@elizaos/app-core 2.0.0-alpha.85 → 2.0.0-beta.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/account-pool.d.ts +6 -0
- package/account-pool.d.ts.map +1 -0
- package/account-pool.js +5 -0
- package/api/__tests__/sandbox-test-helpers.d.ts +10 -0
- package/api/__tests__/sandbox-test-helpers.d.ts.map +1 -0
- package/api/__tests__/sandbox-test-helpers.js +15 -0
- package/api/auth/audit.d.ts +52 -0
- package/api/auth/audit.d.ts.map +1 -0
- package/api/auth/audit.js +126 -0
- package/api/auth/auth-context.d.ts +40 -0
- package/api/auth/auth-context.d.ts.map +1 -0
- package/api/auth/auth-context.js +68 -0
- package/api/auth/bootstrap-token.d.ts +50 -0
- package/api/auth/bootstrap-token.d.ts.map +1 -0
- package/api/auth/bootstrap-token.js +157 -0
- package/api/auth/index.d.ts +14 -0
- package/api/auth/index.d.ts.map +1 -0
- package/api/auth/index.js +13 -0
- package/api/auth/passwords.d.ts +65 -0
- package/api/auth/passwords.d.ts.map +1 -0
- package/api/auth/passwords.js +87 -0
- package/api/auth/sensitive-rate-limit.d.ts +56 -0
- package/api/auth/sensitive-rate-limit.d.ts.map +1 -0
- package/api/auth/sensitive-rate-limit.js +95 -0
- package/api/auth/sessions.d.ts +152 -0
- package/api/auth/sessions.d.ts.map +1 -0
- package/api/auth/sessions.js +298 -0
- package/api/auth/tokens.d.ts +3 -0
- package/api/auth/tokens.d.ts.map +1 -0
- package/api/auth/tokens.js +13 -0
- package/api/auth-bootstrap-routes.d.ts +32 -0
- package/api/auth-bootstrap-routes.d.ts.map +1 -0
- package/api/auth-bootstrap-routes.js +179 -0
- package/api/auth-pairing-compat-routes.d.ts +17 -0
- package/api/auth-pairing-compat-routes.d.ts.map +1 -0
- package/api/auth-pairing-compat-routes.js +301 -0
- package/api/auth-session-routes.d.ts +31 -0
- package/api/auth-session-routes.d.ts.map +1 -0
- package/api/auth-session-routes.js +560 -0
- package/api/auth.d.ts +153 -0
- package/api/auth.d.ts.map +1 -0
- package/api/auth.js +290 -0
- package/api/automation-node-contributors.d.ts +14 -0
- package/api/automation-node-contributors.d.ts.map +1 -0
- package/api/automation-node-contributors.js +14 -0
- package/api/automations-compat-routes.d.ts +18 -0
- package/api/automations-compat-routes.d.ts.map +1 -0
- package/api/automations-compat-routes.js +274 -0
- package/api/catalog-routes.d.ts +4 -0
- package/api/catalog-routes.d.ts.map +1 -0
- package/api/catalog-routes.js +61 -0
- package/api/compat-route-shared.d.ts +29 -0
- package/api/compat-route-shared.d.ts.map +1 -0
- package/api/compat-route-shared.js +298 -0
- package/api/credential-resolver.d.ts +31 -0
- package/api/credential-resolver.d.ts.map +1 -0
- package/api/credential-resolver.js +199 -0
- package/api/database-rows-compat-routes.d.ts +4 -0
- package/api/database-rows-compat-routes.d.ts.map +1 -0
- package/api/database-rows-compat-routes.js +100 -0
- package/api/dev-compat-routes.d.ts +11 -0
- package/api/dev-compat-routes.d.ts.map +1 -0
- package/api/dev-compat-routes.js +144 -0
- package/api/dev-console-log.d.ts +21 -0
- package/api/dev-console-log.d.ts.map +1 -0
- package/api/dev-console-log.js +65 -0
- package/api/dev-stack.d.ts +49 -0
- package/api/dev-stack.d.ts.map +1 -0
- package/api/dev-stack.js +60 -0
- package/api/local-inference-compat-routes.d.ts +16 -0
- package/api/local-inference-compat-routes.d.ts.map +1 -0
- package/api/local-inference-compat-routes.js +617 -0
- package/api/onboarding-compat-routes.d.ts +4 -0
- package/api/onboarding-compat-routes.d.ts.map +1 -0
- package/api/onboarding-compat-routes.js +207 -0
- package/api/plugins-compat-routes.d.ts +103 -0
- package/api/plugins-compat-routes.d.ts.map +1 -0
- package/api/plugins-compat-routes.js +1181 -0
- package/api/response.d.ts +4 -0
- package/api/response.d.ts.map +1 -0
- package/api/response.js +28 -0
- package/api/runtime-mode-routes.d.ts +13 -0
- package/api/runtime-mode-routes.d.ts.map +1 -0
- package/api/runtime-mode-routes.js +32 -0
- package/api/secrets-inventory-routes.d.ts +39 -0
- package/api/secrets-inventory-routes.d.ts.map +1 -0
- package/api/secrets-inventory-routes.js +487 -0
- package/api/secrets-manager-routes.d.ts +9 -0
- package/api/secrets-manager-routes.d.ts.map +1 -0
- package/api/secrets-manager-routes.js +476 -0
- package/api/sensitive-request-routes.d.ts +20 -0
- package/api/sensitive-request-routes.d.ts.map +1 -0
- package/api/sensitive-request-routes.js +489 -0
- package/api/sensitive-request-store.d.ts +39 -0
- package/api/sensitive-request-store.d.ts.map +1 -0
- package/api/sensitive-request-store.js +204 -0
- package/api/server-config-filter.d.ts +14 -0
- package/api/server-config-filter.d.ts.map +1 -0
- package/api/server-config-filter.js +77 -0
- package/api/server-cors.d.ts +30 -0
- package/api/server-cors.d.ts.map +1 -0
- package/api/server-cors.js +128 -0
- package/api/server-html.d.ts +4 -0
- package/api/server-html.d.ts.map +1 -0
- package/api/server-html.js +5 -0
- package/api/server-onboarding-compat.d.ts +31 -0
- package/api/server-onboarding-compat.d.ts.map +1 -0
- package/api/server-onboarding-compat.js +283 -0
- package/api/server-security.d.ts +11 -0
- package/api/server-security.d.ts.map +1 -0
- package/api/server-security.js +29 -0
- package/api/server-startup.d.ts +5 -0
- package/api/server-startup.d.ts.map +1 -0
- package/api/server-startup.js +74 -0
- package/api/server-wallet-trade.d.ts +10 -0
- package/api/server-wallet-trade.d.ts.map +1 -0
- package/api/server-wallet-trade.js +240 -0
- package/api/server.d.ts +32 -0
- package/api/server.d.ts.map +1 -0
- package/api/server.js +768 -0
- package/api/workbench-compat-routes.d.ts +11 -0
- package/api/workbench-compat-routes.d.ts.map +1 -0
- package/api/workbench-compat-routes.js +325 -0
- package/benchmark/cua-routes.d.ts +10 -0
- package/benchmark/cua-routes.d.ts.map +1 -0
- package/benchmark/cua-routes.js +179 -0
- package/benchmark/lifeops-bench-handler.d.ts +94 -0
- package/benchmark/lifeops-bench-handler.d.ts.map +1 -0
- package/benchmark/lifeops-bench-handler.js +280 -0
- package/benchmark/lifeops-fake-backend.d.ts +227 -0
- package/benchmark/lifeops-fake-backend.d.ts.map +1 -0
- package/benchmark/lifeops-fake-backend.js +499 -0
- package/benchmark/mock-plugin-base.d.ts +9 -0
- package/benchmark/mock-plugin-base.d.ts.map +1 -0
- package/benchmark/mock-plugin-base.js +325 -0
- package/benchmark/mock-plugin.d.ts +3 -0
- package/benchmark/mock-plugin.d.ts.map +1 -0
- package/benchmark/mock-plugin.js +504 -0
- package/benchmark/params.d.ts +2 -0
- package/benchmark/params.d.ts.map +1 -0
- package/benchmark/params.js +18 -0
- package/benchmark/plugin.d.ts +42 -0
- package/benchmark/plugin.d.ts.map +1 -0
- package/benchmark/plugin.js +422 -0
- package/benchmark/replay-capture.d.ts +73 -0
- package/benchmark/replay-capture.d.ts.map +1 -0
- package/benchmark/replay-capture.js +223 -0
- package/benchmark/server-utils.d.ts +100 -0
- package/benchmark/server-utils.d.ts.map +1 -0
- package/benchmark/server-utils.js +289 -0
- package/benchmark/server.d.ts +2 -0
- package/benchmark/server.d.ts.map +1 -0
- package/benchmark/server.js +1176 -0
- package/browser.d.ts +13 -0
- package/browser.d.ts.map +1 -0
- package/browser.js +15 -0
- package/cli/argv.d.ts +17 -0
- package/cli/argv.d.ts.map +1 -0
- package/cli/argv.js +140 -0
- package/cli/banner.d.ts +11 -0
- package/cli/banner.d.ts.map +1 -0
- package/cli/banner.js +36 -0
- package/cli/cli-name.d.ts +5 -0
- package/cli/cli-name.d.ts.map +1 -0
- package/cli/cli-name.js +21 -0
- package/cli/cli-utils.d.ts +5 -0
- package/cli/cli-utils.d.ts.map +1 -0
- package/cli/cli-utils.js +13 -0
- package/cli/command-format.d.ts +2 -0
- package/cli/command-format.d.ts.map +1 -0
- package/cli/command-format.js +20 -0
- package/cli/doctor/checks.d.ts +96 -0
- package/cli/doctor/checks.d.ts.map +1 -0
- package/cli/doctor/checks.js +483 -0
- package/cli/git-commit.d.ts +5 -0
- package/cli/git-commit.d.ts.map +1 -0
- package/cli/git-commit.js +106 -0
- package/cli/parse-duration.d.ts +5 -0
- package/cli/parse-duration.d.ts.map +1 -0
- package/cli/parse-duration.js +27 -0
- package/cli/plugins-cli.d.ts +26 -0
- package/cli/plugins-cli.d.ts.map +1 -0
- package/cli/plugins-cli.js +892 -0
- package/cli/profile-utils.d.ts +3 -0
- package/cli/profile-utils.d.ts.map +1 -0
- package/cli/profile-utils.js +21 -0
- package/cli/profile.d.ts +15 -0
- package/cli/profile.d.ts.map +1 -0
- package/cli/profile.js +93 -0
- package/cli/program/build-program.d.ts +3 -0
- package/cli/program/build-program.d.ts.map +1 -0
- package/cli/program/build-program.js +12 -0
- package/cli/program/command-registry.d.ts +3 -0
- package/cli/program/command-registry.d.ts.map +1 -0
- package/cli/program/command-registry.js +24 -0
- package/cli/program/help.d.ts +3 -0
- package/cli/program/help.d.ts.map +1 -0
- package/cli/program/help.js +57 -0
- package/cli/program/preaction.d.ts +3 -0
- package/cli/program/preaction.d.ts.map +1 -0
- package/cli/program/preaction.js +40 -0
- package/cli/program/register.auth.d.ts +51 -0
- package/cli/program/register.auth.d.ts.map +1 -0
- package/cli/program/register.auth.js +203 -0
- package/cli/program/register.benchmark.d.ts +3 -0
- package/cli/program/register.benchmark.d.ts.map +1 -0
- package/cli/program/register.benchmark.js +12 -0
- package/cli/program/register.config.d.ts +3 -0
- package/cli/program/register.config.d.ts.map +1 -0
- package/cli/program/register.config.js +150 -0
- package/cli/program/register.configure.d.ts +3 -0
- package/cli/program/register.configure.d.ts.map +1 -0
- package/cli/program/register.configure.js +18 -0
- package/cli/program/register.dashboard.d.ts +3 -0
- package/cli/program/register.dashboard.d.ts.map +1 -0
- package/cli/program/register.dashboard.js +124 -0
- package/cli/program/register.db.d.ts +3 -0
- package/cli/program/register.db.d.ts.map +1 -0
- package/cli/program/register.db.js +45 -0
- package/cli/program/register.doctor.d.ts +3 -0
- package/cli/program/register.doctor.d.ts.map +1 -0
- package/cli/program/register.doctor.js +170 -0
- package/cli/program/register.models.d.ts +3 -0
- package/cli/program/register.models.d.ts.map +1 -0
- package/cli/program/register.models.js +32 -0
- package/cli/program/register.setup.d.ts +16 -0
- package/cli/program/register.setup.d.ts.map +1 -0
- package/cli/program/register.setup.js +333 -0
- package/cli/program/register.start.d.ts +3 -0
- package/cli/program/register.start.d.ts.map +1 -0
- package/cli/program/register.start.js +95 -0
- package/cli/program/register.subclis.d.ts +4 -0
- package/cli/program/register.subclis.d.ts.map +1 -0
- package/cli/program/register.subclis.js +87 -0
- package/cli/program/register.update.d.ts +12 -0
- package/cli/program/register.update.d.ts.map +1 -0
- package/cli/program/register.update.js +173 -0
- package/cli/program.d.ts +2 -0
- package/cli/program.d.ts.map +1 -0
- package/cli/program.js +1 -0
- package/cli/run-main.d.ts +2 -0
- package/cli/run-main.d.ts.map +1 -0
- package/cli/run-main.js +71 -0
- package/cli/version.d.ts +2 -0
- package/cli/version.d.ts.map +1 -0
- package/cli/version.js +2 -0
- package/connectors/capacitor-jsc.d.ts +66 -0
- package/connectors/capacitor-jsc.d.ts.map +1 -0
- package/connectors/capacitor-jsc.js +39 -0
- package/connectors/capacitor-quickjs.d.ts +64 -0
- package/connectors/capacitor-quickjs.d.ts.map +1 -0
- package/connectors/capacitor-quickjs.js +50 -0
- package/connectors/capacitor-sqlite.d.ts +41 -0
- package/connectors/capacitor-sqlite.d.ts.map +1 -0
- package/connectors/capacitor-sqlite.js +87 -0
- package/diagnostics/integration-observability.d.ts +40 -0
- package/diagnostics/integration-observability.d.ts.map +1 -0
- package/diagnostics/integration-observability.js +68 -0
- package/entry.d.ts +10 -0
- package/entry.d.ts.map +1 -0
- package/entry.js +66 -0
- package/index.d.ts +34 -4
- package/index.d.ts.map +1 -1
- package/index.js +42 -6
- package/package.json +81 -151
- package/packaging/PUBLISHING_GUIDE.md +707 -0
- package/packaging/debian/changelog +9 -0
- package/packaging/debian/control +26 -0
- package/packaging/debian/copyright +27 -0
- package/packaging/debian/elizaos-app.service +15 -0
- package/packaging/debian/install +4 -0
- package/packaging/debian/postinst +28 -0
- package/packaging/debian/prerm +14 -0
- package/packaging/debian/rules +44 -0
- package/packaging/debian/source/format +1 -0
- package/packaging/flatpak/README.md +150 -0
- package/packaging/flatpak/ai.elizaos.App.desktop +11 -0
- package/packaging/flatpak/ai.elizaos.App.metainfo.xml +81 -0
- package/packaging/flatpak/ai.elizaos.App.store.yml +142 -0
- package/packaging/flatpak/ai.elizaos.App.yml +142 -0
- package/packaging/flatpak/elizaos-app-wrapper.sh +5 -0
- package/packaging/flatpak/elizaos-app-wrapper.store.sh +16 -0
- package/packaging/flatpak/icons/128x128/ai.elizaos.App.png +0 -0
- package/packaging/flatpak/icons/256x256/ai.elizaos.App.png +0 -0
- package/packaging/flatpak/icons/512x512/ai.elizaos.App.png +0 -0
- package/packaging/homebrew/README.md +80 -0
- package/packaging/homebrew/elizaos-app.cask.rb +60 -0
- package/packaging/homebrew/elizaos-app.rb +49 -0
- package/packaging/inno/ElizaOSApp.iss +53 -0
- package/packaging/inno/build-inno.ps1 +231 -0
- package/packaging/msix/AppxManifest.store.xml +79 -0
- package/packaging/msix/AppxManifest.xml +53 -0
- package/packaging/msix/README.md +201 -0
- package/packaging/msix/assets/LargeTile.png +0 -0
- package/packaging/msix/assets/Square150x150Logo.png +0 -0
- package/packaging/msix/assets/Square44x44Logo.png +0 -0
- package/packaging/msix/assets/StoreLogo.png +0 -0
- package/packaging/msix/assets/Wide310x150Logo.png +0 -0
- package/packaging/msix/build-msix.ps1 +206 -0
- package/packaging/msix/generate-placeholder-assets.ps1 +49 -0
- package/packaging/msix/store/description.md +31 -0
- package/packaging/msix/store/listing.json +27 -0
- package/packaging/pypi/README.md +14 -0
- package/packaging/pypi/elizaos_app/__init__.py +7 -0
- package/packaging/pypi/elizaos_app/__main__.py +6 -0
- package/packaging/pypi/elizaos_app/cli.py +21 -0
- package/packaging/pypi/elizaos_app/loader.py +127 -0
- package/packaging/pypi/elizaos_app/py.typed +1 -0
- package/packaging/pypi/pyproject.toml +38 -0
- package/packaging/snap/snapcraft.yaml +560 -0
- package/packaging/test-packaging.sh +309 -0
- package/patches/@noble%2Fcurves@2.0.1.patch +33 -0
- package/patches/@pixiv%2Fthree-vrm@3.5.2.patch +26 -0
- package/patches/coding-agent-adapters@0.16.3.patch +44 -0
- package/patches/electrobun@1.16.0.patch +13 -0
- package/patches/llama-cpp-capacitor@0.1.5.patch +2387 -0
- package/patches/proper-lockfile@4.1.2.patch +14 -0
- package/patches/pty-manager@1.11.0.patch +194 -0
- package/permissions/types.d.ts +8 -0
- package/permissions/types.d.ts.map +1 -0
- package/permissions/types.js +7 -0
- package/platform/agent-browser-stub.d.ts +27 -0
- package/platform/agent-browser-stub.d.ts.map +1 -0
- package/platform/agent-browser-stub.js +16 -0
- package/platform/empty-node-module.d.ts +31 -0
- package/platform/empty-node-module.d.ts.map +1 -0
- package/platform/empty-node-module.js +22 -0
- package/platforms/android/Gemfile +6 -0
- package/platforms/android/README.md +79 -0
- package/platforms/android/app/build.gradle +124 -0
- package/platforms/android/app/capacitor.build.gradle +32 -0
- package/platforms/android/app/proguard-rules.pro +46 -0
- package/platforms/android/app/src/androidTest/java/ai/elizaos/app/ElizaOsInstrumentedTest.java +162 -0
- package/platforms/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java +26 -0
- package/platforms/android/app/src/main/AndroidManifest.xml +83 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/AgentPlugin.java +232 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAgentService.java +1514 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAssistActivity.java +21 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaBootReceiver.java +61 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaBrowserActivity.java +39 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaCalendarActivity.java +75 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaCameraActivity.java +54 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaClockActivity.java +70 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaContactsActivity.java +56 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaDialActivity.java +83 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaInCallService.java +168 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaMmsReceiver.java +70 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaNativeBridge.java +38 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaRespondViaMessageService.java +119 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsComposeActivity.java +50 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsReceiver.java +84 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/GatewayConnectionService.java +211 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/MainActivity.java +202 -0
- package/platforms/android/app/src/main/res/drawable/ic_launcher_background.xml +170 -0
- package/platforms/android/app/src/main/res/drawable/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
- package/platforms/android/app/src/main/res/layout/activity_main.xml +12 -0
- package/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/values/ic_launcher_background.xml +4 -0
- package/platforms/android/app/src/main/res/values/strings.xml +7 -0
- package/platforms/android/app/src/main/res/values/styles.xml +22 -0
- package/platforms/android/app/src/main/res/xml/file_paths.xml +5 -0
- package/platforms/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java +18 -0
- package/platforms/android/build.gradle +63 -0
- package/platforms/android/capacitor-cordova-android-plugins/build.gradle +53 -0
- package/platforms/android/capacitor-cordova-android-plugins/cordova.variables.gradle +3 -0
- package/platforms/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml +3 -0
- package/platforms/android/capacitor-cordova-android-plugins/src/main/java/.gitkeep +1 -0
- package/platforms/android/capacitor-cordova-android-plugins/src/main/res/.gitkeep +1 -0
- package/platforms/android/capacitor.settings.gradle +45 -0
- package/platforms/android/fastlane/Appfile +2 -0
- package/platforms/android/fastlane/Fastfile +59 -0
- package/platforms/android/fastlane/metadata/android/en-US/full_description.txt +24 -0
- package/platforms/android/fastlane/metadata/android/en-US/short_description.txt +1 -0
- package/platforms/android/fastlane/metadata/android/en-US/title.txt +1 -0
- package/platforms/android/fastlane/metadata/android/en-US/video.txt +0 -0
- package/platforms/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/platforms/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/platforms/android/gradle.properties +27 -0
- package/platforms/android/gradlew +251 -0
- package/platforms/android/gradlew.bat +94 -0
- package/platforms/android/settings.gradle +13 -0
- package/platforms/android/variables.gradle +17 -0
- package/platforms/electrobun/.generated/brand-config.json +8 -0
- package/platforms/electrobun/README.md +44 -0
- package/platforms/electrobun/assets/appIcon.ico +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_128x128.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_128x128@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_16x16.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_16x16@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_256x256.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_256x256@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_32x32.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_32x32@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_512x512.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_512x512@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.png +0 -0
- package/platforms/electrobun/assets/brand-config.json +8 -0
- package/platforms/electrobun/biome.json +11 -0
- package/platforms/electrobun/electrobun.config.ts +435 -0
- package/platforms/electrobun/entitlements/README.md +54 -0
- package/platforms/electrobun/entitlements/mas-child.entitlements +10 -0
- package/platforms/electrobun/entitlements/mas.entitlements +41 -0
- package/platforms/electrobun/native/macos/window-effects.mm +1030 -0
- package/platforms/electrobun/package.json +42 -0
- package/platforms/electrobun/scripts/bin/zip +2 -0
- package/platforms/electrobun/scripts/build-macos-effects.sh +31 -0
- package/platforms/electrobun/scripts/build-whisper-universal.sh +137 -0
- package/platforms/electrobun/scripts/build-whisper.sh +95 -0
- package/platforms/electrobun/scripts/ensure-whisper-model.sh +93 -0
- package/platforms/electrobun/scripts/hdiutil-wrapper.sh +33 -0
- package/platforms/electrobun/scripts/lib/app-dir.mjs +74 -0
- package/platforms/electrobun/scripts/lib/repo-root.mjs +77 -0
- package/platforms/electrobun/scripts/local-adhoc-sign-macos.ts +214 -0
- package/platforms/electrobun/scripts/macos-direct-launcher.c +84 -0
- package/platforms/electrobun/scripts/postwrap-diagnostics.ts +423 -0
- package/platforms/electrobun/scripts/postwrap-sign-runtime-macos.ts +352 -0
- package/platforms/electrobun/scripts/sign-windows.ps1 +121 -0
- package/platforms/electrobun/scripts/smoke-test-windows.ps1 +907 -0
- package/platforms/electrobun/scripts/smoke-test.sh +1186 -0
- package/platforms/electrobun/scripts/stage-macos-release-artifacts.sh +491 -0
- package/platforms/electrobun/scripts/sync-web-assets.mjs +48 -0
- package/platforms/electrobun/scripts/verify-rpc-handlers.ts +162 -0
- package/platforms/electrobun/scripts/verify-windows-installer-proof.ps1 +203 -0
- package/platforms/electrobun/scripts/xcrun-wrapper.sh +80 -0
- package/platforms/electrobun/scripts/zip-wrapper.sh +6 -0
- package/platforms/electrobun/src/__stubs__/bun-ffi.ts +51 -0
- package/platforms/electrobun/src/__stubs__/electrobun-bun.ts +20 -0
- package/platforms/electrobun/src/agent-ready-state.ts +35 -0
- package/platforms/electrobun/src/agent-reset-from-main.ts +87 -0
- package/platforms/electrobun/src/api-base.ts +169 -0
- package/platforms/electrobun/src/application-menu-action-registry.ts +21 -0
- package/platforms/electrobun/src/application-menu.ts +418 -0
- package/platforms/electrobun/src/background-notice.ts +65 -0
- package/platforms/electrobun/src/brand-config.ts +184 -0
- package/platforms/electrobun/src/bridge/browser-tabs-renderer-registry.ts +60 -0
- package/platforms/electrobun/src/bridge/electrobun-direct-rpc.ts +430 -0
- package/platforms/electrobun/src/bridge/electrobun-preload.ts +1 -0
- package/platforms/electrobun/src/bridge/electrobun-stub.ts +21 -0
- package/platforms/electrobun/src/browser-workspace-bridge-server.ts +284 -0
- package/platforms/electrobun/src/cloud-auth-window.ts +216 -0
- package/platforms/electrobun/src/cloud-disconnect-from-main.ts +118 -0
- package/platforms/electrobun/src/constants.ts +2 -0
- package/platforms/electrobun/src/desktop-http-request.test.ts +85 -0
- package/platforms/electrobun/src/desktop-http-request.ts +103 -0
- package/platforms/electrobun/src/desktop-test-bridge-server.ts +248 -0
- package/platforms/electrobun/src/devtools-layout.ts +63 -0
- package/platforms/electrobun/src/diagnostic-format.ts +65 -0
- package/platforms/electrobun/src/fatal-shutdown.test.ts +30 -0
- package/platforms/electrobun/src/fatal-shutdown.ts +10 -0
- package/platforms/electrobun/src/floating-chat-window.ts +239 -0
- package/platforms/electrobun/src/index.ts +2510 -0
- package/platforms/electrobun/src/libMacWindowEffects.dylib +0 -0
- package/platforms/electrobun/src/lifecycle/api-base-owner.ts +119 -0
- package/platforms/electrobun/src/lifecycle/desktop-session-prime.ts +77 -0
- package/platforms/electrobun/src/logger.ts +23 -0
- package/platforms/electrobun/src/main-window-runtime.ts +117 -0
- package/platforms/electrobun/src/main-window-session.ts +88 -0
- package/platforms/electrobun/src/menu-reset-from-main.ts +211 -0
- package/platforms/electrobun/src/native/agent.ts +1963 -0
- package/platforms/electrobun/src/native/auth-bridge.ts +525 -0
- package/platforms/electrobun/src/native/browser-workspace.ts +574 -0
- package/platforms/electrobun/src/native/camera.ts +68 -0
- package/platforms/electrobun/src/native/canvas.ts +504 -0
- package/platforms/electrobun/src/native/credentials.ts +765 -0
- package/platforms/electrobun/src/native/desktop.ts +2317 -0
- package/platforms/electrobun/src/native/editor-bridge.ts +292 -0
- package/platforms/electrobun/src/native/file-watcher.ts +220 -0
- package/platforms/electrobun/src/native/gateway.ts +218 -0
- package/platforms/electrobun/src/native/gpu-window.ts +301 -0
- package/platforms/electrobun/src/native/index.ts +105 -0
- package/platforms/electrobun/src/native/location.ts +110 -0
- package/platforms/electrobun/src/native/loopback-port.ts +81 -0
- package/platforms/electrobun/src/native/mac-window-effects.ts +178 -0
- package/platforms/electrobun/src/native/music-player.ts +61 -0
- package/platforms/electrobun/src/native/permissions-shared.ts +171 -0
- package/platforms/electrobun/src/native/permissions.ts +242 -0
- package/platforms/electrobun/src/native/power-state.ts +195 -0
- package/platforms/electrobun/src/native/screencapture.ts +654 -0
- package/platforms/electrobun/src/native/steward.ts +343 -0
- package/platforms/electrobun/src/native/swabble.ts +349 -0
- package/platforms/electrobun/src/native/talkmode.ts +441 -0
- package/platforms/electrobun/src/native/webgpu-browser-support.ts +220 -0
- package/platforms/electrobun/src/native/whisper.ts +280 -0
- package/platforms/electrobun/src/preload-validation.ts +65 -0
- package/platforms/electrobun/src/preload.js +1 -0
- package/platforms/electrobun/src/print-electrobun-dev-settings-banner.ts +140 -0
- package/platforms/electrobun/src/renderer-static.ts +77 -0
- package/platforms/electrobun/src/rpc-handlers.ts +1079 -0
- package/platforms/electrobun/src/rpc-schema.ts +1870 -0
- package/platforms/electrobun/src/runtime-layout.ts +150 -0
- package/platforms/electrobun/src/runtime-permissions.ts +131 -0
- package/platforms/electrobun/src/screenshot-dev-server.ts +125 -0
- package/platforms/electrobun/src/startup-trace.ts +351 -0
- package/platforms/electrobun/src/surface-windows.ts +475 -0
- package/platforms/electrobun/src/types/web-speech.d.ts +52 -0
- package/platforms/electrobun/src/types.ts +18 -0
- package/platforms/electrobun/src/windows-cef-profile.ts +124 -0
- package/platforms/electrobun/tsconfig.json +75 -0
- package/platforms/electrobun/vitest.electrobun.config.ts +54 -0
- package/platforms/ios/App/App/App.entitlements +18 -0
- package/platforms/ios/App/App/AppDelegate.swift +93 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ios-marketing-1024.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-20x20@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-20x20@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-29x29@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-29x29@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-40x40@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-40x40@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-76x76@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-76x76@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-83_5x83_5@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-20x20@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-20x20@3x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-29x29@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-29x29@3x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-40x40@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-40x40@3x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-60x60@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-60x60@3x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +116 -0
- package/platforms/ios/App/App/Assets.xcassets/Contents.json +6 -0
- package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +23 -0
- package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
- package/platforms/ios/App/App/Base.lproj/LaunchScreen.storyboard +32 -0
- package/platforms/ios/App/App/Base.lproj/Main.storyboard +19 -0
- package/platforms/ios/App/App/ElizaIntentPlugin.swift +185 -0
- package/platforms/ios/App/App/Info.plist +123 -0
- package/platforms/ios/App/App/PrivacyInfo.xcprivacy +55 -0
- package/platforms/ios/App/App/SceneDelegate.swift +77 -0
- package/platforms/ios/App/App/WebsiteBlockerContentExtension/ActionRequestHandler.swift +142 -0
- package/platforms/ios/App/App/WebsiteBlockerContentExtension/Info.plist +29 -0
- package/platforms/ios/App/App/WebsiteBlockerContentExtension/PrivacyInfo.xcprivacy +23 -0
- package/platforms/ios/App/App/WebsiteBlockerContentExtension/WebsiteBlockerContentExtension.entitlements +10 -0
- package/platforms/ios/App/App.xcodeproj/project.pbxproj +596 -0
- package/platforms/ios/App/App.xcworkspace/contents.xcworkspacedata +10 -0
- package/platforms/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/platforms/ios/App/ExportOptions.plist +18 -0
- package/platforms/ios/App/Podfile +51 -0
- package/platforms/ios/App/Podfile.lock +131 -0
- package/platforms/ios/Gemfile +6 -0
- package/platforms/ios/fastlane/Appfile +4 -0
- package/platforms/ios/fastlane/Fastfile +94 -0
- package/platforms/ios/fastlane/Matchfile +12 -0
- package/platforms/ios/fastlane/metadata/en-US/description.txt +22 -0
- package/platforms/ios/fastlane/metadata/en-US/keywords.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/marketing_url.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/name.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/privacy_url.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/promotional_text.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/subtitle.txt +1 -0
- package/platforms/ios/fastlane/metadata/en-US/support_url.txt +1 -0
- package/register-runtime-hooks.d.ts +2 -0
- package/register-runtime-hooks.d.ts.map +1 -0
- package/register-runtime-hooks.js +13 -0
- package/registry/generate-apps.d.ts +2 -0
- package/registry/generate-apps.d.ts.map +1 -0
- package/registry/generate-apps.js +338 -0
- package/registry/generate.d.ts +2 -0
- package/registry/generate.d.ts.map +1 -0
- package/registry/generate.js +506 -0
- package/registry/index.d.ts +6 -0
- package/registry/index.d.ts.map +1 -0
- package/registry/index.js +68 -0
- package/registry/loader.d.ts +27 -0
- package/registry/loader.d.ts.map +1 -0
- package/registry/loader.js +111 -0
- package/registry/schema.d.ts +989 -0
- package/registry/schema.d.ts.map +1 -0
- package/registry/schema.js +264 -0
- package/runtime/api-dev-settings-banner.d.ts +7 -0
- package/runtime/api-dev-settings-banner.d.ts.map +1 -0
- package/runtime/api-dev-settings-banner.js +104 -0
- package/runtime/app-route-plugin-registry.d.ts +3 -0
- package/runtime/app-route-plugin-registry.d.ts.map +1 -0
- package/runtime/app-route-plugin-registry.js +1 -0
- package/runtime/build-character-from-config.d.ts +3 -0
- package/runtime/build-character-from-config.d.ts.map +1 -0
- package/runtime/build-character-from-config.js +59 -0
- package/runtime/build-variant.d.ts +8 -0
- package/runtime/build-variant.d.ts.map +1 -0
- package/runtime/build-variant.js +7 -0
- package/runtime/channel-plugin-map.d.ts +6 -0
- package/runtime/channel-plugin-map.d.ts.map +1 -0
- package/runtime/channel-plugin-map.js +38 -0
- package/runtime/dev-server.d.ts +2 -0
- package/runtime/dev-server.d.ts.map +1 -0
- package/runtime/dev-server.js +383 -0
- package/runtime/dev-settings-figlet-heading.d.ts +22 -0
- package/runtime/dev-settings-figlet-heading.d.ts.map +1 -0
- package/runtime/dev-settings-figlet-heading.js +55 -0
- package/runtime/eliza.d.ts +21 -0
- package/runtime/eliza.d.ts.map +1 -0
- package/runtime/eliza.js +863 -0
- package/runtime/embedding-manager-support.d.ts +77 -0
- package/runtime/embedding-manager-support.d.ts.map +1 -0
- package/runtime/embedding-manager-support.js +309 -0
- package/runtime/embedding-presets.d.ts +5 -0
- package/runtime/embedding-presets.d.ts.map +1 -0
- package/runtime/embedding-presets.js +47 -0
- package/runtime/embedding-warmup-policy.d.ts +13 -0
- package/runtime/embedding-warmup-policy.d.ts.map +1 -0
- package/runtime/embedding-warmup-policy.js +33 -0
- package/runtime/ensure-local-inference-handler.d.ts +25 -0
- package/runtime/ensure-local-inference-handler.d.ts.map +1 -0
- package/runtime/ensure-local-inference-handler.js +389 -0
- package/runtime/ensure-text-to-speech-handler.d.ts +18 -0
- package/runtime/ensure-text-to-speech-handler.d.ts.map +1 -0
- package/runtime/ensure-text-to-speech-handler.js +50 -0
- package/runtime/error-handlers.d.ts +12 -0
- package/runtime/error-handlers.d.ts.map +1 -0
- package/runtime/error-handlers.js +49 -0
- package/runtime/mobile-local-inference-gate.d.ts +21 -0
- package/runtime/mobile-local-inference-gate.d.ts.map +1 -0
- package/runtime/mobile-local-inference-gate.js +24 -0
- package/runtime/mobile-safe-runtime.d.ts +123 -0
- package/runtime/mobile-safe-runtime.d.ts.map +1 -0
- package/runtime/mobile-safe-runtime.js +290 -0
- package/runtime/mode/remote-forwarder.d.ts +35 -0
- package/runtime/mode/remote-forwarder.d.ts.map +1 -0
- package/runtime/mode/remote-forwarder.js +119 -0
- package/runtime/mode/route-mode-guard.d.ts +21 -0
- package/runtime/mode/route-mode-guard.d.ts.map +1 -0
- package/runtime/mode/route-mode-guard.js +30 -0
- package/runtime/mode/route-mode-matrix.d.ts +64 -0
- package/runtime/mode/route-mode-matrix.d.ts.map +1 -0
- package/runtime/mode/route-mode-matrix.js +125 -0
- package/runtime/mode/runtime-mode.d.ts +72 -0
- package/runtime/mode/runtime-mode.d.ts.map +1 -0
- package/runtime/mode/runtime-mode.js +167 -0
- package/runtime/runtime-bootstrap-policy.d.ts +17 -0
- package/runtime/runtime-bootstrap-policy.d.ts.map +1 -0
- package/runtime/runtime-bootstrap-policy.js +37 -0
- package/runtime/sandbox-policy.d.ts +8 -0
- package/runtime/sandbox-policy.d.ts.map +1 -0
- package/runtime/sandbox-policy.js +7 -0
- package/runtime/startup-overlay.d.ts +14 -0
- package/runtime/startup-overlay.d.ts.map +1 -0
- package/runtime/startup-overlay.js +55 -0
- package/runtime/telegram-standalone-handler.d.ts +34 -0
- package/runtime/telegram-standalone-handler.d.ts.map +1 -0
- package/runtime/telegram-standalone-handler.js +195 -0
- package/runtime/telegram-standalone-policy.d.ts +2 -0
- package/runtime/telegram-standalone-policy.d.ts.map +1 -0
- package/runtime/telegram-standalone-policy.js +14 -0
- package/scripts/README.md +27 -0
- package/scripts/align-electrobun-version.mjs +37 -0
- package/scripts/aosp/README.md +66 -0
- package/scripts/aosp/avd-test.mjs +403 -0
- package/scripts/aosp/boot-validate.mjs +536 -0
- package/scripts/aosp/build-aosp.mjs +448 -0
- package/scripts/aosp/build-bootanimation.mjs +178 -0
- package/scripts/aosp/capture-screens.mjs +325 -0
- package/scripts/aosp/compile-libllama.mjs +1333 -0
- package/scripts/aosp/compile-shim.mjs +328 -0
- package/scripts/aosp/e2e-validate.mjs +225 -0
- package/scripts/aosp/lib/load-variant-config.mjs +182 -0
- package/scripts/aosp/lint-init-rc.mjs +258 -0
- package/scripts/aosp/llama-cpp-patches/README.md +49 -0
- package/scripts/aosp/llama-cpp-patches/apply-patches.mjs +198 -0
- package/scripts/aosp/llama-cpp-patches/polarquant/0001-Q4_POLAR-register-GGML_TYPE_Q4_POLAR-45-and-block_q4.patch +108 -0
- package/scripts/aosp/llama-cpp-patches/polarquant/0002-Q4_POLAR-vendor-PolarQuant-ref-kernels-into-ggml-bas.patch +460 -0
- package/scripts/aosp/llama-cpp-patches/polarquant/0003-tests-cover-Q4_POLAR-fix-latent-buffer-overflow.patch +102 -0
- package/scripts/aosp/llama-cpp-patches/polarquant/0004-Q4_POLAR-gate-QJL-residual-on-runtime-flag-default-o.patch +97 -0
- package/scripts/aosp/llama-cpp-patches/qjl/0001-ggml-add-GGML_TYPE_QJL1_256-GGML_OP_ATTN_SCORE_QJL-e.patch +120 -0
- package/scripts/aosp/llama-cpp-patches/qjl/0002-ggml-register-QJL1_256-type-traits-ATTN_SCORE_QJL-op.patch +1392 -0
- package/scripts/aosp/llama-cpp-patches/qjl/0003-ggml-set-QJL1_256-blck_size-to-head_dim-128-not-sket.patch +56 -0
- package/scripts/aosp/llama-cpp-patches/qjl/0004-tests-add-test-qjl-cache-verifying-type-traits-score.patch +335 -0
- package/scripts/aosp/llama-cpp-patches/qjl/0005-ggml-flip-block_qjl1_256-to-signs-then-norm.patch +69 -0
- package/scripts/aosp/llama-shim/eliza_llama_shim.c +276 -0
- package/scripts/aosp/seccomp-shim/loader-wrap.c +141 -0
- package/scripts/aosp/seccomp-shim/sigsys-handler.c +338 -0
- package/scripts/aosp/sim.mjs +277 -0
- package/scripts/aosp/smoke-cuttlefish.mjs +673 -0
- package/scripts/aosp/stage-default-models.mjs +340 -0
- package/scripts/aosp/stage-models-dfm.mjs +384 -0
- package/scripts/aosp/sync-to-aosp.mjs +134 -0
- package/scripts/aosp/validate.mjs +1273 -0
- package/scripts/aosp/variant-config-schema.ts +10 -0
- package/scripts/audit-live-test-surface.mjs +590 -0
- package/scripts/audit-server-test-surface.mjs +163 -0
- package/scripts/benchmark-preflight.mjs +170 -0
- package/scripts/bin/.gitkeep +0 -0
- package/scripts/build-bundled-agent-skills-artifact.mjs +58 -0
- package/scripts/build-bundled-orchestrator-artifact.mjs +66 -0
- package/scripts/build-capacitor-app.mjs +122 -0
- package/scripts/build-electrobun-preload.mjs +117 -0
- package/scripts/build-flatpak.mjs +125 -0
- package/scripts/build-image.sh +461 -0
- package/scripts/build-llama-cpp-dflash.mjs +1866 -0
- package/scripts/build-native-plugins.mjs +153 -0
- package/scripts/build-patched-electrobun-cli.mjs +424 -0
- package/scripts/build-win.mjs +82 -0
- package/scripts/bump-elizaos.sh +438 -0
- package/scripts/check-i18n.mjs +328 -0
- package/scripts/check-secret-hygiene.mjs +344 -0
- package/scripts/check-upstream-drift.mjs +102 -0
- package/scripts/clean-repo.mjs +187 -0
- package/scripts/codesign-mas.mjs +297 -0
- package/scripts/container-entrypoint.mjs +101 -0
- package/scripts/coordinator-cross-platform-review.mjs +192 -0
- package/scripts/copy-package-assets.mjs +31 -0
- package/scripts/copy-runtime-node-modules.ts +1782 -0
- package/scripts/coverage-policy.d.mts +16 -0
- package/scripts/coverage-policy.mjs +38 -0
- package/scripts/css-coverage.mjs +241 -0
- package/scripts/deploy-image.sh +318 -0
- package/scripts/desktop-build.mjs +867 -0
- package/scripts/desktop-stack-status.mjs +80 -0
- package/scripts/dev-platform.mjs +975 -0
- package/scripts/dev-ui.mjs +1178 -0
- package/scripts/dev-win.mjs +25 -0
- package/scripts/disable-local-eliza-workspace.mjs +420 -0
- package/scripts/docker-ci-smoke.sh +500 -0
- package/scripts/docker-entrypoint.sh +11 -0
- package/scripts/docker-runtime-review.mjs +230 -0
- package/scripts/docs-list.js +206 -0
- package/scripts/ensure-avatars.mjs +335 -0
- package/scripts/ensure-bundled-workspaces.mjs +143 -0
- package/scripts/ensure-capacitor-platform.mjs +58 -0
- package/scripts/ensure-electrobun-core.mjs +318 -0
- package/scripts/ensure-generated-core-proto-js.mjs +125 -0
- package/scripts/ensure-shared-i18n-data.mjs +67 -0
- package/scripts/ensure-skills.mjs +177 -0
- package/scripts/ensure-type-package-aliases.mjs +246 -0
- package/scripts/ensure-vision-deps.mjs +196 -0
- package/scripts/entry.ts +11 -0
- package/scripts/find-collisions.mjs +765 -0
- package/scripts/find-duplicate-components.mjs +203 -0
- package/scripts/fix-workspace-deps.mjs +328 -0
- package/scripts/generate-onboarding-voicelines.mjs +194 -0
- package/scripts/generate-plugin-index.js +1055 -0
- package/scripts/generate-static-asset-manifest.mjs +15 -0
- package/scripts/generated/static-asset-manifest.json +4 -0
- package/scripts/i18n-dynamic-keys.json +128 -0
- package/scripts/init-submodules.mjs +425 -0
- package/scripts/ios-xcframework/README.md +233 -0
- package/scripts/ios-xcframework/build-xcframework.mjs +487 -0
- package/scripts/kernel-patches/metal-kernels.mjs +656 -0
- package/scripts/kernel-patches/vulkan-dispatch-patches/01-vulkan-shaders-gen.patch +41 -0
- package/scripts/kernel-patches/vulkan-dispatch-patches/02-ggml-vulkan-pipelines.patch +86 -0
- package/scripts/kernel-patches/vulkan-kernels.mjs +281 -0
- package/scripts/lib/allocate-loopback-port.mjs +58 -0
- package/scripts/lib/api-supervisor.mjs +115 -0
- package/scripts/lib/app-dir.mjs +74 -0
- package/scripts/lib/asset-cdn.mjs +118 -0
- package/scripts/lib/bun-version-guard.mjs +44 -0
- package/scripts/lib/capacitor-platform-templates.mjs +306 -0
- package/scripts/lib/capacitor-plugin-build-needed.mjs +79 -0
- package/scripts/lib/capacitor-plugin-names.mjs +35 -0
- package/scripts/lib/desktop-preflight.mjs +122 -0
- package/scripts/lib/desktop-stack-status.mjs +151 -0
- package/scripts/lib/dev-ui-onchain.mjs +22 -0
- package/scripts/lib/dev-ui-vision.mjs +15 -0
- package/scripts/lib/kill-process-tree.mjs +87 -0
- package/scripts/lib/kill-ui-listen-port.mjs +74 -0
- package/scripts/lib/node-path-env.mjs +11 -0
- package/scripts/lib/orchestrator-desktop-dev-banner.mjs +285 -0
- package/scripts/lib/patch-bun-exports.mjs +1446 -0
- package/scripts/lib/read-app-identity.mjs +54 -0
- package/scripts/lib/release-check-pack-dry-run.ts +34 -0
- package/scripts/lib/repo-root.mjs +77 -0
- package/scripts/lib/stage-android-agent.mjs +704 -0
- package/scripts/lib/static-asset-manifest.mjs +151 -0
- package/scripts/lib/sync-eliza-env-aliases.mjs +37 -0
- package/scripts/lib/vite-renderer-dist-stale.mjs +141 -0
- package/scripts/lib/workspace-discovery.mjs +108 -0
- package/scripts/lifeops-prompt-benchmark.ts +206 -0
- package/scripts/link-browser-server.mjs +157 -0
- package/scripts/link-docker-local-app-packages.mjs +345 -0
- package/scripts/link-external-plugins.mjs +195 -0
- package/scripts/mobile-auth-simulator-smoke.mjs +373 -0
- package/scripts/normalize-parallax-capture.ts +97 -0
- package/scripts/omnivoice-fuse/Makefile +44 -0
- package/scripts/omnivoice-fuse/README.md +266 -0
- package/scripts/omnivoice-fuse/cmake-graft.mjs +180 -0
- package/scripts/omnivoice-fuse/ffi-stub.c +222 -0
- package/scripts/omnivoice-fuse/ffi.h +158 -0
- package/scripts/omnivoice-fuse/libelizainference_stub.dylib +0 -0
- package/scripts/omnivoice-fuse/prepare.mjs +263 -0
- package/scripts/omnivoice-fuse/verify-symbols.mjs +138 -0
- package/scripts/pack-upstreams.mjs +392 -0
- package/scripts/patch-deps.mjs +597 -0
- package/scripts/patch-workspace-plugins.mjs +148 -0
- package/scripts/playwright-ui-live-stack.ts +667 -0
- package/scripts/playwright-ui-smoke-api-stub.mjs +1838 -0
- package/scripts/plugin-index-local-additions.json +12 -0
- package/scripts/plugin-metadata-overrides.json +165 -0
- package/scripts/pre-review-local.mjs +599 -0
- package/scripts/prepare-ios-cocoapods.sh +30 -0
- package/scripts/prepare-package-dist.mjs +358 -0
- package/scripts/process-vrms.mjs +203 -0
- package/scripts/prune-cdn-local-assets.mjs +44 -0
- package/scripts/publish-local-plugins-next.mjs +122 -0
- package/scripts/release-check.ts +1402 -0
- package/scripts/relink-workspace-packages-to-dist.mjs +115 -0
- package/scripts/replace-workspace-versions.mjs +128 -0
- package/scripts/report-coverage-surfaces.mjs +121 -0
- package/scripts/restore-workspace-refs.mjs +128 -0
- package/scripts/rt.mjs +29 -0
- package/scripts/rt.sh +4 -0
- package/scripts/run-biome-check.mjs +191 -0
- package/scripts/run-coding-agent-e2e.mjs +46 -0
- package/scripts/run-desktop-playwright.mjs +35 -0
- package/scripts/run-local-plugin-live-smoke.mjs +185 -0
- package/scripts/run-mobile-build.mjs +3308 -0
- package/scripts/run-node-runtime.mjs +75 -0
- package/scripts/run-node-tsx.mjs +62 -0
- package/scripts/run-node.mjs +294 -0
- package/scripts/run-playwright.mjs +66 -0
- package/scripts/run-production-build.mjs +138 -0
- package/scripts/run-release-contract-suite.mjs +57 -0
- package/scripts/run-repo-setup.mjs +230 -0
- package/scripts/run-screenshotter.mjs +140 -0
- package/scripts/run-ui-smoke-playwright-suite.mjs +96 -0
- package/scripts/run-windows-smoke-launcher.ps1 +35 -0
- package/scripts/run-with-env.mjs +60 -0
- package/scripts/runtime-package-manifest.ts +107 -0
- package/scripts/sandbox-setup.sh +7 -0
- package/scripts/sanitize-npm-package-metadata.mjs +165 -0
- package/scripts/set-package-version.mjs +13 -0
- package/scripts/setup-upstreams.mjs +838 -0
- package/scripts/smoke-api-status.mjs +113 -0
- package/scripts/smoke-lifeops.mjs +305 -0
- package/scripts/startup-integration-script-drift.test.ts +94 -0
- package/scripts/sync-desktop-renderer.mjs +308 -0
- package/scripts/sync-dod-gap-issues-lib.mjs +214 -0
- package/scripts/sync-dod-gap-issues.mjs +218 -0
- package/scripts/type-audit.mjs +606 -0
- package/scripts/validate-cdn-assets.mjs +307 -0
- package/scripts/validate-regression-matrix.mjs +360 -0
- package/scripts/workspace-plugin-patches/plugin-anthropic-elizaos-core-api-compat.patch +34 -0
- package/scripts/workspace-prepare.mjs +192 -0
- package/scripts/worktree-env.sh +41 -0
- package/scripts/write-build-info.ts +69 -0
- package/scripts/write-homepage-release-data.mjs +393 -0
- package/security/agent-vault-id.d.ts +16 -0
- package/security/agent-vault-id.d.ts.map +1 -0
- package/security/agent-vault-id.js +32 -0
- package/security/cloud-secret-store.d.ts +34 -0
- package/security/cloud-secret-store.d.ts.map +1 -0
- package/security/cloud-secret-store.js +65 -0
- package/security/export-guard.d.ts +34 -0
- package/security/export-guard.d.ts.map +1 -0
- package/security/export-guard.js +127 -0
- package/security/hydrate-wallet-keys-from-platform-store.d.ts +13 -0
- package/security/hydrate-wallet-keys-from-platform-store.d.ts.map +1 -0
- package/security/hydrate-wallet-keys-from-platform-store.js +116 -0
- package/security/platform-secure-store-node.d.ts +13 -0
- package/security/platform-secure-store-node.d.ts.map +1 -0
- package/security/platform-secure-store-node.js +311 -0
- package/security/platform-secure-store.d.ts +47 -0
- package/security/platform-secure-store.d.ts.map +1 -0
- package/security/platform-secure-store.js +10 -0
- package/security/wallet-os-store-actions.d.ts +45 -0
- package/security/wallet-os-store-actions.d.ts.map +1 -0
- package/security/wallet-os-store-actions.js +125 -0
- package/services/account-pool.d.ts +134 -0
- package/services/account-pool.d.ts.map +1 -0
- package/services/account-pool.js +693 -0
- package/services/account-usage.d.ts +75 -0
- package/services/account-usage.d.ts.map +1 -0
- package/services/account-usage.js +179 -0
- package/services/auth-store.d.ts +179 -0
- package/services/auth-store.d.ts.map +1 -0
- package/services/auth-store.js +404 -0
- package/services/cloud-jwks-store.d.ts +62 -0
- package/services/cloud-jwks-store.d.ts.map +1 -0
- package/services/cloud-jwks-store.js +118 -0
- package/services/connector-target-catalog.d.ts +78 -0
- package/services/connector-target-catalog.d.ts.map +1 -0
- package/services/connector-target-catalog.js +64 -0
- package/services/discord-target-source.d.ts +53 -0
- package/services/discord-target-source.d.ts.map +1 -0
- package/services/discord-target-source.js +116 -0
- package/services/github-credentials.d.ts +95 -0
- package/services/github-credentials.d.ts.map +1 -0
- package/services/github-credentials.js +144 -0
- package/services/local-inference/__stress__/cache-stress-helpers.d.ts +76 -0
- package/services/local-inference/__stress__/cache-stress-helpers.d.ts.map +1 -0
- package/services/local-inference/__stress__/cache-stress-helpers.js +238 -0
- package/services/local-inference/active-model.d.ts +180 -0
- package/services/local-inference/active-model.d.ts.map +1 -0
- package/services/local-inference/active-model.js +362 -0
- package/services/local-inference/assignments.d.ts +58 -0
- package/services/local-inference/assignments.d.ts.map +1 -0
- package/services/local-inference/assignments.js +179 -0
- package/services/local-inference/backend.d.ts +200 -0
- package/services/local-inference/backend.d.ts.map +1 -0
- package/services/local-inference/backend.js +242 -0
- package/services/local-inference/bundled-models.d.ts +34 -0
- package/services/local-inference/bundled-models.d.ts.map +1 -0
- package/services/local-inference/bundled-models.js +104 -0
- package/services/local-inference/cache-bridge.d.ts +184 -0
- package/services/local-inference/cache-bridge.d.ts.map +1 -0
- package/services/local-inference/cache-bridge.js +333 -0
- package/services/local-inference/catalog.d.ts +57 -0
- package/services/local-inference/catalog.d.ts.map +1 -0
- package/services/local-inference/catalog.js +262 -0
- package/services/local-inference/conversation-registry.d.ts +122 -0
- package/services/local-inference/conversation-registry.d.ts.map +1 -0
- package/services/local-inference/conversation-registry.js +182 -0
- package/services/local-inference/device-bridge.d.ts +139 -0
- package/services/local-inference/device-bridge.d.ts.map +1 -0
- package/services/local-inference/device-bridge.js +774 -0
- package/services/local-inference/dflash-doctor.d.ts +27 -0
- package/services/local-inference/dflash-doctor.d.ts.map +1 -0
- package/services/local-inference/dflash-doctor.js +149 -0
- package/services/local-inference/dflash-server.d.ts +248 -0
- package/services/local-inference/dflash-server.d.ts.map +1 -0
- package/services/local-inference/dflash-server.js +1076 -0
- package/services/local-inference/downloader.d.ts +48 -0
- package/services/local-inference/downloader.d.ts.map +1 -0
- package/services/local-inference/downloader.js +688 -0
- package/services/local-inference/engine.d.ts +282 -0
- package/services/local-inference/engine.d.ts.map +1 -0
- package/services/local-inference/engine.js +743 -0
- package/services/local-inference/external-scanner.d.ts +17 -0
- package/services/local-inference/external-scanner.d.ts.map +1 -0
- package/services/local-inference/external-scanner.js +261 -0
- package/services/local-inference/handler-registry.d.ts +72 -0
- package/services/local-inference/handler-registry.d.ts.map +1 -0
- package/services/local-inference/handler-registry.js +159 -0
- package/services/local-inference/hardware.d.ts +26 -0
- package/services/local-inference/hardware.d.ts.map +1 -0
- package/services/local-inference/hardware.js +139 -0
- package/services/local-inference/hf-search.d.ts +19 -0
- package/services/local-inference/hf-search.d.ts.map +1 -0
- package/services/local-inference/hf-search.js +169 -0
- package/services/local-inference/index.d.ts +10 -0
- package/services/local-inference/index.d.ts.map +1 -0
- package/services/local-inference/index.js +7 -0
- package/services/local-inference/llama-server-metrics.d.ts +108 -0
- package/services/local-inference/llama-server-metrics.d.ts.map +1 -0
- package/services/local-inference/llama-server-metrics.js +175 -0
- package/services/local-inference/manifest/index.d.ts +4 -0
- package/services/local-inference/manifest/index.d.ts.map +1 -0
- package/services/local-inference/manifest/index.js +5 -0
- package/services/local-inference/manifest/schema.d.ts +419 -0
- package/services/local-inference/manifest/schema.d.ts.map +1 -0
- package/services/local-inference/manifest/schema.js +227 -0
- package/services/local-inference/manifest/types.d.ts +23 -0
- package/services/local-inference/manifest/types.d.ts.map +1 -0
- package/services/local-inference/manifest/types.js +5 -0
- package/services/local-inference/manifest/validator.d.ts +43 -0
- package/services/local-inference/manifest/validator.d.ts.map +1 -0
- package/services/local-inference/manifest/validator.js +180 -0
- package/services/local-inference/paths.d.ts +8 -0
- package/services/local-inference/paths.d.ts.map +1 -0
- package/services/local-inference/paths.js +7 -0
- package/services/local-inference/providers.d.ts +61 -0
- package/services/local-inference/providers.d.ts.map +1 -0
- package/services/local-inference/providers.js +334 -0
- package/services/local-inference/ram-budget.d.ts +57 -0
- package/services/local-inference/ram-budget.d.ts.map +1 -0
- package/services/local-inference/ram-budget.js +107 -0
- package/services/local-inference/readiness.d.ts +9 -0
- package/services/local-inference/readiness.d.ts.map +1 -0
- package/services/local-inference/readiness.js +153 -0
- package/services/local-inference/recommendation.d.ts +62 -0
- package/services/local-inference/recommendation.d.ts.map +1 -0
- package/services/local-inference/recommendation.js +309 -0
- package/services/local-inference/registry.d.ts +35 -0
- package/services/local-inference/registry.d.ts.map +1 -0
- package/services/local-inference/registry.js +117 -0
- package/services/local-inference/router-handler.d.ts +51 -0
- package/services/local-inference/router-handler.d.ts.map +1 -0
- package/services/local-inference/router-handler.js +165 -0
- package/services/local-inference/routing-policy.d.ts +55 -0
- package/services/local-inference/routing-policy.d.ts.map +1 -0
- package/services/local-inference/routing-policy.js +195 -0
- package/services/local-inference/routing-preferences.d.ts +8 -0
- package/services/local-inference/routing-preferences.d.ts.map +1 -0
- package/services/local-inference/routing-preferences.js +7 -0
- package/services/local-inference/service.d.ts +88 -0
- package/services/local-inference/service.d.ts.map +1 -0
- package/services/local-inference/service.js +210 -0
- package/services/local-inference/session-pool.d.ts +72 -0
- package/services/local-inference/session-pool.d.ts.map +1 -0
- package/services/local-inference/session-pool.js +125 -0
- package/services/local-inference/types.d.ts +309 -0
- package/services/local-inference/types.d.ts.map +1 -0
- package/services/local-inference/types.js +23 -0
- package/services/local-inference/verify.d.ts +8 -0
- package/services/local-inference/verify.d.ts.map +1 -0
- package/services/local-inference/verify.js +7 -0
- package/services/local-inference/voice/barge-in.d.ts +15 -0
- package/services/local-inference/voice/barge-in.d.ts.map +1 -0
- package/services/local-inference/voice/barge-in.js +20 -0
- package/services/local-inference/voice/engine-bridge.d.ts +256 -0
- package/services/local-inference/voice/engine-bridge.d.ts.map +1 -0
- package/services/local-inference/voice/engine-bridge.js +398 -0
- package/services/local-inference/voice/ffi-bindings.d.ts +114 -0
- package/services/local-inference/voice/ffi-bindings.d.ts.map +1 -0
- package/services/local-inference/voice/ffi-bindings.js +281 -0
- package/services/local-inference/voice/index.d.ts +51 -0
- package/services/local-inference/voice/index.d.ts.map +1 -0
- package/services/local-inference/voice/index.js +50 -0
- package/services/local-inference/voice/lifecycle.d.ts +135 -0
- package/services/local-inference/voice/lifecycle.d.ts.map +1 -0
- package/services/local-inference/voice/lifecycle.js +189 -0
- package/services/local-inference/voice/phoneme-tokenizer.d.ts +58 -0
- package/services/local-inference/voice/phoneme-tokenizer.d.ts.map +1 -0
- package/services/local-inference/voice/phoneme-tokenizer.js +53 -0
- package/services/local-inference/voice/phrase-cache.d.ts +24 -0
- package/services/local-inference/voice/phrase-cache.d.ts.map +1 -0
- package/services/local-inference/voice/phrase-cache.js +32 -0
- package/services/local-inference/voice/phrase-chunker.d.ts +20 -0
- package/services/local-inference/voice/phrase-chunker.d.ts.map +1 -0
- package/services/local-inference/voice/phrase-chunker.js +85 -0
- package/services/local-inference/voice/ring-buffer.d.ts +40 -0
- package/services/local-inference/voice/ring-buffer.d.ts.map +1 -0
- package/services/local-inference/voice/ring-buffer.js +85 -0
- package/services/local-inference/voice/rollback-queue.d.ts +24 -0
- package/services/local-inference/voice/rollback-queue.d.ts.map +1 -0
- package/services/local-inference/voice/rollback-queue.js +49 -0
- package/services/local-inference/voice/scheduler.d.ts +47 -0
- package/services/local-inference/voice/scheduler.d.ts.map +1 -0
- package/services/local-inference/voice/scheduler.js +123 -0
- package/services/local-inference/voice/shared-resources.d.ts +119 -0
- package/services/local-inference/voice/shared-resources.d.ts.map +1 -0
- package/services/local-inference/voice/shared-resources.js +83 -0
- package/services/local-inference/voice/speaker-preset-cache.d.ts +28 -0
- package/services/local-inference/voice/speaker-preset-cache.d.ts.map +1 -0
- package/services/local-inference/voice/speaker-preset-cache.js +44 -0
- package/services/local-inference/voice/types.d.ts +80 -0
- package/services/local-inference/voice/types.d.ts.map +1 -0
- package/services/local-inference/voice/voice-preset-format.d.ts +56 -0
- package/services/local-inference/voice/voice-preset-format.d.ts.map +1 -0
- package/services/local-inference/voice/voice-preset-format.js +184 -0
- package/services/persistence.d.ts +48 -0
- package/services/persistence.d.ts.map +1 -0
- package/services/persistence.js +128 -0
- package/services/plugin-installer.d.ts +22 -0
- package/services/plugin-installer.d.ts.map +1 -0
- package/services/plugin-installer.js +41 -0
- package/services/secrets-manager-installer.d.ts +140 -0
- package/services/secrets-manager-installer.d.ts.map +1 -0
- package/services/secrets-manager-installer.js +374 -0
- package/services/steward-credentials.d.ts +37 -0
- package/services/steward-credentials.d.ts.map +1 -0
- package/services/steward-credentials.js +93 -0
- package/services/steward-sidecar/health-check.d.ts +9 -0
- package/services/steward-sidecar/health-check.d.ts.map +1 -0
- package/services/steward-sidecar/health-check.js +34 -0
- package/services/steward-sidecar/helpers.d.ts +21 -0
- package/services/steward-sidecar/helpers.d.ts.map +1 -0
- package/services/steward-sidecar/helpers.js +71 -0
- package/services/steward-sidecar/process-management.d.ts +9 -0
- package/services/steward-sidecar/process-management.d.ts.map +1 -0
- package/services/steward-sidecar/process-management.js +53 -0
- package/services/steward-sidecar/types.d.ts +60 -0
- package/services/steward-sidecar/types.d.ts.map +1 -0
- package/services/steward-sidecar/types.js +17 -0
- package/services/steward-sidecar/wallet-setup.d.ts +9 -0
- package/services/steward-sidecar/wallet-setup.d.ts.map +1 -0
- package/services/steward-sidecar/wallet-setup.js +114 -0
- package/services/steward-sidecar.d.ts +70 -0
- package/services/steward-sidecar.d.ts.map +1 -0
- package/services/steward-sidecar.js +385 -0
- package/services/tool-call-cache/index.d.ts +13 -0
- package/services/tool-call-cache/index.d.ts.map +1 -0
- package/services/tool-call-cache/index.js +11 -0
- package/services/trigger-event-bridge.d.ts +52 -0
- package/services/trigger-event-bridge.d.ts.map +1 -0
- package/services/trigger-event-bridge.js +217 -0
- package/services/update-notifier.d.ts +6 -0
- package/services/update-notifier.d.ts.map +1 -0
- package/services/update-notifier.js +33 -0
- package/services/vault-bootstrap.d.ts +31 -0
- package/services/vault-bootstrap.d.ts.map +1 -0
- package/services/vault-bootstrap.js +209 -0
- package/services/vault-mirror.d.ts +44 -0
- package/services/vault-mirror.d.ts.map +1 -0
- package/services/vault-mirror.js +80 -0
- package/styles/electrobun-mac-window-drag.css +66 -0
- package/test/helpers/__tests__/live-agent-test.smoke.test.ts +105 -0
- package/test/helpers/action-assertions.ts +364 -0
- package/test/helpers/action-spy.ts +354 -0
- package/test/helpers/browser-launch.ts +103 -0
- package/test/helpers/browser-mocks.ts +275 -0
- package/test/helpers/conditional-tests.ts +42 -0
- package/test/helpers/conversation-harness.ts +334 -0
- package/test/helpers/http.ts +150 -0
- package/test/helpers/i18n.ts +5 -0
- package/test/helpers/isolated-config.ts +34 -0
- package/test/helpers/live-agent-test.ts +660 -0
- package/test/helpers/live-child-env.ts +72 -0
- package/test/helpers/live-provider.test.ts +124 -0
- package/test/helpers/live-provider.ts +362 -0
- package/test/helpers/live-runtime-server.ts +88 -0
- package/test/helpers/loopback.ts +33 -0
- package/test/helpers/pglite-runtime.ts +173 -0
- package/test/helpers/react-test.ts +40 -0
- package/test/helpers/real-connector.ts +250 -0
- package/test/helpers/real-runtime.ts +543 -0
- package/test/helpers/skip-without.ts +53 -0
- package/test/helpers/stochastic-test.ts +186 -0
- package/test/helpers/test-utils.ts +94 -0
- package/test/helpers/trajectory-assertions.ts +168 -0
- package/test/helpers/trajectory-harness.test.ts +101 -0
- package/test/helpers/trajectory-harness.ts +988 -0
- package/test/scripts/managed-test-command.mjs +632 -0
- package/test/scripts/task-agent-live-smoke.ts +1335 -0
- package/test/scripts/test-parallel.mjs +237 -0
- package/test/scripts/test-root-unit.mjs +169 -0
- package/test/scripts/test-runner.mjs +78 -0
- package/test/scripts/validate-all-features.sh +541 -0
- package/test-support/test-helpers.d.ts +111 -0
- package/test-support/test-helpers.d.ts.map +1 -0
- package/test-support/test-helpers.js +410 -0
- package/ui-compat.d.ts +3 -0
- package/ui-compat.d.ts.map +1 -0
- package/ui-compat.js +3 -0
- package/utils/eliza-root.d.ts +9 -0
- package/utils/eliza-root.d.ts.map +1 -0
- package/utils/eliza-root.js +101 -0
- package/utils/globals.d.ts +7 -0
- package/utils/globals.d.ts.map +1 -0
- package/utils/globals.js +47 -0
- package/App.d.ts +0 -5
- package/App.d.ts.map +0 -1
- package/App.js +0 -220
- package/LICENSE +0 -21
- package/actions/character.d.ts +0 -39
- package/actions/character.d.ts.map +0 -1
- package/actions/character.js +0 -247
- package/actions/chat-helpers.d.ts +0 -47
- package/actions/chat-helpers.d.ts.map +0 -1
- package/actions/chat-helpers.js +0 -79
- package/actions/cloud.d.ts +0 -17
- package/actions/cloud.d.ts.map +0 -1
- package/actions/cloud.js +0 -43
- package/actions/index.d.ts +0 -12
- package/actions/index.d.ts.map +0 -1
- package/actions/index.js +0 -11
- package/actions/lifecycle.d.ts +0 -43
- package/actions/lifecycle.d.ts.map +0 -1
- package/actions/lifecycle.js +0 -118
- package/actions/onboarding.d.ts +0 -13
- package/actions/onboarding.d.ts.map +0 -1
- package/actions/onboarding.js +0 -26
- package/actions/triggers.d.ts +0 -23
- package/actions/triggers.d.ts.map +0 -1
- package/actions/triggers.js +0 -148
- package/api/client.d.ts +0 -2742
- package/api/client.d.ts.map +0 -1
- package/api/client.js +0 -2520
- package/api/index.d.ts +0 -2
- package/api/index.d.ts.map +0 -1
- package/api/index.js +0 -1
- package/autonomy/index.d.ts +0 -48
- package/autonomy/index.d.ts.map +0 -1
- package/autonomy/index.js +0 -330
- package/bridge/capacitor-bridge.d.ts +0 -153
- package/bridge/capacitor-bridge.d.ts.map +0 -1
- package/bridge/capacitor-bridge.js +0 -193
- package/bridge/electrobun-rpc.d.ts +0 -28
- package/bridge/electrobun-rpc.d.ts.map +0 -1
- package/bridge/electrobun-rpc.js +0 -35
- package/bridge/electrobun-runtime.d.ts +0 -3
- package/bridge/electrobun-runtime.d.ts.map +0 -1
- package/bridge/electrobun-runtime.js +0 -17
- package/bridge/index.d.ts +0 -6
- package/bridge/index.d.ts.map +0 -1
- package/bridge/index.js +0 -5
- package/bridge/native-plugins.d.ts +0 -82
- package/bridge/native-plugins.d.ts.map +0 -1
- package/bridge/native-plugins.js +0 -39
- package/bridge/plugin-bridge.d.ts +0 -116
- package/bridge/plugin-bridge.d.ts.map +0 -1
- package/bridge/plugin-bridge.js +0 -203
- package/bridge/storage-bridge.d.ts +0 -39
- package/bridge/storage-bridge.d.ts.map +0 -1
- package/bridge/storage-bridge.js +0 -135
- package/chat/index.d.ts +0 -57
- package/chat/index.d.ts.map +0 -1
- package/chat/index.js +0 -160
- package/coding/index.d.ts +0 -25
- package/coding/index.d.ts.map +0 -1
- package/coding/index.js +0 -25
- package/components/AdvancedPageView.d.ts +0 -17
- package/components/AdvancedPageView.d.ts.map +0 -1
- package/components/AdvancedPageView.js +0 -146
- package/components/AgentActivityBox.d.ts +0 -7
- package/components/AgentActivityBox.d.ts.map +0 -1
- package/components/AgentActivityBox.js +0 -25
- package/components/ApiKeyConfig.d.ts +0 -26
- package/components/ApiKeyConfig.d.ts.map +0 -1
- package/components/ApiKeyConfig.js +0 -119
- package/components/AppsPageView.d.ts +0 -7
- package/components/AppsPageView.d.ts.map +0 -1
- package/components/AppsPageView.js +0 -31
- package/components/AppsView.d.ts +0 -8
- package/components/AppsView.d.ts.map +0 -1
- package/components/AppsView.js +0 -149
- package/components/AvatarLoader.d.ts +0 -13
- package/components/AvatarLoader.d.ts.map +0 -1
- package/components/AvatarLoader.js +0 -53
- package/components/AvatarSelector.d.ts +0 -23
- package/components/AvatarSelector.d.ts.map +0 -1
- package/components/AvatarSelector.js +0 -105
- package/components/BscTradePanel.d.ts +0 -22
- package/components/BscTradePanel.d.ts.map +0 -1
- package/components/BscTradePanel.js +0 -221
- package/components/BugReportModal.d.ts +0 -2
- package/components/BugReportModal.d.ts.map +0 -1
- package/components/BugReportModal.js +0 -219
- package/components/CharacterRoster.d.ts +0 -31
- package/components/CharacterRoster.d.ts.map +0 -1
- package/components/CharacterRoster.js +0 -41
- package/components/CharacterView.d.ts +0 -8
- package/components/CharacterView.d.ts.map +0 -1
- package/components/CharacterView.js +0 -685
- package/components/ChatAvatar.d.ts +0 -8
- package/components/ChatAvatar.d.ts.map +0 -1
- package/components/ChatAvatar.js +0 -89
- package/components/ChatComposer.d.ts +0 -37
- package/components/ChatComposer.d.ts.map +0 -1
- package/components/ChatComposer.js +0 -136
- package/components/ChatMessage.d.ts +0 -24
- package/components/ChatMessage.d.ts.map +0 -1
- package/components/ChatMessage.js +0 -187
- package/components/ChatModalView.d.ts +0 -10
- package/components/ChatModalView.d.ts.map +0 -1
- package/components/ChatModalView.js +0 -57
- package/components/ChatView.d.ts +0 -14
- package/components/ChatView.d.ts.map +0 -1
- package/components/ChatView.js +0 -526
- package/components/CloudOnboarding.d.ts +0 -7
- package/components/CloudOnboarding.d.ts.map +0 -1
- package/components/CloudOnboarding.js +0 -22
- package/components/CloudSourceControls.d.ts +0 -13
- package/components/CloudSourceControls.d.ts.map +0 -1
- package/components/CloudSourceControls.js +0 -16
- package/components/CodingAgentSettingsSection.d.ts +0 -8
- package/components/CodingAgentSettingsSection.d.ts.map +0 -1
- package/components/CodingAgentSettingsSection.js +0 -292
- package/components/CommandPalette.d.ts +0 -2
- package/components/CommandPalette.d.ts.map +0 -1
- package/components/CommandPalette.js +0 -181
- package/components/CompanionSceneHost.d.ts +0 -14
- package/components/CompanionSceneHost.d.ts.map +0 -1
- package/components/CompanionSceneHost.js +0 -362
- package/components/CompanionShell.d.ts +0 -17
- package/components/CompanionShell.d.ts.map +0 -1
- package/components/CompanionShell.js +0 -15
- package/components/CompanionView.d.ts +0 -2
- package/components/CompanionView.d.ts.map +0 -1
- package/components/CompanionView.js +0 -22
- package/components/ConfigPageView.d.ts +0 -11
- package/components/ConfigPageView.d.ts.map +0 -1
- package/components/ConfigPageView.js +0 -311
- package/components/ConfigSaveFooter.d.ts +0 -8
- package/components/ConfigSaveFooter.d.ts.map +0 -1
- package/components/ConfigSaveFooter.js +0 -10
- package/components/ConfirmModal.d.ts +0 -61
- package/components/ConfirmModal.d.ts.map +0 -1
- package/components/ConfirmModal.js +0 -164
- package/components/ConnectionFailedBanner.d.ts +0 -6
- package/components/ConnectionFailedBanner.d.ts.map +0 -1
- package/components/ConnectionFailedBanner.js +0 -22
- package/components/ConnectorsPageView.d.ts +0 -7
- package/components/ConnectorsPageView.d.ts.map +0 -1
- package/components/ConnectorsPageView.js +0 -8
- package/components/ConversationsSidebar.d.ts +0 -9
- package/components/ConversationsSidebar.d.ts.map +0 -1
- package/components/ConversationsSidebar.js +0 -116
- package/components/CustomActionEditor.d.ts +0 -10
- package/components/CustomActionEditor.d.ts.map +0 -1
- package/components/CustomActionEditor.js +0 -596
- package/components/CustomActionsPanel.d.ts +0 -9
- package/components/CustomActionsPanel.d.ts.map +0 -1
- package/components/CustomActionsPanel.js +0 -107
- package/components/CustomActionsView.d.ts +0 -2
- package/components/CustomActionsView.d.ts.map +0 -1
- package/components/CustomActionsView.js +0 -134
- package/components/DatabasePageView.d.ts +0 -5
- package/components/DatabasePageView.d.ts.map +0 -1
- package/components/DatabasePageView.js +0 -28
- package/components/DatabaseView.d.ts +0 -9
- package/components/DatabaseView.d.ts.map +0 -1
- package/components/DatabaseView.js +0 -311
- package/components/ElizaCloudDashboard.d.ts +0 -2
- package/components/ElizaCloudDashboard.d.ts.map +0 -1
- package/components/ElizaCloudDashboard.js +0 -657
- package/components/EmotePicker.d.ts +0 -2
- package/components/EmotePicker.d.ts.map +0 -1
- package/components/EmotePicker.js +0 -343
- package/components/ErrorBoundary.d.ts +0 -22
- package/components/ErrorBoundary.d.ts.map +0 -1
- package/components/ErrorBoundary.js +0 -31
- package/components/FineTuningView.d.ts +0 -2
- package/components/FineTuningView.d.ts.map +0 -1
- package/components/FineTuningView.js +0 -433
- package/components/FlaminaGuide.d.ts +0 -10
- package/components/FlaminaGuide.d.ts.map +0 -1
- package/components/FlaminaGuide.js +0 -64
- package/components/GameView.d.ts +0 -11
- package/components/GameView.d.ts.map +0 -1
- package/components/GameView.js +0 -294
- package/components/GameViewOverlay.d.ts +0 -8
- package/components/GameViewOverlay.d.ts.map +0 -1
- package/components/GameViewOverlay.js +0 -70
- package/components/GlobalEmoteOverlay.d.ts +0 -2
- package/components/GlobalEmoteOverlay.d.ts.map +0 -1
- package/components/GlobalEmoteOverlay.js +0 -112
- package/components/Header.d.ts +0 -9
- package/components/Header.d.ts.map +0 -1
- package/components/Header.js +0 -123
- package/components/HeartbeatsView.d.ts +0 -2
- package/components/HeartbeatsView.d.ts.map +0 -1
- package/components/HeartbeatsView.js +0 -378
- package/components/InventoryView.d.ts +0 -10
- package/components/InventoryView.d.ts.map +0 -1
- package/components/InventoryView.js +0 -176
- package/components/KnowledgeView.d.ts +0 -20
- package/components/KnowledgeView.d.ts.map +0 -1
- package/components/KnowledgeView.js +0 -483
- package/components/LanguageDropdown.d.ts +0 -30
- package/components/LanguageDropdown.d.ts.map +0 -1
- package/components/LanguageDropdown.js +0 -99
- package/components/LifoMonitorPanel.d.ts +0 -21
- package/components/LifoMonitorPanel.d.ts.map +0 -1
- package/components/LifoMonitorPanel.js +0 -24
- package/components/LifoSandboxView.d.ts +0 -5
- package/components/LifoSandboxView.d.ts.map +0 -1
- package/components/LifoSandboxView.js +0 -333
- package/components/LoadingScreen.d.ts +0 -13
- package/components/LoadingScreen.d.ts.map +0 -1
- package/components/LoadingScreen.js +0 -70
- package/components/LogsPageView.d.ts +0 -2
- package/components/LogsPageView.d.ts.map +0 -1
- package/components/LogsPageView.js +0 -7
- package/components/LogsView.d.ts +0 -5
- package/components/LogsView.d.ts.map +0 -1
- package/components/LogsView.js +0 -71
- package/components/MediaGalleryView.d.ts +0 -9
- package/components/MediaGalleryView.d.ts.map +0 -1
- package/components/MediaGalleryView.js +0 -236
- package/components/MediaSettingsSection.d.ts +0 -11
- package/components/MediaSettingsSection.d.ts.map +0 -1
- package/components/MediaSettingsSection.js +0 -329
- package/components/MessageContent.d.ts +0 -51
- package/components/MessageContent.d.ts.map +0 -1
- package/components/MessageContent.js +0 -553
- package/components/OnboardingWizard.d.ts +0 -2
- package/components/OnboardingWizard.d.ts.map +0 -1
- package/components/OnboardingWizard.js +0 -86
- package/components/PairingView.d.ts +0 -5
- package/components/PairingView.d.ts.map +0 -1
- package/components/PairingView.js +0 -29
- package/components/PermissionsSection.d.ts +0 -20
- package/components/PermissionsSection.d.ts.map +0 -1
- package/components/PermissionsSection.js +0 -573
- package/components/PluginsPageView.d.ts +0 -5
- package/components/PluginsPageView.d.ts.map +0 -1
- package/components/PluginsPageView.js +0 -8
- package/components/PluginsView.d.ts +0 -21
- package/components/PluginsView.d.ts.map +0 -1
- package/components/PluginsView.js +0 -1534
- package/components/ProviderSwitcher.d.ts +0 -42
- package/components/ProviderSwitcher.d.ts.map +0 -1
- package/components/ProviderSwitcher.js +0 -493
- package/components/RestartBanner.d.ts +0 -2
- package/components/RestartBanner.d.ts.map +0 -1
- package/components/RestartBanner.js +0 -36
- package/components/RuntimeView.d.ts +0 -10
- package/components/RuntimeView.d.ts.map +0 -1
- package/components/RuntimeView.js +0 -165
- package/components/SaveCommandModal.d.ts +0 -12
- package/components/SaveCommandModal.d.ts.map +0 -1
- package/components/SaveCommandModal.js +0 -84
- package/components/SecretsView.d.ts +0 -9
- package/components/SecretsView.d.ts.map +0 -1
- package/components/SecretsView.js +0 -249
- package/components/SettingsView.d.ts +0 -9
- package/components/SettingsView.d.ts.map +0 -1
- package/components/SettingsView.js +0 -230
- package/components/ShellOverlays.d.ts +0 -8
- package/components/ShellOverlays.d.ts.map +0 -1
- package/components/ShellOverlays.js +0 -10
- package/components/ShortcutsOverlay.d.ts +0 -2
- package/components/ShortcutsOverlay.d.ts.map +0 -1
- package/components/ShortcutsOverlay.js +0 -79
- package/components/SkillsView.d.ts +0 -11
- package/components/SkillsView.d.ts.map +0 -1
- package/components/SkillsView.js +0 -358
- package/components/StartupFailureView.d.ts +0 -8
- package/components/StartupFailureView.d.ts.map +0 -1
- package/components/StartupFailureView.js +0 -16
- package/components/StreamView.d.ts +0 -16
- package/components/StreamView.d.ts.map +0 -1
- package/components/StreamView.js +0 -300
- package/components/StripeEmbeddedCheckout.d.ts +0 -24
- package/components/StripeEmbeddedCheckout.d.ts.map +0 -1
- package/components/StripeEmbeddedCheckout.js +0 -101
- package/components/SubscriptionStatus.d.ts +0 -23
- package/components/SubscriptionStatus.d.ts.map +0 -1
- package/components/SubscriptionStatus.js +0 -301
- package/components/SystemWarningBanner.d.ts +0 -6
- package/components/SystemWarningBanner.d.ts.map +0 -1
- package/components/SystemWarningBanner.js +0 -46
- package/components/ThemeToggle.d.ts +0 -21
- package/components/ThemeToggle.d.ts.map +0 -1
- package/components/ThemeToggle.js +0 -24
- package/components/TrajectoriesView.d.ts +0 -12
- package/components/TrajectoriesView.d.ts.map +0 -1
- package/components/TrajectoriesView.js +0 -183
- package/components/TrajectoryDetailView.d.ts +0 -13
- package/components/TrajectoryDetailView.d.ts.map +0 -1
- package/components/TrajectoryDetailView.js +0 -112
- package/components/TriggersView.d.ts +0 -2
- package/components/TriggersView.d.ts.map +0 -1
- package/components/TriggersView.js +0 -1
- package/components/VectorBrowserView.d.ts +0 -10
- package/components/VectorBrowserView.d.ts.map +0 -1
- package/components/VectorBrowserView.js +0 -1000
- package/components/VoiceConfigView.d.ts +0 -11
- package/components/VoiceConfigView.d.ts.map +0 -1
- package/components/VoiceConfigView.js +0 -331
- package/components/VrmStage.d.ts +0 -28
- package/components/VrmStage.d.ts.map +0 -1
- package/components/VrmStage.js +0 -178
- package/components/WhatsAppQrOverlay.d.ts +0 -8
- package/components/WhatsAppQrOverlay.d.ts.map +0 -1
- package/components/WhatsAppQrOverlay.js +0 -63
- package/components/apps/AppDetailPane.d.ts +0 -15
- package/components/apps/AppDetailPane.d.ts.map +0 -1
- package/components/apps/AppDetailPane.js +0 -13
- package/components/apps/AppsCatalogGrid.d.ts +0 -20
- package/components/apps/AppsCatalogGrid.d.ts.map +0 -1
- package/components/apps/AppsCatalogGrid.js +0 -18
- package/components/apps/extensions/registry.d.ts +0 -4
- package/components/apps/extensions/registry.d.ts.map +0 -1
- package/components/apps/extensions/registry.js +0 -7
- package/components/apps/extensions/types.d.ts +0 -7
- package/components/apps/extensions/types.d.ts.map +0 -1
- package/components/apps/helpers.d.ts +0 -7
- package/components/apps/helpers.d.ts.map +0 -1
- package/components/apps/helpers.js +0 -44
- package/components/avatar/VrmAnimationLoader.d.ts +0 -30
- package/components/avatar/VrmAnimationLoader.d.ts.map +0 -1
- package/components/avatar/VrmAnimationLoader.js +0 -99
- package/components/avatar/VrmBlinkController.d.ts +0 -37
- package/components/avatar/VrmBlinkController.d.ts.map +0 -1
- package/components/avatar/VrmBlinkController.js +0 -98
- package/components/avatar/VrmCameraManager.d.ts +0 -57
- package/components/avatar/VrmCameraManager.d.ts.map +0 -1
- package/components/avatar/VrmCameraManager.js +0 -277
- package/components/avatar/VrmEngine.d.ts +0 -246
- package/components/avatar/VrmEngine.d.ts.map +0 -1
- package/components/avatar/VrmEngine.js +0 -2087
- package/components/avatar/VrmFootShadow.d.ts +0 -18
- package/components/avatar/VrmFootShadow.d.ts.map +0 -1
- package/components/avatar/VrmFootShadow.js +0 -83
- package/components/avatar/VrmViewer.d.ts +0 -60
- package/components/avatar/VrmViewer.d.ts.map +0 -1
- package/components/avatar/VrmViewer.js +0 -396
- package/components/avatar/mixamoVRMRigMap.d.ts +0 -3
- package/components/avatar/mixamoVRMRigMap.d.ts.map +0 -1
- package/components/avatar/mixamoVRMRigMap.js +0 -56
- package/components/avatar/retargetMixamoFbxToVrm.d.ts +0 -9
- package/components/avatar/retargetMixamoFbxToVrm.d.ts.map +0 -1
- package/components/avatar/retargetMixamoFbxToVrm.js +0 -88
- package/components/avatar/retargetMixamoGltfToVrm.d.ts +0 -11
- package/components/avatar/retargetMixamoGltfToVrm.d.ts.map +0 -1
- package/components/avatar/retargetMixamoGltfToVrm.js +0 -80
- package/components/chainConfig.d.ts +0 -89
- package/components/chainConfig.d.ts.map +0 -1
- package/components/chainConfig.js +0 -287
- package/components/companion/CompanionHeader.d.ts +0 -15
- package/components/companion/CompanionHeader.d.ts.map +0 -1
- package/components/companion/CompanionHeader.js +0 -7
- package/components/companion/CompanionSceneHost.d.ts +0 -2
- package/components/companion/CompanionSceneHost.d.ts.map +0 -1
- package/components/companion/CompanionSceneHost.js +0 -1
- package/components/companion/VrmStage.d.ts +0 -3
- package/components/companion/VrmStage.d.ts.map +0 -1
- package/components/companion/VrmStage.js +0 -1
- package/components/companion/index.d.ts +0 -18
- package/components/companion/index.d.ts.map +0 -1
- package/components/companion/index.js +0 -17
- package/components/companion/walletUtils.d.ts +0 -95
- package/components/companion/walletUtils.d.ts.map +0 -1
- package/components/companion/walletUtils.js +0 -167
- package/components/companion-shell-styles.d.ts +0 -38
- package/components/companion-shell-styles.d.ts.map +0 -1
- package/components/companion-shell-styles.js +0 -248
- package/components/confirm-delete-control.d.ts +0 -16
- package/components/confirm-delete-control.d.ts.map +0 -1
- package/components/confirm-delete-control.js +0 -12
- package/components/conversations/ConversationListItem.d.ts +0 -31
- package/components/conversations/ConversationListItem.d.ts.map +0 -1
- package/components/conversations/ConversationListItem.js +0 -52
- package/components/conversations/conversation-utils.d.ts +0 -9
- package/components/conversations/conversation-utils.d.ts.map +0 -1
- package/components/conversations/conversation-utils.js +0 -138
- package/components/format.d.ts +0 -54
- package/components/format.d.ts.map +0 -1
- package/components/format.js +0 -82
- package/components/index.d.ts +0 -96
- package/components/index.d.ts.map +0 -1
- package/components/index.js +0 -95
- package/components/inventory/CopyableAddress.d.ts +0 -8
- package/components/inventory/CopyableAddress.d.ts.map +0 -1
- package/components/inventory/CopyableAddress.js +0 -18
- package/components/inventory/InventoryToolbar.d.ts +0 -25
- package/components/inventory/InventoryToolbar.d.ts.map +0 -1
- package/components/inventory/InventoryToolbar.js +0 -28
- package/components/inventory/NftGrid.d.ts +0 -13
- package/components/inventory/NftGrid.d.ts.map +0 -1
- package/components/inventory/NftGrid.js +0 -29
- package/components/inventory/TokenLogo.d.ts +0 -12
- package/components/inventory/TokenLogo.d.ts.map +0 -1
- package/components/inventory/TokenLogo.js +0 -33
- package/components/inventory/TokensTable.d.ts +0 -24
- package/components/inventory/TokensTable.d.ts.map +0 -1
- package/components/inventory/TokensTable.js +0 -26
- package/components/inventory/constants.d.ts +0 -52
- package/components/inventory/constants.d.ts.map +0 -1
- package/components/inventory/constants.js +0 -121
- package/components/inventory/index.d.ts +0 -9
- package/components/inventory/index.d.ts.map +0 -1
- package/components/inventory/index.js +0 -8
- package/components/inventory/media-url.d.ts +0 -6
- package/components/inventory/media-url.d.ts.map +0 -1
- package/components/inventory/media-url.js +0 -28
- package/components/inventory/useInventoryData.d.ts +0 -53
- package/components/inventory/useInventoryData.d.ts.map +0 -1
- package/components/inventory/useInventoryData.js +0 -332
- package/components/knowledge-upload-image.d.ts +0 -27
- package/components/knowledge-upload-image.d.ts.map +0 -1
- package/components/knowledge-upload-image.js +0 -146
- package/components/labels.d.ts +0 -6
- package/components/labels.d.ts.map +0 -1
- package/components/labels.js +0 -40
- package/components/onboarding/ActivateStep.d.ts +0 -2
- package/components/onboarding/ActivateStep.d.ts.map +0 -1
- package/components/onboarding/ActivateStep.js +0 -10
- package/components/onboarding/CloudLoginStep.d.ts +0 -2
- package/components/onboarding/CloudLoginStep.d.ts.map +0 -1
- package/components/onboarding/CloudLoginStep.js +0 -20
- package/components/onboarding/ConnectionStep.d.ts +0 -2
- package/components/onboarding/ConnectionStep.d.ts.map +0 -1
- package/components/onboarding/ConnectionStep.js +0 -609
- package/components/onboarding/IdentityStep.d.ts +0 -2
- package/components/onboarding/IdentityStep.d.ts.map +0 -1
- package/components/onboarding/IdentityStep.js +0 -102
- package/components/onboarding/OnboardingPanel.d.ts +0 -9
- package/components/onboarding/OnboardingPanel.d.ts.map +0 -1
- package/components/onboarding/OnboardingPanel.js +0 -24
- package/components/onboarding/OnboardingStepNav.d.ts +0 -2
- package/components/onboarding/OnboardingStepNav.d.ts.map +0 -1
- package/components/onboarding/OnboardingStepNav.js +0 -24
- package/components/onboarding/PermissionsStep.d.ts +0 -2
- package/components/onboarding/PermissionsStep.d.ts.map +0 -1
- package/components/onboarding/PermissionsStep.js +0 -7
- package/components/onboarding/RpcStep.d.ts +0 -2
- package/components/onboarding/RpcStep.d.ts.map +0 -1
- package/components/onboarding/RpcStep.js +0 -125
- package/components/onboarding/SaveKeysStep.d.ts +0 -2
- package/components/onboarding/SaveKeysStep.d.ts.map +0 -1
- package/components/onboarding/SaveKeysStep.js +0 -44
- package/components/onboarding/WelcomeStep.d.ts +0 -2
- package/components/onboarding/WelcomeStep.d.ts.map +0 -1
- package/components/onboarding/WelcomeStep.js +0 -30
- package/components/permissions/PermissionIcon.d.ts +0 -4
- package/components/permissions/PermissionIcon.d.ts.map +0 -1
- package/components/permissions/PermissionIcon.js +0 -12
- package/components/permissions/StreamingPermissions.d.ts +0 -20
- package/components/permissions/StreamingPermissions.d.ts.map +0 -1
- package/components/permissions/StreamingPermissions.js +0 -178
- package/components/plugins/showcase-data.d.ts +0 -7
- package/components/plugins/showcase-data.d.ts.map +0 -1
- package/components/plugins/showcase-data.js +0 -464
- package/components/shared/ShellHeaderControls.d.ts +0 -27
- package/components/shared/ShellHeaderControls.d.ts.map +0 -1
- package/components/shared/ShellHeaderControls.js +0 -55
- package/components/shared-companion-scene-context.d.ts +0 -3
- package/components/shared-companion-scene-context.d.ts.map +0 -1
- package/components/shared-companion-scene-context.js +0 -13
- package/components/skeletons.d.ts +0 -17
- package/components/skeletons.d.ts.map +0 -1
- package/components/skeletons.js +0 -22
- package/components/stream/ActivityFeed.d.ts +0 -5
- package/components/stream/ActivityFeed.d.ts.map +0 -1
- package/components/stream/ActivityFeed.js +0 -57
- package/components/stream/AvatarPip.d.ts +0 -5
- package/components/stream/AvatarPip.d.ts.map +0 -1
- package/components/stream/AvatarPip.js +0 -6
- package/components/stream/ChatContent.d.ts +0 -6
- package/components/stream/ChatContent.d.ts.map +0 -1
- package/components/stream/ChatContent.js +0 -69
- package/components/stream/ChatTicker.d.ts +0 -5
- package/components/stream/ChatTicker.d.ts.map +0 -1
- package/components/stream/ChatTicker.js +0 -34
- package/components/stream/IdleContent.d.ts +0 -5
- package/components/stream/IdleContent.d.ts.map +0 -1
- package/components/stream/IdleContent.js +0 -17
- package/components/stream/StatusBar.d.ts +0 -36
- package/components/stream/StatusBar.d.ts.map +0 -1
- package/components/stream/StatusBar.js +0 -140
- package/components/stream/StreamSettings.d.ts +0 -33
- package/components/stream/StreamSettings.d.ts.map +0 -1
- package/components/stream/StreamSettings.js +0 -99
- package/components/stream/StreamTerminal.d.ts +0 -2
- package/components/stream/StreamTerminal.d.ts.map +0 -1
- package/components/stream/StreamTerminal.js +0 -52
- package/components/stream/StreamVoiceConfig.d.ts +0 -10
- package/components/stream/StreamVoiceConfig.d.ts.map +0 -1
- package/components/stream/StreamVoiceConfig.js +0 -88
- package/components/stream/helpers.d.ts +0 -32
- package/components/stream/helpers.d.ts.map +0 -1
- package/components/stream/helpers.js +0 -110
- package/components/stream/overlays/OverlayLayer.d.ts +0 -20
- package/components/stream/overlays/OverlayLayer.d.ts.map +0 -1
- package/components/stream/overlays/OverlayLayer.js +0 -24
- package/components/stream/overlays/built-in/ActionTickerWidget.d.ts +0 -8
- package/components/stream/overlays/built-in/ActionTickerWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/ActionTickerWidget.js +0 -44
- package/components/stream/overlays/built-in/AlertPopupWidget.d.ts +0 -7
- package/components/stream/overlays/built-in/AlertPopupWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/AlertPopupWidget.js +0 -62
- package/components/stream/overlays/built-in/BrandingWidget.d.ts +0 -7
- package/components/stream/overlays/built-in/BrandingWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/BrandingWidget.js +0 -36
- package/components/stream/overlays/built-in/CustomHtmlWidget.d.ts +0 -26
- package/components/stream/overlays/built-in/CustomHtmlWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/CustomHtmlWidget.js +0 -78
- package/components/stream/overlays/built-in/PeonGlassWidget.d.ts +0 -11
- package/components/stream/overlays/built-in/PeonGlassWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/PeonGlassWidget.js +0 -188
- package/components/stream/overlays/built-in/PeonHudWidget.d.ts +0 -10
- package/components/stream/overlays/built-in/PeonHudWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/PeonHudWidget.js +0 -168
- package/components/stream/overlays/built-in/PeonSakuraWidget.d.ts +0 -11
- package/components/stream/overlays/built-in/PeonSakuraWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/PeonSakuraWidget.js +0 -213
- package/components/stream/overlays/built-in/ThoughtBubbleWidget.d.ts +0 -8
- package/components/stream/overlays/built-in/ThoughtBubbleWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/ThoughtBubbleWidget.js +0 -59
- package/components/stream/overlays/built-in/ViewerCountWidget.d.ts +0 -7
- package/components/stream/overlays/built-in/ViewerCountWidget.d.ts.map +0 -1
- package/components/stream/overlays/built-in/ViewerCountWidget.js +0 -34
- package/components/stream/overlays/built-in/index.d.ts +0 -13
- package/components/stream/overlays/built-in/index.d.ts.map +0 -1
- package/components/stream/overlays/built-in/index.js +0 -12
- package/components/stream/overlays/registry.d.ts +0 -11
- package/components/stream/overlays/registry.d.ts.map +0 -1
- package/components/stream/overlays/registry.js +0 -16
- package/components/stream/overlays/types.d.ts +0 -67
- package/components/stream/overlays/types.d.ts.map +0 -1
- package/components/stream/overlays/types.js +0 -7
- package/components/stream/overlays/useOverlayLayout.d.ts +0 -27
- package/components/stream/overlays/useOverlayLayout.d.ts.map +0 -1
- package/components/stream/overlays/useOverlayLayout.js +0 -162
- package/components/trajectory-format.d.ts +0 -6
- package/components/trajectory-format.d.ts.map +0 -1
- package/components/trajectory-format.js +0 -43
- package/components/ui-badges.d.ts +0 -23
- package/components/ui-badges.d.ts.map +0 -1
- package/components/ui-badges.js +0 -38
- package/components/ui-switch.d.ts +0 -14
- package/components/ui-switch.d.ts.map +0 -1
- package/components/ui-switch.js +0 -15
- package/components/vector-browser-three.d.ts +0 -4
- package/components/vector-browser-three.d.ts.map +0 -1
- package/components/vector-browser-three.js +0 -21
- package/config/branding.d.ts +0 -49
- package/config/branding.d.ts.map +0 -1
- package/config/branding.js +0 -16
- package/config/config-catalog.d.ts +0 -376
- package/config/config-catalog.d.ts.map +0 -1
- package/config/config-catalog.js +0 -724
- package/config/config-field.d.ts +0 -68
- package/config/config-field.d.ts.map +0 -1
- package/config/config-field.js +0 -840
- package/config/config-renderer.d.ts +0 -176
- package/config/config-renderer.d.ts.map +0 -1
- package/config/config-renderer.js +0 -405
- package/config/index.d.ts +0 -6
- package/config/index.d.ts.map +0 -1
- package/config/index.js +0 -5
- package/config/ui-renderer.d.ts +0 -26
- package/config/ui-renderer.d.ts.map +0 -1
- package/config/ui-renderer.js +0 -815
- package/config/ui-spec.d.ts +0 -164
- package/config/ui-spec.d.ts.map +0 -1
- package/config/ui-spec.js +0 -13
- package/events/index.d.ts +0 -48
- package/events/index.d.ts.map +0 -1
- package/events/index.js +0 -45
- package/hooks/index.d.ts +0 -15
- package/hooks/index.d.ts.map +0 -1
- package/hooks/index.js +0 -14
- package/hooks/useBugReport.d.ts +0 -14
- package/hooks/useBugReport.d.ts.map +0 -1
- package/hooks/useBugReport.js +0 -18
- package/hooks/useCanvasWindow.d.ts +0 -38
- package/hooks/useCanvasWindow.d.ts.map +0 -1
- package/hooks/useCanvasWindow.js +0 -273
- package/hooks/useChatAvatarVoice.d.ts +0 -10
- package/hooks/useChatAvatarVoice.d.ts.map +0 -1
- package/hooks/useChatAvatarVoice.js +0 -71
- package/hooks/useClickOutside.d.ts +0 -6
- package/hooks/useClickOutside.d.ts.map +0 -1
- package/hooks/useClickOutside.js +0 -25
- package/hooks/useContextMenu.d.ts +0 -17
- package/hooks/useContextMenu.d.ts.map +0 -1
- package/hooks/useContextMenu.js +0 -100
- package/hooks/useKeyboardShortcuts.d.ts +0 -17
- package/hooks/useKeyboardShortcuts.d.ts.map +0 -1
- package/hooks/useKeyboardShortcuts.js +0 -67
- package/hooks/useLifoSync.d.ts +0 -18
- package/hooks/useLifoSync.d.ts.map +0 -1
- package/hooks/useLifoSync.js +0 -113
- package/hooks/useMemoryMonitor.d.ts +0 -87
- package/hooks/useMemoryMonitor.d.ts.map +0 -1
- package/hooks/useMemoryMonitor.js +0 -209
- package/hooks/useRenderGuard.d.ts +0 -17
- package/hooks/useRenderGuard.d.ts.map +0 -1
- package/hooks/useRenderGuard.js +0 -36
- package/hooks/useRetakeCapture.d.ts +0 -12
- package/hooks/useRetakeCapture.d.ts.map +0 -1
- package/hooks/useRetakeCapture.js +0 -60
- package/hooks/useStreamPopoutNavigation.d.ts +0 -3
- package/hooks/useStreamPopoutNavigation.d.ts.map +0 -1
- package/hooks/useStreamPopoutNavigation.js +0 -17
- package/hooks/useTimeout.d.ts +0 -11
- package/hooks/useTimeout.d.ts.map +0 -1
- package/hooks/useTimeout.js +0 -32
- package/hooks/useVoiceChat.d.ts +0 -94
- package/hooks/useVoiceChat.d.ts.map +0 -1
- package/hooks/useVoiceChat.js +0 -1077
- package/hooks/useWhatsAppPairing.d.ts +0 -11
- package/hooks/useWhatsAppPairing.d.ts.map +0 -1
- package/hooks/useWhatsAppPairing.js +0 -95
- package/i18n/index.d.ts +0 -7
- package/i18n/index.d.ts.map +0 -1
- package/i18n/index.js +0 -53
- package/i18n/locales/en.json +0 -1268
- package/i18n/locales/es.json +0 -1236
- package/i18n/locales/ko.json +0 -1236
- package/i18n/locales/pt.json +0 -1236
- package/i18n/locales/zh-CN.json +0 -1236
- package/i18n/messages.d.ts +0 -6
- package/i18n/messages.d.ts.map +0 -1
- package/i18n/messages.js +0 -14
- package/navigation/index.d.ts +0 -27
- package/navigation/index.d.ts.map +0 -1
- package/navigation/index.js +0 -232
- package/onboarding-config.d.ts +0 -25
- package/onboarding-config.d.ts.map +0 -1
- package/onboarding-config.js +0 -76
- package/platform/browser-launch.d.ts +0 -2
- package/platform/browser-launch.d.ts.map +0 -1
- package/platform/browser-launch.js +0 -109
- package/platform/index.d.ts +0 -14
- package/platform/index.d.ts.map +0 -1
- package/platform/index.js +0 -24
- package/platform/init.d.ts +0 -40
- package/platform/init.d.ts.map +0 -1
- package/platform/init.js +0 -160
- package/platform/lifo.d.ts +0 -51
- package/platform/lifo.d.ts.map +0 -1
- package/platform/lifo.js +0 -138
- package/providers/index.d.ts +0 -19
- package/providers/index.d.ts.map +0 -1
- package/providers/index.js +0 -80
- package/shell-params.d.ts +0 -12
- package/shell-params.d.ts.map +0 -1
- package/shell-params.js +0 -19
- package/state/AppContext.d.ts +0 -12
- package/state/AppContext.d.ts.map +0 -1
- package/state/AppContext.js +0 -5102
- package/state/index.d.ts +0 -7
- package/state/index.d.ts.map +0 -1
- package/state/index.js +0 -6
- package/state/internal.d.ts +0 -7
- package/state/internal.d.ts.map +0 -1
- package/state/internal.js +0 -6
- package/state/onboarding-resume.d.ts +0 -11
- package/state/onboarding-resume.d.ts.map +0 -1
- package/state/onboarding-resume.js +0 -187
- package/state/parsers.d.ts +0 -26
- package/state/parsers.d.ts.map +0 -1
- package/state/parsers.js +0 -255
- package/state/persistence.d.ts +0 -59
- package/state/persistence.d.ts.map +0 -1
- package/state/persistence.js +0 -328
- package/state/shell-routing.d.ts +0 -12
- package/state/shell-routing.d.ts.map +0 -1
- package/state/shell-routing.js +0 -26
- package/state/types.d.ts +0 -426
- package/state/types.d.ts.map +0 -1
- package/state/types.js +0 -89
- package/state/ui-preferences.d.ts +0 -3
- package/state/ui-preferences.d.ts.map +0 -1
- package/state/ui-preferences.js +0 -1
- package/state/useApp.d.ts +0 -4
- package/state/useApp.d.ts.map +0 -1
- package/state/useApp.js +0 -22
- package/state/vrm.d.ts +0 -30
- package/state/vrm.d.ts.map +0 -1
- package/state/vrm.js +0 -82
- package/styles/anime.css +0 -6364
- package/styles/base.css +0 -255
- package/styles/onboarding-game.css +0 -1095
- package/styles/styles.css +0 -2087
- package/styles/xterm.css +0 -241
- package/types/index.d.ts +0 -657
- package/types/index.d.ts.map +0 -1
- package/types/index.js +0 -1
- package/utils/asset-url.d.ts +0 -26
- package/utils/asset-url.d.ts.map +0 -1
- package/utils/asset-url.js +0 -99
- package/utils/assistant-text.d.ts +0 -2
- package/utils/assistant-text.d.ts.map +0 -1
- package/utils/assistant-text.js +0 -161
- package/utils/clipboard.d.ts +0 -2
- package/utils/clipboard.d.ts.map +0 -1
- package/utils/clipboard.js +0 -38
- package/utils/desktop-dialogs.d.ts +0 -19
- package/utils/desktop-dialogs.d.ts.map +0 -1
- package/utils/desktop-dialogs.js +0 -50
- package/utils/eliza-globals.d.ts +0 -11
- package/utils/eliza-globals.d.ts.map +0 -1
- package/utils/eliza-globals.js +0 -33
- package/utils/index.d.ts +0 -8
- package/utils/index.d.ts.map +0 -1
- package/utils/index.js +0 -7
- package/utils/number-parsing.d.ts +0 -44
- package/utils/number-parsing.d.ts.map +0 -1
- package/utils/number-parsing.js +0 -56
- package/utils/openExternalUrl.d.ts +0 -2
- package/utils/openExternalUrl.d.ts.map +0 -1
- package/utils/openExternalUrl.js +0 -17
- package/utils/spoken-text.d.ts +0 -2
- package/utils/spoken-text.d.ts.map +0 -1
- package/utils/spoken-text.js +0 -56
- package/utils/streaming-text.d.ts +0 -3
- package/utils/streaming-text.d.ts.map +0 -1
- package/utils/streaming-text.js +0 -87
- package/voice/index.d.ts +0 -2
- package/voice/index.d.ts.map +0 -1
- package/voice/index.js +0 -1
- package/voice/types.d.ts +0 -25
- package/voice/types.d.ts.map +0 -1
- package/voice/types.js +0 -166
- package/wallet-rpc.d.ts +0 -8
- package/wallet-rpc.d.ts.map +0 -1
- package/wallet-rpc.js +0 -131
- /package/{components/apps/extensions → services/local-inference/voice}/types.js +0 -0
|
@@ -0,0 +1,1963 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Native Module for Electrobun
|
|
3
|
+
*
|
|
4
|
+
* Embeds the elizaOS agent runtime as an isolated child process
|
|
5
|
+
* using Bun.spawn() and exposes it to the webview via RPC messages.
|
|
6
|
+
*
|
|
7
|
+
* Instead of dynamically importing the runtime into the main process
|
|
8
|
+
* (which requires fighting ASAR, CJS/ESM mismatch, and NODE_PATH hacks),
|
|
9
|
+
* we spawn a separate Bun process that runs the canonical CLI/server entry
|
|
10
|
+
* (`entry.js start`). This gives us:
|
|
11
|
+
* - Clean process isolation (native module crashes don't kill the UI)
|
|
12
|
+
* - No ESM/CJS import gymnastics
|
|
13
|
+
* - Simple lifecycle management via SIGTERM/SIGKILL
|
|
14
|
+
* - stdout/stderr streaming for diagnostics
|
|
15
|
+
*
|
|
16
|
+
* The renderer never needs to know whether the API server is embedded or
|
|
17
|
+
* remote -- it simply connects to `http://localhost:{port}`.
|
|
18
|
+
*
|
|
19
|
+
* **Port policy (WHY):** we resolve a **free** loopback desktop API port from
|
|
20
|
+
* `ELIZA_API_PORT`, `ELIZA_API_PORT`, or `ELIZA_PORT` (see
|
|
21
|
+
* `findFirstAvailableLoopbackPort`) instead of SIGKILL-ing listeners by
|
|
22
|
+
* default, so two desktop apps can run side by side. Optional
|
|
23
|
+
* `ELIZA_AGENT_RECLAIM_STALE_PORT=1` (legacy: `ELIZA_AGENT_RECLAIM_STALE_PORT`)
|
|
24
|
+
* restores lsof-based reclaim for single-instance dev.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import crypto from "node:crypto";
|
|
28
|
+
import fs from "node:fs";
|
|
29
|
+
import os from "node:os";
|
|
30
|
+
import path from "node:path";
|
|
31
|
+
import {
|
|
32
|
+
resolveApiToken,
|
|
33
|
+
resolveDesktopApiPort,
|
|
34
|
+
resolveDisableAutoApiToken,
|
|
35
|
+
setApiToken,
|
|
36
|
+
} from "@elizaos/shared";
|
|
37
|
+
import { Utils } from "electrobun/bun";
|
|
38
|
+
import { resolveDesktopRuntimeMode } from "../api-base";
|
|
39
|
+
import { getBrandConfig } from "../brand-config";
|
|
40
|
+
import { DEFAULT_API_PORT } from "../constants";
|
|
41
|
+
import { logger } from "../logger";
|
|
42
|
+
import { recordStartupPhase, resolveStartupBundlePath } from "../startup-trace";
|
|
43
|
+
import type { SendToWebview } from "../types.js";
|
|
44
|
+
import { findFirstAvailableLoopbackPort } from "./loopback-port";
|
|
45
|
+
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Types
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
interface AgentStatus {
|
|
51
|
+
state: "not_started" | "starting" | "running" | "stopped" | "error";
|
|
52
|
+
agentName: string | null;
|
|
53
|
+
port: number | null;
|
|
54
|
+
startedAt: number | null;
|
|
55
|
+
error: string | null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface StartupDiagnosticsSnapshot {
|
|
59
|
+
state: AgentStatus["state"];
|
|
60
|
+
phase: string;
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
lastError: string | null;
|
|
63
|
+
agentName: string | null;
|
|
64
|
+
port: number | null;
|
|
65
|
+
startedAt: number | null;
|
|
66
|
+
platform: string;
|
|
67
|
+
arch: string;
|
|
68
|
+
configDir: string;
|
|
69
|
+
logPath: string;
|
|
70
|
+
statusPath: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface BugReportBundleResult {
|
|
74
|
+
directory: string;
|
|
75
|
+
reportMarkdownPath: string;
|
|
76
|
+
reportJsonPath: string;
|
|
77
|
+
startupLogPath: string | null;
|
|
78
|
+
startupStatusPath: string | null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
import type {
|
|
82
|
+
ExistingElizaInstallInfo,
|
|
83
|
+
ExistingElizaInstallSource,
|
|
84
|
+
StateDirMigrationResult,
|
|
85
|
+
} from "../rpc-schema";
|
|
86
|
+
|
|
87
|
+
export type {
|
|
88
|
+
ExistingElizaInstallInfo,
|
|
89
|
+
ExistingElizaInstallSource,
|
|
90
|
+
StateDirMigrationResult,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Subprocess type from Bun.spawn
|
|
94
|
+
type BunSubprocess = ReturnType<typeof Bun.spawn>;
|
|
95
|
+
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
// Constants
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
const HEALTH_POLL_INTERVAL_MS = process.platform === "win32" ? 2_000 : 500;
|
|
101
|
+
const SIGTERM_GRACE_MS = 5_000;
|
|
102
|
+
const AGENT_NAME_FETCH_TIMEOUT_MS = 5_000;
|
|
103
|
+
const WINDOWS_ABS_PATH_RE = /^[A-Za-z]:[\\/]/;
|
|
104
|
+
const ELIZA_CONFIG_FILENAME = "eliza.json";
|
|
105
|
+
|
|
106
|
+
export function getHealthPollTimeoutMs(
|
|
107
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
108
|
+
platform: string = process.platform,
|
|
109
|
+
): number {
|
|
110
|
+
const raw = env.ELIZA_AGENT_HEALTH_TIMEOUT_MS?.trim();
|
|
111
|
+
if (raw) {
|
|
112
|
+
const parsed = Number.parseInt(raw, 10);
|
|
113
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
114
|
+
return parsed;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Windows packaged first-run startup can include PGLite initialization plus
|
|
119
|
+
// a GGUF embedding model download before /api/health comes online.
|
|
120
|
+
return platform === "win32" ? 240_000 : 120_000;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function isPosixAbsolutePath(value: string): boolean {
|
|
124
|
+
return value.startsWith("/") && !WINDOWS_ABS_PATH_RE.test(value);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function resolvePortablePath(value: string): string {
|
|
128
|
+
if (isPosixAbsolutePath(value) || WINDOWS_ABS_PATH_RE.test(value)) {
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
return path.resolve(value);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function dirnamePortable(value: string): string {
|
|
135
|
+
return isPosixAbsolutePath(value)
|
|
136
|
+
? path.posix.dirname(value)
|
|
137
|
+
: path.dirname(value);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function joinPortable(base: string, ...parts: string[]): string {
|
|
141
|
+
return isPosixAbsolutePath(base)
|
|
142
|
+
? path.posix.join(base, ...parts)
|
|
143
|
+
: path.join(base, ...parts);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function resolveRelativePortable(base: string, relativePath: string): string {
|
|
147
|
+
return isPosixAbsolutePath(base)
|
|
148
|
+
? path.posix.resolve(base, relativePath)
|
|
149
|
+
: path.resolve(base, relativePath);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function getDefaultModuleDir(): string {
|
|
153
|
+
return import.meta.dir ?? path.join(process.cwd(), "src");
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function normalizeEnvPath(value: string | undefined): string | null {
|
|
157
|
+
const trimmed = value?.trim();
|
|
158
|
+
return trimmed ? resolvePortablePath(trimmed) : null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function isStoreBuildVariant(env: NodeJS.ProcessEnv = process.env): boolean {
|
|
162
|
+
const raw =
|
|
163
|
+
env.MILADY_BUILD_VARIANT?.trim() || env.ELIZA_BUILD_VARIANT?.trim();
|
|
164
|
+
return raw?.toLowerCase() === "store";
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function resolveStateNamespace(env: NodeJS.ProcessEnv = process.env): string {
|
|
168
|
+
return env.ELIZA_NAMESPACE?.trim() || getBrandConfig().namespace || "eliza";
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function resolveExplicitStateDir(env: NodeJS.ProcessEnv): string | null {
|
|
172
|
+
return (
|
|
173
|
+
normalizeEnvPath(env.MILADY_STATE_DIR) ??
|
|
174
|
+
normalizeEnvPath(env.ELIZA_STATE_DIR)
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function resolveStoreUserDataStateDir(): string {
|
|
179
|
+
const userData = Utils.paths.userData || resolveConfigDir();
|
|
180
|
+
return path.join(userData, "state");
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function resolveDesktopChildStateDir(opts?: {
|
|
184
|
+
env?: NodeJS.ProcessEnv;
|
|
185
|
+
homedir?: string;
|
|
186
|
+
}): string {
|
|
187
|
+
const env = opts?.env ?? process.env;
|
|
188
|
+
const explicit = resolveExplicitStateDir(env);
|
|
189
|
+
if (explicit) return explicit;
|
|
190
|
+
if (isStoreBuildVariant(env)) return resolveStoreUserDataStateDir();
|
|
191
|
+
return joinPortable(
|
|
192
|
+
opts?.homedir ?? os.homedir(),
|
|
193
|
+
`.${resolveStateNamespace(env)}`,
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function applyDesktopChildStateEnv(childEnv: Record<string, string>): void {
|
|
198
|
+
if (!isStoreBuildVariant(childEnv as NodeJS.ProcessEnv)) return;
|
|
199
|
+
const stateDir = resolveDesktopChildStateDir({
|
|
200
|
+
env: childEnv as NodeJS.ProcessEnv,
|
|
201
|
+
});
|
|
202
|
+
fs.mkdirSync(stateDir, { recursive: true });
|
|
203
|
+
childEnv.MILADY_STATE_DIR = stateDir;
|
|
204
|
+
childEnv.ELIZA_STATE_DIR = stateDir;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function listStateEntries(stateDir: string): string[] {
|
|
208
|
+
try {
|
|
209
|
+
return fs
|
|
210
|
+
.readdirSync(stateDir)
|
|
211
|
+
.filter(
|
|
212
|
+
(entry) => entry !== "." && entry !== ".." && entry !== ".DS_Store",
|
|
213
|
+
);
|
|
214
|
+
} catch {
|
|
215
|
+
return [];
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function buildExistingElizaInstallCandidates(opts?: {
|
|
220
|
+
env?: NodeJS.ProcessEnv;
|
|
221
|
+
homedir?: string;
|
|
222
|
+
}): Array<{
|
|
223
|
+
source: ExistingElizaInstallSource;
|
|
224
|
+
stateDir: string;
|
|
225
|
+
configPath: string;
|
|
226
|
+
}> {
|
|
227
|
+
const env = opts?.env ?? process.env;
|
|
228
|
+
const homedir = opts?.homedir ?? os.homedir();
|
|
229
|
+
const configPathFromEnv =
|
|
230
|
+
normalizeEnvPath(env.MILADY_CONFIG_PATH) ??
|
|
231
|
+
normalizeEnvPath(env.ELIZA_CONFIG_PATH);
|
|
232
|
+
const stateDirFromEnv = resolveExplicitStateDir(env);
|
|
233
|
+
const defaultStateDir = joinPortable(
|
|
234
|
+
homedir,
|
|
235
|
+
`.${resolveStateNamespace(env)}`,
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
const candidates = [
|
|
239
|
+
configPathFromEnv
|
|
240
|
+
? {
|
|
241
|
+
source: "config-path-env" as const,
|
|
242
|
+
stateDir: dirnamePortable(configPathFromEnv),
|
|
243
|
+
configPath: configPathFromEnv,
|
|
244
|
+
}
|
|
245
|
+
: null,
|
|
246
|
+
stateDirFromEnv
|
|
247
|
+
? {
|
|
248
|
+
source: "state-dir-env" as const,
|
|
249
|
+
stateDir: stateDirFromEnv,
|
|
250
|
+
configPath: joinPortable(stateDirFromEnv, ELIZA_CONFIG_FILENAME),
|
|
251
|
+
}
|
|
252
|
+
: null,
|
|
253
|
+
{
|
|
254
|
+
source: "default-state-dir" as const,
|
|
255
|
+
stateDir: defaultStateDir,
|
|
256
|
+
configPath: joinPortable(defaultStateDir, ELIZA_CONFIG_FILENAME),
|
|
257
|
+
},
|
|
258
|
+
].filter((candidate): candidate is NonNullable<typeof candidate> =>
|
|
259
|
+
Boolean(candidate),
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
return candidates.filter(
|
|
263
|
+
(candidate, index, all) =>
|
|
264
|
+
all.findIndex(
|
|
265
|
+
(other) =>
|
|
266
|
+
other.stateDir === candidate.stateDir &&
|
|
267
|
+
other.configPath === candidate.configPath,
|
|
268
|
+
) === index,
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export function inspectExistingElizaInstall(opts?: {
|
|
273
|
+
env?: NodeJS.ProcessEnv;
|
|
274
|
+
homedir?: string;
|
|
275
|
+
}): ExistingElizaInstallInfo {
|
|
276
|
+
const candidates = buildExistingElizaInstallCandidates(opts);
|
|
277
|
+
|
|
278
|
+
for (const candidate of candidates) {
|
|
279
|
+
const configExists = fs.existsSync(candidate.configPath);
|
|
280
|
+
const stateDirExists = fs.existsSync(candidate.stateDir);
|
|
281
|
+
const hasStateEntries =
|
|
282
|
+
stateDirExists && listStateEntries(candidate.stateDir).length > 0;
|
|
283
|
+
|
|
284
|
+
if (configExists || hasStateEntries) {
|
|
285
|
+
return {
|
|
286
|
+
detected: true,
|
|
287
|
+
stateDir: candidate.stateDir,
|
|
288
|
+
configPath: candidate.configPath,
|
|
289
|
+
configExists,
|
|
290
|
+
stateDirExists,
|
|
291
|
+
hasStateEntries,
|
|
292
|
+
source: candidate.source,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const fallback = candidates[0] ?? {
|
|
298
|
+
source: "default-state-dir" as const,
|
|
299
|
+
stateDir: joinPortable(
|
|
300
|
+
opts?.homedir ?? os.homedir(),
|
|
301
|
+
`.${resolveStateNamespace(opts?.env ?? process.env)}`,
|
|
302
|
+
),
|
|
303
|
+
configPath: joinPortable(
|
|
304
|
+
joinPortable(
|
|
305
|
+
opts?.homedir ?? os.homedir(),
|
|
306
|
+
`.${resolveStateNamespace(opts?.env ?? process.env)}`,
|
|
307
|
+
),
|
|
308
|
+
ELIZA_CONFIG_FILENAME,
|
|
309
|
+
),
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
return {
|
|
313
|
+
detected: false,
|
|
314
|
+
stateDir: fallback.stateDir,
|
|
315
|
+
configPath: fallback.configPath,
|
|
316
|
+
configExists: false,
|
|
317
|
+
stateDirExists: fs.existsSync(fallback.stateDir),
|
|
318
|
+
hasStateEntries: false,
|
|
319
|
+
source: fallback.source,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export function migrateDesktopStateDirFromPath(
|
|
324
|
+
fromPath: string,
|
|
325
|
+
opts?: { env?: NodeJS.ProcessEnv },
|
|
326
|
+
): StateDirMigrationResult {
|
|
327
|
+
const source = resolvePortablePath(fromPath);
|
|
328
|
+
const target = resolveDesktopChildStateDir({ env: opts?.env ?? process.env });
|
|
329
|
+
|
|
330
|
+
if (source === target) {
|
|
331
|
+
return {
|
|
332
|
+
ok: true,
|
|
333
|
+
migrated: false,
|
|
334
|
+
fromPath: source,
|
|
335
|
+
toPath: target,
|
|
336
|
+
skippedReason: "same-path",
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
try {
|
|
341
|
+
const stat = fs.statSync(source);
|
|
342
|
+
if (!stat.isDirectory()) {
|
|
343
|
+
return {
|
|
344
|
+
ok: true,
|
|
345
|
+
migrated: false,
|
|
346
|
+
fromPath: source,
|
|
347
|
+
toPath: target,
|
|
348
|
+
skippedReason: "source-not-directory",
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
} catch {
|
|
352
|
+
return {
|
|
353
|
+
ok: true,
|
|
354
|
+
migrated: false,
|
|
355
|
+
fromPath: source,
|
|
356
|
+
toPath: target,
|
|
357
|
+
skippedReason: "source-missing",
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
try {
|
|
362
|
+
fs.mkdirSync(target, { recursive: true });
|
|
363
|
+
fs.cpSync(source, target, {
|
|
364
|
+
recursive: true,
|
|
365
|
+
force: false,
|
|
366
|
+
errorOnExist: false,
|
|
367
|
+
dereference: false,
|
|
368
|
+
});
|
|
369
|
+
return {
|
|
370
|
+
ok: true,
|
|
371
|
+
migrated: true,
|
|
372
|
+
fromPath: source,
|
|
373
|
+
toPath: target,
|
|
374
|
+
};
|
|
375
|
+
} catch (err) {
|
|
376
|
+
return {
|
|
377
|
+
ok: false,
|
|
378
|
+
migrated: false,
|
|
379
|
+
fromPath: source,
|
|
380
|
+
toPath: target,
|
|
381
|
+
error: err instanceof Error ? err.message : String(err),
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// ---------------------------------------------------------------------------
|
|
387
|
+
// Diagnostic logging
|
|
388
|
+
// ---------------------------------------------------------------------------
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Resolve the platform-appropriate config directory for the desktop app.
|
|
392
|
+
* Windows: %APPDATA%\{configDirName} (e.g. C:\Users\X\AppData\Roaming\elizaOS)
|
|
393
|
+
* macOS/Linux: ~/.config/{configDirName}
|
|
394
|
+
*
|
|
395
|
+
* Exported for testability — accepts explicit overrides so tests don't need
|
|
396
|
+
* to mock process globals.
|
|
397
|
+
*/
|
|
398
|
+
export function resolveConfigDir(opts?: {
|
|
399
|
+
platform?: string;
|
|
400
|
+
appdata?: string;
|
|
401
|
+
homedir?: string;
|
|
402
|
+
}): string {
|
|
403
|
+
const platform = opts?.platform ?? process.platform;
|
|
404
|
+
const homedir = opts?.homedir ?? os.homedir();
|
|
405
|
+
const dirName = getBrandConfig().configDirName;
|
|
406
|
+
if (platform === "win32") {
|
|
407
|
+
const roaming =
|
|
408
|
+
opts?.appdata ??
|
|
409
|
+
process.env.APPDATA ??
|
|
410
|
+
joinPortable(homedir, "AppData", "Roaming");
|
|
411
|
+
return joinPortable(roaming, dirName);
|
|
412
|
+
}
|
|
413
|
+
return joinPortable(homedir, ".config", dirName);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
export function ensureDesktopApiToken(
|
|
417
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
418
|
+
): string {
|
|
419
|
+
const existingToken = resolveApiToken(env);
|
|
420
|
+
if (existingToken) {
|
|
421
|
+
setApiToken(env, existingToken);
|
|
422
|
+
return existingToken;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (resolveDisableAutoApiToken(env)) {
|
|
426
|
+
return "";
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const generated = crypto.randomBytes(16).toString("hex");
|
|
430
|
+
setApiToken(env, generated);
|
|
431
|
+
return generated;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export function configureDesktopLocalApiAuth(
|
|
435
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
436
|
+
): string {
|
|
437
|
+
const token = ensureDesktopApiToken(env);
|
|
438
|
+
env.ELIZA_PAIRING_DISABLED = "1";
|
|
439
|
+
return token;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function getDesktopApiToken(
|
|
443
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
444
|
+
): string | null {
|
|
445
|
+
return resolveApiToken(env);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function getDesktopApiHeaders(
|
|
449
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
450
|
+
): Record<string, string> | undefined {
|
|
451
|
+
const token = getDesktopApiToken(env);
|
|
452
|
+
if (!token) return undefined;
|
|
453
|
+
return {
|
|
454
|
+
Authorization: `Bearer ${token}`,
|
|
455
|
+
"X-Api-Key": token,
|
|
456
|
+
"X-Api-Token": token,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
let diagnosticLogPath: string | null = null;
|
|
461
|
+
let startupStatusPath: string | null = null;
|
|
462
|
+
|
|
463
|
+
export function getDiagnosticLogPath(): string {
|
|
464
|
+
if (diagnosticLogPath !== null) return diagnosticLogPath;
|
|
465
|
+
try {
|
|
466
|
+
const configDir = resolveConfigDir();
|
|
467
|
+
if (!fs.existsSync(configDir)) {
|
|
468
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
469
|
+
}
|
|
470
|
+
diagnosticLogPath = path.join(
|
|
471
|
+
configDir,
|
|
472
|
+
getBrandConfig().startupLogFileName,
|
|
473
|
+
);
|
|
474
|
+
} catch {
|
|
475
|
+
// Fallback to temp dir
|
|
476
|
+
diagnosticLogPath = path.join(
|
|
477
|
+
os.tmpdir(),
|
|
478
|
+
getBrandConfig().startupLogFileName,
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
return diagnosticLogPath;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export function getStartupStatusPath(): string {
|
|
485
|
+
if (startupStatusPath !== null) return startupStatusPath;
|
|
486
|
+
try {
|
|
487
|
+
const configDir = resolveConfigDir();
|
|
488
|
+
if (!fs.existsSync(configDir)) {
|
|
489
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
490
|
+
}
|
|
491
|
+
startupStatusPath = path.join(configDir, "startup-status.json");
|
|
492
|
+
} catch {
|
|
493
|
+
startupStatusPath = path.join(os.tmpdir(), "startup-status.json");
|
|
494
|
+
}
|
|
495
|
+
return startupStatusPath;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
export function diagnosticLog(message: string): void {
|
|
499
|
+
const timestamp = new Date().toISOString();
|
|
500
|
+
const line = `[${timestamp}] ${message}\n`;
|
|
501
|
+
console.log(message);
|
|
502
|
+
try {
|
|
503
|
+
const logPath = getDiagnosticLogPath();
|
|
504
|
+
fs.appendFileSync(logPath, line);
|
|
505
|
+
} catch {
|
|
506
|
+
// Ignore write errors
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** One-line, truncated error string safe for UI (status.error). */
|
|
511
|
+
function shortError(err: unknown, maxLen = 280): string {
|
|
512
|
+
const raw =
|
|
513
|
+
err instanceof Error
|
|
514
|
+
? err.message || (err.stack ?? String(err))
|
|
515
|
+
: String(err);
|
|
516
|
+
const oneLine = raw.replace(/\s+/g, " ").trim();
|
|
517
|
+
if (oneLine.length <= maxLen) return oneLine;
|
|
518
|
+
return `${oneLine.slice(0, maxLen)}... (see logs for full details)`;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
export function redactSensitiveDiagnostics(input: string): string {
|
|
522
|
+
return input
|
|
523
|
+
.replace(
|
|
524
|
+
/(authorization\s*[:=]\s*bearer\s+)([a-z0-9._-]+)/gi,
|
|
525
|
+
"$1[REDACTED]",
|
|
526
|
+
)
|
|
527
|
+
.replace(
|
|
528
|
+
/((?:x-api-key|x-api-token|api[_-]?key|bearer[_-]?token|access[_-]?token|secret|password)\s*[:=]\s*)([^\s]+)/gi,
|
|
529
|
+
"$1[REDACTED]",
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
function readFileTail(filePath: string, maxChars = 16_000): string {
|
|
534
|
+
try {
|
|
535
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
536
|
+
return redactSensitiveDiagnostics(content.slice(-maxChars));
|
|
537
|
+
} catch {
|
|
538
|
+
return "";
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
function writeStartupDiagnosticsSnapshot(
|
|
543
|
+
snapshot: StartupDiagnosticsSnapshot,
|
|
544
|
+
): void {
|
|
545
|
+
try {
|
|
546
|
+
fs.writeFileSync(
|
|
547
|
+
getStartupStatusPath(),
|
|
548
|
+
`${JSON.stringify(snapshot, null, 2)}\n`,
|
|
549
|
+
"utf8",
|
|
550
|
+
);
|
|
551
|
+
} catch {
|
|
552
|
+
// Ignore write errors
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export function getStartupDiagnosticsSnapshot(): StartupDiagnosticsSnapshot {
|
|
557
|
+
let parsed: Partial<StartupDiagnosticsSnapshot> | null = null;
|
|
558
|
+
try {
|
|
559
|
+
parsed = JSON.parse(
|
|
560
|
+
fs.readFileSync(getStartupStatusPath(), "utf8"),
|
|
561
|
+
) as Partial<StartupDiagnosticsSnapshot> | null;
|
|
562
|
+
} catch {
|
|
563
|
+
parsed = null;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
return {
|
|
567
|
+
state: parsed?.state ?? "not_started",
|
|
568
|
+
phase: parsed?.phase ?? "unknown",
|
|
569
|
+
updatedAt: parsed?.updatedAt ?? new Date().toISOString(),
|
|
570
|
+
lastError: parsed?.lastError ?? null,
|
|
571
|
+
agentName: parsed?.agentName ?? null,
|
|
572
|
+
port: parsed?.port ?? null,
|
|
573
|
+
startedAt: parsed?.startedAt ?? null,
|
|
574
|
+
platform: parsed?.platform ?? process.platform,
|
|
575
|
+
arch: parsed?.arch ?? process.arch,
|
|
576
|
+
configDir: parsed?.configDir ?? resolveConfigDir(),
|
|
577
|
+
logPath: parsed?.logPath ?? getDiagnosticLogPath(),
|
|
578
|
+
statusPath: parsed?.statusPath ?? getStartupStatusPath(),
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
export function getStartupDiagnosticLogTail(maxChars = 16_000): string {
|
|
583
|
+
return readFileTail(getDiagnosticLogPath(), maxChars);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
function sanitizeBugReportPrefix(prefix: string | undefined): string {
|
|
587
|
+
const trimmed = prefix?.trim();
|
|
588
|
+
if (!trimmed) return "bug-report";
|
|
589
|
+
|
|
590
|
+
const sanitized = trimmed
|
|
591
|
+
.replace(/[\\/]+/g, "-")
|
|
592
|
+
.replace(/\.\.+/g, "-")
|
|
593
|
+
.replace(/[^a-zA-Z0-9._-]+/g, "-")
|
|
594
|
+
.replace(/-+/g, "-")
|
|
595
|
+
.replace(/^[._-]+|[._-]+$/g, "")
|
|
596
|
+
.slice(0, 64);
|
|
597
|
+
|
|
598
|
+
return sanitized || "bug-report";
|
|
599
|
+
}
|
|
600
|
+
export function createBugReportBundle(options: {
|
|
601
|
+
reportMarkdown: string;
|
|
602
|
+
reportJson: Record<string, unknown>;
|
|
603
|
+
prefix?: string;
|
|
604
|
+
}): BugReportBundleResult {
|
|
605
|
+
const configDir = resolveConfigDir();
|
|
606
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
607
|
+
const prefix = sanitizeBugReportPrefix(options.prefix);
|
|
608
|
+
const directory = path.join(
|
|
609
|
+
configDir,
|
|
610
|
+
"bug-reports",
|
|
611
|
+
`${prefix}-${timestamp}`,
|
|
612
|
+
);
|
|
613
|
+
const reportMarkdownPath = path.join(directory, "report.md");
|
|
614
|
+
const reportJsonPath = path.join(directory, "report.json");
|
|
615
|
+
const logPath = getDiagnosticLogPath();
|
|
616
|
+
const statusPath = getStartupStatusPath();
|
|
617
|
+
const startupLogTarget = path.join(
|
|
618
|
+
directory,
|
|
619
|
+
getBrandConfig().startupLogFileName,
|
|
620
|
+
);
|
|
621
|
+
const startupStatusTarget = path.join(directory, "startup-status.json");
|
|
622
|
+
const startupDiagnostics = getStartupDiagnosticsSnapshot();
|
|
623
|
+
const includeLogTail =
|
|
624
|
+
typeof options.reportJson.attachLogs === "boolean"
|
|
625
|
+
? options.reportJson.attachLogs
|
|
626
|
+
: true;
|
|
627
|
+
const startupLogTail = includeLogTail ? getStartupDiagnosticLogTail() : "";
|
|
628
|
+
const normalizedReportJson = {
|
|
629
|
+
...options.reportJson,
|
|
630
|
+
startupDiagnostics,
|
|
631
|
+
startupLogTail,
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
635
|
+
fs.writeFileSync(reportMarkdownPath, options.reportMarkdown, "utf8");
|
|
636
|
+
fs.writeFileSync(
|
|
637
|
+
reportJsonPath,
|
|
638
|
+
`${JSON.stringify(normalizedReportJson, null, 2)}\n`,
|
|
639
|
+
"utf8",
|
|
640
|
+
);
|
|
641
|
+
|
|
642
|
+
let copiedLogPath: string | null = null;
|
|
643
|
+
let copiedStatusPath: string | null = null;
|
|
644
|
+
|
|
645
|
+
if (fs.existsSync(logPath)) {
|
|
646
|
+
fs.copyFileSync(logPath, startupLogTarget);
|
|
647
|
+
copiedLogPath = startupLogTarget;
|
|
648
|
+
}
|
|
649
|
+
if (fs.existsSync(statusPath)) {
|
|
650
|
+
fs.copyFileSync(statusPath, startupStatusTarget);
|
|
651
|
+
copiedStatusPath = startupStatusTarget;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
return {
|
|
655
|
+
directory,
|
|
656
|
+
reportMarkdownPath,
|
|
657
|
+
reportJsonPath,
|
|
658
|
+
startupLogPath: copiedLogPath,
|
|
659
|
+
startupStatusPath: copiedStatusPath,
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// ---------------------------------------------------------------------------
|
|
664
|
+
// Path resolution
|
|
665
|
+
// ---------------------------------------------------------------------------
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Resolve the runtime dist directory.
|
|
669
|
+
*
|
|
670
|
+
* Priority:
|
|
671
|
+
* 1. ELIZA_DIST_PATH / ELIZA_DIST_PATH env var (explicit override)
|
|
672
|
+
* 2. Walk up from import.meta.dir to find the runtime dist dir as a sibling
|
|
673
|
+
*/
|
|
674
|
+
export function getRuntimeDistFallbackCandidates(
|
|
675
|
+
moduleDir: string = getDefaultModuleDir(),
|
|
676
|
+
execPath: string = process.execPath,
|
|
677
|
+
): string[] {
|
|
678
|
+
const execDir = execPath ? dirnamePortable(execPath) : moduleDir;
|
|
679
|
+
const distDir = getBrandConfig().runtimeDistDirName;
|
|
680
|
+
|
|
681
|
+
return [
|
|
682
|
+
// macOS: inside .app bundle (Contents/Resources/app/<dist>)
|
|
683
|
+
resolveRelativePortable(execDir, `../Resources/app/${distDir}`),
|
|
684
|
+
// Windows NSIS/portable: resources/app/<dist> next to exe
|
|
685
|
+
resolveRelativePortable(execDir, `resources/app/${distDir}`),
|
|
686
|
+
resolveRelativePortable(execDir, `../resources/app/${distDir}`),
|
|
687
|
+
resolveRelativePortable(moduleDir, `app/${distDir}`),
|
|
688
|
+
resolveRelativePortable(moduleDir, `../${distDir}`),
|
|
689
|
+
resolveRelativePortable(moduleDir, `../app/${distDir}`),
|
|
690
|
+
resolveRelativePortable(moduleDir, `../../../${distDir}`),
|
|
691
|
+
// Legacy eliza-dist fallback for existing packaged builds
|
|
692
|
+
resolveRelativePortable(execDir, "../Resources/app/eliza-dist"),
|
|
693
|
+
resolveRelativePortable(execDir, "resources/app/eliza-dist"),
|
|
694
|
+
resolveRelativePortable(moduleDir, "../eliza-dist"),
|
|
695
|
+
resolveRelativePortable(moduleDir, "../../../eliza-dist"),
|
|
696
|
+
].filter((candidate, index, all) => all.indexOf(candidate) === index);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
export function isPackagedDesktopRuntime(
|
|
700
|
+
moduleDir: string = getDefaultModuleDir(),
|
|
701
|
+
execPath: string = process.execPath,
|
|
702
|
+
): boolean {
|
|
703
|
+
const normalizedModuleDir = moduleDir.replaceAll("\\", "/");
|
|
704
|
+
const normalizedExecPath = execPath.replaceAll("\\", "/").toLowerCase();
|
|
705
|
+
const looksLikePackagedExec =
|
|
706
|
+
normalizedExecPath.includes(".app/contents/") ||
|
|
707
|
+
normalizedExecPath.includes("/self-extraction/") ||
|
|
708
|
+
normalizedExecPath.endsWith("/launcher") ||
|
|
709
|
+
normalizedExecPath.endsWith("/launcher.exe");
|
|
710
|
+
if (process.env.ELIZA_DIST_PATH?.trim() && !looksLikePackagedExec) {
|
|
711
|
+
return false;
|
|
712
|
+
}
|
|
713
|
+
if (!normalizedModuleDir.includes("/src/")) {
|
|
714
|
+
return true;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
return looksLikePackagedExec;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
export function resolveBunExecutablePath(opts?: {
|
|
721
|
+
execPath?: string;
|
|
722
|
+
moduleDir?: string;
|
|
723
|
+
platform?: string;
|
|
724
|
+
}): string {
|
|
725
|
+
const execPath = opts?.execPath ?? process.execPath;
|
|
726
|
+
const moduleDir = opts?.moduleDir ?? getDefaultModuleDir();
|
|
727
|
+
const platform = opts?.platform ?? process.platform;
|
|
728
|
+
const packagedRuntime = isPackagedDesktopRuntime(moduleDir, execPath);
|
|
729
|
+
const looksLikeMacBundleExec = execPath.includes(".app/Contents/MacOS/");
|
|
730
|
+
const executableName =
|
|
731
|
+
platform === "win32" && !looksLikeMacBundleExec ? "bun.exe" : "bun";
|
|
732
|
+
const execDir = execPath ? dirnamePortable(execPath) : "";
|
|
733
|
+
const packagedCandidates = [
|
|
734
|
+
execPath,
|
|
735
|
+
execDir ? joinPortable(execDir, executableName) : "",
|
|
736
|
+
execDir
|
|
737
|
+
? resolveRelativePortable(
|
|
738
|
+
execDir,
|
|
739
|
+
`../Resources/app/bun/${executableName}`,
|
|
740
|
+
)
|
|
741
|
+
: "",
|
|
742
|
+
execDir
|
|
743
|
+
? resolveRelativePortable(
|
|
744
|
+
execDir,
|
|
745
|
+
`../Resources/app/bun/bin/${executableName}`,
|
|
746
|
+
)
|
|
747
|
+
: "",
|
|
748
|
+
moduleDir ? joinPortable(moduleDir, executableName) : "",
|
|
749
|
+
moduleDir ? joinPortable(moduleDir, "bin", executableName) : "",
|
|
750
|
+
moduleDir
|
|
751
|
+
? resolveRelativePortable(moduleDir, `../bun/${executableName}`)
|
|
752
|
+
: "",
|
|
753
|
+
moduleDir
|
|
754
|
+
? resolveRelativePortable(moduleDir, `../bun/bin/${executableName}`)
|
|
755
|
+
: "",
|
|
756
|
+
].filter(Boolean);
|
|
757
|
+
|
|
758
|
+
for (const candidate of packagedCandidates) {
|
|
759
|
+
if (!fs.existsSync(candidate)) continue;
|
|
760
|
+
if (
|
|
761
|
+
path.basename(candidate).toLowerCase() === executableName.toLowerCase()
|
|
762
|
+
) {
|
|
763
|
+
return candidate;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
if (packagedRuntime) {
|
|
768
|
+
return (
|
|
769
|
+
packagedCandidates.find(
|
|
770
|
+
(candidate) =>
|
|
771
|
+
path.basename(candidate).toLowerCase() ===
|
|
772
|
+
executableName.toLowerCase(),
|
|
773
|
+
) ?? executableName
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
const _candidates = [
|
|
778
|
+
execPath,
|
|
779
|
+
execDir ? joinPortable(execDir, executableName) : "",
|
|
780
|
+
].filter(Boolean);
|
|
781
|
+
|
|
782
|
+
const bunGlobal = Bun as { which?: (binary: string) => string | null };
|
|
783
|
+
const whichCandidate =
|
|
784
|
+
typeof bunGlobal.which === "function" ? bunGlobal.which("bun") : null;
|
|
785
|
+
if (whichCandidate) return whichCandidate;
|
|
786
|
+
|
|
787
|
+
// Windows: bun is not always on PATH; check well-known install locations.
|
|
788
|
+
if (process.platform === "win32") {
|
|
789
|
+
const localAppData =
|
|
790
|
+
process.env.LOCALAPPDATA ??
|
|
791
|
+
joinPortable(os.homedir(), "AppData", "Local");
|
|
792
|
+
const programFiles = process.env.ProgramFiles ?? "C:\\Program Files";
|
|
793
|
+
const winCandidates = [
|
|
794
|
+
joinPortable(localAppData, "bun", "bun.exe"),
|
|
795
|
+
joinPortable(programFiles, "bun", "bun.exe"),
|
|
796
|
+
joinPortable(os.homedir(), ".bun", "bin", "bun.exe"),
|
|
797
|
+
];
|
|
798
|
+
for (const candidate of winCandidates) {
|
|
799
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
return "bun";
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
export function resolveRuntimeDistPath(opts?: {
|
|
807
|
+
env?: NodeJS.ProcessEnv;
|
|
808
|
+
moduleDir?: string;
|
|
809
|
+
execPath?: string;
|
|
810
|
+
}): string {
|
|
811
|
+
const env = opts?.env ?? process.env;
|
|
812
|
+
const moduleDir = opts?.moduleDir ?? getDefaultModuleDir();
|
|
813
|
+
const execPath = opts?.execPath ?? process.execPath;
|
|
814
|
+
const packagedRuntime = isPackagedDesktopRuntime(moduleDir, execPath);
|
|
815
|
+
const distDir = getBrandConfig().runtimeDistDirName;
|
|
816
|
+
const fallbackCandidates = getRuntimeDistFallbackCandidates(
|
|
817
|
+
moduleDir,
|
|
818
|
+
execPath,
|
|
819
|
+
);
|
|
820
|
+
|
|
821
|
+
if (packagedRuntime) {
|
|
822
|
+
for (const candidate of fallbackCandidates) {
|
|
823
|
+
if (fs.existsSync(candidate)) {
|
|
824
|
+
return candidate;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
const fallback = fallbackCandidates[0];
|
|
828
|
+
diagnosticLog(
|
|
829
|
+
`[Agent] Could not find packaged runtime dist; using fallback: ${fallback}`,
|
|
830
|
+
);
|
|
831
|
+
return fallback;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// 1. Env override
|
|
835
|
+
const envPath = env.ELIZA_DIST_PATH;
|
|
836
|
+
if (envPath) {
|
|
837
|
+
const resolved = resolvePortablePath(envPath);
|
|
838
|
+
if (fs.existsSync(resolved)) {
|
|
839
|
+
return resolved;
|
|
840
|
+
}
|
|
841
|
+
diagnosticLog(
|
|
842
|
+
`[Agent] ELIZA_DIST_PATH set but does not exist: ${resolved}`,
|
|
843
|
+
);
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
// 2. Walk up from import.meta.dir looking for runtime dist or dev dist
|
|
847
|
+
let dir = moduleDir;
|
|
848
|
+
const maxDepth = 15;
|
|
849
|
+
for (let i = 0; i < maxDepth; i++) {
|
|
850
|
+
// Packaged: runtime dist sibling
|
|
851
|
+
const runtimeDist = joinPortable(dir, distDir);
|
|
852
|
+
if (fs.existsSync(runtimeDist)) {
|
|
853
|
+
return runtimeDist;
|
|
854
|
+
}
|
|
855
|
+
// Legacy eliza-dist sibling (existing packaged builds)
|
|
856
|
+
const legacyDist = joinPortable(dir, "eliza-dist");
|
|
857
|
+
if (fs.existsSync(legacyDist)) {
|
|
858
|
+
return legacyDist;
|
|
859
|
+
}
|
|
860
|
+
// Dev monorepo: dist/ sibling containing the canonical CLI entrypoint
|
|
861
|
+
const devDist = joinPortable(dir, "dist");
|
|
862
|
+
if (fs.existsSync(joinPortable(devDist, "entry.js"))) {
|
|
863
|
+
return devDist;
|
|
864
|
+
}
|
|
865
|
+
const parent = dirnamePortable(dir);
|
|
866
|
+
if (parent === dir) break; // reached filesystem root
|
|
867
|
+
dir = parent;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
// 3. Packaged/dev fallbacks derived from the launcher path and module dir.
|
|
871
|
+
for (const candidate of fallbackCandidates) {
|
|
872
|
+
if (fs.existsSync(candidate)) {
|
|
873
|
+
diagnosticLog(
|
|
874
|
+
`[Agent] Could not find runtime dist by walking up; using fallback: ${candidate}`,
|
|
875
|
+
);
|
|
876
|
+
return candidate;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
const fallback = fallbackCandidates[0];
|
|
881
|
+
diagnosticLog(
|
|
882
|
+
`[Agent] Could not find runtime dist by walking up; using fallback: ${fallback}`,
|
|
883
|
+
);
|
|
884
|
+
return fallback;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
export function buildChildNodePaths(
|
|
888
|
+
runtimeDistPath: string,
|
|
889
|
+
opts?: { packagedRuntime?: boolean },
|
|
890
|
+
): string[] {
|
|
891
|
+
const nodePaths = new Set<string>();
|
|
892
|
+
const distModules = joinPortable(runtimeDistPath, "node_modules");
|
|
893
|
+
if (fs.existsSync(distModules)) {
|
|
894
|
+
nodePaths.add(distModules);
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
if (opts?.packagedRuntime) {
|
|
898
|
+
return [...nodePaths];
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
let searchDir = runtimeDistPath;
|
|
902
|
+
while (searchDir !== dirnamePortable(searchDir)) {
|
|
903
|
+
const candidate = joinPortable(searchDir, "node_modules");
|
|
904
|
+
if (fs.existsSync(candidate) && candidate !== distModules) {
|
|
905
|
+
nodePaths.add(candidate);
|
|
906
|
+
break;
|
|
907
|
+
}
|
|
908
|
+
searchDir = dirnamePortable(searchDir);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
return [...nodePaths];
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
function resolveRuntimeEntryPath(runtimeDistPath: string): string | null {
|
|
915
|
+
const candidates = [joinPortable(runtimeDistPath, "entry.js")];
|
|
916
|
+
|
|
917
|
+
for (const candidate of candidates) {
|
|
918
|
+
if (fs.existsSync(candidate)) {
|
|
919
|
+
return candidate;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
return null;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// ---------------------------------------------------------------------------
|
|
927
|
+
// Health check polling
|
|
928
|
+
// ---------------------------------------------------------------------------
|
|
929
|
+
|
|
930
|
+
async function waitForHealthy(
|
|
931
|
+
getPort: () => number,
|
|
932
|
+
timeoutMs: number = getHealthPollTimeoutMs(),
|
|
933
|
+
childProcess?: BunSubprocess | null,
|
|
934
|
+
): Promise<boolean> {
|
|
935
|
+
const deadline = Date.now() + timeoutMs;
|
|
936
|
+
const headers = getDesktopApiHeaders();
|
|
937
|
+
|
|
938
|
+
while (Date.now() < deadline) {
|
|
939
|
+
// Bail early if the child process has already exited
|
|
940
|
+
if (childProcess && childProcess.exitCode !== null) {
|
|
941
|
+
return false;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
const port = getPort();
|
|
945
|
+
const url = `http://127.0.0.1:${port}/api/health`;
|
|
946
|
+
try {
|
|
947
|
+
const response = await fetch(url, {
|
|
948
|
+
headers,
|
|
949
|
+
signal: AbortSignal.timeout(2_000),
|
|
950
|
+
});
|
|
951
|
+
if (response.ok) {
|
|
952
|
+
const health = (await response.json().catch(() => null)) as {
|
|
953
|
+
ready?: boolean;
|
|
954
|
+
agentState?: string;
|
|
955
|
+
startup?: { phase?: string };
|
|
956
|
+
} | null;
|
|
957
|
+
if (!health) {
|
|
958
|
+
return true;
|
|
959
|
+
}
|
|
960
|
+
if (typeof health.ready === "boolean") {
|
|
961
|
+
if (health.ready) {
|
|
962
|
+
return true;
|
|
963
|
+
}
|
|
964
|
+
} else if (
|
|
965
|
+
health.agentState !== "starting" &&
|
|
966
|
+
health.agentState !== "restarting"
|
|
967
|
+
) {
|
|
968
|
+
return true;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
} catch {
|
|
972
|
+
// Server not ready yet
|
|
973
|
+
}
|
|
974
|
+
await Bun.sleep(HEALTH_POLL_INTERVAL_MS);
|
|
975
|
+
}
|
|
976
|
+
return false;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// ---------------------------------------------------------------------------
|
|
980
|
+
// Stdout watcher for "listening on port" detection
|
|
981
|
+
// ---------------------------------------------------------------------------
|
|
982
|
+
|
|
983
|
+
async function watchStdoutForReady(
|
|
984
|
+
stream: ReadableStream<Uint8Array>,
|
|
985
|
+
onLine: (line: string) => void,
|
|
986
|
+
signal: AbortSignal,
|
|
987
|
+
): Promise<void> {
|
|
988
|
+
const decoder = new TextDecoder();
|
|
989
|
+
let buffer = "";
|
|
990
|
+
|
|
991
|
+
try {
|
|
992
|
+
const reader = stream.getReader();
|
|
993
|
+
while (!signal.aborted) {
|
|
994
|
+
const { done, value } = await reader.read();
|
|
995
|
+
if (done) break;
|
|
996
|
+
|
|
997
|
+
buffer += decoder.decode(value, { stream: true });
|
|
998
|
+
const lines = buffer.split("\n");
|
|
999
|
+
buffer = lines.pop() ?? "";
|
|
1000
|
+
|
|
1001
|
+
for (const line of lines) {
|
|
1002
|
+
if (line.trim()) {
|
|
1003
|
+
onLine(line);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
// Flush remaining buffer
|
|
1008
|
+
if (buffer.trim()) {
|
|
1009
|
+
onLine(buffer);
|
|
1010
|
+
}
|
|
1011
|
+
reader.releaseLock();
|
|
1012
|
+
} catch (err) {
|
|
1013
|
+
if (!signal.aborted) {
|
|
1014
|
+
diagnosticLog(
|
|
1015
|
+
`[Agent] stdout watcher error: ${err instanceof Error ? err.message : String(err)}`,
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
async function drainStderrToLog(
|
|
1022
|
+
stream: ReadableStream<Uint8Array>,
|
|
1023
|
+
signal: AbortSignal,
|
|
1024
|
+
onLine?: (line: string) => void,
|
|
1025
|
+
): Promise<void> {
|
|
1026
|
+
const decoder = new TextDecoder();
|
|
1027
|
+
let buffer = "";
|
|
1028
|
+
|
|
1029
|
+
try {
|
|
1030
|
+
const reader = stream.getReader();
|
|
1031
|
+
while (!signal.aborted) {
|
|
1032
|
+
const { done, value } = await reader.read();
|
|
1033
|
+
if (done) break;
|
|
1034
|
+
|
|
1035
|
+
buffer += decoder.decode(value, { stream: true });
|
|
1036
|
+
const lines = buffer.split("\n");
|
|
1037
|
+
buffer = lines.pop() ?? "";
|
|
1038
|
+
|
|
1039
|
+
for (const line of lines) {
|
|
1040
|
+
if (line.trim()) {
|
|
1041
|
+
diagnosticLog(`[Agent][stderr] ${line}`);
|
|
1042
|
+
onLine?.(line);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
if (buffer.trim()) {
|
|
1047
|
+
diagnosticLog(`[Agent][stderr] ${buffer}`);
|
|
1048
|
+
onLine?.(buffer);
|
|
1049
|
+
}
|
|
1050
|
+
reader.releaseLock();
|
|
1051
|
+
} catch (err) {
|
|
1052
|
+
if (!signal.aborted) {
|
|
1053
|
+
diagnosticLog(
|
|
1054
|
+
`[Agent] stderr drain error: ${err instanceof Error ? err.message : String(err)}`,
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
const PGLITE_LOCK_RE =
|
|
1061
|
+
/pglite data dir is already in use|database is locked|lock file already exists/i;
|
|
1062
|
+
const PGLITE_RECOVERY_RE =
|
|
1063
|
+
/failed query:\s*(?:create schema if not exists|create table if not exists life_)|aborted\(\)\. build with -sassertions|database disk image is malformed|file is not a database|malformed database schema|checksum mismatch|checkpoint failed|wal file/i;
|
|
1064
|
+
|
|
1065
|
+
function shouldAutoRecoverPgliteFailure(line: string): boolean {
|
|
1066
|
+
if (PGLITE_LOCK_RE.test(line)) {
|
|
1067
|
+
return false;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
return (
|
|
1071
|
+
PGLITE_RECOVERY_RE.test(line) ||
|
|
1072
|
+
(/corrupt/i.test(line) && /pglite|sqlite/i.test(line))
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Opt-in: kill processes listening on `port` (lsof + SIGKILL). Default off so a
|
|
1078
|
+
* second desktop instance can coexist on the same machine when ports differ.
|
|
1079
|
+
* Set ELIZA_AGENT_RECLAIM_STALE_PORT=1 (legacy: ELIZA_AGENT_RECLAIM_STALE_PORT)
|
|
1080
|
+
* to restore the old “take over default port” behavior.
|
|
1081
|
+
*/
|
|
1082
|
+
async function maybeReclaimPortWithSigkill(port: number): Promise<void> {
|
|
1083
|
+
const raw = process.env.ELIZA_AGENT_RECLAIM_STALE_PORT?.trim().toLowerCase();
|
|
1084
|
+
if (raw !== "1" && raw !== "true" && raw !== "yes") {
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
try {
|
|
1088
|
+
const lsofResult = Bun.spawnSync(["lsof", "-ti", `tcp:${port}`]);
|
|
1089
|
+
const pids = new TextDecoder()
|
|
1090
|
+
.decode(lsofResult.stdout)
|
|
1091
|
+
.trim()
|
|
1092
|
+
.split("\n")
|
|
1093
|
+
.filter(Boolean);
|
|
1094
|
+
for (const pid of pids) {
|
|
1095
|
+
const numPid = parseInt(pid, 10);
|
|
1096
|
+
if (!Number.isNaN(numPid) && numPid !== process.pid) {
|
|
1097
|
+
diagnosticLog(
|
|
1098
|
+
`[Agent] Reclaim: killing process ${numPid} on port ${port} (ELIZA_AGENT_RECLAIM_STALE_PORT)`,
|
|
1099
|
+
);
|
|
1100
|
+
try {
|
|
1101
|
+
process.kill(numPid, "SIGKILL");
|
|
1102
|
+
} catch {
|
|
1103
|
+
// Process may have already exited
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
if (pids.length > 0) {
|
|
1108
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
1109
|
+
}
|
|
1110
|
+
} catch {
|
|
1111
|
+
// lsof missing — ignore
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
function resolvePgliteDataDir(): string {
|
|
1116
|
+
return joinPortable(
|
|
1117
|
+
os.homedir(),
|
|
1118
|
+
`.${getBrandConfig().namespace}`,
|
|
1119
|
+
"workspace",
|
|
1120
|
+
".eliza",
|
|
1121
|
+
".elizadb",
|
|
1122
|
+
);
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Removes only the PGLite database folder (agent memory / conversations).
|
|
1127
|
+
* GGUF embedding weights live under `MODELS_DIR` / `~/.eliza/models` by default — never deleted here.
|
|
1128
|
+
*/
|
|
1129
|
+
function deletePgliteDataDir(): void {
|
|
1130
|
+
const dir = resolvePgliteDataDir();
|
|
1131
|
+
if (path.basename(dir) !== ".elizadb") {
|
|
1132
|
+
diagnosticLog(
|
|
1133
|
+
`[Agent] deletePgliteDataDir: refused — basename must be .elizadb, got: ${dir}`,
|
|
1134
|
+
);
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
try {
|
|
1138
|
+
if (fs.existsSync(dir)) {
|
|
1139
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
1140
|
+
diagnosticLog(
|
|
1141
|
+
`[Agent] Deleted PGLite data dir (GGUF model cache elsewhere): ${dir}`,
|
|
1142
|
+
);
|
|
1143
|
+
}
|
|
1144
|
+
} catch (err) {
|
|
1145
|
+
diagnosticLog(
|
|
1146
|
+
`[Agent] Failed to delete PGLite data dir: ${err instanceof Error ? err.message : String(err)}`,
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// ---------------------------------------------------------------------------
|
|
1152
|
+
// AgentManager -- singleton
|
|
1153
|
+
// ---------------------------------------------------------------------------
|
|
1154
|
+
|
|
1155
|
+
export class AgentManager {
|
|
1156
|
+
private sendToWebview: SendToWebview | null = null;
|
|
1157
|
+
private readonly statusListeners = new Set<
|
|
1158
|
+
(status: Readonly<AgentStatus>) => void
|
|
1159
|
+
>();
|
|
1160
|
+
private status: AgentStatus = {
|
|
1161
|
+
state: "not_started",
|
|
1162
|
+
agentName: null,
|
|
1163
|
+
port: null,
|
|
1164
|
+
startedAt: null,
|
|
1165
|
+
error: null,
|
|
1166
|
+
};
|
|
1167
|
+
private childProcess: BunSubprocess | null = null;
|
|
1168
|
+
private stdioAbortController: AbortController | null = null;
|
|
1169
|
+
private hasPgliteError = false;
|
|
1170
|
+
private pgliteRecoveryDone = false;
|
|
1171
|
+
private startupPhase = "not_started";
|
|
1172
|
+
|
|
1173
|
+
constructor() {
|
|
1174
|
+
this.persistStartupDiagnostics();
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
setSendToWebview(fn: SendToWebview): void {
|
|
1178
|
+
this.sendToWebview = fn;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
onStatusChange(
|
|
1182
|
+
listener: (status: Readonly<AgentStatus>) => void,
|
|
1183
|
+
): () => void {
|
|
1184
|
+
this.statusListeners.add(listener);
|
|
1185
|
+
return () => {
|
|
1186
|
+
this.statusListeners.delete(listener);
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
/** Start the agent runtime as a child process. Idempotent. */
|
|
1191
|
+
async start(): Promise<AgentStatus> {
|
|
1192
|
+
recordStartupPhase("agent_start_entered", {
|
|
1193
|
+
pid: process.pid,
|
|
1194
|
+
exec_path: process.execPath,
|
|
1195
|
+
bundle_path: resolveStartupBundlePath(process.execPath),
|
|
1196
|
+
});
|
|
1197
|
+
this.setStartupPhase("start_requested");
|
|
1198
|
+
recordStartupPhase("agent_start_entered", {
|
|
1199
|
+
pid: process.pid,
|
|
1200
|
+
exec_path: process.execPath,
|
|
1201
|
+
bundle_path: resolveStartupBundlePath(process.execPath),
|
|
1202
|
+
});
|
|
1203
|
+
diagnosticLog(
|
|
1204
|
+
`[Agent] start() called, current state: ${this.status.state}`,
|
|
1205
|
+
);
|
|
1206
|
+
diagnosticLog(`[Agent] Diagnostic log file: ${getDiagnosticLogPath()}`);
|
|
1207
|
+
|
|
1208
|
+
if (this.status.state === "running" || this.status.state === "starting") {
|
|
1209
|
+
return this.status;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
const runtimeMode = resolveDesktopRuntimeMode(
|
|
1213
|
+
process.env as Record<string, string | undefined>,
|
|
1214
|
+
);
|
|
1215
|
+
if (runtimeMode.mode !== "local") {
|
|
1216
|
+
const reason =
|
|
1217
|
+
runtimeMode.mode === "external"
|
|
1218
|
+
? `Embedded desktop runtime is disabled because ${runtimeMode.externalApi.source} points at ${runtimeMode.externalApi.base}.`
|
|
1219
|
+
: "Embedded desktop runtime is disabled by ELIZA_DESKTOP_SKIP_EMBEDDED_AGENT=1.";
|
|
1220
|
+
diagnosticLog(`[Agent] ${reason}`);
|
|
1221
|
+
this.setStartupPhase("startup_disabled", reason);
|
|
1222
|
+
throw new Error(reason);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
let packagedRuntime: boolean;
|
|
1226
|
+
let apiPort: number;
|
|
1227
|
+
let preferredPort: number;
|
|
1228
|
+
try {
|
|
1229
|
+
configureDesktopLocalApiAuth();
|
|
1230
|
+
packagedRuntime = isPackagedDesktopRuntime();
|
|
1231
|
+
|
|
1232
|
+
// Reset per-startup flags
|
|
1233
|
+
this.pgliteRecoveryDone = false;
|
|
1234
|
+
|
|
1235
|
+
// Clean up any stale process before starting
|
|
1236
|
+
if (this.childProcess) {
|
|
1237
|
+
await this.killChildProcess();
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
preferredPort = resolveDesktopApiPort(process.env) || DEFAULT_API_PORT;
|
|
1241
|
+
diagnosticLog(
|
|
1242
|
+
`[Agent] Preferred port: ${preferredPort} (packaged: ${packagedRuntime})`,
|
|
1243
|
+
);
|
|
1244
|
+
if (!packagedRuntime) {
|
|
1245
|
+
await maybeReclaimPortWithSigkill(preferredPort);
|
|
1246
|
+
}
|
|
1247
|
+
apiPort = await findFirstAvailableLoopbackPort(preferredPort);
|
|
1248
|
+
} catch (err) {
|
|
1249
|
+
const msg =
|
|
1250
|
+
err instanceof Error ? err.message : "Failed during pre-startup";
|
|
1251
|
+
diagnosticLog(`[Agent] ${msg}`);
|
|
1252
|
+
this.status = {
|
|
1253
|
+
state: "error",
|
|
1254
|
+
agentName: null,
|
|
1255
|
+
port: null,
|
|
1256
|
+
startedAt: null,
|
|
1257
|
+
error: msg,
|
|
1258
|
+
};
|
|
1259
|
+
recordStartupPhase("fatal", {
|
|
1260
|
+
port: null,
|
|
1261
|
+
error: msg,
|
|
1262
|
+
});
|
|
1263
|
+
this.setStartupPhase("port_allocation_failed", msg);
|
|
1264
|
+
this.emitStatus();
|
|
1265
|
+
return this.status;
|
|
1266
|
+
}
|
|
1267
|
+
if (apiPort !== preferredPort) {
|
|
1268
|
+
diagnosticLog(
|
|
1269
|
+
`[Agent] Port ${preferredPort} busy — using ${apiPort} for embedded API (set ELIZA_AGENT_RECLAIM_STALE_PORT=1 to try reclaiming the preferred port first)`,
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
recordStartupPhase("port_selected", {
|
|
1273
|
+
port: apiPort,
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
this.status = {
|
|
1277
|
+
state: "starting",
|
|
1278
|
+
agentName: null,
|
|
1279
|
+
port: null,
|
|
1280
|
+
startedAt: null,
|
|
1281
|
+
error: null,
|
|
1282
|
+
};
|
|
1283
|
+
this.setStartupPhase("starting_runtime");
|
|
1284
|
+
this.emitStatus();
|
|
1285
|
+
|
|
1286
|
+
try {
|
|
1287
|
+
// Resolve the bundled runtime dist path.
|
|
1288
|
+
this.setStartupPhase("resolving_runtime");
|
|
1289
|
+
const runtimeDistPath = resolveRuntimeDistPath();
|
|
1290
|
+
diagnosticLog(`[Agent] Resolved runtime dist: ${runtimeDistPath}`);
|
|
1291
|
+
|
|
1292
|
+
// Packaged builds can expose the runnable entry either at the dist root
|
|
1293
|
+
// or under runtime/. Prefer the root file but accept both layouts.
|
|
1294
|
+
const runtimeEntryPath = resolveRuntimeEntryPath(runtimeDistPath);
|
|
1295
|
+
if (!runtimeEntryPath) {
|
|
1296
|
+
const distExists = fs.existsSync(runtimeDistPath);
|
|
1297
|
+
let contents = "<directory missing>";
|
|
1298
|
+
if (distExists) {
|
|
1299
|
+
try {
|
|
1300
|
+
contents = fs.readdirSync(runtimeDistPath).join(", ");
|
|
1301
|
+
} catch {
|
|
1302
|
+
contents = "<unreadable>";
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
const errMsg = `No runnable runtime entry found in ${runtimeDistPath} (checked entry.js; dist exists: ${distExists}, contents: ${contents})`;
|
|
1306
|
+
diagnosticLog(`[Agent] ${errMsg}`);
|
|
1307
|
+
this.status = {
|
|
1308
|
+
state: "error",
|
|
1309
|
+
agentName: null,
|
|
1310
|
+
port: null,
|
|
1311
|
+
startedAt: null,
|
|
1312
|
+
error: errMsg,
|
|
1313
|
+
};
|
|
1314
|
+
recordStartupPhase("fatal", {
|
|
1315
|
+
port: apiPort,
|
|
1316
|
+
error: errMsg,
|
|
1317
|
+
});
|
|
1318
|
+
this.setStartupPhase("runtime_entry_missing", errMsg);
|
|
1319
|
+
recordStartupPhase("fatal", {
|
|
1320
|
+
port: apiPort,
|
|
1321
|
+
error: errMsg,
|
|
1322
|
+
});
|
|
1323
|
+
this.emitStatus();
|
|
1324
|
+
return this.status;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
diagnosticLog(`[Agent] runtime entry: exists (${runtimeEntryPath})`);
|
|
1328
|
+
recordStartupPhase("runtime_path_resolved", {
|
|
1329
|
+
port: apiPort,
|
|
1330
|
+
});
|
|
1331
|
+
|
|
1332
|
+
diagnosticLog(`[Agent] Starting child process on port ${apiPort}...`);
|
|
1333
|
+
this.setStartupPhase("spawning_runtime");
|
|
1334
|
+
|
|
1335
|
+
// Build NODE_PATH so the child can find node_modules
|
|
1336
|
+
const nodePaths = buildChildNodePaths(runtimeDistPath, {
|
|
1337
|
+
packagedRuntime,
|
|
1338
|
+
});
|
|
1339
|
+
if (packagedRuntime && nodePaths.length === 0) {
|
|
1340
|
+
const errMsg =
|
|
1341
|
+
`Packaged runtime is missing bundle-local node_modules under ${runtimeDistPath}; ` +
|
|
1342
|
+
"refusing to inherit the parent NODE_PATH";
|
|
1343
|
+
diagnosticLog(`[Agent] ${errMsg}`);
|
|
1344
|
+
this.status = {
|
|
1345
|
+
state: "error",
|
|
1346
|
+
agentName: null,
|
|
1347
|
+
port: apiPort,
|
|
1348
|
+
startedAt: null,
|
|
1349
|
+
error: errMsg,
|
|
1350
|
+
};
|
|
1351
|
+
recordStartupPhase("fatal", {
|
|
1352
|
+
port: apiPort,
|
|
1353
|
+
error: errMsg,
|
|
1354
|
+
});
|
|
1355
|
+
this.emitStatus();
|
|
1356
|
+
return this.status;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
const childEnv: Record<string, string> = {
|
|
1360
|
+
...(process.env as Record<string, string>),
|
|
1361
|
+
ELIZA_API_PORT: String(apiPort),
|
|
1362
|
+
ELIZA_PORT: String(apiPort),
|
|
1363
|
+
};
|
|
1364
|
+
childEnv.ELIZA_NAMESPACE =
|
|
1365
|
+
childEnv.ELIZA_NAMESPACE?.trim() || getBrandConfig().namespace;
|
|
1366
|
+
childEnv.ELIZA_NAMESPACE =
|
|
1367
|
+
childEnv.ELIZA_NAMESPACE?.trim() || childEnv.ELIZA_NAMESPACE;
|
|
1368
|
+
applyDesktopChildStateEnv(childEnv);
|
|
1369
|
+
delete childEnv.ELIZA_PORT;
|
|
1370
|
+
delete childEnv.NODE_PATH;
|
|
1371
|
+
|
|
1372
|
+
// node-llama-cpp crashes Bun on Windows during packaged startup.
|
|
1373
|
+
// Disable local embeddings until upstream fix lands.
|
|
1374
|
+
if (process.platform === "win32") {
|
|
1375
|
+
childEnv.ELIZA_DISABLE_LOCAL_EMBEDDINGS = "1";
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
// Propagate PGlite data dir from parent env so CI/smoke test overrides
|
|
1379
|
+
// (e.g. a short Windows path avoiding MAX_PATH issues) reach the runtime.
|
|
1380
|
+
if (process.env.PGLITE_DATA_DIR) {
|
|
1381
|
+
childEnv.PGLITE_DATA_DIR = process.env.PGLITE_DATA_DIR;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
if (nodePaths.length > 0) {
|
|
1385
|
+
childEnv.NODE_PATH = nodePaths.join(path.delimiter);
|
|
1386
|
+
diagnosticLog(`[Agent] Child NODE_PATH: ${childEnv.NODE_PATH}`);
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
const bunExecutable = resolveBunExecutablePath();
|
|
1390
|
+
diagnosticLog(`[Agent] Using Bun executable: ${bunExecutable}`);
|
|
1391
|
+
diagnosticLog(
|
|
1392
|
+
`[Agent] Bun exists on disk: ${fs.existsSync(bunExecutable)}`,
|
|
1393
|
+
);
|
|
1394
|
+
|
|
1395
|
+
// Ensure bun's directory is on PATH so child_process.exec calls
|
|
1396
|
+
// (e.g. plugin-manager running `bun add ...`) can find it.
|
|
1397
|
+
const bunDir = path.dirname(bunExecutable);
|
|
1398
|
+
const existingPath = childEnv.PATH ?? "";
|
|
1399
|
+
if (!existingPath.split(path.delimiter).includes(bunDir)) {
|
|
1400
|
+
childEnv.PATH = bunDir + path.delimiter + existingPath;
|
|
1401
|
+
diagnosticLog(`[Agent] Prepended bun dir to child PATH: ${bunDir}`);
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
// Spawn the child process
|
|
1405
|
+
const spawnTime = Date.now();
|
|
1406
|
+
const proc = Bun.spawn(
|
|
1407
|
+
[bunExecutable, "run", runtimeEntryPath, "start"],
|
|
1408
|
+
{
|
|
1409
|
+
cwd: runtimeDistPath,
|
|
1410
|
+
env: childEnv,
|
|
1411
|
+
stdout: "pipe",
|
|
1412
|
+
stderr: "pipe",
|
|
1413
|
+
},
|
|
1414
|
+
);
|
|
1415
|
+
|
|
1416
|
+
this.childProcess = proc;
|
|
1417
|
+
diagnosticLog(
|
|
1418
|
+
`[Agent] Child spawned pid=${proc.pid} elapsed=${Date.now() - spawnTime}ms`,
|
|
1419
|
+
);
|
|
1420
|
+
recordStartupPhase("child_spawned", {
|
|
1421
|
+
port: apiPort,
|
|
1422
|
+
child_pid: proc.pid,
|
|
1423
|
+
});
|
|
1424
|
+
|
|
1425
|
+
// Set up abort controller for stdio watchers
|
|
1426
|
+
this.stdioAbortController = new AbortController();
|
|
1427
|
+
const { signal } = this.stdioAbortController;
|
|
1428
|
+
|
|
1429
|
+
// Surface the port immediately while waiting for ready
|
|
1430
|
+
this.status = {
|
|
1431
|
+
...this.status,
|
|
1432
|
+
port: apiPort,
|
|
1433
|
+
};
|
|
1434
|
+
this.emitStatus();
|
|
1435
|
+
|
|
1436
|
+
// Track whether we detected the "listening" message from stdout
|
|
1437
|
+
let detectedListening = false;
|
|
1438
|
+
|
|
1439
|
+
// Watch stdout for "listening on port" or similar ready messages
|
|
1440
|
+
if (proc.stdout) {
|
|
1441
|
+
watchStdoutForReady(
|
|
1442
|
+
proc.stdout,
|
|
1443
|
+
(line: string) => {
|
|
1444
|
+
diagnosticLog(`[Agent][stdout] ${line}`);
|
|
1445
|
+
const lower = line.toLowerCase();
|
|
1446
|
+
// Parse dynamic port from "[eliza-api] Listening on http://host:PORT"
|
|
1447
|
+
const portMatch = line.match(
|
|
1448
|
+
/Listening on https?:\/\/[^:]+:(\d+)/i,
|
|
1449
|
+
);
|
|
1450
|
+
if (portMatch) {
|
|
1451
|
+
const parsedPort = parseInt(portMatch[1], 10);
|
|
1452
|
+
if (!Number.isNaN(parsedPort) && parsedPort > 0) {
|
|
1453
|
+
if (parsedPort !== apiPort) {
|
|
1454
|
+
diagnosticLog(
|
|
1455
|
+
`[Agent] Server bound to dynamic port ${parsedPort} (requested ${apiPort})`,
|
|
1456
|
+
);
|
|
1457
|
+
apiPort = parsedPort;
|
|
1458
|
+
}
|
|
1459
|
+
detectedListening = true;
|
|
1460
|
+
}
|
|
1461
|
+
} else if (
|
|
1462
|
+
lower.includes("listening on port") ||
|
|
1463
|
+
lower.includes("server started") ||
|
|
1464
|
+
lower.includes("ready on")
|
|
1465
|
+
) {
|
|
1466
|
+
detectedListening = true;
|
|
1467
|
+
}
|
|
1468
|
+
// Update status port so callers see the actual bound port
|
|
1469
|
+
this.status = { ...this.status, port: apiPort };
|
|
1470
|
+
this.emitStatus();
|
|
1471
|
+
},
|
|
1472
|
+
signal,
|
|
1473
|
+
).catch(() => {
|
|
1474
|
+
// Stream ended or aborted -- expected on shutdown
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
// Drain stderr to diagnostic log; detect PGLite migration failures
|
|
1479
|
+
this.hasPgliteError = false;
|
|
1480
|
+
if (proc.stderr) {
|
|
1481
|
+
drainStderrToLog(proc.stderr, signal, (line) => {
|
|
1482
|
+
if (shouldAutoRecoverPgliteFailure(line)) {
|
|
1483
|
+
this.hasPgliteError = true;
|
|
1484
|
+
}
|
|
1485
|
+
}).catch(() => {
|
|
1486
|
+
// Stream ended or aborted -- expected on shutdown
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
// Monitor child process exit
|
|
1491
|
+
this.monitorChildExit(proc);
|
|
1492
|
+
|
|
1493
|
+
// Wait for the health endpoint to respond
|
|
1494
|
+
// Use a getter so the health check follows dynamic port reassignment from stdout
|
|
1495
|
+
diagnosticLog(
|
|
1496
|
+
`[Agent] Waiting for health endpoint at http://127.0.0.1:${apiPort}/api/health ...`,
|
|
1497
|
+
);
|
|
1498
|
+
this.setStartupPhase("waiting_for_health");
|
|
1499
|
+
const healthPollTimeoutMs = getHealthPollTimeoutMs();
|
|
1500
|
+
const healthy = await waitForHealthy(
|
|
1501
|
+
() => apiPort,
|
|
1502
|
+
healthPollTimeoutMs,
|
|
1503
|
+
proc,
|
|
1504
|
+
);
|
|
1505
|
+
|
|
1506
|
+
if (!healthy) {
|
|
1507
|
+
// Check if process already exited
|
|
1508
|
+
if (proc.exitCode !== null) {
|
|
1509
|
+
const errMsg = `Child process exited with code ${proc.exitCode} before becoming healthy`;
|
|
1510
|
+
diagnosticLog(`[Agent] ${errMsg}`);
|
|
1511
|
+
this.childProcess = null;
|
|
1512
|
+
this.status = {
|
|
1513
|
+
state: "error",
|
|
1514
|
+
agentName: null,
|
|
1515
|
+
port: apiPort,
|
|
1516
|
+
startedAt: null,
|
|
1517
|
+
error: errMsg,
|
|
1518
|
+
};
|
|
1519
|
+
recordStartupPhase("fatal", {
|
|
1520
|
+
port: apiPort,
|
|
1521
|
+
child_pid: proc.pid,
|
|
1522
|
+
error: errMsg,
|
|
1523
|
+
exit_code: proc.exitCode,
|
|
1524
|
+
});
|
|
1525
|
+
this.setStartupPhase("startup_failed", errMsg);
|
|
1526
|
+
recordStartupPhase("fatal", {
|
|
1527
|
+
port: apiPort,
|
|
1528
|
+
child_pid: proc.pid,
|
|
1529
|
+
error: errMsg,
|
|
1530
|
+
exit_code: proc.exitCode,
|
|
1531
|
+
});
|
|
1532
|
+
this.emitStatus();
|
|
1533
|
+
return this.status;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
const errMsg = detectedListening
|
|
1537
|
+
? "Server reported listening but health check timed out"
|
|
1538
|
+
: `Health check timed out after ${healthPollTimeoutMs}ms`;
|
|
1539
|
+
diagnosticLog(`[Agent] ${errMsg}`);
|
|
1540
|
+
this.status = {
|
|
1541
|
+
state: "error",
|
|
1542
|
+
agentName: null,
|
|
1543
|
+
port: apiPort,
|
|
1544
|
+
startedAt: null,
|
|
1545
|
+
error: errMsg,
|
|
1546
|
+
};
|
|
1547
|
+
recordStartupPhase("fatal", {
|
|
1548
|
+
port: apiPort,
|
|
1549
|
+
child_pid: proc.pid,
|
|
1550
|
+
error: errMsg,
|
|
1551
|
+
});
|
|
1552
|
+
this.setStartupPhase("startup_failed", errMsg);
|
|
1553
|
+
recordStartupPhase("fatal", {
|
|
1554
|
+
port: apiPort,
|
|
1555
|
+
child_pid: proc.pid,
|
|
1556
|
+
error: errMsg,
|
|
1557
|
+
});
|
|
1558
|
+
this.emitStatus();
|
|
1559
|
+
return this.status;
|
|
1560
|
+
}
|
|
1561
|
+
recordStartupPhase("health_ready", {
|
|
1562
|
+
port: apiPort,
|
|
1563
|
+
child_pid: proc.pid,
|
|
1564
|
+
});
|
|
1565
|
+
|
|
1566
|
+
this.setStartupPhase("fetching_agent_metadata");
|
|
1567
|
+
const startedAt = Date.now();
|
|
1568
|
+
const startupMs = startedAt - spawnTime;
|
|
1569
|
+
|
|
1570
|
+
this.status = {
|
|
1571
|
+
state: "running",
|
|
1572
|
+
agentName: getBrandConfig().appName,
|
|
1573
|
+
port: apiPort,
|
|
1574
|
+
startedAt,
|
|
1575
|
+
error: null,
|
|
1576
|
+
};
|
|
1577
|
+
this.setStartupPhase("ready", null);
|
|
1578
|
+
this.emitStatus();
|
|
1579
|
+
diagnosticLog(
|
|
1580
|
+
`[Agent] Runtime ready -- port: ${apiPort}, pid: ${proc.pid}, startup_ms: ${startupMs}`,
|
|
1581
|
+
);
|
|
1582
|
+
recordStartupPhase("runtime_ready", {
|
|
1583
|
+
port: apiPort,
|
|
1584
|
+
child_pid: proc.pid,
|
|
1585
|
+
});
|
|
1586
|
+
void this.refreshAgentMetadata(proc, apiPort, startupMs);
|
|
1587
|
+
return this.status;
|
|
1588
|
+
} catch (err) {
|
|
1589
|
+
const errMsg =
|
|
1590
|
+
err instanceof Error ? err.stack || err.message : String(err);
|
|
1591
|
+
diagnosticLog(`[Agent] Failed to start: ${errMsg}`);
|
|
1592
|
+
recordStartupPhase("fatal", {
|
|
1593
|
+
port: this.status.port,
|
|
1594
|
+
error: errMsg,
|
|
1595
|
+
});
|
|
1596
|
+
|
|
1597
|
+
// Clean up child if it was spawned
|
|
1598
|
+
if (this.childProcess) {
|
|
1599
|
+
await this.killChildProcess();
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
this.status = {
|
|
1603
|
+
state: "error",
|
|
1604
|
+
agentName: null,
|
|
1605
|
+
port: this.status.port, // preserve port if set
|
|
1606
|
+
startedAt: null,
|
|
1607
|
+
error: shortError(err),
|
|
1608
|
+
};
|
|
1609
|
+
this.setStartupPhase("startup_failed", shortError(err));
|
|
1610
|
+
this.emitStatus();
|
|
1611
|
+
return this.status;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
/** Stop the agent runtime. */
|
|
1616
|
+
async stop(): Promise<void> {
|
|
1617
|
+
if (this.status.state !== "running" && this.status.state !== "starting") {
|
|
1618
|
+
return;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
diagnosticLog("[Agent] Stopping...");
|
|
1622
|
+
this.setStartupPhase("stopping");
|
|
1623
|
+
|
|
1624
|
+
// Abort stdio watchers
|
|
1625
|
+
if (this.stdioAbortController) {
|
|
1626
|
+
this.stdioAbortController.abort();
|
|
1627
|
+
this.stdioAbortController = null;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
await this.killChildProcess();
|
|
1631
|
+
|
|
1632
|
+
this.status = {
|
|
1633
|
+
state: "stopped",
|
|
1634
|
+
agentName: this.status.agentName,
|
|
1635
|
+
port: null,
|
|
1636
|
+
startedAt: null,
|
|
1637
|
+
error: null,
|
|
1638
|
+
};
|
|
1639
|
+
this.setStartupPhase("stopped", null);
|
|
1640
|
+
this.emitStatus();
|
|
1641
|
+
diagnosticLog("[Agent] Runtime stopped");
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
/**
|
|
1645
|
+
* Restart the agent runtime -- stops the current instance and starts a
|
|
1646
|
+
* fresh one, picking up config/plugin changes.
|
|
1647
|
+
*/
|
|
1648
|
+
async restart(): Promise<AgentStatus> {
|
|
1649
|
+
diagnosticLog("[Agent] Restart requested -- stopping current runtime...");
|
|
1650
|
+
this.setStartupPhase("restart_requested");
|
|
1651
|
+
await this.stop();
|
|
1652
|
+
diagnosticLog("[Agent] Restarting...");
|
|
1653
|
+
return this.start();
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* Used after `POST /api/agent/reset`: stop the child, delete local PGLite
|
|
1658
|
+
* (conversations / agent memory under `~/.${getBrandConfig().namespace}/workspace/.eliza/.elizadb`),
|
|
1659
|
+
* then start fresh. Does not remove downloaded **GGUF** models (`MODELS_DIR`,
|
|
1660
|
+
* default ~/.eliza/models), env-backed wallet keys, or eliza.json (the API
|
|
1661
|
+
* reset already rewrote config on disk).
|
|
1662
|
+
*
|
|
1663
|
+
* When `ELIZA_DESKTOP_API_BASE` points at an external dev API (e.g. :31337),
|
|
1664
|
+
* the embedded child is never used — this is a no-op so the renderer can
|
|
1665
|
+
* bounce the real API via `POST /api/agent/restart` instead.
|
|
1666
|
+
*/
|
|
1667
|
+
async restartClearingLocalDb(): Promise<AgentStatus> {
|
|
1668
|
+
const runtimeMode = resolveDesktopRuntimeMode(
|
|
1669
|
+
process.env as Record<string, string | undefined>,
|
|
1670
|
+
);
|
|
1671
|
+
if (runtimeMode.mode !== "local") {
|
|
1672
|
+
diagnosticLog(
|
|
1673
|
+
`[Agent] restartClearingLocalDb skipped — mode=${runtimeMode.mode} externalBase=${runtimeMode.externalApi.base ?? "n/a"} source=${runtimeMode.externalApi.source ?? "n/a"} (renderer uses POST /api/agent/restart)`,
|
|
1674
|
+
);
|
|
1675
|
+
return this.getStatus();
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
diagnosticLog(
|
|
1679
|
+
`[Agent] restartClearingLocalDb: local mode — stop → rm PGLite (${resolvePgliteDataDir()}) → start`,
|
|
1680
|
+
);
|
|
1681
|
+
await this.stop();
|
|
1682
|
+
this.hasPgliteError = false;
|
|
1683
|
+
this.pgliteRecoveryDone = false;
|
|
1684
|
+
deletePgliteDataDir();
|
|
1685
|
+
const next = await this.start();
|
|
1686
|
+
diagnosticLog(
|
|
1687
|
+
`[Agent] restartClearingLocalDb: start() finished state=${next.state} port=${next.port ?? "null"}`,
|
|
1688
|
+
);
|
|
1689
|
+
return next;
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
getStatus(): AgentStatus {
|
|
1693
|
+
return { ...this.status };
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
inspectExistingInstall(): ExistingElizaInstallInfo {
|
|
1697
|
+
return inspectExistingElizaInstall();
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
migrateStateDir(params: { fromPath: string }): StateDirMigrationResult {
|
|
1701
|
+
return migrateDesktopStateDirFromPath(params.fromPath);
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
getPort(): number | null {
|
|
1705
|
+
return this.status.port;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
/** Clean up on app quit. */
|
|
1709
|
+
async dispose(): Promise<void> {
|
|
1710
|
+
if (this.stdioAbortController) {
|
|
1711
|
+
this.stdioAbortController.abort();
|
|
1712
|
+
this.stdioAbortController = null;
|
|
1713
|
+
}
|
|
1714
|
+
try {
|
|
1715
|
+
await this.killChildProcess();
|
|
1716
|
+
} catch (err) {
|
|
1717
|
+
logger.warn(
|
|
1718
|
+
`[Agent] dispose error: ${err instanceof Error ? err.message : String(err)}`,
|
|
1719
|
+
);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
// -----------------------------------------------------------------------
|
|
1724
|
+
// Private helpers
|
|
1725
|
+
// -----------------------------------------------------------------------
|
|
1726
|
+
|
|
1727
|
+
private emitStatus(): void {
|
|
1728
|
+
this.persistStartupDiagnostics();
|
|
1729
|
+
if (this.sendToWebview) {
|
|
1730
|
+
this.sendToWebview("agentStatusUpdate", this.status);
|
|
1731
|
+
}
|
|
1732
|
+
const statusSnapshot = { ...this.status };
|
|
1733
|
+
for (const listener of this.statusListeners) {
|
|
1734
|
+
try {
|
|
1735
|
+
listener(statusSnapshot);
|
|
1736
|
+
} catch (err) {
|
|
1737
|
+
logger.warn(
|
|
1738
|
+
`[Agent] status listener failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
1739
|
+
);
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
private async refreshAgentMetadata(
|
|
1745
|
+
proc: BunSubprocess,
|
|
1746
|
+
port: number,
|
|
1747
|
+
startupMs: number,
|
|
1748
|
+
): Promise<void> {
|
|
1749
|
+
const agentName = await this.fetchAgentName(port);
|
|
1750
|
+
if (
|
|
1751
|
+
this.childProcess !== proc ||
|
|
1752
|
+
this.status.state !== "running" ||
|
|
1753
|
+
this.status.port !== port
|
|
1754
|
+
) {
|
|
1755
|
+
return;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
if (this.status.agentName !== agentName) {
|
|
1759
|
+
this.status = {
|
|
1760
|
+
...this.status,
|
|
1761
|
+
agentName,
|
|
1762
|
+
};
|
|
1763
|
+
this.emitStatus();
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
diagnosticLog(
|
|
1767
|
+
`[Agent] Runtime started -- agent: ${agentName}, port: ${port}, pid: ${proc.pid}, startup_ms: ${startupMs}`,
|
|
1768
|
+
);
|
|
1769
|
+
recordStartupPhase("metadata_ready", {
|
|
1770
|
+
port,
|
|
1771
|
+
child_pid: proc.pid,
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
private setStartupPhase(phase: string, lastError?: string | null): void {
|
|
1775
|
+
this.startupPhase = phase;
|
|
1776
|
+
this.persistStartupDiagnostics(lastError);
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
private persistStartupDiagnostics(lastError?: string | null): void {
|
|
1780
|
+
writeStartupDiagnosticsSnapshot({
|
|
1781
|
+
state: this.status.state,
|
|
1782
|
+
phase: this.startupPhase,
|
|
1783
|
+
updatedAt: new Date().toISOString(),
|
|
1784
|
+
lastError: lastError ?? this.status.error,
|
|
1785
|
+
agentName: this.status.agentName,
|
|
1786
|
+
port: this.status.port,
|
|
1787
|
+
startedAt: this.status.startedAt,
|
|
1788
|
+
platform: process.platform,
|
|
1789
|
+
arch: process.arch,
|
|
1790
|
+
configDir: resolveConfigDir(),
|
|
1791
|
+
logPath: getDiagnosticLogPath(),
|
|
1792
|
+
statusPath: getStartupStatusPath(),
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
/**
|
|
1797
|
+
* Monitor the child process for unexpected exits and update status.
|
|
1798
|
+
*/
|
|
1799
|
+
private monitorChildExit(proc: BunSubprocess): void {
|
|
1800
|
+
// Bun.spawn provides an `exited` promise that resolves when the process exits
|
|
1801
|
+
proc.exited
|
|
1802
|
+
.then((exitCode: number) => {
|
|
1803
|
+
// Only update status if this is still our active child process
|
|
1804
|
+
if (this.childProcess !== proc) return;
|
|
1805
|
+
|
|
1806
|
+
const wasRunning = this.status.state === "running";
|
|
1807
|
+
const wasStarting = this.status.state === "starting";
|
|
1808
|
+
|
|
1809
|
+
if (wasRunning || wasStarting) {
|
|
1810
|
+
diagnosticLog(
|
|
1811
|
+
`[Agent] Child process exited unexpectedly with code ${exitCode} (pid: ${proc.pid})`,
|
|
1812
|
+
);
|
|
1813
|
+
recordStartupPhase("fatal", {
|
|
1814
|
+
port: this.status.port,
|
|
1815
|
+
child_pid: proc.pid,
|
|
1816
|
+
error: `Process exited unexpectedly with code ${exitCode}`,
|
|
1817
|
+
exit_code: exitCode,
|
|
1818
|
+
});
|
|
1819
|
+
this.childProcess = null;
|
|
1820
|
+
|
|
1821
|
+
// Auto-recover from PGLite migration failures by deleting the DB
|
|
1822
|
+
// and spawning a fresh process (new process = fresh WASM state).
|
|
1823
|
+
if (this.hasPgliteError && !this.pgliteRecoveryDone) {
|
|
1824
|
+
this.pgliteRecoveryDone = true;
|
|
1825
|
+
diagnosticLog(
|
|
1826
|
+
"[Agent] PGLite migration error detected — deleting DB and retrying with fresh process",
|
|
1827
|
+
);
|
|
1828
|
+
deletePgliteDataDir();
|
|
1829
|
+
this.status = {
|
|
1830
|
+
state: "not_started",
|
|
1831
|
+
agentName: null,
|
|
1832
|
+
port: null,
|
|
1833
|
+
startedAt: null,
|
|
1834
|
+
error: null,
|
|
1835
|
+
};
|
|
1836
|
+
this.setStartupPhase("recovering_pglite");
|
|
1837
|
+
// Delay slightly so OS releases file handles before respawn
|
|
1838
|
+
setTimeout(() => void this.start(), 500);
|
|
1839
|
+
return;
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
this.status = {
|
|
1843
|
+
state: "error",
|
|
1844
|
+
agentName: this.status.agentName,
|
|
1845
|
+
port: this.status.port,
|
|
1846
|
+
startedAt: null,
|
|
1847
|
+
error: `Process exited unexpectedly with code ${exitCode}`,
|
|
1848
|
+
};
|
|
1849
|
+
this.setStartupPhase(
|
|
1850
|
+
"process_exited_unexpectedly",
|
|
1851
|
+
`Process exited unexpectedly with code ${exitCode}`,
|
|
1852
|
+
);
|
|
1853
|
+
this.emitStatus();
|
|
1854
|
+
} else {
|
|
1855
|
+
// Expected exit (we called stop)
|
|
1856
|
+
this.childProcess = null;
|
|
1857
|
+
}
|
|
1858
|
+
})
|
|
1859
|
+
.catch((err: unknown) => {
|
|
1860
|
+
if (this.childProcess !== proc) return;
|
|
1861
|
+
diagnosticLog(
|
|
1862
|
+
`[Agent] Child process exited with error: ${err instanceof Error ? err.message : String(err)}`,
|
|
1863
|
+
);
|
|
1864
|
+
recordStartupPhase("fatal", {
|
|
1865
|
+
port: this.status.port,
|
|
1866
|
+
child_pid: proc.pid,
|
|
1867
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1868
|
+
});
|
|
1869
|
+
this.childProcess = null;
|
|
1870
|
+
if (
|
|
1871
|
+
this.status.state === "running" ||
|
|
1872
|
+
this.status.state === "starting"
|
|
1873
|
+
) {
|
|
1874
|
+
this.status = {
|
|
1875
|
+
state: "error",
|
|
1876
|
+
agentName: this.status.agentName,
|
|
1877
|
+
port: this.status.port,
|
|
1878
|
+
startedAt: null,
|
|
1879
|
+
error: shortError(err),
|
|
1880
|
+
};
|
|
1881
|
+
this.setStartupPhase("process_exit_error", shortError(err));
|
|
1882
|
+
this.emitStatus();
|
|
1883
|
+
}
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
/**
|
|
1888
|
+
* Kill the child process gracefully with SIGTERM, escalating to SIGKILL
|
|
1889
|
+
* after a timeout.
|
|
1890
|
+
*/
|
|
1891
|
+
private async killChildProcess(): Promise<void> {
|
|
1892
|
+
const proc = this.childProcess;
|
|
1893
|
+
if (!proc) return;
|
|
1894
|
+
|
|
1895
|
+
this.childProcess = null;
|
|
1896
|
+
|
|
1897
|
+
// Already exited
|
|
1898
|
+
if (proc.exitCode !== null) return;
|
|
1899
|
+
|
|
1900
|
+
diagnosticLog(`[Agent] Sending SIGTERM to pid ${proc.pid}`);
|
|
1901
|
+
proc.kill("SIGTERM");
|
|
1902
|
+
|
|
1903
|
+
// Wait for graceful shutdown or timeout
|
|
1904
|
+
const exited = await Promise.race([
|
|
1905
|
+
proc.exited.then(() => true as const),
|
|
1906
|
+
Bun.sleep(SIGTERM_GRACE_MS).then(() => false as const),
|
|
1907
|
+
]);
|
|
1908
|
+
|
|
1909
|
+
if (!exited) {
|
|
1910
|
+
diagnosticLog(
|
|
1911
|
+
`[Agent] Process did not exit within ${SIGTERM_GRACE_MS}ms, sending SIGKILL`,
|
|
1912
|
+
);
|
|
1913
|
+
try {
|
|
1914
|
+
proc.kill("SIGKILL");
|
|
1915
|
+
} catch {
|
|
1916
|
+
// Process may have already exited between check and kill
|
|
1917
|
+
}
|
|
1918
|
+
// Wait briefly for SIGKILL to take effect
|
|
1919
|
+
await Promise.race([proc.exited.catch(() => {}), Bun.sleep(1_000)]);
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
diagnosticLog("[Agent] Child process terminated");
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
/**
|
|
1926
|
+
* Attempt to fetch the agent name from the running API server.
|
|
1927
|
+
* Falls back to the configured desktop app name if the endpoint is unavailable.
|
|
1928
|
+
*/
|
|
1929
|
+
private async fetchAgentName(port: number): Promise<string> {
|
|
1930
|
+
try {
|
|
1931
|
+
const headers = getDesktopApiHeaders();
|
|
1932
|
+
const response = await fetch(`http://127.0.0.1:${port}/api/agents`, {
|
|
1933
|
+
headers,
|
|
1934
|
+
signal: AbortSignal.timeout(AGENT_NAME_FETCH_TIMEOUT_MS),
|
|
1935
|
+
});
|
|
1936
|
+
if (response.ok) {
|
|
1937
|
+
const data = (await response.json()) as
|
|
1938
|
+
| { agents?: Array<{ name?: string }> }
|
|
1939
|
+
| Array<{ name?: string }>;
|
|
1940
|
+
const agents = Array.isArray(data) ? data : data.agents;
|
|
1941
|
+
if (agents && agents.length > 0 && agents[0].name) {
|
|
1942
|
+
return agents[0].name;
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
} catch {
|
|
1946
|
+
diagnosticLog("[Agent] Could not fetch agent name, using default");
|
|
1947
|
+
}
|
|
1948
|
+
return getBrandConfig().appName;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
// ---------------------------------------------------------------------------
|
|
1953
|
+
// Singleton
|
|
1954
|
+
// ---------------------------------------------------------------------------
|
|
1955
|
+
|
|
1956
|
+
let agentManager: AgentManager | null = null;
|
|
1957
|
+
|
|
1958
|
+
export function getAgentManager(): AgentManager {
|
|
1959
|
+
if (!agentManager) {
|
|
1960
|
+
agentManager = new AgentManager();
|
|
1961
|
+
}
|
|
1962
|
+
return agentManager;
|
|
1963
|
+
}
|