neoagent 2.3.1-beta.0 → 2.3.1-beta.100
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/.env.example +63 -5
- package/README.md +16 -5
- package/com.neoagent.plist +1 -1
- package/docs/automation.md +82 -41
- package/docs/capabilities.md +85 -89
- package/docs/configuration.md +89 -87
- package/docs/getting-started.md +46 -27
- package/docs/hardware.md +1 -1
- package/docs/index.md +24 -30
- package/docs/integrations.md +46 -60
- package/docs/migration.md +41 -146
- package/docs/operations.md +23 -20
- package/docs/skills.md +20 -20
- package/docs/why-neoagent.md +15 -13
- package/extensions/chrome-browser/background.mjs +10 -2
- package/flutter_app/.metadata +42 -0
- package/flutter_app/DESIGN_SYSTEM.md +166 -0
- package/flutter_app/README.md +21 -0
- package/flutter_app/analysis_options.yaml +32 -0
- package/flutter_app/android/app/build.gradle.kts +111 -0
- package/flutter_app/android/app/src/debug/AndroidManifest.xml +7 -0
- package/flutter_app/android/app/src/main/AndroidManifest.xml +185 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/MainActivity.kt +888 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/auto/NeoAgentCarAppService.kt +114 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/HealthConnectGateway.kt +280 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/HealthSyncNotifications.kt +113 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/HealthSyncPayload.kt +57 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/HealthSyncScheduler.kt +78 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/HealthSyncWorker.kt +253 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/health/PermissionsRationaleActivity.kt +46 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/recording/RecordingBootReceiver.kt +21 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/recording/RecordingForegroundService.kt +586 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/recording/RecordingStateStore.kt +78 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/recording/RecordingUploadClient.kt +104 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/telecom/NeoAgentConnection.kt +118 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/telecom/NeoAgentConnectionService.kt +86 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/AiHomeWidgetProvider.kt +457 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/AiWidgetStore.kt +194 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/VoiceLaunchWidgetProvider.kt +67 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/WidgetConfigActivity.kt +228 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/WidgetSyncScheduler.kt +72 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/WidgetSyncWorker.kt +186 -0
- package/flutter_app/android/app/src/main/kotlin/com/neoagent/flutter_app/widgets/WidgetTaskRunWorker.kt +210 -0
- package/flutter_app/android/app/src/main/res/drawable/launch_background.xml +12 -0
- package/flutter_app/android/app/src/main/res/drawable/neoagent_ai_widget_bg.xml +11 -0
- package/flutter_app/android/app/src/main/res/drawable/neoagent_ai_widget_task_bg.xml +8 -0
- package/flutter_app/android/app/src/main/res/drawable-v21/launch_background.xml +12 -0
- package/flutter_app/android/app/src/main/res/layout/neoagent_ai_widget.xml +138 -0
- package/flutter_app/android/app/src/main/res/layout/neoagent_ai_widget_task_row.xml +52 -0
- package/flutter_app/android/app/src/main/res/layout/neoagent_voice_widget.xml +49 -0
- package/flutter_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/flutter_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/flutter_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/flutter_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/flutter_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/flutter_app/android/app/src/main/res/values/arrays.xml +8 -0
- package/flutter_app/android/app/src/main/res/values/strings.xml +12 -0
- package/flutter_app/android/app/src/main/res/values/styles.xml +18 -0
- package/flutter_app/android/app/src/main/res/values-night/styles.xml +18 -0
- package/flutter_app/android/app/src/main/res/xml/automotive_app_desc.xml +4 -0
- package/flutter_app/android/app/src/main/res/xml/file_paths.xml +6 -0
- package/flutter_app/android/app/src/main/res/xml/neoagent_ai_widget_info.xml +12 -0
- package/flutter_app/android/app/src/main/res/xml/neoagent_voice_widget_info.xml +12 -0
- package/flutter_app/android/app/src/profile/AndroidManifest.xml +7 -0
- package/flutter_app/android/build.gradle.kts +24 -0
- package/flutter_app/android/ci-release.keystore +0 -0
- package/flutter_app/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/flutter_app/android/gradle.properties +3 -0
- package/flutter_app/android/key.properties +4 -0
- package/flutter_app/android/settings.gradle.kts +26 -0
- package/flutter_app/assets/branding/app_icon_1024.png +0 -0
- package/flutter_app/assets/branding/app_icon_128.png +0 -0
- package/flutter_app/assets/branding/app_icon_192.png +0 -0
- package/flutter_app/assets/branding/app_icon_256.png +0 -0
- package/flutter_app/assets/branding/app_icon_32.png +0 -0
- package/flutter_app/assets/branding/app_icon_512.png +0 -0
- package/flutter_app/assets/branding/app_icon_64.png +0 -0
- package/flutter_app/assets/branding/onboarding_intro.mp4 +0 -0
- package/flutter_app/assets/branding/tray_icon_template.png +0 -0
- package/flutter_app/lib/features/location/location_service.dart +117 -0
- package/flutter_app/lib/features/notifications/notification_interceptor.dart +73 -0
- package/flutter_app/lib/features/onboarding/onboarding_chrome.dart +571 -0
- package/flutter_app/lib/features/onboarding/onboarding_messaging_step.dart +275 -0
- package/flutter_app/lib/features/onboarding/onboarding_model_step.dart +366 -0
- package/flutter_app/lib/features/onboarding/onboarding_shell.dart +57 -0
- package/flutter_app/lib/features/onboarding/onboarding_video_step.dart +218 -0
- package/flutter_app/lib/features/onboarding/onboarding_welcome_step.dart +46 -0
- package/flutter_app/lib/main.dart +107 -0
- package/flutter_app/lib/main_account_settings.dart +1340 -0
- package/flutter_app/lib/main_admin.dart +900 -0
- package/flutter_app/lib/main_app_shell.dart +2162 -0
- package/flutter_app/lib/main_chat.dart +3902 -0
- package/flutter_app/lib/main_controller.dart +7229 -0
- package/flutter_app/lib/main_devices.dart +1738 -0
- package/flutter_app/lib/main_integrations.dart +917 -0
- package/flutter_app/lib/main_launcher.dart +959 -0
- package/flutter_app/lib/main_launcher_entry.dart +5 -0
- package/flutter_app/lib/main_models.dart +3807 -0
- package/flutter_app/lib/main_navigation.dart +206 -0
- package/flutter_app/lib/main_operations.dart +5249 -0
- package/flutter_app/lib/main_recordings.dart +920 -0
- package/flutter_app/lib/main_runtime.dart +869 -0
- package/flutter_app/lib/main_settings.dart +2288 -0
- package/flutter_app/lib/main_shared.dart +3393 -0
- package/flutter_app/lib/main_spacing.dart +33 -0
- package/flutter_app/lib/main_theme.dart +276 -0
- package/flutter_app/lib/main_unified.dart +388 -0
- package/flutter_app/lib/main_voice_assistant.dart +957 -0
- package/flutter_app/lib/src/analytics_service.dart +294 -0
- package/flutter_app/lib/src/android_apk_drop_zone.dart +32 -0
- package/flutter_app/lib/src/android_apk_drop_zone_stub.dart +16 -0
- package/flutter_app/lib/src/android_apk_drop_zone_web.dart +348 -0
- package/flutter_app/lib/src/android_app_installer.dart +22 -0
- package/flutter_app/lib/src/android_app_installer_io.dart +122 -0
- package/flutter_app/lib/src/android_app_installer_stub.dart +21 -0
- package/flutter_app/lib/src/android_auto_bridge.dart +59 -0
- package/flutter_app/lib/src/android_launcher_bridge.dart +239 -0
- package/flutter_app/lib/src/app_launch_bridge.dart +58 -0
- package/flutter_app/lib/src/app_release_updater.dart +511 -0
- package/flutter_app/lib/src/backend_client.dart +1870 -0
- package/flutter_app/lib/src/desktop_companion.dart +2 -0
- package/flutter_app/lib/src/desktop_companion_actions.dart +586 -0
- package/flutter_app/lib/src/desktop_companion_io.dart +538 -0
- package/flutter_app/lib/src/desktop_companion_stub.dart +59 -0
- package/flutter_app/lib/src/desktop_native_bridge.dart +91 -0
- package/flutter_app/lib/src/desktop_screen_capture.dart +21 -0
- package/flutter_app/lib/src/desktop_screen_capture_io.dart +142 -0
- package/flutter_app/lib/src/desktop_screen_capture_stub.dart +12 -0
- package/flutter_app/lib/src/diagnostics_logger.dart +119 -0
- package/flutter_app/lib/src/health_bridge.dart +136 -0
- package/flutter_app/lib/src/live_voice_capture.dart +85 -0
- package/flutter_app/lib/src/messaging_access_summary.dart +46 -0
- package/flutter_app/lib/src/network/app_http_client.dart +53 -0
- package/flutter_app/lib/src/network/app_http_client_factory.dart +6 -0
- package/flutter_app/lib/src/network/app_http_client_io.dart +138 -0
- package/flutter_app/lib/src/network/app_http_client_stub.dart +3 -0
- package/flutter_app/lib/src/network/app_http_client_web.dart +94 -0
- package/flutter_app/lib/src/oauth_launcher.dart +33 -0
- package/flutter_app/lib/src/oauth_launcher_io.dart +95 -0
- package/flutter_app/lib/src/oauth_launcher_stub.dart +33 -0
- package/flutter_app/lib/src/oauth_launcher_web.dart +107 -0
- package/flutter_app/lib/src/recording_bridge.dart +232 -0
- package/flutter_app/lib/src/recording_bridge_io.dart +1019 -0
- package/flutter_app/lib/src/recording_bridge_stub.dart +120 -0
- package/flutter_app/lib/src/recording_bridge_web.dart +689 -0
- package/flutter_app/lib/src/recording_payloads.dart +86 -0
- package/flutter_app/lib/src/theme/palette.dart +81 -0
- package/flutter_app/lib/src/web_app_update_monitor.dart +17 -0
- package/flutter_app/lib/src/web_app_update_monitor_stub.dart +24 -0
- package/flutter_app/lib/src/web_app_update_monitor_web.dart +123 -0
- package/flutter_app/lib/src/widget_bridge.dart +49 -0
- package/flutter_app/linux/CMakeLists.txt +128 -0
- package/flutter_app/linux/flutter/CMakeLists.txt +88 -0
- package/flutter_app/linux/flutter/generated_plugin_registrant.cc +47 -0
- package/flutter_app/linux/flutter/generated_plugin_registrant.h +15 -0
- package/flutter_app/linux/flutter/generated_plugins.cmake +32 -0
- package/flutter_app/linux/runner/CMakeLists.txt +26 -0
- package/flutter_app/linux/runner/main.cc +6 -0
- package/flutter_app/linux/runner/my_application.cc +144 -0
- package/flutter_app/linux/runner/my_application.h +18 -0
- package/flutter_app/linux/runner/resources/app_icon.png +0 -0
- package/flutter_app/macos/Flutter/Flutter-Debug.xcconfig +2 -0
- package/flutter_app/macos/Flutter/Flutter-Release.xcconfig +2 -0
- package/flutter_app/macos/Flutter/GeneratedPluginRegistrant.swift +48 -0
- package/flutter_app/macos/Podfile +42 -0
- package/flutter_app/macos/Podfile.lock +87 -0
- package/flutter_app/macos/Runner/AppDelegate.swift +576 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
- package/flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
- package/flutter_app/macos/Runner/Base.lproj/MainMenu.xib +342 -0
- package/flutter_app/macos/Runner/Configs/AppInfo.xcconfig +14 -0
- package/flutter_app/macos/Runner/Configs/Debug.xcconfig +2 -0
- package/flutter_app/macos/Runner/Configs/Release.xcconfig +2 -0
- package/flutter_app/macos/Runner/Configs/Warnings.xcconfig +13 -0
- package/flutter_app/macos/Runner/DebugProfile.entitlements +16 -0
- package/flutter_app/macos/Runner/Info.plist +36 -0
- package/flutter_app/macos/Runner/MainFlutterWindow.swift +19 -0
- package/flutter_app/macos/Runner/Release.entitlements +12 -0
- package/flutter_app/macos/Runner.xcodeproj/project.pbxproj +801 -0
- package/flutter_app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/flutter_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +99 -0
- package/flutter_app/macos/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/flutter_app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/flutter_app/macos/RunnerTests/RunnerTests.swift +12 -0
- package/flutter_app/patch_strings.py +12 -0
- package/flutter_app/pubspec.lock +1256 -0
- package/flutter_app/pubspec.yaml +59 -0
- package/flutter_app/third_party/desktop_audio_capture/LICENSE +21 -0
- package/flutter_app/third_party/desktop_audio_capture/README.md +262 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/audio_capture.dart +65 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/config/mic_audio_config.dart +153 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/config/system_adudio_config.dart +110 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/mic/mic_audio_capture.dart +461 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/model/audio_status.dart +91 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/model/decibel_data.dart +106 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/model/input_device_type.dart +219 -0
- package/flutter_app/third_party/desktop_audio_capture/lib/system/system_audio_capture.dart +336 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/CMakeLists.txt +101 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/audio_capture_plugin.cc +692 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/include/audio_capture/audio_capture_plugin.h +35 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/include/audio_capture/mic_capture_plugin.h +36 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/include/desktop_audio_capture/audio_capture_plugin.h +32 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/include/desktop_audio_capture/mic_capture_plugin.h +32 -0
- package/flutter_app/third_party/desktop_audio_capture/linux/mic_capture_plugin.cc +878 -0
- package/flutter_app/third_party/desktop_audio_capture/macos/Classes/AudioCapturePlugin.swift +27 -0
- package/flutter_app/third_party/desktop_audio_capture/macos/Classes/MicCapturePlugin.swift +1172 -0
- package/flutter_app/third_party/desktop_audio_capture/macos/Classes/SystemCapturePlugin.swift +655 -0
- package/flutter_app/third_party/desktop_audio_capture/macos/Resources/PrivacyInfo.xcprivacy +12 -0
- package/flutter_app/third_party/desktop_audio_capture/macos/desktop_audio_capture.podspec +30 -0
- package/flutter_app/third_party/desktop_audio_capture/pubspec.yaml +87 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/CMakeLists.txt +105 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/audio_capture_plugin.cpp +80 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/audio_capture_plugin.h +31 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/audio_capture_plugin_c_api.cpp +12 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/include/audio_capture/audio_capture_plugin_c_api.h +23 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/include/desktop_audio_capture/audio_capture_plugin.h +25 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/mic_capture_plugin.cpp +1117 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/mic_capture_plugin.h +115 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/system_audio_capture_plugin.cpp +777 -0
- package/flutter_app/third_party/desktop_audio_capture/windows/system_audio_capture_plugin.h +87 -0
- package/flutter_app/third_party/flutter_secure_storage_linux/linux/CMakeLists.txt +30 -0
- package/flutter_app/third_party/flutter_secure_storage_linux/linux/flutter_secure_storage_linux_plugin.cc +215 -0
- package/flutter_app/third_party/flutter_secure_storage_linux/linux/include/flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h +27 -0
- package/flutter_app/third_party/flutter_secure_storage_linux/pubspec.yaml +20 -0
- package/flutter_app/tool/generate_desktop_branding.py +219 -0
- package/flutter_app/web/favicon.png +0 -0
- package/flutter_app/web/favicon.svg +12 -0
- package/flutter_app/web/icons/Icon-192.png +0 -0
- package/flutter_app/web/icons/Icon-512.png +0 -0
- package/flutter_app/web/icons/Icon-maskable-192.png +0 -0
- package/flutter_app/web/icons/Icon-maskable-512.png +0 -0
- package/flutter_app/web/index.html +39 -0
- package/flutter_app/web/manifest.json +35 -0
- package/flutter_app/windows/CMakeLists.txt +108 -0
- package/flutter_app/windows/flutter/CMakeLists.txt +109 -0
- package/flutter_app/windows/flutter/generated_plugin_registrant.cc +50 -0
- package/flutter_app/windows/flutter/generated_plugin_registrant.h +15 -0
- package/flutter_app/windows/flutter/generated_plugins.cmake +36 -0
- package/flutter_app/windows/runner/CMakeLists.txt +41 -0
- package/flutter_app/windows/runner/Runner.rc +121 -0
- package/flutter_app/windows/runner/flutter_window.cpp +533 -0
- package/flutter_app/windows/runner/flutter_window.h +37 -0
- package/flutter_app/windows/runner/main.cpp +53 -0
- package/flutter_app/windows/runner/resource.h +16 -0
- package/flutter_app/windows/runner/resources/app_icon.ico +0 -0
- package/flutter_app/windows/runner/runner.exe.manifest +14 -0
- package/flutter_app/windows/runner/utils.cpp +65 -0
- package/flutter_app/windows/runner/utils.h +19 -0
- package/flutter_app/windows/runner/win32_window.cpp +299 -0
- package/flutter_app/windows/runner/win32_window.h +102 -0
- package/lib/install_helpers.js +31 -0
- package/lib/manager.js +465 -43
- package/package.json +11 -3
- package/runtime/paths.js +137 -0
- package/server/config/analytics.js +30 -0
- package/server/db/database.js +363 -21
- package/server/guest-agent.android.package.json +13 -0
- package/server/guest-agent.browser.package.json +14 -0
- package/server/guest_agent.js +98 -52
- package/server/http/middleware.js +55 -2
- package/server/http/routes.js +6 -1
- package/server/http/static.js +41 -1
- package/server/index.js +16 -16
- package/server/public/.last_build_id +1 -1
- package/server/public/assets/AssetManifest.bin +1 -1
- package/server/public/assets/AssetManifest.bin.json +1 -1
- package/server/public/assets/AssetManifest.json +1 -1
- package/server/public/assets/NOTICES +679 -129
- package/server/public/assets/assets/branding/onboarding_intro.mp4 +0 -0
- package/server/public/assets/fonts/MaterialIcons-Regular.otf +0 -0
- package/server/public/assets/packages/mixpanel_flutter/assets/mixpanel.js +3 -0
- package/server/public/canvaskit/wimp.wasm +0 -0
- package/server/public/flutter_bootstrap.js +2 -2
- package/server/public/main.dart.js +95866 -87333
- package/server/routes/account.js +26 -1
- package/server/routes/agents.js +6 -2
- package/server/routes/android.js +22 -6
- package/server/routes/auth.js +25 -5
- package/server/routes/browser.js +47 -13
- package/server/routes/integrations.js +119 -9
- package/server/routes/memory.js +179 -8
- package/server/routes/runtime.js +14 -0
- package/server/routes/screenHistory.js +46 -0
- package/server/routes/settings.js +102 -24
- package/server/routes/skills.js +12 -0
- package/server/routes/social_video.js +66 -0
- package/server/routes/tasks.js +22 -2
- package/server/routes/triggers.js +90 -0
- package/server/routes/wearable.js +67 -0
- package/server/routes/widgets.js +4 -4
- package/server/services/ai/capabilityHealth.js +23 -51
- package/server/services/ai/compaction.js +1 -1
- package/server/services/ai/deliverables/artifact_helpers.js +190 -0
- package/server/services/ai/deliverables/contracts.js +113 -0
- package/server/services/ai/deliverables/index.js +20 -0
- package/server/services/ai/deliverables/selector.js +94 -0
- package/server/services/ai/deliverables/validator.js +63 -0
- package/server/services/ai/deliverables/workflows.js +207 -0
- package/server/services/ai/engine.js +372 -27
- package/server/services/ai/hooks.js +127 -0
- package/server/services/ai/integrated_tools/index.js +98 -0
- package/server/services/ai/integrated_tools/remotion.js +373 -0
- package/server/services/ai/integrated_tools/shared.js +204 -0
- package/server/services/ai/integrated_tools/slidev.js +207 -0
- package/server/services/ai/loopPolicy.js +146 -0
- package/server/services/ai/models.js +36 -0
- package/server/services/ai/providers/githubCopilot.js +97 -0
- package/server/services/ai/providers/openai.js +2 -1
- package/server/services/ai/providers/openaiCodex.js +384 -0
- package/server/services/ai/recordingInsights.js +11 -13
- package/server/services/ai/runEvents.js +100 -0
- package/server/services/ai/settings.js +20 -0
- package/server/services/ai/systemPrompt.js +16 -2
- package/server/services/ai/taskAnalysis.js +2 -0
- package/server/services/ai/toolResult.js +20 -0
- package/server/services/ai/toolRunner.js +46 -6
- package/server/services/ai/toolSelector.js +54 -1
- package/server/services/ai/tools.js +360 -127
- package/server/services/android/android_bootstrap_worker.js +63 -0
- package/server/services/android/controller.js +442 -1760
- package/server/services/bootstrap_helpers.js +0 -34
- package/server/services/browser/controller.js +326 -52
- package/server/services/cli/executor.js +40 -1
- package/server/services/desktop/screenRecorder.js +182 -0
- package/server/services/integrations/env.js +10 -0
- package/server/services/integrations/figma/provider.js +1 -0
- package/server/services/integrations/github/common.js +106 -0
- package/server/services/integrations/github/provider.js +499 -0
- package/server/services/integrations/github/repos.js +1124 -0
- package/server/services/integrations/google/provider.js +1 -0
- package/server/services/integrations/manager.js +88 -12
- package/server/services/integrations/microsoft/provider.js +1 -0
- package/server/services/integrations/oauth_provider.js +25 -8
- package/server/services/integrations/provider_config_store.js +85 -0
- package/server/services/integrations/registry.js +8 -2
- package/server/services/integrations/spotify/provider.js +488 -0
- package/server/services/integrations/trello/provider.js +842 -0
- package/server/services/integrations/weather/provider.js +559 -0
- package/server/services/integrations/whatsapp/provider.js +6 -2
- package/server/services/manager.js +109 -154
- package/server/services/mcp/client.js +120 -23
- package/server/services/memory/llm_transfer.js +218 -0
- package/server/services/memory/manager.js +299 -35
- package/server/services/messaging/access_policy.js +10 -0
- package/server/services/messaging/automation.js +1 -1
- package/server/services/messaging/manager.js +93 -8
- package/server/services/messaging/meshtastic.js +277 -0
- package/server/services/messaging/meshtastic_env.js +40 -0
- package/server/services/messaging/meshtastic_protocol.js +530 -0
- package/server/services/messaging/meshtastic_tcp_transport.js +25 -0
- package/server/services/runtime/backends/local-vm.js +221 -158
- package/server/services/runtime/docker-vm-manager.js +392 -0
- package/server/services/runtime/guest_bootstrap.js +654 -0
- package/server/services/runtime/manager.js +85 -29
- package/server/services/runtime/settings.js +22 -31
- package/server/services/runtime/validation.js +16 -31
- package/server/services/skills/base_catalog.js +33 -0
- package/server/services/social_video/adapters/base.js +26 -0
- package/server/services/social_video/adapters/index.js +27 -0
- package/server/services/social_video/adapters/instagram.js +17 -0
- package/server/services/social_video/adapters/tiktok.js +17 -0
- package/server/services/social_video/adapters/x.js +17 -0
- package/server/services/social_video/adapters/youtube.js +17 -0
- package/server/services/social_video/captions.js +187 -0
- package/server/services/social_video/frame.js +42 -0
- package/server/services/social_video/index.js +7 -0
- package/server/services/social_video/metadata.js +63 -0
- package/server/services/social_video/result.js +63 -0
- package/server/services/social_video/service.js +720 -0
- package/server/services/social_video/url.js +83 -0
- package/server/services/tasks/adapters/index.js +2 -0
- package/server/services/tasks/adapters/manual.js +12 -0
- package/server/services/tasks/adapters/schedule.js +33 -5
- package/server/services/tasks/adapters/weather_event.js +84 -0
- package/server/services/tasks/integration_runtime.js +86 -1
- package/server/services/tasks/runtime.js +3 -3
- package/server/services/tasks/task_repository.js +3 -6
- package/server/services/voice/agentBridge.js +20 -4
- package/server/services/voice/message.js +3 -0
- package/server/services/voice/openaiClient.js +4 -1
- package/server/services/voice/openaiSpeech.js +6 -1
- package/server/services/voice/providers.js +144 -15
- package/server/services/voice/runtime.js +8 -8
- package/server/services/voice/runtimeManager.js +292 -20
- package/server/services/voice/turnRunner.js +29 -9
- package/server/services/wearable/firmware_manifest.js +353 -0
- package/server/services/wearable/gateway.js +350 -0
- package/server/services/wearable/protocol.js +45 -0
- package/server/services/wearable/service.js +240 -0
- package/server/services/websocket.js +3 -1
- package/server/services/widgets/focus_widget.js +137 -0
- package/server/services/widgets/service.js +182 -6
- package/server/services/workspace/manager.js +301 -0
- package/server/utils/deployment.js +16 -9
- package/server/utils/local_secrets.js +56 -0
- package/server/utils/logger.js +37 -9
- package/server/services/integrations/home_assistant/provider.js +0 -350
- package/server/services/messaging/access_policy.test.js +0 -228
- package/server/services/runtime/backends/host.js +0 -37
- package/server/services/runtime/qemu.js +0 -391
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const crypto = require('crypto');
|
|
4
|
+
const db = require('../../../db/database');
|
|
5
|
+
const { fetchJson } = require('../oauth_provider');
|
|
6
|
+
|
|
7
|
+
const WEATHER_APP = {
|
|
8
|
+
id: 'forecast',
|
|
9
|
+
label: 'Forecast',
|
|
10
|
+
description: 'Public weather data from Open-Meteo (no API key required).',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const WEATHER_TOOL_DEFINITIONS = [
|
|
14
|
+
{
|
|
15
|
+
appId: WEATHER_APP.id,
|
|
16
|
+
name: 'weather_search_locations',
|
|
17
|
+
access: 'read',
|
|
18
|
+
description: 'Search Open-Meteo locations by city or place name.',
|
|
19
|
+
parameters: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
query: { type: 'string', description: 'Location text like "Berlin" or "San Francisco".' },
|
|
23
|
+
limit: { type: 'number', description: 'Maximum locations to return, default 5.' },
|
|
24
|
+
},
|
|
25
|
+
required: ['query'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
appId: WEATHER_APP.id,
|
|
30
|
+
name: 'weather_get_current',
|
|
31
|
+
access: 'read',
|
|
32
|
+
description: 'Get current weather conditions for a location or coordinates.',
|
|
33
|
+
parameters: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
location: { type: 'string', description: 'Optional location name like "Tokyo".' },
|
|
37
|
+
latitude: { type: 'number', description: 'Latitude, required with longitude if location is omitted.' },
|
|
38
|
+
longitude: { type: 'number', description: 'Longitude, required with latitude if location is omitted.' },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
appId: WEATHER_APP.id,
|
|
44
|
+
name: 'weather_get_forecast',
|
|
45
|
+
access: 'read',
|
|
46
|
+
description: 'Get hourly weather forecast for a location or coordinates.',
|
|
47
|
+
parameters: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
location: { type: 'string', description: 'Optional location name like "London".' },
|
|
51
|
+
latitude: { type: 'number', description: 'Latitude, required with longitude if location is omitted.' },
|
|
52
|
+
longitude: { type: 'number', description: 'Longitude, required with latitude if location is omitted.' },
|
|
53
|
+
forecast_hours: { type: 'number', description: 'Forecast horizon in hours (1-72), default 24.' },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
const WEATHER_CODE_LABELS = {
|
|
60
|
+
0: 'Clear sky',
|
|
61
|
+
1: 'Mainly clear',
|
|
62
|
+
2: 'Partly cloudy',
|
|
63
|
+
3: 'Overcast',
|
|
64
|
+
45: 'Fog',
|
|
65
|
+
48: 'Depositing rime fog',
|
|
66
|
+
51: 'Light drizzle',
|
|
67
|
+
53: 'Moderate drizzle',
|
|
68
|
+
55: 'Dense drizzle',
|
|
69
|
+
56: 'Light freezing drizzle',
|
|
70
|
+
57: 'Dense freezing drizzle',
|
|
71
|
+
61: 'Slight rain',
|
|
72
|
+
63: 'Moderate rain',
|
|
73
|
+
65: 'Heavy rain',
|
|
74
|
+
66: 'Light freezing rain',
|
|
75
|
+
67: 'Heavy freezing rain',
|
|
76
|
+
71: 'Slight snowfall',
|
|
77
|
+
73: 'Moderate snowfall',
|
|
78
|
+
75: 'Heavy snowfall',
|
|
79
|
+
77: 'Snow grains',
|
|
80
|
+
80: 'Slight rain showers',
|
|
81
|
+
81: 'Moderate rain showers',
|
|
82
|
+
82: 'Violent rain showers',
|
|
83
|
+
85: 'Slight snow showers',
|
|
84
|
+
86: 'Heavy snow showers',
|
|
85
|
+
95: 'Thunderstorm',
|
|
86
|
+
96: 'Thunderstorm with slight hail',
|
|
87
|
+
99: 'Thunderstorm with heavy hail',
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
function normalizeConnectionAccount(row, envStatus) {
|
|
91
|
+
if (!row) {
|
|
92
|
+
return {
|
|
93
|
+
id: null,
|
|
94
|
+
status: 'not_connected',
|
|
95
|
+
connected: false,
|
|
96
|
+
accountEmail: null,
|
|
97
|
+
lastConnectedAt: null,
|
|
98
|
+
accessMode: 'read_write',
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
id: row.id || null,
|
|
104
|
+
status: row.status || 'not_connected',
|
|
105
|
+
connected: row.status === 'connected',
|
|
106
|
+
accountEmail: row.account_email || null,
|
|
107
|
+
lastConnectedAt: row.last_connected_at || null,
|
|
108
|
+
accessMode: 'read_write',
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function sanitizeToolDefinition(definition) {
|
|
113
|
+
return {
|
|
114
|
+
...definition,
|
|
115
|
+
description:
|
|
116
|
+
`${definition.description} When multiple Weather accounts are connected, set connection_id or account_email to choose which one to use.`,
|
|
117
|
+
parameters: {
|
|
118
|
+
...(definition.parameters || { type: 'object', properties: {} }),
|
|
119
|
+
type: 'object',
|
|
120
|
+
properties: {
|
|
121
|
+
...((definition.parameters && definition.parameters.properties) || {}),
|
|
122
|
+
connection_id: {
|
|
123
|
+
type: 'number',
|
|
124
|
+
description: 'Optional connected Weather account ID.',
|
|
125
|
+
},
|
|
126
|
+
account_email: {
|
|
127
|
+
type: 'string',
|
|
128
|
+
description: 'Optional connected Weather account identifier.',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
required: Array.isArray(definition.parameters?.required)
|
|
132
|
+
? definition.parameters.required.slice()
|
|
133
|
+
: [],
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function toNumber(value, fallback = null) {
|
|
139
|
+
const num = Number(value);
|
|
140
|
+
return Number.isFinite(num) ? num : fallback;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function cleanLocationResult(item = {}) {
|
|
144
|
+
return {
|
|
145
|
+
name: item.name || null,
|
|
146
|
+
latitude: toNumber(item.latitude),
|
|
147
|
+
longitude: toNumber(item.longitude),
|
|
148
|
+
country: item.country || null,
|
|
149
|
+
admin1: item.admin1 || null,
|
|
150
|
+
timezone: item.timezone || null,
|
|
151
|
+
population: toNumber(item.population),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function geocodeLocation(locationQuery, limit = 1) {
|
|
156
|
+
const query = String(locationQuery || '').trim();
|
|
157
|
+
if (!query) {
|
|
158
|
+
throw new Error('location is required when latitude/longitude are not provided.');
|
|
159
|
+
}
|
|
160
|
+
const result = await fetchJson(
|
|
161
|
+
`https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(query)}&count=${Math.max(1, Math.min(Number(limit) || 1, 10))}&language=en&format=json`,
|
|
162
|
+
{ method: 'GET' },
|
|
163
|
+
{ serviceName: 'Open-Meteo geocoding' },
|
|
164
|
+
);
|
|
165
|
+
const matches = Array.isArray(result?.results) ? result.results : [];
|
|
166
|
+
if (matches.length === 0) {
|
|
167
|
+
throw new Error(`No location match found for "${query}".`);
|
|
168
|
+
}
|
|
169
|
+
return matches.map(cleanLocationResult);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
async function resolveLocation(args = {}, connection = null) {
|
|
173
|
+
const latitude = toNumber(args.latitude, null);
|
|
174
|
+
const longitude = toNumber(args.longitude, null);
|
|
175
|
+
if (latitude !== null && longitude !== null) {
|
|
176
|
+
return {
|
|
177
|
+
latitude,
|
|
178
|
+
longitude,
|
|
179
|
+
label: `${latitude.toFixed(4)}, ${longitude.toFixed(4)}`,
|
|
180
|
+
timezone: null,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const location = String(args.location || '').trim();
|
|
185
|
+
if (location) {
|
|
186
|
+
const [best] = await geocodeLocation(location, 1);
|
|
187
|
+
return {
|
|
188
|
+
latitude: best.latitude,
|
|
189
|
+
longitude: best.longitude,
|
|
190
|
+
label: [best.name, best.admin1, best.country].filter(Boolean).join(', ') || location,
|
|
191
|
+
timezone: best.timezone || null,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (connection) {
|
|
196
|
+
try {
|
|
197
|
+
const metadata = JSON.parse(String(connection.metadata_json || '{}')) || {};
|
|
198
|
+
const metaLatitude = toNumber(metadata.latitude, null);
|
|
199
|
+
const metaLongitude = toNumber(metadata.longitude, null);
|
|
200
|
+
if (metaLatitude !== null && metaLongitude !== null) {
|
|
201
|
+
return {
|
|
202
|
+
latitude: metaLatitude,
|
|
203
|
+
longitude: metaLongitude,
|
|
204
|
+
label: String(metadata.locationLabel || `${metaLatitude.toFixed(4)}, ${metaLongitude.toFixed(4)}`),
|
|
205
|
+
timezone: String(metadata.timezone || '') || null,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
} catch {
|
|
209
|
+
// Ignore malformed metadata and fail with a proper validation message below.
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
throw new Error('Provide either location or latitude/longitude for weather tools.');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function enrichCurrent(current = {}) {
|
|
217
|
+
const weatherCode = Number(current.weather_code);
|
|
218
|
+
return {
|
|
219
|
+
...current,
|
|
220
|
+
weather_label: Number.isFinite(weatherCode) ? WEATHER_CODE_LABELS[weatherCode] || 'Unknown' : 'Unknown',
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
async function fetchForecastForLocation(location, forecastHours = 24) {
|
|
225
|
+
const horizon = Math.max(1, Math.min(Number(forecastHours) || 24, 72));
|
|
226
|
+
const url = new URL('https://api.open-meteo.com/v1/forecast');
|
|
227
|
+
url.searchParams.set('latitude', String(location.latitude));
|
|
228
|
+
url.searchParams.set('longitude', String(location.longitude));
|
|
229
|
+
url.searchParams.set(
|
|
230
|
+
'current',
|
|
231
|
+
[
|
|
232
|
+
'temperature_2m',
|
|
233
|
+
'apparent_temperature',
|
|
234
|
+
'precipitation',
|
|
235
|
+
'rain',
|
|
236
|
+
'showers',
|
|
237
|
+
'snowfall',
|
|
238
|
+
'weather_code',
|
|
239
|
+
'wind_speed_10m',
|
|
240
|
+
'wind_gusts_10m',
|
|
241
|
+
'wind_direction_10m',
|
|
242
|
+
'is_day',
|
|
243
|
+
].join(','),
|
|
244
|
+
);
|
|
245
|
+
url.searchParams.set(
|
|
246
|
+
'hourly',
|
|
247
|
+
[
|
|
248
|
+
'temperature_2m',
|
|
249
|
+
'precipitation',
|
|
250
|
+
'rain',
|
|
251
|
+
'showers',
|
|
252
|
+
'snowfall',
|
|
253
|
+
'weather_code',
|
|
254
|
+
'wind_speed_10m',
|
|
255
|
+
'wind_gusts_10m',
|
|
256
|
+
'is_day',
|
|
257
|
+
].join(','),
|
|
258
|
+
);
|
|
259
|
+
url.searchParams.set('forecast_hours', String(horizon));
|
|
260
|
+
url.searchParams.set('timezone', location.timezone || 'auto');
|
|
261
|
+
|
|
262
|
+
const result = await fetchJson(url.toString(), { method: 'GET' }, { serviceName: 'Open-Meteo forecast' });
|
|
263
|
+
const hourly = result?.hourly || {};
|
|
264
|
+
const times = Array.isArray(hourly.time) ? hourly.time : [];
|
|
265
|
+
const rows = times.map((time, index) => {
|
|
266
|
+
const weatherCode = Number(hourly.weather_code?.[index]);
|
|
267
|
+
return {
|
|
268
|
+
time,
|
|
269
|
+
temperature: toNumber(hourly.temperature_2m?.[index]),
|
|
270
|
+
precipitation: toNumber(hourly.precipitation?.[index], 0),
|
|
271
|
+
rain: toNumber(hourly.rain?.[index], 0),
|
|
272
|
+
showers: toNumber(hourly.showers?.[index], 0),
|
|
273
|
+
snowfall: toNumber(hourly.snowfall?.[index], 0),
|
|
274
|
+
windSpeed: toNumber(hourly.wind_speed_10m?.[index], 0),
|
|
275
|
+
windGust: toNumber(hourly.wind_gusts_10m?.[index], 0),
|
|
276
|
+
weatherCode: Number.isFinite(weatherCode) ? weatherCode : null,
|
|
277
|
+
weatherLabel: Number.isFinite(weatherCode) ? WEATHER_CODE_LABELS[weatherCode] || 'Unknown' : 'Unknown',
|
|
278
|
+
isDay: Number(hourly.is_day?.[index]) === 1,
|
|
279
|
+
};
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
location: {
|
|
284
|
+
label: location.label,
|
|
285
|
+
latitude: toNumber(result?.latitude, location.latitude),
|
|
286
|
+
longitude: toNumber(result?.longitude, location.longitude),
|
|
287
|
+
timezone: result?.timezone || location.timezone || null,
|
|
288
|
+
elevation: toNumber(result?.elevation),
|
|
289
|
+
},
|
|
290
|
+
current: enrichCurrent(result?.current || {}),
|
|
291
|
+
hourly: rows,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
class WeatherProvider {
|
|
296
|
+
constructor() {
|
|
297
|
+
this.key = 'weather';
|
|
298
|
+
this.label = 'Weather';
|
|
299
|
+
this.description = 'Official weather integration powered by Open-Meteo public APIs (no API key required).';
|
|
300
|
+
this.icon = 'weather';
|
|
301
|
+
this.apps = [{ ...WEATHER_APP }];
|
|
302
|
+
this.connectPrompt =
|
|
303
|
+
'Connect Weather to use keyless forecast and current-condition tools, then trigger tasks on weather events.';
|
|
304
|
+
this.sessions = new Map();
|
|
305
|
+
this.sessionTTL = 30 * 60 * 1000;
|
|
306
|
+
this.#pruneTimer = setInterval(() => this.pruneExpiredSessions(), this.sessionTTL);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
#pruneTimer = null;
|
|
310
|
+
|
|
311
|
+
pruneExpiredSessions() {
|
|
312
|
+
const now = Date.now();
|
|
313
|
+
for (const [id, session] of this.sessions) {
|
|
314
|
+
if (now - session.createdAt > this.sessionTTL) {
|
|
315
|
+
this.sessions.delete(id);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
getApp(appId) {
|
|
321
|
+
return String(appId || '').trim() === WEATHER_APP.id ? { ...WEATHER_APP } : null;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
getToolAppId(toolName) {
|
|
325
|
+
const normalized = String(toolName || '').trim();
|
|
326
|
+
return WEATHER_TOOL_DEFINITIONS.some((tool) => tool.name === normalized)
|
|
327
|
+
? WEATHER_APP.id
|
|
328
|
+
: null;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
getEnvStatus() {
|
|
332
|
+
return {
|
|
333
|
+
configured: true,
|
|
334
|
+
missing: [],
|
|
335
|
+
summary: 'Weather is ready for account connections.',
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
buildSnapshot(connectionRows) {
|
|
340
|
+
const env = this.getEnvStatus();
|
|
341
|
+
const accounts = (Array.isArray(connectionRows) ? connectionRows : [])
|
|
342
|
+
.slice()
|
|
343
|
+
.sort((left, right) => String(right.updated_at || '').localeCompare(String(left.updated_at || '')))
|
|
344
|
+
.map((row) => normalizeConnectionAccount(row, env));
|
|
345
|
+
const connectedAccounts = accounts.filter((account) => account.connected);
|
|
346
|
+
const latestConnectedAt = connectedAccounts
|
|
347
|
+
.map((account) => account.lastConnectedAt)
|
|
348
|
+
.filter(Boolean)
|
|
349
|
+
.sort()
|
|
350
|
+
.reverse()[0] || null;
|
|
351
|
+
|
|
352
|
+
const appSnapshot = {
|
|
353
|
+
id: WEATHER_APP.id,
|
|
354
|
+
label: WEATHER_APP.label,
|
|
355
|
+
description: WEATHER_APP.description,
|
|
356
|
+
accounts,
|
|
357
|
+
connection: {
|
|
358
|
+
status: connectedAccounts.length > 0 ? 'connected' : 'not_connected',
|
|
359
|
+
connected: connectedAccounts.length > 0,
|
|
360
|
+
accountCount: connectedAccounts.length,
|
|
361
|
+
accountEmail: connectedAccounts.length === 1 ? connectedAccounts[0].accountEmail : null,
|
|
362
|
+
lastConnectedAt: latestConnectedAt,
|
|
363
|
+
},
|
|
364
|
+
availableToolCount: connectedAccounts.length > 0 ? WEATHER_TOOL_DEFINITIONS.length : 0,
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
return {
|
|
368
|
+
id: this.key,
|
|
369
|
+
label: this.label,
|
|
370
|
+
description: this.description,
|
|
371
|
+
icon: this.icon,
|
|
372
|
+
apps: [appSnapshot],
|
|
373
|
+
env,
|
|
374
|
+
connection: {
|
|
375
|
+
status: appSnapshot.connection.status,
|
|
376
|
+
connected: appSnapshot.connection.connected,
|
|
377
|
+
accountCount: appSnapshot.connection.accountCount,
|
|
378
|
+
appCount: appSnapshot.connection.connected ? 1 : 0,
|
|
379
|
+
accountEmail: appSnapshot.connection.accountEmail,
|
|
380
|
+
lastConnectedAt: appSnapshot.connection.lastConnectedAt,
|
|
381
|
+
},
|
|
382
|
+
availableToolCount: appSnapshot.availableToolCount,
|
|
383
|
+
connectPrompt: this.connectPrompt,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
summarizeForModel(snapshot) {
|
|
388
|
+
if (!snapshot?.connection?.connected) {
|
|
389
|
+
return 'Weather: available but not connected yet. Ask the user to connect Weather in Official Integrations.';
|
|
390
|
+
}
|
|
391
|
+
return 'Weather: connected with keyless Open-Meteo tools for geocoding, current conditions, and hourly forecast.';
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
getToolDefinitions({ connectedAppIds } = {}) {
|
|
395
|
+
const appIds = new Set(Array.isArray(connectedAppIds) ? connectedAppIds : []);
|
|
396
|
+
if (!appIds.has(WEATHER_APP.id)) {
|
|
397
|
+
return [];
|
|
398
|
+
}
|
|
399
|
+
return WEATHER_TOOL_DEFINITIONS.map(sanitizeToolDefinition);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
supportsTool(toolName) {
|
|
403
|
+
return WEATHER_TOOL_DEFINITIONS.some((tool) => tool.name === String(toolName || '').trim());
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
async beginConnection({ userId, agentId, appKey }) {
|
|
407
|
+
if (!this.getApp(appKey)) {
|
|
408
|
+
throw new Error(`Unknown ${this.label} app: ${appKey || 'missing app key'}`);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const accountEmail = 'public@open-meteo';
|
|
412
|
+
db.prepare(
|
|
413
|
+
`INSERT INTO integration_connections (
|
|
414
|
+
user_id,
|
|
415
|
+
agent_id,
|
|
416
|
+
provider_key,
|
|
417
|
+
app_key,
|
|
418
|
+
status,
|
|
419
|
+
account_email,
|
|
420
|
+
scopes_json,
|
|
421
|
+
credentials_json,
|
|
422
|
+
metadata_json,
|
|
423
|
+
last_connected_at,
|
|
424
|
+
updated_at
|
|
425
|
+
) VALUES (?, ?, ?, ?, 'connected', ?, ?, ?, ?, datetime('now'), datetime('now'))
|
|
426
|
+
ON CONFLICT(user_id, agent_id, provider_key, app_key, account_email) DO UPDATE SET
|
|
427
|
+
status = 'connected',
|
|
428
|
+
scopes_json = excluded.scopes_json,
|
|
429
|
+
credentials_json = excluded.credentials_json,
|
|
430
|
+
metadata_json = excluded.metadata_json,
|
|
431
|
+
last_connected_at = excluded.last_connected_at,
|
|
432
|
+
updated_at = excluded.updated_at`,
|
|
433
|
+
).run(
|
|
434
|
+
userId,
|
|
435
|
+
agentId,
|
|
436
|
+
this.key,
|
|
437
|
+
WEATHER_APP.id,
|
|
438
|
+
accountEmail,
|
|
439
|
+
JSON.stringify(['open-meteo:public']),
|
|
440
|
+
JSON.stringify({}),
|
|
441
|
+
JSON.stringify({ source: 'open-meteo', mode: 'public' }),
|
|
442
|
+
);
|
|
443
|
+
|
|
444
|
+
const connection = db.prepare(
|
|
445
|
+
`SELECT id FROM integration_connections
|
|
446
|
+
WHERE user_id = ? AND agent_id = ? AND provider_key = ? AND app_key = ? AND account_email = ?`,
|
|
447
|
+
).get(userId, agentId, this.key, WEATHER_APP.id, accountEmail);
|
|
448
|
+
|
|
449
|
+
const sessionId = crypto.randomBytes(18).toString('hex');
|
|
450
|
+
this.sessions.set(sessionId, {
|
|
451
|
+
id: sessionId,
|
|
452
|
+
userId,
|
|
453
|
+
agentId,
|
|
454
|
+
appKey: WEATHER_APP.id,
|
|
455
|
+
status: 'connected',
|
|
456
|
+
connectionId: connection?.id || null,
|
|
457
|
+
accountEmail,
|
|
458
|
+
createdAt: Date.now(),
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
return {
|
|
462
|
+
provider: this.key,
|
|
463
|
+
appId: WEATHER_APP.id,
|
|
464
|
+
status: 'interactive_connect',
|
|
465
|
+
sessionId,
|
|
466
|
+
url: `/api/integrations/${this.key}/connect/${sessionId}`,
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
getConnectionSession(userId, providerKey, sessionId, agentId = null) {
|
|
471
|
+
if (providerKey !== this.key) {
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
const session = this.sessions.get(String(sessionId || '').trim());
|
|
475
|
+
if (!session) {
|
|
476
|
+
return null;
|
|
477
|
+
}
|
|
478
|
+
if (session.userId !== userId || String(session.agentId || '') !== String(agentId || '')) {
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
return {
|
|
482
|
+
id: session.id,
|
|
483
|
+
provider: this.key,
|
|
484
|
+
appId: session.appKey,
|
|
485
|
+
status: session.status,
|
|
486
|
+
connectionId: session.connectionId,
|
|
487
|
+
accountEmail: session.accountEmail,
|
|
488
|
+
error: null,
|
|
489
|
+
qr: null,
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
async disconnect(sessionId = null) {
|
|
494
|
+
if (sessionId) {
|
|
495
|
+
this.sessions.delete(String(sessionId));
|
|
496
|
+
}
|
|
497
|
+
return null;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
shutdown() {
|
|
501
|
+
if (this.#pruneTimer) {
|
|
502
|
+
clearInterval(this.#pruneTimer);
|
|
503
|
+
this.#pruneTimer = null;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
async executeTool(toolName, args, connection) {
|
|
508
|
+
switch (toolName) {
|
|
509
|
+
case 'weather_search_locations': {
|
|
510
|
+
const query = String(args.query || '').trim();
|
|
511
|
+
if (!query) {
|
|
512
|
+
throw new Error('query is required.');
|
|
513
|
+
}
|
|
514
|
+
const limit = Math.max(1, Math.min(Number(args.limit) || 5, 10));
|
|
515
|
+
const results = await geocodeLocation(query, limit);
|
|
516
|
+
return {
|
|
517
|
+
result: {
|
|
518
|
+
query,
|
|
519
|
+
count: results.length,
|
|
520
|
+
results,
|
|
521
|
+
},
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
case 'weather_get_current': {
|
|
525
|
+
const location = await resolveLocation(args, connection);
|
|
526
|
+
const forecast = await fetchForecastForLocation(location, 1);
|
|
527
|
+
return {
|
|
528
|
+
result: {
|
|
529
|
+
location: forecast.location,
|
|
530
|
+
current: forecast.current,
|
|
531
|
+
},
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
case 'weather_get_forecast': {
|
|
535
|
+
const location = await resolveLocation(args, connection);
|
|
536
|
+
const forecastHours = Math.max(1, Math.min(Number(args.forecast_hours) || 24, 72));
|
|
537
|
+
const forecast = await fetchForecastForLocation(location, forecastHours);
|
|
538
|
+
return {
|
|
539
|
+
result: {
|
|
540
|
+
location: forecast.location,
|
|
541
|
+
current: forecast.current,
|
|
542
|
+
hourly: forecast.hourly,
|
|
543
|
+
horizonHours: forecastHours,
|
|
544
|
+
},
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
default:
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function createWeatherProvider() {
|
|
554
|
+
return new WeatherProvider();
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
module.exports = {
|
|
558
|
+
createWeatherProvider,
|
|
559
|
+
};
|
|
@@ -545,7 +545,7 @@ class WhatsAppPersonalProvider extends EventEmitter {
|
|
|
545
545
|
chatCount: client.chats.size,
|
|
546
546
|
cachedMessageChats: client.messages.size,
|
|
547
547
|
syncNote:
|
|
548
|
-
'Read tools only
|
|
548
|
+
'This account is linked and connected. Read tools expose only chats and messages currently available in this session cache.',
|
|
549
549
|
},
|
|
550
550
|
};
|
|
551
551
|
case 'whatsapp_personal_list_chats': {
|
|
@@ -557,10 +557,14 @@ class WhatsAppPersonalProvider extends EventEmitter {
|
|
|
557
557
|
.slice(0, limit);
|
|
558
558
|
return {
|
|
559
559
|
result: {
|
|
560
|
+
account: client.accountEmail || connection.account_email || null,
|
|
561
|
+
connected: client.status === 'connected',
|
|
560
562
|
chats,
|
|
561
563
|
count: chats.length,
|
|
562
564
|
syncNote:
|
|
563
|
-
|
|
565
|
+
chats.length > 0
|
|
566
|
+
? 'Chats shown here come from the current personal WhatsApp cache.'
|
|
567
|
+
: 'The personal WhatsApp account is connected, but no chats are cached yet. The cache populates as history/events are synchronized.',
|
|
564
568
|
},
|
|
565
569
|
};
|
|
566
570
|
}
|