node-red-contrib-knx-ultimate 7.1.4 → 8.0.2
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 +20 -10
- package/MIGRATION.md +40 -0
- package/README.md +32 -6
- package/docs/README.md +34 -0
- package/docs/assets/brand/made-in-italy.svg +12 -0
- package/examples/Alerter - Device Alert Aggregation.json +5 -2
- package/examples/Auto Responder - Read Request Defaults.json +5 -2
- package/examples/Garage - Door Controller.json +5 -2
- package/examples/Global Context - Expose KNX Values.json +5 -2
- package/examples/KNX DateTime - Set Date and Time to Bus.json +111 -89
- package/examples/Load Control - Manual Shedding Mode.json +5 -2
- package/examples/Logger ETS File and Telegram Count.json +10 -2
- package/examples/Scene Controller Recall and Save.json +33 -6
- package/examples/Staircase - Timer, Override and Block.json +5 -2
- package/examples/WatchDog Connect Disconnect.json +98 -70
- package/nodes/commonFunctions.js +0 -587
- package/nodes/knxUltimate-config.html +0 -14
- package/nodes/knxUltimate-config.js +1 -18
- package/nodes/knxUltimate.html +1 -6
- package/nodes/knxUltimateIoTBridge.html +0 -14
- package/nodes/knxUltimateLegacyMigration.js +75 -0
- package/nodes/knxUltimateMultiRouting.html +1 -7
- package/nodes/knxUltimateRouterFilter.html +1 -7
- package/nodes/knxUltimateUtility.html +0 -6
- package/nodes/knxUltimateViewer.html +0 -6
- package/nodes/locales/de/knxUltimate-config.html +0 -8
- package/nodes/locales/de/knxUltimate.html +0 -8
- package/nodes/locales/de/knxUltimateIoTBridge.html +0 -8
- package/nodes/locales/de/knxUltimateMultiRouting.html +0 -8
- package/nodes/locales/de/knxUltimateRouterFilter.html +0 -8
- package/nodes/locales/de/knxUltimateUtility.html +0 -8
- package/nodes/locales/de/knxUltimateUtility.json +16 -1
- package/nodes/locales/de/knxUltimateViewer.html +0 -8
- package/nodes/locales/en/knxUltimate-config.html +0 -8
- package/nodes/locales/en/knxUltimate.html +0 -8
- package/nodes/locales/en/knxUltimateIoTBridge.html +0 -8
- package/nodes/locales/en/knxUltimateMultiRouting.html +0 -8
- package/nodes/locales/en/knxUltimateRouterFilter.html +0 -8
- package/nodes/locales/en/knxUltimateUtility.html +0 -8
- package/nodes/locales/en/knxUltimateUtility.json +16 -1
- package/nodes/locales/en/knxUltimateViewer.html +0 -8
- package/nodes/locales/es/knxUltimate-config.html +0 -8
- package/nodes/locales/es/knxUltimate.html +0 -8
- package/nodes/locales/es/knxUltimateIoTBridge.html +0 -8
- package/nodes/locales/es/knxUltimateMultiRouting.html +0 -8
- package/nodes/locales/es/knxUltimateRouterFilter.html +0 -8
- package/nodes/locales/es/knxUltimateUtility.html +0 -8
- package/nodes/locales/es/knxUltimateUtility.json +17 -2
- package/nodes/locales/es/knxUltimateViewer.html +0 -8
- package/nodes/locales/fr/knxUltimate-config.html +0 -8
- package/nodes/locales/fr/knxUltimate.html +0 -8
- package/nodes/locales/fr/knxUltimateIoTBridge.html +0 -8
- package/nodes/locales/fr/knxUltimateMultiRouting.html +0 -8
- package/nodes/locales/fr/knxUltimateRouterFilter.html +0 -8
- package/nodes/locales/fr/knxUltimateUtility.html +0 -8
- package/nodes/locales/fr/knxUltimateUtility.json +16 -1
- package/nodes/locales/fr/knxUltimateViewer.html +0 -8
- package/nodes/locales/it/knxUltimate-config.html +0 -8
- package/nodes/locales/it/knxUltimate.html +0 -8
- package/nodes/locales/it/knxUltimateIoTBridge.html +0 -8
- package/nodes/locales/it/knxUltimateMultiRouting.html +0 -8
- package/nodes/locales/it/knxUltimateRouterFilter.html +0 -8
- package/nodes/locales/it/knxUltimateUtility.html +0 -8
- package/nodes/locales/it/knxUltimateUtility.json +16 -1
- package/nodes/locales/it/knxUltimateViewer.html +0 -8
- package/nodes/locales/zh-CN/knxUltimate-config.html +0 -8
- package/nodes/locales/zh-CN/knxUltimate.html +0 -8
- package/nodes/locales/zh-CN/knxUltimateIoTBridge.html +0 -8
- package/nodes/locales/zh-CN/knxUltimateMultiRouting.html +0 -8
- package/nodes/locales/zh-CN/knxUltimateRouterFilter.html +0 -8
- package/nodes/locales/zh-CN/knxUltimateUtility.html +0 -8
- package/nodes/locales/zh-CN/knxUltimateUtility.json +16 -1
- package/nodes/locales/zh-CN/knxUltimateViewer.html +0 -8
- package/nodes/plugins/knxUltimate-v8-migration-recovery-plugin.html +140 -0
- package/package.json +22 -69
- package/resources/11f26b4500.js +2 -2
- package/resources/KNXAIChatAdapterMappings.js +2 -416
- package/resources/configNodeEditorSelection.js +2 -32
- package/resources/hueControllerEditorSelection.js +2 -32
- package/resources/hueControllerMigrationDialog.js +2 -254
- package/resources/hueControllerProfiles.js +2 -9319
- package/resources/knxUtilityProfiles.js +2041 -2082
- package/resources/legacyMigrationNotice.js +23 -111
- package/resources/matterQrScanner.js +2 -98
- package/resources/upgradeToV8.js +94 -26
- package/scripts/check-legacy-flows.js +142 -0
- package/examples/Hue Area Motion - Zone Presence.json +0 -77
- package/examples/Hue Battery - Level Status.json +0 -77
- package/examples/Hue Button - Short and Dim Commands.json +0 -83
- package/examples/Hue Camera Motion - Presence.json +0 -77
- package/examples/Hue Config - Bridge Template.json +0 -27
- package/examples/Hue Contact Sensor - Open Closed.json +0 -75
- package/examples/Hue Device Software Update - Availability.json +0 -77
- package/examples/Hue Humidity Sensor - Relative Humidity.json +0 -77
- package/examples/Hue Light - Switch and Brightness.json +0 -67
- package/examples/Hue Light Sensor - Lux to KNX.json +0 -77
- package/examples/Hue Motion - Presence Sensor.json +0 -76
- package/examples/Hue Plug - Switch and State.json +0 -63
- package/examples/Hue Scene - Recall from KNX.json +0 -63
- package/examples/Hue Tap Dial - Relative Dimming.json +0 -76
- package/examples/Hue Temperature Sensor - Celsius to KNX.json +0 -77
- package/examples/Hue Zigbee Connectivity - Online Status.json +0 -77
- package/examples/Matter Controller - Semantic Flow Input.json +0 -248
- package/nodes/hue-config.html +0 -378
- package/nodes/hue-config.js +0 -846
- package/nodes/icons/node-alerter-icon.png +0 -0
- package/nodes/icons/node-homekit-icon.png +0 -0
- package/nodes/icons/node-homekit-icon.svg +0 -10
- package/nodes/icons/node-hue-icon.svg +0 -10
- package/nodes/icons/node-knx-icon.png +0 -0
- package/nodes/icons/node-logger-icon.png +0 -0
- package/nodes/icons/node-logger2-icon.png +0 -0
- package/nodes/icons/node-logger2-icon.svg +0 -32
- package/nodes/icons/node-matter-bridge-icon.svg +0 -6
- package/nodes/icons/node-matter-controller-icon.svg +0 -6
- package/nodes/icons/node-matter-icon.svg +0 -12
- package/nodes/icons/node-scene-icon.png +0 -0
- package/nodes/icons/node-watchdog-icon.png +0 -0
- package/nodes/knxUltimateAI.html +0 -1826
- package/nodes/knxUltimateAI.js +0 -16797
- package/nodes/knxUltimateAIHomeAssistant.html +0 -54
- package/nodes/knxUltimateAIHomeAssistant.js +0 -152
- package/nodes/knxUltimateAlerter.html +0 -267
- package/nodes/knxUltimateAlerter.js +0 -300
- package/nodes/knxUltimateAutoResponder.html +0 -128
- package/nodes/knxUltimateAutoResponder.js +0 -264
- package/nodes/knxUltimateDateTime.html +0 -579
- package/nodes/knxUltimateDateTime.js +0 -282
- package/nodes/knxUltimateGarage.html +0 -337
- package/nodes/knxUltimateGarage.js +0 -504
- package/nodes/knxUltimateGlobalContext.html +0 -145
- package/nodes/knxUltimateGlobalContext.js +0 -208
- package/nodes/knxUltimateHATranslator.html +0 -85
- package/nodes/knxUltimateHATranslator.js +0 -83
- package/nodes/knxUltimateHueAreaMotion.html +0 -670
- package/nodes/knxUltimateHueAreaMotion.js +0 -218
- package/nodes/knxUltimateHueBattery.html +0 -646
- package/nodes/knxUltimateHueBattery.js +0 -182
- package/nodes/knxUltimateHueButton.html +0 -804
- package/nodes/knxUltimateHueButton.js +0 -292
- package/nodes/knxUltimateHueCameraMotion.html +0 -671
- package/nodes/knxUltimateHueCameraMotion.js +0 -218
- package/nodes/knxUltimateHueContactSensor.html +0 -609
- package/nodes/knxUltimateHueContactSensor.js +0 -188
- package/nodes/knxUltimateHueController.html +0 -1765
- package/nodes/knxUltimateHueController.js +0 -28
- package/nodes/knxUltimateHueHumiditySensor.html +0 -641
- package/nodes/knxUltimateHueHumiditySensor.js +0 -201
- package/nodes/knxUltimateHueLight.html +0 -2516
- package/nodes/knxUltimateHueLight.js +0 -1582
- package/nodes/knxUltimateHueLightSensor.html +0 -636
- package/nodes/knxUltimateHueLightSensor.js +0 -177
- package/nodes/knxUltimateHueMotion.html +0 -634
- package/nodes/knxUltimateHueMotion.js +0 -182
- package/nodes/knxUltimateHuePlug.html +0 -576
- package/nodes/knxUltimateHuePlug.js +0 -341
- package/nodes/knxUltimateHueScene.html +0 -967
- package/nodes/knxUltimateHueScene.js +0 -349
- package/nodes/knxUltimateHueTapDial.html +0 -640
- package/nodes/knxUltimateHueTapDial.js +0 -268
- package/nodes/knxUltimateHueTemperatureSensor.html +0 -639
- package/nodes/knxUltimateHueTemperatureSensor.js +0 -184
- package/nodes/knxUltimateHueZigbeeConnectivity.html +0 -648
- package/nodes/knxUltimateHueZigbeeConnectivity.js +0 -182
- package/nodes/knxUltimateHuedevice_software_update.html +0 -650
- package/nodes/knxUltimateHuedevice_software_update.js +0 -182
- package/nodes/knxUltimateLoadControl.html +0 -425
- package/nodes/knxUltimateLoadControl.js +0 -443
- package/nodes/knxUltimateLogger.html +0 -197
- package/nodes/knxUltimateLogger.js +0 -224
- package/nodes/knxUltimateMatterBridge.html +0 -689
- package/nodes/knxUltimateMatterBridge.js +0 -464
- package/nodes/knxUltimateMatterControllerDevice.html +0 -2851
- package/nodes/knxUltimateMatterControllerDevice.js +0 -1747
- package/nodes/knxUltimateSceneController.html +0 -529
- package/nodes/knxUltimateSceneController.js +0 -437
- package/nodes/knxUltimateStaircase.html +0 -346
- package/nodes/knxUltimateStaircase.js +0 -463
- package/nodes/knxUltimateWatchDog.html +0 -241
- package/nodes/knxUltimateWatchDog.js +0 -230
- package/nodes/locales/de/hue-config.html +0 -33
- package/nodes/locales/de/hue-config.json +0 -21
- package/nodes/locales/de/knxUltimateAI.html +0 -13
- package/nodes/locales/de/knxUltimateAI.json +0 -231
- package/nodes/locales/de/knxUltimateAIHomeAssistant.html +0 -11
- package/nodes/locales/de/knxUltimateAlerter.html +0 -159
- package/nodes/locales/de/knxUltimateAlerter.json +0 -27
- package/nodes/locales/de/knxUltimateAutoResponder.html +0 -96
- package/nodes/locales/de/knxUltimateAutoResponder.json +0 -8
- package/nodes/locales/de/knxUltimateDateTime.html +0 -45
- package/nodes/locales/de/knxUltimateDateTime.json +0 -32
- package/nodes/locales/de/knxUltimateGarage.html +0 -79
- package/nodes/locales/de/knxUltimateGarage.json +0 -51
- package/nodes/locales/de/knxUltimateGlobalContext.html +0 -76
- package/nodes/locales/de/knxUltimateGlobalContext.json +0 -24
- package/nodes/locales/de/knxUltimateHATranslator.html +0 -25
- package/nodes/locales/de/knxUltimateHATranslator.json +0 -8
- package/nodes/locales/de/knxUltimateHueAreaMotion.html +0 -44
- package/nodes/locales/de/knxUltimateHueAreaMotion.json +0 -31
- package/nodes/locales/de/knxUltimateHueBattery.html +0 -37
- package/nodes/locales/de/knxUltimateHueBattery.json +0 -30
- package/nodes/locales/de/knxUltimateHueButton.html +0 -52
- package/nodes/locales/de/knxUltimateHueButton.json +0 -34
- package/nodes/locales/de/knxUltimateHueCameraMotion.html +0 -38
- package/nodes/locales/de/knxUltimateHueCameraMotion.json +0 -30
- package/nodes/locales/de/knxUltimateHueContactSensor.html +0 -35
- package/nodes/locales/de/knxUltimateHueContactSensor.json +0 -26
- package/nodes/locales/de/knxUltimateHueController.html +0 -690
- package/nodes/locales/de/knxUltimateHueController.json +0 -64
- package/nodes/locales/de/knxUltimateHueHumiditySensor.html +0 -38
- package/nodes/locales/de/knxUltimateHueHumiditySensor.json +0 -30
- package/nodes/locales/de/knxUltimateHueLight.html +0 -121
- package/nodes/locales/de/knxUltimateHueLight.json +0 -94
- package/nodes/locales/de/knxUltimateHueLightSensor.html +0 -38
- package/nodes/locales/de/knxUltimateHueLightSensor.json +0 -19
- package/nodes/locales/de/knxUltimateHueMotion.html +0 -41
- package/nodes/locales/de/knxUltimateHueMotion.json +0 -27
- package/nodes/locales/de/knxUltimateHuePlug.html +0 -50
- package/nodes/locales/de/knxUltimateHuePlug.json +0 -33
- package/nodes/locales/de/knxUltimateHueScene.html +0 -45
- package/nodes/locales/de/knxUltimateHueScene.json +0 -41
- package/nodes/locales/de/knxUltimateHueTapDial.html +0 -40
- package/nodes/locales/de/knxUltimateHueTapDial.json +0 -28
- package/nodes/locales/de/knxUltimateHueTemperatureSensor.html +0 -38
- package/nodes/locales/de/knxUltimateHueTemperatureSensor.json +0 -30
- package/nodes/locales/de/knxUltimateHueZigbeeConnectivity.html +0 -39
- package/nodes/locales/de/knxUltimateHueZigbeeConnectivity.json +0 -30
- package/nodes/locales/de/knxUltimateHuedevice_software_update.html +0 -36
- package/nodes/locales/de/knxUltimateHuedevice_software_update.json +0 -30
- package/nodes/locales/de/knxUltimateLoadControl.html +0 -69
- package/nodes/locales/de/knxUltimateLoadControl.json +0 -28
- package/nodes/locales/de/knxUltimateLogger.html +0 -126
- package/nodes/locales/de/knxUltimateLogger.json +0 -31
- package/nodes/locales/de/knxUltimateMatterBridge.html +0 -65
- package/nodes/locales/de/knxUltimateMatterBridge.json +0 -123
- package/nodes/locales/de/knxUltimateMatterControllerDevice.html +0 -57
- package/nodes/locales/de/knxUltimateMatterControllerDevice.json +0 -146
- package/nodes/locales/de/knxUltimateSceneController.html +0 -98
- package/nodes/locales/de/knxUltimateSceneController.json +0 -32
- package/nodes/locales/de/knxUltimateStaircase.html +0 -77
- package/nodes/locales/de/knxUltimateStaircase.json +0 -62
- package/nodes/locales/de/knxUltimateWatchDog.html +0 -178
- package/nodes/locales/de/knxUltimateWatchDog.json +0 -27
- package/nodes/locales/de/matter-config.html +0 -47
- package/nodes/locales/de/matter-config.json +0 -47
- package/nodes/locales/de/matterbridge-config.html +0 -45
- package/nodes/locales/de/matterbridge-config.json +0 -25
- package/nodes/locales/en/hue-config.html +0 -31
- package/nodes/locales/en/hue-config.json +0 -21
- package/nodes/locales/en/knxUltimateAI.html +0 -13
- package/nodes/locales/en/knxUltimateAI.json +0 -234
- package/nodes/locales/en/knxUltimateAIHomeAssistant.html +0 -11
- package/nodes/locales/en/knxUltimateAlerter.html +0 -164
- package/nodes/locales/en/knxUltimateAlerter.json +0 -27
- package/nodes/locales/en/knxUltimateAutoResponder.html +0 -94
- package/nodes/locales/en/knxUltimateAutoResponder.json +0 -8
- package/nodes/locales/en/knxUltimateDateTime.html +0 -67
- package/nodes/locales/en/knxUltimateDateTime.json +0 -32
- package/nodes/locales/en/knxUltimateGarage.html +0 -79
- package/nodes/locales/en/knxUltimateGarage.json +0 -51
- package/nodes/locales/en/knxUltimateGlobalContext.html +0 -124
- package/nodes/locales/en/knxUltimateGlobalContext.json +0 -24
- package/nodes/locales/en/knxUltimateHATranslator.html +0 -25
- package/nodes/locales/en/knxUltimateHATranslator.json +0 -8
- package/nodes/locales/en/knxUltimateHueAreaMotion.html +0 -44
- package/nodes/locales/en/knxUltimateHueAreaMotion.json +0 -31
- package/nodes/locales/en/knxUltimateHueBattery.html +0 -37
- package/nodes/locales/en/knxUltimateHueBattery.json +0 -30
- package/nodes/locales/en/knxUltimateHueButton.html +0 -52
- package/nodes/locales/en/knxUltimateHueButton.json +0 -34
- package/nodes/locales/en/knxUltimateHueCameraMotion.html +0 -38
- package/nodes/locales/en/knxUltimateHueCameraMotion.json +0 -30
- package/nodes/locales/en/knxUltimateHueContactSensor.html +0 -35
- package/nodes/locales/en/knxUltimateHueContactSensor.json +0 -26
- package/nodes/locales/en/knxUltimateHueController.html +0 -691
- package/nodes/locales/en/knxUltimateHueController.json +0 -64
- package/nodes/locales/en/knxUltimateHueHumiditySensor.html +0 -38
- package/nodes/locales/en/knxUltimateHueHumiditySensor.json +0 -30
- package/nodes/locales/en/knxUltimateHueLight.html +0 -124
- package/nodes/locales/en/knxUltimateHueLight.json +0 -94
- package/nodes/locales/en/knxUltimateHueLightSensor.html +0 -38
- package/nodes/locales/en/knxUltimateHueLightSensor.json +0 -19
- package/nodes/locales/en/knxUltimateHueMotion.html +0 -41
- package/nodes/locales/en/knxUltimateHueMotion.json +0 -27
- package/nodes/locales/en/knxUltimateHuePlug.html +0 -50
- package/nodes/locales/en/knxUltimateHuePlug.json +0 -33
- package/nodes/locales/en/knxUltimateHueScene.html +0 -45
- package/nodes/locales/en/knxUltimateHueScene.json +0 -41
- package/nodes/locales/en/knxUltimateHueTapDial.html +0 -40
- package/nodes/locales/en/knxUltimateHueTapDial.json +0 -28
- package/nodes/locales/en/knxUltimateHueTemperatureSensor.html +0 -38
- package/nodes/locales/en/knxUltimateHueTemperatureSensor.json +0 -30
- package/nodes/locales/en/knxUltimateHueZigbeeConnectivity.html +0 -39
- package/nodes/locales/en/knxUltimateHueZigbeeConnectivity.json +0 -30
- package/nodes/locales/en/knxUltimateHuedevice_software_update.html +0 -36
- package/nodes/locales/en/knxUltimateHuedevice_software_update.json +0 -30
- package/nodes/locales/en/knxUltimateLoadControl.html +0 -76
- package/nodes/locales/en/knxUltimateLoadControl.json +0 -28
- package/nodes/locales/en/knxUltimateLogger.html +0 -161
- package/nodes/locales/en/knxUltimateLogger.json +0 -31
- package/nodes/locales/en/knxUltimateMatterBridge.html +0 -65
- package/nodes/locales/en/knxUltimateMatterBridge.json +0 -123
- package/nodes/locales/en/knxUltimateMatterControllerDevice.html +0 -57
- package/nodes/locales/en/knxUltimateMatterControllerDevice.json +0 -146
- package/nodes/locales/en/knxUltimateSceneController.html +0 -117
- package/nodes/locales/en/knxUltimateSceneController.json +0 -32
- package/nodes/locales/en/knxUltimateStaircase.html +0 -77
- package/nodes/locales/en/knxUltimateStaircase.json +0 -62
- package/nodes/locales/en/knxUltimateWatchDog.html +0 -244
- package/nodes/locales/en/knxUltimateWatchDog.json +0 -27
- package/nodes/locales/en/matter-config.html +0 -47
- package/nodes/locales/en/matter-config.json +0 -48
- package/nodes/locales/en/matterbridge-config.html +0 -45
- package/nodes/locales/en/matterbridge-config.json +0 -25
- package/nodes/locales/es/hue-config.html +0 -31
- package/nodes/locales/es/hue-config.json +0 -21
- package/nodes/locales/es/knxUltimateAI.html +0 -13
- package/nodes/locales/es/knxUltimateAI.json +0 -231
- package/nodes/locales/es/knxUltimateAIHomeAssistant.html +0 -11
- package/nodes/locales/es/knxUltimateAlerter.html +0 -164
- package/nodes/locales/es/knxUltimateAlerter.json +0 -27
- package/nodes/locales/es/knxUltimateAutoResponder.html +0 -81
- package/nodes/locales/es/knxUltimateAutoResponder.json +0 -8
- package/nodes/locales/es/knxUltimateDateTime.html +0 -45
- package/nodes/locales/es/knxUltimateDateTime.json +0 -32
- package/nodes/locales/es/knxUltimateGarage.html +0 -79
- package/nodes/locales/es/knxUltimateGarage.json +0 -51
- package/nodes/locales/es/knxUltimateGlobalContext.html +0 -128
- package/nodes/locales/es/knxUltimateGlobalContext.json +0 -24
- package/nodes/locales/es/knxUltimateHATranslator.html +0 -25
- package/nodes/locales/es/knxUltimateHATranslator.json +0 -8
- package/nodes/locales/es/knxUltimateHueAreaMotion.html +0 -44
- package/nodes/locales/es/knxUltimateHueAreaMotion.json +0 -31
- package/nodes/locales/es/knxUltimateHueBattery.html +0 -37
- package/nodes/locales/es/knxUltimateHueBattery.json +0 -30
- package/nodes/locales/es/knxUltimateHueButton.html +0 -52
- package/nodes/locales/es/knxUltimateHueButton.json +0 -34
- package/nodes/locales/es/knxUltimateHueCameraMotion.html +0 -38
- package/nodes/locales/es/knxUltimateHueCameraMotion.json +0 -30
- package/nodes/locales/es/knxUltimateHueContactSensor.html +0 -35
- package/nodes/locales/es/knxUltimateHueContactSensor.json +0 -26
- package/nodes/locales/es/knxUltimateHueController.html +0 -691
- package/nodes/locales/es/knxUltimateHueController.json +0 -64
- package/nodes/locales/es/knxUltimateHueHumiditySensor.html +0 -38
- package/nodes/locales/es/knxUltimateHueHumiditySensor.json +0 -30
- package/nodes/locales/es/knxUltimateHueLight.html +0 -124
- package/nodes/locales/es/knxUltimateHueLight.json +0 -94
- package/nodes/locales/es/knxUltimateHueLightSensor.html +0 -38
- package/nodes/locales/es/knxUltimateHueLightSensor.json +0 -19
- package/nodes/locales/es/knxUltimateHueMotion.html +0 -41
- package/nodes/locales/es/knxUltimateHueMotion.json +0 -27
- package/nodes/locales/es/knxUltimateHuePlug.html +0 -50
- package/nodes/locales/es/knxUltimateHuePlug.json +0 -33
- package/nodes/locales/es/knxUltimateHueScene.html +0 -45
- package/nodes/locales/es/knxUltimateHueScene.json +0 -41
- package/nodes/locales/es/knxUltimateHueTapDial.html +0 -40
- package/nodes/locales/es/knxUltimateHueTapDial.json +0 -28
- package/nodes/locales/es/knxUltimateHueTemperatureSensor.html +0 -38
- package/nodes/locales/es/knxUltimateHueTemperatureSensor.json +0 -30
- package/nodes/locales/es/knxUltimateHueZigbeeConnectivity.html +0 -39
- package/nodes/locales/es/knxUltimateHueZigbeeConnectivity.json +0 -30
- package/nodes/locales/es/knxUltimateHuedevice_software_update.html +0 -36
- package/nodes/locales/es/knxUltimateHuedevice_software_update.json +0 -30
- package/nodes/locales/es/knxUltimateLoadControl.html +0 -76
- package/nodes/locales/es/knxUltimateLoadControl.json +0 -28
- package/nodes/locales/es/knxUltimateLogger.html +0 -162
- package/nodes/locales/es/knxUltimateLogger.json +0 -31
- package/nodes/locales/es/knxUltimateMatterBridge.html +0 -65
- package/nodes/locales/es/knxUltimateMatterBridge.json +0 -123
- package/nodes/locales/es/knxUltimateMatterControllerDevice.html +0 -57
- package/nodes/locales/es/knxUltimateMatterControllerDevice.json +0 -146
- package/nodes/locales/es/knxUltimateSceneController.html +0 -115
- package/nodes/locales/es/knxUltimateSceneController.json +0 -32
- package/nodes/locales/es/knxUltimateStaircase.html +0 -77
- package/nodes/locales/es/knxUltimateStaircase.json +0 -62
- package/nodes/locales/es/knxUltimateWatchDog.html +0 -230
- package/nodes/locales/es/knxUltimateWatchDog.json +0 -27
- package/nodes/locales/es/matter-config.html +0 -47
- package/nodes/locales/es/matter-config.json +0 -47
- package/nodes/locales/es/matterbridge-config.html +0 -45
- package/nodes/locales/es/matterbridge-config.json +0 -25
- package/nodes/locales/fr/hue-config.html +0 -31
- package/nodes/locales/fr/hue-config.json +0 -21
- package/nodes/locales/fr/knxUltimateAI.html +0 -13
- package/nodes/locales/fr/knxUltimateAI.json +0 -231
- package/nodes/locales/fr/knxUltimateAIHomeAssistant.html +0 -11
- package/nodes/locales/fr/knxUltimateAlerter.html +0 -164
- package/nodes/locales/fr/knxUltimateAlerter.json +0 -27
- package/nodes/locales/fr/knxUltimateAutoResponder.html +0 -92
- package/nodes/locales/fr/knxUltimateAutoResponder.json +0 -8
- package/nodes/locales/fr/knxUltimateDateTime.html +0 -45
- package/nodes/locales/fr/knxUltimateDateTime.json +0 -32
- package/nodes/locales/fr/knxUltimateGarage.html +0 -79
- package/nodes/locales/fr/knxUltimateGarage.json +0 -51
- package/nodes/locales/fr/knxUltimateGlobalContext.html +0 -122
- package/nodes/locales/fr/knxUltimateGlobalContext.json +0 -24
- package/nodes/locales/fr/knxUltimateHATranslator.html +0 -25
- package/nodes/locales/fr/knxUltimateHATranslator.json +0 -8
- package/nodes/locales/fr/knxUltimateHueAreaMotion.html +0 -44
- package/nodes/locales/fr/knxUltimateHueAreaMotion.json +0 -31
- package/nodes/locales/fr/knxUltimateHueBattery.html +0 -37
- package/nodes/locales/fr/knxUltimateHueBattery.json +0 -30
- package/nodes/locales/fr/knxUltimateHueButton.html +0 -52
- package/nodes/locales/fr/knxUltimateHueButton.json +0 -34
- package/nodes/locales/fr/knxUltimateHueCameraMotion.html +0 -38
- package/nodes/locales/fr/knxUltimateHueCameraMotion.json +0 -30
- package/nodes/locales/fr/knxUltimateHueContactSensor.html +0 -35
- package/nodes/locales/fr/knxUltimateHueContactSensor.json +0 -26
- package/nodes/locales/fr/knxUltimateHueController.html +0 -691
- package/nodes/locales/fr/knxUltimateHueController.json +0 -64
- package/nodes/locales/fr/knxUltimateHueHumiditySensor.html +0 -38
- package/nodes/locales/fr/knxUltimateHueHumiditySensor.json +0 -30
- package/nodes/locales/fr/knxUltimateHueLight.html +0 -124
- package/nodes/locales/fr/knxUltimateHueLight.json +0 -86
- package/nodes/locales/fr/knxUltimateHueLightSensor.html +0 -38
- package/nodes/locales/fr/knxUltimateHueLightSensor.json +0 -19
- package/nodes/locales/fr/knxUltimateHueMotion.html +0 -41
- package/nodes/locales/fr/knxUltimateHueMotion.json +0 -27
- package/nodes/locales/fr/knxUltimateHuePlug.html +0 -50
- package/nodes/locales/fr/knxUltimateHuePlug.json +0 -33
- package/nodes/locales/fr/knxUltimateHueScene.html +0 -45
- package/nodes/locales/fr/knxUltimateHueScene.json +0 -41
- package/nodes/locales/fr/knxUltimateHueTapDial.html +0 -40
- package/nodes/locales/fr/knxUltimateHueTapDial.json +0 -28
- package/nodes/locales/fr/knxUltimateHueTemperatureSensor.html +0 -38
- package/nodes/locales/fr/knxUltimateHueTemperatureSensor.json +0 -30
- package/nodes/locales/fr/knxUltimateHueZigbeeConnectivity.html +0 -39
- package/nodes/locales/fr/knxUltimateHueZigbeeConnectivity.json +0 -30
- package/nodes/locales/fr/knxUltimateHuedevice_software_update.html +0 -36
- package/nodes/locales/fr/knxUltimateHuedevice_software_update.json +0 -30
- package/nodes/locales/fr/knxUltimateLoadControl.html +0 -76
- package/nodes/locales/fr/knxUltimateLoadControl.json +0 -28
- package/nodes/locales/fr/knxUltimateLogger.html +0 -160
- package/nodes/locales/fr/knxUltimateLogger.json +0 -31
- package/nodes/locales/fr/knxUltimateMatterBridge.html +0 -65
- package/nodes/locales/fr/knxUltimateMatterBridge.json +0 -123
- package/nodes/locales/fr/knxUltimateMatterControllerDevice.html +0 -57
- package/nodes/locales/fr/knxUltimateMatterControllerDevice.json +0 -146
- package/nodes/locales/fr/knxUltimateSceneController.html +0 -117
- package/nodes/locales/fr/knxUltimateSceneController.json +0 -32
- package/nodes/locales/fr/knxUltimateStaircase.html +0 -77
- package/nodes/locales/fr/knxUltimateStaircase.json +0 -62
- package/nodes/locales/fr/knxUltimateWatchDog.html +0 -228
- package/nodes/locales/fr/knxUltimateWatchDog.json +0 -27
- package/nodes/locales/fr/matter-config.html +0 -47
- package/nodes/locales/fr/matter-config.json +0 -47
- package/nodes/locales/fr/matterbridge-config.html +0 -45
- package/nodes/locales/fr/matterbridge-config.json +0 -25
- package/nodes/locales/it/hue-config.html +0 -33
- package/nodes/locales/it/hue-config.json +0 -21
- package/nodes/locales/it/knxUltimateAI.html +0 -13
- package/nodes/locales/it/knxUltimateAI.json +0 -234
- package/nodes/locales/it/knxUltimateAIHomeAssistant.html +0 -11
- package/nodes/locales/it/knxUltimateAlerter.html +0 -159
- package/nodes/locales/it/knxUltimateAlerter.json +0 -27
- package/nodes/locales/it/knxUltimateAutoResponder.html +0 -96
- package/nodes/locales/it/knxUltimateAutoResponder.json +0 -8
- package/nodes/locales/it/knxUltimateDateTime.html +0 -67
- package/nodes/locales/it/knxUltimateDateTime.json +0 -32
- package/nodes/locales/it/knxUltimateGarage.html +0 -79
- package/nodes/locales/it/knxUltimateGarage.json +0 -51
- package/nodes/locales/it/knxUltimateGlobalContext.html +0 -81
- package/nodes/locales/it/knxUltimateGlobalContext.json +0 -24
- package/nodes/locales/it/knxUltimateHATranslator.html +0 -24
- package/nodes/locales/it/knxUltimateHATranslator.json +0 -8
- package/nodes/locales/it/knxUltimateHueAreaMotion.html +0 -44
- package/nodes/locales/it/knxUltimateHueAreaMotion.json +0 -31
- package/nodes/locales/it/knxUltimateHueBattery.html +0 -37
- package/nodes/locales/it/knxUltimateHueBattery.json +0 -30
- package/nodes/locales/it/knxUltimateHueButton.html +0 -52
- package/nodes/locales/it/knxUltimateHueButton.json +0 -34
- package/nodes/locales/it/knxUltimateHueCameraMotion.html +0 -38
- package/nodes/locales/it/knxUltimateHueCameraMotion.json +0 -30
- package/nodes/locales/it/knxUltimateHueContactSensor.html +0 -35
- package/nodes/locales/it/knxUltimateHueContactSensor.json +0 -26
- package/nodes/locales/it/knxUltimateHueController.html +0 -690
- package/nodes/locales/it/knxUltimateHueController.json +0 -64
- package/nodes/locales/it/knxUltimateHueHumiditySensor 2.html +0 -11
- package/nodes/locales/it/knxUltimateHueHumiditySensor.html +0 -38
- package/nodes/locales/it/knxUltimateHueHumiditySensor.json +0 -30
- package/nodes/locales/it/knxUltimateHueLight.html +0 -124
- package/nodes/locales/it/knxUltimateHueLight.json +0 -94
- package/nodes/locales/it/knxUltimateHueLightSensor.html +0 -38
- package/nodes/locales/it/knxUltimateHueLightSensor.json +0 -19
- package/nodes/locales/it/knxUltimateHueMotion.html +0 -41
- package/nodes/locales/it/knxUltimateHueMotion.json +0 -27
- package/nodes/locales/it/knxUltimateHuePlug.html +0 -50
- package/nodes/locales/it/knxUltimateHuePlug.json +0 -33
- package/nodes/locales/it/knxUltimateHueScene.html +0 -45
- package/nodes/locales/it/knxUltimateHueScene.json +0 -41
- package/nodes/locales/it/knxUltimateHueTapDial.html +0 -40
- package/nodes/locales/it/knxUltimateHueTapDial.json +0 -28
- package/nodes/locales/it/knxUltimateHueTemperatureSensor.html +0 -38
- package/nodes/locales/it/knxUltimateHueTemperatureSensor.json +0 -30
- package/nodes/locales/it/knxUltimateHueZigbeeConnectivity.html +0 -39
- package/nodes/locales/it/knxUltimateHueZigbeeConnectivity.json +0 -30
- package/nodes/locales/it/knxUltimateHuedevice_software_update.html +0 -35
- package/nodes/locales/it/knxUltimateHuedevice_software_update.json +0 -30
- package/nodes/locales/it/knxUltimateLoadControl.html +0 -76
- package/nodes/locales/it/knxUltimateLoadControl.json +0 -28
- package/nodes/locales/it/knxUltimateLogger.html +0 -132
- package/nodes/locales/it/knxUltimateLogger.json +0 -31
- package/nodes/locales/it/knxUltimateMatterBridge.html +0 -65
- package/nodes/locales/it/knxUltimateMatterBridge.json +0 -123
- package/nodes/locales/it/knxUltimateMatterControllerDevice.html +0 -57
- package/nodes/locales/it/knxUltimateMatterControllerDevice.json +0 -146
- package/nodes/locales/it/knxUltimateSceneController.html +0 -101
- package/nodes/locales/it/knxUltimateSceneController.json +0 -32
- package/nodes/locales/it/knxUltimateStaircase.html +0 -77
- package/nodes/locales/it/knxUltimateStaircase.json +0 -62
- package/nodes/locales/it/knxUltimateWatchDog.html +0 -194
- package/nodes/locales/it/knxUltimateWatchDog.json +0 -27
- package/nodes/locales/it/matter-config.html +0 -47
- package/nodes/locales/it/matter-config.json +0 -48
- package/nodes/locales/it/matterbridge-config.html +0 -45
- package/nodes/locales/it/matterbridge-config.json +0 -25
- package/nodes/locales/zh-CN/hue-config.html +0 -33
- package/nodes/locales/zh-CN/hue-config.json +0 -21
- package/nodes/locales/zh-CN/knxUltimateAI.html +0 -13
- package/nodes/locales/zh-CN/knxUltimateAI.json +0 -231
- package/nodes/locales/zh-CN/knxUltimateAIHomeAssistant.html +0 -11
- package/nodes/locales/zh-CN/knxUltimateAlerter.html +0 -159
- package/nodes/locales/zh-CN/knxUltimateAlerter.json +0 -27
- package/nodes/locales/zh-CN/knxUltimateAutoResponder.html +0 -94
- package/nodes/locales/zh-CN/knxUltimateAutoResponder.json +0 -8
- package/nodes/locales/zh-CN/knxUltimateDateTime.html +0 -45
- package/nodes/locales/zh-CN/knxUltimateDateTime.json +0 -32
- package/nodes/locales/zh-CN/knxUltimateGarage.html +0 -79
- package/nodes/locales/zh-CN/knxUltimateGarage.json +0 -51
- package/nodes/locales/zh-CN/knxUltimateGlobalContext.html +0 -77
- package/nodes/locales/zh-CN/knxUltimateGlobalContext.json +0 -24
- package/nodes/locales/zh-CN/knxUltimateHATranslator.html +0 -25
- package/nodes/locales/zh-CN/knxUltimateHATranslator.json +0 -8
- package/nodes/locales/zh-CN/knxUltimateHueAreaMotion.html +0 -44
- package/nodes/locales/zh-CN/knxUltimateHueAreaMotion.json +0 -31
- package/nodes/locales/zh-CN/knxUltimateHueBattery.html +0 -37
- package/nodes/locales/zh-CN/knxUltimateHueBattery.json +0 -30
- package/nodes/locales/zh-CN/knxUltimateHueButton.html +0 -52
- package/nodes/locales/zh-CN/knxUltimateHueButton.json +0 -34
- package/nodes/locales/zh-CN/knxUltimateHueCameraMotion.html +0 -38
- package/nodes/locales/zh-CN/knxUltimateHueCameraMotion.json +0 -30
- package/nodes/locales/zh-CN/knxUltimateHueContactSensor.html +0 -35
- package/nodes/locales/zh-CN/knxUltimateHueContactSensor.json +0 -26
- package/nodes/locales/zh-CN/knxUltimateHueController.html +0 -693
- package/nodes/locales/zh-CN/knxUltimateHueController.json +0 -64
- package/nodes/locales/zh-CN/knxUltimateHueHumiditySensor.html +0 -38
- package/nodes/locales/zh-CN/knxUltimateHueHumiditySensor.json +0 -30
- package/nodes/locales/zh-CN/knxUltimateHueLight.html +0 -126
- package/nodes/locales/zh-CN/knxUltimateHueLight.json +0 -86
- package/nodes/locales/zh-CN/knxUltimateHueLightSensor.html +0 -38
- package/nodes/locales/zh-CN/knxUltimateHueLightSensor.json +0 -9
- package/nodes/locales/zh-CN/knxUltimateHueMotion.html +0 -41
- package/nodes/locales/zh-CN/knxUltimateHueMotion.json +0 -27
- package/nodes/locales/zh-CN/knxUltimateHuePlug.html +0 -50
- package/nodes/locales/zh-CN/knxUltimateHuePlug.json +0 -33
- package/nodes/locales/zh-CN/knxUltimateHueScene.html +0 -45
- package/nodes/locales/zh-CN/knxUltimateHueScene.json +0 -41
- package/nodes/locales/zh-CN/knxUltimateHueTapDial.html +0 -40
- package/nodes/locales/zh-CN/knxUltimateHueTapDial.json +0 -28
- package/nodes/locales/zh-CN/knxUltimateHueTemperatureSensor.html +0 -38
- package/nodes/locales/zh-CN/knxUltimateHueTemperatureSensor.json +0 -30
- package/nodes/locales/zh-CN/knxUltimateHueZigbeeConnectivity.html +0 -39
- package/nodes/locales/zh-CN/knxUltimateHueZigbeeConnectivity.json +0 -30
- package/nodes/locales/zh-CN/knxUltimateHuedevice_software_update.html +0 -36
- package/nodes/locales/zh-CN/knxUltimateHuedevice_software_update.json +0 -30
- package/nodes/locales/zh-CN/knxUltimateLoadControl.html +0 -76
- package/nodes/locales/zh-CN/knxUltimateLoadControl.json +0 -28
- package/nodes/locales/zh-CN/knxUltimateLogger.html +0 -126
- package/nodes/locales/zh-CN/knxUltimateLogger.json +0 -31
- package/nodes/locales/zh-CN/knxUltimateMatterBridge.html +0 -65
- package/nodes/locales/zh-CN/knxUltimateMatterBridge.json +0 -123
- package/nodes/locales/zh-CN/knxUltimateMatterControllerDevice.html +0 -57
- package/nodes/locales/zh-CN/knxUltimateMatterControllerDevice.json +0 -146
- package/nodes/locales/zh-CN/knxUltimateSceneController.html +0 -98
- package/nodes/locales/zh-CN/knxUltimateSceneController.json +0 -32
- package/nodes/locales/zh-CN/knxUltimateStaircase.html +0 -77
- package/nodes/locales/zh-CN/knxUltimateStaircase.json +0 -62
- package/nodes/locales/zh-CN/knxUltimateWatchDog.html +0 -178
- package/nodes/locales/zh-CN/knxUltimateWatchDog.json +0 -27
- package/nodes/locales/zh-CN/matter-config.html +0 -47
- package/nodes/locales/zh-CN/matter-config.json +0 -47
- package/nodes/locales/zh-CN/matterbridge-config.html +0 -45
- package/nodes/locales/zh-CN/matterbridge-config.json +0 -25
- package/nodes/matter-config.html +0 -578
- package/nodes/matter-config.js +0 -387
- package/nodes/matterbridge-config.html +0 -198
- package/nodes/matterbridge-config.js +0 -261
- package/nodes/plugins/knxUltimate-cerebrum-runtime-plugin.js +0 -79
- package/nodes/plugins/knxUltimate-migration-notice-plugin.html +0 -44
- package/nodes/plugins/knxUltimateAI-vue/assets/app.css +0 -1
- package/nodes/plugins/knxUltimateAI-vue/assets/app.js +0 -13
- package/nodes/plugins/knxUltimateAI-vue/assets/chunk-html2canvas.esm.js +0 -5
- package/nodes/plugins/knxUltimateAI-vue/assets/chunk-index.es.js +0 -5
- package/nodes/plugins/knxUltimateAI-vue/assets/chunk-jspdf.es.min.js +0 -79
- package/nodes/plugins/knxUltimateAI-vue/assets/chunk-purify.es.js +0 -3
- package/nodes/plugins/knxUltimateAI-vue/index.html +0 -13
- package/nodes/utils/HueEventStream.mjs +0 -176
- package/nodes/utils/colorManipulators/XYFromRGB_Supergiovane.js +0 -113
- package/nodes/utils/colorManipulators/hueColorConverter.js +0 -521
- package/nodes/utils/http.js +0 -291
- package/nodes/utils/hueControllerProfileAdapter.js +0 -104
- package/nodes/utils/hueControllerProfiles/runtime/area_motion.js +0 -221
- package/nodes/utils/hueControllerProfiles/runtime/button.js +0 -295
- package/nodes/utils/hueControllerProfiles/runtime/camera_motion.js +0 -221
- package/nodes/utils/hueControllerProfiles/runtime/contact.js +0 -191
- package/nodes/utils/hueControllerProfiles/runtime/device_power.js +0 -185
- package/nodes/utils/hueControllerProfiles/runtime/device_software_update.js +0 -185
- package/nodes/utils/hueControllerProfiles/runtime/humidity.js +0 -204
- package/nodes/utils/hueControllerProfiles/runtime/light.js +0 -1585
- package/nodes/utils/hueControllerProfiles/runtime/light_level.js +0 -180
- package/nodes/utils/hueControllerProfiles/runtime/motion.js +0 -185
- package/nodes/utils/hueControllerProfiles/runtime/plug.js +0 -344
- package/nodes/utils/hueControllerProfiles/runtime/relative_rotary.js +0 -271
- package/nodes/utils/hueControllerProfiles/runtime/scene.js +0 -352
- package/nodes/utils/hueControllerProfiles/runtime/temperature.js +0 -187
- package/nodes/utils/hueControllerProfiles/runtime/zigbee_connectivity.js +0 -185
- package/nodes/utils/hueControllerResourceCatalog.js +0 -71
- package/nodes/utils/hueEngine.mjs +0 -469
- package/nodes/utils/knxAiCamera.js +0 -302
- package/nodes/utils/knxAiCatalogRetrieval.js +0 -349
- package/nodes/utils/knxAiCerebrum.js +0 -406
- package/nodes/utils/knxAiChatContext.js +0 -496
- package/nodes/utils/knxAiEventHistory.js +0 -521
- package/nodes/utils/knxAiHomeMemory.js +0 -1021
- package/nodes/utils/knxAiScheduler.js +0 -445
- package/nodes/utils/knxAiSemanticContext.js +0 -662
- package/nodes/utils/knxAiTelegramVoice.js +0 -545
- package/nodes/utils/knxAiWebAccess.js +0 -631
- package/nodes/utils/lightEngines/canonicalLight.js +0 -75
- package/nodes/utils/lightEngines/hueLightEngine.js +0 -51
- package/nodes/utils/lightEngines/index.js +0 -25
- package/nodes/utils/lightEngines/knxLightCommand.js +0 -79
- package/nodes/utils/lightEngines/lightEngine.js +0 -46
- package/nodes/utils/lightEngines/matterHueShim.js +0 -59
- package/nodes/utils/lightEngines/matterLightEngine.js +0 -117
- package/nodes/utils/matterBridgeDeviceFactory.mjs +0 -780
- package/nodes/utils/matterBridgeEngine.mjs +0 -297
- package/nodes/utils/matterControllerCommandGate.js +0 -47
- package/nodes/utils/matterControllerProfiles/doorLock.js +0 -258
- package/nodes/utils/matterControllerProfiles/fan.js +0 -19
- package/nodes/utils/matterControllerProfiles/index.js +0 -34
- package/nodes/utils/matterControllerProfiles/mappedEndpoint.js +0 -217
- package/nodes/utils/matterControllerProfiles/switch.js +0 -13
- package/nodes/utils/matterControllerProfiles/thermostat.js +0 -19
- package/nodes/utils/matterControllerProfiles/universal.js +0 -462
- package/nodes/utils/matterControllerProfiles/windowCovering.js +0 -19
- package/nodes/utils/matterControllerSemanticInput.js +0 -212
- package/nodes/utils/matterEngine.mjs +0 -894
- package/nodes/utils/matterEnvironmentLock.mjs +0 -32
- package/nodes/utils/matterKnxConverter.js +0 -204
- package/nodes/utils/matterStorageBackup.js +0 -100
- package/resources/HA-icon.png +0 -0
- package/resources/dim.png +0 -0
- package/resources/rgb.png +0 -0
- package/resources/tunablewhite.png +0 -0
- package/resources/zxing-browser-0.2.0.min.js +0 -1
- package/resources/zxing-browser-LICENSE.txt +0 -21
|
@@ -1,496 +0,0 @@
|
|
|
1
|
-
const CHAT_CONTEXT_VERSION = 3
|
|
2
|
-
const CHAT_CONTEXT_MAX_BYTES = 512 * 1024
|
|
3
|
-
const CHAT_CONTEXT_MAX_SESSIONS = 50
|
|
4
|
-
const CHAT_CONTEXT_MAX_TURNS_PER_SESSION = 8
|
|
5
|
-
const CHAT_CONTEXT_MAX_INSTRUCTIONS_PER_SESSION = 20
|
|
6
|
-
const CHAT_CONTEXT_MAX_CAMERA_WATCHES_PER_SESSION = 20
|
|
7
|
-
const CHAT_CONTEXT_MAX_QUESTION_CHARS = 4000
|
|
8
|
-
const CHAT_CONTEXT_MAX_REPLY_CHARS = 8000
|
|
9
|
-
const CHAT_CONTEXT_MAX_INSTRUCTION_CHARS = 2000
|
|
10
|
-
const CHAT_CONTEXT_NATIVE_HEADER = 'KNXAI_CHAT_CONTEXT'
|
|
11
|
-
|
|
12
|
-
const clampText = (value, maxChars) => String(value === undefined || value === null ? '' : value)
|
|
13
|
-
.trim()
|
|
14
|
-
.slice(0, Math.max(0, Number(maxChars) || 0))
|
|
15
|
-
|
|
16
|
-
const normalizeSessionId = value => clampText(value || 'default', 160) || 'default'
|
|
17
|
-
|
|
18
|
-
const createEmptyKnxAiChatContext = () => ({
|
|
19
|
-
version: CHAT_CONTEXT_VERSION,
|
|
20
|
-
createdAt: new Date().toISOString(),
|
|
21
|
-
updatedAt: new Date().toISOString(),
|
|
22
|
-
sessions: []
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
const normalizeTurn = (turn) => {
|
|
26
|
-
if (!turn || typeof turn !== 'object' || Array.isArray(turn)) return null
|
|
27
|
-
const question = clampText(turn.question, CHAT_CONTEXT_MAX_QUESTION_CHARS)
|
|
28
|
-
const reply = clampText(turn.reply, CHAT_CONTEXT_MAX_REPLY_CHARS)
|
|
29
|
-
if (!question && !reply) return null
|
|
30
|
-
return {
|
|
31
|
-
at: clampText(turn.at || new Date().toISOString(), 64),
|
|
32
|
-
question,
|
|
33
|
-
reply
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const normalizeInstruction = (instruction) => {
|
|
38
|
-
if (!instruction || typeof instruction !== 'object' || Array.isArray(instruction)) return null
|
|
39
|
-
const text = clampText(instruction.text, CHAT_CONTEXT_MAX_INSTRUCTION_CHARS)
|
|
40
|
-
if (!text) return null
|
|
41
|
-
return {
|
|
42
|
-
at: clampText(instruction.at || new Date().toISOString(), 64),
|
|
43
|
-
text
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const normalizeCameraWatch = (watch) => {
|
|
48
|
-
if (!watch || typeof watch !== 'object' || Array.isArray(watch)) return null
|
|
49
|
-
const id = clampText(watch.id, 160)
|
|
50
|
-
const cameraId = clampText(watch.cameraId, 160)
|
|
51
|
-
const cameraName = clampText(watch.cameraName, 240)
|
|
52
|
-
const eventType = clampText(watch.eventType, 80)
|
|
53
|
-
if (!id || (!cameraId && !cameraName) || !eventType) return null
|
|
54
|
-
return {
|
|
55
|
-
id,
|
|
56
|
-
createdAt: clampText(watch.createdAt || new Date().toISOString(), 64),
|
|
57
|
-
cameraId,
|
|
58
|
-
cameraName,
|
|
59
|
-
eventType,
|
|
60
|
-
scopeId: clampText(watch.scopeId, 160),
|
|
61
|
-
scopeName: clampText(watch.scopeName, 240),
|
|
62
|
-
objectTypes: Array.from(new Set((Array.isArray(watch.objectTypes) ? watch.objectTypes : [])
|
|
63
|
-
.map(value => clampText(value, 80).toLocaleLowerCase())
|
|
64
|
-
.filter(Boolean))).slice(0, 12),
|
|
65
|
-
cooldownSeconds: Math.max(10, Math.min(86400, Number(watch.cooldownSeconds) || 60)),
|
|
66
|
-
sendSnapshot: watch.sendSnapshot !== false,
|
|
67
|
-
language: clampText(watch.language || 'en', 8).toLocaleLowerCase()
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const normalizeSession = (session) => {
|
|
72
|
-
if (!session || typeof session !== 'object' || Array.isArray(session)) return null
|
|
73
|
-
const id = normalizeSessionId(session.id)
|
|
74
|
-
const turns = (Array.isArray(session.turns) ? session.turns : [])
|
|
75
|
-
.map(normalizeTurn)
|
|
76
|
-
.filter(Boolean)
|
|
77
|
-
.slice(-CHAT_CONTEXT_MAX_TURNS_PER_SESSION)
|
|
78
|
-
const instructions = (Array.isArray(session.instructions) ? session.instructions : [])
|
|
79
|
-
.map(normalizeInstruction)
|
|
80
|
-
.filter(Boolean)
|
|
81
|
-
.slice(-CHAT_CONTEXT_MAX_INSTRUCTIONS_PER_SESSION)
|
|
82
|
-
const cameraWatches = (Array.isArray(session.cameraWatches) ? session.cameraWatches : [])
|
|
83
|
-
.map(normalizeCameraWatch)
|
|
84
|
-
.filter(Boolean)
|
|
85
|
-
.slice(-CHAT_CONTEXT_MAX_CAMERA_WATCHES_PER_SESSION)
|
|
86
|
-
return {
|
|
87
|
-
id,
|
|
88
|
-
updatedAt: clampText(session.updatedAt || new Date().toISOString(), 64),
|
|
89
|
-
turns,
|
|
90
|
-
instructions,
|
|
91
|
-
cameraWatches
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const normalizeKnxAiChatContext = (value = {}) => {
|
|
96
|
-
const source = value && typeof value === 'object' && !Array.isArray(value) ? value : {}
|
|
97
|
-
const byId = new Map()
|
|
98
|
-
;(Array.isArray(source.sessions) ? source.sessions : []).forEach((item) => {
|
|
99
|
-
const session = normalizeSession(item)
|
|
100
|
-
if (!session) return
|
|
101
|
-
byId.delete(session.id)
|
|
102
|
-
byId.set(session.id, session)
|
|
103
|
-
})
|
|
104
|
-
return {
|
|
105
|
-
version: CHAT_CONTEXT_VERSION,
|
|
106
|
-
createdAt: clampText(source.createdAt || new Date().toISOString(), 64),
|
|
107
|
-
updatedAt: clampText(source.updatedAt || new Date().toISOString(), 64),
|
|
108
|
-
sessions: Array.from(byId.values()).slice(-CHAT_CONTEXT_MAX_SESSIONS)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const findSession = (context, sessionId) => {
|
|
113
|
-
const id = normalizeSessionId(sessionId)
|
|
114
|
-
return normalizeKnxAiChatContext(context).sessions.find(session => session.id === id) || null
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const touchSession = (context, sessionId) => {
|
|
118
|
-
const target = normalizeKnxAiChatContext(context)
|
|
119
|
-
const id = normalizeSessionId(sessionId)
|
|
120
|
-
const existing = target.sessions.find(session => session.id === id)
|
|
121
|
-
const session = existing || { id, updatedAt: new Date().toISOString(), turns: [], instructions: [], cameraWatches: [] }
|
|
122
|
-
target.sessions = target.sessions.filter(item => item.id !== id)
|
|
123
|
-
target.sessions.push(session)
|
|
124
|
-
target.sessions = target.sessions.slice(-CHAT_CONTEXT_MAX_SESSIONS)
|
|
125
|
-
target.updatedAt = new Date().toISOString()
|
|
126
|
-
session.updatedAt = target.updatedAt
|
|
127
|
-
return { target, session }
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const addKnxAiChatTurn = (context, { sessionId, question, reply, at } = {}) => {
|
|
131
|
-
const { target, session } = touchSession(context, sessionId)
|
|
132
|
-
const turn = normalizeTurn({ at, question, reply })
|
|
133
|
-
if (turn) session.turns.push(turn)
|
|
134
|
-
session.turns = session.turns.slice(-CHAT_CONTEXT_MAX_TURNS_PER_SESSION)
|
|
135
|
-
return target
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const addKnxAiChatInstruction = (context, { sessionId, text, at } = {}) => {
|
|
139
|
-
const instruction = normalizeInstruction({ text, at })
|
|
140
|
-
if (!instruction) return normalizeKnxAiChatContext(context)
|
|
141
|
-
const { target, session } = touchSession(context, sessionId)
|
|
142
|
-
const normalizedText = instruction.text.toLocaleLowerCase()
|
|
143
|
-
session.instructions = session.instructions
|
|
144
|
-
.filter(item => item.text.toLocaleLowerCase() !== normalizedText)
|
|
145
|
-
session.instructions.push(instruction)
|
|
146
|
-
session.instructions = session.instructions.slice(-CHAT_CONTEXT_MAX_INSTRUCTIONS_PER_SESSION)
|
|
147
|
-
return target
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const removeKnxAiChatInstructions = (context, { sessionId, text, all = false } = {}) => {
|
|
151
|
-
const { target, session } = touchSession(context, sessionId)
|
|
152
|
-
if (all === true) {
|
|
153
|
-
session.instructions = []
|
|
154
|
-
return target
|
|
155
|
-
}
|
|
156
|
-
const normalizedText = clampText(text, CHAT_CONTEXT_MAX_INSTRUCTION_CHARS).toLocaleLowerCase()
|
|
157
|
-
if (!normalizedText) return target
|
|
158
|
-
session.instructions = session.instructions
|
|
159
|
-
.filter(item => item.text.toLocaleLowerCase() !== normalizedText)
|
|
160
|
-
return target
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const clearKnxAiChatSession = (context, sessionId) => {
|
|
164
|
-
const target = normalizeKnxAiChatContext(context)
|
|
165
|
-
const id = normalizeSessionId(sessionId)
|
|
166
|
-
target.sessions = target.sessions.filter(session => session.id !== id)
|
|
167
|
-
target.updatedAt = new Date().toISOString()
|
|
168
|
-
return target
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const addKnxAiCameraWatch = (context, { sessionId, watch } = {}) => {
|
|
172
|
-
const normalized = normalizeCameraWatch(watch)
|
|
173
|
-
if (!normalized) return normalizeKnxAiChatContext(context)
|
|
174
|
-
const { target, session } = touchSession(context, sessionId)
|
|
175
|
-
session.cameraWatches = (Array.isArray(session.cameraWatches) ? session.cameraWatches : [])
|
|
176
|
-
.filter(item => item.id !== normalized.id)
|
|
177
|
-
session.cameraWatches.push(normalized)
|
|
178
|
-
session.cameraWatches = session.cameraWatches.slice(-CHAT_CONTEXT_MAX_CAMERA_WATCHES_PER_SESSION)
|
|
179
|
-
return target
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const removeKnxAiCameraWatches = (context, { sessionId, predicate } = {}) => {
|
|
183
|
-
const { target, session } = touchSession(context, sessionId)
|
|
184
|
-
const before = Array.isArray(session.cameraWatches) ? session.cameraWatches.length : 0
|
|
185
|
-
session.cameraWatches = (Array.isArray(session.cameraWatches) ? session.cameraWatches : [])
|
|
186
|
-
.filter(watch => !(typeof predicate === 'function' && predicate(watch)))
|
|
187
|
-
return { context: target, removed: Math.max(0, before - session.cameraWatches.length) }
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const listKnxAiCameraWatches = (context, sessionId) => getKnxAiChatSession(context, sessionId).cameraWatches.slice()
|
|
191
|
-
|
|
192
|
-
const listAllKnxAiCameraWatches = (context) => normalizeKnxAiChatContext(context).sessions.flatMap(session => {
|
|
193
|
-
return session.cameraWatches.map(watch => Object.assign({ sessionId: session.id }, watch))
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
const getKnxAiChatSession = (context, sessionId) => {
|
|
197
|
-
const session = findSession(context, sessionId)
|
|
198
|
-
return session || {
|
|
199
|
-
id: normalizeSessionId(sessionId),
|
|
200
|
-
updatedAt: '',
|
|
201
|
-
turns: [],
|
|
202
|
-
instructions: [],
|
|
203
|
-
cameraWatches: []
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const buildKnxAiChatPromptContext = ({ context, sessionId, maxChars = 16000 } = {}) => {
|
|
208
|
-
const session = getKnxAiChatSession(context, sessionId)
|
|
209
|
-
if (!session.instructions.length && !session.turns.length && !session.cameraWatches.length) return ''
|
|
210
|
-
const boundedChars = Number(maxChars) > 0 ? Math.max(1000, Number(maxChars)) : 0
|
|
211
|
-
if (boundedChars > 0) {
|
|
212
|
-
const fixedBlocks = []
|
|
213
|
-
if (session.instructions.length) {
|
|
214
|
-
const instructionBudget = Math.min(1200, Math.max(400, Math.floor(boundedChars * 0.3)))
|
|
215
|
-
const instructionLines = [
|
|
216
|
-
'PERSISTENT USER FACTS AND INSTRUCTIONS:',
|
|
217
|
-
...session.instructions.map(item => `- ${item.text.replace(/\r?\n/g, ' ')}`)
|
|
218
|
-
]
|
|
219
|
-
fixedBlocks.push(instructionLines.join('\n').slice(0, instructionBudget))
|
|
220
|
-
}
|
|
221
|
-
if (session.cameraWatches.length) {
|
|
222
|
-
const watchLines = [
|
|
223
|
-
'ACTIVE CAMERA WATCHES:',
|
|
224
|
-
...session.cameraWatches.map(watch => {
|
|
225
|
-
const camera = watch.cameraName || watch.cameraId
|
|
226
|
-
const scope = watch.scopeName || watch.scopeId
|
|
227
|
-
const objects = watch.objectTypes.length ? `; objects ${watch.objectTypes.join(', ')}` : ''
|
|
228
|
-
return `- ${watch.id}: ${camera}; event ${watch.eventType}${scope ? `; scope ${scope}` : ''}${objects}; cooldown ${watch.cooldownSeconds}s`
|
|
229
|
-
})
|
|
230
|
-
]
|
|
231
|
-
fixedBlocks.push(watchLines.join('\n').slice(0, Math.min(800, Math.floor(boundedChars * 0.25))))
|
|
232
|
-
}
|
|
233
|
-
const fixedText = fixedBlocks.join('\n\n')
|
|
234
|
-
const turnBudget = Math.max(0, boundedChars - fixedText.length - (fixedText ? 2 : 0))
|
|
235
|
-
const selectedTurns = []
|
|
236
|
-
let used = 0
|
|
237
|
-
for (let index = session.turns.length - 1; index >= 0; index -= 1) {
|
|
238
|
-
const turn = session.turns[index]
|
|
239
|
-
const renderedTurn = `User: ${clampText(turn.question, 700)}\nAssistant: ${clampText(turn.reply, 1400)}`
|
|
240
|
-
const nextSize = renderedTurn.length + (selectedTurns.length ? 1 : 0)
|
|
241
|
-
if (used + nextSize > turnBudget) {
|
|
242
|
-
if (!selectedTurns.length && turnBudget >= 200) selectedTurns.unshift(renderedTurn.slice(0, turnBudget))
|
|
243
|
-
break
|
|
244
|
-
}
|
|
245
|
-
selectedTurns.unshift(renderedTurn)
|
|
246
|
-
used += nextSize
|
|
247
|
-
}
|
|
248
|
-
const conversationBlock = selectedTurns.length ? `RECENT CONVERSATION:\n${selectedTurns.join('\n')}` : ''
|
|
249
|
-
return [fixedText, conversationBlock].filter(Boolean).join('\n\n').slice(0, boundedChars)
|
|
250
|
-
}
|
|
251
|
-
const lines = []
|
|
252
|
-
if (session.instructions.length) {
|
|
253
|
-
lines.push('PERSISTENT USER-PROVIDED FACTS, PREFERENCES, AND INSTRUCTIONS (follow relevant entries unless they conflict with safety or the KNX contract; newer entries override older conflicting entries):')
|
|
254
|
-
session.instructions.forEach(item => lines.push(`- ${item.text.replace(/\r?\n/g, ' ')}`))
|
|
255
|
-
}
|
|
256
|
-
if (session.turns.length) {
|
|
257
|
-
if (lines.length) lines.push('')
|
|
258
|
-
lines.push('RECENT CONVERSATION:')
|
|
259
|
-
session.turns.forEach((turn) => {
|
|
260
|
-
lines.push(`User: ${turn.question}`)
|
|
261
|
-
lines.push(`Assistant: ${turn.reply}`)
|
|
262
|
-
})
|
|
263
|
-
}
|
|
264
|
-
if (session.cameraWatches.length) {
|
|
265
|
-
if (lines.length) lines.push('')
|
|
266
|
-
lines.push('ACTIVE CAMERA WATCHES (persistent notification rules created by this chat):')
|
|
267
|
-
session.cameraWatches.forEach((watch) => {
|
|
268
|
-
const camera = watch.cameraName || watch.cameraId
|
|
269
|
-
const scope = watch.scopeName || watch.scopeId
|
|
270
|
-
const objects = watch.objectTypes.length ? `; objects ${watch.objectTypes.join(', ')}` : ''
|
|
271
|
-
lines.push(`- ${watch.id}: ${camera}; event ${watch.eventType}${scope ? `; scope ${scope}` : ''}${objects}; cooldown ${watch.cooldownSeconds}s`)
|
|
272
|
-
})
|
|
273
|
-
}
|
|
274
|
-
const rendered = lines.join('\n')
|
|
275
|
-
return rendered
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const escapeKnxAiChatContextField = value => String(value === undefined || value === null ? '' : value)
|
|
279
|
-
.replace(/\\/g, '\\\\')
|
|
280
|
-
.replace(/\t/g, '\\t')
|
|
281
|
-
.replace(/\r/g, '\\r')
|
|
282
|
-
.replace(/\n/g, '\\n')
|
|
283
|
-
|
|
284
|
-
const unescapeKnxAiChatContextField = (value) => {
|
|
285
|
-
const source = String(value === undefined || value === null ? '' : value)
|
|
286
|
-
let result = ''
|
|
287
|
-
for (let index = 0; index < source.length; index += 1) {
|
|
288
|
-
const char = source[index]
|
|
289
|
-
if (char !== '\\' || index + 1 >= source.length) {
|
|
290
|
-
result += char
|
|
291
|
-
continue
|
|
292
|
-
}
|
|
293
|
-
const next = source[index + 1]
|
|
294
|
-
if (next === '\\') result += '\\'
|
|
295
|
-
else if (next === 't') result += '\t'
|
|
296
|
-
else if (next === 'r') result += '\r'
|
|
297
|
-
else if (next === 'n') result += '\n'
|
|
298
|
-
else result += `\\${next}`
|
|
299
|
-
index += 1
|
|
300
|
-
}
|
|
301
|
-
return result
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const buildKnxAiChatContextRecord = (type, fields = []) => [type]
|
|
305
|
-
.concat(fields.map(escapeKnxAiChatContextField))
|
|
306
|
-
.join('\t')
|
|
307
|
-
|
|
308
|
-
const renderKnxAiChatContextFile = (context) => {
|
|
309
|
-
const target = normalizeKnxAiChatContext(context)
|
|
310
|
-
target.updatedAt = new Date().toISOString()
|
|
311
|
-
const lines = [
|
|
312
|
-
'# Cerebrum Ultimate native chat-learning context',
|
|
313
|
-
'# Tab-separated records. Escapes: \\\\ (backslash), \\t (tab), \\n (newline), \\r (carriage return).',
|
|
314
|
-
'# Records: SESSION, INSTRUCTION, TURN, CAMERA_WATCH, END_SESSION.',
|
|
315
|
-
buildKnxAiChatContextRecord(CHAT_CONTEXT_NATIVE_HEADER, [CHAT_CONTEXT_VERSION]),
|
|
316
|
-
buildKnxAiChatContextRecord('CREATED_AT', [target.createdAt]),
|
|
317
|
-
buildKnxAiChatContextRecord('UPDATED_AT', [target.updatedAt])
|
|
318
|
-
]
|
|
319
|
-
target.sessions.forEach((session) => {
|
|
320
|
-
lines.push(buildKnxAiChatContextRecord('SESSION', [session.id, session.updatedAt]))
|
|
321
|
-
session.instructions.forEach(item => lines.push(buildKnxAiChatContextRecord('INSTRUCTION', [item.at, item.text])))
|
|
322
|
-
session.turns.forEach(turn => lines.push(buildKnxAiChatContextRecord('TURN', [turn.at, turn.question, turn.reply])))
|
|
323
|
-
session.cameraWatches.forEach((watch) => {
|
|
324
|
-
lines.push(buildKnxAiChatContextRecord('CAMERA_WATCH', [
|
|
325
|
-
watch.id,
|
|
326
|
-
watch.createdAt,
|
|
327
|
-
watch.cameraId,
|
|
328
|
-
watch.cameraName,
|
|
329
|
-
watch.eventType,
|
|
330
|
-
watch.scopeId,
|
|
331
|
-
watch.scopeName,
|
|
332
|
-
watch.cooldownSeconds,
|
|
333
|
-
watch.sendSnapshot ? 'true' : 'false',
|
|
334
|
-
watch.language
|
|
335
|
-
].concat(watch.objectTypes)))
|
|
336
|
-
})
|
|
337
|
-
lines.push('END_SESSION')
|
|
338
|
-
})
|
|
339
|
-
return { content: `${lines.join('\n')}\n`, context: target }
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
const buildKnxAiChatContextFile = ({ context, maxBytes = CHAT_CONTEXT_MAX_BYTES } = {}) => {
|
|
343
|
-
const targetBytes = Math.max(64 * 1024, Math.min(CHAT_CONTEXT_MAX_BYTES, Number(maxBytes) || CHAT_CONTEXT_MAX_BYTES))
|
|
344
|
-
let bounded = normalizeKnxAiChatContext(context)
|
|
345
|
-
let rendered = renderKnxAiChatContextFile(bounded)
|
|
346
|
-
while (Buffer.byteLength(rendered.content, 'utf8') > targetBytes) {
|
|
347
|
-
const sessionWithTurns = bounded.sessions.find(session => session.turns.length > 0)
|
|
348
|
-
if (sessionWithTurns) sessionWithTurns.turns.shift()
|
|
349
|
-
else if (bounded.sessions.length > 1) bounded.sessions.shift()
|
|
350
|
-
else {
|
|
351
|
-
const sessionWithInstructions = bounded.sessions.find(session => session.instructions.length > 0)
|
|
352
|
-
if (!sessionWithInstructions) break
|
|
353
|
-
sessionWithInstructions.instructions.shift()
|
|
354
|
-
}
|
|
355
|
-
rendered = renderKnxAiChatContextFile(bounded)
|
|
356
|
-
bounded = rendered.context
|
|
357
|
-
}
|
|
358
|
-
return {
|
|
359
|
-
content: rendered.content,
|
|
360
|
-
context: rendered.context,
|
|
361
|
-
bytes: Buffer.byteLength(rendered.content, 'utf8'),
|
|
362
|
-
maxBytes: targetBytes
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
const parseKnxAiChatContextFileStrict = (content) => {
|
|
367
|
-
const source = String(content || '')
|
|
368
|
-
const context = { version: CHAT_CONTEXT_VERSION, createdAt: '', updatedAt: '', sessions: [] }
|
|
369
|
-
let headerSeen = false
|
|
370
|
-
let currentSession = null
|
|
371
|
-
|
|
372
|
-
source.split(/\r?\n/).forEach((line, lineIndex) => {
|
|
373
|
-
if (!line.trim() || line.trimStart().startsWith('#')) return
|
|
374
|
-
const fields = line.split('\t').map(unescapeKnxAiChatContextField)
|
|
375
|
-
const record = fields.shift()
|
|
376
|
-
const fail = message => { throw new Error(`Invalid Cerebrum Ultimate native chat-learning context at line ${lineIndex + 1}: ${message}`) }
|
|
377
|
-
|
|
378
|
-
if (!headerSeen) {
|
|
379
|
-
if (record !== CHAT_CONTEXT_NATIVE_HEADER || String(fields[0] || '') !== String(CHAT_CONTEXT_VERSION)) {
|
|
380
|
-
fail(`expected ${CHAT_CONTEXT_NATIVE_HEADER} ${CHAT_CONTEXT_VERSION} header`)
|
|
381
|
-
}
|
|
382
|
-
headerSeen = true
|
|
383
|
-
return
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
if (record === 'CREATED_AT') {
|
|
387
|
-
if (currentSession) fail('CREATED_AT is not allowed inside a session')
|
|
388
|
-
context.createdAt = fields[0] || ''
|
|
389
|
-
return
|
|
390
|
-
}
|
|
391
|
-
if (record === 'UPDATED_AT') {
|
|
392
|
-
if (currentSession) fail('UPDATED_AT is not allowed inside a session')
|
|
393
|
-
context.updatedAt = fields[0] || ''
|
|
394
|
-
return
|
|
395
|
-
}
|
|
396
|
-
if (record === 'SESSION') {
|
|
397
|
-
if (currentSession) fail('nested SESSION record')
|
|
398
|
-
if (!String(fields[0] || '').trim()) fail('SESSION id is required')
|
|
399
|
-
currentSession = {
|
|
400
|
-
id: fields[0],
|
|
401
|
-
updatedAt: fields[1] || '',
|
|
402
|
-
turns: [],
|
|
403
|
-
instructions: [],
|
|
404
|
-
cameraWatches: []
|
|
405
|
-
}
|
|
406
|
-
return
|
|
407
|
-
}
|
|
408
|
-
if (record === 'END_SESSION') {
|
|
409
|
-
if (!currentSession) fail('END_SESSION without SESSION')
|
|
410
|
-
context.sessions.push(currentSession)
|
|
411
|
-
currentSession = null
|
|
412
|
-
return
|
|
413
|
-
}
|
|
414
|
-
if (!currentSession) fail(`${record || 'empty record'} is not allowed outside a session`)
|
|
415
|
-
if (record === 'INSTRUCTION') {
|
|
416
|
-
if (fields.length < 2 || !String(fields[1] || '').trim()) fail('INSTRUCTION requires timestamp and text')
|
|
417
|
-
currentSession.instructions.push({ at: fields[0], text: fields[1] })
|
|
418
|
-
return
|
|
419
|
-
}
|
|
420
|
-
if (record === 'TURN') {
|
|
421
|
-
if (fields.length < 3 || (!String(fields[1] || '').trim() && !String(fields[2] || '').trim())) {
|
|
422
|
-
fail('TURN requires timestamp, question and reply')
|
|
423
|
-
}
|
|
424
|
-
currentSession.turns.push({ at: fields[0], question: fields[1], reply: fields[2] })
|
|
425
|
-
return
|
|
426
|
-
}
|
|
427
|
-
if (record === 'CAMERA_WATCH') {
|
|
428
|
-
if (fields.length < 10) fail('CAMERA_WATCH has missing fields')
|
|
429
|
-
if (fields[8] !== 'true' && fields[8] !== 'false') fail('CAMERA_WATCH sendSnapshot must be true or false')
|
|
430
|
-
currentSession.cameraWatches.push({
|
|
431
|
-
id: fields[0],
|
|
432
|
-
createdAt: fields[1],
|
|
433
|
-
cameraId: fields[2],
|
|
434
|
-
cameraName: fields[3],
|
|
435
|
-
eventType: fields[4],
|
|
436
|
-
scopeId: fields[5],
|
|
437
|
-
scopeName: fields[6],
|
|
438
|
-
cooldownSeconds: Number(fields[7]),
|
|
439
|
-
sendSnapshot: fields[8] === 'true',
|
|
440
|
-
language: fields[9],
|
|
441
|
-
objectTypes: fields.slice(10)
|
|
442
|
-
})
|
|
443
|
-
return
|
|
444
|
-
}
|
|
445
|
-
fail(`unknown ${record || 'empty'} record`)
|
|
446
|
-
})
|
|
447
|
-
|
|
448
|
-
if (!headerSeen) throw new Error(`The file does not contain a ${CHAT_CONTEXT_NATIVE_HEADER} ${CHAT_CONTEXT_VERSION} header`)
|
|
449
|
-
if (currentSession) throw new Error('Invalid Cerebrum Ultimate native chat-learning context: SESSION without END_SESSION')
|
|
450
|
-
if (!context.createdAt || !context.updatedAt) throw new Error('Invalid Cerebrum Ultimate native chat-learning context: CREATED_AT and UPDATED_AT are required')
|
|
451
|
-
return normalizeKnxAiChatContext(context)
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
const parseKnxAiChatContextFile = (content) => {
|
|
455
|
-
try {
|
|
456
|
-
return parseKnxAiChatContextFileStrict(content)
|
|
457
|
-
} catch (error) {
|
|
458
|
-
return createEmptyKnxAiChatContext()
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
const conversationMapFromKnxAiChatContext = (context) => {
|
|
463
|
-
const result = new Map()
|
|
464
|
-
normalizeKnxAiChatContext(context).sessions.forEach((session) => {
|
|
465
|
-
result.set(session.id, session.turns.map(turn => ({
|
|
466
|
-
question: turn.question,
|
|
467
|
-
reply: turn.reply
|
|
468
|
-
})))
|
|
469
|
-
})
|
|
470
|
-
return result
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
module.exports = {
|
|
474
|
-
CHAT_CONTEXT_MAX_CAMERA_WATCHES_PER_SESSION,
|
|
475
|
-
CHAT_CONTEXT_MAX_BYTES,
|
|
476
|
-
CHAT_CONTEXT_MAX_INSTRUCTIONS_PER_SESSION,
|
|
477
|
-
CHAT_CONTEXT_MAX_SESSIONS,
|
|
478
|
-
CHAT_CONTEXT_MAX_TURNS_PER_SESSION,
|
|
479
|
-
addKnxAiCameraWatch,
|
|
480
|
-
addKnxAiChatInstruction,
|
|
481
|
-
addKnxAiChatTurn,
|
|
482
|
-
buildKnxAiChatContextFile,
|
|
483
|
-
buildKnxAiChatPromptContext,
|
|
484
|
-
clearKnxAiChatSession,
|
|
485
|
-
conversationMapFromKnxAiChatContext,
|
|
486
|
-
createEmptyKnxAiChatContext,
|
|
487
|
-
getKnxAiChatSession,
|
|
488
|
-
listAllKnxAiCameraWatches,
|
|
489
|
-
listKnxAiCameraWatches,
|
|
490
|
-
normalizeKnxAiChatContext,
|
|
491
|
-
normalizeCameraWatch,
|
|
492
|
-
parseKnxAiChatContextFile,
|
|
493
|
-
parseKnxAiChatContextFileStrict,
|
|
494
|
-
removeKnxAiCameraWatches,
|
|
495
|
-
removeKnxAiChatInstructions
|
|
496
|
-
}
|