@camstack/addon-admin-ui 1.2.678 → 1.2.680
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/CHANGELOG.md +16 -0
- package/dist/assets/Addons-CbMQ6QOZ.js +5 -0
- package/dist/assets/{AdminPage-BEQJlUNo.js → AdminPage-DfT8N7Bl.js} +1 -1
- package/dist/assets/{AdminSectionedPage-C7Nx9jJl.js → AdminSectionedPage-CpcwVaPi.js} +1 -1
- package/dist/assets/{AiProfiles-D4eTx94W.js → AiProfiles-CO02Pe8C.js} +2 -2
- package/dist/assets/{BootstrapSettingsForm-C8SgY-gH.js → BootstrapSettingsForm-I_pzlg37.js} +1 -1
- package/dist/assets/Build-BjVdqRW2.js +42 -0
- package/dist/assets/{Calendars-CngFbuGP.js → Calendars-POqrL2K5.js} +1 -1
- package/dist/assets/{CameraGrids-BI3PYGPr.js → CameraGrids-D3AIHu1F.js} +1 -1
- package/dist/assets/Cluster-BsA55loF.js +1 -0
- package/dist/assets/CompositionBlockEditor-B9Dfae1t.js +2 -0
- package/dist/assets/{CompositionEditorPage-C56ErWVZ.js → CompositionEditorPage-DkZ7A2su.js} +1 -1
- package/dist/assets/Data-BFSr2kfu.js +2 -0
- package/dist/assets/DeviceDetail-na0OsrsC.js +2 -0
- package/dist/assets/{Devices-ByKU7OhR.js → Devices-PYzlrYFi.js} +1 -1
- package/dist/assets/{EmbedDevicePage-CUljYRrr.js → EmbedDevicePage-QfJaH9et.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-BM7zhcWx.js → EmbedPlayerPage-ChsM6fwV.js} +1 -1
- package/dist/assets/{History-BCQ4IrRD.js → History-Bdz_0QAJ.js} +1 -1
- package/dist/assets/Identity-CRHUOPkL.js +1 -0
- package/dist/assets/{InstancesTable-CriEfrMJ.js → InstancesTable-YQdXCtaA.js} +1 -1
- package/dist/assets/{IntegrationDetail-BCP8mmgO.js → IntegrationDetail-gc_y7FHB.js} +1 -1
- package/dist/assets/{Integrations-Bqcvm_Qf.js → Integrations-Dlfm_5eM.js} +2 -2
- package/dist/assets/{Integrations-C30eE4UB.js → Integrations-nPzZ9j6g.js} +1 -1
- package/dist/assets/Library-DLR5ijVt.js +1 -0
- package/dist/assets/Locations-BpAIZ5Q8.js +3 -0
- package/dist/assets/{Logs-DKDr8AuB.js → Logs-BgeE52Vx.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-DbmWEEiO.js → MaskShapeCanvas-BN-PRLjb.js} +1 -1
- package/dist/assets/{MotionZonesSettings-BzScgedh.js → MotionZonesSettings-D9Prrwl-.js} +1 -1
- package/dist/assets/{MyAccess-CzfNmMJl.js → MyAccess-By6dpree.js} +1 -1
- package/dist/assets/{Network-CAbg7ZpT.js → Network-DJ3mA02D.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-DTkQMaBn.js → NodeAddonsSettingsPanel-CPSGG58L.js} +1 -1
- package/dist/assets/Notifications-Dw06-CPi.js +1 -0
- package/dist/assets/Pipeline-Ciwjdo9n.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-DgBQuyh9.js → PrivacyMaskSettings-uNqMIBUf.js} +1 -1
- package/dist/assets/{Recordings-BlCEAKse.js → Recordings-DejfD-rw.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-D5OLGtBI.js → SceneMonitorEditor-Dd67GOFm.js} +1 -1
- package/dist/assets/{ServerShell-CSTjFsEJ.js → ServerShell-XefvzbRy.js} +1 -1
- package/dist/assets/{SessionsList-C1Ao7w_G.js → SessionsList-B80DJWoE.js} +2 -2
- package/dist/assets/{Showroom-DCYRjXXW.js → Showroom-CRsxAvxN.js} +1 -1
- package/dist/assets/{StorageLocationsTable-BfwKi6fr.js → StorageLocationsTable-x4CVbzbw.js} +1 -1
- package/dist/assets/{System-BvNJMfpW.js → System-Cd2nwJE8.js} +1 -1
- package/dist/assets/{Terminal-DQ5u6n8f.js → Terminal-Y4RMF5FN.js} +2 -2
- package/dist/assets/{TerminalPanel-DC4Fs74K.js → TerminalPanel-DRRt2yqB.js} +1 -1
- package/dist/assets/{TrainingProviders-D6bLgYi2.js → TrainingProviders-BeskzFPx.js} +1 -1
- package/dist/assets/{Viewer-BmamcoHc.js → Viewer-CkH9wbpr.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DcrAwx-L.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BOfg6zTM.js} +1 -1
- package/dist/assets/{action-draft-Dr5Q1lmk.js → action-draft-DgC3sdIv.js} +1 -1
- package/dist/assets/{ai-page.helpers-AOJOCF6H.js → ai-page.helpers-BGxGEY-d.js} +1 -1
- package/dist/assets/{assignment-candidates-BYfez7Z_.js → assignment-candidates-DeoBl894.js} +1 -1
- package/dist/assets/{authed-media-DaaHSoAj.js → authed-media-CG5cnS5J.js} +1 -1
- package/dist/assets/{board-model-COsjkU2L.js → board-model-C2Tzni7-.js} +1 -1
- package/dist/assets/client-B0p6WiZb.js +1120 -0
- package/dist/assets/{command-vocab-wRSfGsbG.js → command-vocab-DNAnc4zd.js} +1 -1
- package/dist/assets/{device-detail-CT3Wq2MX.js → device-detail-BnrDlPnk.js} +1 -1
- package/dist/assets/{device-integration-icon-CK7ULj84.js → device-integration-icon-jRlZnIlZ.js} +1 -1
- package/dist/assets/device-picker-model-gF32i0sF.js +1 -0
- package/dist/assets/{dist-BnzMSUv0.js → dist-BZGaAsKc.js} +1 -1
- package/dist/assets/dist-auYATUda.js +1120 -0
- package/dist/assets/{format-Fw8MrMCF.js → format-YT7IgtG9.js} +1 -1
- package/dist/assets/{hostInit-BHV5j57a.js → hostInit-DcxonsQJ.js} +1 -1
- package/dist/assets/i18n-NPZM0HGc.js +1 -0
- package/dist/assets/icons-f0SVFd9I.js +1 -0
- package/dist/assets/index-CkPnVqy7.js +4 -0
- package/dist/assets/{linked-devices-model-BRVCcL_i.js → linked-devices-model-EHzqFFKo.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-65134e91.js → mf-entry-bootstrap-0-35098dbd.js} +2 -2
- package/dist/assets/mount-gF32i0sF.js +1 -0
- package/dist/assets/{notification-rule-status-tbLfUZee.js → notification-rule-status-BRCNbkxe.js} +1 -1
- package/dist/assets/{player-overlays-8aC2r-sd.js → player-overlays-ClFSGefV.js} +1 -1
- package/dist/assets/remoteEntry-DQV7Iljf.js +1 -0
- package/dist/assets/src-1hzzyrfp.js +279 -0
- package/dist/assets/{sso-popup-C_VTtoWT.js → sso-popup-Bxcrh_Ga.js} +1 -1
- package/dist/assets/{step-inspector-model-UadKxnLr.js → step-inspector-model-FH8OnNrR.js} +1 -1
- package/dist/assets/{use-scenes-feed-D3bzrMKu.js → use-scenes-feed-CV_7Z6wY.js} +1 -1
- package/dist/assets/{use-stationary-objects-Yw5gdlLl.js → use-stationary-objects-Dt0C-TIU.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-WQ4NaouA.js → useAdminDeviceRemoval-N5ijtZ-Z.js} +1 -1
- package/dist/assets/useEventInvalidation-gF32i0sF.js +1 -0
- package/dist/assets/{useNodeUrlSelection-BSpn8JLz.js → useNodeUrlSelection-ZwCw4opF.js} +1 -1
- package/dist/assets/useTemplateSave-KMK9W_j4.js +1 -0
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CTvMo-Za.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-C0iz7ghi.js} +2 -2
- package/dist/index.html +8 -8
- package/dist/server/addon.js +1500 -1078
- package/package.json +2 -2
- package/dist/assets/Addons-DKOUsYsk.js +0 -5
- package/dist/assets/Build-BuGJWdUz.js +0 -42
- package/dist/assets/Cluster-DMkIzva9.js +0 -1
- package/dist/assets/CompositionBlockEditor-BlkVIJir.js +0 -2
- package/dist/assets/Data-D-7IMZzp.js +0 -2
- package/dist/assets/DeviceDetail-CATQ56bt.js +0 -2
- package/dist/assets/Identity-D60Odj5F.js +0 -1
- package/dist/assets/Library-BbXKoa8Z.js +0 -1
- package/dist/assets/Locations-DM8nnzTd.js +0 -3
- package/dist/assets/Notifications-BnUmb5Cg.js +0 -1
- package/dist/assets/Pipeline-SaA7yA5Z.js +0 -1
- package/dist/assets/client-LrzN1ATZ.js +0 -1119
- package/dist/assets/device-picker-model-BaM_HHUO.js +0 -1
- package/dist/assets/dist-p9ea9Hzu.js +0 -1119
- package/dist/assets/i18n-DWjQ9UFE.js +0 -1
- package/dist/assets/icons-Dfx79nBH.js +0 -1
- package/dist/assets/index-BsPM4J54.js +0 -4
- package/dist/assets/mount-BaM_HHUO.js +0 -1
- package/dist/assets/remoteEntry-DuqtB7i9.js +0 -1
- package/dist/assets/src-D5UhvHcp.js +0 -279
- package/dist/assets/useEventInvalidation-BaM_HHUO.js +0 -1
- package/dist/assets/useTemplateSave-CVoxjtyr.js +0 -1
package/dist/server/addon.js
CHANGED
|
@@ -5943,7 +5943,7 @@ var ZodIssueCode = {
|
|
|
5943
5943
|
var ZodFirstPartyTypeKind;
|
|
5944
5944
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5945
5945
|
//#endregion
|
|
5946
|
-
//#region ../types/dist/sleep-
|
|
5946
|
+
//#region ../types/dist/sleep-C9EWTQr9.mjs
|
|
5947
5947
|
/**
|
|
5948
5948
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5949
5949
|
* window to float samples (D455).
|
|
@@ -18674,6 +18674,10 @@ var CAP_VOCABULARY_BY_NAME = {
|
|
|
18674
18674
|
scope: "system",
|
|
18675
18675
|
notOperatorFacing: "cluster administration — nodes, server package, metrics"
|
|
18676
18676
|
},
|
|
18677
|
+
"tags": {
|
|
18678
|
+
scope: "system",
|
|
18679
|
+
notOperatorFacing: "tags are managed from the tag picker and the tags manager, not actuated"
|
|
18680
|
+
},
|
|
18677
18681
|
"template": {
|
|
18678
18682
|
scope: "system",
|
|
18679
18683
|
notOperatorFacing: "operator-authored templates — edited in their own editor, never actuated"
|
|
@@ -19092,6 +19096,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
19092
19096
|
"stream-signals",
|
|
19093
19097
|
"switch",
|
|
19094
19098
|
"system",
|
|
19099
|
+
"tags",
|
|
19095
19100
|
"tamper",
|
|
19096
19101
|
"temperature-sensor",
|
|
19097
19102
|
"template",
|
|
@@ -22868,6 +22873,293 @@ function tryConvertUnit(value, from, to) {
|
|
|
22868
22873
|
return fromCanonical(toCanonical(value, fromSpec), toSpec);
|
|
22869
22874
|
}
|
|
22870
22875
|
//#endregion
|
|
22876
|
+
//#region ../types/dist/device-template-catalogue.mjs
|
|
22877
|
+
/**
|
|
22878
|
+
* The one catalogue of what a device template may name (D1021, D1029).
|
|
22879
|
+
*
|
|
22880
|
+
* Filters, the `range` global and the reserved names (`now`, `camera`, the
|
|
22881
|
+
* caller's recognition values) are listed here. The grammar's allow-list and
|
|
22882
|
+
* argument caps are derived from this module; nothing else keeps a second list.
|
|
22883
|
+
* The renderer imports this module through the
|
|
22884
|
+
* `@camstack/types/device-template-catalogue` subpath, never the types barrel
|
|
22885
|
+
* (D453), and sends the derived caps to the worker. The worker does not import it.
|
|
22886
|
+
*/
|
|
22887
|
+
var DEVICE_TEMPLATE_CATALOGUE_KINDS = [
|
|
22888
|
+
"filter",
|
|
22889
|
+
"global",
|
|
22890
|
+
"variable"
|
|
22891
|
+
];
|
|
22892
|
+
var DEVICE_TEMPLATE_CATALOGUE_CATEGORIES = [
|
|
22893
|
+
"number",
|
|
22894
|
+
"unit",
|
|
22895
|
+
"text",
|
|
22896
|
+
"state",
|
|
22897
|
+
"time",
|
|
22898
|
+
"fallback",
|
|
22899
|
+
"loop",
|
|
22900
|
+
"variable"
|
|
22901
|
+
];
|
|
22902
|
+
var deviceTemplateParamSchema = object({
|
|
22903
|
+
name: string().min(1),
|
|
22904
|
+
type: _enum([
|
|
22905
|
+
"string",
|
|
22906
|
+
"number",
|
|
22907
|
+
"boolean"
|
|
22908
|
+
]),
|
|
22909
|
+
optional: boolean(),
|
|
22910
|
+
default: union([
|
|
22911
|
+
string(),
|
|
22912
|
+
number$1(),
|
|
22913
|
+
boolean()
|
|
22914
|
+
]).optional()
|
|
22915
|
+
});
|
|
22916
|
+
object({
|
|
22917
|
+
name: string().min(1),
|
|
22918
|
+
kind: _enum(DEVICE_TEMPLATE_CATALOGUE_KINDS),
|
|
22919
|
+
category: _enum(DEVICE_TEMPLATE_CATALOGUE_CATEGORIES),
|
|
22920
|
+
params: array(deviceTemplateParamSchema),
|
|
22921
|
+
descriptionKey: string().min(1),
|
|
22922
|
+
exampleKey: string().min(1)
|
|
22923
|
+
});
|
|
22924
|
+
function param(name, type, optional, fallback) {
|
|
22925
|
+
return fallback === void 0 ? {
|
|
22926
|
+
name,
|
|
22927
|
+
type,
|
|
22928
|
+
optional
|
|
22929
|
+
} : {
|
|
22930
|
+
name,
|
|
22931
|
+
type,
|
|
22932
|
+
optional,
|
|
22933
|
+
default: fallback
|
|
22934
|
+
};
|
|
22935
|
+
}
|
|
22936
|
+
function entry(name, kind, category, params) {
|
|
22937
|
+
return {
|
|
22938
|
+
name,
|
|
22939
|
+
kind,
|
|
22940
|
+
category,
|
|
22941
|
+
params: [...params],
|
|
22942
|
+
descriptionKey: `uiLibrary.deviceTemplateCatalogue.${name}.description`,
|
|
22943
|
+
exampleKey: `uiLibrary.deviceTemplateCatalogue.${name}.example`
|
|
22944
|
+
};
|
|
22945
|
+
}
|
|
22946
|
+
var DIGITS = param("digits", "number", true, 0);
|
|
22947
|
+
var FALLBACK_TEXT = param("fallback", "string", false);
|
|
22948
|
+
var FALSY = param("falsy", "boolean", true, false);
|
|
22949
|
+
/** Every name the engine allows, in the order operators meet them. */
|
|
22950
|
+
var DEVICE_TEMPLATE_CATALOGUE = [
|
|
22951
|
+
entry("unit", "filter", "unit", [param("symbol", "string", false), param("from", "string", true)]),
|
|
22952
|
+
entry("round", "filter", "number", [DIGITS]),
|
|
22953
|
+
entry("trunc", "filter", "number", [DIGITS]),
|
|
22954
|
+
entry("onoff", "filter", "state", []),
|
|
22955
|
+
entry("default", "filter", "fallback", [FALLBACK_TEXT, FALSY]),
|
|
22956
|
+
entry("since", "filter", "time", []),
|
|
22957
|
+
entry("ago", "filter", "time", []),
|
|
22958
|
+
entry("format", "filter", "text", [param("pattern", "string", false)]),
|
|
22959
|
+
entry("upper", "filter", "text", []),
|
|
22960
|
+
entry("lower", "filter", "text", []),
|
|
22961
|
+
entry("title", "filter", "text", []),
|
|
22962
|
+
entry("capitalize", "filter", "text", []),
|
|
22963
|
+
entry("trim", "filter", "text", []),
|
|
22964
|
+
entry("abs", "filter", "number", []),
|
|
22965
|
+
entry("int", "filter", "number", [param("fallback", "number", true, 0)]),
|
|
22966
|
+
entry("float", "filter", "number", [param("fallback", "number", true, 0)]),
|
|
22967
|
+
entry("length", "filter", "text", []),
|
|
22968
|
+
entry("d", "filter", "fallback", [FALLBACK_TEXT, FALSY]),
|
|
22969
|
+
entry("join", "filter", "text", [param("separator", "string", true, "")]),
|
|
22970
|
+
entry("replace", "filter", "text", [
|
|
22971
|
+
param("old", "string", false),
|
|
22972
|
+
param("new", "string", false),
|
|
22973
|
+
param("count", "number", true)
|
|
22974
|
+
]),
|
|
22975
|
+
entry("first", "filter", "loop", []),
|
|
22976
|
+
entry("last", "filter", "loop", []),
|
|
22977
|
+
entry("sort", "filter", "loop", [param("reverse", "boolean", true, false), param("caseSensitive", "boolean", true, false)]),
|
|
22978
|
+
entry("reverse", "filter", "loop", []),
|
|
22979
|
+
entry("sum", "filter", "number", []),
|
|
22980
|
+
entry("string", "filter", "text", []),
|
|
22981
|
+
entry("list", "filter", "loop", []),
|
|
22982
|
+
entry("truncate", "filter", "text", [
|
|
22983
|
+
param("length", "number", false),
|
|
22984
|
+
param("killwords", "boolean", true, false),
|
|
22985
|
+
param("end", "string", true, "…")
|
|
22986
|
+
]),
|
|
22987
|
+
entry("time", "filter", "time", [param("pattern", "string", false)]),
|
|
22988
|
+
entry("range", "global", "loop", [
|
|
22989
|
+
param("stop", "number", false),
|
|
22990
|
+
param("start", "number", true, 0),
|
|
22991
|
+
param("step", "number", true, 1)
|
|
22992
|
+
]),
|
|
22993
|
+
entry("now", "variable", "time", []),
|
|
22994
|
+
entry("camera", "variable", "variable", []),
|
|
22995
|
+
entry("loop", "variable", "loop", []),
|
|
22996
|
+
entry("lastPerson", "variable", "variable", []),
|
|
22997
|
+
entry("lastPlate", "variable", "variable", [])
|
|
22998
|
+
];
|
|
22999
|
+
var COPY = {
|
|
23000
|
+
unit: {
|
|
23001
|
+
description: ["Converts a number from the field’s base unit and prints the symbol.", "Converte un numero dall’unità di base del campo e stampa il simbolo."],
|
|
23002
|
+
example: ["{{ garage.temperature | unit('°C') }}", "{{ garage.temperature | unit('°C') }}"]
|
|
23003
|
+
},
|
|
23004
|
+
round: {
|
|
23005
|
+
description: ["Rounds a number to the given decimals.", "Arrotonda un numero ai decimali indicati."],
|
|
23006
|
+
example: ["{{ garage.temperature | round(1) }}", "{{ garage.temperature | round(1) }}"]
|
|
23007
|
+
},
|
|
23008
|
+
trunc: {
|
|
23009
|
+
description: ["Cuts decimals toward zero, without rounding.", "Taglia i decimali verso zero, senza arrotondare."],
|
|
23010
|
+
example: ["{{ garage.temperature | trunc(1) }}", "{{ garage.temperature | trunc(1) }}"]
|
|
23011
|
+
},
|
|
23012
|
+
onoff: {
|
|
23013
|
+
description: ["Prints a boolean as ON or OFF.", "Stampa un sì/no come ON oppure OFF."],
|
|
23014
|
+
example: ["{{ garage.switch | onoff }}", "{{ garage.switch | onoff }}"]
|
|
23015
|
+
},
|
|
23016
|
+
default: {
|
|
23017
|
+
description: ["Replaces a missing value. The second argument also replaces a false or zero.", "Sostituisce un valore assente. Il secondo argomento sostituisce anche falso o zero."],
|
|
23018
|
+
example: ["{{ camera.lastPerson | default('') }}", "{{ camera.lastPerson | default('') }}"]
|
|
23019
|
+
},
|
|
23020
|
+
since: {
|
|
23021
|
+
description: ["How long ago a timestamp was, as “5 min”.", "Quanto tempo fa era un istante, come «5 min»."],
|
|
23022
|
+
example: ["{{ garage.updated | since }}", "{{ garage.updated | since }}"]
|
|
23023
|
+
},
|
|
23024
|
+
ago: {
|
|
23025
|
+
description: ["The same duration as since, followed by “ago”.", "La stessa durata di since, seguita da «ago»."],
|
|
23026
|
+
example: ["{{ garage.updated | ago }}", "{{ garage.updated | ago }}"]
|
|
23027
|
+
},
|
|
23028
|
+
format: {
|
|
23029
|
+
description: ["Prints one value with a single %s, %d or %.Nf placeholder.", "Stampa un valore con un solo segnaposto %s, %d o %.Nf."],
|
|
23030
|
+
example: ["{{ garage.temperature | format('%.1f') }}", "{{ garage.temperature | format('%.1f') }}"]
|
|
23031
|
+
},
|
|
23032
|
+
upper: {
|
|
23033
|
+
description: ["Uppercase text.", "Testo in maiuscolo."],
|
|
23034
|
+
example: ["{{ camera.lastPerson | upper }}", "{{ camera.lastPerson | upper }}"]
|
|
23035
|
+
},
|
|
23036
|
+
lower: {
|
|
23037
|
+
description: ["Lowercase text.", "Testo in minuscolo."],
|
|
23038
|
+
example: ["{{ camera.lastPlate | lower }}", "{{ camera.lastPlate | lower }}"]
|
|
23039
|
+
},
|
|
23040
|
+
title: {
|
|
23041
|
+
description: ["Capitalises each word.", "Mette la maiuscola a ogni parola."],
|
|
23042
|
+
example: ["{{ camera.lastPerson | title }}", "{{ camera.lastPerson | title }}"]
|
|
23043
|
+
},
|
|
23044
|
+
capitalize: {
|
|
23045
|
+
description: ["Capitalises the first letter.", "Mette la maiuscola alla prima lettera."],
|
|
23046
|
+
example: ["{{ camera.lastPerson | capitalize }}", "{{ camera.lastPerson | capitalize }}"]
|
|
23047
|
+
},
|
|
23048
|
+
trim: {
|
|
23049
|
+
description: ["Removes spaces at both ends.", "Toglie gli spazi alle estremità."],
|
|
23050
|
+
example: ["{{ camera.lastPerson | trim }}", "{{ camera.lastPerson | trim }}"]
|
|
23051
|
+
},
|
|
23052
|
+
abs: {
|
|
23053
|
+
description: ["The absolute value of a number.", "Il valore assoluto di un numero."],
|
|
23054
|
+
example: ["{{ garage.power | abs }}", "{{ garage.power | abs }}"]
|
|
23055
|
+
},
|
|
23056
|
+
int: {
|
|
23057
|
+
description: ["The whole part of a number.", "La parte intera di un numero."],
|
|
23058
|
+
example: ["{{ garage.temperature | int }}", "{{ garage.temperature | int }}"]
|
|
23059
|
+
},
|
|
23060
|
+
float: {
|
|
23061
|
+
description: ["Reads the value as a decimal number.", "Legge il valore come numero decimale."],
|
|
23062
|
+
example: ["{{ garage.temperature | float }}", "{{ garage.temperature | float }}"]
|
|
23063
|
+
},
|
|
23064
|
+
length: {
|
|
23065
|
+
description: ["How many characters or items.", "Quanti caratteri o elementi."],
|
|
23066
|
+
example: ["{{ camera.lastPerson | length }}", "{{ camera.lastPerson | length }}"]
|
|
23067
|
+
},
|
|
23068
|
+
d: {
|
|
23069
|
+
description: ["The short name of default.", "Il nome breve di default."],
|
|
23070
|
+
example: ["{{ camera.lastPerson | d('') }}", "{{ camera.lastPerson | d('') }}"]
|
|
23071
|
+
},
|
|
23072
|
+
join: {
|
|
23073
|
+
description: ["Joins a list with a separator.", "Unisce un elenco con un separatore."],
|
|
23074
|
+
example: ["{{ range(3) | join(', ') }}", "{{ range(3) | join(', ') }}"]
|
|
23075
|
+
},
|
|
23076
|
+
replace: {
|
|
23077
|
+
description: ["Replaces text, optionally only the first few times.", "Sostituisce del testo, volendo solo le prime volte."],
|
|
23078
|
+
example: ["{{ camera.lastPlate | replace(' ', '') }}", "{{ camera.lastPlate | replace(' ', '') }}"]
|
|
23079
|
+
},
|
|
23080
|
+
first: {
|
|
23081
|
+
description: ["The first item of a list.", "Il primo elemento di un elenco."],
|
|
23082
|
+
example: ["{{ range(3) | first }}", "{{ range(3) | first }}"]
|
|
23083
|
+
},
|
|
23084
|
+
last: {
|
|
23085
|
+
description: ["The last item of a list.", "L’ultimo elemento di un elenco."],
|
|
23086
|
+
example: ["{{ range(3) | last }}", "{{ range(3) | last }}"]
|
|
23087
|
+
},
|
|
23088
|
+
sort: {
|
|
23089
|
+
description: ["Sorts a list. The arguments reverse it or keep case.", "Ordina un elenco. Gli argomenti lo invertono o rispettano le maiuscole."],
|
|
23090
|
+
example: ["{{ range(3) | reverse | sort }}", "{{ range(3) | reverse | sort }}"]
|
|
23091
|
+
},
|
|
23092
|
+
reverse: {
|
|
23093
|
+
description: ["Reverses a list.", "Inverte un elenco."],
|
|
23094
|
+
example: ["{{ range(3) | reverse }}", "{{ range(3) | reverse }}"]
|
|
23095
|
+
},
|
|
23096
|
+
sum: {
|
|
23097
|
+
description: ["Adds the numbers in a list.", "Somma i numeri di un elenco."],
|
|
23098
|
+
example: ["{{ range(3) | sum }}", "{{ range(3) | sum }}"]
|
|
23099
|
+
},
|
|
23100
|
+
string: {
|
|
23101
|
+
description: ["Prints the value as text.", "Stampa il valore come testo."],
|
|
23102
|
+
example: ["{{ garage.temperature | string }}", "{{ garage.temperature | string }}"]
|
|
23103
|
+
},
|
|
23104
|
+
list: {
|
|
23105
|
+
description: ["Wraps the value in a list.", "Mette il valore in un elenco."],
|
|
23106
|
+
example: ["{{ garage.temperature | list }}", "{{ garage.temperature | list }}"]
|
|
23107
|
+
},
|
|
23108
|
+
truncate: {
|
|
23109
|
+
description: ["Shortens text to a length, with an ending.", "Accorcia il testo a una lunghezza, con una chiusura."],
|
|
23110
|
+
example: ["{{ camera.lastPerson | truncate(12) }}", "{{ camera.lastPerson | truncate(12) }}"]
|
|
23111
|
+
},
|
|
23112
|
+
time: {
|
|
23113
|
+
description: ["Prints a timestamp in the server’s time zone. Tokens: YYYY MM DD HH mm ss.", "Stampa un istante nel fuso del server. Segni: YYYY MM DD HH mm ss."],
|
|
23114
|
+
example: ["{{ now | time('HH:mm') }}", "{{ now | time('HH:mm') }}"]
|
|
23115
|
+
},
|
|
23116
|
+
range: {
|
|
23117
|
+
description: ["The integers up to stop, or from start to stop by step. At most 1000 items.", "Gli interi fino a stop, oppure da start a stop con step. Al massimo 1000 elementi."],
|
|
23118
|
+
example: ["{% for i in range(3) %}{{ i }}{% endfor %}", "{% for i in range(3) %}{{ i }}{% endfor %}"]
|
|
23119
|
+
},
|
|
23120
|
+
now: {
|
|
23121
|
+
description: ["The hub clock. A bare now prints ISO; time prints a pattern.", "L’orologio dell’hub. now da solo stampa ISO; time stampa un formato."],
|
|
23122
|
+
example: ["{{ now | time('HH:mm') }}", "{{ now | time('HH:mm') }}"]
|
|
23123
|
+
},
|
|
23124
|
+
camera: {
|
|
23125
|
+
description: ["The device this text is written for. It stays correct when the text is copied to another camera.", "Il dispositivo per cui è scritto il testo. Resta corretto se il testo viene copiato su un’altra telecamera."],
|
|
23126
|
+
example: ["{{ camera.temperature }}", "{{ camera.temperature }}"]
|
|
23127
|
+
},
|
|
23128
|
+
loop: {
|
|
23129
|
+
description: ["The for-loop counter (index, length) inside {% for %}.", "Il contatore del ciclo (index, length) dentro {% for %}."],
|
|
23130
|
+
example: ["{% for i in range(3) %}{{ loop.index }}{% endfor %}", "{% for i in range(3) %}{{ loop.index }}{% endfor %}"]
|
|
23131
|
+
},
|
|
23132
|
+
lastPerson: {
|
|
23133
|
+
description: ["The last person recognised on this camera, empty until there is one.", "L’ultima persona riconosciuta su questa telecamera, vuota finché non ce n’è una."],
|
|
23134
|
+
example: ["{{ camera.lastPerson }}", "{{ camera.lastPerson }}"]
|
|
23135
|
+
},
|
|
23136
|
+
lastPlate: {
|
|
23137
|
+
description: ["The last plate recognised on this camera, empty until there is one.", "L’ultima targa riconosciuta su questa telecamera, vuota finché non ce n’è una."],
|
|
23138
|
+
example: ["{{ camera.lastPlate }}", "{{ camera.lastPlate }}"]
|
|
23139
|
+
}
|
|
23140
|
+
};
|
|
23141
|
+
function buildText() {
|
|
23142
|
+
const out = {};
|
|
23143
|
+
for (const item of DEVICE_TEMPLATE_CATALOGUE) {
|
|
23144
|
+
const row = COPY[item.name];
|
|
23145
|
+
if (row === void 0) continue;
|
|
23146
|
+
out[item.descriptionKey] = {
|
|
23147
|
+
en: row.description[0],
|
|
23148
|
+
it: row.description[1]
|
|
23149
|
+
};
|
|
23150
|
+
out[item.exampleKey] = {
|
|
23151
|
+
en: row.example[0],
|
|
23152
|
+
it: row.example[1]
|
|
23153
|
+
};
|
|
23154
|
+
}
|
|
23155
|
+
return out;
|
|
23156
|
+
}
|
|
23157
|
+
buildText();
|
|
23158
|
+
/** Names a template may use after `|`. Order matches the catalogue. */
|
|
23159
|
+
function deviceTemplateFilterNames() {
|
|
23160
|
+
return DEVICE_TEMPLATE_CATALOGUE.filter((item) => item.kind === "filter").map((item) => item.name);
|
|
23161
|
+
}
|
|
23162
|
+
//#endregion
|
|
22871
23163
|
//#region ../types/dist/index.mjs
|
|
22872
23164
|
var SMTP_INBOUND_DEFAULT_PORT = 2525;
|
|
22873
23165
|
var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
|
|
@@ -26453,1012 +26745,51 @@ var LogChannelWindowSchema = object({
|
|
|
26453
26745
|
/** `null` = every camera. A non-empty list narrows to those numeric ids. */
|
|
26454
26746
|
deviceIds: array(number$1().int()).readonly().nullable()
|
|
26455
26747
|
});
|
|
26456
|
-
|
|
26457
|
-
|
|
26458
|
-
|
|
26459
|
-
|
|
26460
|
-
|
|
26461
|
-
|
|
26462
|
-
|
|
26463
|
-
|
|
26464
|
-
|
|
26465
|
-
|
|
26466
|
-
|
|
26467
|
-
|
|
26468
|
-
|
|
26469
|
-
|
|
26470
|
-
|
|
26471
|
-
|
|
26472
|
-
|
|
26473
|
-
|
|
26474
|
-
|
|
26475
|
-
|
|
26476
|
-
|
|
26477
|
-
|
|
26478
|
-
|
|
26479
|
-
|
|
26480
|
-
|
|
26481
|
-
|
|
26482
|
-
|
|
26483
|
-
|
|
26484
|
-
|
|
26485
|
-
|
|
26486
|
-
|
|
26487
|
-
|
|
26488
|
-
"
|
|
26489
|
-
"
|
|
26490
|
-
"
|
|
26491
|
-
|
|
26492
|
-
|
|
26493
|
-
|
|
26494
|
-
"
|
|
26495
|
-
"
|
|
26496
|
-
"
|
|
26497
|
-
|
|
26498
|
-
|
|
26499
|
-
|
|
26500
|
-
|
|
26501
|
-
* Steps whose per-detection MASK a root detection can carry (D737). The live
|
|
26502
|
-
* mask step is `segmentation` — a frame-plane refiner that runs its own model
|
|
26503
|
-
* once per detection crop. (`instance-segmentation` is a dormant step id that
|
|
26504
|
-
* no camera tree carries.)
|
|
26505
|
-
*/
|
|
26506
|
-
var MASK_SUPPLY_STEP_IDS = ["segmentation"];
|
|
26507
|
-
[
|
|
26508
|
-
...LABEL_SUPPLY_STEP_IDS,
|
|
26509
|
-
...CROP_SUPPLY_STEP_IDS,
|
|
26510
|
-
...MASK_SUPPLY_STEP_IDS
|
|
26511
|
-
];
|
|
26512
|
-
/**
|
|
26513
|
-
* Multi-file format payload.
|
|
26514
|
-
*
|
|
26515
|
-
* - Directory formats (`isDirectory: true`, e.g. `.mlpackage`): files
|
|
26516
|
-
* relative to the directory root — the downloader fetches each from
|
|
26517
|
-
* `{url}/{file}` into `{modelDir}/{file}`. If omitted, it probes the
|
|
26518
|
-
* HuggingFace API (slower).
|
|
26519
|
-
* - Single-file formats (no `isDirectory`, e.g. OpenVINO IR): sibling
|
|
26520
|
-
* files fetched from the SAME remote directory as `url` and stored flat
|
|
26521
|
-
* alongside the main file — e.g. `['camstack-yolov9t.bin']` for the IR
|
|
26522
|
-
* weights next to `camstack-yolov9t.xml`.
|
|
26523
|
-
*/
|
|
26524
|
-
var ModelFormatEntrySchema = object({
|
|
26525
|
-
url: string(),
|
|
26526
|
-
sizeMB: number$1(),
|
|
26527
|
-
/** Whether this format is a directory bundle (e.g., .mlpackage) rather than a single file */
|
|
26528
|
-
isDirectory: boolean().optional(),
|
|
26529
|
-
/** Multi-file payload (directory members or sibling files). */
|
|
26530
|
-
files: array(string()).readonly().optional(),
|
|
26531
|
-
/** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
|
|
26532
|
-
runtimes: array(_enum(["python"])).readonly().optional(),
|
|
26533
|
-
/**
|
|
26534
|
-
* Content revision of the artefact, for one hosted OFF the CamStack mirror.
|
|
26535
|
-
* A format on the mirror leaves it unset: its revision (the sha256 of its
|
|
26536
|
-
* weight file) comes from the downloader's generated table, kept in step
|
|
26537
|
-
* with the mirror by `scripts/check-hosted-model-revisions.ts` (D744). A
|
|
26538
|
-
* node records the revision it downloaded next to the file
|
|
26539
|
-
* (`<file>.revision`); a copy with no record or a different one is stale
|
|
26540
|
-
* unless its weight file hashes to the revision, and a stale copy is
|
|
26541
|
-
* downloaded again, the old one serving until the new one is complete. No
|
|
26542
|
-
* revision at all ⇒ a file on disk is current, whatever it holds (D743).
|
|
26543
|
-
*/
|
|
26544
|
-
revision: string().min(1).optional()
|
|
26545
|
-
});
|
|
26546
|
-
/**
|
|
26547
|
-
* What a node holds for one (model, format) (D746). `current` is a complete
|
|
26548
|
-
* copy at its catalog revision — exactly what `downloaded: true` means.
|
|
26549
|
-
* `stale` is bytes on disk that are not (yet) proven current under D743/D744:
|
|
26550
|
-
* no or a different revision record, or a missing sibling. `missing` is no
|
|
26551
|
-
* copy. `downloaded` alone folds `stale` into "not downloaded", which hid
|
|
26552
|
-
* reclaimable bytes and a copy about to be replaced.
|
|
26553
|
-
*/
|
|
26554
|
-
var ModelOnDiskStateSchema = _enum([
|
|
26555
|
-
"current",
|
|
26556
|
-
"stale",
|
|
26557
|
-
"missing"
|
|
26558
|
-
]);
|
|
26559
|
-
/**
|
|
26560
|
-
* The numeric precision of one format's BUILD (D746) — reported only when the
|
|
26561
|
-
* build states it (file-name token, an INT8 variant, an EdgeTPU compile, a
|
|
26562
|
-
* CamStack Core ML export). Absent means "not stated", never "fp32".
|
|
26563
|
-
*/
|
|
26564
|
-
var ModelFormatPrecisionSchema = _enum([
|
|
26565
|
-
"fp32",
|
|
26566
|
-
"fp16",
|
|
26567
|
-
"int8"
|
|
26568
|
-
]);
|
|
26569
|
-
/**
|
|
26570
|
-
* One format of one model as a node's `pipelineExecutor.getSchema` reports it.
|
|
26571
|
-
* `onDisk` / `precision` are optional for version skew: a runner that predates
|
|
26572
|
-
* them omits them, and a reader falls back to `downloaded`.
|
|
26573
|
-
*/
|
|
26574
|
-
var PipelineModelFormatStatusSchema = object({
|
|
26575
|
-
downloaded: boolean(),
|
|
26576
|
-
sizeMB: number$1(),
|
|
26577
|
-
onDisk: ModelOnDiskStateSchema.optional(),
|
|
26578
|
-
precision: ModelFormatPrecisionSchema.optional()
|
|
26579
|
-
});
|
|
26580
|
-
/**
|
|
26581
|
-
* Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
|
|
26582
|
-
* The downloader fetches from `url` and saves to `{modelsDir}/{filename}`.
|
|
26583
|
-
*/
|
|
26584
|
-
var ModelExtraFileSchema = object({
|
|
26585
|
-
url: string(),
|
|
26586
|
-
filename: string(),
|
|
26587
|
-
sizeMB: number$1()
|
|
26588
|
-
});
|
|
26589
|
-
/**
|
|
26590
|
-
* Per-format payload map. Modelled as an explicit object (one optional key
|
|
26591
|
-
* per `ModelFormat`) rather than `z.record(enum, …)` — zod v4's enum-keyed
|
|
26592
|
-
* record requires every key, but a catalog entry only ships a subset of
|
|
26593
|
-
* formats.
|
|
26594
|
-
*/
|
|
26595
|
-
var ModelFormatsSchema = object({
|
|
26596
|
-
onnx: ModelFormatEntrySchema.optional(),
|
|
26597
|
-
coreml: ModelFormatEntrySchema.optional(),
|
|
26598
|
-
openvino: ModelFormatEntrySchema.optional(),
|
|
26599
|
-
tflite: ModelFormatEntrySchema.optional(),
|
|
26600
|
-
pt: ModelFormatEntrySchema.optional(),
|
|
26601
|
-
gguf: ModelFormatEntrySchema.optional()
|
|
26602
|
-
});
|
|
26603
|
-
/**
|
|
26604
|
-
* Variant-selector grouping axes. Shared by the full `ModelCatalogEntry` and by
|
|
26605
|
-
* the reduced `PipelineModelOption` returned in `pipeline.getSchema()` so the
|
|
26606
|
-
* grouped Family→Tier→Variant picker renders identically in the config UI and
|
|
26607
|
-
* in the pipeline/device steppers. The flat `id` stays the source of truth for
|
|
26608
|
-
* resolution/download/persistence; this is a presentation overlay resolved back
|
|
26609
|
-
* to an `id`.
|
|
26610
|
-
*/
|
|
26611
|
-
var ModelVariantGroupSchema = object({
|
|
26612
|
-
/** Top-level family, e.g. `yolo26` (later `d-fine`, `rf-detr`). */
|
|
26613
|
-
family: string(),
|
|
26614
|
-
/** Size within the family, e.g. `n` | `s` | `m` | `l`. */
|
|
26615
|
-
tier: string(),
|
|
26616
|
-
/** Quantization axis. Omit ⇒ the fp32 base build. */
|
|
26617
|
-
precision: _enum(["fp32", "int8"]).optional(),
|
|
26618
|
-
/**
|
|
26619
|
-
* Training / latency-variant axis. Omit ⇒ the standard build. `test` marks
|
|
26620
|
-
* an alternate training of the same family (plugin catalog `relu_test`); chip
|
|
26621
|
-
* label is "Test".
|
|
26622
|
-
*/
|
|
26623
|
-
optimization: _enum(["standard", "test"]).optional(),
|
|
26624
|
-
/**
|
|
26625
|
-
* Input-resolution axis (square input side, px). Omit ⇒ the family's native
|
|
26626
|
-
* resolution (640 for yolo26). Reduced-input builds (320 / 256) are a big,
|
|
26627
|
-
* cheap latency lever — especially on Apple ANE and the Intel N100 — at a
|
|
26628
|
-
* small-object accuracy cost. Mirrors the model's `inputSize` but lifted onto
|
|
26629
|
-
* the group so the selector can offer it as a variant axis.
|
|
26630
|
-
*/
|
|
26631
|
-
resolution: number$1().int().positive().optional()
|
|
26632
|
-
});
|
|
26633
|
-
var ModelProviderIdSchema = _enum([
|
|
26634
|
-
"camstack",
|
|
26635
|
-
"frigate",
|
|
26636
|
-
"scrypted",
|
|
26637
|
-
"custom"
|
|
26638
|
-
]);
|
|
26639
|
-
/**
|
|
26640
|
-
* The licence of a model, as a record rather than a bare SPDX string: a
|
|
26641
|
-
* permissive CODE licence routinely sits on top of restrictive WEIGHTS or
|
|
26642
|
-
* DATA, and the obligations (attribution, modification notices, source offers)
|
|
26643
|
-
* are per upstream. A persisted custom-model row written when this field was a
|
|
26644
|
-
* string still parses — the string is lifted into `{ weights }`.
|
|
26645
|
-
*
|
|
26646
|
-
* Every machine licence surface (`THIRD_PARTY_MODELS.md`, the Hugging Face
|
|
26647
|
-
* model table) is GENERATED from these records by
|
|
26648
|
-
* `scripts/gen-model-licenses.ts` (D661). Operator-facing docs live in
|
|
26649
|
-
* `camstack/docs` → `/docs/detection/models`.
|
|
26650
|
-
*/
|
|
26651
|
-
var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { weights: value } : value, object({
|
|
26652
|
-
/** SPDX id of the WEIGHTS' terms, a `LicenseRef-*` for non-SPDX terms, or `UNKNOWN`. */
|
|
26653
|
-
weights: string().min(1),
|
|
26654
|
-
/** SPDX id of the upstream code that defines / trained the network. */
|
|
26655
|
-
code: string().min(1).optional(),
|
|
26656
|
-
/** Training data whose terms add obligations (attribution, non-commercial). */
|
|
26657
|
-
data: object({
|
|
26658
|
-
name: string().min(1),
|
|
26659
|
-
terms: string().min(1),
|
|
26660
|
-
url: string().url().optional()
|
|
26661
|
-
}).optional(),
|
|
26662
|
-
/** The project the weights come from. Required on built-in entries (guard). */
|
|
26663
|
-
upstream: object({
|
|
26664
|
-
name: string().min(1),
|
|
26665
|
-
url: string().url()
|
|
26666
|
-
}).optional(),
|
|
26667
|
-
/** Where the licence text governing the weights is published. */
|
|
26668
|
-
url: string().url().optional(),
|
|
26669
|
-
/** Attribution the licence REQUIRES, verbatim. */
|
|
26670
|
-
attribution: string().min(1).optional(),
|
|
26671
|
-
/** What CamStack changed. Required when `hosting` is `camstack-hf` (guard). */
|
|
26672
|
-
modifications: string().min(1).optional(),
|
|
26673
|
-
/** Who serves the file a node downloads. */
|
|
26674
|
-
hosting: _enum([
|
|
26675
|
-
"camstack-hf",
|
|
26676
|
-
"third-party",
|
|
26677
|
-
"built-in"
|
|
26678
|
-
]).optional(),
|
|
26679
|
-
/** True when the weights or their data forbid commercial use. */
|
|
26680
|
-
nonCommercial: boolean().optional()
|
|
26681
|
-
}));
|
|
26682
|
-
/**
|
|
26683
|
-
* One step a ROOT detector can supply from its own output (D730) — see
|
|
26684
|
-
* `ModelCatalogEntry.suppliesSteps`.
|
|
26685
|
-
*
|
|
26686
|
-
* - `label`: the root's raw class IS the step's answer. `labelToEffect` maps
|
|
26687
|
-
* the root's label to the step's vocabulary; `uncovered` is the vocabulary
|
|
26688
|
-
* the root cannot produce (shown as unavailable, never a blocker).
|
|
26689
|
-
* - `crop`: the root draws the box the step would have found (`license_plate`
|
|
26690
|
-
* for plate-detection, `face` for face-detection). The box becomes a detail
|
|
26691
|
-
* child of the `parentMacro` detection that contains it — never a track.
|
|
26692
|
-
* - `mask`: the root's decode emits an instance mask with every detection (a
|
|
26693
|
-
* YOLO26-seg root, D737) — the `segmentation` step's result, carried on the
|
|
26694
|
-
* detection in the shape that step produces. Derived from the model's
|
|
26695
|
-
* postprocessor on read, never stored by an import.
|
|
26696
|
-
*/
|
|
26697
|
-
var RootStepSupplySchema = discriminatedUnion("kind", [
|
|
26698
|
-
object({
|
|
26699
|
-
kind: literal("label"),
|
|
26700
|
-
stepId: _enum(LABEL_SUPPLY_STEP_IDS),
|
|
26701
|
-
labelToEffect: record(string(), string()),
|
|
26702
|
-
uncovered: array(string()).readonly()
|
|
26703
|
-
}),
|
|
26704
|
-
object({
|
|
26705
|
-
kind: literal("crop"),
|
|
26706
|
-
stepId: _enum(CROP_SUPPLY_STEP_IDS),
|
|
26707
|
-
rootLabels: array(string()).readonly(),
|
|
26708
|
-
parentMacro: _enum(["vehicle", "person"]),
|
|
26709
|
-
childClass: _enum(["plate", "face"]),
|
|
26710
|
-
/**
|
|
26711
|
-
* The root's smaller input side, stamped on read by `rootSuppliesOf` from
|
|
26712
|
-
* the model entry — what a step's `minRootInputPx` gate judges. Never
|
|
26713
|
-
* stored by an import.
|
|
26714
|
-
*/
|
|
26715
|
-
rootInputPx: number$1().int().positive().optional()
|
|
26716
|
-
}),
|
|
26717
|
-
object({
|
|
26718
|
-
kind: literal("mask"),
|
|
26719
|
-
stepId: _enum(MASK_SUPPLY_STEP_IDS)
|
|
26720
|
-
})
|
|
26721
|
-
]);
|
|
26722
|
-
var ModelCatalogEntrySchema = object({
|
|
26723
|
-
id: string(),
|
|
26724
|
-
name: string(),
|
|
26725
|
-
description: string(),
|
|
26726
|
-
formats: ModelFormatsSchema,
|
|
26727
|
-
inputSize: object({
|
|
26728
|
-
width: number$1(),
|
|
26729
|
-
height: number$1()
|
|
26730
|
-
}),
|
|
26731
|
-
/**
|
|
26732
|
-
* Channel count of the model input tensor. Omit ⇒ 3 (RGB), the default for
|
|
26733
|
-
* every detector / classifier / embedder. Set to 1 for a grayscale CTC text
|
|
26734
|
-
* recognizer (EasyOCR VGG plate-OCR: input `[N,1,H,W]`) so the preprocess
|
|
26735
|
-
* feeds a single-channel, EasyOCR-normalized tensor instead of the default
|
|
26736
|
-
* 3-channel RGB one. Threaded through `PoolModelConfig.inputChannels` to the
|
|
26737
|
-
* Python inference pool.
|
|
26738
|
-
*/
|
|
26739
|
-
inputChannels: number$1().int().positive().optional(),
|
|
26740
|
-
labels: array(LabelDefinitionSchema).readonly(),
|
|
26741
|
-
inputLayout: _enum(["nchw", "nhwc"]).optional(),
|
|
26742
|
-
/**
|
|
26743
|
-
* `'scrfd'` applies InsightFace's SCRFD input contract, `(x - 127.5) / 128`
|
|
26744
|
-
* (upstream `insightface/model_zoo/scrfd.py`), instead of the historical
|
|
26745
|
-
* plain `/255`. Measured against COCO GT: 188 → 196 faces found on the
|
|
26746
|
-
* `scrfd-2.5g` catalog entry (2026-09-26 model-replacement spike, §2.4-2).
|
|
26747
|
-
*/
|
|
26748
|
-
inputNormalization: _enum([
|
|
26749
|
-
"zero-one",
|
|
26750
|
-
"imagenet",
|
|
26751
|
-
"none",
|
|
26752
|
-
"scrfd"
|
|
26753
|
-
]).optional(),
|
|
26754
|
-
/**
|
|
26755
|
-
* The model already applies softmax IN-GRAPH — its raw output is a
|
|
26756
|
-
* probability distribution, not logits. When set, the `softmax`
|
|
26757
|
-
* postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
|
|
26758
|
-
* probability vector collapses it toward uniform (top-1 score craters far
|
|
26759
|
-
* below its true value, making every confidence gate meaningless). Absent ⇒
|
|
26760
|
-
* the output is raw logits and the postprocessor applies softmax (the normal
|
|
26761
|
-
* case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
|
|
26762
|
-
* TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
|
|
26763
|
-
*/
|
|
26764
|
-
outputProbabilities: boolean().optional(),
|
|
26765
|
-
preprocessMode: _enum(["letterbox", "resize"]).optional(),
|
|
26766
|
-
/**
|
|
26767
|
-
* Per-MODEL postprocessor override. Absent ⇒ the step's own
|
|
26768
|
-
* `StepDefinition.postprocessor` applies (the normal case — every model in a
|
|
26769
|
-
* step shares its decode). Set it when a step hosts models with DIFFERENT raw
|
|
26770
|
-
* output layouts under one slot: e.g. object-detection is `'yolo'` by default,
|
|
26771
|
-
* but a Coral SSD MobileNet build emits the `TFLite_Detection_PostProcess`
|
|
26772
|
-
* 4-tensor layout and needs `'ssd'`. Threaded into `PoolModelConfig.postprocessor`
|
|
26773
|
-
* by the engine factory (`modelEntry.postprocessor ?? def.postprocessor`).
|
|
26774
|
-
*/
|
|
26775
|
-
postprocessor: custom().optional(),
|
|
26776
|
-
/**
|
|
26777
|
-
* Per-MODEL default confidence floor. Absent ⇒ the step's
|
|
26778
|
-
* `StepDefinition.defaultConfidence` applies. A score is a property of one
|
|
26779
|
-
* model's output scale, not of the step slot it sits in: YuNet's
|
|
26780
|
-
* `sqrt(cls·obj)` is not SCRFD's score, and inheriting SCRFD's 0.5 filled the
|
|
26781
|
-
* face gallery with wheels and hands (D662, amends D645). An operator's
|
|
26782
|
-
* explicit value still wins over it. Resolved in ONE place —
|
|
26783
|
-
* `addon-pipeline/.../registry/effective-confidence.ts`.
|
|
26784
|
-
*/
|
|
26785
|
-
defaultConfidence: number$1().min(0).max(1).optional(),
|
|
26786
|
-
/**
|
|
26787
|
-
* Per-MODEL default of the per-class confidence floors (`minConfidence<Macro>`
|
|
26788
|
-
* on a detector step), keyed by macro class: `{ person: 0.45 }`. A class
|
|
26789
|
-
* absent here runs at the step slider's global default. The same row shape
|
|
26790
|
-
* the floor measurement produces (`model-floors.json`: modelId → floors), so
|
|
26791
|
-
* a measured table is copied in as-is. An operator override is bound to the
|
|
26792
|
-
* model it was made for and does not survive a model change (D738). A custom
|
|
26793
|
-
* / imported model may declare it; without it, the global defaults apply.
|
|
26794
|
-
*/
|
|
26795
|
-
defaultClassFloors: record(string(), number$1().min(0).max(1)).optional(),
|
|
26796
|
-
/**
|
|
26797
|
-
* The inference precision this model's OpenVINO IR needs on an Intel GPU.
|
|
26798
|
-
* Absent ⇒ the device default (f16 on a GPU). Set to `'f32'` for an FP32 IR
|
|
26799
|
-
* that produces invalid output at f16 — measured 2026-10-07 for YOLO26
|
|
26800
|
-
* base IRs (`yolo26s`: 0 true / 146 false positives; `yolo26m*`: NaN
|
|
26801
|
-
* scores) on the Core Ultra iGPU and the N100. Threaded to the pool as
|
|
26802
|
-
* `PoolModelConfig.gpuInferencePrecision`; the pool sets
|
|
26803
|
-
* INFERENCE_PRECISION_HINT on a GPU only. Costs ~60% latency on the GPU.
|
|
26804
|
-
*/
|
|
26805
|
-
gpuInferencePrecision: _enum(["f32", "f16"]).optional(),
|
|
26806
|
-
/**
|
|
26807
|
-
* ROOT detectors only: per supplied step (`animal-classifier`, …), the
|
|
26808
|
-
* minimum DETECTION score from which this root's own fine label (species,
|
|
26809
|
-
* vehicle type — D736 root supply) is taken (D741). Below it the detection
|
|
26810
|
-
* keeps its macro class without the fine label. `1` = never take it from
|
|
26811
|
-
* this root. Absent ⇒ no floor beyond the macro floor. The supplied step's
|
|
26812
|
-
* `minConfidence` slider, bound to the ROOT model, overrides it.
|
|
26813
|
-
*/
|
|
26814
|
-
suppliedLabelFloors: record(string(), number$1().min(0).max(1)).optional(),
|
|
26815
|
-
/**
|
|
26816
|
-
* When true, the executor produces a landmark-aligned crop (similarity warp
|
|
26817
|
-
* onto the canonical template) before this step runs, instead of a plain
|
|
26818
|
-
* axis-aligned bbox crop. Required for face-recognition embedders (ArcFace):
|
|
26819
|
-
* their embeddings are only discriminative on an aligned input. The face
|
|
26820
|
-
* detector that produced the parent detail must emit 5 landmarks.
|
|
26821
|
-
*/
|
|
26822
|
-
faceAlignment: boolean().optional(),
|
|
26823
|
-
/**
|
|
26824
|
-
* Auxiliary files required at runtime (labels JSON, charset dict, etc.).
|
|
26825
|
-
* Downloaded into the same modelsDir alongside the model file.
|
|
26826
|
-
*/
|
|
26827
|
-
extraFiles: array(ModelExtraFileSchema).readonly().optional(),
|
|
26828
|
-
/**
|
|
26829
|
-
* LEGACY entry — retained in the catalog so a persisted operator selection
|
|
26830
|
-
* still RESOLVES (and can be re-activated), but hidden from the selectable
|
|
26831
|
-
* model list and excluded from the auto format-default pick. Set on the
|
|
26832
|
-
* superseded / consolidated models (older lineages, redundant fp16 IRs) so
|
|
26833
|
-
* the active lineup stays the coherent curated ladder without deleting a
|
|
26834
|
-
* model anyone may still be pinned to. `resolveModelForFormat` keeps honoring
|
|
26835
|
-
* an explicit legacy id that has a build for the node's format.
|
|
26836
|
-
*/
|
|
26837
|
-
legacy: boolean().optional(),
|
|
26838
|
-
/**
|
|
26839
|
-
* Measured quality/latency metadata — populated from the benchmark addon on
|
|
26840
|
-
* the real node classes. Absent = not yet measured (most entries today; the
|
|
26841
|
-
* catalog historically carried only `sizeMB`, a poor cross-architecture
|
|
26842
|
-
* speed proxy). `p95LatencyMs` is keyed by node class (e.g. `n100`, `mac`).
|
|
26843
|
-
*/
|
|
26844
|
-
metrics: object({
|
|
26845
|
-
map50: number$1().optional(),
|
|
26846
|
-
p95LatencyMs: record(string(), number$1()).optional()
|
|
26847
|
-
}).optional(),
|
|
26848
|
-
/**
|
|
26849
|
-
* The model's licence record — see {@link ModelLicenseSchema}. Optional in
|
|
26850
|
-
* the schema (a custom model's author may state none); REQUIRED and complete
|
|
26851
|
-
* on every built-in catalog entry (`scripts/check-catalog-licence.ts`).
|
|
26852
|
-
*/
|
|
26853
|
-
license: ModelLicenseSchema.optional(),
|
|
26854
|
-
/**
|
|
26855
|
-
* Variant-selector grouping. The UI groups models by `family` + `tier` and
|
|
26856
|
-
* offers `precision` / `optimization` as variant axes WITHIN a tier — so all
|
|
26857
|
-
* of a family's sizes and quantizations collapse into one grouped picker
|
|
26858
|
-
* instead of a flat list of `yolo26s`, `yolo26s-int8`, … Absent ⇒ ungrouped
|
|
26859
|
-
* (legacy / custom models) — never shown in the grouped selector. The flat
|
|
26860
|
-
* `id` stays the source of truth for resolution/download/persistence; grouping
|
|
26861
|
-
* is a presentation overlay resolved back to an `id`.
|
|
26862
|
-
*/
|
|
26863
|
-
group: ModelVariantGroupSchema.optional(),
|
|
26864
|
-
/**
|
|
26865
|
-
* Catalog source for the pipeline stepper's provider-first picker. Absent on
|
|
26866
|
-
* built-in CamStack entries (treated as `camstack`) and on registry rows
|
|
26867
|
-
* persisted before this field existed (`inferModelProvider` fills those).
|
|
26868
|
-
*/
|
|
26869
|
-
provider: ModelProviderIdSchema.optional(),
|
|
26870
|
-
/**
|
|
26871
|
-
* Per-MODEL class map override. Absent ⇒ the step's `StepDefinition.classMap`
|
|
26872
|
-
* applies (plus catalog / COCO public catalog). Set on a custom model whose raw
|
|
26873
|
-
* labels already ARE the CamStack macros (plugin catalog identity map).
|
|
26874
|
-
*/
|
|
26875
|
-
classMap: DetectionCatalogClassMapSchema.optional(),
|
|
26876
|
-
/**
|
|
26877
|
-
* The pipeline steps this ROOT detector can supply from its own output
|
|
26878
|
-
* (D730): its labels name a step's effect (`deer` for `animal-classifier`)
|
|
26879
|
-
* or draw a step's box (`license_plate` for `plate-detection`). Computed at
|
|
26880
|
-
* import from THIS model's labelmap by `deriveRootSupplies`, never written
|
|
26881
|
-
* by hand and never assumed per family; a row without it is derived on read
|
|
26882
|
-
* (`rootSuppliesOf`). Whether a camera uses it is the step's own
|
|
26883
|
-
* `useRootModel` flag (`resolveRootSupply`).
|
|
26884
|
-
*/
|
|
26885
|
-
suppliesSteps: array(RootStepSupplySchema).readonly().optional(),
|
|
26886
|
-
/**
|
|
26887
|
-
* The model's CLIP feature-space contract (text encoder, dimension, vector
|
|
26888
|
-
* index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
|
|
26889
|
-
* CLIP image encoder; its absence is what "not a CLIP model" means to the
|
|
26890
|
-
* embedding encoder and the semantic-search store (D649).
|
|
26891
|
-
*/
|
|
26892
|
-
clip: ClipModelMetaSchema.optional()
|
|
26893
|
-
});
|
|
26894
|
-
var ConvertTargetSchema = discriminatedUnion("format", [object({
|
|
26895
|
-
format: literal("openvino"),
|
|
26896
|
-
precisions: array(_enum(["fp16", "int8"])).min(1).readonly()
|
|
26897
|
-
}), object({ format: literal("coreml") })]);
|
|
26898
|
-
var ModelConvertMetadataSchema = object({
|
|
26899
|
-
id: string().regex(/^[a-zA-Z0-9._-]+$/),
|
|
26900
|
-
name: string(),
|
|
26901
|
-
labels: array(LabelDefinitionSchema).readonly(),
|
|
26902
|
-
inputSize: object({
|
|
26903
|
-
width: number$1(),
|
|
26904
|
-
height: number$1()
|
|
26905
|
-
}),
|
|
26906
|
-
inputLayout: _enum(["nchw", "nhwc"]).optional(),
|
|
26907
|
-
inputNormalization: _enum([
|
|
26908
|
-
"zero-one",
|
|
26909
|
-
"imagenet",
|
|
26910
|
-
"none",
|
|
26911
|
-
"scrfd"
|
|
26912
|
-
]).optional(),
|
|
26913
|
-
preprocessMode: _enum(["letterbox", "resize"]).optional(),
|
|
26914
|
-
outputFormat: _enum([
|
|
26915
|
-
"yolo",
|
|
26916
|
-
"ssd",
|
|
26917
|
-
"embedding",
|
|
26918
|
-
"classification",
|
|
26919
|
-
"ocr",
|
|
26920
|
-
"segmentation"
|
|
26921
|
-
]),
|
|
26922
|
-
faceAlignment: boolean().optional(),
|
|
26923
|
-
classMap: DetectionCatalogClassMapSchema.optional()
|
|
26924
|
-
});
|
|
26925
|
-
var ConvertResultSchema = object({
|
|
26926
|
-
entry: ModelCatalogEntrySchema,
|
|
26927
|
-
artifacts: array(object({
|
|
26928
|
-
format: _enum(MODEL_FORMATS),
|
|
26929
|
-
precision: _enum(["fp16", "int8"]).optional(),
|
|
26930
|
-
sizeMB: number$1(),
|
|
26931
|
-
validated: boolean(),
|
|
26932
|
-
files: array(string()).readonly()
|
|
26933
|
-
})).readonly()
|
|
26934
|
-
});
|
|
26935
|
-
var ViewerFeatureIdSchema = _enum([
|
|
26936
|
-
"face-assignment",
|
|
26937
|
-
"plate-assignment",
|
|
26938
|
-
"retrain",
|
|
26939
|
-
"scenes"
|
|
26940
|
-
]);
|
|
26941
|
-
/** Which devices a viewer reaches: `allow` minus `block`. */
|
|
26942
|
-
var ViewerDeviceAllowSchema = union([literal("*"), array(number$1().int().nonnegative())]);
|
|
26943
|
-
/**
|
|
26944
|
-
* The viewer grant, stored as ONE row of a user's `scopes`. A principal that
|
|
26945
|
-
* holds it is decided by the viewer rules ALONE — any other row it carries is
|
|
26946
|
-
* ignored, so a viewer can never be widened by a leftover grant.
|
|
26947
|
-
*/
|
|
26948
|
-
var ViewerTokenScopeSchema = object({
|
|
26949
|
-
type: literal("viewer"),
|
|
26950
|
-
allow: ViewerDeviceAllowSchema,
|
|
26951
|
-
block: array(number$1().int().nonnegative()),
|
|
26952
|
-
features: array(ViewerFeatureIdSchema)
|
|
26953
|
-
});
|
|
26954
|
-
/**
|
|
26955
|
-
* Zod schemas for persisted record types.
|
|
26956
|
-
*
|
|
26957
|
-
* These schemas serve as the single source of truth for types that are
|
|
26958
|
-
* stored in the settings-store backend and retrieved via tRPC. They
|
|
26959
|
-
* replace the manual TypeScript interfaces with schema-derived types,
|
|
26960
|
-
* enabling runtime validation when reading from the backend.
|
|
26961
|
-
*
|
|
26962
|
-
* Convention: each schema is named `<Type>Schema`, the inferred TS type
|
|
26963
|
-
* keeps the original name for backward compatibility.
|
|
26964
|
-
*/
|
|
26965
|
-
/**
|
|
26966
|
-
* Auth model (v2 — 2026-05-12 caps-only):
|
|
26967
|
-
*
|
|
26968
|
-
* Two principals:
|
|
26969
|
-
* - `isAdmin: true` — full bypass. Admin scope set is ignored.
|
|
26970
|
-
* - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
|
|
26971
|
-
*
|
|
26972
|
-
* No role enum. There used to be `viewer / agent / scoped` and earlier
|
|
26973
|
-
* `super_admin` — collapsed onto the single boolean because every
|
|
26974
|
-
* non-admin caller is governed by the same scope-check rules; the
|
|
26975
|
-
* distinction was only ever used to route role-specific procedures
|
|
26976
|
-
* which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
|
|
26977
|
-
* with `isAdmin: false` + an explicit scope list.
|
|
26978
|
-
*/
|
|
26979
|
-
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
26980
|
-
var MethodAccessSchema = _enum([
|
|
26981
|
-
"view",
|
|
26982
|
-
"create",
|
|
26983
|
-
"delete"
|
|
26984
|
-
]);
|
|
26985
|
-
/**
|
|
26986
|
-
* A single scope grant. Three forms — checked in matcher with OR
|
|
26987
|
-
* semantics; the first match decides whether the call passes:
|
|
26988
|
-
*
|
|
26989
|
-
* - `category` — broadest. `target: 'device' | 'system'` selects every
|
|
26990
|
-
* cap with the matching `scope` declaration. New caps inherit grants
|
|
26991
|
-
* automatically — adding a device cap to the codebase makes it
|
|
26992
|
-
* reachable to every user with `category:device [...]` without a
|
|
26993
|
-
* re-grant. Use this for "family viewer" / "operator" tiers.
|
|
26994
|
-
*
|
|
26995
|
-
* - `addon` — every cap that ships inside a given addon id. Niche;
|
|
26996
|
-
* useful when an integration needs to interact with one specific
|
|
26997
|
-
* addon's surface regardless of how many caps it exports.
|
|
26998
|
-
*
|
|
26999
|
-
* - `capability` — the most precise form. Single cap name. Use for
|
|
27000
|
-
* integration tokens where you want to grant `addons.installPackage`
|
|
27001
|
-
* and nothing else.
|
|
27002
|
-
*
|
|
27003
|
-
* `access` is REQUIRED with min 1 element. `admin` bypass is the
|
|
27004
|
-
* "give me everything" escape; there is no wildcard scope.
|
|
27005
|
-
*/
|
|
27006
|
-
var AllowedProviderSchema = union([literal("*"), array(string())]);
|
|
27007
|
-
var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
|
|
27008
|
-
var CapScopeSchema = _enum(["device", "system"]);
|
|
27009
|
-
/**
|
|
27010
|
-
* DeviceSelector (scope model v3 — 2026-08-12).
|
|
27011
|
-
*
|
|
27012
|
-
* A `device` grant no longer carries a frozen list of deviceIds. It carries
|
|
27013
|
-
* a SELECTOR the matcher resolves against the live fleet, so the grant can be
|
|
27014
|
-
* DYNAMIC: a `types:['camera']` selector automatically covers a camera added
|
|
27015
|
-
* AFTER the grant was minted — no re-grant, no re-login.
|
|
27016
|
-
*
|
|
27017
|
-
* - `all` — every device in the deployment. The broad viewer/operator
|
|
27018
|
-
* lever without a `category` grant (a `category` grant also covers device
|
|
27019
|
-
* caps that carry no deviceId; `all` is specifically the device set).
|
|
27020
|
-
* - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
|
|
27021
|
-
* grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
|
|
27022
|
-
* is NOT covered until the grant is edited.
|
|
27023
|
-
* - `types` — every device of a `DeviceType` (e.g. every `camera`).
|
|
27024
|
-
* DYNAMIC. A device that changes type, or a new device of the type,
|
|
27025
|
-
* re-resolves on the next request.
|
|
27026
|
-
* - `locations` — every device whose operator-assigned `location` label is
|
|
27027
|
-
* in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
|
|
27028
|
-
* null/unset location matches NO `locations` selector.
|
|
27029
|
-
*/
|
|
27030
|
-
var DeviceSelectorSchema = discriminatedUnion("kind", [
|
|
27031
|
-
object({ kind: literal("all") }),
|
|
27032
|
-
object({
|
|
27033
|
-
kind: literal("ids"),
|
|
27034
|
-
ids: array(number$1().int()).min(1)
|
|
27035
|
-
}),
|
|
27036
|
-
object({
|
|
27037
|
-
kind: literal("types"),
|
|
27038
|
-
types: array(_enum(DeviceType)).min(1)
|
|
27039
|
-
}),
|
|
27040
|
-
object({
|
|
27041
|
-
kind: literal("locations"),
|
|
27042
|
-
locations: array(string().min(1)).min(1)
|
|
27043
|
-
})
|
|
27044
|
-
]);
|
|
27045
|
-
var DeviceTokenScopeSchema = object({
|
|
27046
|
-
type: literal("device"),
|
|
27047
|
-
/** The device SET this grant covers — resolved against the live fleet. */
|
|
27048
|
-
selector: DeviceSelectorSchema,
|
|
27049
|
-
access: array(MethodAccessSchema).min(1),
|
|
27050
|
-
/**
|
|
27051
|
-
* Whether a grant on a PARENT device transparently covers its accessory
|
|
27052
|
-
* CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
|
|
27053
|
-
* Direction is parent → children ONLY.
|
|
27054
|
-
*
|
|
27055
|
-
* Absent → the matcher DERIVES it from the access flavour: `view`
|
|
27056
|
-
* inherits (a camera viewer sees the camera's accessories), `create` /
|
|
27057
|
-
* `delete` do NOT (actuating/removing a child is an explicit act the
|
|
27058
|
-
* operator must grant on the child, not inherit from the parent). Set it
|
|
27059
|
-
* explicitly to override that default per grant.
|
|
27060
|
-
*/
|
|
27061
|
-
includeLinked: boolean().optional()
|
|
27062
|
-
});
|
|
27063
|
-
/**
|
|
27064
|
-
* v2 → v3 lazy migration. A pre-v3 `device` grant carried
|
|
27065
|
-
* `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
|
|
27066
|
-
* `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
|
|
27067
|
-
* EVERY parse path — stored records AND the JWT-carried scope arrays
|
|
27068
|
-
* normalised at the request boundary ({@link normalizeTokenScopes} in
|
|
27069
|
-
* `device-selector.ts`). Chosen over a one-time DB migration because a
|
|
27070
|
-
* migration cannot reach a JWT already in a client's hands; parse-time
|
|
27071
|
-
* migration covers both without a flag day. No cast — the raw object is read
|
|
27072
|
-
* through `Reflect.get` (its static type is `unknown`).
|
|
27073
|
-
*/
|
|
27074
|
-
function migrateLegacyTokenScope(raw) {
|
|
27075
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
27076
|
-
if (Reflect.get(raw, "type") !== "device") return raw;
|
|
27077
|
-
if (Reflect.get(raw, "selector") !== void 0) return canonicalSelectorTypes(raw);
|
|
27078
|
-
const targets = Reflect.get(raw, "targets");
|
|
27079
|
-
if (!Array.isArray(targets)) return raw;
|
|
27080
|
-
return {
|
|
27081
|
-
type: "device",
|
|
27082
|
-
selector: {
|
|
27083
|
-
kind: "ids",
|
|
27084
|
-
ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
|
|
27085
|
-
},
|
|
27086
|
-
access: Reflect.get(raw, "access")
|
|
27087
|
-
};
|
|
27088
|
-
}
|
|
27089
|
-
/**
|
|
27090
|
-
* A stored `types` selector may name a type D1033 retired (`thermostat`). The
|
|
27091
|
-
* grant is read back through this same preprocess, so the retired name is
|
|
27092
|
-
* rewritten to its canonical type here and {@link DeviceSelectorSchema} itself
|
|
27093
|
-
* stays a strict enum on the wire.
|
|
27094
|
-
*/
|
|
27095
|
-
function canonicalSelectorTypes(raw) {
|
|
27096
|
-
const selector = Reflect.get(raw, "selector");
|
|
27097
|
-
if (selector === null || typeof selector !== "object") return raw;
|
|
27098
|
-
if (Reflect.get(selector, "kind") !== "types") return raw;
|
|
27099
|
-
const types = Reflect.get(selector, "types");
|
|
27100
|
-
if (!Array.isArray(types)) return raw;
|
|
27101
|
-
const canonical = types.map((t) => typeof t === "string" ? canonicalStoredDeviceType(t) : t);
|
|
27102
|
-
return {
|
|
27103
|
-
...raw,
|
|
27104
|
-
selector: {
|
|
27105
|
-
...selector,
|
|
27106
|
-
types: canonical
|
|
27107
|
-
}
|
|
27108
|
-
};
|
|
27109
|
-
}
|
|
27110
|
-
var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
|
|
27111
|
-
object({
|
|
27112
|
-
type: literal("category"),
|
|
27113
|
-
target: CapScopeSchema,
|
|
27114
|
-
access: array(MethodAccessSchema).min(1)
|
|
27115
|
-
}),
|
|
27116
|
-
object({
|
|
27117
|
-
type: literal("capability"),
|
|
27118
|
-
target: string(),
|
|
27119
|
-
access: array(MethodAccessSchema).min(1)
|
|
27120
|
-
}),
|
|
27121
|
-
object({
|
|
27122
|
-
type: literal("addon"),
|
|
27123
|
-
target: string(),
|
|
27124
|
-
access: array(MethodAccessSchema).min(1)
|
|
27125
|
-
}),
|
|
27126
|
-
DeviceTokenScopeSchema
|
|
27127
|
-
]));
|
|
27128
|
-
/**
|
|
27129
|
-
* What a PERSON's grant set holds (D921): the capability rows above (legacy
|
|
27130
|
-
* users, integration-style tokens) or the viewer row, which is decided by its
|
|
27131
|
-
* own rules alone. Kept apart from {@link TokenScope} so every surface that
|
|
27132
|
-
* edits capability rows (the scope picker, token minting) keeps its shape.
|
|
27133
|
-
*/
|
|
27134
|
-
var UserScopeSchema = union([ViewerTokenScopeSchema, TokenScopeSchema]);
|
|
27135
|
-
object({
|
|
27136
|
-
id: string(),
|
|
27137
|
-
username: string(),
|
|
27138
|
-
passwordHash: string(),
|
|
27139
|
-
/**
|
|
27140
|
-
* Admin bypass. When true, the middleware skips the scope-access
|
|
27141
|
-
* check entirely. There is no other axis of privilege; the legacy
|
|
27142
|
-
* role enum collapsed onto this boolean in v2.
|
|
27143
|
-
*/
|
|
27144
|
-
isAdmin: boolean().default(false),
|
|
27145
|
-
allowedProviders: AllowedProviderSchema,
|
|
27146
|
-
allowedDevices: AllowedDevicesSchema,
|
|
27147
|
-
/**
|
|
27148
|
-
* Scopes granted to this user. Admins bypass; their `scopes` is
|
|
27149
|
-
* ignored. Non-admins without scopes are locked out of every
|
|
27150
|
-
* protected call.
|
|
27151
|
-
*/
|
|
27152
|
-
scopes: array(UserScopeSchema).default([]),
|
|
27153
|
-
createdAt: number$1(),
|
|
27154
|
-
updatedAt: number$1()
|
|
27155
|
-
});
|
|
27156
|
-
object({
|
|
27157
|
-
id: string(),
|
|
27158
|
-
userId: string(),
|
|
27159
|
-
name: string(),
|
|
27160
|
-
tokenHash: string(),
|
|
27161
|
-
tokenPrefix: string(),
|
|
27162
|
-
scopes: array(TokenScopeSchema),
|
|
27163
|
-
expiresAt: number$1().nullish(),
|
|
27164
|
-
lastUsedAt: number$1().nullish(),
|
|
27165
|
-
createdAt: number$1()
|
|
27166
|
-
});
|
|
27167
|
-
/** What a share-view grant lets its holder see. */
|
|
27168
|
-
var ShareViewGrantSchema = object({
|
|
27169
|
-
kind: _enum(SHARE_VIEW_KINDS),
|
|
27170
|
-
deviceIds: array(number$1().int().nonnegative()).min(1).max(64),
|
|
27171
|
-
/** Talk-back, opt-in at mint time; absent means off. */
|
|
27172
|
-
talk: boolean().optional()
|
|
27173
|
-
});
|
|
27174
|
-
var ShareViewScopeSchema = object({
|
|
27175
|
-
type: literal("share-view"),
|
|
27176
|
-
grant: ShareViewGrantSchema
|
|
27177
|
-
});
|
|
27178
|
-
var AddonRoutesScopeSchema = object({
|
|
27179
|
-
type: literal("addon-routes"),
|
|
27180
|
-
access: array(MethodAccessSchema).min(1)
|
|
27181
|
-
});
|
|
27182
|
-
var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
|
|
27183
|
-
var CredentialScopeSchema = union([
|
|
27184
|
-
literal("*"),
|
|
27185
|
-
ShareViewScopeSchema,
|
|
27186
|
-
AddonRoutesScopeSchema,
|
|
27187
|
-
PreferencesSelfScopeSchema,
|
|
27188
|
-
ViewerTokenScopeSchema,
|
|
27189
|
-
TokenScopeSchema
|
|
27190
|
-
]);
|
|
27191
|
-
object({
|
|
27192
|
-
kind: literal("credential"),
|
|
27193
|
-
sub: string().min(1),
|
|
27194
|
-
jti: string().min(16),
|
|
27195
|
-
scopes: array(CredentialScopeSchema).min(1)
|
|
27196
|
-
});
|
|
27197
|
-
var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
|
|
27198
|
-
/** A namespace's value: a JSON object, opaque to the hub. */
|
|
27199
|
-
var PreferenceValueSchema = record(string(), unknown());
|
|
27200
|
-
var PreferenceDeviceIdSchema = string().min(1).max(64);
|
|
27201
|
-
/** A stored row, as the owner reads it. */
|
|
27202
|
-
var PreferenceRowSchema = object({
|
|
27203
|
-
namespace: PreferenceNamespaceSchema,
|
|
27204
|
-
value: PreferenceValueSchema,
|
|
27205
|
-
/** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
|
|
27206
|
-
revision: number$1().int().positive(),
|
|
27207
|
-
updatedAt: number$1().int(),
|
|
27208
|
-
/** The client id the last writer sent; `null` when it sent none. */
|
|
27209
|
-
updatedByDevice: PreferenceDeviceIdSchema.nullable()
|
|
27210
|
-
});
|
|
27211
|
-
object({
|
|
27212
|
-
/** Absent: every namespace the caller holds. */
|
|
27213
|
-
namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
|
|
27214
|
-
object({ rows: array(PreferenceRowSchema) });
|
|
27215
|
-
object({
|
|
27216
|
-
namespace: PreferenceNamespaceSchema,
|
|
27217
|
-
value: PreferenceValueSchema,
|
|
27218
|
-
/**
|
|
27219
|
-
* The revision the edit was based on. Absent: last write wins. `0`: the
|
|
27220
|
-
* namespace must not exist yet. Any other value that is not the current
|
|
27221
|
-
* revision answers `conflict` and writes nothing.
|
|
27222
|
-
*/
|
|
27223
|
-
baseRevision: number$1().int().nonnegative().optional(),
|
|
27224
|
-
deviceId: PreferenceDeviceIdSchema.optional()
|
|
27225
|
-
});
|
|
27226
|
-
discriminatedUnion("status", [object({
|
|
27227
|
-
status: literal("saved"),
|
|
27228
|
-
row: PreferenceRowSchema
|
|
27229
|
-
}), object({
|
|
27230
|
-
status: literal("conflict"),
|
|
27231
|
-
current: PreferenceRowSchema.nullable()
|
|
27232
|
-
})]);
|
|
27233
|
-
object({ namespace: PreferenceNamespaceSchema });
|
|
27234
|
-
object({
|
|
27235
|
-
/** `false` when the namespace did not exist. */
|
|
27236
|
-
deleted: boolean() });
|
|
27237
|
-
object({
|
|
27238
|
-
/** The revision the client holds per namespace; a namespace it does not list is new to it. */
|
|
27239
|
-
revisionByNamespace: record(PreferenceNamespaceSchema, number$1().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
|
|
27240
|
-
object({
|
|
27241
|
-
/** Every row whose revision differs from the client's, and every row it did not list. */
|
|
27242
|
-
rows: array(PreferenceRowSchema),
|
|
27243
|
-
/** Namespaces the client listed that no longer exist. */
|
|
27244
|
-
deleted: array(PreferenceNamespaceSchema)
|
|
27245
|
-
});
|
|
27246
|
-
_enum(["new-session", "step-up"]);
|
|
27247
|
-
/** The languages the hub's app landing pages are written in (D858). */
|
|
27248
|
-
var AppPageLangSchema = _enum(["en", "it"]);
|
|
27249
|
-
/** How a native app starts one login method (D858), as `auth.listLoginMethods` reports it. */
|
|
27250
|
-
var AppLoginPathSchema = discriminatedUnion("kind", [object({ kind: literal("native") }), object({
|
|
27251
|
-
kind: literal("browser"),
|
|
27252
|
-
startPath: string().startsWith("/")
|
|
27253
|
-
})]);
|
|
27254
|
-
/**
|
|
27255
|
-
* Device certificates (D855) — the wire contract shared by the hub, the admin
|
|
27256
|
-
* UI and the native viewer.
|
|
27257
|
-
*
|
|
27258
|
-
* A device (a phone) generates its OWN P-256 key pair in hardware (Secure
|
|
27259
|
-
* Enclave / Android Keystore / a non-extractable WebCrypto key). The private
|
|
27260
|
-
* key never travels. The hub signs the PUBLIC key into an X.509 leaf under a
|
|
27261
|
-
* dedicated device CA; the device later proves possession of the key by
|
|
27262
|
-
* signing a hub-issued nonce, and the hub answers with the same session a
|
|
27263
|
-
* password login opens.
|
|
27264
|
-
*
|
|
27265
|
-
* Everything on the wire is a small string (a PEM, a base64url signature):
|
|
27266
|
-
* D613 is about bulk bytes, and a certificate is ~600 bytes.
|
|
27267
|
-
*/
|
|
27268
|
-
/** Signature algorithm of every device credential: ECDSA, curve P-256, SHA-256. */
|
|
27269
|
-
var DEVICE_CERT_SIGNATURE = "ecdsa-p256-sha256";
|
|
27270
|
-
/** First line of every signed message; a change of format bumps the version. */
|
|
27271
|
-
var DEVICE_SIGNATURE_MESSAGE_VERSION = "camstack-device-cert-v1";
|
|
27272
|
-
_enum([
|
|
27273
|
-
"login",
|
|
27274
|
-
"renew",
|
|
27275
|
-
"revoke"
|
|
27276
|
-
]);
|
|
27277
|
-
var DevicePlatformSchema = _enum([
|
|
27278
|
-
"ios",
|
|
27279
|
-
"android",
|
|
27280
|
-
"web",
|
|
27281
|
-
"other"
|
|
27282
|
-
]);
|
|
27283
|
-
var Base64UrlSchema = string().min(1).max(4096).regex(/^[A-Za-z0-9_-]+$/);
|
|
27284
|
-
var PemSchema = string().min(1).max(16384);
|
|
27285
|
-
/**
|
|
27286
|
-
* Why a device-certificate endpoint said no. Distinct from a transport / 5xx
|
|
27287
|
-
* failure: those carry no reason and mean "try again", never "the credential is
|
|
27288
|
-
* dead". The viewer switches on this exhaustively.
|
|
27289
|
-
*/
|
|
27290
|
-
var DeviceRefusalReasonSchema = _enum([
|
|
27291
|
-
"revoked",
|
|
27292
|
-
"unknown-credential",
|
|
27293
|
-
"expired",
|
|
27294
|
-
"bad-signature",
|
|
27295
|
-
"nonce-invalid",
|
|
27296
|
-
"rate-limited",
|
|
27297
|
-
"invalid-certificate",
|
|
27298
|
-
"superseded",
|
|
27299
|
-
"user-gone",
|
|
27300
|
-
"unavailable",
|
|
27301
|
-
"code-invalid",
|
|
27302
|
-
"self-enrollment-disabled",
|
|
27303
|
-
"step-up-required",
|
|
27304
|
-
"bad-public-key"
|
|
27305
|
-
]);
|
|
27306
|
-
var DeviceRefusalSchema = object({
|
|
27307
|
-
ok: literal(false),
|
|
27308
|
-
reason: DeviceRefusalReasonSchema,
|
|
27309
|
-
definitive: boolean(),
|
|
27310
|
-
retryAfterSeconds: number$1().optional()
|
|
27311
|
-
});
|
|
27312
|
-
object({
|
|
27313
|
-
code: string().min(1).max(256),
|
|
27314
|
-
/** SubjectPublicKeyInfo DER of the device's P-256 public key, base64url. */
|
|
27315
|
-
publicKeySpki: Base64UrlSchema,
|
|
27316
|
-
deviceName: string().min(1).max(80).optional(),
|
|
27317
|
-
platform: DevicePlatformSchema
|
|
27318
|
-
});
|
|
27319
|
-
discriminatedUnion("ok", [object({
|
|
27320
|
-
credentialId: string(),
|
|
27321
|
-
certPem: PemSchema,
|
|
27322
|
-
/** The device CA certificate the leaf chains to. */
|
|
27323
|
-
chainPem: PemSchema,
|
|
27324
|
-
notAfter: number$1(),
|
|
27325
|
-
user: object({
|
|
27326
|
-
id: string(),
|
|
27327
|
-
username: string()
|
|
27328
|
-
})
|
|
27329
|
-
}).extend({ ok: literal(true) }), DeviceRefusalSchema]);
|
|
27330
|
-
object({
|
|
27331
|
-
/** The single-use step-up proof (`auth.deviceEnrollProofFrom…`). */
|
|
27332
|
-
proof: string().min(1).max(512),
|
|
27333
|
-
publicKeySpki: Base64UrlSchema,
|
|
27334
|
-
deviceName: string().min(1).max(80),
|
|
27335
|
-
platform: DevicePlatformSchema
|
|
27336
|
-
});
|
|
27337
|
-
object({
|
|
27338
|
-
proof: string(),
|
|
27339
|
-
expiresAt: number$1()
|
|
27340
|
-
});
|
|
27341
|
-
discriminatedUnion("ok", [object({
|
|
27342
|
-
nonce: string(),
|
|
27343
|
-
/** The origin to put in the signed message. The app compares it to the hub it dialled. */
|
|
27344
|
-
origin: string(),
|
|
27345
|
-
expiresAt: number$1(),
|
|
27346
|
-
signature: literal(DEVICE_CERT_SIGNATURE)
|
|
27347
|
-
}).extend({ ok: literal(true) }), DeviceRefusalSchema]);
|
|
27348
|
-
object({
|
|
27349
|
-
certPem: PemSchema,
|
|
27350
|
-
nonce: string().min(1).max(256),
|
|
27351
|
-
/** ECDSA P-256 SHA-256 over {@link buildDeviceSignatureMessage}; raw r||s or DER, base64url. */
|
|
27352
|
-
signature: Base64UrlSchema
|
|
27353
|
-
});
|
|
27354
|
-
discriminatedUnion("ok", [object({
|
|
27355
|
-
credentialId: string(),
|
|
27356
|
-
certPem: PemSchema,
|
|
27357
|
-
chainPem: PemSchema,
|
|
27358
|
-
notAfter: number$1()
|
|
27359
|
-
}).extend({ ok: literal(true) }), DeviceRefusalSchema]);
|
|
27360
|
-
discriminatedUnion("ok", [object({
|
|
27361
|
-
ok: literal(true),
|
|
27362
|
-
credentialId: string(),
|
|
27363
|
-
sessionsEnded: number$1().int()
|
|
27364
|
-
}), DeviceRefusalSchema]);
|
|
27365
|
-
var DeviceCredentialStatusSchema = _enum([
|
|
27366
|
-
"active",
|
|
27367
|
-
"expired",
|
|
27368
|
-
"revoked"
|
|
27369
|
-
]);
|
|
27370
|
-
var DeviceCredentialSchema = object({
|
|
27371
|
-
id: string(),
|
|
27372
|
-
userId: string(),
|
|
27373
|
-
username: string().nullable(),
|
|
27374
|
-
deviceName: string(),
|
|
27375
|
-
platform: DevicePlatformSchema,
|
|
27376
|
-
enrolledVia: _enum(["qr", "self"]),
|
|
27377
|
-
/** SHA-256 of the leaf certificate DER, colon-hex. */
|
|
27378
|
-
fingerprint: string(),
|
|
27379
|
-
issuedAt: number$1(),
|
|
27380
|
-
expiresAt: number$1(),
|
|
27381
|
-
lastUsedAt: number$1().nullable(),
|
|
27382
|
-
lastUsedFrom: string().nullable(),
|
|
27383
|
-
revokedAt: number$1().nullable(),
|
|
27384
|
-
/** `admin:<userId>` | `user:<userId>` | `device` | `user-deleted`. */
|
|
27385
|
-
revokedBy: string().nullable(),
|
|
27386
|
-
status: DeviceCredentialStatusSchema
|
|
27387
|
-
});
|
|
27388
|
-
var StartEnrollmentOutputSchema = object({
|
|
27389
|
-
/** Shown once; only its hash is kept. */
|
|
27390
|
-
code: string(),
|
|
27391
|
-
expiresAt: number$1(),
|
|
27392
|
-
/** `camstack://enroll?hub=…&code=…` — what the QR encodes. */
|
|
27393
|
-
enrollUrl: string(),
|
|
27394
|
-
/** The hub origin in the link, or `null` when the hub could not name one (the link then has no `hub`). */
|
|
27395
|
-
hubOrigin: string().nullable(),
|
|
27396
|
-
/** Every origin the apps may try (role `appConnections`). */
|
|
27397
|
-
hubOrigins: array(string())
|
|
27398
|
-
});
|
|
27399
|
-
object({
|
|
27400
|
-
kind: literal("device-certificate"),
|
|
27401
|
-
id: literal("device-certificate"),
|
|
27402
|
-
label: string(),
|
|
27403
|
-
stage: literal("primary"),
|
|
27404
|
-
/** tRPC paths under the hub's `auth` router, so a client names no literal. */
|
|
27405
|
-
challengePath: literal("auth.getDeviceChallenge"),
|
|
27406
|
-
revokePath: literal("auth.revokeOwnDeviceCertificate"),
|
|
27407
|
-
enrollSelfPath: literal("auth.enrollSelf"),
|
|
27408
|
-
loginPath: literal("auth.loginWithDeviceCertificate"),
|
|
27409
|
-
renewPath: literal("auth.renewDeviceCertificate"),
|
|
27410
|
-
signature: literal(DEVICE_CERT_SIGNATURE),
|
|
27411
|
-
messageVersion: literal(DEVICE_SIGNATURE_MESSAGE_VERSION),
|
|
27412
|
-
/** Which clients can execute it: a native app silently, a browser with a non-extractable WebCrypto key. */
|
|
27413
|
-
clients: array(_enum(["native", "web"])),
|
|
27414
|
-
/** The app executes it itself, silently (D858). */
|
|
27415
|
-
app: AppLoginPathSchema.nullable()
|
|
27416
|
-
});
|
|
27417
|
-
/** Lucide category ids, alphabetical. `ICON_META` indexes into this. */
|
|
27418
|
-
var ICON_CATEGORY_IDS = [
|
|
27419
|
-
"accessibility",
|
|
27420
|
-
"account",
|
|
27421
|
-
"animals",
|
|
27422
|
-
"arrows",
|
|
27423
|
-
"brands",
|
|
27424
|
-
"buildings",
|
|
27425
|
-
"charts",
|
|
27426
|
-
"communication",
|
|
27427
|
-
"connectivity",
|
|
27428
|
-
"cursors",
|
|
27429
|
-
"design",
|
|
27430
|
-
"development",
|
|
27431
|
-
"devices",
|
|
27432
|
-
"emoji",
|
|
27433
|
-
"files",
|
|
27434
|
-
"finance",
|
|
27435
|
-
"food-beverage",
|
|
27436
|
-
"gaming",
|
|
27437
|
-
"home",
|
|
27438
|
-
"layout",
|
|
27439
|
-
"mail",
|
|
27440
|
-
"math",
|
|
27441
|
-
"medical",
|
|
27442
|
-
"multimedia",
|
|
27443
|
-
"nature",
|
|
27444
|
-
"navigation",
|
|
27445
|
-
"notifications",
|
|
27446
|
-
"people",
|
|
27447
|
-
"photography",
|
|
27448
|
-
"science",
|
|
27449
|
-
"seasons",
|
|
27450
|
-
"security",
|
|
27451
|
-
"shapes",
|
|
27452
|
-
"shopping",
|
|
27453
|
-
"social",
|
|
27454
|
-
"sports",
|
|
27455
|
-
"sustainability",
|
|
27456
|
-
"text",
|
|
27457
|
-
"time",
|
|
27458
|
-
"tools",
|
|
27459
|
-
"transportation",
|
|
27460
|
-
"travel",
|
|
27461
|
-
"weather"
|
|
26748
|
+
/** Lucide category ids, alphabetical. `ICON_META` indexes into this. */
|
|
26749
|
+
var ICON_CATEGORY_IDS = [
|
|
26750
|
+
"accessibility",
|
|
26751
|
+
"account",
|
|
26752
|
+
"animals",
|
|
26753
|
+
"arrows",
|
|
26754
|
+
"brands",
|
|
26755
|
+
"buildings",
|
|
26756
|
+
"charts",
|
|
26757
|
+
"communication",
|
|
26758
|
+
"connectivity",
|
|
26759
|
+
"cursors",
|
|
26760
|
+
"design",
|
|
26761
|
+
"development",
|
|
26762
|
+
"devices",
|
|
26763
|
+
"emoji",
|
|
26764
|
+
"files",
|
|
26765
|
+
"finance",
|
|
26766
|
+
"food-beverage",
|
|
26767
|
+
"gaming",
|
|
26768
|
+
"home",
|
|
26769
|
+
"layout",
|
|
26770
|
+
"mail",
|
|
26771
|
+
"math",
|
|
26772
|
+
"medical",
|
|
26773
|
+
"multimedia",
|
|
26774
|
+
"nature",
|
|
26775
|
+
"navigation",
|
|
26776
|
+
"notifications",
|
|
26777
|
+
"people",
|
|
26778
|
+
"photography",
|
|
26779
|
+
"science",
|
|
26780
|
+
"seasons",
|
|
26781
|
+
"security",
|
|
26782
|
+
"shapes",
|
|
26783
|
+
"shopping",
|
|
26784
|
+
"social",
|
|
26785
|
+
"sports",
|
|
26786
|
+
"sustainability",
|
|
26787
|
+
"text",
|
|
26788
|
+
"time",
|
|
26789
|
+
"tools",
|
|
26790
|
+
"transportation",
|
|
26791
|
+
"travel",
|
|
26792
|
+
"weather"
|
|
27462
26793
|
];
|
|
27463
26794
|
/** The catalog keys (the PERSISTED values), sorted. */
|
|
27464
26795
|
var ICON_KEYS = [
|
|
@@ -47227,84 +46558,1064 @@ var ICON_SYNONYMS = {
|
|
|
47227
46558
|
]
|
|
47228
46559
|
};
|
|
47229
46560
|
/**
|
|
47230
|
-
* Spellings an operator may already have PERSISTED that no lucide package
|
|
47231
|
-
* accepts any more, and the catalog key they draw. They resolve
|
|
47232
|
-
* (`canonicalIconKey`) but are never offered. `gauge2` was this repo's own
|
|
47233
|
-
* pre-catalog spelling of `gauge`.
|
|
46561
|
+
* Spellings an operator may already have PERSISTED that no lucide package
|
|
46562
|
+
* accepts any more, and the catalog key they draw. They resolve
|
|
46563
|
+
* (`canonicalIconKey`) but are never offered. `gauge2` was this repo's own
|
|
46564
|
+
* pre-catalog spelling of `gauge`.
|
|
46565
|
+
*/
|
|
46566
|
+
var LEGACY_ICON_ALIASES = { gauge2: "gauge" };
|
|
46567
|
+
/**
|
|
46568
|
+
* icon-catalog — THE icon vocabulary (D854).
|
|
46569
|
+
*
|
|
46570
|
+
* Every place that picks or stores an icon — a device's display override, a
|
|
46571
|
+
* location, a site zone, a viewer accessory, an `icon` settings field — names
|
|
46572
|
+
* it by a key of this catalog and nothing else. There is no curated subset and
|
|
46573
|
+
* no second list: the catalog is every lucide icon that both surfaces can draw
|
|
46574
|
+
* (the admin UI's `lucide-react` and the viewer's `lucide-react-native`), the
|
|
46575
|
+
* intersection computed by `scripts/generate-icon-catalog.ts` into the
|
|
46576
|
+
* committed `icon-catalog.generated.ts`.
|
|
46577
|
+
*
|
|
46578
|
+
* Like the vocabularies it replaces, this module holds STRINGS only — no React,
|
|
46579
|
+
* no lucide import, no glyph. Each surface owns its glyph table (the web one
|
|
46580
|
+
* lives in `ui-library`, loaded lazily), and a test on each side pins that it
|
|
46581
|
+
* covers {@link ICON_KEYS}.
|
|
46582
|
+
*
|
|
46583
|
+
* ## What is persisted
|
|
46584
|
+
*
|
|
46585
|
+
* The canonical kebab-case lucide id ({@link IconKey}). Spellings that a lucide
|
|
46586
|
+
* package still accepts (`home` for `house`) and this repo's own legacy ones
|
|
46587
|
+
* (`gauge2`) RESOLVE ({@link canonicalIconKey}) so a stored value never goes
|
|
46588
|
+
* stale, but they are never OFFERED by search.
|
|
46589
|
+
*
|
|
46590
|
+
* ## Search
|
|
46591
|
+
*
|
|
46592
|
+
* Over the key, the Italian/English overlay in `icon-synonyms.ts`, any words
|
|
46593
|
+
* the caller adds, and lucide's English tags — in that order of weight.
|
|
46594
|
+
*/
|
|
46595
|
+
var KEY_SET$2 = new Set(ICON_KEYS);
|
|
46596
|
+
new Map([...Object.entries(ICON_ALIASES), ...Object.entries(LEGACY_ICON_ALIASES)]);
|
|
46597
|
+
/** Is this a canonical key of the catalog? (An alias is not — see {@link canonicalIconKey}.) */
|
|
46598
|
+
function isIconKey(value) {
|
|
46599
|
+
return typeof value === "string" && KEY_SET$2.has(value);
|
|
46600
|
+
}
|
|
46601
|
+
/**
|
|
46602
|
+
* Wire/storage schema for one icon key.
|
|
46603
|
+
*
|
|
46604
|
+
* Deliberately NOT a `z.enum` of the catalog: ~1,700 literals would be inlined
|
|
46605
|
+
* into every cap router, type and API-reference row that carries an icon. The
|
|
46606
|
+
* check is membership in the catalog and the type is {@link IconKey}.
|
|
46607
|
+
*/
|
|
46608
|
+
var IconKeySchema = custom(isIconKey, "Not an icon of the catalog");
|
|
46609
|
+
var ENTRIES = ICON_KEYS.map((key, index) => {
|
|
46610
|
+
const [categoryIndexes, tags] = ICON_META[index] ?? [[], []];
|
|
46611
|
+
const categories = categoryIndexes.flatMap((i) => {
|
|
46612
|
+
const id = ICON_CATEGORY_IDS[i];
|
|
46613
|
+
return id === void 0 ? [] : [id];
|
|
46614
|
+
});
|
|
46615
|
+
return {
|
|
46616
|
+
key,
|
|
46617
|
+
categories,
|
|
46618
|
+
primaryCategory: categories[0] ?? ICON_CATEGORY_IDS[0],
|
|
46619
|
+
tags,
|
|
46620
|
+
synonyms: ICON_SYNONYMS[key] ?? []
|
|
46621
|
+
};
|
|
46622
|
+
});
|
|
46623
|
+
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
46624
|
+
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
46625
|
+
var LEADING_CATEGORIES = [
|
|
46626
|
+
"devices",
|
|
46627
|
+
"home",
|
|
46628
|
+
"security",
|
|
46629
|
+
"buildings",
|
|
46630
|
+
"connectivity",
|
|
46631
|
+
"multimedia",
|
|
46632
|
+
"nature",
|
|
46633
|
+
"weather",
|
|
46634
|
+
"transportation",
|
|
46635
|
+
"animals"
|
|
46636
|
+
];
|
|
46637
|
+
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
46638
|
+
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
46639
|
+
/** One tag name: trimmed, 1..40 characters. */
|
|
46640
|
+
var TagNameSchema = string().trim().min(1).max(40);
|
|
46641
|
+
/** The `tags` field every owner record carries. Absent = no tags. */
|
|
46642
|
+
var TagsFieldSchema = array(TagNameSchema).max(20);
|
|
46643
|
+
var TagColorIdSchema = _enum([
|
|
46644
|
+
"tag-a",
|
|
46645
|
+
"tag-b",
|
|
46646
|
+
"tag-c",
|
|
46647
|
+
"tag-d",
|
|
46648
|
+
"tag-e",
|
|
46649
|
+
"tag-f",
|
|
46650
|
+
"tag-g",
|
|
46651
|
+
"tag-h"
|
|
46652
|
+
]);
|
|
46653
|
+
object({
|
|
46654
|
+
name: TagNameSchema,
|
|
46655
|
+
color: TagColorIdSchema,
|
|
46656
|
+
icon: IconKeySchema
|
|
46657
|
+
});
|
|
46658
|
+
var ClipModelMetaSchema = object({
|
|
46659
|
+
/** The paired text encoder's catalog id (the embedding-encoder's text catalog). */
|
|
46660
|
+
textModelId: string().min(1),
|
|
46661
|
+
/** Output dimension of BOTH towers. A vector of any other length is refused. */
|
|
46662
|
+
embeddingDim: number$1().int().positive(),
|
|
46663
|
+
/**
|
|
46664
|
+
* The `vector-store` index this model's vectors live in. ONE feature space
|
|
46665
|
+
* per index: two models share an index only when their vectors are ranked
|
|
46666
|
+
* against each other, which for CLIP means never across families. Every
|
|
46667
|
+
* model gets its own.
|
|
46668
|
+
*/
|
|
46669
|
+
vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
|
|
46670
|
+
/**
|
|
46671
|
+
* The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
|
|
46672
|
+
* must be unique per tokenizer: every model's siblings land in ONE flat
|
|
46673
|
+
* models directory, so two different tokenizers under the same name would
|
|
46674
|
+
* silently overwrite each other (whichever model downloaded last wins, and
|
|
46675
|
+
* the other one tokenises with the wrong vocabulary).
|
|
46676
|
+
*/
|
|
46677
|
+
tokenizerFile: string().min(1),
|
|
46678
|
+
/** Token window the text graph takes (SigLIP2: 64; CLIP BPE: 77). */
|
|
46679
|
+
contextLength: number$1().int().positive(),
|
|
46680
|
+
/** Id the tokenizer pads with. */
|
|
46681
|
+
padId: number$1().int().nonnegative(),
|
|
46682
|
+
/**
|
|
46683
|
+
* The search cosine floor at `strictness: 'loose'` — calibrated per model,
|
|
46684
|
+
* because cosine bands are a property of the model: 0.2 keeps 96% of matched
|
|
46685
|
+
* COCO caption-image pairs on MobileCLIP S1 and 2.7% on SigLIP2.
|
|
46686
|
+
*/
|
|
46687
|
+
searchMinScore: number$1().min(0).max(1)
|
|
46688
|
+
});
|
|
46689
|
+
var ClipSearchStrictnessSchema = _enum([
|
|
46690
|
+
"loose",
|
|
46691
|
+
"balanced",
|
|
46692
|
+
"strict"
|
|
46693
|
+
]);
|
|
46694
|
+
/** Steps whose effect a root label can BE. */
|
|
46695
|
+
var LABEL_SUPPLY_STEP_IDS = [
|
|
46696
|
+
"animal-classifier",
|
|
46697
|
+
"vehicle-classifier",
|
|
46698
|
+
"package-detection"
|
|
46699
|
+
];
|
|
46700
|
+
/** Steps whose box a root detection can BE. */
|
|
46701
|
+
var CROP_SUPPLY_STEP_IDS = ["plate-detection", "face-detection"];
|
|
46702
|
+
/**
|
|
46703
|
+
* Steps whose per-detection MASK a root detection can carry (D737). The live
|
|
46704
|
+
* mask step is `segmentation` — a frame-plane refiner that runs its own model
|
|
46705
|
+
* once per detection crop. (`instance-segmentation` is a dormant step id that
|
|
46706
|
+
* no camera tree carries.)
|
|
47234
46707
|
*/
|
|
47235
|
-
var
|
|
46708
|
+
var MASK_SUPPLY_STEP_IDS = ["segmentation"];
|
|
46709
|
+
[
|
|
46710
|
+
...LABEL_SUPPLY_STEP_IDS,
|
|
46711
|
+
...CROP_SUPPLY_STEP_IDS,
|
|
46712
|
+
...MASK_SUPPLY_STEP_IDS
|
|
46713
|
+
];
|
|
47236
46714
|
/**
|
|
47237
|
-
*
|
|
46715
|
+
* Multi-file format payload.
|
|
47238
46716
|
*
|
|
47239
|
-
*
|
|
47240
|
-
*
|
|
47241
|
-
*
|
|
47242
|
-
*
|
|
47243
|
-
*
|
|
47244
|
-
*
|
|
47245
|
-
*
|
|
46717
|
+
* - Directory formats (`isDirectory: true`, e.g. `.mlpackage`): files
|
|
46718
|
+
* relative to the directory root — the downloader fetches each from
|
|
46719
|
+
* `{url}/{file}` into `{modelDir}/{file}`. If omitted, it probes the
|
|
46720
|
+
* HuggingFace API (slower).
|
|
46721
|
+
* - Single-file formats (no `isDirectory`, e.g. OpenVINO IR): sibling
|
|
46722
|
+
* files fetched from the SAME remote directory as `url` and stored flat
|
|
46723
|
+
* alongside the main file — e.g. `['camstack-yolov9t.bin']` for the IR
|
|
46724
|
+
* weights next to `camstack-yolov9t.xml`.
|
|
46725
|
+
*/
|
|
46726
|
+
var ModelFormatEntrySchema = object({
|
|
46727
|
+
url: string(),
|
|
46728
|
+
sizeMB: number$1(),
|
|
46729
|
+
/** Whether this format is a directory bundle (e.g., .mlpackage) rather than a single file */
|
|
46730
|
+
isDirectory: boolean().optional(),
|
|
46731
|
+
/** Multi-file payload (directory members or sibling files). */
|
|
46732
|
+
files: array(string()).readonly().optional(),
|
|
46733
|
+
/** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
|
|
46734
|
+
runtimes: array(_enum(["python"])).readonly().optional(),
|
|
46735
|
+
/**
|
|
46736
|
+
* Content revision of the artefact, for one hosted OFF the CamStack mirror.
|
|
46737
|
+
* A format on the mirror leaves it unset: its revision (the sha256 of its
|
|
46738
|
+
* weight file) comes from the downloader's generated table, kept in step
|
|
46739
|
+
* with the mirror by `scripts/check-hosted-model-revisions.ts` (D744). A
|
|
46740
|
+
* node records the revision it downloaded next to the file
|
|
46741
|
+
* (`<file>.revision`); a copy with no record or a different one is stale
|
|
46742
|
+
* unless its weight file hashes to the revision, and a stale copy is
|
|
46743
|
+
* downloaded again, the old one serving until the new one is complete. No
|
|
46744
|
+
* revision at all ⇒ a file on disk is current, whatever it holds (D743).
|
|
46745
|
+
*/
|
|
46746
|
+
revision: string().min(1).optional()
|
|
46747
|
+
});
|
|
46748
|
+
/**
|
|
46749
|
+
* What a node holds for one (model, format) (D746). `current` is a complete
|
|
46750
|
+
* copy at its catalog revision — exactly what `downloaded: true` means.
|
|
46751
|
+
* `stale` is bytes on disk that are not (yet) proven current under D743/D744:
|
|
46752
|
+
* no or a different revision record, or a missing sibling. `missing` is no
|
|
46753
|
+
* copy. `downloaded` alone folds `stale` into "not downloaded", which hid
|
|
46754
|
+
* reclaimable bytes and a copy about to be replaced.
|
|
46755
|
+
*/
|
|
46756
|
+
var ModelOnDiskStateSchema = _enum([
|
|
46757
|
+
"current",
|
|
46758
|
+
"stale",
|
|
46759
|
+
"missing"
|
|
46760
|
+
]);
|
|
46761
|
+
/**
|
|
46762
|
+
* The numeric precision of one format's BUILD (D746) — reported only when the
|
|
46763
|
+
* build states it (file-name token, an INT8 variant, an EdgeTPU compile, a
|
|
46764
|
+
* CamStack Core ML export). Absent means "not stated", never "fp32".
|
|
46765
|
+
*/
|
|
46766
|
+
var ModelFormatPrecisionSchema = _enum([
|
|
46767
|
+
"fp32",
|
|
46768
|
+
"fp16",
|
|
46769
|
+
"int8"
|
|
46770
|
+
]);
|
|
46771
|
+
/**
|
|
46772
|
+
* One format of one model as a node's `pipelineExecutor.getSchema` reports it.
|
|
46773
|
+
* `onDisk` / `precision` are optional for version skew: a runner that predates
|
|
46774
|
+
* them omits them, and a reader falls back to `downloaded`.
|
|
46775
|
+
*/
|
|
46776
|
+
var PipelineModelFormatStatusSchema = object({
|
|
46777
|
+
downloaded: boolean(),
|
|
46778
|
+
sizeMB: number$1(),
|
|
46779
|
+
onDisk: ModelOnDiskStateSchema.optional(),
|
|
46780
|
+
precision: ModelFormatPrecisionSchema.optional()
|
|
46781
|
+
});
|
|
46782
|
+
/**
|
|
46783
|
+
* Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
|
|
46784
|
+
* The downloader fetches from `url` and saves to `{modelsDir}/{filename}`.
|
|
46785
|
+
*/
|
|
46786
|
+
var ModelExtraFileSchema = object({
|
|
46787
|
+
url: string(),
|
|
46788
|
+
filename: string(),
|
|
46789
|
+
sizeMB: number$1()
|
|
46790
|
+
});
|
|
46791
|
+
/**
|
|
46792
|
+
* Per-format payload map. Modelled as an explicit object (one optional key
|
|
46793
|
+
* per `ModelFormat`) rather than `z.record(enum, …)` — zod v4's enum-keyed
|
|
46794
|
+
* record requires every key, but a catalog entry only ships a subset of
|
|
46795
|
+
* formats.
|
|
46796
|
+
*/
|
|
46797
|
+
var ModelFormatsSchema = object({
|
|
46798
|
+
onnx: ModelFormatEntrySchema.optional(),
|
|
46799
|
+
coreml: ModelFormatEntrySchema.optional(),
|
|
46800
|
+
openvino: ModelFormatEntrySchema.optional(),
|
|
46801
|
+
tflite: ModelFormatEntrySchema.optional(),
|
|
46802
|
+
pt: ModelFormatEntrySchema.optional(),
|
|
46803
|
+
gguf: ModelFormatEntrySchema.optional()
|
|
46804
|
+
});
|
|
46805
|
+
/**
|
|
46806
|
+
* Variant-selector grouping axes. Shared by the full `ModelCatalogEntry` and by
|
|
46807
|
+
* the reduced `PipelineModelOption` returned in `pipeline.getSchema()` so the
|
|
46808
|
+
* grouped Family→Tier→Variant picker renders identically in the config UI and
|
|
46809
|
+
* in the pipeline/device steppers. The flat `id` stays the source of truth for
|
|
46810
|
+
* resolution/download/persistence; this is a presentation overlay resolved back
|
|
46811
|
+
* to an `id`.
|
|
46812
|
+
*/
|
|
46813
|
+
var ModelVariantGroupSchema = object({
|
|
46814
|
+
/** Top-level family, e.g. `yolo26` (later `d-fine`, `rf-detr`). */
|
|
46815
|
+
family: string(),
|
|
46816
|
+
/** Size within the family, e.g. `n` | `s` | `m` | `l`. */
|
|
46817
|
+
tier: string(),
|
|
46818
|
+
/** Quantization axis. Omit ⇒ the fp32 base build. */
|
|
46819
|
+
precision: _enum(["fp32", "int8"]).optional(),
|
|
46820
|
+
/**
|
|
46821
|
+
* Training / latency-variant axis. Omit ⇒ the standard build. `test` marks
|
|
46822
|
+
* an alternate training of the same family (plugin catalog `relu_test`); chip
|
|
46823
|
+
* label is "Test".
|
|
46824
|
+
*/
|
|
46825
|
+
optimization: _enum(["standard", "test"]).optional(),
|
|
46826
|
+
/**
|
|
46827
|
+
* Input-resolution axis (square input side, px). Omit ⇒ the family's native
|
|
46828
|
+
* resolution (640 for yolo26). Reduced-input builds (320 / 256) are a big,
|
|
46829
|
+
* cheap latency lever — especially on Apple ANE and the Intel N100 — at a
|
|
46830
|
+
* small-object accuracy cost. Mirrors the model's `inputSize` but lifted onto
|
|
46831
|
+
* the group so the selector can offer it as a variant axis.
|
|
46832
|
+
*/
|
|
46833
|
+
resolution: number$1().int().positive().optional()
|
|
46834
|
+
});
|
|
46835
|
+
var ModelProviderIdSchema = _enum([
|
|
46836
|
+
"camstack",
|
|
46837
|
+
"frigate",
|
|
46838
|
+
"scrypted",
|
|
46839
|
+
"custom"
|
|
46840
|
+
]);
|
|
46841
|
+
/**
|
|
46842
|
+
* The licence of a model, as a record rather than a bare SPDX string: a
|
|
46843
|
+
* permissive CODE licence routinely sits on top of restrictive WEIGHTS or
|
|
46844
|
+
* DATA, and the obligations (attribution, modification notices, source offers)
|
|
46845
|
+
* are per upstream. A persisted custom-model row written when this field was a
|
|
46846
|
+
* string still parses — the string is lifted into `{ weights }`.
|
|
47246
46847
|
*
|
|
47247
|
-
*
|
|
47248
|
-
*
|
|
47249
|
-
*
|
|
47250
|
-
*
|
|
46848
|
+
* Every machine licence surface (`THIRD_PARTY_MODELS.md`, the Hugging Face
|
|
46849
|
+
* model table) is GENERATED from these records by
|
|
46850
|
+
* `scripts/gen-model-licenses.ts` (D661). Operator-facing docs live in
|
|
46851
|
+
* `camstack/docs` → `/docs/detection/models`.
|
|
46852
|
+
*/
|
|
46853
|
+
var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { weights: value } : value, object({
|
|
46854
|
+
/** SPDX id of the WEIGHTS' terms, a `LicenseRef-*` for non-SPDX terms, or `UNKNOWN`. */
|
|
46855
|
+
weights: string().min(1),
|
|
46856
|
+
/** SPDX id of the upstream code that defines / trained the network. */
|
|
46857
|
+
code: string().min(1).optional(),
|
|
46858
|
+
/** Training data whose terms add obligations (attribution, non-commercial). */
|
|
46859
|
+
data: object({
|
|
46860
|
+
name: string().min(1),
|
|
46861
|
+
terms: string().min(1),
|
|
46862
|
+
url: string().url().optional()
|
|
46863
|
+
}).optional(),
|
|
46864
|
+
/** The project the weights come from. Required on built-in entries (guard). */
|
|
46865
|
+
upstream: object({
|
|
46866
|
+
name: string().min(1),
|
|
46867
|
+
url: string().url()
|
|
46868
|
+
}).optional(),
|
|
46869
|
+
/** Where the licence text governing the weights is published. */
|
|
46870
|
+
url: string().url().optional(),
|
|
46871
|
+
/** Attribution the licence REQUIRES, verbatim. */
|
|
46872
|
+
attribution: string().min(1).optional(),
|
|
46873
|
+
/** What CamStack changed. Required when `hosting` is `camstack-hf` (guard). */
|
|
46874
|
+
modifications: string().min(1).optional(),
|
|
46875
|
+
/** Who serves the file a node downloads. */
|
|
46876
|
+
hosting: _enum([
|
|
46877
|
+
"camstack-hf",
|
|
46878
|
+
"third-party",
|
|
46879
|
+
"built-in"
|
|
46880
|
+
]).optional(),
|
|
46881
|
+
/** True when the weights or their data forbid commercial use. */
|
|
46882
|
+
nonCommercial: boolean().optional()
|
|
46883
|
+
}));
|
|
46884
|
+
/**
|
|
46885
|
+
* One step a ROOT detector can supply from its own output (D730) — see
|
|
46886
|
+
* `ModelCatalogEntry.suppliesSteps`.
|
|
46887
|
+
*
|
|
46888
|
+
* - `label`: the root's raw class IS the step's answer. `labelToEffect` maps
|
|
46889
|
+
* the root's label to the step's vocabulary; `uncovered` is the vocabulary
|
|
46890
|
+
* the root cannot produce (shown as unavailable, never a blocker).
|
|
46891
|
+
* - `crop`: the root draws the box the step would have found (`license_plate`
|
|
46892
|
+
* for plate-detection, `face` for face-detection). The box becomes a detail
|
|
46893
|
+
* child of the `parentMacro` detection that contains it — never a track.
|
|
46894
|
+
* - `mask`: the root's decode emits an instance mask with every detection (a
|
|
46895
|
+
* YOLO26-seg root, D737) — the `segmentation` step's result, carried on the
|
|
46896
|
+
* detection in the shape that step produces. Derived from the model's
|
|
46897
|
+
* postprocessor on read, never stored by an import.
|
|
46898
|
+
*/
|
|
46899
|
+
var RootStepSupplySchema = discriminatedUnion("kind", [
|
|
46900
|
+
object({
|
|
46901
|
+
kind: literal("label"),
|
|
46902
|
+
stepId: _enum(LABEL_SUPPLY_STEP_IDS),
|
|
46903
|
+
labelToEffect: record(string(), string()),
|
|
46904
|
+
uncovered: array(string()).readonly()
|
|
46905
|
+
}),
|
|
46906
|
+
object({
|
|
46907
|
+
kind: literal("crop"),
|
|
46908
|
+
stepId: _enum(CROP_SUPPLY_STEP_IDS),
|
|
46909
|
+
rootLabels: array(string()).readonly(),
|
|
46910
|
+
parentMacro: _enum(["vehicle", "person"]),
|
|
46911
|
+
childClass: _enum(["plate", "face"]),
|
|
46912
|
+
/**
|
|
46913
|
+
* The root's smaller input side, stamped on read by `rootSuppliesOf` from
|
|
46914
|
+
* the model entry — what a step's `minRootInputPx` gate judges. Never
|
|
46915
|
+
* stored by an import.
|
|
46916
|
+
*/
|
|
46917
|
+
rootInputPx: number$1().int().positive().optional()
|
|
46918
|
+
}),
|
|
46919
|
+
object({
|
|
46920
|
+
kind: literal("mask"),
|
|
46921
|
+
stepId: _enum(MASK_SUPPLY_STEP_IDS)
|
|
46922
|
+
})
|
|
46923
|
+
]);
|
|
46924
|
+
var ModelCatalogEntrySchema = object({
|
|
46925
|
+
id: string(),
|
|
46926
|
+
name: string(),
|
|
46927
|
+
description: string(),
|
|
46928
|
+
formats: ModelFormatsSchema,
|
|
46929
|
+
inputSize: object({
|
|
46930
|
+
width: number$1(),
|
|
46931
|
+
height: number$1()
|
|
46932
|
+
}),
|
|
46933
|
+
/**
|
|
46934
|
+
* Channel count of the model input tensor. Omit ⇒ 3 (RGB), the default for
|
|
46935
|
+
* every detector / classifier / embedder. Set to 1 for a grayscale CTC text
|
|
46936
|
+
* recognizer (EasyOCR VGG plate-OCR: input `[N,1,H,W]`) so the preprocess
|
|
46937
|
+
* feeds a single-channel, EasyOCR-normalized tensor instead of the default
|
|
46938
|
+
* 3-channel RGB one. Threaded through `PoolModelConfig.inputChannels` to the
|
|
46939
|
+
* Python inference pool.
|
|
46940
|
+
*/
|
|
46941
|
+
inputChannels: number$1().int().positive().optional(),
|
|
46942
|
+
labels: array(LabelDefinitionSchema).readonly(),
|
|
46943
|
+
inputLayout: _enum(["nchw", "nhwc"]).optional(),
|
|
46944
|
+
/**
|
|
46945
|
+
* `'scrfd'` applies InsightFace's SCRFD input contract, `(x - 127.5) / 128`
|
|
46946
|
+
* (upstream `insightface/model_zoo/scrfd.py`), instead of the historical
|
|
46947
|
+
* plain `/255`. Measured against COCO GT: 188 → 196 faces found on the
|
|
46948
|
+
* `scrfd-2.5g` catalog entry (2026-09-26 model-replacement spike, §2.4-2).
|
|
46949
|
+
*/
|
|
46950
|
+
inputNormalization: _enum([
|
|
46951
|
+
"zero-one",
|
|
46952
|
+
"imagenet",
|
|
46953
|
+
"none",
|
|
46954
|
+
"scrfd"
|
|
46955
|
+
]).optional(),
|
|
46956
|
+
/**
|
|
46957
|
+
* The model already applies softmax IN-GRAPH — its raw output is a
|
|
46958
|
+
* probability distribution, not logits. When set, the `softmax`
|
|
46959
|
+
* postprocessor must NOT re-apply softmax: re-softmaxing an already-normalised
|
|
46960
|
+
* probability vector collapses it toward uniform (top-1 score craters far
|
|
46961
|
+
* below its true value, making every confidence gate meaningless). Absent ⇒
|
|
46962
|
+
* the output is raw logits and the postprocessor applies softmax (the normal
|
|
46963
|
+
* case). Set on the Google AIY Birds `bird-classifier` (softmax baked into the
|
|
46964
|
+
* TF graph). Threaded to the Python pool via `PoolModelConfig.outputProbabilities`.
|
|
46965
|
+
*/
|
|
46966
|
+
outputProbabilities: boolean().optional(),
|
|
46967
|
+
preprocessMode: _enum(["letterbox", "resize"]).optional(),
|
|
46968
|
+
/**
|
|
46969
|
+
* Per-MODEL postprocessor override. Absent ⇒ the step's own
|
|
46970
|
+
* `StepDefinition.postprocessor` applies (the normal case — every model in a
|
|
46971
|
+
* step shares its decode). Set it when a step hosts models with DIFFERENT raw
|
|
46972
|
+
* output layouts under one slot: e.g. object-detection is `'yolo'` by default,
|
|
46973
|
+
* but a Coral SSD MobileNet build emits the `TFLite_Detection_PostProcess`
|
|
46974
|
+
* 4-tensor layout and needs `'ssd'`. Threaded into `PoolModelConfig.postprocessor`
|
|
46975
|
+
* by the engine factory (`modelEntry.postprocessor ?? def.postprocessor`).
|
|
46976
|
+
*/
|
|
46977
|
+
postprocessor: custom().optional(),
|
|
46978
|
+
/**
|
|
46979
|
+
* Per-MODEL default confidence floor. Absent ⇒ the step's
|
|
46980
|
+
* `StepDefinition.defaultConfidence` applies. A score is a property of one
|
|
46981
|
+
* model's output scale, not of the step slot it sits in: YuNet's
|
|
46982
|
+
* `sqrt(cls·obj)` is not SCRFD's score, and inheriting SCRFD's 0.5 filled the
|
|
46983
|
+
* face gallery with wheels and hands (D662, amends D645). An operator's
|
|
46984
|
+
* explicit value still wins over it. Resolved in ONE place —
|
|
46985
|
+
* `addon-pipeline/.../registry/effective-confidence.ts`.
|
|
46986
|
+
*/
|
|
46987
|
+
defaultConfidence: number$1().min(0).max(1).optional(),
|
|
46988
|
+
/**
|
|
46989
|
+
* Per-MODEL default of the per-class confidence floors (`minConfidence<Macro>`
|
|
46990
|
+
* on a detector step), keyed by macro class: `{ person: 0.45 }`. A class
|
|
46991
|
+
* absent here runs at the step slider's global default. The same row shape
|
|
46992
|
+
* the floor measurement produces (`model-floors.json`: modelId → floors), so
|
|
46993
|
+
* a measured table is copied in as-is. An operator override is bound to the
|
|
46994
|
+
* model it was made for and does not survive a model change (D738). A custom
|
|
46995
|
+
* / imported model may declare it; without it, the global defaults apply.
|
|
46996
|
+
*/
|
|
46997
|
+
defaultClassFloors: record(string(), number$1().min(0).max(1)).optional(),
|
|
46998
|
+
/**
|
|
46999
|
+
* The inference precision this model's OpenVINO IR needs on an Intel GPU.
|
|
47000
|
+
* Absent ⇒ the device default (f16 on a GPU). Set to `'f32'` for an FP32 IR
|
|
47001
|
+
* that produces invalid output at f16 — measured 2026-10-07 for YOLO26
|
|
47002
|
+
* base IRs (`yolo26s`: 0 true / 146 false positives; `yolo26m*`: NaN
|
|
47003
|
+
* scores) on the Core Ultra iGPU and the N100. Threaded to the pool as
|
|
47004
|
+
* `PoolModelConfig.gpuInferencePrecision`; the pool sets
|
|
47005
|
+
* INFERENCE_PRECISION_HINT on a GPU only. Costs ~60% latency on the GPU.
|
|
47006
|
+
*/
|
|
47007
|
+
gpuInferencePrecision: _enum(["f32", "f16"]).optional(),
|
|
47008
|
+
/**
|
|
47009
|
+
* ROOT detectors only: per supplied step (`animal-classifier`, …), the
|
|
47010
|
+
* minimum DETECTION score from which this root's own fine label (species,
|
|
47011
|
+
* vehicle type — D736 root supply) is taken (D741). Below it the detection
|
|
47012
|
+
* keeps its macro class without the fine label. `1` = never take it from
|
|
47013
|
+
* this root. Absent ⇒ no floor beyond the macro floor. The supplied step's
|
|
47014
|
+
* `minConfidence` slider, bound to the ROOT model, overrides it.
|
|
47015
|
+
*/
|
|
47016
|
+
suppliedLabelFloors: record(string(), number$1().min(0).max(1)).optional(),
|
|
47017
|
+
/**
|
|
47018
|
+
* When true, the executor produces a landmark-aligned crop (similarity warp
|
|
47019
|
+
* onto the canonical template) before this step runs, instead of a plain
|
|
47020
|
+
* axis-aligned bbox crop. Required for face-recognition embedders (ArcFace):
|
|
47021
|
+
* their embeddings are only discriminative on an aligned input. The face
|
|
47022
|
+
* detector that produced the parent detail must emit 5 landmarks.
|
|
47023
|
+
*/
|
|
47024
|
+
faceAlignment: boolean().optional(),
|
|
47025
|
+
/**
|
|
47026
|
+
* Auxiliary files required at runtime (labels JSON, charset dict, etc.).
|
|
47027
|
+
* Downloaded into the same modelsDir alongside the model file.
|
|
47028
|
+
*/
|
|
47029
|
+
extraFiles: array(ModelExtraFileSchema).readonly().optional(),
|
|
47030
|
+
/**
|
|
47031
|
+
* LEGACY entry — retained in the catalog so a persisted operator selection
|
|
47032
|
+
* still RESOLVES (and can be re-activated), but hidden from the selectable
|
|
47033
|
+
* model list and excluded from the auto format-default pick. Set on the
|
|
47034
|
+
* superseded / consolidated models (older lineages, redundant fp16 IRs) so
|
|
47035
|
+
* the active lineup stays the coherent curated ladder without deleting a
|
|
47036
|
+
* model anyone may still be pinned to. `resolveModelForFormat` keeps honoring
|
|
47037
|
+
* an explicit legacy id that has a build for the node's format.
|
|
47038
|
+
*/
|
|
47039
|
+
legacy: boolean().optional(),
|
|
47040
|
+
/**
|
|
47041
|
+
* Measured quality/latency metadata — populated from the benchmark addon on
|
|
47042
|
+
* the real node classes. Absent = not yet measured (most entries today; the
|
|
47043
|
+
* catalog historically carried only `sizeMB`, a poor cross-architecture
|
|
47044
|
+
* speed proxy). `p95LatencyMs` is keyed by node class (e.g. `n100`, `mac`).
|
|
47045
|
+
*/
|
|
47046
|
+
metrics: object({
|
|
47047
|
+
map50: number$1().optional(),
|
|
47048
|
+
p95LatencyMs: record(string(), number$1()).optional()
|
|
47049
|
+
}).optional(),
|
|
47050
|
+
/**
|
|
47051
|
+
* The model's licence record — see {@link ModelLicenseSchema}. Optional in
|
|
47052
|
+
* the schema (a custom model's author may state none); REQUIRED and complete
|
|
47053
|
+
* on every built-in catalog entry (`scripts/check-catalog-licence.ts`).
|
|
47054
|
+
*/
|
|
47055
|
+
license: ModelLicenseSchema.optional(),
|
|
47056
|
+
/**
|
|
47057
|
+
* Variant-selector grouping. The UI groups models by `family` + `tier` and
|
|
47058
|
+
* offers `precision` / `optimization` as variant axes WITHIN a tier — so all
|
|
47059
|
+
* of a family's sizes and quantizations collapse into one grouped picker
|
|
47060
|
+
* instead of a flat list of `yolo26s`, `yolo26s-int8`, … Absent ⇒ ungrouped
|
|
47061
|
+
* (legacy / custom models) — never shown in the grouped selector. The flat
|
|
47062
|
+
* `id` stays the source of truth for resolution/download/persistence; grouping
|
|
47063
|
+
* is a presentation overlay resolved back to an `id`.
|
|
47064
|
+
*/
|
|
47065
|
+
group: ModelVariantGroupSchema.optional(),
|
|
47066
|
+
/**
|
|
47067
|
+
* Catalog source for the pipeline stepper's provider-first picker. Absent on
|
|
47068
|
+
* built-in CamStack entries (treated as `camstack`) and on registry rows
|
|
47069
|
+
* persisted before this field existed (`inferModelProvider` fills those).
|
|
47070
|
+
*/
|
|
47071
|
+
provider: ModelProviderIdSchema.optional(),
|
|
47072
|
+
/**
|
|
47073
|
+
* Per-MODEL class map override. Absent ⇒ the step's `StepDefinition.classMap`
|
|
47074
|
+
* applies (plus catalog / COCO public catalog). Set on a custom model whose raw
|
|
47075
|
+
* labels already ARE the CamStack macros (plugin catalog identity map).
|
|
47076
|
+
*/
|
|
47077
|
+
classMap: DetectionCatalogClassMapSchema.optional(),
|
|
47078
|
+
/**
|
|
47079
|
+
* The pipeline steps this ROOT detector can supply from its own output
|
|
47080
|
+
* (D730): its labels name a step's effect (`deer` for `animal-classifier`)
|
|
47081
|
+
* or draw a step's box (`license_plate` for `plate-detection`). Computed at
|
|
47082
|
+
* import from THIS model's labelmap by `deriveRootSupplies`, never written
|
|
47083
|
+
* by hand and never assumed per family; a row without it is derived on read
|
|
47084
|
+
* (`rootSuppliesOf`). Whether a camera uses it is the step's own
|
|
47085
|
+
* `useRootModel` flag (`resolveRootSupply`).
|
|
47086
|
+
*/
|
|
47087
|
+
suppliesSteps: array(RootStepSupplySchema).readonly().optional(),
|
|
47088
|
+
/**
|
|
47089
|
+
* The model's CLIP feature-space contract (text encoder, dimension, vector
|
|
47090
|
+
* index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
|
|
47091
|
+
* CLIP image encoder; its absence is what "not a CLIP model" means to the
|
|
47092
|
+
* embedding encoder and the semantic-search store (D649).
|
|
47093
|
+
*/
|
|
47094
|
+
clip: ClipModelMetaSchema.optional()
|
|
47095
|
+
});
|
|
47096
|
+
var ConvertTargetSchema = discriminatedUnion("format", [object({
|
|
47097
|
+
format: literal("openvino"),
|
|
47098
|
+
precisions: array(_enum(["fp16", "int8"])).min(1).readonly()
|
|
47099
|
+
}), object({ format: literal("coreml") })]);
|
|
47100
|
+
var ModelConvertMetadataSchema = object({
|
|
47101
|
+
id: string().regex(/^[a-zA-Z0-9._-]+$/),
|
|
47102
|
+
name: string(),
|
|
47103
|
+
labels: array(LabelDefinitionSchema).readonly(),
|
|
47104
|
+
inputSize: object({
|
|
47105
|
+
width: number$1(),
|
|
47106
|
+
height: number$1()
|
|
47107
|
+
}),
|
|
47108
|
+
inputLayout: _enum(["nchw", "nhwc"]).optional(),
|
|
47109
|
+
inputNormalization: _enum([
|
|
47110
|
+
"zero-one",
|
|
47111
|
+
"imagenet",
|
|
47112
|
+
"none",
|
|
47113
|
+
"scrfd"
|
|
47114
|
+
]).optional(),
|
|
47115
|
+
preprocessMode: _enum(["letterbox", "resize"]).optional(),
|
|
47116
|
+
outputFormat: _enum([
|
|
47117
|
+
"yolo",
|
|
47118
|
+
"ssd",
|
|
47119
|
+
"embedding",
|
|
47120
|
+
"classification",
|
|
47121
|
+
"ocr",
|
|
47122
|
+
"segmentation"
|
|
47123
|
+
]),
|
|
47124
|
+
faceAlignment: boolean().optional(),
|
|
47125
|
+
classMap: DetectionCatalogClassMapSchema.optional()
|
|
47126
|
+
});
|
|
47127
|
+
var ConvertResultSchema = object({
|
|
47128
|
+
entry: ModelCatalogEntrySchema,
|
|
47129
|
+
artifacts: array(object({
|
|
47130
|
+
format: _enum(MODEL_FORMATS),
|
|
47131
|
+
precision: _enum(["fp16", "int8"]).optional(),
|
|
47132
|
+
sizeMB: number$1(),
|
|
47133
|
+
validated: boolean(),
|
|
47134
|
+
files: array(string()).readonly()
|
|
47135
|
+
})).readonly()
|
|
47136
|
+
});
|
|
47137
|
+
var ViewerFeatureIdSchema = _enum([
|
|
47138
|
+
"face-assignment",
|
|
47139
|
+
"plate-assignment",
|
|
47140
|
+
"retrain",
|
|
47141
|
+
"scenes"
|
|
47142
|
+
]);
|
|
47143
|
+
/** Which devices a viewer reaches: `allow` minus `block`. */
|
|
47144
|
+
var ViewerDeviceAllowSchema = union([literal("*"), array(number$1().int().nonnegative())]);
|
|
47145
|
+
/**
|
|
47146
|
+
* The viewer grant, stored as ONE row of a user's `scopes`. A principal that
|
|
47147
|
+
* holds it is decided by the viewer rules ALONE — any other row it carries is
|
|
47148
|
+
* ignored, so a viewer can never be widened by a leftover grant.
|
|
47149
|
+
*/
|
|
47150
|
+
var ViewerTokenScopeSchema = object({
|
|
47151
|
+
type: literal("viewer"),
|
|
47152
|
+
allow: ViewerDeviceAllowSchema,
|
|
47153
|
+
block: array(number$1().int().nonnegative()),
|
|
47154
|
+
features: array(ViewerFeatureIdSchema)
|
|
47155
|
+
});
|
|
47156
|
+
/**
|
|
47157
|
+
* Zod schemas for persisted record types.
|
|
47158
|
+
*
|
|
47159
|
+
* These schemas serve as the single source of truth for types that are
|
|
47160
|
+
* stored in the settings-store backend and retrieved via tRPC. They
|
|
47161
|
+
* replace the manual TypeScript interfaces with schema-derived types,
|
|
47162
|
+
* enabling runtime validation when reading from the backend.
|
|
47163
|
+
*
|
|
47164
|
+
* Convention: each schema is named `<Type>Schema`, the inferred TS type
|
|
47165
|
+
* keeps the original name for backward compatibility.
|
|
47166
|
+
*/
|
|
47167
|
+
/**
|
|
47168
|
+
* Auth model (v2 — 2026-05-12 caps-only):
|
|
47169
|
+
*
|
|
47170
|
+
* Two principals:
|
|
47171
|
+
* - `isAdmin: true` — full bypass. Admin scope set is ignored.
|
|
47172
|
+
* - `isAdmin: false` — every call gated by `scopes` (see TokenScope).
|
|
47173
|
+
*
|
|
47174
|
+
* No role enum. There used to be `viewer / agent / scoped` and earlier
|
|
47175
|
+
* `super_admin` — collapsed onto the single boolean because every
|
|
47176
|
+
* non-admin caller is governed by the same scope-check rules; the
|
|
47177
|
+
* distinction was only ever used to route role-specific procedures
|
|
47178
|
+
* which we no longer have. CLI / webhook integrations are tokens (`auth.mintToken`)
|
|
47179
|
+
* with `isAdmin: false` + an explicit scope list.
|
|
47180
|
+
*/
|
|
47181
|
+
/** Per-method access flavour. Materialised on every cap method via codegen. */
|
|
47182
|
+
var MethodAccessSchema = _enum([
|
|
47183
|
+
"view",
|
|
47184
|
+
"create",
|
|
47185
|
+
"delete"
|
|
47186
|
+
]);
|
|
47187
|
+
/**
|
|
47188
|
+
* A single scope grant. Three forms — checked in matcher with OR
|
|
47189
|
+
* semantics; the first match decides whether the call passes:
|
|
47190
|
+
*
|
|
47191
|
+
* - `category` — broadest. `target: 'device' | 'system'` selects every
|
|
47192
|
+
* cap with the matching `scope` declaration. New caps inherit grants
|
|
47193
|
+
* automatically — adding a device cap to the codebase makes it
|
|
47194
|
+
* reachable to every user with `category:device [...]` without a
|
|
47195
|
+
* re-grant. Use this for "family viewer" / "operator" tiers.
|
|
47196
|
+
*
|
|
47197
|
+
* - `addon` — every cap that ships inside a given addon id. Niche;
|
|
47198
|
+
* useful when an integration needs to interact with one specific
|
|
47199
|
+
* addon's surface regardless of how many caps it exports.
|
|
47251
47200
|
*
|
|
47252
|
-
*
|
|
47201
|
+
* - `capability` — the most precise form. Single cap name. Use for
|
|
47202
|
+
* integration tokens where you want to grant `addons.installPackage`
|
|
47203
|
+
* and nothing else.
|
|
47253
47204
|
*
|
|
47254
|
-
*
|
|
47255
|
-
*
|
|
47256
|
-
|
|
47257
|
-
|
|
47205
|
+
* `access` is REQUIRED with min 1 element. `admin` bypass is the
|
|
47206
|
+
* "give me everything" escape; there is no wildcard scope.
|
|
47207
|
+
*/
|
|
47208
|
+
var AllowedProviderSchema = union([literal("*"), array(string())]);
|
|
47209
|
+
var AllowedDevicesSchema = record(string(), union([literal("*"), array(string())]));
|
|
47210
|
+
var CapScopeSchema = _enum(["device", "system"]);
|
|
47211
|
+
/**
|
|
47212
|
+
* DeviceSelector (scope model v3 — 2026-08-12).
|
|
47258
47213
|
*
|
|
47259
|
-
*
|
|
47214
|
+
* A `device` grant no longer carries a frozen list of deviceIds. It carries
|
|
47215
|
+
* a SELECTOR the matcher resolves against the live fleet, so the grant can be
|
|
47216
|
+
* DYNAMIC: a `types:['camera']` selector automatically covers a camera added
|
|
47217
|
+
* AFTER the grant was minted — no re-grant, no re-login.
|
|
47260
47218
|
*
|
|
47261
|
-
*
|
|
47262
|
-
*
|
|
47219
|
+
* - `all` — every device in the deployment. The broad viewer/operator
|
|
47220
|
+
* lever without a `category` grant (a `category` grant also covers device
|
|
47221
|
+
* caps that carry no deviceId; `all` is specifically the device set).
|
|
47222
|
+
* - `ids` — an explicit deviceId list. This is what a v2 `device:[…]`
|
|
47223
|
+
* grant migrates to (see {@link TokenScopeSchema}); STATIC — a new camera
|
|
47224
|
+
* is NOT covered until the grant is edited.
|
|
47225
|
+
* - `types` — every device of a `DeviceType` (e.g. every `camera`).
|
|
47226
|
+
* DYNAMIC. A device that changes type, or a new device of the type,
|
|
47227
|
+
* re-resolves on the next request.
|
|
47228
|
+
* - `locations` — every device whose operator-assigned `location` label is
|
|
47229
|
+
* in the set (e.g. "Garden", "Front door"). DYNAMIC. A device with a
|
|
47230
|
+
* null/unset location matches NO `locations` selector.
|
|
47263
47231
|
*/
|
|
47264
|
-
var
|
|
47265
|
-
|
|
47266
|
-
|
|
47267
|
-
|
|
47268
|
-
|
|
47232
|
+
var DeviceSelectorSchema = discriminatedUnion("kind", [
|
|
47233
|
+
object({ kind: literal("all") }),
|
|
47234
|
+
object({
|
|
47235
|
+
kind: literal("ids"),
|
|
47236
|
+
ids: array(number$1().int()).min(1)
|
|
47237
|
+
}),
|
|
47238
|
+
object({
|
|
47239
|
+
kind: literal("types"),
|
|
47240
|
+
types: array(_enum(DeviceType)).min(1)
|
|
47241
|
+
}),
|
|
47242
|
+
object({
|
|
47243
|
+
kind: literal("locations"),
|
|
47244
|
+
locations: array(string().min(1)).min(1)
|
|
47245
|
+
})
|
|
47246
|
+
]);
|
|
47247
|
+
var DeviceTokenScopeSchema = object({
|
|
47248
|
+
type: literal("device"),
|
|
47249
|
+
/** The device SET this grant covers — resolved against the live fleet. */
|
|
47250
|
+
selector: DeviceSelectorSchema,
|
|
47251
|
+
access: array(MethodAccessSchema).min(1),
|
|
47252
|
+
/**
|
|
47253
|
+
* Whether a grant on a PARENT device transparently covers its accessory
|
|
47254
|
+
* CHILDREN (siren / floodlight / PIR) via the persisted-parentage walk.
|
|
47255
|
+
* Direction is parent → children ONLY.
|
|
47256
|
+
*
|
|
47257
|
+
* Absent → the matcher DERIVES it from the access flavour: `view`
|
|
47258
|
+
* inherits (a camera viewer sees the camera's accessories), `create` /
|
|
47259
|
+
* `delete` do NOT (actuating/removing a child is an explicit act the
|
|
47260
|
+
* operator must grant on the child, not inherit from the parent). Set it
|
|
47261
|
+
* explicitly to override that default per grant.
|
|
47262
|
+
*/
|
|
47263
|
+
includeLinked: boolean().optional()
|
|
47264
|
+
});
|
|
47265
|
+
/**
|
|
47266
|
+
* v2 → v3 lazy migration. A pre-v3 `device` grant carried
|
|
47267
|
+
* `targets: string[]` (stringified deviceIds); it rewrites to the equivalent
|
|
47268
|
+
* `selector: {kind:'ids', ids}`. Applied as a `preprocess` so it runs on
|
|
47269
|
+
* EVERY parse path — stored records AND the JWT-carried scope arrays
|
|
47270
|
+
* normalised at the request boundary ({@link normalizeTokenScopes} in
|
|
47271
|
+
* `device-selector.ts`). Chosen over a one-time DB migration because a
|
|
47272
|
+
* migration cannot reach a JWT already in a client's hands; parse-time
|
|
47273
|
+
* migration covers both without a flag day. No cast — the raw object is read
|
|
47274
|
+
* through `Reflect.get` (its static type is `unknown`).
|
|
47275
|
+
*/
|
|
47276
|
+
function migrateLegacyTokenScope(raw) {
|
|
47277
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
47278
|
+
if (Reflect.get(raw, "type") !== "device") return raw;
|
|
47279
|
+
if (Reflect.get(raw, "selector") !== void 0) return canonicalSelectorTypes(raw);
|
|
47280
|
+
const targets = Reflect.get(raw, "targets");
|
|
47281
|
+
if (!Array.isArray(targets)) return raw;
|
|
47282
|
+
return {
|
|
47283
|
+
type: "device",
|
|
47284
|
+
selector: {
|
|
47285
|
+
kind: "ids",
|
|
47286
|
+
ids: targets.map((t) => typeof t === "string" ? Number(t) : t).filter((n) => typeof n === "number" && Number.isInteger(n))
|
|
47287
|
+
},
|
|
47288
|
+
access: Reflect.get(raw, "access")
|
|
47289
|
+
};
|
|
47269
47290
|
}
|
|
47270
47291
|
/**
|
|
47271
|
-
*
|
|
47272
|
-
*
|
|
47273
|
-
*
|
|
47274
|
-
*
|
|
47275
|
-
* check is membership in the catalog and the type is {@link IconKey}.
|
|
47292
|
+
* A stored `types` selector may name a type D1033 retired (`thermostat`). The
|
|
47293
|
+
* grant is read back through this same preprocess, so the retired name is
|
|
47294
|
+
* rewritten to its canonical type here and {@link DeviceSelectorSchema} itself
|
|
47295
|
+
* stays a strict enum on the wire.
|
|
47276
47296
|
*/
|
|
47277
|
-
|
|
47278
|
-
|
|
47279
|
-
|
|
47280
|
-
|
|
47281
|
-
|
|
47282
|
-
|
|
47283
|
-
|
|
47297
|
+
function canonicalSelectorTypes(raw) {
|
|
47298
|
+
const selector = Reflect.get(raw, "selector");
|
|
47299
|
+
if (selector === null || typeof selector !== "object") return raw;
|
|
47300
|
+
if (Reflect.get(selector, "kind") !== "types") return raw;
|
|
47301
|
+
const types = Reflect.get(selector, "types");
|
|
47302
|
+
if (!Array.isArray(types)) return raw;
|
|
47303
|
+
const canonical = types.map((t) => typeof t === "string" ? canonicalStoredDeviceType(t) : t);
|
|
47284
47304
|
return {
|
|
47285
|
-
|
|
47286
|
-
|
|
47287
|
-
|
|
47288
|
-
|
|
47289
|
-
|
|
47305
|
+
...raw,
|
|
47306
|
+
selector: {
|
|
47307
|
+
...selector,
|
|
47308
|
+
types: canonical
|
|
47309
|
+
}
|
|
47290
47310
|
};
|
|
47311
|
+
}
|
|
47312
|
+
var TokenScopeSchema = preprocess(migrateLegacyTokenScope, discriminatedUnion("type", [
|
|
47313
|
+
object({
|
|
47314
|
+
type: literal("category"),
|
|
47315
|
+
target: CapScopeSchema,
|
|
47316
|
+
access: array(MethodAccessSchema).min(1)
|
|
47317
|
+
}),
|
|
47318
|
+
object({
|
|
47319
|
+
type: literal("capability"),
|
|
47320
|
+
target: string(),
|
|
47321
|
+
access: array(MethodAccessSchema).min(1)
|
|
47322
|
+
}),
|
|
47323
|
+
object({
|
|
47324
|
+
type: literal("addon"),
|
|
47325
|
+
target: string(),
|
|
47326
|
+
access: array(MethodAccessSchema).min(1)
|
|
47327
|
+
}),
|
|
47328
|
+
DeviceTokenScopeSchema
|
|
47329
|
+
]));
|
|
47330
|
+
/**
|
|
47331
|
+
* What a PERSON's grant set holds (D921): the capability rows above (legacy
|
|
47332
|
+
* users, integration-style tokens) or the viewer row, which is decided by its
|
|
47333
|
+
* own rules alone. Kept apart from {@link TokenScope} so every surface that
|
|
47334
|
+
* edits capability rows (the scope picker, token minting) keeps its shape.
|
|
47335
|
+
*/
|
|
47336
|
+
var UserScopeSchema = union([ViewerTokenScopeSchema, TokenScopeSchema]);
|
|
47337
|
+
object({
|
|
47338
|
+
id: string(),
|
|
47339
|
+
username: string(),
|
|
47340
|
+
passwordHash: string(),
|
|
47341
|
+
/**
|
|
47342
|
+
* Admin bypass. When true, the middleware skips the scope-access
|
|
47343
|
+
* check entirely. There is no other axis of privilege; the legacy
|
|
47344
|
+
* role enum collapsed onto this boolean in v2.
|
|
47345
|
+
*/
|
|
47346
|
+
isAdmin: boolean().default(false),
|
|
47347
|
+
allowedProviders: AllowedProviderSchema,
|
|
47348
|
+
allowedDevices: AllowedDevicesSchema,
|
|
47349
|
+
/**
|
|
47350
|
+
* Scopes granted to this user. Admins bypass; their `scopes` is
|
|
47351
|
+
* ignored. Non-admins without scopes are locked out of every
|
|
47352
|
+
* protected call.
|
|
47353
|
+
*/
|
|
47354
|
+
scopes: array(UserScopeSchema).default([]),
|
|
47355
|
+
createdAt: number$1(),
|
|
47356
|
+
updatedAt: number$1()
|
|
47357
|
+
});
|
|
47358
|
+
object({
|
|
47359
|
+
id: string(),
|
|
47360
|
+
userId: string(),
|
|
47361
|
+
name: string(),
|
|
47362
|
+
tokenHash: string(),
|
|
47363
|
+
tokenPrefix: string(),
|
|
47364
|
+
scopes: array(TokenScopeSchema),
|
|
47365
|
+
expiresAt: number$1().nullish(),
|
|
47366
|
+
lastUsedAt: number$1().nullish(),
|
|
47367
|
+
createdAt: number$1()
|
|
47368
|
+
});
|
|
47369
|
+
/** What a share-view grant lets its holder see. */
|
|
47370
|
+
var ShareViewGrantSchema = object({
|
|
47371
|
+
kind: _enum(SHARE_VIEW_KINDS),
|
|
47372
|
+
deviceIds: array(number$1().int().nonnegative()).min(1).max(64),
|
|
47373
|
+
/** Talk-back, opt-in at mint time; absent means off. */
|
|
47374
|
+
talk: boolean().optional()
|
|
47375
|
+
});
|
|
47376
|
+
var ShareViewScopeSchema = object({
|
|
47377
|
+
type: literal("share-view"),
|
|
47378
|
+
grant: ShareViewGrantSchema
|
|
47379
|
+
});
|
|
47380
|
+
var AddonRoutesScopeSchema = object({
|
|
47381
|
+
type: literal("addon-routes"),
|
|
47382
|
+
access: array(MethodAccessSchema).min(1)
|
|
47383
|
+
});
|
|
47384
|
+
var PreferencesSelfScopeSchema = object({ type: literal("preferences-self") });
|
|
47385
|
+
var CredentialScopeSchema = union([
|
|
47386
|
+
literal("*"),
|
|
47387
|
+
ShareViewScopeSchema,
|
|
47388
|
+
AddonRoutesScopeSchema,
|
|
47389
|
+
PreferencesSelfScopeSchema,
|
|
47390
|
+
ViewerTokenScopeSchema,
|
|
47391
|
+
TokenScopeSchema
|
|
47392
|
+
]);
|
|
47393
|
+
object({
|
|
47394
|
+
kind: literal("credential"),
|
|
47395
|
+
sub: string().min(1),
|
|
47396
|
+
jti: string().min(16),
|
|
47397
|
+
scopes: array(CredentialScopeSchema).min(1)
|
|
47398
|
+
});
|
|
47399
|
+
var PreferenceNamespaceSchema = string().regex(/^[a-z][a-z0-9.-]{0,63}$/);
|
|
47400
|
+
/** A namespace's value: a JSON object, opaque to the hub. */
|
|
47401
|
+
var PreferenceValueSchema = record(string(), unknown());
|
|
47402
|
+
var PreferenceDeviceIdSchema = string().min(1).max(64);
|
|
47403
|
+
/** A stored row, as the owner reads it. */
|
|
47404
|
+
var PreferenceRowSchema = object({
|
|
47405
|
+
namespace: PreferenceNamespaceSchema,
|
|
47406
|
+
value: PreferenceValueSchema,
|
|
47407
|
+
/** Starts at 1, +1 on every write of this namespace. A delete ends the row and its count. */
|
|
47408
|
+
revision: number$1().int().positive(),
|
|
47409
|
+
updatedAt: number$1().int(),
|
|
47410
|
+
/** The client id the last writer sent; `null` when it sent none. */
|
|
47411
|
+
updatedByDevice: PreferenceDeviceIdSchema.nullable()
|
|
47412
|
+
});
|
|
47413
|
+
object({
|
|
47414
|
+
/** Absent: every namespace the caller holds. */
|
|
47415
|
+
namespaces: array(PreferenceNamespaceSchema).max(32).optional() });
|
|
47416
|
+
object({ rows: array(PreferenceRowSchema) });
|
|
47417
|
+
object({
|
|
47418
|
+
namespace: PreferenceNamespaceSchema,
|
|
47419
|
+
value: PreferenceValueSchema,
|
|
47420
|
+
/**
|
|
47421
|
+
* The revision the edit was based on. Absent: last write wins. `0`: the
|
|
47422
|
+
* namespace must not exist yet. Any other value that is not the current
|
|
47423
|
+
* revision answers `conflict` and writes nothing.
|
|
47424
|
+
*/
|
|
47425
|
+
baseRevision: number$1().int().nonnegative().optional(),
|
|
47426
|
+
deviceId: PreferenceDeviceIdSchema.optional()
|
|
47427
|
+
});
|
|
47428
|
+
discriminatedUnion("status", [object({
|
|
47429
|
+
status: literal("saved"),
|
|
47430
|
+
row: PreferenceRowSchema
|
|
47431
|
+
}), object({
|
|
47432
|
+
status: literal("conflict"),
|
|
47433
|
+
current: PreferenceRowSchema.nullable()
|
|
47434
|
+
})]);
|
|
47435
|
+
object({ namespace: PreferenceNamespaceSchema });
|
|
47436
|
+
object({
|
|
47437
|
+
/** `false` when the namespace did not exist. */
|
|
47438
|
+
deleted: boolean() });
|
|
47439
|
+
object({
|
|
47440
|
+
/** The revision the client holds per namespace; a namespace it does not list is new to it. */
|
|
47441
|
+
revisionByNamespace: record(PreferenceNamespaceSchema, number$1().int().nonnegative()).refine((map) => Object.keys(map).length <= 32, { message: `at most 32 namespaces` }) });
|
|
47442
|
+
object({
|
|
47443
|
+
/** Every row whose revision differs from the client's, and every row it did not list. */
|
|
47444
|
+
rows: array(PreferenceRowSchema),
|
|
47445
|
+
/** Namespaces the client listed that no longer exist. */
|
|
47446
|
+
deleted: array(PreferenceNamespaceSchema)
|
|
47447
|
+
});
|
|
47448
|
+
_enum(["new-session", "step-up"]);
|
|
47449
|
+
/** The languages the hub's app landing pages are written in (D858). */
|
|
47450
|
+
var AppPageLangSchema = _enum(["en", "it"]);
|
|
47451
|
+
/** How a native app starts one login method (D858), as `auth.listLoginMethods` reports it. */
|
|
47452
|
+
var AppLoginPathSchema = discriminatedUnion("kind", [object({ kind: literal("native") }), object({
|
|
47453
|
+
kind: literal("browser"),
|
|
47454
|
+
startPath: string().startsWith("/")
|
|
47455
|
+
})]);
|
|
47456
|
+
/**
|
|
47457
|
+
* Device certificates (D855) — the wire contract shared by the hub, the admin
|
|
47458
|
+
* UI and the native viewer.
|
|
47459
|
+
*
|
|
47460
|
+
* A device (a phone) generates its OWN P-256 key pair in hardware (Secure
|
|
47461
|
+
* Enclave / Android Keystore / a non-extractable WebCrypto key). The private
|
|
47462
|
+
* key never travels. The hub signs the PUBLIC key into an X.509 leaf under a
|
|
47463
|
+
* dedicated device CA; the device later proves possession of the key by
|
|
47464
|
+
* signing a hub-issued nonce, and the hub answers with the same session a
|
|
47465
|
+
* password login opens.
|
|
47466
|
+
*
|
|
47467
|
+
* Everything on the wire is a small string (a PEM, a base64url signature):
|
|
47468
|
+
* D613 is about bulk bytes, and a certificate is ~600 bytes.
|
|
47469
|
+
*/
|
|
47470
|
+
/** Signature algorithm of every device credential: ECDSA, curve P-256, SHA-256. */
|
|
47471
|
+
var DEVICE_CERT_SIGNATURE = "ecdsa-p256-sha256";
|
|
47472
|
+
/** First line of every signed message; a change of format bumps the version. */
|
|
47473
|
+
var DEVICE_SIGNATURE_MESSAGE_VERSION = "camstack-device-cert-v1";
|
|
47474
|
+
_enum([
|
|
47475
|
+
"login",
|
|
47476
|
+
"renew",
|
|
47477
|
+
"revoke"
|
|
47478
|
+
]);
|
|
47479
|
+
var DevicePlatformSchema = _enum([
|
|
47480
|
+
"ios",
|
|
47481
|
+
"android",
|
|
47482
|
+
"web",
|
|
47483
|
+
"other"
|
|
47484
|
+
]);
|
|
47485
|
+
var Base64UrlSchema = string().min(1).max(4096).regex(/^[A-Za-z0-9_-]+$/);
|
|
47486
|
+
var PemSchema = string().min(1).max(16384);
|
|
47487
|
+
/**
|
|
47488
|
+
* Why a device-certificate endpoint said no. Distinct from a transport / 5xx
|
|
47489
|
+
* failure: those carry no reason and mean "try again", never "the credential is
|
|
47490
|
+
* dead". The viewer switches on this exhaustively.
|
|
47491
|
+
*/
|
|
47492
|
+
var DeviceRefusalReasonSchema = _enum([
|
|
47493
|
+
"revoked",
|
|
47494
|
+
"unknown-credential",
|
|
47495
|
+
"expired",
|
|
47496
|
+
"bad-signature",
|
|
47497
|
+
"nonce-invalid",
|
|
47498
|
+
"rate-limited",
|
|
47499
|
+
"invalid-certificate",
|
|
47500
|
+
"superseded",
|
|
47501
|
+
"user-gone",
|
|
47502
|
+
"unavailable",
|
|
47503
|
+
"code-invalid",
|
|
47504
|
+
"self-enrollment-disabled",
|
|
47505
|
+
"step-up-required",
|
|
47506
|
+
"bad-public-key"
|
|
47507
|
+
]);
|
|
47508
|
+
var DeviceRefusalSchema = object({
|
|
47509
|
+
ok: literal(false),
|
|
47510
|
+
reason: DeviceRefusalReasonSchema,
|
|
47511
|
+
definitive: boolean(),
|
|
47512
|
+
retryAfterSeconds: number$1().optional()
|
|
47513
|
+
});
|
|
47514
|
+
object({
|
|
47515
|
+
code: string().min(1).max(256),
|
|
47516
|
+
/** SubjectPublicKeyInfo DER of the device's P-256 public key, base64url. */
|
|
47517
|
+
publicKeySpki: Base64UrlSchema,
|
|
47518
|
+
deviceName: string().min(1).max(80).optional(),
|
|
47519
|
+
platform: DevicePlatformSchema
|
|
47520
|
+
});
|
|
47521
|
+
discriminatedUnion("ok", [object({
|
|
47522
|
+
credentialId: string(),
|
|
47523
|
+
certPem: PemSchema,
|
|
47524
|
+
/** The device CA certificate the leaf chains to. */
|
|
47525
|
+
chainPem: PemSchema,
|
|
47526
|
+
notAfter: number$1(),
|
|
47527
|
+
user: object({
|
|
47528
|
+
id: string(),
|
|
47529
|
+
username: string()
|
|
47530
|
+
})
|
|
47531
|
+
}).extend({ ok: literal(true) }), DeviceRefusalSchema]);
|
|
47532
|
+
object({
|
|
47533
|
+
/** The single-use step-up proof (`auth.deviceEnrollProofFrom…`). */
|
|
47534
|
+
proof: string().min(1).max(512),
|
|
47535
|
+
publicKeySpki: Base64UrlSchema,
|
|
47536
|
+
deviceName: string().min(1).max(80),
|
|
47537
|
+
platform: DevicePlatformSchema
|
|
47538
|
+
});
|
|
47539
|
+
object({
|
|
47540
|
+
proof: string(),
|
|
47541
|
+
expiresAt: number$1()
|
|
47542
|
+
});
|
|
47543
|
+
discriminatedUnion("ok", [object({
|
|
47544
|
+
nonce: string(),
|
|
47545
|
+
/** The origin to put in the signed message. The app compares it to the hub it dialled. */
|
|
47546
|
+
origin: string(),
|
|
47547
|
+
expiresAt: number$1(),
|
|
47548
|
+
signature: literal(DEVICE_CERT_SIGNATURE)
|
|
47549
|
+
}).extend({ ok: literal(true) }), DeviceRefusalSchema]);
|
|
47550
|
+
object({
|
|
47551
|
+
certPem: PemSchema,
|
|
47552
|
+
nonce: string().min(1).max(256),
|
|
47553
|
+
/** ECDSA P-256 SHA-256 over {@link buildDeviceSignatureMessage}; raw r||s or DER, base64url. */
|
|
47554
|
+
signature: Base64UrlSchema
|
|
47555
|
+
});
|
|
47556
|
+
discriminatedUnion("ok", [object({
|
|
47557
|
+
credentialId: string(),
|
|
47558
|
+
certPem: PemSchema,
|
|
47559
|
+
chainPem: PemSchema,
|
|
47560
|
+
notAfter: number$1()
|
|
47561
|
+
}).extend({ ok: literal(true) }), DeviceRefusalSchema]);
|
|
47562
|
+
discriminatedUnion("ok", [object({
|
|
47563
|
+
ok: literal(true),
|
|
47564
|
+
credentialId: string(),
|
|
47565
|
+
sessionsEnded: number$1().int()
|
|
47566
|
+
}), DeviceRefusalSchema]);
|
|
47567
|
+
var DeviceCredentialStatusSchema = _enum([
|
|
47568
|
+
"active",
|
|
47569
|
+
"expired",
|
|
47570
|
+
"revoked"
|
|
47571
|
+
]);
|
|
47572
|
+
var DeviceCredentialSchema = object({
|
|
47573
|
+
id: string(),
|
|
47574
|
+
userId: string(),
|
|
47575
|
+
username: string().nullable(),
|
|
47576
|
+
deviceName: string(),
|
|
47577
|
+
platform: DevicePlatformSchema,
|
|
47578
|
+
enrolledVia: _enum(["qr", "self"]),
|
|
47579
|
+
/** SHA-256 of the leaf certificate DER, colon-hex. */
|
|
47580
|
+
fingerprint: string(),
|
|
47581
|
+
issuedAt: number$1(),
|
|
47582
|
+
expiresAt: number$1(),
|
|
47583
|
+
lastUsedAt: number$1().nullable(),
|
|
47584
|
+
lastUsedFrom: string().nullable(),
|
|
47585
|
+
revokedAt: number$1().nullable(),
|
|
47586
|
+
/** `admin:<userId>` | `user:<userId>` | `device` | `user-deleted`. */
|
|
47587
|
+
revokedBy: string().nullable(),
|
|
47588
|
+
status: DeviceCredentialStatusSchema
|
|
47589
|
+
});
|
|
47590
|
+
var StartEnrollmentOutputSchema = object({
|
|
47591
|
+
/** Shown once; only its hash is kept. */
|
|
47592
|
+
code: string(),
|
|
47593
|
+
expiresAt: number$1(),
|
|
47594
|
+
/** `camstack://enroll?hub=…&code=…` — what the QR encodes. */
|
|
47595
|
+
enrollUrl: string(),
|
|
47596
|
+
/** The hub origin in the link, or `null` when the hub could not name one (the link then has no `hub`). */
|
|
47597
|
+
hubOrigin: string().nullable(),
|
|
47598
|
+
/** Every origin the apps may try (role `appConnections`). */
|
|
47599
|
+
hubOrigins: array(string())
|
|
47600
|
+
});
|
|
47601
|
+
object({
|
|
47602
|
+
kind: literal("device-certificate"),
|
|
47603
|
+
id: literal("device-certificate"),
|
|
47604
|
+
label: string(),
|
|
47605
|
+
stage: literal("primary"),
|
|
47606
|
+
/** tRPC paths under the hub's `auth` router, so a client names no literal. */
|
|
47607
|
+
challengePath: literal("auth.getDeviceChallenge"),
|
|
47608
|
+
revokePath: literal("auth.revokeOwnDeviceCertificate"),
|
|
47609
|
+
enrollSelfPath: literal("auth.enrollSelf"),
|
|
47610
|
+
loginPath: literal("auth.loginWithDeviceCertificate"),
|
|
47611
|
+
renewPath: literal("auth.renewDeviceCertificate"),
|
|
47612
|
+
signature: literal(DEVICE_CERT_SIGNATURE),
|
|
47613
|
+
messageVersion: literal(DEVICE_SIGNATURE_MESSAGE_VERSION),
|
|
47614
|
+
/** Which clients can execute it: a native app silently, a browser with a non-extractable WebCrypto key. */
|
|
47615
|
+
clients: array(_enum(["native", "web"])),
|
|
47616
|
+
/** The app executes it itself, silently (D858). */
|
|
47617
|
+
app: AppLoginPathSchema.nullable()
|
|
47291
47618
|
});
|
|
47292
|
-
new Map(ENTRIES.map((e) => [e.key, e]));
|
|
47293
|
-
/** Categories a picker offers first: the ones this product's icons mostly live in. */
|
|
47294
|
-
var LEADING_CATEGORIES = [
|
|
47295
|
-
"devices",
|
|
47296
|
-
"home",
|
|
47297
|
-
"security",
|
|
47298
|
-
"buildings",
|
|
47299
|
-
"connectivity",
|
|
47300
|
-
"multimedia",
|
|
47301
|
-
"nature",
|
|
47302
|
-
"weather",
|
|
47303
|
-
"transportation",
|
|
47304
|
-
"animals"
|
|
47305
|
-
];
|
|
47306
|
-
var PRIMARY_CATEGORIES = new Set(ENTRIES.map((e) => e.primaryCategory));
|
|
47307
|
-
[...LEADING_CATEGORIES, ...ICON_CATEGORY_IDS.filter((c) => !LEADING_CATEGORIES.includes(c))].filter((c) => PRIMARY_CATEGORIES.has(c));
|
|
47308
47619
|
/**
|
|
47309
47620
|
* One (location, icon) assignment as it travels.
|
|
47310
47621
|
*
|
|
@@ -48935,7 +49246,9 @@ var SchedulerInputSchema = object({
|
|
|
48935
49246
|
/** Higher wins when two holds want the same device in different states. */
|
|
48936
49247
|
priority: number$1().int().min(0).max(100).default(0),
|
|
48937
49248
|
maxLateMs: number$1().int().min(1e3).max(24 * 36e5).default(DEFAULT_MAX_LATE_MS),
|
|
48938
|
-
profiles: array(SchedulerProfileSchema).max(20)
|
|
49249
|
+
profiles: array(SchedulerProfileSchema).max(20),
|
|
49250
|
+
/** Operator tags (D1054). Absent = no tags. */
|
|
49251
|
+
tags: TagsFieldSchema.optional()
|
|
48939
49252
|
});
|
|
48940
49253
|
var SchedulerSchema = SchedulerInputSchema.extend({
|
|
48941
49254
|
id: string().min(1),
|
|
@@ -49428,6 +49741,8 @@ var ActionEntrySchema = object({
|
|
|
49428
49741
|
* action (two rules, a button, an automation).
|
|
49429
49742
|
*/
|
|
49430
49743
|
minDelaySec: ActionMinDelaySecSchema.optional(),
|
|
49744
|
+
/** Internal only: operator tags (D1054). Absent = no tags. */
|
|
49745
|
+
tags: TagsFieldSchema.optional(),
|
|
49431
49746
|
status: ActionStatusSchema
|
|
49432
49747
|
}).superRefine((entry, ctx) => {
|
|
49433
49748
|
if (entry.source === "internal") {
|
|
@@ -49459,7 +49774,8 @@ var ActionInputSchema = object({
|
|
|
49459
49774
|
name: string().min(1).max(120),
|
|
49460
49775
|
steps: array(ActionStepSchema).min(1).max(50),
|
|
49461
49776
|
variables: array(ActionVariableSchema).max(20).optional(),
|
|
49462
|
-
minDelaySec: ActionMinDelaySecSchema.optional()
|
|
49777
|
+
minDelaySec: ActionMinDelaySecSchema.optional(),
|
|
49778
|
+
tags: TagsFieldSchema.optional()
|
|
49463
49779
|
});
|
|
49464
49780
|
/** Who started a run. Absent = the operator pressed it. */
|
|
49465
49781
|
var ActionRunOriginSchema = object({
|
|
@@ -56140,7 +56456,9 @@ var CoreBlockInputFieldsSchema = object({
|
|
|
56140
56456
|
* from the compiled entry after a successful load; the editor may also set
|
|
56141
56457
|
* it. Absent ⇒ `getBlockSettings` returns null until one is known.
|
|
56142
56458
|
*/
|
|
56143
|
-
settingsSchema: CoreBlockSettingsSchemaBridge.optional()
|
|
56459
|
+
settingsSchema: CoreBlockSettingsSchemaBridge.optional(),
|
|
56460
|
+
/** Operator tags (D1054), kept on the record. Absent = no tags. */
|
|
56461
|
+
tags: TagsFieldSchema.optional()
|
|
56144
56462
|
});
|
|
56145
56463
|
/** Client-authored fields for create — requires `code` or `files[entry]`. */
|
|
56146
56464
|
var CoreBlockInputSchema = CoreBlockInputFieldsSchema.superRefine((val, ctx) => {
|
|
@@ -56201,6 +56519,8 @@ var CoreBlockSchema = object({
|
|
|
56201
56519
|
placement: CoreBlockPlacementSchema,
|
|
56202
56520
|
integrationId: string().optional(),
|
|
56203
56521
|
settingsSchema: CoreBlockSettingsSchemaBridge.optional(),
|
|
56522
|
+
/** Operator tags (D1054). Absent = no tags. */
|
|
56523
|
+
tags: TagsFieldSchema.optional(),
|
|
56204
56524
|
id: string(),
|
|
56205
56525
|
createdAt: number$1(),
|
|
56206
56526
|
updatedAt: number$1(),
|
|
@@ -57204,6 +57524,7 @@ var DeviceTemplateThisDeviceSchema = object({
|
|
|
57204
57524
|
deviceId: number$1().int(),
|
|
57205
57525
|
values: record(string().min(1).max(64), DeviceTemplateValueSchema).optional()
|
|
57206
57526
|
});
|
|
57527
|
+
deviceTemplateFilterNames();
|
|
57207
57528
|
var DeviceTemplateRefusalSchema = object({
|
|
57208
57529
|
reason: _enum([
|
|
57209
57530
|
"too-long",
|
|
@@ -57731,6 +58052,8 @@ var DeviceInfoSchema = object({
|
|
|
57731
58052
|
alias: DeviceAliasSchema.optional(),
|
|
57732
58053
|
/** Operator-organisational location label. `null` when unset. */
|
|
57733
58054
|
location: string().nullable(),
|
|
58055
|
+
/** Operator tags (D1054), kept on the device meta beside `location`. Absent = no tags. */
|
|
58056
|
+
tags: TagsFieldSchema.optional(),
|
|
57734
58057
|
/** Soft-disabled flag. */
|
|
57735
58058
|
disabled: boolean(),
|
|
57736
58059
|
parentDeviceId: number$1().nullable(),
|
|
@@ -57877,6 +58200,8 @@ var SavedDeviceRowSchema = object({
|
|
|
57877
58200
|
name: string(),
|
|
57878
58201
|
/** Operator-organisational location label. `null` when unset. */
|
|
57879
58202
|
location: string().nullable(),
|
|
58203
|
+
/** Operator tags (D1054), kept on the device meta beside `location`. Absent = no tags. */
|
|
58204
|
+
tags: TagsFieldSchema.optional(),
|
|
57880
58205
|
/** Soft-disabled flag. */
|
|
57881
58206
|
disabled: boolean(),
|
|
57882
58207
|
parentDeviceId: number$1().nullable(),
|
|
@@ -57899,6 +58224,8 @@ var DeviceMetaSchema = object({
|
|
|
57899
58224
|
* `DeviceMeta.userNamed`. */
|
|
57900
58225
|
userNamed: boolean().optional(),
|
|
57901
58226
|
location: string().nullable(),
|
|
58227
|
+
/** Operator tags (D1054), kept on the device meta beside `location`. Absent = no tags. */
|
|
58228
|
+
tags: TagsFieldSchema.optional(),
|
|
57902
58229
|
disabled: boolean(),
|
|
57903
58230
|
parentDeviceId: number$1().nullable(),
|
|
57904
58231
|
metadata: record(string(), unknown()).nullable().optional(),
|
|
@@ -58110,6 +58437,12 @@ method(object({
|
|
|
58110
58437
|
}), _void(), {
|
|
58111
58438
|
kind: "mutation",
|
|
58112
58439
|
auth: "admin"
|
|
58440
|
+
}), method(object({
|
|
58441
|
+
deviceId: number$1(),
|
|
58442
|
+
tags: TagsFieldSchema
|
|
58443
|
+
}), _void(), {
|
|
58444
|
+
kind: "mutation",
|
|
58445
|
+
auth: "admin"
|
|
58113
58446
|
}), method(object({
|
|
58114
58447
|
deviceId: number$1(),
|
|
58115
58448
|
type: _enum(DeviceType)
|
|
@@ -58195,6 +58528,7 @@ method(object({
|
|
|
58195
58528
|
deviceId: number$1(),
|
|
58196
58529
|
name: string().optional(),
|
|
58197
58530
|
location: string().nullable().optional(),
|
|
58531
|
+
tags: TagsFieldSchema.optional(),
|
|
58198
58532
|
type: _enum(DeviceType).optional(),
|
|
58199
58533
|
integrationId: string().optional(),
|
|
58200
58534
|
linkDeviceId: number$1().nullable().optional(),
|
|
@@ -75709,7 +76043,7 @@ var OsdSourceSchema = discriminatedUnion("kind", [
|
|
|
75709
76043
|
object({ kind: literal("none") }),
|
|
75710
76044
|
object({
|
|
75711
76045
|
kind: literal("static"),
|
|
75712
|
-
text: string().max(
|
|
76046
|
+
text: string().max(OSD_TEMPLATE_TEXT_MAX)
|
|
75713
76047
|
}),
|
|
75714
76048
|
object({
|
|
75715
76049
|
kind: literal("template"),
|
|
@@ -83462,6 +83796,50 @@ method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_
|
|
|
83462
83796
|
auth: "admin"
|
|
83463
83797
|
}), NOT_A_DEVICE.CLUSTER;
|
|
83464
83798
|
/**
|
|
83799
|
+
* tags — the registry of tag STYLES and the one place that renames or removes a
|
|
83800
|
+
* tag everywhere (D1054). A tag itself lives in the `tags` array of the record it
|
|
83801
|
+
* labels (a core block, a scheduler, a template, an action, a device); only its
|
|
83802
|
+
* colour token and icon are registered here. Provided by the core-blocks builtin,
|
|
83803
|
+
* the one place that knows every owner kind; devices are reached through
|
|
83804
|
+
* `deviceManager` over `ctx.api`.
|
|
83805
|
+
*
|
|
83806
|
+
* Tags compare trimmed and case-insensitively. `list` is the union of styled tags
|
|
83807
|
+
* and tags in use; a tag with no style answers a colour derived from its name and
|
|
83808
|
+
* the default icon (`styled: false`).
|
|
83809
|
+
*/
|
|
83810
|
+
var TagUsageCountsSchema = object({
|
|
83811
|
+
coreBlocks: number$1().int().nonnegative(),
|
|
83812
|
+
schedulers: number$1().int().nonnegative(),
|
|
83813
|
+
templates: number$1().int().nonnegative(),
|
|
83814
|
+
actions: number$1().int().nonnegative(),
|
|
83815
|
+
devices: number$1().int().nonnegative()
|
|
83816
|
+
});
|
|
83817
|
+
var TagEntrySchema = object({
|
|
83818
|
+
name: TagNameSchema,
|
|
83819
|
+
color: TagColorIdSchema,
|
|
83820
|
+
icon: IconKeySchema,
|
|
83821
|
+
/** `false` when the operator never chose a style: colour and icon are the derived defaults. */
|
|
83822
|
+
styled: boolean(),
|
|
83823
|
+
counts: TagUsageCountsSchema
|
|
83824
|
+
});
|
|
83825
|
+
method(object({}), array(TagEntrySchema), { auth: "protected" }), method(object({
|
|
83826
|
+
name: TagNameSchema,
|
|
83827
|
+
color: TagColorIdSchema,
|
|
83828
|
+
icon: IconKeySchema
|
|
83829
|
+
}), _void(), {
|
|
83830
|
+
kind: "mutation",
|
|
83831
|
+
auth: "admin"
|
|
83832
|
+
}), method(object({
|
|
83833
|
+
from: string(),
|
|
83834
|
+
to: string()
|
|
83835
|
+
}), object({ updated: TagUsageCountsSchema }), {
|
|
83836
|
+
kind: "mutation",
|
|
83837
|
+
auth: "admin"
|
|
83838
|
+
}), method(object({ name: string() }), object({ updated: TagUsageCountsSchema }), {
|
|
83839
|
+
kind: "mutation",
|
|
83840
|
+
auth: "admin"
|
|
83841
|
+
});
|
|
83842
|
+
/**
|
|
83465
83843
|
* Tamper / case-open detection sensor. Drives Home Assistant
|
|
83466
83844
|
* `binary_sensor` entries with `device_class: tamper`. Push-driven.
|
|
83467
83845
|
*/
|
|
@@ -83841,7 +84219,9 @@ var TemplateRecordSchema = object({
|
|
|
83841
84219
|
createdAt: number$1(),
|
|
83842
84220
|
updatedAt: number$1(),
|
|
83843
84221
|
/** Shipped with CamStack (`builtin:` ids): listed beside the operator's, never updated or deleted. */
|
|
83844
|
-
builtIn: literal(true).optional()
|
|
84222
|
+
builtIn: literal(true).optional(),
|
|
84223
|
+
/** Operator tags (D1054). Absent = no tags. */
|
|
84224
|
+
tags: TagsFieldSchema.optional()
|
|
83845
84225
|
});
|
|
83846
84226
|
var TemplateWriteResultSchema = discriminatedUnion("status", [object({
|
|
83847
84227
|
status: literal("saved"),
|
|
@@ -83878,14 +84258,16 @@ var TemplateDeleteResultSchema = discriminatedUnion("status", [
|
|
|
83878
84258
|
method(object({ kind: TemplateKindSchema.optional() }), array(TemplateRecordSchema), { auth: "protected" }), method(object({ id: string().min(1) }), TemplateRecordSchema.nullable(), { auth: "protected" }), method(object({
|
|
83879
84259
|
kind: TemplateKindSchema,
|
|
83880
84260
|
name: string().min(1).max(120),
|
|
83881
|
-
payload: unknown()
|
|
84261
|
+
payload: unknown(),
|
|
84262
|
+
tags: TagsFieldSchema.optional()
|
|
83882
84263
|
}), TemplateWriteResultSchema, {
|
|
83883
84264
|
kind: "mutation",
|
|
83884
84265
|
auth: "admin"
|
|
83885
84266
|
}), method(object({
|
|
83886
84267
|
id: string().min(1),
|
|
83887
84268
|
name: string().min(1).max(120).optional(),
|
|
83888
|
-
payload: unknown().optional()
|
|
84269
|
+
payload: unknown().optional(),
|
|
84270
|
+
tags: TagsFieldSchema.optional()
|
|
83889
84271
|
}), TemplateWriteResultSchema, {
|
|
83890
84272
|
kind: "mutation",
|
|
83891
84273
|
auth: "admin"
|
|
@@ -92156,6 +92538,13 @@ Object.freeze({
|
|
|
92156
92538
|
access: "create",
|
|
92157
92539
|
role: "admin"
|
|
92158
92540
|
},
|
|
92541
|
+
"deviceManager.setTags": {
|
|
92542
|
+
capName: "device-manager",
|
|
92543
|
+
capScope: "system",
|
|
92544
|
+
addonId: null,
|
|
92545
|
+
access: "create",
|
|
92546
|
+
role: "admin"
|
|
92547
|
+
},
|
|
92159
92548
|
"deviceManager.setType": {
|
|
92160
92549
|
capName: "device-manager",
|
|
92161
92550
|
capScope: "system",
|
|
@@ -98869,6 +99258,34 @@ Object.freeze({
|
|
|
98869
99258
|
access: "create",
|
|
98870
99259
|
role: "admin"
|
|
98871
99260
|
},
|
|
99261
|
+
"tags.list": {
|
|
99262
|
+
capName: "tags",
|
|
99263
|
+
capScope: "system",
|
|
99264
|
+
addonId: null,
|
|
99265
|
+
access: "view",
|
|
99266
|
+
role: "admin"
|
|
99267
|
+
},
|
|
99268
|
+
"tags.remove": {
|
|
99269
|
+
capName: "tags",
|
|
99270
|
+
capScope: "system",
|
|
99271
|
+
addonId: null,
|
|
99272
|
+
access: "delete",
|
|
99273
|
+
role: "admin"
|
|
99274
|
+
},
|
|
99275
|
+
"tags.rename": {
|
|
99276
|
+
capName: "tags",
|
|
99277
|
+
capScope: "system",
|
|
99278
|
+
addonId: null,
|
|
99279
|
+
access: "create",
|
|
99280
|
+
role: "admin"
|
|
99281
|
+
},
|
|
99282
|
+
"tags.setStyle": {
|
|
99283
|
+
capName: "tags",
|
|
99284
|
+
capScope: "system",
|
|
99285
|
+
addonId: null,
|
|
99286
|
+
access: "create",
|
|
99287
|
+
role: "admin"
|
|
99288
|
+
},
|
|
98872
99289
|
"tamper.getStatus": {
|
|
98873
99290
|
capName: "tamper",
|
|
98874
99291
|
capScope: "device",
|
|
@@ -100683,6 +101100,11 @@ Object.freeze({
|
|
|
100683
101100
|
form: "single",
|
|
100684
101101
|
optional: false
|
|
100685
101102
|
}],
|
|
101103
|
+
"deviceManager.setTags": [{
|
|
101104
|
+
name: "deviceId",
|
|
101105
|
+
form: "single",
|
|
101106
|
+
optional: false
|
|
101107
|
+
}],
|
|
100686
101108
|
"deviceManager.setType": [{
|
|
100687
101109
|
name: "deviceId",
|
|
100688
101110
|
form: "single",
|
|
@@ -104517,7 +104939,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
104517
104939
|
capability: adminUiCapability,
|
|
104518
104940
|
provider: {
|
|
104519
104941
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
104520
|
-
getVersion: async () => ({ version: "1.2.
|
|
104942
|
+
getVersion: async () => ({ version: "1.2.680" })
|
|
104521
104943
|
}
|
|
104522
104944
|
}];
|
|
104523
104945
|
}
|