@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,1514 @@
|
|
|
1
|
+
package ai.elizaos.app;
|
|
2
|
+
|
|
3
|
+
import android.app.Notification;
|
|
4
|
+
import android.app.NotificationChannel;
|
|
5
|
+
import android.app.NotificationManager;
|
|
6
|
+
import android.app.PendingIntent;
|
|
7
|
+
import android.app.Service;
|
|
8
|
+
import android.content.Context;
|
|
9
|
+
import android.content.Intent;
|
|
10
|
+
import android.content.pm.ServiceInfo;
|
|
11
|
+
import android.content.res.AssetManager;
|
|
12
|
+
import android.os.Build;
|
|
13
|
+
import android.os.IBinder;
|
|
14
|
+
import android.provider.Settings;
|
|
15
|
+
import android.util.Log;
|
|
16
|
+
|
|
17
|
+
import androidx.core.app.NotificationCompat;
|
|
18
|
+
|
|
19
|
+
import ByteArrayOutputStream;
|
|
20
|
+
import java.io.File;
|
|
21
|
+
import java.io.FileOutputStream;
|
|
22
|
+
import java.io.IOException;
|
|
23
|
+
import java.io.InputStream;
|
|
24
|
+
import java.io.OutputStream;
|
|
25
|
+
import java.nio.charset.StandardCharsets;
|
|
26
|
+
import java.net.HttpURLConnection;
|
|
27
|
+
import java.net.URL;
|
|
28
|
+
import java.util.ArrayList;
|
|
29
|
+
import java.util.LinkedHashMap;
|
|
30
|
+
import java.util.List;
|
|
31
|
+
import java.util.Map;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Foreground service that owns the local Eliza agent process on Android.
|
|
35
|
+
*
|
|
36
|
+
* On startup the service unpacks the bun runtime + musl loader + matching
|
|
37
|
+
* shared libraries + agent bundle from the APK assets into the app's
|
|
38
|
+
* writable data dir, marks them executable, and {@link Runtime#exec}'s
|
|
39
|
+
* the agent. A foreground notification keeps the OS from killing the
|
|
40
|
+
* hosting process; a watchdog thread polls process liveness and the
|
|
41
|
+
* agent's HTTP health endpoint and restarts the process on crash with
|
|
42
|
+
* exponential backoff.
|
|
43
|
+
*
|
|
44
|
+
* Mirrors {@link GatewayConnectionService}'s lifecycle and static API
|
|
45
|
+
* shape — start/stop/restart helpers match what other call sites already
|
|
46
|
+
* use.
|
|
47
|
+
*/
|
|
48
|
+
public class ElizaAgentService extends Service {
|
|
49
|
+
|
|
50
|
+
private static final String TAG = "ElizaAgent";
|
|
51
|
+
|
|
52
|
+
private static final String CHANNEL_ID = "eliza_agent";
|
|
53
|
+
private static final int NOTIFICATION_ID = 2;
|
|
54
|
+
|
|
55
|
+
// Intent actions
|
|
56
|
+
public static final String ACTION_START = "ai.elizaos.app.action.START_AGENT";
|
|
57
|
+
public static final String ACTION_STOP = "ai.elizaos.app.action.STOP_AGENT";
|
|
58
|
+
public static final String ACTION_RESTART = "ai.elizaos.app.action.RESTART_AGENT";
|
|
59
|
+
public static final String ACTION_UPDATE_STATUS = "ai.elizaos.app.action.UPDATE_AGENT_STATUS";
|
|
60
|
+
|
|
61
|
+
// Extras
|
|
62
|
+
private static final String EXTRA_STATUS = "status";
|
|
63
|
+
|
|
64
|
+
// Agent layout under getFilesDir():
|
|
65
|
+
// agent/ ← cwd, also holds agent-bundle.js + launch.sh
|
|
66
|
+
// agent/{abi}/bun
|
|
67
|
+
// agent/{abi}/ld-musl-*.so.1
|
|
68
|
+
// agent/{abi}/libstdc++.so.6
|
|
69
|
+
// agent/{abi}/libgcc_s.so.1
|
|
70
|
+
// .eliza/ ← ELIZA_STATE_DIR (PGlite data, auth, prompts)
|
|
71
|
+
//
|
|
72
|
+
// The agent runs in the priv_app SELinux domain — Android.bp deliberately
|
|
73
|
+
// omits the platform certificate so seapp_contexts puts the APK there
|
|
74
|
+
// instead of platform_app. AOSP's stock policy includes
|
|
75
|
+
// `allow priv_app privapp_data_file:file execute;` in
|
|
76
|
+
// system/sepolicy/private/priv_app.te, which is what lets us execve
|
|
77
|
+
// the bun binary out of /data/data/<pkg>/files/agent/. No jniLibs
|
|
78
|
+
// trick, no custom domain, no symlinks: the binary just sits in the
|
|
79
|
+
// app's writable data dir at canonical names.
|
|
80
|
+
private static final String AGENT_DIR_NAME = "agent";
|
|
81
|
+
private static final String AGENT_STATE_DIR_NAME = ".eliza";
|
|
82
|
+
private static final String AGENT_BUNDLE_NAME = "agent-bundle.js";
|
|
83
|
+
private static final String AGENT_LAUNCH_SCRIPT = "launch.sh";
|
|
84
|
+
private static final String BUN_BINARY = "bun";
|
|
85
|
+
private static final String AGENT_LOG_NAME = "agent.log";
|
|
86
|
+
|
|
87
|
+
private static final int AGENT_PORT = 31337;
|
|
88
|
+
private static final String HEALTH_URL = "http://127.0.0.1:" + AGENT_PORT + "/api/health";
|
|
89
|
+
|
|
90
|
+
// The on-device boot path is heavy: PGlite extension extraction +
|
|
91
|
+
// plugin resolution + libllama dlopen + first-time model load can
|
|
92
|
+
// exceed 240 s on a cold cuttlefish x86_64 image. The chat path is
|
|
93
|
+
// even heavier: a single planner-produced prompt at ~12k tokens,
|
|
94
|
+
// chunked through llama_decode on emulated CPU, can run 15–30 min
|
|
95
|
+
// wall-clock for a single chat turn (multiple model invocations:
|
|
96
|
+
// planner, action evaluator, response generator).
|
|
97
|
+
//
|
|
98
|
+
// Strategy: combine a generous interval with a smart probe that
|
|
99
|
+
// distinguishes "process dead" from "process alive but busy in a
|
|
100
|
+
// native FFI call". When the HTTP probe times out but the process
|
|
101
|
+
// is alive (i.e. bun is mid-llama_decode and hasn't returned to its
|
|
102
|
+
// event loop yet), we DO NOT count a strike — the process is doing
|
|
103
|
+
// exactly what it should be doing, just synchronously inside a
|
|
104
|
+
// native call. We only count strikes when the process is actually
|
|
105
|
+
// dead OR returns 5xx from /api/health (a real crash signal).
|
|
106
|
+
// Strikes accumulate when the process is dead, which forces a
|
|
107
|
+
// restart via the existing scheduleRestart() path.
|
|
108
|
+
//
|
|
109
|
+
// 600 s × 3 = 1800 s = 30 min worst-case grace window. Real phone
|
|
110
|
+
// hardware (Tensor / Adreno) finishes a chat turn in seconds, so
|
|
111
|
+
// this only matters for AOSP smoke runs on cvd. HEALTH_TIMEOUT_MS
|
|
112
|
+
// = 30 s is a conservative bound on a single HTTP listener wakeup
|
|
113
|
+
// — bun's setImmediate yield should hit within a few seconds even
|
|
114
|
+
// mid-decode, and 30 s catches genuine TCP-level hangs without
|
|
115
|
+
// racing against real long-running calls.
|
|
116
|
+
private static final long WATCHDOG_INTERVAL_MS = 600_000L;
|
|
117
|
+
private static final int HEALTH_FAIL_STRIKES = 3;
|
|
118
|
+
private static final long HEALTH_TIMEOUT_MS = 30_000L;
|
|
119
|
+
private static final int MAX_RESTART_ATTEMPTS = 5;
|
|
120
|
+
private static final long PROCESS_TERMINATE_GRACE_MS = 5_000L;
|
|
121
|
+
|
|
122
|
+
private final Object processLock = new Object();
|
|
123
|
+
private Process agentProcess;
|
|
124
|
+
private Thread stdoutPump;
|
|
125
|
+
private Thread stderrPump;
|
|
126
|
+
private WatchdogThread watchdog;
|
|
127
|
+
private Thread startWorker;
|
|
128
|
+
private volatile boolean shuttingDown;
|
|
129
|
+
private int restartAttempts;
|
|
130
|
+
private String currentStatus = "starting";
|
|
131
|
+
|
|
132
|
+
// Per-boot bearer token for the WebView↔agent loopback. Generated when
|
|
133
|
+
// the service first starts the agent process and cleared on stop.
|
|
134
|
+
// The Capacitor agent plugin reads it from `localAgentToken()` to
|
|
135
|
+
// hydrate `window.__ELIZA_API_TOKEN__` so the WebView's fetches
|
|
136
|
+
// include `Authorization: Bearer <token>`. The agent enforces the
|
|
137
|
+
// token via ELIZA_REQUIRE_LOCAL_AUTH=1.
|
|
138
|
+
private static volatile String currentLocalAgentToken;
|
|
139
|
+
|
|
140
|
+
/** Called by the Capacitor agent plugin Android binding. */
|
|
141
|
+
public static String localAgentToken() {
|
|
142
|
+
return currentLocalAgentToken;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ── Lifecycle ────────────────────────────────────────────────────────
|
|
146
|
+
|
|
147
|
+
@Override
|
|
148
|
+
public void onCreate() {
|
|
149
|
+
super.onCreate();
|
|
150
|
+
ensureNotificationChannel();
|
|
151
|
+
|
|
152
|
+
Notification notification = buildNotification("Eliza agent", "Starting…");
|
|
153
|
+
|
|
154
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
|
155
|
+
startForeground(
|
|
156
|
+
NOTIFICATION_ID,
|
|
157
|
+
notification,
|
|
158
|
+
ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE
|
|
159
|
+
);
|
|
160
|
+
} else {
|
|
161
|
+
startForeground(NOTIFICATION_ID, notification);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@Override
|
|
166
|
+
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
167
|
+
String action = intent != null ? intent.getAction() : null;
|
|
168
|
+
if (ACTION_STOP.equals(action)) {
|
|
169
|
+
shuttingDown = true;
|
|
170
|
+
stopSelf();
|
|
171
|
+
return START_NOT_STICKY;
|
|
172
|
+
}
|
|
173
|
+
if (ACTION_RESTART.equals(action)) {
|
|
174
|
+
Log.i(TAG, "Restart requested via intent.");
|
|
175
|
+
restartAttempts = 0;
|
|
176
|
+
requestAgentStart(true);
|
|
177
|
+
return START_STICKY;
|
|
178
|
+
}
|
|
179
|
+
if (ACTION_UPDATE_STATUS.equals(action)) {
|
|
180
|
+
String status = intent.getStringExtra(EXTRA_STATUS);
|
|
181
|
+
if (status != null) {
|
|
182
|
+
currentStatus = status;
|
|
183
|
+
updateNotification();
|
|
184
|
+
}
|
|
185
|
+
return START_STICKY;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// ACTION_START or null (default) — boot the agent if it isn't already up.
|
|
189
|
+
requestAgentStart(false);
|
|
190
|
+
if (watchdog == null) {
|
|
191
|
+
watchdog = new WatchdogThread();
|
|
192
|
+
watchdog.start();
|
|
193
|
+
}
|
|
194
|
+
return START_STICKY;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
@Override
|
|
198
|
+
public void onDestroy() {
|
|
199
|
+
shuttingDown = true;
|
|
200
|
+
if (watchdog != null) {
|
|
201
|
+
watchdog.interrupt();
|
|
202
|
+
watchdog = null;
|
|
203
|
+
}
|
|
204
|
+
stopAgentProcess();
|
|
205
|
+
NotificationManager mgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
|
206
|
+
if (mgr != null) {
|
|
207
|
+
mgr.cancel(NOTIFICATION_ID);
|
|
208
|
+
}
|
|
209
|
+
super.onDestroy();
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@Override
|
|
213
|
+
public IBinder onBind(Intent intent) {
|
|
214
|
+
// Not a bound service.
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// ── Asset extraction ─────────────────────────────────────────────────
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Pick the runtime ABI directory we ship binaries for. Walks
|
|
222
|
+
* Build.SUPPORTED_ABIS in device-priority order so x86_64 cuttlefish
|
|
223
|
+
* (which lists ["x86_64","arm64-v8a"]) doesn't wrongly pick arm64.
|
|
224
|
+
*/
|
|
225
|
+
private String resolveRuntimeAbi() {
|
|
226
|
+
String[] supported = Build.SUPPORTED_ABIS;
|
|
227
|
+
if (supported != null) {
|
|
228
|
+
for (String abi : supported) {
|
|
229
|
+
if ("arm64-v8a".equals(abi) || "x86_64".equals(abi)) return abi;
|
|
230
|
+
}
|
|
231
|
+
if (supported.length > 0) return supported[0];
|
|
232
|
+
}
|
|
233
|
+
return "arm64-v8a";
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
private File agentRoot() {
|
|
237
|
+
return new File(getFilesDir(), AGENT_DIR_NAME);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
private File agentAbiDir(String abi) {
|
|
241
|
+
return new File(agentRoot(), abi);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
private File agentStateDir() {
|
|
245
|
+
return new File(getFilesDir(), AGENT_STATE_DIR_NAME);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Copy assets/agent/** into the app's data dir on first launch.
|
|
250
|
+
* Idempotent: skips files that already exist on disk and are
|
|
251
|
+
* non-empty. Sets +x on bun, the musl loader, and launch.sh.
|
|
252
|
+
*/
|
|
253
|
+
private void extractAssetsIfNeeded(String abi) throws IOException {
|
|
254
|
+
File root = agentRoot();
|
|
255
|
+
File abiDir = agentAbiDir(abi);
|
|
256
|
+
File stateDir = agentStateDir();
|
|
257
|
+
if (!root.exists() && !root.mkdirs()) {
|
|
258
|
+
throw new IOException("Could not create " + root);
|
|
259
|
+
}
|
|
260
|
+
if (!abiDir.exists() && !abiDir.mkdirs()) {
|
|
261
|
+
throw new IOException("Could not create " + abiDir);
|
|
262
|
+
}
|
|
263
|
+
if (!stateDir.exists() && !stateDir.mkdirs()) {
|
|
264
|
+
throw new IOException("Could not create " + stateDir);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Compare APK source-file mtime against a stamp file in the agent
|
|
268
|
+
// root; when the APK was upgraded under us (adb push to
|
|
269
|
+
// /system/priv-app + reboot, a Play update, or an OTA) wipe the
|
|
270
|
+
// cached bundle + ABI binaries so the new asset payload gets
|
|
271
|
+
// re-extracted. Without this, copyAssetIfMissing silently keeps
|
|
272
|
+
// the previous extraction forever and shipping a fresh
|
|
273
|
+
// agent-bundle.js does nothing.
|
|
274
|
+
//
|
|
275
|
+
// We use the APK file's mtime (sourceDir → File.lastModified)
|
|
276
|
+
// rather than PackageInfo.lastUpdateTime because /system/priv-app
|
|
277
|
+
// installs (the AOSP image embed path) DO NOT bump
|
|
278
|
+
// lastUpdateTime — that field reflects pm-install + Play-update
|
|
279
|
+
// events. The on-disk APK mtime always reflects the current
|
|
280
|
+
// payload, which is what we need to invalidate cached extractions.
|
|
281
|
+
File stamp = new File(root, ".apk-stamp");
|
|
282
|
+
long pkgUpdate = 0L;
|
|
283
|
+
try {
|
|
284
|
+
String sourceDir = getApplicationInfo().sourceDir;
|
|
285
|
+
if (sourceDir != null) {
|
|
286
|
+
long apkMtime = new File(sourceDir).lastModified();
|
|
287
|
+
if (apkMtime > 0L) pkgUpdate = apkMtime;
|
|
288
|
+
}
|
|
289
|
+
long pmUpdate = getPackageManager()
|
|
290
|
+
.getPackageInfo(getPackageName(), 0).lastUpdateTime;
|
|
291
|
+
if (pmUpdate > pkgUpdate) pkgUpdate = pmUpdate;
|
|
292
|
+
} catch (Exception ignored) {
|
|
293
|
+
// best-effort; no stamp known on early-boot failure
|
|
294
|
+
}
|
|
295
|
+
long stampedUpdate = 0L;
|
|
296
|
+
if (stamp.exists()) {
|
|
297
|
+
try (InputStream in = new java.io.FileInputStream(stamp)) {
|
|
298
|
+
byte[] buf = new byte[64];
|
|
299
|
+
int n = in.read(buf);
|
|
300
|
+
if (n > 0) {
|
|
301
|
+
stampedUpdate = Long.parseLong(new String(buf, 0, n).trim());
|
|
302
|
+
}
|
|
303
|
+
} catch (Exception ignored) {
|
|
304
|
+
// corrupt stamp — treat as missing
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (pkgUpdate > 0L && pkgUpdate != stampedUpdate) {
|
|
308
|
+
Log.i(TAG, "APK changed (was=" + stampedUpdate + ", now=" + pkgUpdate + "); refreshing extracted agent assets");
|
|
309
|
+
File bundle = new File(root, AGENT_BUNDLE_NAME);
|
|
310
|
+
if (bundle.exists() && !bundle.delete()) Log.w(TAG, "Could not delete stale agent-bundle.js");
|
|
311
|
+
File launchScript = new File(root, AGENT_LAUNCH_SCRIPT);
|
|
312
|
+
if (launchScript.exists() && !launchScript.delete()) Log.w(TAG, "Could not delete stale launch.sh");
|
|
313
|
+
File pgWasm = new File(root, "pglite.wasm");
|
|
314
|
+
if (pgWasm.exists()) pgWasm.delete();
|
|
315
|
+
File initDbWasm = new File(root, "initdb.wasm");
|
|
316
|
+
if (initDbWasm.exists()) initDbWasm.delete();
|
|
317
|
+
File pgData = new File(root, "pglite.data");
|
|
318
|
+
if (pgData.exists()) pgData.delete();
|
|
319
|
+
File vec = new File(getFilesDir(), "vector.tar.gz");
|
|
320
|
+
if (vec.exists()) vec.delete();
|
|
321
|
+
File fuzzy = new File(getFilesDir(), "fuzzystrmatch.tar.gz");
|
|
322
|
+
if (fuzzy.exists()) fuzzy.delete();
|
|
323
|
+
File pluginsManifest = new File(root, "plugins-manifest.json");
|
|
324
|
+
if (pluginsManifest.exists()) pluginsManifest.delete();
|
|
325
|
+
File[] abiContents = abiDir.listFiles();
|
|
326
|
+
if (abiContents != null) {
|
|
327
|
+
for (File f : abiContents) {
|
|
328
|
+
try {
|
|
329
|
+
java.nio.file.Files.deleteIfExists(f.toPath());
|
|
330
|
+
} catch (IOException | SecurityException error) {
|
|
331
|
+
Log.w(TAG, "Could not delete stale ABI asset " + f.getName() + ": " + error.getMessage());
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
AssetManager assets = getAssets();
|
|
338
|
+
|
|
339
|
+
copyAssetIfMissing(assets, "agent/" + AGENT_BUNDLE_NAME, new File(root, AGENT_BUNDLE_NAME));
|
|
340
|
+
copyAssetIfPresent(assets, "agent/" + AGENT_LAUNCH_SCRIPT, new File(root, AGENT_LAUNCH_SCRIPT));
|
|
341
|
+
|
|
342
|
+
// PGlite runtime assets. pglite.wasm + initdb.wasm + pglite.data
|
|
343
|
+
// sit next to the bundle (`new URL("./pglite.X", import.meta.url)`);
|
|
344
|
+
// vector.tar.gz and fuzzystrmatch.tar.gz must live one directory
|
|
345
|
+
// ABOVE the bundle because PGlite resolves them via
|
|
346
|
+
// `new URL("../X.tar.gz", ...)`.
|
|
347
|
+
//
|
|
348
|
+
// aapt2 quirk: even with `androidResources.noCompress` listing
|
|
349
|
+
// `tar.gz` and `tar`, aapt2 strips the `.gz` suffix from
|
|
350
|
+
// `*.tar.gz` assets at packaging time (the `noCompress` flag
|
|
351
|
+
// only controls ZIP-level compression of the entry, not the
|
|
352
|
+
// pre-processing aapt2 does to "doubly compressed" extensions).
|
|
353
|
+
// The asset on disk inside the APK is therefore named
|
|
354
|
+
// `vector.tar` / `fuzzystrmatch.tar`, but PGlite's runtime
|
|
355
|
+
// loader still resolves `../vector.tar.gz` and
|
|
356
|
+
// `../fuzzystrmatch.tar.gz`. Look up under the aapt2-rewritten
|
|
357
|
+
// name and write to the runtime-expected `.tar.gz` name so the
|
|
358
|
+
// loader contract is preserved without changing the bundle.
|
|
359
|
+
copyAssetIfPresent(assets, "agent/pglite.wasm", new File(root, "pglite.wasm"));
|
|
360
|
+
copyAssetIfPresent(assets, "agent/initdb.wasm", new File(root, "initdb.wasm"));
|
|
361
|
+
copyAssetIfPresent(assets, "agent/pglite.data", new File(root, "pglite.data"));
|
|
362
|
+
// aapt2 not only strips `.gz` from `*.tar.gz` asset names, it also
|
|
363
|
+
// DECOMPRESSES them into raw tar bytes. PGlite's loader does
|
|
364
|
+
// `new URL("../X.tar.gz", ...)` then pipes the bytes through
|
|
365
|
+
// gunzip — fed raw tar it errors with `Z_DATA_ERROR: incorrect
|
|
366
|
+
// header check` and the agent crashloops at PGlite init. Re-gzip
|
|
367
|
+
// on extraction so the on-disk file matches what the loader
|
|
368
|
+
// expects: a gzipped tarball at `vector.tar.gz` /
|
|
369
|
+
// `fuzzystrmatch.tar.gz`.
|
|
370
|
+
copyAssetIfPresentAsGzipped(assets, "agent/vector.tar",
|
|
371
|
+
new File(getFilesDir(), "vector.tar.gz"));
|
|
372
|
+
copyAssetIfPresentAsGzipped(assets, "agent/fuzzystrmatch.tar",
|
|
373
|
+
new File(getFilesDir(), "fuzzystrmatch.tar.gz"));
|
|
374
|
+
copyAssetIfPresent(assets, "agent/plugins-manifest.json",
|
|
375
|
+
new File(root, "plugins-manifest.json"));
|
|
376
|
+
|
|
377
|
+
// ABI-specific binaries: bun + musl loader + libstdc++ + libgcc.
|
|
378
|
+
String abiAssetDir = "agent/" + abi;
|
|
379
|
+
String[] abiFiles = assets.list(abiAssetDir);
|
|
380
|
+
if (abiFiles == null || abiFiles.length == 0) {
|
|
381
|
+
throw new IOException("APK is missing assets/" + abiAssetDir + " for runtime ABI " + abi);
|
|
382
|
+
}
|
|
383
|
+
for (String name : abiFiles) {
|
|
384
|
+
try {
|
|
385
|
+
copyAssetIfMissing(assets, abiAssetDir + "/" + name, new File(abiDir, name));
|
|
386
|
+
} catch (java.io.FileNotFoundException error) {
|
|
387
|
+
if ("libgcc_s.so.1".equals(name)) {
|
|
388
|
+
Log.w(TAG, "Optional runtime library missing from APK assets: " + abiAssetDir + "/" + name);
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
391
|
+
throw error;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
File bun = new File(abiDir, BUN_BINARY);
|
|
396
|
+
if (bun.exists()) bun.setExecutable(true, false);
|
|
397
|
+
File launch = new File(root, AGENT_LAUNCH_SCRIPT);
|
|
398
|
+
if (launch.exists()) launch.setExecutable(true, false);
|
|
399
|
+
for (String name : abiFiles) {
|
|
400
|
+
// The musl loader (`ld-musl-<arch>.so.1`) needs +x. With the
|
|
401
|
+
// SIGSYS-shim wrapper installed (x86_64 only) the original
|
|
402
|
+
// Alpine loader is shipped as `ld-musl-<arch>.so.1.real` and
|
|
403
|
+
// ALSO needs +x because loader-wrap execve()s it directly.
|
|
404
|
+
if (name.startsWith("ld-musl-")
|
|
405
|
+
&& (name.endsWith(".so.1") || name.endsWith(".so.1.real"))) {
|
|
406
|
+
File loader = new File(abiDir, name);
|
|
407
|
+
if (loader.exists()) loader.setExecutable(true, false);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
boolean stdcxxLinkedFromNative = linkPackagedRuntimeLibrary(
|
|
412
|
+
abiDir,
|
|
413
|
+
"libstdc++.so.6",
|
|
414
|
+
"libeliza_stdcpp.so"
|
|
415
|
+
);
|
|
416
|
+
linkPackagedRuntimeLibrary(abiDir, "libgcc_s.so.1", "libeliza_gcc_s.so");
|
|
417
|
+
|
|
418
|
+
// bun's binary requests `libstdc++.so.6` at runtime (the soname),
|
|
419
|
+
// but the actual file we shipped is the versioned realpath
|
|
420
|
+
// (`libstdc++.so.6.0.33`). Without a symlink the musl loader
|
|
421
|
+
// can't find the shared object and bun crashes with hundreds of
|
|
422
|
+
// "Error relocating: symbol not found" lines. Create the symlink
|
|
423
|
+
// pointing from the soname to the realpath inside the same abi
|
|
424
|
+
// dir so LD_LIBRARY_PATH resolution works without LD_PRELOAD.
|
|
425
|
+
if (!stdcxxLinkedFromNative) {
|
|
426
|
+
for (String name : abiFiles) {
|
|
427
|
+
if (name.startsWith("libstdc++.so.6.")) {
|
|
428
|
+
File realPath = new File(abiDir, name);
|
|
429
|
+
File symlink = new File(abiDir, "libstdc++.so.6");
|
|
430
|
+
if (realPath.exists()) {
|
|
431
|
+
try {
|
|
432
|
+
if (java.nio.file.Files.isSymbolicLink(symlink.toPath()) && !symlink.exists()) {
|
|
433
|
+
java.nio.file.Files.deleteIfExists(symlink.toPath());
|
|
434
|
+
}
|
|
435
|
+
if (!symlink.exists() && !java.nio.file.Files.isSymbolicLink(symlink.toPath())) {
|
|
436
|
+
java.nio.file.Files.createSymbolicLink(
|
|
437
|
+
symlink.toPath(),
|
|
438
|
+
java.nio.file.Paths.get(name)
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
} catch (IOException error) {
|
|
442
|
+
Log.w(TAG, "Could not symlink libstdc++.so.6 → " + name + ": " + error.getMessage());
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// Bundled default models (chat + embedding GGUF files staged by
|
|
450
|
+
// scripts/elizaos/stage-default-models.mjs at AOSP build time).
|
|
451
|
+
// Land them under $ELIZA_STATE_DIR/local-inference/models/ so
|
|
452
|
+
// the runtime's first-run bootstrap discovers them at canonical
|
|
453
|
+
// paths and registers them in the local-inference registry as
|
|
454
|
+
// eliza-owned models. The manifest.json carried alongside the
|
|
455
|
+
// GGUF files lets the bootstrap pick the right id + role for
|
|
456
|
+
// each file without re-deriving them from the filename.
|
|
457
|
+
//
|
|
458
|
+
// assets/agent/models/ may not exist on Capacitor (non-AOSP)
|
|
459
|
+
// builds — bundling defaults to off there since the desktop /
|
|
460
|
+
// Capacitor flows already have download UX. assets.list()
|
|
461
|
+
// returns null on missing paths, which we treat as "no models
|
|
462
|
+
// to extract".
|
|
463
|
+
String modelsAssetDir = "agent/models";
|
|
464
|
+
String[] modelFiles = assets.list(modelsAssetDir);
|
|
465
|
+
if (modelFiles != null && modelFiles.length > 0) {
|
|
466
|
+
File modelsDest = new File(
|
|
467
|
+
new File(stateDir, "local-inference"),
|
|
468
|
+
"models"
|
|
469
|
+
);
|
|
470
|
+
if (!modelsDest.exists() && !modelsDest.mkdirs()) {
|
|
471
|
+
throw new IOException("Could not create " + modelsDest);
|
|
472
|
+
}
|
|
473
|
+
for (String name : modelFiles) {
|
|
474
|
+
copyAssetIfMissing(
|
|
475
|
+
assets,
|
|
476
|
+
modelsAssetDir + "/" + name,
|
|
477
|
+
new File(modelsDest, name)
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
Log.i(TAG, "Extracted " + modelFiles.length + " bundled model file(s) to " + modelsDest);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// Persist the APK's mtime stamp so subsequent boots can detect a
|
|
484
|
+
// stale extraction and force a refresh.
|
|
485
|
+
if (pkgUpdate > 0L) {
|
|
486
|
+
try (FileOutputStream out = new FileOutputStream(stamp)) {
|
|
487
|
+
out.write(Long.toString(pkgUpdate).getBytes());
|
|
488
|
+
} catch (IOException error) {
|
|
489
|
+
Log.w(TAG, "Could not write APK stamp: " + error.getMessage());
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/** Walk agent/{abi}/ for the musl loader; name varies by ABI. */
|
|
495
|
+
private String findMuslLoader(File abiDir) {
|
|
496
|
+
File[] files = abiDir.listFiles();
|
|
497
|
+
if (files == null) return null;
|
|
498
|
+
for (File f : files) {
|
|
499
|
+
String name = f.getName();
|
|
500
|
+
if (name.startsWith("ld-musl-") && name.endsWith(".so.1")) {
|
|
501
|
+
return name;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
private File nativeLibraryDir() {
|
|
508
|
+
return new File(getApplicationInfo().nativeLibraryDir);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
private String packagedMuslLoaderName(String abi) {
|
|
512
|
+
if ("arm64-v8a".equals(abi)) return "libeliza_ld_musl_aarch64.so";
|
|
513
|
+
if ("x86_64".equals(abi)) return "libeliza_ld_musl_x86_64.so";
|
|
514
|
+
return null;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
private File preferPackagedExecutable(File extractedFile, String packagedName) {
|
|
518
|
+
File packaged = new File(nativeLibraryDir(), packagedName);
|
|
519
|
+
if (packaged.exists() && packaged.length() > 0) {
|
|
520
|
+
return packaged;
|
|
521
|
+
}
|
|
522
|
+
return extractedFile;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
private boolean linkPackagedRuntimeLibrary(
|
|
526
|
+
File abiDir,
|
|
527
|
+
String soname,
|
|
528
|
+
String packagedName
|
|
529
|
+
) {
|
|
530
|
+
File packaged = new File(nativeLibraryDir(), packagedName);
|
|
531
|
+
if (!packaged.exists() || packaged.length() <= 0) return false;
|
|
532
|
+
File symlink = new File(abiDir, soname);
|
|
533
|
+
try {
|
|
534
|
+
java.nio.file.Files.deleteIfExists(symlink.toPath());
|
|
535
|
+
java.nio.file.Files.createSymbolicLink(
|
|
536
|
+
symlink.toPath(),
|
|
537
|
+
packaged.toPath()
|
|
538
|
+
);
|
|
539
|
+
return true;
|
|
540
|
+
} catch (IOException | UnsupportedOperationException error) {
|
|
541
|
+
Log.w(TAG, "Could not symlink " + soname + " to packaged native lib: " + error.getMessage());
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Invoke `selinux.android.SELinux.restoreconRecursive` via reflection so
|
|
548
|
+
* we don't take a hard compile-time dependency on the hidden API. The
|
|
549
|
+
* call is best-effort: if the platform refuses it (older Android, denied
|
|
550
|
+
* perm) we log and continue; the agent will run in priv_app domain and
|
|
551
|
+
* the SELinux denials surface in dmesg for diagnosis.
|
|
552
|
+
*/
|
|
553
|
+
private void relabelAgentTree(File root) {
|
|
554
|
+
try {
|
|
555
|
+
Class<?> selinux = Class.forName("android.os.SELinux");
|
|
556
|
+
java.lang.reflect.Method restorecon = selinux.getMethod(
|
|
557
|
+
"restoreconRecursive", File.class
|
|
558
|
+
);
|
|
559
|
+
Object result = restorecon.invoke(null, root);
|
|
560
|
+
if (Boolean.FALSE.equals(result)) {
|
|
561
|
+
Log.w(TAG, "SELinux.restoreconRecursive returned false for " + root);
|
|
562
|
+
} else {
|
|
563
|
+
Log.i(TAG, "SELinux relabel done for " + root);
|
|
564
|
+
}
|
|
565
|
+
} catch (ReflectiveOperationException error) {
|
|
566
|
+
Log.w(TAG, "SELinux.restoreconRecursive unavailable: " + error.getMessage());
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
private void copyAssetIfMissing(AssetManager assets, String assetPath, File target) throws IOException {
|
|
571
|
+
if (target.exists() && target.length() > 0) {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
File parent = target.getParentFile();
|
|
575
|
+
if (parent != null && !parent.exists() && !parent.mkdirs()) {
|
|
576
|
+
throw new IOException("Could not create " + parent);
|
|
577
|
+
}
|
|
578
|
+
try (
|
|
579
|
+
InputStream in = assets.open(assetPath);
|
|
580
|
+
OutputStream out = new FileOutputStream(target)
|
|
581
|
+
) {
|
|
582
|
+
byte[] buffer = new byte[64 * 1024];
|
|
583
|
+
int read;
|
|
584
|
+
while ((read = in.read(buffer)) > 0) {
|
|
585
|
+
out.write(buffer, 0, read);
|
|
586
|
+
}
|
|
587
|
+
out.flush();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Like copyAssetIfMissing, but silently no-ops when the source asset is
|
|
593
|
+
* absent. Used for PGlite + plugin-manifest payload that Phase D
|
|
594
|
+
* generates only when the real agent bundle is built; with the spike
|
|
595
|
+
* placeholder bundle the assets are simply not present and the agent
|
|
596
|
+
* runs without them.
|
|
597
|
+
*/
|
|
598
|
+
private void copyAssetIfPresent(AssetManager assets, String assetPath, File target) throws IOException {
|
|
599
|
+
try (InputStream probe = assets.open(assetPath)) {
|
|
600
|
+
// present — fall through to copy via fresh stream
|
|
601
|
+
} catch (IOException missing) {
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
copyAssetIfMissing(assets, assetPath, target);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Like copyAssetIfPresent, but wraps the asset bytes in a gzip stream on
|
|
609
|
+
* write. Compensates for aapt2's behaviour of decompressing `.tar.gz`
|
|
610
|
+
* assets at packaging time even with `androidResources.noCompress`
|
|
611
|
+
* declared — the on-disk APK entry is raw tar bytes, but PGlite's
|
|
612
|
+
* loader does `pipeline(createReadStream(file), createGunzip(), …)`
|
|
613
|
+
* and rejects raw tar with `Z_DATA_ERROR: incorrect header check`.
|
|
614
|
+
* Re-gzipping on extraction restores the contract the loader expects.
|
|
615
|
+
*/
|
|
616
|
+
private void copyAssetIfPresentAsGzipped(AssetManager assets, String assetPath, File target) throws IOException {
|
|
617
|
+
try (InputStream probe = assets.open(assetPath)) {
|
|
618
|
+
// present — fall through to gzip-wrap via fresh stream
|
|
619
|
+
} catch (IOException missing) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
if (target.exists() && target.length() > 0) {
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
File parent = target.getParentFile();
|
|
626
|
+
if (parent != null && !parent.exists() && !parent.mkdirs()) {
|
|
627
|
+
throw new IOException("Could not create " + parent);
|
|
628
|
+
}
|
|
629
|
+
try (
|
|
630
|
+
InputStream in = assets.open(assetPath);
|
|
631
|
+
FileOutputStream raw = new FileOutputStream(target);
|
|
632
|
+
java.util.zip.GZIPOutputStream gz = new java.util.zip.GZIPOutputStream(raw)
|
|
633
|
+
) {
|
|
634
|
+
byte[] buffer = new byte[64 * 1024];
|
|
635
|
+
int read;
|
|
636
|
+
while ((read = in.read(buffer)) > 0) {
|
|
637
|
+
gz.write(buffer, 0, read);
|
|
638
|
+
}
|
|
639
|
+
gz.flush();
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// ── Process lifecycle ────────────────────────────────────────────────
|
|
644
|
+
|
|
645
|
+
private void requestAgentStart(boolean restartFirst) {
|
|
646
|
+
synchronized (processLock) {
|
|
647
|
+
if (!restartFirst && agentProcess != null && agentProcess.isAlive()) {
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
if (startWorker != null && startWorker.isAlive()) {
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
currentStatus = restartFirst ? "restarting" : "starting";
|
|
654
|
+
updateNotification();
|
|
655
|
+
startWorker = new Thread(() -> {
|
|
656
|
+
try {
|
|
657
|
+
if (restartFirst) {
|
|
658
|
+
stopAgentProcess();
|
|
659
|
+
}
|
|
660
|
+
startAgentProcess();
|
|
661
|
+
} finally {
|
|
662
|
+
synchronized (processLock) {
|
|
663
|
+
startWorker = null;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}, "ElizaAgent-start");
|
|
667
|
+
startWorker.start();
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
private void startAgentProcess() {
|
|
672
|
+
synchronized (processLock) {
|
|
673
|
+
if (agentProcess != null && agentProcess.isAlive()) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
String abi = resolveRuntimeAbi();
|
|
678
|
+
try {
|
|
679
|
+
extractAssetsIfNeeded(abi);
|
|
680
|
+
} catch (IOException error) {
|
|
681
|
+
Log.e(TAG, "Failed to extract agent assets for abi=" + abi, error);
|
|
682
|
+
currentStatus = "extract-failed";
|
|
683
|
+
updateNotification();
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
File root = agentRoot();
|
|
688
|
+
File abiDir = agentAbiDir(abi);
|
|
689
|
+
File bundle = new File(root, AGENT_BUNDLE_NAME);
|
|
690
|
+
File bun = new File(abiDir, BUN_BINARY);
|
|
691
|
+
String loaderName = findMuslLoader(abiDir);
|
|
692
|
+
|
|
693
|
+
if (!bundle.exists()) {
|
|
694
|
+
Log.e(TAG, "Agent bundle missing at " + bundle);
|
|
695
|
+
currentStatus = "missing-bundle";
|
|
696
|
+
updateNotification();
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
if (!bun.exists()) {
|
|
700
|
+
Log.e(TAG, "bun binary missing at " + bun);
|
|
701
|
+
currentStatus = "missing-bun";
|
|
702
|
+
updateNotification();
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
if (loaderName == null) {
|
|
706
|
+
Log.e(TAG, "musl loader missing under " + abiDir);
|
|
707
|
+
currentStatus = "missing-loader";
|
|
708
|
+
updateNotification();
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
File loader = new File(abiDir, loaderName);
|
|
712
|
+
String packagedLoaderName = packagedMuslLoaderName(abi);
|
|
713
|
+
if (packagedLoaderName != null) {
|
|
714
|
+
loader = preferPackagedExecutable(loader, packagedLoaderName);
|
|
715
|
+
}
|
|
716
|
+
bun = preferPackagedExecutable(bun, "libeliza_bun.so");
|
|
717
|
+
|
|
718
|
+
// Generate a fresh per-boot token for the WebView↔agent loopback.
|
|
719
|
+
// Without this the loopback API would accept any local request
|
|
720
|
+
// — including from other apps on the device — because the
|
|
721
|
+
// agent's default isTrustedLocalRequest() heuristic treats
|
|
722
|
+
// loopback as authoritative, which is wrong on multi-app
|
|
723
|
+
// Android. ELIZA_REQUIRE_LOCAL_AUTH on the server side flips
|
|
724
|
+
// that heuristic off so every request needs the bearer token.
|
|
725
|
+
String token = generateLocalAgentToken();
|
|
726
|
+
currentLocalAgentToken = token;
|
|
727
|
+
try {
|
|
728
|
+
writeLocalAgentTokenFile(token);
|
|
729
|
+
} catch (IOException error) {
|
|
730
|
+
Log.w(TAG, "Failed to persist local-agent token file: " + error.getMessage());
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// Invocation:
|
|
734
|
+
// LD_LIBRARY_PATH=<agent/{abi}> PORT=31337 ELIZA_*=…
|
|
735
|
+
// ELIZA_API_TOKEN=<token>
|
|
736
|
+
// agent/{abi}/ld-musl-…so.1 agent/{abi}/bun agent/agent-bundle.js
|
|
737
|
+
List<String> command = new ArrayList<>();
|
|
738
|
+
command.add(loader.getAbsolutePath());
|
|
739
|
+
command.add(bun.getAbsolutePath());
|
|
740
|
+
command.add(bundle.getAbsolutePath());
|
|
741
|
+
|
|
742
|
+
ProcessBuilder pb = new ProcessBuilder(command);
|
|
743
|
+
pb.directory(root);
|
|
744
|
+
Map<String, String> env = pb.environment();
|
|
745
|
+
Map<String, String> agentEnv = new LinkedHashMap<>();
|
|
746
|
+
agentEnv.put(
|
|
747
|
+
"LD_LIBRARY_PATH",
|
|
748
|
+
nativeLibraryDir().getAbsolutePath() + ":" + abiDir.getAbsolutePath()
|
|
749
|
+
);
|
|
750
|
+
agentEnv.put("PORT", String.valueOf(AGENT_PORT));
|
|
751
|
+
agentEnv.put("ELIZA_API_PORT", String.valueOf(AGENT_PORT));
|
|
752
|
+
// The agent's runtime-env resolver reads ELIZA_PORT / ELIZA_UI_PORT
|
|
753
|
+
// (defaulting to 2138) before falling back to PORT. Without
|
|
754
|
+
// these the agent binds 2138 even though the service advertises
|
|
755
|
+
// 31337, the loopback healthcheck never sees a listener, and
|
|
756
|
+
// the watchdog churns indefinitely. Both env vars resolve to
|
|
757
|
+
// the same port — UI bundles in the same Hono server.
|
|
758
|
+
agentEnv.put("ELIZA_PORT", String.valueOf(AGENT_PORT));
|
|
759
|
+
agentEnv.put("ELIZA_UI_PORT", String.valueOf(AGENT_PORT));
|
|
760
|
+
agentEnv.put("ELIZA_STATE_DIR", agentStateDir().getAbsolutePath());
|
|
761
|
+
agentEnv.put("ELIZA_PLATFORM", "android");
|
|
762
|
+
agentEnv.put("ELIZA_DISABLE_DIRECT_RUN", "1");
|
|
763
|
+
// Android loopback is shared across apps. Require the per-boot
|
|
764
|
+
// bearer token; the Capacitor Agent plugin exposes it to the
|
|
765
|
+
// WebView before local-agent API calls are retried.
|
|
766
|
+
agentEnv.put("ELIZA_REQUIRE_LOCAL_AUTH", "1");
|
|
767
|
+
agentEnv.put("ELIZA_API_TOKEN", token);
|
|
768
|
+
// The Capacitor APK always hosts @elizaos/capacitor-llama in the
|
|
769
|
+
// WebView, so the runtime should always be ready to broker
|
|
770
|
+
// inference over the device-bridge WSS at /api/local-inference/
|
|
771
|
+
// device-bridge. The WebView dials it over loopback once the
|
|
772
|
+
// user picks the local runtime mode in onboarding.
|
|
773
|
+
agentEnv.put("ELIZA_DEVICE_BRIDGE_ENABLED", "1");
|
|
774
|
+
// AOSP builds ship libllama.so under agent/{abi}/ and load it
|
|
775
|
+
// directly into the bun process via bun:ffi (see
|
|
776
|
+
// eliza/packages/agent/src/runtime/aosp-llama-adapter.ts). The
|
|
777
|
+
// gradle BuildConfig.AOSP_BUILD field is wired by sub-task 2B;
|
|
778
|
+
// the Capacitor APK keeps its DeviceBridge loopback path.
|
|
779
|
+
if (BuildConfig.AOSP_BUILD) {
|
|
780
|
+
agentEnv.put("ELIZA_LOCAL_LLAMA", "1");
|
|
781
|
+
// CPU-only inference of a 12k-token prompt on cuttlefish
|
|
782
|
+
// x86_64 / Eliza-1 lands well past the 180 s default
|
|
783
|
+
// chat-generation timeout (chat-routes.ts). On cvd a
|
|
784
|
+
// single chat turn fires the planner (9k-token prefill
|
|
785
|
+
// ≈ 10 min on 4 vCPUs at 16 tok/s) plus an action
|
|
786
|
+
// runner plus a reply, and the planner's structured-
|
|
787
|
+
// output parser sometimes triggers a retry round.
|
|
788
|
+
// Empirically end-to-end runs land at 25–45 min on cvd.
|
|
789
|
+
// 60 min budget gives the smoke a full cycle to
|
|
790
|
+
// complete with retries; real phone hardware
|
|
791
|
+
// (Tensor / Adreno) finishes in seconds, so this only
|
|
792
|
+
// matters for AOSP cvd runs.
|
|
793
|
+
agentEnv.put("ELIZA_CHAT_GENERATION_TIMEOUT_MS", "3600000");
|
|
794
|
+
|
|
795
|
+
// Eliza-1 native context is 128k. We pin to 16k
|
|
796
|
+
// because 16k easily fits the planner's ~12k-token
|
|
797
|
+
// prompts plus output reserve. KV-cache for 16k ctx on
|
|
798
|
+
// 1B-Q4_K_M / fp16 KV is ~512 MB (16384 cells × 16 layers
|
|
799
|
+
// × (256 MiB K + 256 MiB V) per llama.cpp's sched_reserve),
|
|
800
|
+
// which alongside the ~770 MB weights and ~290 MB compute
|
|
801
|
+
// buffer puts the model alone close to 1.6 GB. cvd has 4
|
|
802
|
+
// GB total RAM with ~640 MB free at agent start, and bun's
|
|
803
|
+
// heap routinely peaks at 1.5–2.0 GB during long planner
|
|
804
|
+
// cycles — the combined footprint hits OOM-killer
|
|
805
|
+
// territory and bun panics with a SIGSEGV mid-request.
|
|
806
|
+
// Override via env on real-device builds when ctx vs RAM
|
|
807
|
+
// trade-offs change.
|
|
808
|
+
if (!env.containsKey("ELIZA_LLAMA_N_CTX")) {
|
|
809
|
+
agentEnv.put("ELIZA_LLAMA_N_CTX", "16384");
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
// Pin n_threads to the actual CPU count. The default of
|
|
813
|
+
// 0 in the adapter (and llama.cpp's auto-detect path)
|
|
814
|
+
// frequently returns 1 on Android because Android's
|
|
815
|
+
// seccomp filter blocks sched_getaffinity for app
|
|
816
|
+
// domains and llama.cpp's /proc/cpuinfo parse misses
|
|
817
|
+
// the core count on cvd. Cuttlefish x86_64 has 4 vCPUs;
|
|
818
|
+
// most real phones have 6–8 big.LITTLE cores. Read
|
|
819
|
+
// from the JVM at startup and pass through so the FFI
|
|
820
|
+
// side doesn't need to call any blocked syscall.
|
|
821
|
+
if (!env.containsKey("ELIZA_LLAMA_THREADS")) {
|
|
822
|
+
int cores = Runtime.getRuntime().availableProcessors();
|
|
823
|
+
if (cores < 1) cores = 1;
|
|
824
|
+
agentEnv.put("ELIZA_LLAMA_THREADS", String.valueOf(cores));
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
// Smaller decode chunks → more event-loop yield points
|
|
828
|
+
// during prompt prefill. 2048 holds bun inside a single
|
|
829
|
+
// llama_decode call for ~30 s on cvd CPU; the watchdog
|
|
830
|
+
// probe sits on a closed listener queue that whole
|
|
831
|
+
// time. 512-token chunks land each call in ~6–8 s, so
|
|
832
|
+
// the 30 s probe timeout has a realistic chance to
|
|
833
|
+
// wake the listener between chunks.
|
|
834
|
+
if (!env.containsKey("ELIZA_LLAMA_N_BATCH")) {
|
|
835
|
+
agentEnv.put("ELIZA_LLAMA_N_BATCH", "512");
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
agentEnv.put("HOME", getFilesDir().getAbsolutePath());
|
|
839
|
+
agentEnv.put("TMPDIR", getCacheDir().getAbsolutePath());
|
|
840
|
+
|
|
841
|
+
// ── Android seccomp compatibility (SIGSYS / code 159 fix) ──────
|
|
842
|
+
//
|
|
843
|
+
// Android's zygote installs a seccomp-bpf filter on every app
|
|
844
|
+
// process via `seccomp_set_policy()` in
|
|
845
|
+
// frameworks/base/core/jni/com_android_internal_os_Zygote.cpp,
|
|
846
|
+
// sourced from the per-arch allowlists in
|
|
847
|
+
// bionic/libc/seccomp/{x86_64,arm64}_app_policy.cpp. The filter is
|
|
848
|
+
// inherited and locked by SECCOMP_FILTER_FLAG_TSYNC; a child
|
|
849
|
+
// process spawned via fork+execve (which is how this service
|
|
850
|
+
// launches bun via ProcessBuilder) cannot opt out. SELinux
|
|
851
|
+
// policy in vendor/eliza/sepolicy/ is orthogonal — it does
|
|
852
|
+
// not (and cannot) override seccomp.
|
|
853
|
+
//
|
|
854
|
+
// Bun's Linux runtime exercises several syscalls that Android's
|
|
855
|
+
// seccomp filter blocks for app domains:
|
|
856
|
+
// - `io_uring_setup` / `io_uring_enter` / `io_uring_register`
|
|
857
|
+
// (bun's IO pool; not on Android's app allowlist)
|
|
858
|
+
// - `pidfd_open` (bun uses it for child-process waiting; not
|
|
859
|
+
// on the app allowlist before Android 13 / API 33, and
|
|
860
|
+
// gated behind `pidfd_open` allow on newer policy)
|
|
861
|
+
// - `preadv2` / `pwritev2` with `RWF_NONBLOCK` (bun's
|
|
862
|
+
// async-fs path; some Android kernels gate the flag arg)
|
|
863
|
+
//
|
|
864
|
+
// Empirically the agent bundle exit-trapped on SIGSYS (signal
|
|
865
|
+
// 31, exit code 128 + 31 = 159) at first interpretation of
|
|
866
|
+
// user code. The four BUN_FEATURE_FLAG_* knobs below opt bun
|
|
867
|
+
// into its more conservative fallbacks for each of those
|
|
868
|
+
// syscalls. They are intentionally redundant: enabling all four
|
|
869
|
+
// costs nothing and protects against future bun versions that
|
|
870
|
+
// start using a previously-unused gated syscall.
|
|
871
|
+
//
|
|
872
|
+
// BUN_FEATURE_FLAG_DISABLE_IO_POOL=1
|
|
873
|
+
// Replaces bun's io_uring-backed IO pool with the legacy
|
|
874
|
+
// thread-pool implementation. Avoids io_uring_* entirely.
|
|
875
|
+
//
|
|
876
|
+
// BUN_FEATURE_FLAG_FORCE_WAITER_THREAD=1
|
|
877
|
+
// Forces the dedicated waiter-thread child reaper instead
|
|
878
|
+
// of pidfd_open + epoll. Avoids pidfd_open.
|
|
879
|
+
//
|
|
880
|
+
// BUN_FEATURE_FLAG_DISABLE_RWF_NONBLOCK=1
|
|
881
|
+
// Drops RWF_NONBLOCK from preadv2/pwritev2 calls so bun
|
|
882
|
+
// stays on flags Android's seccomp predates. Costs us
|
|
883
|
+
// nothing on Android (the kernel runs the same fallback).
|
|
884
|
+
//
|
|
885
|
+
// BUN_FEATURE_FLAG_DISABLE_SPAWNSYNC_FAST_PATH=1
|
|
886
|
+
// Forces bun's portable spawn fast path off so any
|
|
887
|
+
// vfork/clone3 variants the seccomp filter blocks aren't
|
|
888
|
+
// attempted.
|
|
889
|
+
//
|
|
890
|
+
// To diagnose a future SIGSYS regression on a real boot:
|
|
891
|
+
// adb logcat -d | grep -E '(SIGSYS|seccomp|audit:.*type=1326)'
|
|
892
|
+
// adb shell dmesg | grep -E '(seccomp|SIGSYS)'
|
|
893
|
+
// The audit line includes `syscall=N`; map it via
|
|
894
|
+
// bionic/libc/kernel/uapi/asm-generic/unistd.h or
|
|
895
|
+
// https://chromium.googlesource.com/aosp/platform/bionic/+/refs/heads/master/libc/SYSCALLS.TXT
|
|
896
|
+
// and either add a new BUN_FEATURE_FLAG_* knob or open a bun
|
|
897
|
+
// issue if the call has no fallback.
|
|
898
|
+
agentEnv.put("BUN_FEATURE_FLAG_DISABLE_IO_POOL", "1");
|
|
899
|
+
agentEnv.put("BUN_FEATURE_FLAG_FORCE_WAITER_THREAD", "1");
|
|
900
|
+
agentEnv.put("BUN_FEATURE_FLAG_DISABLE_RWF_NONBLOCK", "1");
|
|
901
|
+
agentEnv.put("BUN_FEATURE_FLAG_DISABLE_SPAWNSYNC_FAST_PATH", "1");
|
|
902
|
+
// BUN_FEATURE_FLAG_DISABLE_ASYNC_TRANSPILER=1
|
|
903
|
+
// Forces bun's transpiler to run on the main thread
|
|
904
|
+
// instead of the async worker pool. The worker pool
|
|
905
|
+
// uses pthread + futex_waitv (added in 5.16) which
|
|
906
|
+
// Android's app seccomp policy blocks on most kernels
|
|
907
|
+
// before API 34. Disables the worker thread spawn
|
|
908
|
+
// entirely — the transpiler still runs, just inline.
|
|
909
|
+
//
|
|
910
|
+
// NOTE: Do NOT set BUN_FEATURE_FLAG_DISABLE_MEMFD=1 here.
|
|
911
|
+
// memfd_create IS on Android's app seccomp allowlist
|
|
912
|
+
// (verified API 30+), and bun's JSC tier uses memfd as
|
|
913
|
+
// the W^X dual-mapping mechanism for JIT code pages.
|
|
914
|
+
// Disabling memfd forces JSC to fall back to raw RWX
|
|
915
|
+
// mmap, which IS blocked by SELinux execmem on platform_app
|
|
916
|
+
// — that combination kills bun before any log line is
|
|
917
|
+
// written. Tested empirically: with the 43 MB agent-bundle,
|
|
918
|
+
// DISABLE_MEMFD=1 produces an early SIGSYS during JIT init;
|
|
919
|
+
// with memfd allowed, bun reaches PGlite + listener.
|
|
920
|
+
agentEnv.put("BUN_FEATURE_FLAG_DISABLE_ASYNC_TRANSPILER", "1");
|
|
921
|
+
|
|
922
|
+
// ── No on-device prompt-optimization / training ────────────
|
|
923
|
+
//
|
|
924
|
+
// The runtime ships with a trajectory-driven prompt-optimization
|
|
925
|
+
// pipeline (MIPRO / GEPA / bootstrap-fewshot via the native
|
|
926
|
+
// backend). On boot, OptimizedPromptService kicks off a one-
|
|
927
|
+
// shot bootstrap when accumulated trajectories cross threshold,
|
|
928
|
+
// and the cron auto-trainer dispatches further rounds in the
|
|
929
|
+
// background. None of that belongs on a phone or a privileged
|
|
930
|
+
// system app:
|
|
931
|
+
// - MIPRO/GEPA spawn coding sub-agents (PTY-backed bash) that
|
|
932
|
+
// blow past the bun seccomp envelope this service builds.
|
|
933
|
+
// - The trajectory writer fans out to the trajectories table
|
|
934
|
+
// under PGlite which already churns the device flash.
|
|
935
|
+
// - On AOSP cvd we want a deterministic agent binary, not
|
|
936
|
+
// one that mutates its prompts mid-smoke.
|
|
937
|
+
//
|
|
938
|
+
// Hard-disable both the bootstrap and the trajectory ingest
|
|
939
|
+
// path so the agent never spins up a training round on-device.
|
|
940
|
+
// Trajectories are still useful for live chat context, but
|
|
941
|
+
// this disables PERSISTENCE — the optimizer has no input data
|
|
942
|
+
// and no-ops at boot.
|
|
943
|
+
agentEnv.put("ELIZA_DISABLE_AUTO_BOOTSTRAP", "1");
|
|
944
|
+
agentEnv.put("ELIZA_DISABLE_TRAJECTORY_LOGGING", "1");
|
|
945
|
+
|
|
946
|
+
// ── Vault passphrase ──────────────────────────────────────
|
|
947
|
+
// The runtime's vault-bootstrap mirrors process.env secrets
|
|
948
|
+
// through @elizaos/vault, which on a headless Linux host
|
|
949
|
+
// (Android counts: no reachable D-Bus session) refuses the
|
|
950
|
+
// OS keychain and demands ELIZA_VAULT_PASSPHRASE (≥12 chars)
|
|
951
|
+
// to derive a master key. Without it the bootstrap fails
|
|
952
|
+
// and startEliza() throws "[vault-bootstrap] all 1 secret
|
|
953
|
+
// writes failed; vault unreachable", which the watchdog
|
|
954
|
+
// interprets as a crash and restart-loops the agent.
|
|
955
|
+
//
|
|
956
|
+
// Derive a per-install stable passphrase from ANDROID_ID
|
|
957
|
+
// (Settings.Secure.ANDROID_ID — 16 hex chars, per-app-install
|
|
958
|
+
// on Android 8+, stable across reboots and OS updates).
|
|
959
|
+
// Prefix with a constant so the value is always ≥12 chars
|
|
960
|
+
// even if ANDROID_ID is unexpectedly short or null. The
|
|
961
|
+
// resulting passphrase is opaque to the user and is only
|
|
962
|
+
// ever stored in memory in the spawned bun process.
|
|
963
|
+
//
|
|
964
|
+
// Operators can override by setting ELIZA_VAULT_PASSPHRASE
|
|
965
|
+
// in the parent service env (e.g. for a deterministic dev
|
|
966
|
+
// passphrase across reinstalls).
|
|
967
|
+
if (!env.containsKey("ELIZA_VAULT_PASSPHRASE")) {
|
|
968
|
+
String androidId = Settings.Secure.getString(
|
|
969
|
+
getContentResolver(),
|
|
970
|
+
Settings.Secure.ANDROID_ID
|
|
971
|
+
);
|
|
972
|
+
if (androidId == null || androidId.length() < 8) {
|
|
973
|
+
androidId = "fallback-" + Build.SERIAL;
|
|
974
|
+
}
|
|
975
|
+
agentEnv.put(
|
|
976
|
+
"ELIZA_VAULT_PASSPHRASE",
|
|
977
|
+
"elizaos-android-vault-" + androidId
|
|
978
|
+
);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
// Default to info-level logging so plugin resolution + listen
|
|
982
|
+
// progress is visible in agent.log. The runtime defaults to
|
|
983
|
+
// `error` which leaves boot hangs invisible. Operators can
|
|
984
|
+
// override by setting LOG_LEVEL in the parent service env.
|
|
985
|
+
if (!env.containsKey("LOG_LEVEL")) {
|
|
986
|
+
agentEnv.put("LOG_LEVEL", "info");
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
env.putAll(agentEnv);
|
|
990
|
+
|
|
991
|
+
// Merge stderr into stdout so a single pump captures both streams
|
|
992
|
+
// and one failure mode — bun crashing mid-write before the buffered
|
|
993
|
+
// stderr line is flushed — can't lose the diagnostic. The previous
|
|
994
|
+
// BufferedReader.readLine() pump silently dropped any partial line
|
|
995
|
+
// that wasn't terminated with a newline, which is exactly what
|
|
996
|
+
// happens when a panic interrupts a Logger call mid-string.
|
|
997
|
+
pb.redirectErrorStream(true);
|
|
998
|
+
|
|
999
|
+
Process started;
|
|
1000
|
+
try {
|
|
1001
|
+
started = pb.start();
|
|
1002
|
+
} catch (IOException error) {
|
|
1003
|
+
Log.e(TAG, "Failed to spawn agent process: " + command, error);
|
|
1004
|
+
currentStatus = "spawn-failed";
|
|
1005
|
+
updateNotification();
|
|
1006
|
+
scheduleRestart();
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
agentProcess = started;
|
|
1011
|
+
File logFile = new File(root, AGENT_LOG_NAME);
|
|
1012
|
+
stdoutPump = startStreamPump(started.getInputStream(), logFile, "out");
|
|
1013
|
+
// stderrPump intentionally null — redirectErrorStream(true) merges
|
|
1014
|
+
// both streams into getInputStream() so one pump captures everything.
|
|
1015
|
+
stderrPump = null;
|
|
1016
|
+
currentStatus = "running";
|
|
1017
|
+
updateNotification();
|
|
1018
|
+
Log.i(TAG, "Agent process started (pid=" + safePid(started) + ").");
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
private void stopAgentProcess() {
|
|
1023
|
+
Process toStop;
|
|
1024
|
+
Thread outPump;
|
|
1025
|
+
Thread errPump;
|
|
1026
|
+
synchronized (processLock) {
|
|
1027
|
+
toStop = agentProcess;
|
|
1028
|
+
outPump = stdoutPump;
|
|
1029
|
+
errPump = stderrPump;
|
|
1030
|
+
agentProcess = null;
|
|
1031
|
+
stdoutPump = null;
|
|
1032
|
+
stderrPump = null;
|
|
1033
|
+
}
|
|
1034
|
+
if (toStop == null) {
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
Log.i(TAG, "Stopping agent process (pid=" + safePid(toStop) + ").");
|
|
1038
|
+
toStop.destroy();
|
|
1039
|
+
long deadline = System.currentTimeMillis() + PROCESS_TERMINATE_GRACE_MS;
|
|
1040
|
+
while (toStop.isAlive() && System.currentTimeMillis() < deadline) {
|
|
1041
|
+
try {
|
|
1042
|
+
Thread.sleep(100);
|
|
1043
|
+
} catch (InterruptedException error) {
|
|
1044
|
+
Thread.currentThread().interrupt();
|
|
1045
|
+
break;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
if (toStop.isAlive()) {
|
|
1049
|
+
Log.w(TAG, "Agent did not exit on SIGTERM — sending SIGKILL.");
|
|
1050
|
+
toStop.destroyForcibly();
|
|
1051
|
+
}
|
|
1052
|
+
if (outPump != null) outPump.interrupt();
|
|
1053
|
+
if (errPump != null) errPump.interrupt();
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
private static final java.security.SecureRandom TOKEN_RNG = new java.security.SecureRandom();
|
|
1057
|
+
|
|
1058
|
+
private static String generateLocalAgentToken() {
|
|
1059
|
+
byte[] bytes = new byte[32];
|
|
1060
|
+
TOKEN_RNG.nextBytes(bytes);
|
|
1061
|
+
StringBuilder sb = new StringBuilder(bytes.length * 2);
|
|
1062
|
+
for (byte b : bytes) {
|
|
1063
|
+
sb.append(String.format("%02x", b & 0xff));
|
|
1064
|
+
}
|
|
1065
|
+
return sb.toString();
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* Persist the per-boot token to a UID-restricted file so a future
|
|
1070
|
+
* restart of the WebView (without restarting the service) can re-read
|
|
1071
|
+
* it without losing auth. File is mode 0600; only the app's own UID
|
|
1072
|
+
* can read.
|
|
1073
|
+
*/
|
|
1074
|
+
private void writeLocalAgentTokenFile(String token) throws IOException {
|
|
1075
|
+
File dir = new File(getFilesDir(), "auth");
|
|
1076
|
+
if (!dir.exists() && !dir.mkdirs()) {
|
|
1077
|
+
throw new IOException("Could not create " + dir);
|
|
1078
|
+
}
|
|
1079
|
+
File file = new File(dir, "local-agent-token");
|
|
1080
|
+
try (FileOutputStream out = new FileOutputStream(file)) {
|
|
1081
|
+
out.write(token.getBytes());
|
|
1082
|
+
}
|
|
1083
|
+
file.setReadable(false, false);
|
|
1084
|
+
file.setReadable(true, true);
|
|
1085
|
+
file.setWritable(false, false);
|
|
1086
|
+
file.setWritable(true, true);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
private long safePid(Process process) {
|
|
1090
|
+
// Process#pid() is Java 9+; Android's java.lang.Process exposes it
|
|
1091
|
+
// since API 24. AGP's d8 desugaring on this project rejects the
|
|
1092
|
+
// direct call at compile time even with sourceCompatibility=21,
|
|
1093
|
+
// so go through reflection — pid is informational only.
|
|
1094
|
+
try {
|
|
1095
|
+
Object value = Process.class.getMethod("pid").invoke(process);
|
|
1096
|
+
return value instanceof Long ? (Long) value : -1L;
|
|
1097
|
+
} catch (ReflectiveOperationException | UnsupportedOperationException ignored) {
|
|
1098
|
+
return -1L;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* Drain a process stream into the agent log file and tee to logcat.
|
|
1104
|
+
* One thread per stream; both exit cleanly when the stream closes
|
|
1105
|
+
* (process death) or the thread is interrupted.
|
|
1106
|
+
*/
|
|
1107
|
+
private Thread startStreamPump(InputStream stream, File logFile, String label) {
|
|
1108
|
+
Thread t = new Thread(() -> {
|
|
1109
|
+
byte[] buf = new byte[4096];
|
|
1110
|
+
try (FileOutputStream logOut = new FileOutputStream(logFile, true)) {
|
|
1111
|
+
// Buffer raw bytes until '\n' so multi-byte UTF-8 sequences
|
|
1112
|
+
// are decoded intact — newline (0x0A) never appears as a
|
|
1113
|
+
// continuation byte in UTF-8, so splitting on it can't slice
|
|
1114
|
+
// a codepoint. A char-level StringBuilder with `(char)(byte
|
|
1115
|
+
// & 0xFF)` would mojibake non-ASCII output (emoji, CJK).
|
|
1116
|
+
ByteArrayOutputStream lineBuf = new ByteArrayOutputStream(256);
|
|
1117
|
+
int n;
|
|
1118
|
+
// Interrupt check goes before read(): once read() has
|
|
1119
|
+
// returned bytes we're committed to writing them, otherwise
|
|
1120
|
+
// a graceful-shutdown interrupt during a successful read
|
|
1121
|
+
// would silently drop the very tail this PR exists to save.
|
|
1122
|
+
while (!Thread.currentThread().isInterrupted() && (n = stream.read(buf)) >= 0) {
|
|
1123
|
+
// Mirror raw bytes to the log immediately so a mid-write
|
|
1124
|
+
// panic in the agent doesn't lose its last diagnostic.
|
|
1125
|
+
// BufferedReader.readLine() dropped partial lines on
|
|
1126
|
+
// crash; the byte-level pump captures everything.
|
|
1127
|
+
logOut.write(buf, 0, n);
|
|
1128
|
+
logOut.flush();
|
|
1129
|
+
// For logcat readability, accumulate complete lines and
|
|
1130
|
+
// emit them tagged. The post-loop drain below handles the
|
|
1131
|
+
// unterminated tail when the stream closes mid-line.
|
|
1132
|
+
for (int i = 0; i < n; i += 1) {
|
|
1133
|
+
byte b = buf[i];
|
|
1134
|
+
if (b == (byte) '\n') {
|
|
1135
|
+
if (lineBuf.size() > 0) {
|
|
1136
|
+
String line = lineBuf.toString(StandardCharsets.UTF_8.name());
|
|
1137
|
+
lineBuf.reset();
|
|
1138
|
+
// Strip a trailing '\r' from CRLF without
|
|
1139
|
+
// a separate scan over `line`.
|
|
1140
|
+
if (line.endsWith("\r")) line = line.substring(0, line.length() - 1);
|
|
1141
|
+
if (!line.isEmpty()) Log.i(TAG, line);
|
|
1142
|
+
}
|
|
1143
|
+
} else {
|
|
1144
|
+
lineBuf.write(b);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
if (lineBuf.size() > 0) {
|
|
1149
|
+
String tail = lineBuf.toString(StandardCharsets.UTF_8.name());
|
|
1150
|
+
Log.w(TAG, tail + " <eof — no trailing newline>");
|
|
1151
|
+
}
|
|
1152
|
+
} catch (IOException error) {
|
|
1153
|
+
if (!shuttingDown) {
|
|
1154
|
+
Log.w(TAG, "Stream pump (" + label + ") ended.", error);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}, "ElizaAgent-pump-" + label);
|
|
1158
|
+
t.setDaemon(true);
|
|
1159
|
+
t.start();
|
|
1160
|
+
return t;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
private void scheduleRestart() {
|
|
1164
|
+
if (shuttingDown) return;
|
|
1165
|
+
if (restartAttempts >= MAX_RESTART_ATTEMPTS) {
|
|
1166
|
+
Log.e(TAG, "Agent crashed " + restartAttempts + " times — giving up. Service stopping.");
|
|
1167
|
+
currentStatus = "fatal";
|
|
1168
|
+
updateNotification();
|
|
1169
|
+
stopSelf();
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
long backoffMs = 1000L * (1L << restartAttempts);
|
|
1173
|
+
restartAttempts++;
|
|
1174
|
+
Log.w(TAG, "Restarting agent in " + backoffMs + "ms (attempt " + restartAttempts + "/" + MAX_RESTART_ATTEMPTS + ").");
|
|
1175
|
+
new Thread(() -> {
|
|
1176
|
+
try {
|
|
1177
|
+
Thread.sleep(backoffMs);
|
|
1178
|
+
} catch (InterruptedException error) {
|
|
1179
|
+
Thread.currentThread().interrupt();
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
if (shuttingDown) return;
|
|
1183
|
+
startAgentProcess();
|
|
1184
|
+
}, "ElizaAgent-restart").start();
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
// ── Watchdog ─────────────────────────────────────────────────────────
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Polls the agent process and the local health endpoint every
|
|
1191
|
+
* {@link #WATCHDOG_INTERVAL_MS}. If the process died, schedule a
|
|
1192
|
+
* restart with exponential backoff. If the process is alive but the
|
|
1193
|
+
* health endpoint has been unreachable for two consecutive ticks,
|
|
1194
|
+
* also force a restart — the runtime is wedged.
|
|
1195
|
+
*/
|
|
1196
|
+
private final class WatchdogThread extends Thread {
|
|
1197
|
+
private int unhealthyTicks;
|
|
1198
|
+
|
|
1199
|
+
WatchdogThread() {
|
|
1200
|
+
super("ElizaAgent-watchdog");
|
|
1201
|
+
setDaemon(true);
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
@Override
|
|
1205
|
+
public void run() {
|
|
1206
|
+
while (!shuttingDown && !isInterrupted()) {
|
|
1207
|
+
try {
|
|
1208
|
+
Thread.sleep(WATCHDOG_INTERVAL_MS);
|
|
1209
|
+
} catch (InterruptedException error) {
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
if (shuttingDown) return;
|
|
1213
|
+
|
|
1214
|
+
Process current;
|
|
1215
|
+
synchronized (processLock) {
|
|
1216
|
+
current = agentProcess;
|
|
1217
|
+
}
|
|
1218
|
+
if (current == null) {
|
|
1219
|
+
// Service is up but no process — caller must explicitly start.
|
|
1220
|
+
continue;
|
|
1221
|
+
}
|
|
1222
|
+
if (!current.isAlive()) {
|
|
1223
|
+
int exit = -1;
|
|
1224
|
+
try {
|
|
1225
|
+
exit = current.exitValue();
|
|
1226
|
+
} catch (IllegalThreadStateException ignored) {
|
|
1227
|
+
// Race: marked alive between checks. Treat as dead.
|
|
1228
|
+
}
|
|
1229
|
+
Log.w(TAG, "Agent process exited (code=" + exit + "). Scheduling restart.");
|
|
1230
|
+
synchronized (processLock) {
|
|
1231
|
+
agentProcess = null;
|
|
1232
|
+
}
|
|
1233
|
+
unhealthyTicks = 0;
|
|
1234
|
+
scheduleRestart();
|
|
1235
|
+
continue;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
ProbeResult probe = probeHealth();
|
|
1239
|
+
if (probe == ProbeResult.OK) {
|
|
1240
|
+
if (unhealthyTicks > 0) {
|
|
1241
|
+
Log.i(TAG, "Agent health restored.");
|
|
1242
|
+
}
|
|
1243
|
+
unhealthyTicks = 0;
|
|
1244
|
+
if (restartAttempts > 0) {
|
|
1245
|
+
// Reset backoff once the agent has been healthy for a tick.
|
|
1246
|
+
restartAttempts = 0;
|
|
1247
|
+
}
|
|
1248
|
+
if (!"running".equals(currentStatus)) {
|
|
1249
|
+
currentStatus = "running";
|
|
1250
|
+
updateNotification();
|
|
1251
|
+
}
|
|
1252
|
+
} else if (probe == ProbeResult.BUSY) {
|
|
1253
|
+
// HTTP listener didn't answer in HEALTH_TIMEOUT_MS but the
|
|
1254
|
+
// bun process is still alive. The most likely cause is
|
|
1255
|
+
// synchronous work inside the JS event loop — typically
|
|
1256
|
+
// a long llama_decode FFI call with a 12k-token prompt
|
|
1257
|
+
// on emulated CPU. We do NOT count a strike; the
|
|
1258
|
+
// process is doing exactly what it should be doing.
|
|
1259
|
+
// Logging is at info-level so operators can correlate
|
|
1260
|
+
// decode-busy periods with apparent unresponsiveness.
|
|
1261
|
+
Log.i(TAG, "Agent HTTP probe timed out but process is alive — likely mid-decode. No strike.");
|
|
1262
|
+
} else {
|
|
1263
|
+
// ProbeResult.DEAD: process is dead, OR /api/health
|
|
1264
|
+
// returned 5xx (a real crash signal). Only here do we
|
|
1265
|
+
// accumulate strikes toward a force-restart.
|
|
1266
|
+
unhealthyTicks++;
|
|
1267
|
+
Log.w(TAG, "Agent health probe failed (" + unhealthyTicks + " consecutive).");
|
|
1268
|
+
if (unhealthyTicks >= HEALTH_FAIL_STRIKES) {
|
|
1269
|
+
unhealthyTicks = 0;
|
|
1270
|
+
Log.w(TAG, "Agent unresponsive — force-restarting.");
|
|
1271
|
+
stopAgentProcess();
|
|
1272
|
+
scheduleRestart();
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
private ProbeResult probeHealth() {
|
|
1279
|
+
HttpURLConnection conn = null;
|
|
1280
|
+
try {
|
|
1281
|
+
URL url = new URL(HEALTH_URL);
|
|
1282
|
+
conn = (HttpURLConnection) url.openConnection();
|
|
1283
|
+
conn.setConnectTimeout((int) HEALTH_TIMEOUT_MS);
|
|
1284
|
+
conn.setReadTimeout((int) HEALTH_TIMEOUT_MS);
|
|
1285
|
+
conn.setRequestMethod("GET");
|
|
1286
|
+
int status = conn.getResponseCode();
|
|
1287
|
+
if (status >= 200 && status < 500) {
|
|
1288
|
+
return ProbeResult.OK;
|
|
1289
|
+
}
|
|
1290
|
+
// 5xx: agent process is up but reported a server error.
|
|
1291
|
+
// Treat as DEAD so strikes accumulate — a 5xx on
|
|
1292
|
+
// /api/health is a crash signal, not a busy signal.
|
|
1293
|
+
return ProbeResult.DEAD;
|
|
1294
|
+
} catch (IOException error) {
|
|
1295
|
+
// HTTP request failed (timeout / connect refused / read
|
|
1296
|
+
// interrupt). If the agent process is still alive the
|
|
1297
|
+
// most likely cause is bun synchronously inside a native
|
|
1298
|
+
// FFI call (long llama_decode on a multi-thousand-token
|
|
1299
|
+
// prompt). The event loop will resume when the FFI call
|
|
1300
|
+
// returns. If the process IS dead, scheduleRestart()
|
|
1301
|
+
// already fired from the outer loop on the
|
|
1302
|
+
// !current.isAlive() path on the previous tick — a
|
|
1303
|
+
// strike here would be redundant.
|
|
1304
|
+
Process current;
|
|
1305
|
+
synchronized (processLock) {
|
|
1306
|
+
current = agentProcess;
|
|
1307
|
+
}
|
|
1308
|
+
if (current != null && current.isAlive()) {
|
|
1309
|
+
return ProbeResult.BUSY;
|
|
1310
|
+
}
|
|
1311
|
+
return ProbeResult.DEAD;
|
|
1312
|
+
} finally {
|
|
1313
|
+
if (conn != null) conn.disconnect();
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
/**
|
|
1319
|
+
* Outcome of a single watchdog health probe. The watchdog uses these
|
|
1320
|
+
* to decide whether to count a strike toward force-restart:
|
|
1321
|
+
* OK → process is healthy, reset strike counter.
|
|
1322
|
+
* BUSY → process is alive but the HTTP listener didn't answer in
|
|
1323
|
+
* HEALTH_TIMEOUT_MS. Typically means bun is synchronously
|
|
1324
|
+
* inside a native FFI call (llama_decode on a long prompt).
|
|
1325
|
+
* No strike.
|
|
1326
|
+
* DEAD → process is dead, OR the HTTP server returned 5xx, OR a
|
|
1327
|
+
* hard connection failure (port closed). Count a strike.
|
|
1328
|
+
*/
|
|
1329
|
+
private enum ProbeResult {
|
|
1330
|
+
OK,
|
|
1331
|
+
BUSY,
|
|
1332
|
+
DEAD,
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
// ── Notification helpers ─────────────────────────────────────────────
|
|
1336
|
+
|
|
1337
|
+
private void ensureNotificationChannel() {
|
|
1338
|
+
NotificationChannel channel = new NotificationChannel(
|
|
1339
|
+
CHANNEL_ID,
|
|
1340
|
+
"Eliza Agent",
|
|
1341
|
+
NotificationManager.IMPORTANCE_LOW
|
|
1342
|
+
);
|
|
1343
|
+
channel.setDescription("Local Eliza agent runtime status");
|
|
1344
|
+
channel.setShowBadge(false);
|
|
1345
|
+
|
|
1346
|
+
NotificationManager mgr = getSystemService(NotificationManager.class);
|
|
1347
|
+
if (mgr != null) {
|
|
1348
|
+
mgr.createNotificationChannel(channel);
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
private Notification buildNotification(String title, String text) {
|
|
1353
|
+
Intent launchIntent = new Intent(this, MainActivity.class);
|
|
1354
|
+
launchIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
1355
|
+
PendingIntent launchPending = PendingIntent.getActivity(
|
|
1356
|
+
this, 1, launchIntent,
|
|
1357
|
+
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE
|
|
1358
|
+
);
|
|
1359
|
+
|
|
1360
|
+
Intent stopIntent = new Intent(this, ElizaAgentService.class);
|
|
1361
|
+
stopIntent.setAction(ACTION_STOP);
|
|
1362
|
+
PendingIntent stopPending = PendingIntent.getService(
|
|
1363
|
+
this, 2, stopIntent,
|
|
1364
|
+
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE
|
|
1365
|
+
);
|
|
1366
|
+
|
|
1367
|
+
return new NotificationCompat.Builder(this, CHANNEL_ID)
|
|
1368
|
+
.setSmallIcon(R.mipmap.ic_launcher)
|
|
1369
|
+
.setContentTitle(title)
|
|
1370
|
+
.setContentText(text)
|
|
1371
|
+
.setContentIntent(launchPending)
|
|
1372
|
+
.setOngoing(true)
|
|
1373
|
+
.setOnlyAlertOnce(true)
|
|
1374
|
+
.setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE)
|
|
1375
|
+
.addAction(0, "Stop", stopPending)
|
|
1376
|
+
.build();
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
private void updateNotification() {
|
|
1380
|
+
String title;
|
|
1381
|
+
String text;
|
|
1382
|
+
switch (currentStatus) {
|
|
1383
|
+
case "running":
|
|
1384
|
+
title = "Eliza agent · Running";
|
|
1385
|
+
text = "Local agent listening on :" + AGENT_PORT;
|
|
1386
|
+
break;
|
|
1387
|
+
case "starting":
|
|
1388
|
+
title = "Eliza agent · Starting";
|
|
1389
|
+
text = "Preparing on-device runtime…";
|
|
1390
|
+
break;
|
|
1391
|
+
case "fatal":
|
|
1392
|
+
title = "Eliza agent · Stopped";
|
|
1393
|
+
text = "Agent crashed repeatedly; tap to investigate";
|
|
1394
|
+
break;
|
|
1395
|
+
case "extract-failed":
|
|
1396
|
+
title = "Eliza agent · Asset error";
|
|
1397
|
+
text = "Could not unpack runtime";
|
|
1398
|
+
break;
|
|
1399
|
+
case "missing-bundle":
|
|
1400
|
+
case "missing-bun":
|
|
1401
|
+
case "missing-loader":
|
|
1402
|
+
title = "Eliza agent · Missing files";
|
|
1403
|
+
text = currentStatus;
|
|
1404
|
+
break;
|
|
1405
|
+
case "spawn-failed":
|
|
1406
|
+
title = "Eliza agent · Spawn failed";
|
|
1407
|
+
text = "Could not start runtime process";
|
|
1408
|
+
break;
|
|
1409
|
+
default:
|
|
1410
|
+
title = "Eliza agent";
|
|
1411
|
+
text = currentStatus;
|
|
1412
|
+
break;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
Notification notification = buildNotification(title, text);
|
|
1416
|
+
NotificationManager mgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
|
1417
|
+
if (mgr != null) {
|
|
1418
|
+
mgr.notify(NOTIFICATION_ID, notification);
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
// ── Static helpers for callers ───────────────────────────────────────
|
|
1423
|
+
|
|
1424
|
+
/**
|
|
1425
|
+
* SharedPreferences group used by Capacitor's @capacitor/preferences
|
|
1426
|
+
* plugin. Mirrors PreferencesConfiguration.DEFAULTS.group in v8.
|
|
1427
|
+
*/
|
|
1428
|
+
private static final String CAPACITOR_PREFS_GROUP = "CapacitorStorage";
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* Storage key for the persisted mobile runtime mode. Must match
|
|
1432
|
+
* MOBILE_RUNTIME_MODE_STORAGE_KEY in
|
|
1433
|
+
* eliza/packages/app-core/src/onboarding/mobile-runtime-mode.ts.
|
|
1434
|
+
*/
|
|
1435
|
+
private static final String RUNTIME_MODE_KEY = "eliza:mobile-runtime-mode";
|
|
1436
|
+
|
|
1437
|
+
/**
|
|
1438
|
+
* Whether the on-device agent should auto-start at app boot.
|
|
1439
|
+
*
|
|
1440
|
+
* - On AOSP / ElizaOS-branded devices (`ro.elizaos.product` set or any
|
|
1441
|
+
* white-label fork's `ro.<brand>os.product`), the device IS the
|
|
1442
|
+
* agent: always start.
|
|
1443
|
+
* - On stock Android, only start when the user has explicitly picked
|
|
1444
|
+
* the Local runtime in the onboarding picker (mobile-runtime-mode
|
|
1445
|
+
* == "local"). Cloud and Remote modes do not need this service.
|
|
1446
|
+
*/
|
|
1447
|
+
public static boolean shouldAutoStart(Context context) {
|
|
1448
|
+
if (isBrandedDevice()) {
|
|
1449
|
+
return true;
|
|
1450
|
+
}
|
|
1451
|
+
String mode = readRuntimeMode(context);
|
|
1452
|
+
return "local".equals(mode);
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
private static boolean isBrandedDevice() {
|
|
1456
|
+
if (!readSystemProperty("ro.elizaos.product").isEmpty()) return true;
|
|
1457
|
+
// White-label forks set ro.<brand>os.product (e.g. ro.miladyos.product).
|
|
1458
|
+
// We can't enumerate every fork's namespace from native code, so
|
|
1459
|
+
// probe the most common ones used by current forks. Forks that
|
|
1460
|
+
// need a different sysprop should override shouldAutoStart locally.
|
|
1461
|
+
return !readSystemProperty("ro.miladyos.product").isEmpty();
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
private static String readRuntimeMode(Context context) {
|
|
1465
|
+
try {
|
|
1466
|
+
return context
|
|
1467
|
+
.getSharedPreferences(CAPACITOR_PREFS_GROUP, Context.MODE_PRIVATE)
|
|
1468
|
+
.getString(RUNTIME_MODE_KEY, null);
|
|
1469
|
+
} catch (Exception e) {
|
|
1470
|
+
Log.w(TAG, "Unable to read runtime mode preference", e);
|
|
1471
|
+
return null;
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
private static String readSystemProperty(String key) {
|
|
1476
|
+
try {
|
|
1477
|
+
Class<?> spClass = Class.forName("android.os.SystemProperties");
|
|
1478
|
+
java.lang.reflect.Method get = spClass.getMethod("get", String.class);
|
|
1479
|
+
Object result = get.invoke(null, key);
|
|
1480
|
+
return result instanceof String ? (String) result : "";
|
|
1481
|
+
} catch (ReflectiveOperationException | SecurityException e) {
|
|
1482
|
+
return "";
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
/** Start the foreground service (safe to call repeatedly). */
|
|
1487
|
+
public static void start(Context context) {
|
|
1488
|
+
Intent intent = new Intent(context, ElizaAgentService.class);
|
|
1489
|
+
intent.setAction(ACTION_START);
|
|
1490
|
+
context.startForegroundService(intent);
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
/** Request a graceful stop via the ACTION_STOP intent. */
|
|
1494
|
+
public static void stop(Context context) {
|
|
1495
|
+
Intent intent = new Intent(context, ElizaAgentService.class);
|
|
1496
|
+
intent.setAction(ACTION_STOP);
|
|
1497
|
+
context.startService(intent);
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
/** Restart the agent process without tearing down the service. */
|
|
1501
|
+
public static void restart(Context context) {
|
|
1502
|
+
Intent intent = new Intent(context, ElizaAgentService.class);
|
|
1503
|
+
intent.setAction(ACTION_RESTART);
|
|
1504
|
+
context.startService(intent);
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
/** Push a status string into the foreground notification. */
|
|
1508
|
+
public static void updateStatus(Context context, String status) {
|
|
1509
|
+
Intent intent = new Intent(context, ElizaAgentService.class);
|
|
1510
|
+
intent.setAction(ACTION_UPDATE_STATUS);
|
|
1511
|
+
intent.putExtra(EXTRA_STATUS, status);
|
|
1512
|
+
context.startService(intent);
|
|
1513
|
+
}
|
|
1514
|
+
}
|