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

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 (361) 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-paths.mjs +110 -0
  152. package/scripts/aosp/compile-libllama-zig-pin.test.mjs +147 -0
  153. package/scripts/aosp/compile-libllama.mjs +377 -81
  154. package/scripts/aosp/compile-libllama.test.mjs +133 -0
  155. package/scripts/aosp/compile-shim.mjs +21 -1
  156. package/scripts/aosp/deploy-pixel.mjs +1 -1
  157. package/scripts/aosp/stage-default-models.mjs +24 -31
  158. package/scripts/aosp/stage-default-models.test.mjs +23 -0
  159. package/scripts/assert-required-bundled-packages.test.ts +22 -1
  160. package/scripts/build-helpers/verify-fused-symbols.mjs +33 -0
  161. package/scripts/build-helpers/verify-fused-symbols.test.mjs +0 -0
  162. package/scripts/build-image.sh +1 -3
  163. package/scripts/build-llama-cpp-mtp.mjs +17 -16
  164. package/scripts/check-i18n.mjs +0 -1
  165. package/scripts/copy-runtime-node-modules.ts +147 -0
  166. package/scripts/desktop-build.mjs +317 -4
  167. package/scripts/docker-ci-smoke.sh +33 -8
  168. package/scripts/ensure-type-package-aliases.mjs +1 -1
  169. package/scripts/ios-xcframework/run-physical-device-smoke.mjs +1 -1
  170. package/scripts/lib/agent-source-watcher.mjs +0 -1
  171. package/scripts/lib/artifact-staleness.d.mts +33 -0
  172. package/scripts/lib/artifact-staleness.mjs +122 -0
  173. package/scripts/lib/artifact-staleness.test.mts +98 -0
  174. package/scripts/lib/duet-bridge.mjs +1 -1
  175. package/scripts/lib/ios-plist-url-scheme.mjs +80 -0
  176. package/scripts/lib/mobile-build-decisions.mjs +97 -0
  177. package/scripts/lib/renderer-build-manifest.d.mts +65 -0
  178. package/scripts/lib/renderer-build-manifest.mjs +257 -0
  179. package/scripts/lib/renderer-build-manifest.test.mts +277 -0
  180. package/scripts/lib/stage-android-agent.mjs +13 -4
  181. package/scripts/lib/verify-ondevice-artifact.d.mts +16 -0
  182. package/scripts/lib/verify-ondevice-artifact.mjs +61 -0
  183. package/scripts/lib/verify-ondevice-artifact.test.mts +98 -0
  184. package/scripts/lib/websocket-pending-queue.ts +92 -0
  185. package/scripts/link-docker-local-app-packages.mjs +6 -0
  186. package/scripts/playwright-ui-live-stack.ts +430 -144
  187. package/scripts/playwright-ui-smoke-api-stub.mjs +160 -168
  188. package/scripts/run-local-plugin-live-smoke.mjs +1 -6
  189. package/scripts/run-mobile-build-brand-separation.test.mts +33 -0
  190. package/scripts/run-mobile-build-ios-engine-gate.test.mjs +85 -0
  191. package/scripts/run-mobile-build-mtp-staleness.test.mts +198 -0
  192. package/scripts/run-mobile-build.mjs +408 -86
  193. package/scripts/serve-real-local-agent.ts +72 -0
  194. package/scripts/stage-desktop-fused-lib.mjs +43 -14
  195. package/scripts/verify-ondevice-artifact.mjs +111 -0
  196. package/scripts/voice-attribution-smoke.ts +144 -38
  197. package/scripts/voice-duet.mjs +6 -6
  198. package/scripts/voice-e2e-hardware.ts +22 -16
  199. package/scripts/voice-interactive.mjs +16 -45
  200. package/security/agent-vault-id.d.ts +1 -1
  201. package/security/platform-secure-store-node.d.ts +1 -1
  202. package/services/ambient-audio/consent.d.ts +1 -1
  203. package/services/ambient-audio/index.d.ts +6 -6
  204. package/services/ambient-audio/replay-buffer.d.ts +1 -1
  205. package/services/ambient-audio/response-gate.d.ts +1 -1
  206. package/services/ambient-audio/service.d.ts +3 -3
  207. package/services/connector-target-catalog.d.ts +1 -1
  208. package/services/sensitive-requests/index.d.ts +6 -6
  209. package/services/steward-sidecar/wallet-setup.d.ts +1 -1
  210. package/services/steward-sidecar.d.ts +3 -3
  211. package/services/tunnel-to-mobile/index.d.ts +1 -1
  212. package/services/vault-bootstrap.d.ts.map +1 -1
  213. package/services/vault-bootstrap.js +14 -10
  214. package/services/voice-profiles/diarization-pipeline.d.ts +1 -1
  215. package/services/voice-profiles/index.d.ts +11 -11
  216. package/services/voice-profiles/owner-confidence.d.ts +1 -1
  217. package/services/voice-profiles/private-challenge.d.ts +1 -1
  218. package/services/voice-profiles/store.d.ts +1 -1
  219. package/test/helpers/live-provider.test.ts +91 -1
  220. package/test/helpers/live-provider.ts +195 -51
  221. package/test/scripts/websocket-pending-queue.test.ts +119 -0
  222. package/test-support/test-helpers.d.ts +0 -33
  223. package/test-support/test-helpers.d.ts.map +1 -1
  224. package/test-support/test-helpers.js +81 -189
  225. package/ui-compat.d.ts +1 -0
  226. package/ui-compat.d.ts.map +1 -1
  227. package/ui-compat.js +4 -0
  228. package/platforms/electrobun/docs/convergence-audit.json +0 -3505
  229. package/platforms/electrobun/docs/convergence-audit.md +0 -694
  230. package/platforms/electrobun/scripts/ensure-whisper-gguf.sh +0 -55
  231. package/platforms/electrobun/scripts/ensure-whisper-model.sh +0 -35
  232. package/platforms/electrobun/scripts/generate-convergence-audit.ts +0 -1203
  233. package/platforms/electrobun/src/native/whisper-env.test.ts +0 -71
  234. package/platforms/electrobun/src/native/whisper-env.ts +0 -68
  235. package/registry/app-registry.d.ts +0 -14
  236. package/registry/app-registry.d.ts.map +0 -1
  237. package/registry/app-registry.js +0 -29
  238. package/registry/entries/apps/app-polymarket.json +0 -31
  239. package/registry/entries/apps/clawville.json +0 -27
  240. package/registry/entries/apps/companion.json +0 -28
  241. package/registry/entries/apps/database-viewer.json +0 -27
  242. package/registry/entries/apps/defense-of-the-agents.json +0 -27
  243. package/registry/entries/apps/documents.json +0 -30
  244. package/registry/entries/apps/feed.json +0 -27
  245. package/registry/entries/apps/hyperliquid.json +0 -31
  246. package/registry/entries/apps/log-viewer.json +0 -27
  247. package/registry/entries/apps/memory-viewer.json +0 -27
  248. package/registry/entries/apps/model-tester.json +0 -31
  249. package/registry/entries/apps/plugin-viewer.json +0 -27
  250. package/registry/entries/apps/relationship-viewer.json +0 -27
  251. package/registry/entries/apps/runtime-debugger.json +0 -27
  252. package/registry/entries/apps/shopify.json +0 -31
  253. package/registry/entries/apps/skills-viewer.json +0 -27
  254. package/registry/entries/apps/steward.json +0 -31
  255. package/registry/entries/apps/training.json +0 -54
  256. package/registry/entries/apps/trajectory-viewer.json +0 -27
  257. package/registry/entries/apps/vincent.json +0 -31
  258. package/registry/entries/connectors/bluebubbles.json +0 -99
  259. package/registry/entries/connectors/bluesky.json +0 -173
  260. package/registry/entries/connectors/discord.json +0 -119
  261. package/registry/entries/connectors/farcaster.json +0 -174
  262. package/registry/entries/connectors/feishu.json +0 -79
  263. package/registry/entries/connectors/google-chat.json +0 -120
  264. package/registry/entries/connectors/google.json +0 -82
  265. package/registry/entries/connectors/imessage.json +0 -96
  266. package/registry/entries/connectors/instagram.json +0 -64
  267. package/registry/entries/connectors/line.json +0 -86
  268. package/registry/entries/connectors/matrix.json +0 -94
  269. package/registry/entries/connectors/mattermost.json +0 -110
  270. package/registry/entries/connectors/msteams.json +0 -104
  271. package/registry/entries/connectors/nextcloud-talk.json +0 -104
  272. package/registry/entries/connectors/nostr.json +0 -70
  273. package/registry/entries/connectors/signal.json +0 -81
  274. package/registry/entries/connectors/slack.json +0 -102
  275. package/registry/entries/connectors/telegram.json +0 -71
  276. package/registry/entries/connectors/tlon.json +0 -94
  277. package/registry/entries/connectors/twitch.json +0 -110
  278. package/registry/entries/connectors/whatsapp.json +0 -113
  279. package/registry/entries/connectors/x.json +0 -231
  280. package/registry/entries/connectors/zalo.json +0 -112
  281. package/registry/entries/connectors/zalouser.json +0 -122
  282. package/registry/entries/plugins/agent-orchestrator.json +0 -33
  283. package/registry/entries/plugins/agent-skills.json +0 -72
  284. package/registry/entries/plugins/anthropic.json +0 -73
  285. package/registry/entries/plugins/app-control.json +0 -23
  286. package/registry/entries/plugins/auto-trader.json +0 -203
  287. package/registry/entries/plugins/background-runner.json +0 -26
  288. package/registry/entries/plugins/blooio.json +0 -102
  289. package/registry/entries/plugins/browser.json +0 -75
  290. package/registry/entries/plugins/cli.json +0 -40
  291. package/registry/entries/plugins/clipboard.json +0 -44
  292. package/registry/entries/plugins/coding-tools.json +0 -71
  293. package/registry/entries/plugins/commands.json +0 -63
  294. package/registry/entries/plugins/computeruse.json +0 -74
  295. package/registry/entries/plugins/copilot-proxy.json +0 -93
  296. package/registry/entries/plugins/directives.json +0 -63
  297. package/registry/entries/plugins/edge-tts.json +0 -97
  298. package/registry/entries/plugins/elevenlabs.json +0 -169
  299. package/registry/entries/plugins/elizacloud.json +0 -208
  300. package/registry/entries/plugins/evm.json +0 -134
  301. package/registry/entries/plugins/experience.json +0 -34
  302. package/registry/entries/plugins/facewear.json +0 -131
  303. package/registry/entries/plugins/form.json +0 -26
  304. package/registry/entries/plugins/github.json +0 -93
  305. package/registry/entries/plugins/gmail-watch.json +0 -25
  306. package/registry/entries/plugins/goals.json +0 -77
  307. package/registry/entries/plugins/google-genai.json +0 -106
  308. package/registry/entries/plugins/groq.json +0 -93
  309. package/registry/entries/plugins/hedera.json +0 -48
  310. package/registry/entries/plugins/inmemorydb.json +0 -25
  311. package/registry/entries/plugins/linear.json +0 -51
  312. package/registry/entries/plugins/local-inference.json +0 -137
  313. package/registry/entries/plugins/local-storage.json +0 -36
  314. package/registry/entries/plugins/localdb.json +0 -25
  315. package/registry/entries/plugins/mcp.json +0 -44
  316. package/registry/entries/plugins/memory.json +0 -124
  317. package/registry/entries/plugins/minecraft.json +0 -79
  318. package/registry/entries/plugins/moltbook.json +0 -83
  319. package/registry/entries/plugins/music.json +0 -155
  320. package/registry/entries/plugins/mysticism.json +0 -48
  321. package/registry/entries/plugins/nearai.json +0 -82
  322. package/registry/entries/plugins/ngrok.json +0 -69
  323. package/registry/entries/plugins/ollama.json +0 -96
  324. package/registry/entries/plugins/openai.json +0 -189
  325. package/registry/entries/plugins/openrouter.json +0 -188
  326. package/registry/entries/plugins/pdf.json +0 -26
  327. package/registry/entries/plugins/plugin-manager.json +0 -23
  328. package/registry/entries/plugins/prose.json +0 -48
  329. package/registry/entries/plugins/rlm.json +0 -26
  330. package/registry/entries/plugins/roblox.json +0 -88
  331. package/registry/entries/plugins/rss.json +0 -64
  332. package/registry/entries/plugins/s3-storage.json +0 -91
  333. package/registry/entries/plugins/scheduling.json +0 -35
  334. package/registry/entries/plugins/shell.json +0 -94
  335. package/registry/entries/plugins/social-alpha.json +0 -72
  336. package/registry/entries/plugins/tailscale.json +0 -81
  337. package/registry/entries/plugins/tee.json +0 -53
  338. package/registry/entries/plugins/todos.json +0 -26
  339. package/registry/entries/plugins/trajectory-logger.json +0 -33
  340. package/registry/entries/plugins/trust.json +0 -39
  341. package/registry/entries/plugins/tts.json +0 -71
  342. package/registry/entries/plugins/tunnel.json +0 -45
  343. package/registry/entries/plugins/twilio.json +0 -168
  344. package/registry/entries/plugins/vercel-ai-gateway.json +0 -128
  345. package/registry/entries/plugins/video.json +0 -23
  346. package/registry/entries/plugins/vision.json +0 -43
  347. package/registry/entries/plugins/webhooks.json +0 -23
  348. package/registry/entries/plugins/workflow.json +0 -25
  349. package/registry/entries/plugins/xai.json +0 -75
  350. package/registry/loader.d.ts +0 -28
  351. package/registry/loader.d.ts.map +0 -1
  352. package/registry/loader.js +0 -158
  353. package/registry/schema.d.ts +0 -1199
  354. package/registry/schema.d.ts.map +0 -1
  355. package/registry/schema.js +0 -300
  356. package/scripts/patches/llama-mobile-kokoro-tts.patch +0 -480
  357. package/scripts/release-workflow-drift.test.ts +0 -57
  358. package/test/helpers/i18n.ts +0 -5
  359. package/test/helpers/loopback.ts +0 -33
  360. package/test/helpers/react-test.ts +0 -40
  361. 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
@@ -182,8 +187,20 @@ import {
182
187
  import { verifyFusedSymbols } from "../build-helpers/verify-fused-symbols.mjs";
183
188
  import { patchVulkanKernels } from "../kernel-patches/vulkan-kernels.mjs";
184
189
  import { resolveRepoRootFromImportMeta } from "../lib/repo-root.mjs";
190
+ import {
191
+ compareSemver,
192
+ resolveAndroidNdkHostDir,
193
+ resolveDefaultAndroidAssetsDir as resolveDefaultAndroidAssetsDirForRoot,
194
+ resolveHomebrewFormulaIncludeDirs,
195
+ } from "./compile-libllama-paths.mjs";
185
196
  import { main as compileShimMain } from "./compile-shim.mjs";
186
197
 
198
+ export {
199
+ compareSemver,
200
+ resolveAndroidNdkHostDir,
201
+ resolveHomebrewFormulaIncludeDirs,
202
+ };
203
+
187
204
  const here = path.dirname(fileURLToPath(import.meta.url));
188
205
  // Walk up from `eliza/packages/app-core/scripts/aosp/` until we hit
189
206
  // the host repo root (the directory with a top-level `package.json`).
@@ -212,9 +229,17 @@ const repoRoot = resolveRepoRootFromImportMeta(import.meta.url);
212
229
  // baked in. apply-patches.mjs is kept around for one release as a
213
230
  // rollback path; see scripts/aosp/llama-cpp-patches/README.md.
214
231
  export const LLAMA_CPP_TAG = "v1.2.0-eliza";
215
- export const LLAMA_CPP_COMMIT = "33c888a7be0b0b8ffb54cd3f0e05b4bed20cc52e";
232
+ // Must track the `plugins/plugin-local-inference/native/llama.cpp` submodule
233
+ // gitlink on develop. The old pin `33c888a7be` predated the Mali flash-attn
234
+ // subgroup-race fix (the `VK_VENDOR_ID_ARM` `disable_subgroups` branch), so the
235
+ // fused Vulkan lib built from it SIGABRTed mid-decode on Mali GPUs (#9508). This
236
+ // commit is a forward descendant that bakes the mitigation in; the
237
+ // `verify-fused-symbols` gate enforces the marker is present post-build.
238
+ export const LLAMA_CPP_COMMIT = "32a7911dced6230ce544c43a6399f5bd721cab90";
216
239
  export const LLAMA_CPP_REMOTE = "https://github.com/elizaOS/llama.cpp.git";
217
240
  export const MIN_ZIG_VERSION = "0.13.0";
241
+ export const AARCH64_MUSL_ZIG_MIN_VERSION = "0.13.0";
242
+ export const AARCH64_MUSL_ZIG_MAX_VERSION_EXCLUSIVE = "0.14.0";
218
243
  // Floor for the RVV-on riscv64 build. Zig 0.13's bundled LLVM rejects the
219
244
  // GCC-style `-march=rv64gcv*` ISA string the vendored llama.cpp's
220
245
  // ggml-cpu/CMakeLists hard-codes when GGML_RVV / GGML_RV_ZFH / etc. are ON;
@@ -228,6 +253,31 @@ export const MIN_ZIG_VERSION = "0.13.0";
228
253
  // ggml/src/ggml-cpu/arch/riscv/quants.c) light up.
229
254
  export const MIN_ZIG_RVV_VERSION = "0.14.0";
230
255
 
256
+ // Pinned zig series (MAJOR.MINOR) for the aarch64/x86_64 `*-linux-musl`
257
+ // cross-link that produces the Android/cuttlefish + fused (libelizainference)
258
+ // libs. zig 0.16 bundles an LLVM whose `lld` SIGSEGVs while linking the
259
+ // aarch64-linux-musl shared object — a host-toolchain regression that aborts
260
+ // the link with no actionable diagnostic (it looks like an OOM / random crash,
261
+ // not a config error). zig 0.13.x links these targets cleanly, so we pin the
262
+ // series rather than only enforcing a floor: a newer-is-fine `>=` check would
263
+ // silently route an operator's `brew install zig` (0.16) straight into the
264
+ // SIGSEGV. This is intentionally a series pin, not an exact-patch pin — any
265
+ // 0.13.x patch release links fine. The riscv64 RVV path keeps its own
266
+ // MIN_ZIG_RVV_VERSION floor (it needs 0.14+ for the RVV ISA string) and is a
267
+ // distinct musl triple, so it is exempt from this pin (see
268
+ // `assertZigPinForTargets`). An operator who has independently verified their
269
+ // zig's lld links aarch64-linux-musl can override with
270
+ // ELIZA_ALLOW_UNPINNED_ZIG=1, but the default refuses the broken toolchain.
271
+ export const PINNED_ZIG_SERIES_FOR_MUSL_LINK = "0.13";
272
+ // zig triples whose lld link is covered by the 0.13.x pin above. riscv64 is
273
+ // deliberately absent: its RVV build path requires 0.14+ and is gated by
274
+ // MIN_ZIG_RVV_VERSION instead.
275
+ export const PINNED_ZIG_LINK_TRIPLES = Object.freeze([
276
+ "aarch64-linux-musl",
277
+ "x86_64-linux-musl",
278
+ ]);
279
+ export const ALLOW_UNPINNED_ZIG_ENV = "ELIZA_ALLOW_UNPINNED_ZIG";
280
+
231
281
  // The in-repo submodule checkout of the fork.
232
282
  // `repoRoot` resolves to the repo root that contains a top-level package.json.
233
283
  const LLAMA_CPP_SUBMODULE_DIR = path.join(
@@ -268,6 +318,33 @@ export const ABI_TARGETS = [
268
318
  },
269
319
  ];
270
320
 
321
+ /**
322
+ * Map a list of Android ABI directory names (`arm64-v8a` | `x86_64` |
323
+ * `riscv64`) to the distinct zig cross-link triples (`zigTarget`) they build
324
+ * through. Used to decide which targets the zig-series pin applies to. Throws
325
+ * on an unknown ABI rather than silently dropping it.
326
+ *
327
+ * Exported for tests.
328
+ *
329
+ * @param {readonly string[]} abis
330
+ * @returns {string[]}
331
+ */
332
+ export function zigTriplesForAbis(abis) {
333
+ const triples = new Set();
334
+ for (const abi of abis) {
335
+ const target = ABI_TARGETS.find((t) => t.androidAbi === abi);
336
+ if (!target) {
337
+ throw new Error(
338
+ `[compile-libllama] unknown Android ABI ${abi}; expected one of ${ABI_TARGETS.map(
339
+ (t) => t.androidAbi,
340
+ ).join(", ")}.`,
341
+ );
342
+ }
343
+ triples.add(target.zigTarget);
344
+ }
345
+ return [...triples];
346
+ }
347
+
271
348
  // `*-fused` android targets that are wired to real AOSP artifacts.
272
349
  // Membership in this set is the only way the fused (omnivoice-grafted) build
273
350
  // path activates from this script — there is no env-var shortcut and no
@@ -368,11 +445,24 @@ export function resolveAndroidVulkanCmakeFlags({
368
445
  );
369
446
  }
370
447
  const ndk = path.join(ndkRoot, ndks[ndks.length - 1]);
371
- const sysroot = path.join(
448
+ // Resolve the NDK host-prebuilt dir from the actual host, not a hardcoded
449
+ // `linux-x86_64` — the same NDK ships `darwin-x86_64` on macOS hosts, so
450
+ // hardcoding linux made the Android Vulkan build Linux-only (#9508).
451
+ const prebuiltRoot = path.join(ndk, "toolchains/llvm/prebuilt");
452
+ const hostDir = resolveAndroidNdkHostDir(prebuiltRoot);
453
+ if (!hostDir) {
454
+ throw new Error(
455
+ `[compile-libllama] No NDK host toolchain under ${prebuiltRoot} ` +
456
+ `(need a host-matching linux/darwin/windows prebuilt).`,
457
+ );
458
+ }
459
+ const sysroot = path.join(prebuiltRoot, hostDir, "sysroot");
460
+ const glslc = path.join(
372
461
  ndk,
373
- "toolchains/llvm/prebuilt/linux-x86_64/sysroot",
462
+ "shader-tools",
463
+ hostDir,
464
+ os.platform() === "win32" ? "glslc.exe" : "glslc",
374
465
  );
375
- const glslc = path.join(ndk, "shader-tools/linux-x86_64/glslc");
376
466
  const libBase = path.join(sysroot, "usr/lib/aarch64-linux-android");
377
467
  const apis = fs.existsSync(libBase)
378
468
  ? fs
@@ -401,6 +491,7 @@ export function resolveAndroidVulkanCmakeFlags({
401
491
  process.env.VULKAN_SDK && path.join(process.env.VULKAN_SDK, "include"),
402
492
  "/usr/include",
403
493
  "/usr/local/include",
494
+ ...resolveHomebrewFormulaIncludeDirs("vulkan-headers"),
404
495
  ].filter(Boolean);
405
496
  const hostVulkanDir = headerCandidates
406
497
  .map((d) => path.join(d, "vulkan"))
@@ -442,6 +533,7 @@ export function resolveAndroidVulkanCmakeFlags({
442
533
  process.env.VULKAN_SDK && path.join(process.env.VULKAN_SDK, "include"),
443
534
  "/usr/include",
444
535
  "/usr/local/include",
536
+ ...resolveHomebrewFormulaIncludeDirs("spirv-headers"),
445
537
  ].filter(Boolean);
446
538
  const hostSpirvRoot = spirvCandidates.find((d) =>
447
539
  fs.existsSync(path.join(d, "spirv/unified1/spirv.hpp")),
@@ -456,7 +548,9 @@ export function resolveAndroidVulkanCmakeFlags({
456
548
  }
457
549
  const stagedSpirv = path.join(incRoot, "spirv");
458
550
  fs.rmSync(stagedSpirv, { recursive: true, force: true });
459
- fs.cpSync(path.join(hostSpirvRoot, "spirv"), stagedSpirv, { recursive: true });
551
+ fs.cpSync(path.join(hostSpirvRoot, "spirv"), stagedSpirv, {
552
+ recursive: true,
553
+ });
460
554
 
461
555
  for (const [name, p] of [
462
556
  ["vulkan/vulkan.hpp", path.join(stagedVulkan, "vulkan.hpp")],
@@ -477,19 +571,13 @@ export function resolveAndroidVulkanCmakeFlags({
477
571
  ];
478
572
  }
479
573
 
574
+ export function resolveDefaultAndroidAssetsDir({ root = repoRoot } = {}) {
575
+ return resolveDefaultAndroidAssetsDirForRoot({ root });
576
+ }
577
+
480
578
  export function parseArgs(argv) {
481
579
  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
- ),
580
+ androidAssetsDir: resolveDefaultAndroidAssetsDir(),
493
581
  cacheDir: path.join(
494
582
  os.homedir(),
495
583
  ".cache",
@@ -507,6 +595,15 @@ export function parseArgs(argv) {
507
595
  srcDir: null,
508
596
  cacheDirExplicit: false,
509
597
  dryRun: false,
598
+ // Optional source dir of prebuilt LiteRT-LM `.litertlm` text artifacts to
599
+ // stage into the on-device bundle assets (`models/text/`), parallel to the
600
+ // `.so`/.gguf staging. Defaults to ELIZA_LITERTLM_DIR; absent ⇒ no-op (the
601
+ // GGUF-only default bundle is byte-identical).
602
+ litertlmDir:
603
+ process.env.ELIZA_LITERTLM_DIR &&
604
+ process.env.ELIZA_LITERTLM_DIR.trim().length > 0
605
+ ? path.resolve(process.env.ELIZA_LITERTLM_DIR.trim())
606
+ : null,
510
607
  };
511
608
 
512
609
  const readFlagValue = (flag, index) => {
@@ -529,6 +626,9 @@ export function parseArgs(argv) {
529
626
  } else if (arg === "--src-dir") {
530
627
  args.srcDir = path.resolve(readFlagValue(arg, i));
531
628
  i += 1;
629
+ } else if (arg === "--litertlm-dir") {
630
+ args.litertlmDir = path.resolve(readFlagValue(arg, i));
631
+ i += 1;
532
632
  } else if (arg === "--abi") {
533
633
  const value = readFlagValue(arg, i);
534
634
  const valid = ABI_TARGETS.map((t) => t.androidAbi);
@@ -562,7 +662,11 @@ export function parseArgs(argv) {
562
662
  "Usage: node eliza/packages/app-core/scripts/aosp/compile-libllama.mjs " +
563
663
  "[--assets-dir <PATH>] [--cache-dir <PATH>] [--src-dir <PATH>] " +
564
664
  "[--abi <arm64-v8a|x86_64|riscv64>] [--target <android-<arch>-<backend>[-fused]>] " +
565
- "[--jobs <N>] [--skip-if-present] [--dry-run]\n" +
665
+ "[--litertlm-dir <PATH>] [--jobs <N>] [--skip-if-present] [--dry-run]\n" +
666
+ " --litertlm-dir <PATH> Stage prebuilt LiteRT-LM .litertlm text artifacts from\n" +
667
+ " PATH into the on-device bundle assets (models/text/), parallel\n" +
668
+ " to the .so/.gguf staging. Defaults to ELIZA_LITERTLM_DIR.\n" +
669
+ " Omit ⇒ GGUF-only bundle (the default).\n" +
566
670
  " --target <TRIPLE> Build a single target: android-{arm64,x86_64,riscv64}-cpu[-fused].\n" +
567
671
  " riscv64 requires NDK r27+ (first stable NDK with a real\n" +
568
672
  " riscv64-linux-android sysroot); older NDKs will fail the\n" +
@@ -601,28 +705,6 @@ export function parseArgs(argv) {
601
705
  return args;
602
706
  }
603
707
 
604
- /**
605
- * Compare two semver-ish version strings (zig follows MAJOR.MINOR.PATCH for
606
- * stable releases; dev builds add `-dev.NNN+sha` which we strip).
607
- * Returns negative when `a < b`, positive when `a > b`, zero on equal.
608
- */
609
- export function compareSemver(a, b) {
610
- const norm = (v) =>
611
- String(v)
612
- .replace(/^v/, "")
613
- .split(/[-+]/)[0]
614
- .split(".")
615
- .map((n) => Number.parseInt(n, 10) || 0);
616
- const aa = norm(a);
617
- const bb = norm(b);
618
- for (let i = 0; i < Math.max(aa.length, bb.length); i += 1) {
619
- const x = aa[i] ?? 0;
620
- const y = bb[i] ?? 0;
621
- if (x !== y) return x - y;
622
- }
623
- return 0;
624
- }
625
-
626
708
  /**
627
709
  * Probe the build host for a usable zig toolchain. Returns the absolute path
628
710
  * to the zig binary on success, or throws an Error with an install hint
@@ -664,6 +746,90 @@ export function probeZig({
664
746
  return version;
665
747
  }
666
748
 
749
+ /**
750
+ * Extract the MAJOR.MINOR series from a zig version string. `0.13.0` -> `0.13`,
751
+ * `0.13.0-dev.46+abc` -> `0.13`. Returns `null` for an unparseable input so
752
+ * callers can decide how to treat a missing/garbage version.
753
+ *
754
+ * Exported for tests.
755
+ *
756
+ * @param {string} version
757
+ * @returns {string | null}
758
+ */
759
+ export function zigSeries(version) {
760
+ if (typeof version !== "string") return null;
761
+ const parts = version
762
+ .replace(/^v/, "")
763
+ .split(/[-+]/)[0]
764
+ .split(".")
765
+ .map((n) => Number.parseInt(n, 10));
766
+ if (
767
+ parts.length < 2 ||
768
+ !Number.isFinite(parts[0]) ||
769
+ !Number.isFinite(parts[1])
770
+ ) {
771
+ return null;
772
+ }
773
+ return `${parts[0]}.${parts[1]}`;
774
+ }
775
+
776
+ /**
777
+ * Enforce the zig-series pin (PINNED_ZIG_SERIES_FOR_MUSL_LINK) for any requested
778
+ * target whose link goes through one of PINNED_ZIG_LINK_TRIPLES (the
779
+ * aarch64/x86_64 `*-linux-musl` Android / fused libs). zig 0.16's bundled lld
780
+ * SIGSEGVs that link, so a plain `>=` floor is not enough — we must reject a
781
+ * newer-but-broken toolchain too. riscv64-only target sets are exempt (their
782
+ * RVV path needs 0.14+, gated separately by MIN_ZIG_RVV_VERSION).
783
+ *
784
+ * Pure + deterministic: takes the detected version + the resolved triple list +
785
+ * env, throws on a pin violation, returns nothing on success. No side effects.
786
+ *
787
+ * Exported for tests.
788
+ *
789
+ * @param {object} params
790
+ * @param {string} params.version zig version string from probeZig().
791
+ * @param {readonly string[]} params.zigTriples the `zigTarget` triples the run
792
+ * will cross-link (e.g. ["aarch64-linux-musl"]).
793
+ * @param {NodeJS.ProcessEnv} [params.env]
794
+ */
795
+ export function assertZigPinForTargets({
796
+ version,
797
+ zigTriples,
798
+ env = process.env,
799
+ }) {
800
+ const pinnedTriples = zigTriples.filter((t) =>
801
+ PINNED_ZIG_LINK_TRIPLES.includes(t),
802
+ );
803
+ if (pinnedTriples.length === 0) {
804
+ // No pinned-link triple in this run (e.g. riscv64-only) — nothing to pin.
805
+ return;
806
+ }
807
+ if (env[ALLOW_UNPINNED_ZIG_ENV] === "1") {
808
+ console.warn(
809
+ `[compile-libllama] ${ALLOW_UNPINNED_ZIG_ENV}=1 set; skipping the zig ` +
810
+ `${PINNED_ZIG_SERIES_FOR_MUSL_LINK}.x pin for ${pinnedTriples.join(", ")} ` +
811
+ `(zig ${version}). Only safe if you have verified this zig's lld links ` +
812
+ `aarch64-linux-musl without SIGSEGV.`,
813
+ );
814
+ return;
815
+ }
816
+ const series = zigSeries(version);
817
+ if (series !== PINNED_ZIG_SERIES_FOR_MUSL_LINK) {
818
+ throw new Error(
819
+ `[compile-libllama] zig ${version} (series ${series ?? "unknown"}) is not ` +
820
+ `the pinned zig ${PINNED_ZIG_SERIES_FOR_MUSL_LINK}.x required to link ` +
821
+ `${pinnedTriples.join(", ")}.\n` +
822
+ `zig 0.16's bundled lld SIGSEGVs the aarch64-linux-musl link, aborting ` +
823
+ `the fused/Android build with no actionable diagnostic; zig 0.13.x links ` +
824
+ `it cleanly. Install zig ${PINNED_ZIG_SERIES_FOR_MUSL_LINK}.x and re-run:\n` +
825
+ ` download the 0.13.x tarball from https://ziglang.org/download/ and put ` +
826
+ `\`zig\` on PATH (the package-manager \`zig\` is frequently 0.16).\n` +
827
+ `If you have independently verified your zig's lld links ` +
828
+ `aarch64-linux-musl, override with ${ALLOW_UNPINNED_ZIG_ENV}=1.`,
829
+ );
830
+ }
831
+ }
832
+
667
833
  /**
668
834
  * Decide the riscv64 build plan based on the detected Zig version + env knobs.
669
835
  * Pure: takes the version string + env, returns a structured plan. No side
@@ -855,6 +1021,16 @@ export function ensureLlamaCppCheckout({
855
1021
  cwd: cacheDir,
856
1022
  });
857
1023
  }
1024
+ // The pinned commit is authoritative and may NOT be the tag tip — the moving
1025
+ // LLAMA_CPP_TAG and LLAMA_CPP_COMMIT can diverge (e.g. the commit lives on a
1026
+ // feature branch while the tag was re-pointed at a release). A
1027
+ // `--branch <tag>` shallow clone only carries the tag's commit, so a bare
1028
+ // `git checkout <commit>` then fails with "unable to read tree". Fetch the
1029
+ // exact pinned commit by sha first (GitHub serves any ref-reachable sha) so
1030
+ // the working tree always lands on LLAMA_CPP_COMMIT, never the tag.
1031
+ spawn("git", ["fetch", "--depth", "1", "origin", LLAMA_CPP_COMMIT], {
1032
+ cwd: cacheDir,
1033
+ });
858
1034
  spawn("git", ["checkout", "--detach", LLAMA_CPP_COMMIT], {
859
1035
  cwd: cacheDir,
860
1036
  });
@@ -1092,18 +1268,18 @@ export function ensureZigDrivers({
1092
1268
  // forwards the whole array with every quote and space preserved.
1093
1269
  const riscv64ArgFilter =
1094
1270
  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' +
1271
+ ? "_n=$#\n" +
1272
+ "i=0\n" +
1273
+ "while [ $i -lt $_n ]; do\n" +
1274
+ " arg=$1\n" +
1275
+ " shift\n" +
1276
+ " i=$((i+1))\n" +
1101
1277
  ' case "$arg" in\n' +
1102
- ' -march=rv64gc|-march=rv64gc_*) ;;\n' +
1103
- ' -mabi=lp64d|-mabi=lp64) ;;\n' +
1278
+ " -march=rv64gc|-march=rv64gc_*) ;;\n" +
1279
+ " -mabi=lp64d|-mabi=lp64) ;;\n" +
1104
1280
  ' *) set -- "$@" "$arg" ;;\n' +
1105
- ' esac\n' +
1106
- 'done\n'
1281
+ " esac\n" +
1282
+ "done\n"
1107
1283
  : null;
1108
1284
 
1109
1285
  // arm64: the ggml-cpu CMakeLists emits the GCC-style ISA string
@@ -1121,22 +1297,22 @@ export function ensureZigDrivers({
1121
1297
  // through untouched (there shouldn't be one for arm64).
1122
1298
  const arm64ArgFilter =
1123
1299
  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' +
1300
+ ? "_n=$#\n" +
1301
+ "i=0\n" +
1302
+ "while [ $i -lt $_n ]; do\n" +
1303
+ " arg=$1\n" +
1304
+ " shift\n" +
1305
+ " i=$((i+1))\n" +
1130
1306
  ' case "$arg" in\n' +
1131
- ' -march=armv8.*-a+*)\n' +
1307
+ " -march=armv8.*-a+*)\n" +
1132
1308
  ' _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' +
1309
+ ` case "$arg" in *+dotprod*) _feats="\${_feats}+dotprod" ;; esac\n` +
1310
+ ` case "$arg" in *+i8mm*) _feats="\${_feats}+i8mm" ;; esac\n` +
1311
+ ` case "$arg" in *+fp16*) _feats="\${_feats}+fullfp16" ;; esac\n` +
1312
+ ` set -- "$@" "-mcpu=generic\${_feats}" ;;\n` +
1137
1313
  ' *) set -- "$@" "$arg" ;;\n' +
1138
- ' esac\n' +
1139
- 'done\n'
1314
+ " esac\n" +
1315
+ "done\n"
1140
1316
  : null;
1141
1317
 
1142
1318
  const argFilter = riscv64ArgFilter ?? arm64ArgFilter;
@@ -1241,7 +1417,10 @@ export function buildLibllamaForAbi({
1241
1417
  `reason=${riscv64Plan.reason}`,
1242
1418
  );
1243
1419
  }
1244
- const riscv64BuildFlags = riscv64CmakeFlagsForPlan({ abi, plan: riscv64Plan });
1420
+ const riscv64BuildFlags = riscv64CmakeFlagsForPlan({
1421
+ abi,
1422
+ plan: riscv64Plan,
1423
+ });
1245
1424
 
1246
1425
  // x86_64: the mobile x86_64 ABI only ever runs on cuttlefish / the Android
1247
1426
  // x86_64 emulator (both KVM-backed by an AVX2-class host, and our emulator
@@ -1421,12 +1600,28 @@ export function buildLibllamaForAbi({
1421
1600
  // The target name is `llama-server` on the apothic fork (verified against
1422
1601
  // the upstream b8198 examples/server/CMakeLists.txt: `add_executable(
1423
1602
  // ${TARGET} server.cpp ...)` with `set(TARGET llama-server)`).
1603
+ //
1604
+ // Non-fatal for the library build: llama-server is the optional AOSP
1605
+ // MTP/spec-decode HTTP path, but the required in-process libs below
1606
+ // (libllama.so/libggml*.so and, for fused targets, libelizainference.so) are
1607
+ // verified separately. On the musl cross-link this target can fail to resolve
1608
+ // its httplib/OpenSSL deps (undefined `httplib::*` / `SSLClient` symbols).
1609
+ // In that case stage-android-agent warns about the missing server and runtime
1610
+ // falls back to the non-MTP path instead of losing the whole native build.
1424
1611
  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
- );
1612
+ try {
1613
+ spawn(
1614
+ "cmake",
1615
+ ["--build", buildDir, "--target", "llama-server", "-j", String(jobs)],
1616
+ {},
1617
+ );
1618
+ } catch (err) {
1619
+ log(
1620
+ `[compile-libllama] WARN: llama-server failed to build for ${abi}; ` +
1621
+ `continuing — it bundles nothing into the APK and libllama.so/libelizainference.so are unaffected. ` +
1622
+ `Cause: ${err instanceof Error ? err.message : String(err)}`,
1623
+ );
1624
+ }
1430
1625
 
1431
1626
  // libllama.so and the ggml shared-library family are all transitive build
1432
1627
  // products of the `llama` target. b4500's NEEDED chain (verified via
@@ -1452,7 +1647,7 @@ export function buildLibllamaForAbi({
1452
1647
  let llamaOut = null;
1453
1648
  let ggmlOuts = [];
1454
1649
  let runtimeSiblingOuts = [];
1455
- let sonameAliases = [];
1650
+ const sonameAliases = [];
1456
1651
  if (!isStaticFused) {
1457
1652
  const builtLlama = locateBuiltLib(buildDir, "libllama.so");
1458
1653
  if (!builtLlama) {
@@ -1615,7 +1810,6 @@ export function buildLibllamaForAbi({
1615
1810
  };
1616
1811
  }
1617
1812
 
1618
-
1619
1813
  /**
1620
1814
  * Find every `libggml*.so` under the build tree. b4500 shipped plain .so
1621
1815
  * files; the apothic fork (built off b8198) ships SONAME-versioned files
@@ -1834,7 +2028,7 @@ function locateBuiltLib(buildDir, soName) {
1834
2028
  */
1835
2029
  // Cache of the resolved llvm-strip path (from the Android NDK toolchain).
1836
2030
  // Set once on first call so we don't re-walk the NDK dir for every artifact.
1837
- let _ndkLlvmStripPathCache = undefined;
2031
+ let _ndkLlvmStripPathCache;
1838
2032
  function locateNdkLlvmStrip() {
1839
2033
  if (_ndkLlvmStripPathCache !== undefined) return _ndkLlvmStripPathCache;
1840
2034
  // Honor the same env-var ladder as build-llama-cpp-mtp's resolveAndroidNdk()
@@ -1932,11 +2126,9 @@ function stripBinary({ filePath, zigBin, log }) {
1932
2126
  // for riscv64 until Zig 0.14's objcopy lands across all build hosts.
1933
2127
  const llvmStrip = locateNdkLlvmStrip();
1934
2128
  if (llvmStrip) {
1935
- const llvmStripResult = spawnSync(
1936
- llvmStrip,
1937
- ["--strip-all", filePath],
1938
- { stdio: ["ignore", "pipe", "pipe"] },
1939
- );
2129
+ const llvmStripResult = spawnSync(llvmStrip, ["--strip-all", filePath], {
2130
+ stdio: ["ignore", "pipe", "pipe"],
2131
+ });
1940
2132
  if (llvmStripResult.status === 0) return true;
1941
2133
  log(
1942
2134
  `[compile-libllama] DEBUG: NDK llvm-strip (${llvmStrip}) failed ` +
@@ -1966,6 +2158,75 @@ export function applyOmnivoiceGraft({ srcDir: _srcDir, log = console.log }) {
1966
2158
  return { mode: "merged", source: "tools/omnivoice" };
1967
2159
  }
1968
2160
 
2161
+ /**
2162
+ * Stage prebuilt LiteRT-LM `.litertlm` text artifacts into the on-device
2163
+ * bundle assets, parallel to the `.so` libs this script stages and the `.gguf`
2164
+ * models `stage-default-models.mjs` stages. The destination is
2165
+ * `<androidAssetsDir>/models/text/` — the same `text/` subdir the GGUF text
2166
+ * weights land in (`models/text/eliza-1-<tier>-128k.gguf`) and the path the
2167
+ * C-side `llm_backend_select` / `find_litertlm_artifact` probes at runtime
2168
+ * (`<bundleRoot>/text/*.litertlm`, see
2169
+ * `tools/omnivoice/src/backends/litert-backend.cpp`).
2170
+ *
2171
+ * GGUF stays the default: when no `litertlmDir` is configured (no
2172
+ * `--litertlm-dir` / `ELIZA_LITERTLM_DIR`) or the dir holds no `.litertlm`,
2173
+ * this is a no-op and the bundle is byte-identical to a GGUF-only build. A
2174
+ * configured dir that does not exist is a hard error (the operator asked for
2175
+ * LiteRT staging but pointed us at nothing — don't silently ship GGUF-only).
2176
+ *
2177
+ * `.litertlm` artifacts are model files, arch-independent like the GGUFs, so
2178
+ * they are staged ONCE into the shared `models/text/` dir — not per-ABI.
2179
+ *
2180
+ * Exported for unit tests.
2181
+ */
2182
+ export function stageLitertlmArtifacts({
2183
+ litertlmDir,
2184
+ androidAssetsDir,
2185
+ log = console.log,
2186
+ dryRun = false,
2187
+ }) {
2188
+ if (!litertlmDir) return [];
2189
+ if (!fs.existsSync(litertlmDir)) {
2190
+ throw new Error(
2191
+ `[compile-libllama] --litertlm-dir ${litertlmDir} does not exist. ` +
2192
+ `Point it at a directory of prebuilt .litertlm artifacts, or omit it to ` +
2193
+ `ship the GGUF-only bundle.`,
2194
+ );
2195
+ }
2196
+ const artifacts = fs
2197
+ .readdirSync(litertlmDir, { withFileTypes: true })
2198
+ .filter((e) => e.isFile() && e.name.endsWith(".litertlm"))
2199
+ .map((e) => e.name);
2200
+ if (artifacts.length === 0) {
2201
+ log(
2202
+ `[compile-libllama] No .litertlm artifacts under ${litertlmDir}; LiteRT ` +
2203
+ `staging is a no-op (GGUF-only bundle).`,
2204
+ );
2205
+ return [];
2206
+ }
2207
+ const textDir = path.join(androidAssetsDir, "models", "text");
2208
+ if (dryRun) {
2209
+ log(
2210
+ `[compile-libllama] (dry-run) would stage ${artifacts.length} .litertlm ` +
2211
+ `artifact(s) into ${textDir}: ${artifacts.join(", ")}`,
2212
+ );
2213
+ return artifacts.map((name) => path.join(textDir, name));
2214
+ }
2215
+ fs.mkdirSync(textDir, { recursive: true });
2216
+ const staged = [];
2217
+ for (const name of artifacts) {
2218
+ const src = path.join(litertlmDir, name);
2219
+ const dst = path.join(textDir, name);
2220
+ fs.copyFileSync(src, dst);
2221
+ staged.push(dst);
2222
+ log(
2223
+ `[compile-libllama] Staged LiteRT artifact ${name} -> ${dst} ` +
2224
+ `(${(fs.statSync(dst).size / (1024 * 1024)).toFixed(2)} MB).`,
2225
+ );
2226
+ }
2227
+ return staged;
2228
+ }
2229
+
1969
2230
  /**
1970
2231
  * Print the dry-run plan for one `android-<arch>-<backend>[-fused]` target:
1971
2232
  * the cmake invocation, the post-cmake build target list, the graft steps
@@ -2004,6 +2265,12 @@ export function describeAndroidTargetDryRun({
2004
2265
  log(` src=${srcDir}`);
2005
2266
  log(` build=${buildDir}`);
2006
2267
  log(` install=${abiAssetDir}`);
2268
+ if (parsed.androidAbi === "arm64-v8a") {
2269
+ log(
2270
+ ` zig requirement: ${AARCH64_MUSL_ZIG_MIN_VERSION} <= version < ` +
2271
+ `${AARCH64_MUSL_ZIG_MAX_VERSION_EXCLUSIVE} (aarch64-linux-musl pin)`,
2272
+ );
2273
+ }
2007
2274
  if (parsed.fused) {
2008
2275
  log(` omnivoice: merged in-fork path (tools/omnivoice/)`);
2009
2276
  }
@@ -2092,6 +2359,10 @@ export async function main(argv = process.argv.slice(2)) {
2092
2359
  if (!args.dryRun) {
2093
2360
  const zigVersion = probeZig();
2094
2361
  console.log(`[compile-libllama] Found zig ${zigVersion}`);
2362
+ assertZigPinForTargets({
2363
+ version: zigVersion,
2364
+ zigTriples: zigTriplesForAbis(args.abis),
2365
+ });
2095
2366
  } else {
2096
2367
  console.log(`[compile-libllama] (dry-run) skipping zig toolchain probe`);
2097
2368
  }
@@ -2224,6 +2495,14 @@ export async function main(argv = process.argv.slice(2)) {
2224
2495
  // the production-landing checklist.
2225
2496
  await compileShimMain(["--skip-if-present"]);
2226
2497
 
2498
+ // Stage any prebuilt LiteRT-LM `.litertlm` text artifacts into the shared
2499
+ // on-device bundle assets (arch-independent, so once — not per ABI). No-op
2500
+ // unless --litertlm-dir / ELIZA_LITERTLM_DIR is configured; GGUF stays default.
2501
+ stageLitertlmArtifacts({
2502
+ litertlmDir: args.litertlmDir,
2503
+ androidAssetsDir: args.androidAssetsDir,
2504
+ });
2505
+
2227
2506
  console.log(
2228
2507
  `[compile-libllama] Built libllama.so + libggml*.so + llama-server for ` +
2229
2508
  `${args.abis.join(", ")} (${srcDescription}).`,
@@ -2296,6 +2575,10 @@ export async function mainTargets(args) {
2296
2575
  if (!args.dryRun) {
2297
2576
  const zigVersion = probeZig();
2298
2577
  console.log(`[compile-libllama] Found zig ${zigVersion}`);
2578
+ assertZigPinForTargets({
2579
+ version: zigVersion,
2580
+ zigTriples: zigTriplesForAbis(args.targets.map((t) => t.androidAbi)),
2581
+ });
2299
2582
  } else {
2300
2583
  console.log(`[compile-libllama] (dry-run) skipping zig toolchain probe`);
2301
2584
  }
@@ -2403,6 +2686,11 @@ export async function mainTargets(args) {
2403
2686
  }
2404
2687
 
2405
2688
  if (args.dryRun) {
2689
+ stageLitertlmArtifacts({
2690
+ litertlmDir: args.litertlmDir,
2691
+ androidAssetsDir: args.androidAssetsDir,
2692
+ dryRun: true,
2693
+ });
2406
2694
  console.log(
2407
2695
  `[compile-libllama] (dry-run) plan complete: ${args.targets.length} target(s) (${srcDescription}).`,
2408
2696
  );
@@ -2415,6 +2703,14 @@ export async function mainTargets(args) {
2415
2703
  await compileShimMain(["--skip-if-present"]);
2416
2704
  }
2417
2705
 
2706
+ // Stage any prebuilt LiteRT-LM `.litertlm` text artifacts into the shared
2707
+ // on-device bundle assets (once — arch-independent). No-op unless
2708
+ // --litertlm-dir / ELIZA_LITERTLM_DIR is configured; GGUF stays the default.
2709
+ stageLitertlmArtifacts({
2710
+ litertlmDir: args.litertlmDir,
2711
+ androidAssetsDir: args.androidAssetsDir,
2712
+ });
2713
+
2418
2714
  console.log(
2419
2715
  `[compile-libllama] Built ${args.targets.map((t) => t.target).join(", ")} (${srcDescription}).`,
2420
2716
  );