@elizaos/app-core 2.0.3-beta.2 → 2.0.3-beta.3

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.
Files changed (360) hide show
  1. package/agent-bridge.d.ts +5 -5
  2. package/api/auth/audit.d.ts +1 -1
  3. package/api/auth/auth-context.d.ts +1 -1
  4. package/api/auth/bootstrap-token.d.ts +1 -1
  5. package/api/auth/sessions.d.ts +1 -1
  6. package/api/auth-bootstrap-routes.d.ts +1 -1
  7. package/api/auth-pairing-routes.d.ts +1 -1
  8. package/api/auth-pairing-routes.d.ts.map +1 -1
  9. package/api/auth-pairing-routes.js +2 -3
  10. package/api/auth-session-routes.d.ts +2 -2
  11. package/api/auth.d.ts +1 -1
  12. package/api/automations-compat-routes.d.ts +1 -1
  13. package/api/background-tasks-routes.d.ts +1 -1
  14. package/api/catalog-routes.d.ts +1 -1
  15. package/api/cloud-voice-routes.d.ts +1 -1
  16. package/api/compat-route-shared.d.ts +12 -5
  17. package/api/compat-route-shared.d.ts.map +1 -1
  18. package/api/compat-route-shared.js +22 -187
  19. package/api/database-rows-compat-routes.d.ts +1 -1
  20. package/api/dev-compat-routes.d.ts +1 -1
  21. package/api/dev-route-catalog.d.ts.map +1 -1
  22. package/api/dev-route-catalog.js +20 -0
  23. package/api/drop-status-compat-route.d.ts +3 -0
  24. package/api/drop-status-compat-route.d.ts.map +1 -0
  25. package/api/drop-status-compat-route.js +12 -0
  26. package/api/first-run-routes.d.ts +1 -1
  27. package/api/internal-routes.d.ts +1 -1
  28. package/api/runtime-mode-routes.d.ts +1 -1
  29. package/api/secrets-manager-routes.d.ts.map +1 -1
  30. package/api/sensitive-request-routes.d.ts +2 -2
  31. package/api/server-config-filter.d.ts.map +1 -1
  32. package/api/server-config-filter.js +0 -1
  33. package/api/server-first-run-helpers.d.ts.map +1 -1
  34. package/api/server-first-run-helpers.js +0 -3
  35. package/api/server.d.ts +8 -8
  36. package/api/server.d.ts.map +1 -1
  37. package/api/server.js +13 -59
  38. package/api/training-benchmarks.d.ts +1 -1
  39. package/api/training-benchmarks.d.ts.map +1 -1
  40. package/api/training-benchmarks.js +31 -9
  41. package/api/workbench-compat-routes.d.ts +1 -1
  42. package/benchmark/server-utils.d.ts +2 -2
  43. package/browser.d.ts +4 -4
  44. package/cli/plugins-cli.d.ts.map +1 -1
  45. package/cli/plugins-cli.js +5 -0
  46. package/cli/program/register.auth.d.ts +27 -1
  47. package/cli/program/register.auth.d.ts.map +1 -1
  48. package/cli/program/register.auth.js +187 -0
  49. package/cli/program/register.dashboard.d.ts.map +1 -1
  50. package/cli/program/register.dashboard.js +11 -1
  51. package/cli/program.d.ts +1 -1
  52. package/first-run/first-run-config.d.ts +1 -1
  53. package/index.d.ts +46 -47
  54. package/index.d.ts.map +1 -1
  55. package/index.js +3 -7
  56. package/package.json +42 -36
  57. package/packaging/PUBLISHING_GUIDE.md +20 -20
  58. package/platform/elizaos-agent-browser-stub.d.ts +0 -1
  59. package/platform/elizaos-agent-browser-stub.d.ts.map +1 -1
  60. package/platform/elizaos-agent-browser-stub.js +0 -1
  61. package/platform/ios-runtime-bridge.d.ts.map +1 -1
  62. package/platform/ios-runtime-bridge.js +0 -1
  63. package/platform/native-plugin-entrypoints.d.ts +2 -2
  64. package/platforms/android/app/build.gradle +30 -7
  65. package/platforms/android/app/src/main/elizavoice-jni/elizavoice-jni.cpp +179 -35
  66. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAgentService.java +60 -32
  67. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaBionicInferenceServer.java +405 -65
  68. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoiceNative.java +35 -0
  69. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoicePlugin.java +13 -6
  70. package/platforms/android/app/src/main/res/drawable/splash.png +0 -0
  71. package/platforms/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
  72. package/platforms/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
  73. package/platforms/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
  74. package/platforms/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
  75. package/platforms/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
  76. package/platforms/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
  77. package/platforms/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
  78. package/platforms/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
  79. package/platforms/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
  80. package/platforms/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
  81. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  82. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
  83. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png +0 -0
  84. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  85. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  86. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
  87. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png +0 -0
  88. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  89. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  90. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
  91. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png +0 -0
  92. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  93. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  94. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
  95. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png +0 -0
  96. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  97. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  98. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
  99. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png +0 -0
  100. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  101. package/platforms/android/app/src/main/res/values/colors.xml +5 -1
  102. package/platforms/android/app/src/main/res/values/ic_launcher_background.xml +1 -1
  103. package/platforms/android/app/src/main/res/values/styles.xml +4 -1
  104. package/platforms/electrobun/electrobun.config.ts +0 -1
  105. package/platforms/electrobun/native/macos/window-effects.mm +4 -0
  106. package/platforms/electrobun/package.json +11 -9
  107. package/platforms/electrobun/remotes/local-model/src/bun/eliza1-catalog.ts +1 -1
  108. package/platforms/electrobun/remotes/runtime/src/dev/phase2-smoke.ts +10 -5
  109. package/platforms/electrobun/remotes/runtime/src/dev/phase3-smoke.ts +11 -15
  110. package/platforms/electrobun/src/application-menu.ts +0 -7
  111. package/platforms/electrobun/src/desktop-http-request.test.ts +30 -1
  112. package/platforms/electrobun/src/desktop-http-request.ts +14 -2
  113. package/platforms/electrobun/src/desktop-test-bridge-server.ts +28 -0
  114. package/platforms/electrobun/src/fatal-shutdown.test.ts +3 -7
  115. package/platforms/electrobun/src/index.ts +64 -13
  116. package/platforms/electrobun/src/lifecycle/api-base-owner.test.ts +83 -0
  117. package/platforms/electrobun/src/lifecycle/api-base-owner.ts +37 -16
  118. package/platforms/electrobun/src/native/agent.ts +28 -17
  119. package/platforms/electrobun/src/native/credentials.ts +6 -1
  120. package/platforms/electrobun/src/native/desktop-window.test.ts +142 -26
  121. package/platforms/electrobun/src/native/desktop.ts +8 -4
  122. package/platforms/electrobun/src/native/index.ts +6 -0
  123. package/platforms/electrobun/src/native/remote-plugin-host.ts +18 -8
  124. package/platforms/electrobun/src/preload.js +1 -1
  125. package/platforms/electrobun/src/voice/voice-live-validation.test.ts +10 -5
  126. package/platforms/electrobun/src/voice/voice-runtime-adapter.ts +3 -2
  127. package/platforms/electrobun/src/voice/voice-service.test.ts +26 -0
  128. package/platforms/electrobun/src/voice/voice-service.ts +57 -17
  129. package/platforms/electrobun/tsconfig.json +17 -1
  130. package/platforms/ios/App/App/Base.lproj/LaunchScreen.storyboard +4 -6
  131. package/registry/index.d.ts +1 -6
  132. package/registry/index.d.ts.map +1 -1
  133. package/registry/index.js +9 -101
  134. package/runtime/android-avf-microdroid-bridge.d.ts +1 -1
  135. package/runtime/bundled-fused-lib.d.ts +36 -0
  136. package/runtime/bundled-fused-lib.d.ts.map +1 -0
  137. package/runtime/bundled-fused-lib.js +77 -0
  138. package/runtime/channel-plugin-map.d.ts +1 -5
  139. package/runtime/channel-plugin-map.d.ts.map +1 -1
  140. package/runtime/channel-plugin-map.js +11 -31
  141. package/runtime/desktop/index.d.ts +5 -5
  142. package/runtime/dev-server.js +11 -2
  143. package/runtime/eliza.d.ts.map +1 -1
  144. package/runtime/eliza.js +18 -8
  145. package/runtime/mode/route-mode-guard.d.ts +1 -1
  146. package/runtime/mode/route-mode-matrix.d.ts +1 -1
  147. package/runtime/voice-warmup.d.ts +4 -19
  148. package/runtime/voice-warmup.d.ts.map +1 -1
  149. package/runtime/voice-warmup.js +4 -14
  150. package/scripts/aosp/README.md +10 -1
  151. package/scripts/aosp/compile-libllama-zig-pin.test.mjs +147 -0
  152. package/scripts/aosp/compile-libllama.mjs +446 -59
  153. package/scripts/aosp/compile-libllama.test.mjs +133 -0
  154. package/scripts/aosp/compile-shim.mjs +21 -1
  155. package/scripts/aosp/deploy-pixel.mjs +1 -1
  156. package/scripts/aosp/stage-default-models.mjs +24 -31
  157. package/scripts/aosp/stage-default-models.test.mjs +23 -0
  158. package/scripts/assert-required-bundled-packages.test.ts +22 -1
  159. package/scripts/build-helpers/verify-fused-symbols.mjs +33 -0
  160. package/scripts/build-helpers/verify-fused-symbols.test.mjs +0 -0
  161. package/scripts/build-image.sh +1 -3
  162. package/scripts/build-llama-cpp-mtp.mjs +17 -16
  163. package/scripts/check-i18n.mjs +0 -1
  164. package/scripts/copy-runtime-node-modules.ts +147 -0
  165. package/scripts/desktop-build.mjs +317 -4
  166. package/scripts/docker-ci-smoke.sh +33 -8
  167. package/scripts/ensure-type-package-aliases.mjs +1 -1
  168. package/scripts/ios-xcframework/run-physical-device-smoke.mjs +1 -1
  169. package/scripts/lib/agent-source-watcher.mjs +0 -1
  170. package/scripts/lib/artifact-staleness.d.mts +33 -0
  171. package/scripts/lib/artifact-staleness.mjs +122 -0
  172. package/scripts/lib/artifact-staleness.test.mts +98 -0
  173. package/scripts/lib/duet-bridge.mjs +1 -1
  174. package/scripts/lib/ios-plist-url-scheme.mjs +80 -0
  175. package/scripts/lib/mobile-build-decisions.mjs +97 -0
  176. package/scripts/lib/renderer-build-manifest.d.mts +65 -0
  177. package/scripts/lib/renderer-build-manifest.mjs +257 -0
  178. package/scripts/lib/renderer-build-manifest.test.mts +277 -0
  179. package/scripts/lib/stage-android-agent.mjs +13 -4
  180. package/scripts/lib/verify-ondevice-artifact.d.mts +16 -0
  181. package/scripts/lib/verify-ondevice-artifact.mjs +61 -0
  182. package/scripts/lib/verify-ondevice-artifact.test.mts +98 -0
  183. package/scripts/lib/websocket-pending-queue.ts +92 -0
  184. package/scripts/link-docker-local-app-packages.mjs +6 -0
  185. package/scripts/playwright-ui-live-stack.ts +430 -144
  186. package/scripts/playwright-ui-smoke-api-stub.mjs +160 -168
  187. package/scripts/run-local-plugin-live-smoke.mjs +1 -6
  188. package/scripts/run-mobile-build-brand-separation.test.mts +33 -0
  189. package/scripts/run-mobile-build-ios-engine-gate.test.mjs +85 -0
  190. package/scripts/run-mobile-build-mtp-staleness.test.mts +198 -0
  191. package/scripts/run-mobile-build.mjs +408 -86
  192. package/scripts/serve-real-local-agent.ts +72 -0
  193. package/scripts/stage-desktop-fused-lib.mjs +43 -14
  194. package/scripts/verify-ondevice-artifact.mjs +111 -0
  195. package/scripts/voice-attribution-smoke.ts +144 -38
  196. package/scripts/voice-duet.mjs +6 -6
  197. package/scripts/voice-e2e-hardware.ts +22 -16
  198. package/scripts/voice-interactive.mjs +16 -45
  199. package/security/agent-vault-id.d.ts +1 -1
  200. package/security/platform-secure-store-node.d.ts +1 -1
  201. package/services/ambient-audio/consent.d.ts +1 -1
  202. package/services/ambient-audio/index.d.ts +6 -6
  203. package/services/ambient-audio/replay-buffer.d.ts +1 -1
  204. package/services/ambient-audio/response-gate.d.ts +1 -1
  205. package/services/ambient-audio/service.d.ts +3 -3
  206. package/services/connector-target-catalog.d.ts +1 -1
  207. package/services/sensitive-requests/index.d.ts +6 -6
  208. package/services/steward-sidecar/wallet-setup.d.ts +1 -1
  209. package/services/steward-sidecar.d.ts +3 -3
  210. package/services/tunnel-to-mobile/index.d.ts +1 -1
  211. package/services/vault-bootstrap.d.ts.map +1 -1
  212. package/services/vault-bootstrap.js +14 -10
  213. package/services/voice-profiles/diarization-pipeline.d.ts +1 -1
  214. package/services/voice-profiles/index.d.ts +11 -11
  215. package/services/voice-profiles/owner-confidence.d.ts +1 -1
  216. package/services/voice-profiles/private-challenge.d.ts +1 -1
  217. package/services/voice-profiles/store.d.ts +1 -1
  218. package/test/helpers/live-provider.test.ts +91 -1
  219. package/test/helpers/live-provider.ts +195 -51
  220. package/test/scripts/websocket-pending-queue.test.ts +119 -0
  221. package/test-support/test-helpers.d.ts +0 -33
  222. package/test-support/test-helpers.d.ts.map +1 -1
  223. package/test-support/test-helpers.js +81 -189
  224. package/ui-compat.d.ts +1 -0
  225. package/ui-compat.d.ts.map +1 -1
  226. package/ui-compat.js +4 -0
  227. package/platforms/electrobun/docs/convergence-audit.json +0 -3505
  228. package/platforms/electrobun/docs/convergence-audit.md +0 -694
  229. package/platforms/electrobun/scripts/ensure-whisper-gguf.sh +0 -55
  230. package/platforms/electrobun/scripts/ensure-whisper-model.sh +0 -35
  231. package/platforms/electrobun/scripts/generate-convergence-audit.ts +0 -1203
  232. package/platforms/electrobun/src/native/whisper-env.test.ts +0 -71
  233. package/platforms/electrobun/src/native/whisper-env.ts +0 -68
  234. package/registry/app-registry.d.ts +0 -14
  235. package/registry/app-registry.d.ts.map +0 -1
  236. package/registry/app-registry.js +0 -29
  237. package/registry/entries/apps/app-polymarket.json +0 -31
  238. package/registry/entries/apps/clawville.json +0 -27
  239. package/registry/entries/apps/companion.json +0 -28
  240. package/registry/entries/apps/database-viewer.json +0 -27
  241. package/registry/entries/apps/defense-of-the-agents.json +0 -27
  242. package/registry/entries/apps/documents.json +0 -30
  243. package/registry/entries/apps/feed.json +0 -27
  244. package/registry/entries/apps/hyperliquid.json +0 -31
  245. package/registry/entries/apps/log-viewer.json +0 -27
  246. package/registry/entries/apps/memory-viewer.json +0 -27
  247. package/registry/entries/apps/model-tester.json +0 -31
  248. package/registry/entries/apps/plugin-viewer.json +0 -27
  249. package/registry/entries/apps/relationship-viewer.json +0 -27
  250. package/registry/entries/apps/runtime-debugger.json +0 -27
  251. package/registry/entries/apps/shopify.json +0 -31
  252. package/registry/entries/apps/skills-viewer.json +0 -27
  253. package/registry/entries/apps/steward.json +0 -31
  254. package/registry/entries/apps/training.json +0 -54
  255. package/registry/entries/apps/trajectory-viewer.json +0 -27
  256. package/registry/entries/apps/vincent.json +0 -31
  257. package/registry/entries/connectors/bluebubbles.json +0 -99
  258. package/registry/entries/connectors/bluesky.json +0 -173
  259. package/registry/entries/connectors/discord.json +0 -119
  260. package/registry/entries/connectors/farcaster.json +0 -174
  261. package/registry/entries/connectors/feishu.json +0 -79
  262. package/registry/entries/connectors/google-chat.json +0 -120
  263. package/registry/entries/connectors/google.json +0 -82
  264. package/registry/entries/connectors/imessage.json +0 -96
  265. package/registry/entries/connectors/instagram.json +0 -64
  266. package/registry/entries/connectors/line.json +0 -86
  267. package/registry/entries/connectors/matrix.json +0 -94
  268. package/registry/entries/connectors/mattermost.json +0 -110
  269. package/registry/entries/connectors/msteams.json +0 -104
  270. package/registry/entries/connectors/nextcloud-talk.json +0 -104
  271. package/registry/entries/connectors/nostr.json +0 -70
  272. package/registry/entries/connectors/signal.json +0 -81
  273. package/registry/entries/connectors/slack.json +0 -102
  274. package/registry/entries/connectors/telegram.json +0 -71
  275. package/registry/entries/connectors/tlon.json +0 -94
  276. package/registry/entries/connectors/twitch.json +0 -110
  277. package/registry/entries/connectors/whatsapp.json +0 -113
  278. package/registry/entries/connectors/x.json +0 -231
  279. package/registry/entries/connectors/zalo.json +0 -112
  280. package/registry/entries/connectors/zalouser.json +0 -122
  281. package/registry/entries/plugins/agent-orchestrator.json +0 -33
  282. package/registry/entries/plugins/agent-skills.json +0 -72
  283. package/registry/entries/plugins/anthropic.json +0 -73
  284. package/registry/entries/plugins/app-control.json +0 -23
  285. package/registry/entries/plugins/auto-trader.json +0 -203
  286. package/registry/entries/plugins/background-runner.json +0 -26
  287. package/registry/entries/plugins/blooio.json +0 -102
  288. package/registry/entries/plugins/browser.json +0 -75
  289. package/registry/entries/plugins/cli.json +0 -40
  290. package/registry/entries/plugins/clipboard.json +0 -44
  291. package/registry/entries/plugins/coding-tools.json +0 -71
  292. package/registry/entries/plugins/commands.json +0 -63
  293. package/registry/entries/plugins/computeruse.json +0 -74
  294. package/registry/entries/plugins/copilot-proxy.json +0 -93
  295. package/registry/entries/plugins/directives.json +0 -63
  296. package/registry/entries/plugins/edge-tts.json +0 -97
  297. package/registry/entries/plugins/elevenlabs.json +0 -169
  298. package/registry/entries/plugins/elizacloud.json +0 -208
  299. package/registry/entries/plugins/evm.json +0 -134
  300. package/registry/entries/plugins/experience.json +0 -34
  301. package/registry/entries/plugins/facewear.json +0 -131
  302. package/registry/entries/plugins/form.json +0 -26
  303. package/registry/entries/plugins/github.json +0 -93
  304. package/registry/entries/plugins/gmail-watch.json +0 -25
  305. package/registry/entries/plugins/goals.json +0 -77
  306. package/registry/entries/plugins/google-genai.json +0 -106
  307. package/registry/entries/plugins/groq.json +0 -93
  308. package/registry/entries/plugins/hedera.json +0 -48
  309. package/registry/entries/plugins/inmemorydb.json +0 -25
  310. package/registry/entries/plugins/linear.json +0 -51
  311. package/registry/entries/plugins/local-inference.json +0 -137
  312. package/registry/entries/plugins/local-storage.json +0 -36
  313. package/registry/entries/plugins/localdb.json +0 -25
  314. package/registry/entries/plugins/mcp.json +0 -44
  315. package/registry/entries/plugins/memory.json +0 -124
  316. package/registry/entries/plugins/minecraft.json +0 -79
  317. package/registry/entries/plugins/moltbook.json +0 -83
  318. package/registry/entries/plugins/music.json +0 -155
  319. package/registry/entries/plugins/mysticism.json +0 -48
  320. package/registry/entries/plugins/nearai.json +0 -82
  321. package/registry/entries/plugins/ngrok.json +0 -69
  322. package/registry/entries/plugins/ollama.json +0 -96
  323. package/registry/entries/plugins/openai.json +0 -189
  324. package/registry/entries/plugins/openrouter.json +0 -188
  325. package/registry/entries/plugins/pdf.json +0 -26
  326. package/registry/entries/plugins/plugin-manager.json +0 -23
  327. package/registry/entries/plugins/prose.json +0 -48
  328. package/registry/entries/plugins/rlm.json +0 -26
  329. package/registry/entries/plugins/roblox.json +0 -88
  330. package/registry/entries/plugins/rss.json +0 -64
  331. package/registry/entries/plugins/s3-storage.json +0 -91
  332. package/registry/entries/plugins/scheduling.json +0 -35
  333. package/registry/entries/plugins/shell.json +0 -94
  334. package/registry/entries/plugins/social-alpha.json +0 -72
  335. package/registry/entries/plugins/tailscale.json +0 -81
  336. package/registry/entries/plugins/tee.json +0 -53
  337. package/registry/entries/plugins/todos.json +0 -26
  338. package/registry/entries/plugins/trajectory-logger.json +0 -33
  339. package/registry/entries/plugins/trust.json +0 -39
  340. package/registry/entries/plugins/tts.json +0 -71
  341. package/registry/entries/plugins/tunnel.json +0 -45
  342. package/registry/entries/plugins/twilio.json +0 -168
  343. package/registry/entries/plugins/vercel-ai-gateway.json +0 -128
  344. package/registry/entries/plugins/video.json +0 -23
  345. package/registry/entries/plugins/vision.json +0 -43
  346. package/registry/entries/plugins/webhooks.json +0 -23
  347. package/registry/entries/plugins/workflow.json +0 -25
  348. package/registry/entries/plugins/xai.json +0 -75
  349. package/registry/loader.d.ts +0 -28
  350. package/registry/loader.d.ts.map +0 -1
  351. package/registry/loader.js +0 -158
  352. package/registry/schema.d.ts +0 -1199
  353. package/registry/schema.d.ts.map +0 -1
  354. package/registry/schema.js +0 -300
  355. package/scripts/patches/llama-mobile-kokoro-tts.patch +0 -480
  356. package/scripts/release-workflow-drift.test.ts +0 -57
  357. package/test/helpers/i18n.ts +0 -5
  358. package/test/helpers/loopback.ts +0 -33
  359. package/test/helpers/react-test.ts +0 -40
  360. package/test/helpers/skip-without.ts +0 -53
@@ -29,8 +29,11 @@
29
29
  // its musl Android targets, so the resulting ABI matches what bun expects
30
30
  // when it dlopen()s libllama.so via bun:ffi at runtime.
31
31
  //
32
- // Minimum tested: zig 0.13.0. Earlier versions ship older libc++ headers
33
- // that miss <bit> / <span> shims llama.cpp's CMake feature checks rely on.
32
+ // Arm64/aarch64-musl is pinned to zig 0.13.x. Earlier versions ship older
33
+ // libc++ headers that miss <bit> / <span> shims llama.cpp's CMake feature
34
+ // checks rely on, and newer host toolchains have regressed this lane (zig
35
+ // 0.16's lld SIGSEGVs the aarch64-linux-musl link). Keep that target on the
36
+ // tested 0.13 line until the upstream linker crash is cleared.
34
37
  //
35
38
  // llama.cpp pin (matches the fork the runtime loads via
36
39
  // plugins/plugin-aosp-local-inference/src/aosp-local-inference-bootstrap.ts):
@@ -159,9 +162,11 @@
159
162
  // call (Commandment 8: don't hide broken pipelines behind fallbacks).
160
163
  //
161
164
  // Repo-root resolution:
162
- // The script defaults `--assets-dir` to
163
- // `<repoRoot>/packages/app/android/app/src/main/assets/agent` and
164
- // `--cache-dir` to `~/.cache/eliza-android-agent/llama-cpp-<tag>`.
165
+ // The script defaults `--assets-dir` to the first app shell found under
166
+ // `<repoRoot>/packages/app`, `<repoRoot>/apps/app`, or
167
+ // `<repoRoot>/eliza/packages/app`, then appends
168
+ // `android/app/src/main/assets/agent`. `--cache-dir` defaults to
169
+ // `~/.cache/eliza-android-agent/llama-cpp-<tag>`.
165
170
  // `<repoRoot>` is derived from this script's location: walk up from
166
171
  // `eliza/packages/app-core/scripts/aosp/` to the host repo root by
167
172
  // default, but when the parent host repo invokes this via the
@@ -212,9 +217,17 @@ const repoRoot = resolveRepoRootFromImportMeta(import.meta.url);
212
217
  // baked in. apply-patches.mjs is kept around for one release as a
213
218
  // rollback path; see scripts/aosp/llama-cpp-patches/README.md.
214
219
  export const LLAMA_CPP_TAG = "v1.2.0-eliza";
215
- export const LLAMA_CPP_COMMIT = "33c888a7be0b0b8ffb54cd3f0e05b4bed20cc52e";
220
+ // Must track the `plugins/plugin-local-inference/native/llama.cpp` submodule
221
+ // gitlink on develop. The old pin `33c888a7be` predated the Mali flash-attn
222
+ // subgroup-race fix (the `VK_VENDOR_ID_ARM` `disable_subgroups` branch), so the
223
+ // fused Vulkan lib built from it SIGABRTed mid-decode on Mali GPUs (#9508). This
224
+ // commit is a forward descendant that bakes the mitigation in; the
225
+ // `verify-fused-symbols` gate enforces the marker is present post-build.
226
+ export const LLAMA_CPP_COMMIT = "32a7911dced6230ce544c43a6399f5bd721cab90";
216
227
  export const LLAMA_CPP_REMOTE = "https://github.com/elizaOS/llama.cpp.git";
217
228
  export const MIN_ZIG_VERSION = "0.13.0";
229
+ export const AARCH64_MUSL_ZIG_MIN_VERSION = "0.13.0";
230
+ export const AARCH64_MUSL_ZIG_MAX_VERSION_EXCLUSIVE = "0.14.0";
218
231
  // Floor for the RVV-on riscv64 build. Zig 0.13's bundled LLVM rejects the
219
232
  // GCC-style `-march=rv64gcv*` ISA string the vendored llama.cpp's
220
233
  // ggml-cpu/CMakeLists hard-codes when GGML_RVV / GGML_RV_ZFH / etc. are ON;
@@ -228,6 +241,31 @@ export const MIN_ZIG_VERSION = "0.13.0";
228
241
  // ggml/src/ggml-cpu/arch/riscv/quants.c) light up.
229
242
  export const MIN_ZIG_RVV_VERSION = "0.14.0";
230
243
 
244
+ // Pinned zig series (MAJOR.MINOR) for the aarch64/x86_64 `*-linux-musl`
245
+ // cross-link that produces the Android/cuttlefish + fused (libelizainference)
246
+ // libs. zig 0.16 bundles an LLVM whose `lld` SIGSEGVs while linking the
247
+ // aarch64-linux-musl shared object — a host-toolchain regression that aborts
248
+ // the link with no actionable diagnostic (it looks like an OOM / random crash,
249
+ // not a config error). zig 0.13.x links these targets cleanly, so we pin the
250
+ // series rather than only enforcing a floor: a newer-is-fine `>=` check would
251
+ // silently route an operator's `brew install zig` (0.16) straight into the
252
+ // SIGSEGV. This is intentionally a series pin, not an exact-patch pin — any
253
+ // 0.13.x patch release links fine. The riscv64 RVV path keeps its own
254
+ // MIN_ZIG_RVV_VERSION floor (it needs 0.14+ for the RVV ISA string) and is a
255
+ // distinct musl triple, so it is exempt from this pin (see
256
+ // `assertZigPinForTargets`). An operator who has independently verified their
257
+ // zig's lld links aarch64-linux-musl can override with
258
+ // ELIZA_ALLOW_UNPINNED_ZIG=1, but the default refuses the broken toolchain.
259
+ export const PINNED_ZIG_SERIES_FOR_MUSL_LINK = "0.13";
260
+ // zig triples whose lld link is covered by the 0.13.x pin above. riscv64 is
261
+ // deliberately absent: its RVV build path requires 0.14+ and is gated by
262
+ // MIN_ZIG_RVV_VERSION instead.
263
+ export const PINNED_ZIG_LINK_TRIPLES = Object.freeze([
264
+ "aarch64-linux-musl",
265
+ "x86_64-linux-musl",
266
+ ]);
267
+ export const ALLOW_UNPINNED_ZIG_ENV = "ELIZA_ALLOW_UNPINNED_ZIG";
268
+
231
269
  // The in-repo submodule checkout of the fork.
232
270
  // `repoRoot` resolves to the repo root that contains a top-level package.json.
233
271
  const LLAMA_CPP_SUBMODULE_DIR = path.join(
@@ -268,6 +306,33 @@ export const ABI_TARGETS = [
268
306
  },
269
307
  ];
270
308
 
309
+ /**
310
+ * Map a list of Android ABI directory names (`arm64-v8a` | `x86_64` |
311
+ * `riscv64`) to the distinct zig cross-link triples (`zigTarget`) they build
312
+ * through. Used to decide which targets the zig-series pin applies to. Throws
313
+ * on an unknown ABI rather than silently dropping it.
314
+ *
315
+ * Exported for tests.
316
+ *
317
+ * @param {readonly string[]} abis
318
+ * @returns {string[]}
319
+ */
320
+ export function zigTriplesForAbis(abis) {
321
+ const triples = new Set();
322
+ for (const abi of abis) {
323
+ const target = ABI_TARGETS.find((t) => t.androidAbi === abi);
324
+ if (!target) {
325
+ throw new Error(
326
+ `[compile-libllama] unknown Android ABI ${abi}; expected one of ${ABI_TARGETS.map(
327
+ (t) => t.androidAbi,
328
+ ).join(", ")}.`,
329
+ );
330
+ }
331
+ triples.add(target.zigTarget);
332
+ }
333
+ return [...triples];
334
+ }
335
+
271
336
  // `*-fused` android targets that are wired to real AOSP artifacts.
272
337
  // Membership in this set is the only way the fused (omnivoice-grafted) build
273
338
  // path activates from this script — there is no env-var shortcut and no
@@ -336,6 +401,55 @@ export function parseAndroidTarget(target) {
336
401
  return { target, arch, backend, fused, androidAbi };
337
402
  }
338
403
 
404
+ export function resolveAndroidNdkHostDir(
405
+ prebuiltRoot,
406
+ { platform = os.platform(), arch = os.arch(), entries } = {},
407
+ ) {
408
+ const dirs =
409
+ entries ??
410
+ (fs.existsSync(prebuiltRoot) ? fs.readdirSync(prebuiltRoot) : []);
411
+ const hostDirs = dirs
412
+ .filter((d) => /^(linux|darwin|windows)-(x86_64|aarch64|arm64)$/.test(d))
413
+ .sort();
414
+ const hostPrefix =
415
+ platform === "win32"
416
+ ? "windows"
417
+ : platform === "linux" || platform === "darwin"
418
+ ? platform
419
+ : null;
420
+ if (!hostPrefix) return null;
421
+
422
+ const preferredArch =
423
+ arch === "x64" ? "x86_64" : arch === "arm64" ? "arm64" : arch;
424
+ const archCandidates =
425
+ preferredArch === "arm64"
426
+ ? ["arm64", "aarch64", "x86_64"]
427
+ : [preferredArch, "x86_64"];
428
+ return (
429
+ archCandidates
430
+ .map((candidate) => `${hostPrefix}-${candidate}`)
431
+ .find((candidate) => hostDirs.includes(candidate)) ??
432
+ hostDirs.find((candidate) => candidate.startsWith(`${hostPrefix}-`)) ??
433
+ null
434
+ );
435
+ }
436
+
437
+ export function resolveHomebrewFormulaIncludeDirs(
438
+ formula,
439
+ prefixes = ["/opt/homebrew", "/usr/local"],
440
+ ) {
441
+ const includeDirs = [];
442
+ for (const prefix of prefixes) {
443
+ includeDirs.push(path.join(prefix, "opt", formula, "include"));
444
+ const cellar = path.join(prefix, "Cellar", formula);
445
+ if (!fs.existsSync(cellar)) continue;
446
+ for (const version of fs.readdirSync(cellar).sort(compareSemver)) {
447
+ includeDirs.push(path.join(cellar, version, "include"));
448
+ }
449
+ }
450
+ return includeDirs;
451
+ }
452
+
339
453
  /**
340
454
  * GGML_VULKAN CMake flags for the android-arm64 Vulkan backend. Points cmake at
341
455
  * the NDK's host `glslc` (the shader compiler ggml-vulkan's codegen invokes),
@@ -368,11 +482,24 @@ export function resolveAndroidVulkanCmakeFlags({
368
482
  );
369
483
  }
370
484
  const ndk = path.join(ndkRoot, ndks[ndks.length - 1]);
371
- const sysroot = path.join(
485
+ // Resolve the NDK host-prebuilt dir from the actual host, not a hardcoded
486
+ // `linux-x86_64` — the same NDK ships `darwin-x86_64` on macOS hosts, so
487
+ // hardcoding linux made the Android Vulkan build Linux-only (#9508).
488
+ const prebuiltRoot = path.join(ndk, "toolchains/llvm/prebuilt");
489
+ const hostDir = resolveAndroidNdkHostDir(prebuiltRoot);
490
+ if (!hostDir) {
491
+ throw new Error(
492
+ `[compile-libllama] No NDK host toolchain under ${prebuiltRoot} ` +
493
+ `(need a host-matching linux/darwin/windows prebuilt).`,
494
+ );
495
+ }
496
+ const sysroot = path.join(prebuiltRoot, hostDir, "sysroot");
497
+ const glslc = path.join(
372
498
  ndk,
373
- "toolchains/llvm/prebuilt/linux-x86_64/sysroot",
499
+ "shader-tools",
500
+ hostDir,
501
+ os.platform() === "win32" ? "glslc.exe" : "glslc",
374
502
  );
375
- const glslc = path.join(ndk, "shader-tools/linux-x86_64/glslc");
376
503
  const libBase = path.join(sysroot, "usr/lib/aarch64-linux-android");
377
504
  const apis = fs.existsSync(libBase)
378
505
  ? fs
@@ -401,6 +528,7 @@ export function resolveAndroidVulkanCmakeFlags({
401
528
  process.env.VULKAN_SDK && path.join(process.env.VULKAN_SDK, "include"),
402
529
  "/usr/include",
403
530
  "/usr/local/include",
531
+ ...resolveHomebrewFormulaIncludeDirs("vulkan-headers"),
404
532
  ].filter(Boolean);
405
533
  const hostVulkanDir = headerCandidates
406
534
  .map((d) => path.join(d, "vulkan"))
@@ -442,6 +570,7 @@ export function resolveAndroidVulkanCmakeFlags({
442
570
  process.env.VULKAN_SDK && path.join(process.env.VULKAN_SDK, "include"),
443
571
  "/usr/include",
444
572
  "/usr/local/include",
573
+ ...resolveHomebrewFormulaIncludeDirs("spirv-headers"),
445
574
  ].filter(Boolean);
446
575
  const hostSpirvRoot = spirvCandidates.find((d) =>
447
576
  fs.existsSync(path.join(d, "spirv/unified1/spirv.hpp")),
@@ -456,7 +585,9 @@ export function resolveAndroidVulkanCmakeFlags({
456
585
  }
457
586
  const stagedSpirv = path.join(incRoot, "spirv");
458
587
  fs.rmSync(stagedSpirv, { recursive: true, force: true });
459
- fs.cpSync(path.join(hostSpirvRoot, "spirv"), stagedSpirv, { recursive: true });
588
+ fs.cpSync(path.join(hostSpirvRoot, "spirv"), stagedSpirv, {
589
+ recursive: true,
590
+ });
460
591
 
461
592
  for (const [name, p] of [
462
593
  ["vulkan/vulkan.hpp", path.join(stagedVulkan, "vulkan.hpp")],
@@ -477,19 +608,45 @@ export function resolveAndroidVulkanCmakeFlags({
477
608
  ];
478
609
  }
479
610
 
611
+ export function resolveDefaultAndroidAssetsDir({ root = repoRoot } = {}) {
612
+ const appRelativeCandidates = [
613
+ path.join("packages", "app"),
614
+ path.join("apps", "app"),
615
+ path.join("eliza", "packages", "app"),
616
+ ];
617
+ for (const appRelative of appRelativeCandidates) {
618
+ const appRoot = path.join(root, appRelative);
619
+ if (
620
+ fs.existsSync(path.join(appRoot, "android")) ||
621
+ fs.existsSync(path.join(appRoot, "package.json"))
622
+ ) {
623
+ return path.join(
624
+ appRoot,
625
+ "android",
626
+ "app",
627
+ "src",
628
+ "main",
629
+ "assets",
630
+ "agent",
631
+ );
632
+ }
633
+ }
634
+ return path.join(
635
+ root,
636
+ "packages",
637
+ "app",
638
+ "android",
639
+ "app",
640
+ "src",
641
+ "main",
642
+ "assets",
643
+ "agent",
644
+ );
645
+ }
646
+
480
647
  export function parseArgs(argv) {
481
648
  const args = {
482
- androidAssetsDir: path.join(
483
- repoRoot,
484
- "packages",
485
- "app",
486
- "android",
487
- "app",
488
- "src",
489
- "main",
490
- "assets",
491
- "agent",
492
- ),
649
+ androidAssetsDir: resolveDefaultAndroidAssetsDir(),
493
650
  cacheDir: path.join(
494
651
  os.homedir(),
495
652
  ".cache",
@@ -507,6 +664,15 @@ export function parseArgs(argv) {
507
664
  srcDir: null,
508
665
  cacheDirExplicit: false,
509
666
  dryRun: false,
667
+ // Optional source dir of prebuilt LiteRT-LM `.litertlm` text artifacts to
668
+ // stage into the on-device bundle assets (`models/text/`), parallel to the
669
+ // `.so`/.gguf staging. Defaults to ELIZA_LITERTLM_DIR; absent ⇒ no-op (the
670
+ // GGUF-only default bundle is byte-identical).
671
+ litertlmDir:
672
+ process.env.ELIZA_LITERTLM_DIR &&
673
+ process.env.ELIZA_LITERTLM_DIR.trim().length > 0
674
+ ? path.resolve(process.env.ELIZA_LITERTLM_DIR.trim())
675
+ : null,
510
676
  };
511
677
 
512
678
  const readFlagValue = (flag, index) => {
@@ -529,6 +695,9 @@ export function parseArgs(argv) {
529
695
  } else if (arg === "--src-dir") {
530
696
  args.srcDir = path.resolve(readFlagValue(arg, i));
531
697
  i += 1;
698
+ } else if (arg === "--litertlm-dir") {
699
+ args.litertlmDir = path.resolve(readFlagValue(arg, i));
700
+ i += 1;
532
701
  } else if (arg === "--abi") {
533
702
  const value = readFlagValue(arg, i);
534
703
  const valid = ABI_TARGETS.map((t) => t.androidAbi);
@@ -562,7 +731,11 @@ export function parseArgs(argv) {
562
731
  "Usage: node eliza/packages/app-core/scripts/aosp/compile-libllama.mjs " +
563
732
  "[--assets-dir <PATH>] [--cache-dir <PATH>] [--src-dir <PATH>] " +
564
733
  "[--abi <arm64-v8a|x86_64|riscv64>] [--target <android-<arch>-<backend>[-fused]>] " +
565
- "[--jobs <N>] [--skip-if-present] [--dry-run]\n" +
734
+ "[--litertlm-dir <PATH>] [--jobs <N>] [--skip-if-present] [--dry-run]\n" +
735
+ " --litertlm-dir <PATH> Stage prebuilt LiteRT-LM .litertlm text artifacts from\n" +
736
+ " PATH into the on-device bundle assets (models/text/), parallel\n" +
737
+ " to the .so/.gguf staging. Defaults to ELIZA_LITERTLM_DIR.\n" +
738
+ " Omit ⇒ GGUF-only bundle (the default).\n" +
566
739
  " --target <TRIPLE> Build a single target: android-{arm64,x86_64,riscv64}-cpu[-fused].\n" +
567
740
  " riscv64 requires NDK r27+ (first stable NDK with a real\n" +
568
741
  " riscv64-linux-android sysroot); older NDKs will fail the\n" +
@@ -664,6 +837,90 @@ export function probeZig({
664
837
  return version;
665
838
  }
666
839
 
840
+ /**
841
+ * Extract the MAJOR.MINOR series from a zig version string. `0.13.0` -> `0.13`,
842
+ * `0.13.0-dev.46+abc` -> `0.13`. Returns `null` for an unparseable input so
843
+ * callers can decide how to treat a missing/garbage version.
844
+ *
845
+ * Exported for tests.
846
+ *
847
+ * @param {string} version
848
+ * @returns {string | null}
849
+ */
850
+ export function zigSeries(version) {
851
+ if (typeof version !== "string") return null;
852
+ const parts = version
853
+ .replace(/^v/, "")
854
+ .split(/[-+]/)[0]
855
+ .split(".")
856
+ .map((n) => Number.parseInt(n, 10));
857
+ if (
858
+ parts.length < 2 ||
859
+ !Number.isFinite(parts[0]) ||
860
+ !Number.isFinite(parts[1])
861
+ ) {
862
+ return null;
863
+ }
864
+ return `${parts[0]}.${parts[1]}`;
865
+ }
866
+
867
+ /**
868
+ * Enforce the zig-series pin (PINNED_ZIG_SERIES_FOR_MUSL_LINK) for any requested
869
+ * target whose link goes through one of PINNED_ZIG_LINK_TRIPLES (the
870
+ * aarch64/x86_64 `*-linux-musl` Android / fused libs). zig 0.16's bundled lld
871
+ * SIGSEGVs that link, so a plain `>=` floor is not enough — we must reject a
872
+ * newer-but-broken toolchain too. riscv64-only target sets are exempt (their
873
+ * RVV path needs 0.14+, gated separately by MIN_ZIG_RVV_VERSION).
874
+ *
875
+ * Pure + deterministic: takes the detected version + the resolved triple list +
876
+ * env, throws on a pin violation, returns nothing on success. No side effects.
877
+ *
878
+ * Exported for tests.
879
+ *
880
+ * @param {object} params
881
+ * @param {string} params.version zig version string from probeZig().
882
+ * @param {readonly string[]} params.zigTriples the `zigTarget` triples the run
883
+ * will cross-link (e.g. ["aarch64-linux-musl"]).
884
+ * @param {NodeJS.ProcessEnv} [params.env]
885
+ */
886
+ export function assertZigPinForTargets({
887
+ version,
888
+ zigTriples,
889
+ env = process.env,
890
+ }) {
891
+ const pinnedTriples = zigTriples.filter((t) =>
892
+ PINNED_ZIG_LINK_TRIPLES.includes(t),
893
+ );
894
+ if (pinnedTriples.length === 0) {
895
+ // No pinned-link triple in this run (e.g. riscv64-only) — nothing to pin.
896
+ return;
897
+ }
898
+ if (env[ALLOW_UNPINNED_ZIG_ENV] === "1") {
899
+ console.warn(
900
+ `[compile-libllama] ${ALLOW_UNPINNED_ZIG_ENV}=1 set; skipping the zig ` +
901
+ `${PINNED_ZIG_SERIES_FOR_MUSL_LINK}.x pin for ${pinnedTriples.join(", ")} ` +
902
+ `(zig ${version}). Only safe if you have verified this zig's lld links ` +
903
+ `aarch64-linux-musl without SIGSEGV.`,
904
+ );
905
+ return;
906
+ }
907
+ const series = zigSeries(version);
908
+ if (series !== PINNED_ZIG_SERIES_FOR_MUSL_LINK) {
909
+ throw new Error(
910
+ `[compile-libllama] zig ${version} (series ${series ?? "unknown"}) is not ` +
911
+ `the pinned zig ${PINNED_ZIG_SERIES_FOR_MUSL_LINK}.x required to link ` +
912
+ `${pinnedTriples.join(", ")}.\n` +
913
+ `zig 0.16's bundled lld SIGSEGVs the aarch64-linux-musl link, aborting ` +
914
+ `the fused/Android build with no actionable diagnostic; zig 0.13.x links ` +
915
+ `it cleanly. Install zig ${PINNED_ZIG_SERIES_FOR_MUSL_LINK}.x and re-run:\n` +
916
+ ` download the 0.13.x tarball from https://ziglang.org/download/ and put ` +
917
+ `\`zig\` on PATH (the package-manager \`zig\` is frequently 0.16).\n` +
918
+ `If you have independently verified your zig's lld links ` +
919
+ `aarch64-linux-musl, override with ${ALLOW_UNPINNED_ZIG_ENV}=1.`,
920
+ );
921
+ }
922
+ }
923
+
667
924
  /**
668
925
  * Decide the riscv64 build plan based on the detected Zig version + env knobs.
669
926
  * Pure: takes the version string + env, returns a structured plan. No side
@@ -855,6 +1112,16 @@ export function ensureLlamaCppCheckout({
855
1112
  cwd: cacheDir,
856
1113
  });
857
1114
  }
1115
+ // The pinned commit is authoritative and may NOT be the tag tip — the moving
1116
+ // LLAMA_CPP_TAG and LLAMA_CPP_COMMIT can diverge (e.g. the commit lives on a
1117
+ // feature branch while the tag was re-pointed at a release). A
1118
+ // `--branch <tag>` shallow clone only carries the tag's commit, so a bare
1119
+ // `git checkout <commit>` then fails with "unable to read tree". Fetch the
1120
+ // exact pinned commit by sha first (GitHub serves any ref-reachable sha) so
1121
+ // the working tree always lands on LLAMA_CPP_COMMIT, never the tag.
1122
+ spawn("git", ["fetch", "--depth", "1", "origin", LLAMA_CPP_COMMIT], {
1123
+ cwd: cacheDir,
1124
+ });
858
1125
  spawn("git", ["checkout", "--detach", LLAMA_CPP_COMMIT], {
859
1126
  cwd: cacheDir,
860
1127
  });
@@ -1092,18 +1359,18 @@ export function ensureZigDrivers({
1092
1359
  // forwards the whole array with every quote and space preserved.
1093
1360
  const riscv64ArgFilter =
1094
1361
  abi === "riscv64" && !riscv64MarchPassthrough
1095
- ? '_n=$#\n' +
1096
- 'i=0\n' +
1097
- 'while [ $i -lt $_n ]; do\n' +
1098
- ' arg=$1\n' +
1099
- ' shift\n' +
1100
- ' i=$((i+1))\n' +
1362
+ ? "_n=$#\n" +
1363
+ "i=0\n" +
1364
+ "while [ $i -lt $_n ]; do\n" +
1365
+ " arg=$1\n" +
1366
+ " shift\n" +
1367
+ " i=$((i+1))\n" +
1101
1368
  ' case "$arg" in\n' +
1102
- ' -march=rv64gc|-march=rv64gc_*) ;;\n' +
1103
- ' -mabi=lp64d|-mabi=lp64) ;;\n' +
1369
+ " -march=rv64gc|-march=rv64gc_*) ;;\n" +
1370
+ " -mabi=lp64d|-mabi=lp64) ;;\n" +
1104
1371
  ' *) set -- "$@" "$arg" ;;\n' +
1105
- ' esac\n' +
1106
- 'done\n'
1372
+ " esac\n" +
1373
+ "done\n"
1107
1374
  : null;
1108
1375
 
1109
1376
  // arm64: the ggml-cpu CMakeLists emits the GCC-style ISA string
@@ -1121,22 +1388,22 @@ export function ensureZigDrivers({
1121
1388
  // through untouched (there shouldn't be one for arm64).
1122
1389
  const arm64ArgFilter =
1123
1390
  abi === "arm64-v8a"
1124
- ? '_n=$#\n' +
1125
- 'i=0\n' +
1126
- 'while [ $i -lt $_n ]; do\n' +
1127
- ' arg=$1\n' +
1128
- ' shift\n' +
1129
- ' i=$((i+1))\n' +
1391
+ ? "_n=$#\n" +
1392
+ "i=0\n" +
1393
+ "while [ $i -lt $_n ]; do\n" +
1394
+ " arg=$1\n" +
1395
+ " shift\n" +
1396
+ " i=$((i+1))\n" +
1130
1397
  ' case "$arg" in\n' +
1131
- ' -march=armv8.*-a+*)\n' +
1398
+ " -march=armv8.*-a+*)\n" +
1132
1399
  ' _feats=""\n' +
1133
- ' case "$arg" in *+dotprod*) _feats="${_feats}+dotprod" ;; esac\n' +
1134
- ' case "$arg" in *+i8mm*) _feats="${_feats}+i8mm" ;; esac\n' +
1135
- ' case "$arg" in *+fp16*) _feats="${_feats}+fullfp16" ;; esac\n' +
1136
- ' set -- "$@" "-mcpu=generic${_feats}" ;;\n' +
1400
+ ` case "$arg" in *+dotprod*) _feats="\${_feats}+dotprod" ;; esac\n` +
1401
+ ` case "$arg" in *+i8mm*) _feats="\${_feats}+i8mm" ;; esac\n` +
1402
+ ` case "$arg" in *+fp16*) _feats="\${_feats}+fullfp16" ;; esac\n` +
1403
+ ` set -- "$@" "-mcpu=generic\${_feats}" ;;\n` +
1137
1404
  ' *) set -- "$@" "$arg" ;;\n' +
1138
- ' esac\n' +
1139
- 'done\n'
1405
+ " esac\n" +
1406
+ "done\n"
1140
1407
  : null;
1141
1408
 
1142
1409
  const argFilter = riscv64ArgFilter ?? arm64ArgFilter;
@@ -1241,7 +1508,10 @@ export function buildLibllamaForAbi({
1241
1508
  `reason=${riscv64Plan.reason}`,
1242
1509
  );
1243
1510
  }
1244
- const riscv64BuildFlags = riscv64CmakeFlagsForPlan({ abi, plan: riscv64Plan });
1511
+ const riscv64BuildFlags = riscv64CmakeFlagsForPlan({
1512
+ abi,
1513
+ plan: riscv64Plan,
1514
+ });
1245
1515
 
1246
1516
  // x86_64: the mobile x86_64 ABI only ever runs on cuttlefish / the Android
1247
1517
  // x86_64 emulator (both KVM-backed by an AVX2-class host, and our emulator
@@ -1421,12 +1691,28 @@ export function buildLibllamaForAbi({
1421
1691
  // The target name is `llama-server` on the apothic fork (verified against
1422
1692
  // the upstream b8198 examples/server/CMakeLists.txt: `add_executable(
1423
1693
  // ${TARGET} server.cpp ...)` with `set(TARGET llama-server)`).
1694
+ //
1695
+ // Non-fatal for the library build: llama-server is the optional AOSP
1696
+ // MTP/spec-decode HTTP path, but the required in-process libs below
1697
+ // (libllama.so/libggml*.so and, for fused targets, libelizainference.so) are
1698
+ // verified separately. On the musl cross-link this target can fail to resolve
1699
+ // its httplib/OpenSSL deps (undefined `httplib::*` / `SSLClient` symbols).
1700
+ // In that case stage-android-agent warns about the missing server and runtime
1701
+ // falls back to the non-MTP path instead of losing the whole native build.
1424
1702
  log(`[compile-libllama] Compiling llama-server for ${abi} with -j${jobs}`);
1425
- spawn(
1426
- "cmake",
1427
- ["--build", buildDir, "--target", "llama-server", "-j", String(jobs)],
1428
- {},
1429
- );
1703
+ try {
1704
+ spawn(
1705
+ "cmake",
1706
+ ["--build", buildDir, "--target", "llama-server", "-j", String(jobs)],
1707
+ {},
1708
+ );
1709
+ } catch (err) {
1710
+ log(
1711
+ `[compile-libllama] WARN: llama-server failed to build for ${abi}; ` +
1712
+ `continuing — it bundles nothing into the APK and libllama.so/libelizainference.so are unaffected. ` +
1713
+ `Cause: ${err instanceof Error ? err.message : String(err)}`,
1714
+ );
1715
+ }
1430
1716
 
1431
1717
  // libllama.so and the ggml shared-library family are all transitive build
1432
1718
  // products of the `llama` target. b4500's NEEDED chain (verified via
@@ -1452,7 +1738,7 @@ export function buildLibllamaForAbi({
1452
1738
  let llamaOut = null;
1453
1739
  let ggmlOuts = [];
1454
1740
  let runtimeSiblingOuts = [];
1455
- let sonameAliases = [];
1741
+ const sonameAliases = [];
1456
1742
  if (!isStaticFused) {
1457
1743
  const builtLlama = locateBuiltLib(buildDir, "libllama.so");
1458
1744
  if (!builtLlama) {
@@ -1615,7 +1901,6 @@ export function buildLibllamaForAbi({
1615
1901
  };
1616
1902
  }
1617
1903
 
1618
-
1619
1904
  /**
1620
1905
  * Find every `libggml*.so` under the build tree. b4500 shipped plain .so
1621
1906
  * files; the apothic fork (built off b8198) ships SONAME-versioned files
@@ -1834,7 +2119,7 @@ function locateBuiltLib(buildDir, soName) {
1834
2119
  */
1835
2120
  // Cache of the resolved llvm-strip path (from the Android NDK toolchain).
1836
2121
  // Set once on first call so we don't re-walk the NDK dir for every artifact.
1837
- let _ndkLlvmStripPathCache = undefined;
2122
+ let _ndkLlvmStripPathCache;
1838
2123
  function locateNdkLlvmStrip() {
1839
2124
  if (_ndkLlvmStripPathCache !== undefined) return _ndkLlvmStripPathCache;
1840
2125
  // Honor the same env-var ladder as build-llama-cpp-mtp's resolveAndroidNdk()
@@ -1932,11 +2217,9 @@ function stripBinary({ filePath, zigBin, log }) {
1932
2217
  // for riscv64 until Zig 0.14's objcopy lands across all build hosts.
1933
2218
  const llvmStrip = locateNdkLlvmStrip();
1934
2219
  if (llvmStrip) {
1935
- const llvmStripResult = spawnSync(
1936
- llvmStrip,
1937
- ["--strip-all", filePath],
1938
- { stdio: ["ignore", "pipe", "pipe"] },
1939
- );
2220
+ const llvmStripResult = spawnSync(llvmStrip, ["--strip-all", filePath], {
2221
+ stdio: ["ignore", "pipe", "pipe"],
2222
+ });
1940
2223
  if (llvmStripResult.status === 0) return true;
1941
2224
  log(
1942
2225
  `[compile-libllama] DEBUG: NDK llvm-strip (${llvmStrip}) failed ` +
@@ -1966,6 +2249,75 @@ export function applyOmnivoiceGraft({ srcDir: _srcDir, log = console.log }) {
1966
2249
  return { mode: "merged", source: "tools/omnivoice" };
1967
2250
  }
1968
2251
 
2252
+ /**
2253
+ * Stage prebuilt LiteRT-LM `.litertlm` text artifacts into the on-device
2254
+ * bundle assets, parallel to the `.so` libs this script stages and the `.gguf`
2255
+ * models `stage-default-models.mjs` stages. The destination is
2256
+ * `<androidAssetsDir>/models/text/` — the same `text/` subdir the GGUF text
2257
+ * weights land in (`models/text/eliza-1-<tier>-128k.gguf`) and the path the
2258
+ * C-side `llm_backend_select` / `find_litertlm_artifact` probes at runtime
2259
+ * (`<bundleRoot>/text/*.litertlm`, see
2260
+ * `tools/omnivoice/src/backends/litert-backend.cpp`).
2261
+ *
2262
+ * GGUF stays the default: when no `litertlmDir` is configured (no
2263
+ * `--litertlm-dir` / `ELIZA_LITERTLM_DIR`) or the dir holds no `.litertlm`,
2264
+ * this is a no-op and the bundle is byte-identical to a GGUF-only build. A
2265
+ * configured dir that does not exist is a hard error (the operator asked for
2266
+ * LiteRT staging but pointed us at nothing — don't silently ship GGUF-only).
2267
+ *
2268
+ * `.litertlm` artifacts are model files, arch-independent like the GGUFs, so
2269
+ * they are staged ONCE into the shared `models/text/` dir — not per-ABI.
2270
+ *
2271
+ * Exported for unit tests.
2272
+ */
2273
+ export function stageLitertlmArtifacts({
2274
+ litertlmDir,
2275
+ androidAssetsDir,
2276
+ log = console.log,
2277
+ dryRun = false,
2278
+ }) {
2279
+ if (!litertlmDir) return [];
2280
+ if (!fs.existsSync(litertlmDir)) {
2281
+ throw new Error(
2282
+ `[compile-libllama] --litertlm-dir ${litertlmDir} does not exist. ` +
2283
+ `Point it at a directory of prebuilt .litertlm artifacts, or omit it to ` +
2284
+ `ship the GGUF-only bundle.`,
2285
+ );
2286
+ }
2287
+ const artifacts = fs
2288
+ .readdirSync(litertlmDir, { withFileTypes: true })
2289
+ .filter((e) => e.isFile() && e.name.endsWith(".litertlm"))
2290
+ .map((e) => e.name);
2291
+ if (artifacts.length === 0) {
2292
+ log(
2293
+ `[compile-libllama] No .litertlm artifacts under ${litertlmDir}; LiteRT ` +
2294
+ `staging is a no-op (GGUF-only bundle).`,
2295
+ );
2296
+ return [];
2297
+ }
2298
+ const textDir = path.join(androidAssetsDir, "models", "text");
2299
+ if (dryRun) {
2300
+ log(
2301
+ `[compile-libllama] (dry-run) would stage ${artifacts.length} .litertlm ` +
2302
+ `artifact(s) into ${textDir}: ${artifacts.join(", ")}`,
2303
+ );
2304
+ return artifacts.map((name) => path.join(textDir, name));
2305
+ }
2306
+ fs.mkdirSync(textDir, { recursive: true });
2307
+ const staged = [];
2308
+ for (const name of artifacts) {
2309
+ const src = path.join(litertlmDir, name);
2310
+ const dst = path.join(textDir, name);
2311
+ fs.copyFileSync(src, dst);
2312
+ staged.push(dst);
2313
+ log(
2314
+ `[compile-libllama] Staged LiteRT artifact ${name} -> ${dst} ` +
2315
+ `(${(fs.statSync(dst).size / (1024 * 1024)).toFixed(2)} MB).`,
2316
+ );
2317
+ }
2318
+ return staged;
2319
+ }
2320
+
1969
2321
  /**
1970
2322
  * Print the dry-run plan for one `android-<arch>-<backend>[-fused]` target:
1971
2323
  * the cmake invocation, the post-cmake build target list, the graft steps
@@ -2004,6 +2356,12 @@ export function describeAndroidTargetDryRun({
2004
2356
  log(` src=${srcDir}`);
2005
2357
  log(` build=${buildDir}`);
2006
2358
  log(` install=${abiAssetDir}`);
2359
+ if (parsed.androidAbi === "arm64-v8a") {
2360
+ log(
2361
+ ` zig requirement: ${AARCH64_MUSL_ZIG_MIN_VERSION} <= version < ` +
2362
+ `${AARCH64_MUSL_ZIG_MAX_VERSION_EXCLUSIVE} (aarch64-linux-musl pin)`,
2363
+ );
2364
+ }
2007
2365
  if (parsed.fused) {
2008
2366
  log(` omnivoice: merged in-fork path (tools/omnivoice/)`);
2009
2367
  }
@@ -2092,6 +2450,10 @@ export async function main(argv = process.argv.slice(2)) {
2092
2450
  if (!args.dryRun) {
2093
2451
  const zigVersion = probeZig();
2094
2452
  console.log(`[compile-libllama] Found zig ${zigVersion}`);
2453
+ assertZigPinForTargets({
2454
+ version: zigVersion,
2455
+ zigTriples: zigTriplesForAbis(args.abis),
2456
+ });
2095
2457
  } else {
2096
2458
  console.log(`[compile-libllama] (dry-run) skipping zig toolchain probe`);
2097
2459
  }
@@ -2224,6 +2586,14 @@ export async function main(argv = process.argv.slice(2)) {
2224
2586
  // the production-landing checklist.
2225
2587
  await compileShimMain(["--skip-if-present"]);
2226
2588
 
2589
+ // Stage any prebuilt LiteRT-LM `.litertlm` text artifacts into the shared
2590
+ // on-device bundle assets (arch-independent, so once — not per ABI). No-op
2591
+ // unless --litertlm-dir / ELIZA_LITERTLM_DIR is configured; GGUF stays default.
2592
+ stageLitertlmArtifacts({
2593
+ litertlmDir: args.litertlmDir,
2594
+ androidAssetsDir: args.androidAssetsDir,
2595
+ });
2596
+
2227
2597
  console.log(
2228
2598
  `[compile-libllama] Built libllama.so + libggml*.so + llama-server for ` +
2229
2599
  `${args.abis.join(", ")} (${srcDescription}).`,
@@ -2296,6 +2666,10 @@ export async function mainTargets(args) {
2296
2666
  if (!args.dryRun) {
2297
2667
  const zigVersion = probeZig();
2298
2668
  console.log(`[compile-libllama] Found zig ${zigVersion}`);
2669
+ assertZigPinForTargets({
2670
+ version: zigVersion,
2671
+ zigTriples: zigTriplesForAbis(args.targets.map((t) => t.androidAbi)),
2672
+ });
2299
2673
  } else {
2300
2674
  console.log(`[compile-libllama] (dry-run) skipping zig toolchain probe`);
2301
2675
  }
@@ -2403,6 +2777,11 @@ export async function mainTargets(args) {
2403
2777
  }
2404
2778
 
2405
2779
  if (args.dryRun) {
2780
+ stageLitertlmArtifacts({
2781
+ litertlmDir: args.litertlmDir,
2782
+ androidAssetsDir: args.androidAssetsDir,
2783
+ dryRun: true,
2784
+ });
2406
2785
  console.log(
2407
2786
  `[compile-libllama] (dry-run) plan complete: ${args.targets.length} target(s) (${srcDescription}).`,
2408
2787
  );
@@ -2415,6 +2794,14 @@ export async function mainTargets(args) {
2415
2794
  await compileShimMain(["--skip-if-present"]);
2416
2795
  }
2417
2796
 
2797
+ // Stage any prebuilt LiteRT-LM `.litertlm` text artifacts into the shared
2798
+ // on-device bundle assets (once — arch-independent). No-op unless
2799
+ // --litertlm-dir / ELIZA_LITERTLM_DIR is configured; GGUF stays the default.
2800
+ stageLitertlmArtifacts({
2801
+ litertlmDir: args.litertlmDir,
2802
+ androidAssetsDir: args.androidAssetsDir,
2803
+ });
2804
+
2418
2805
  console.log(
2419
2806
  `[compile-libllama] Built ${args.targets.map((t) => t.target).join(", ")} (${srcDescription}).`,
2420
2807
  );