@elizaos/app-core 2.0.0-beta.2 → 2.0.11-beta.5

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 (1534) hide show
  1. package/agent-bridge.d.ts +27 -0
  2. package/agent-bridge.d.ts.map +1 -0
  3. package/agent-bridge.js +26 -0
  4. package/api/__tests__/sandbox-test-helpers.js +1 -1
  5. package/api/auth/audit.js +1 -1
  6. package/api/auth/auth-context.js +1 -1
  7. package/api/auth/bootstrap-token.js +2 -2
  8. package/api/auth/index.d.ts +9 -10
  9. package/api/auth/index.d.ts.map +1 -1
  10. package/api/auth/index.js +9 -10
  11. package/api/auth/passwords.js +2 -2
  12. package/api/auth/sensitive-rate-limit.d.ts +1 -4
  13. package/api/auth/sensitive-rate-limit.d.ts.map +1 -1
  14. package/api/auth/sensitive-rate-limit.js +6 -6
  15. package/api/auth/sessions.js +2 -2
  16. package/api/auth-bootstrap-routes.d.ts +6 -13
  17. package/api/auth-bootstrap-routes.d.ts.map +1 -1
  18. package/api/auth-bootstrap-routes.js +14 -27
  19. package/api/auth-pairing-routes.d.ts +17 -0
  20. package/api/auth-pairing-routes.d.ts.map +1 -0
  21. package/api/auth-pairing-routes.js +300 -0
  22. package/api/auth-session-routes.d.ts.map +1 -1
  23. package/api/auth-session-routes.js +36 -15
  24. package/api/auth.d.ts +12 -19
  25. package/api/auth.d.ts.map +1 -1
  26. package/api/auth.js +32 -27
  27. package/api/automations-compat-routes.d.ts.map +1 -1
  28. package/api/automations-compat-routes.js +5 -5
  29. package/api/background-tasks-routes.d.ts +4 -0
  30. package/api/background-tasks-routes.d.ts.map +1 -0
  31. package/api/background-tasks-routes.js +63 -0
  32. package/api/catalog-routes.js +3 -3
  33. package/api/cloud-pair-route.d.ts +26 -0
  34. package/api/cloud-pair-route.d.ts.map +1 -0
  35. package/api/cloud-pair-route.js +222 -0
  36. package/api/cloud-voice-routes.d.ts +52 -0
  37. package/api/cloud-voice-routes.d.ts.map +1 -0
  38. package/api/cloud-voice-routes.js +50 -0
  39. package/api/compat-route-shared.d.ts +2 -2
  40. package/api/compat-route-shared.d.ts.map +1 -1
  41. package/api/compat-route-shared.js +11 -7
  42. package/api/credential-resolver.d.ts +2 -2
  43. package/api/credential-resolver.d.ts.map +1 -1
  44. package/api/credential-resolver.js +8 -2
  45. package/api/database-rows-compat-routes.d.ts.map +1 -1
  46. package/api/database-rows-compat-routes.js +69 -31
  47. package/api/dev-boot-history.d.ts +26 -0
  48. package/api/dev-boot-history.d.ts.map +1 -0
  49. package/api/dev-boot-history.js +69 -0
  50. package/api/dev-compat-routes.d.ts +5 -0
  51. package/api/dev-compat-routes.d.ts.map +1 -1
  52. package/api/dev-compat-routes.js +127 -4
  53. package/api/dev-console-log.d.ts +2 -2
  54. package/api/dev-console-log.d.ts.map +1 -1
  55. package/api/dev-console-log.js +8 -5
  56. package/api/dev-route-catalog.d.ts +58 -0
  57. package/api/dev-route-catalog.d.ts.map +1 -0
  58. package/api/dev-route-catalog.js +447 -0
  59. package/api/dev-stack.d.ts.map +1 -1
  60. package/api/dev-stack.js +6 -9
  61. package/api/first-run-routes.d.ts +4 -0
  62. package/api/first-run-routes.d.ts.map +1 -0
  63. package/api/first-run-routes.js +208 -0
  64. package/api/first-run-tts-route.d.ts +19 -0
  65. package/api/first-run-tts-route.d.ts.map +1 -0
  66. package/api/first-run-tts-route.js +59 -0
  67. package/api/internal-routes.d.ts +23 -0
  68. package/api/internal-routes.d.ts.map +1 -0
  69. package/api/internal-routes.js +203 -0
  70. package/api/ios-local-agent-transport.d.ts +36 -0
  71. package/api/ios-local-agent-transport.d.ts.map +1 -0
  72. package/api/ios-local-agent-transport.js +566 -0
  73. package/api/onboarding-voice-lines.d.ts +23 -0
  74. package/api/onboarding-voice-lines.d.ts.map +1 -0
  75. package/api/onboarding-voice-lines.js +8 -0
  76. package/api/perf-instrument.d.ts +43 -0
  77. package/api/perf-instrument.d.ts.map +1 -0
  78. package/api/perf-instrument.js +113 -0
  79. package/api/response.d.ts.map +1 -1
  80. package/api/response.js +14 -14
  81. package/api/runtime-mode-routes.d.ts.map +1 -1
  82. package/api/runtime-mode-routes.js +2 -2
  83. package/api/secrets-inventory-routes.js +2 -2
  84. package/api/secrets-manager-routes.d.ts +1 -1
  85. package/api/secrets-manager-routes.d.ts.map +1 -1
  86. package/api/secrets-manager-routes.js +9 -10
  87. package/api/sensitive-request-routes.d.ts.map +1 -1
  88. package/api/sensitive-request-routes.js +5 -5
  89. package/api/sensitive-request-store.d.ts +12 -3
  90. package/api/sensitive-request-store.d.ts.map +1 -1
  91. package/api/server-cors.d.ts.map +1 -1
  92. package/api/server-cors.js +13 -2
  93. package/api/server-first-run-helpers.d.ts +26 -0
  94. package/api/server-first-run-helpers.d.ts.map +1 -0
  95. package/api/server-first-run-helpers.js +271 -0
  96. package/api/server-security.js +1 -1
  97. package/api/server-startup.d.ts.map +1 -1
  98. package/api/server-startup.js +3 -4
  99. package/api/server-wallet-trade.js +1 -1
  100. package/api/server.d.ts +4 -4
  101. package/api/server.d.ts.map +1 -1
  102. package/api/server.js +222 -88
  103. package/api/setup-contract.d.ts +63 -0
  104. package/api/setup-contract.d.ts.map +1 -0
  105. package/api/setup-contract.js +39 -0
  106. package/api/training-benchmarks.d.ts +97 -0
  107. package/api/training-benchmarks.d.ts.map +1 -0
  108. package/api/training-benchmarks.js +307 -0
  109. package/api/workbench-compat-routes.js +2 -2
  110. package/benchmark/cerebras-autowire.d.ts +28 -0
  111. package/benchmark/cerebras-autowire.d.ts.map +1 -0
  112. package/benchmark/cerebras-autowire.js +62 -0
  113. package/benchmark/lifeops-bench-handler.d.ts +36 -0
  114. package/benchmark/lifeops-bench-handler.d.ts.map +1 -1
  115. package/benchmark/lifeops-bench-handler.js +63 -1
  116. package/benchmark/lifeops-fake-backend.d.ts +39 -0
  117. package/benchmark/lifeops-fake-backend.d.ts.map +1 -1
  118. package/benchmark/lifeops-fake-backend.js +993 -21
  119. package/benchmark/mock-plugin.d.ts.map +1 -1
  120. package/benchmark/mock-plugin.js +0 -24
  121. package/benchmark/plugin.d.ts +2 -1
  122. package/benchmark/plugin.d.ts.map +1 -1
  123. package/benchmark/plugin.js +989 -68
  124. package/benchmark/replay-capture.d.ts +2 -2
  125. package/benchmark/replay-capture.d.ts.map +1 -1
  126. package/benchmark/replay-capture.js +3 -3
  127. package/benchmark/server-utils.d.ts +162 -9
  128. package/benchmark/server-utils.d.ts.map +1 -1
  129. package/benchmark/server-utils.js +625 -62
  130. package/benchmark/server.d.ts.map +1 -1
  131. package/benchmark/server.js +1962 -118
  132. package/boot-profile.d.ts +3 -0
  133. package/boot-profile.d.ts.map +1 -0
  134. package/boot-profile.js +30 -0
  135. package/browser.d.ts +23 -1
  136. package/browser.d.ts.map +1 -1
  137. package/browser.js +20 -1
  138. package/cli/argv.js +1 -1
  139. package/cli/banner.js +1 -1
  140. package/cli/command-format.js +2 -2
  141. package/cli/doctor/checks.d.ts.map +1 -1
  142. package/cli/doctor/checks.js +6 -6
  143. package/cli/plugins-cli.d.ts.map +1 -1
  144. package/cli/plugins-cli.js +77 -32
  145. package/cli/profile.d.ts.map +1 -1
  146. package/cli/profile.js +5 -4
  147. package/cli/program/build-program.js +4 -4
  148. package/cli/program/command-registry.d.ts.map +1 -1
  149. package/cli/program/command-registry.js +13 -11
  150. package/cli/program/help.js +5 -5
  151. package/cli/program/preaction.js +5 -5
  152. package/cli/program/register.auth.d.ts.map +1 -1
  153. package/cli/program/register.auth.js +6 -12
  154. package/cli/program/register.capability-router.d.ts +29 -0
  155. package/cli/program/register.capability-router.d.ts.map +1 -0
  156. package/cli/program/register.capability-router.js +568 -0
  157. package/cli/program/register.config.js +1 -1
  158. package/cli/program/register.configure.d.ts.map +1 -1
  159. package/cli/program/register.configure.js +1 -1
  160. package/cli/program/register.dashboard.d.ts.map +1 -1
  161. package/cli/program/register.dashboard.js +6 -7
  162. package/cli/program/register.db.d.ts.map +1 -1
  163. package/cli/program/register.db.js +3 -4
  164. package/cli/program/register.doctor.js +7 -7
  165. package/cli/program/register.setup.d.ts.map +1 -1
  166. package/cli/program/register.setup.js +14 -10
  167. package/cli/program/register.start.d.ts.map +1 -1
  168. package/cli/program/register.start.js +5 -3
  169. package/cli/program/register.subclis.js +3 -3
  170. package/cli/program/register.update.d.ts +6 -0
  171. package/cli/program/register.update.d.ts.map +1 -1
  172. package/cli/program/register.update.js +58 -6
  173. package/cli/program.js +1 -1
  174. package/cli/run-main.js +4 -4
  175. package/config/app-config.d.ts +2 -0
  176. package/config/app-config.d.ts.map +1 -0
  177. package/config/app-config.js +1 -0
  178. package/connectors/capacitor-jsc.d.ts.map +1 -1
  179. package/connectors/capacitor-jsc.js +16 -10
  180. package/connectors/capacitor-quickjs.d.ts.map +1 -1
  181. package/connectors/capacitor-quickjs.js +18 -13
  182. package/connectors/capacitor-sqlite.d.ts.map +1 -1
  183. package/connectors/capacitor-sqlite.js +27 -12
  184. package/dispatch/approval-queue.d.ts +37 -0
  185. package/dispatch/approval-queue.d.ts.map +1 -0
  186. package/dispatch/approval-queue.js +25 -0
  187. package/dispatch/channel-registry.d.ts +30 -0
  188. package/dispatch/channel-registry.d.ts.map +1 -0
  189. package/dispatch/channel-registry.js +22 -0
  190. package/dispatch/connector-registry.d.ts +39 -0
  191. package/dispatch/connector-registry.d.ts.map +1 -0
  192. package/dispatch/connector-registry.js +24 -0
  193. package/dispatch/index.d.ts +14 -0
  194. package/dispatch/index.d.ts.map +1 -0
  195. package/dispatch/index.js +13 -0
  196. package/dispatch/send-policy.d.ts +36 -0
  197. package/dispatch/send-policy.d.ts.map +1 -0
  198. package/dispatch/send-policy.js +16 -0
  199. package/entry.js +28 -11
  200. package/first-run/first-run-config.d.ts +55 -0
  201. package/first-run/first-run-config.d.ts.map +1 -0
  202. package/first-run/first-run-config.js +178 -0
  203. package/first-run/runtime-target.d.ts +4 -0
  204. package/first-run/runtime-target.d.ts.map +1 -0
  205. package/first-run/runtime-target.js +13 -0
  206. package/index.d.ts +16 -3
  207. package/index.d.ts.map +1 -1
  208. package/index.js +57 -33
  209. package/package.json +159 -50
  210. package/packaging/debian/apt-repo-config/README.md +18 -0
  211. package/packaging/debian/apt-repo-config/conf/distributions +11 -0
  212. package/packaging/flatpak/README.md +26 -16
  213. package/packaging/flatpak/ai.elizaos.App.metainfo.xml +17 -12
  214. package/packaging/flatpak/ai.elizaos.App.store.yml +5 -5
  215. package/packaging/flatpak/ai.elizaos.App.yml +10 -24
  216. package/packaging/flatpak/elizaos-app-wrapper.store.sh +2 -2
  217. package/packaging/flatpak/generate-sources.sh +74 -0
  218. package/packaging/flatpak/node-sources.json +7930 -0
  219. package/packaging/inno/build-inno.ps1 +34 -9
  220. package/packaging/msix/AppxManifest.store.xml +1 -1
  221. package/packaging/msix/README.md +39 -19
  222. package/packaging/msix/build-msix.ps1 +44 -14
  223. package/packaging/snap/snapcraft.yaml +22 -21
  224. package/packaging/test-packaging.sh +2 -2
  225. package/permissions/types.d.ts +1 -1
  226. package/permissions/types.js +1 -1
  227. package/platform/elizaos-agent-browser-stub.d.ts +144 -0
  228. package/platform/elizaos-agent-browser-stub.d.ts.map +1 -0
  229. package/platform/elizaos-agent-browser-stub.js +158 -0
  230. package/platform/elizaos-plugin-elizacloud-browser-stub.d.ts +34 -0
  231. package/platform/elizaos-plugin-elizacloud-browser-stub.d.ts.map +1 -0
  232. package/platform/elizaos-plugin-elizacloud-browser-stub.js +51 -0
  233. package/platform/empty-node-module.d.ts +148 -0
  234. package/platform/empty-node-module.d.ts.map +1 -1
  235. package/platform/empty-node-module.js +140 -3
  236. package/platform/ios-runtime-backends.d.ts +83 -0
  237. package/platform/ios-runtime-backends.d.ts.map +1 -0
  238. package/platform/ios-runtime-backends.js +133 -0
  239. package/platform/ios-runtime-bridge.d.ts +15 -0
  240. package/platform/ios-runtime-bridge.d.ts.map +1 -0
  241. package/platform/ios-runtime-bridge.js +527 -0
  242. package/platform/native-library-policy.d.ts +23 -0
  243. package/platform/native-library-policy.d.ts.map +1 -0
  244. package/platform/native-library-policy.js +112 -0
  245. package/platform/native-plugin-entrypoints.d.ts +19 -0
  246. package/platform/native-plugin-entrypoints.d.ts.map +1 -0
  247. package/platform/native-plugin-entrypoints.js +29 -0
  248. package/platforms/android/README.md +68 -10
  249. package/platforms/android/app/build.gradle +268 -3
  250. package/platforms/android/app/capacitor.build.gradle +18 -1
  251. package/platforms/android/app/proguard-rules.pro +17 -2
  252. package/platforms/android/app/src/androidTest/java/ai/elizaos/app/ElizaOsInstrumentedTest.java +1 -1
  253. package/platforms/android/app/src/main/AndroidManifest.xml +334 -17
  254. package/platforms/android/app/src/main/assets/runners/eliza-tasks.js +177 -0
  255. package/platforms/android/app/src/main/elizavoice-jni/CMakeLists.txt +75 -0
  256. package/platforms/android/app/src/main/elizavoice-jni/elizavoice-jni.cpp +1045 -0
  257. package/platforms/android/app/src/main/java/ai/elizaos/app/AgentPlugin.java +111 -171
  258. package/platforms/android/app/src/main/java/ai/elizaos/app/AndroidVirtualizationBridge.java +284 -0
  259. package/platforms/android/app/src/main/java/ai/elizaos/app/BatteryOptimizationPlugin.java +95 -0
  260. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAccessibilityService.java +55 -0
  261. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAgentService.java +1198 -141
  262. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAndroidSystemBridge.java +83 -0
  263. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAssistActivity.java +50 -1
  264. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaBootReceiver.java +90 -8
  265. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaBrowserActivity.java +2 -2
  266. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaCalendarActivity.java +1 -1
  267. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaCameraActivity.java +1 -1
  268. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaClockActivity.java +2 -2
  269. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaContactsActivity.java +1 -1
  270. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaDialActivity.java +1 -1
  271. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaInCallService.java +1 -1
  272. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaMmsReceiver.java +1 -1
  273. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaNativeBridge.java +22 -0
  274. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaNotificationListenerService.java +45 -0
  275. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaQuickActionsWidgetProvider.java +68 -0
  276. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaShareActivity.java +132 -0
  277. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsComposeActivity.java +1 -1
  278. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsGatewayService.java +268 -0
  279. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsReceiver.java +12 -1
  280. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaTasksWorker.java +194 -0
  281. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoiceCaptureService.java +198 -0
  282. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoiceNative.java +160 -0
  283. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoicePlugin.java +450 -0
  284. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoiceTileService.java +39 -0
  285. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaWorkScheduler.java +60 -0
  286. package/platforms/android/app/src/main/java/ai/elizaos/app/GatewayConnectionService.java +53 -19
  287. package/platforms/android/app/src/main/java/ai/elizaos/app/MainActivity.java +160 -33
  288. package/platforms/android/app/src/main/java/ai/elizaos/app/ResourceProbePlugin.java +169 -0
  289. package/platforms/android/app/src/main/java/ai/elizaos/app/VoiceCapturePlugin.java +119 -0
  290. package/platforms/android/app/src/main/res/drawable/eliza_widget_background.xml +10 -0
  291. package/platforms/android/app/src/main/res/drawable/eliza_widget_button_background.xml +13 -0
  292. package/platforms/android/app/src/main/res/drawable/splash.png +0 -0
  293. package/platforms/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
  294. package/platforms/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
  295. package/platforms/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
  296. package/platforms/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
  297. package/platforms/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
  298. package/platforms/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
  299. package/platforms/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
  300. package/platforms/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
  301. package/platforms/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
  302. package/platforms/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
  303. package/platforms/android/app/src/main/res/layout/eliza_quick_actions_widget.xml +86 -0
  304. package/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +2 -1
  305. package/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +2 -1
  306. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  307. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
  308. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png +0 -0
  309. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  310. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  311. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
  312. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png +0 -0
  313. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  314. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  315. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
  316. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png +0 -0
  317. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  318. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  319. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
  320. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png +0 -0
  321. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  322. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  323. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
  324. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png +0 -0
  325. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  326. package/platforms/android/app/src/main/res/values/android_app_actions.xml +48 -0
  327. package/platforms/android/app/src/main/res/values/colors.xml +8 -0
  328. package/platforms/android/app/src/main/res/values/ic_launcher_background.xml +2 -2
  329. package/platforms/android/app/src/main/res/values/strings.xml +2 -2
  330. package/platforms/android/app/src/main/res/values/styles.xml +25 -1
  331. package/platforms/android/app/src/main/res/xml/eliza_accessibility_service.xml +9 -0
  332. package/platforms/android/app/src/main/res/xml/eliza_quick_actions_widget.xml +13 -0
  333. package/platforms/android/app/src/main/res/xml/shortcuts.xml +121 -0
  334. package/platforms/android/build.gradle +2 -2
  335. package/platforms/android/capacitor-cordova-android-plugins/build.gradle +9 -3
  336. package/platforms/android/capacitor-cordova-android-plugins/cordova.variables.gradle +6 -2
  337. package/platforms/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml +7 -2
  338. package/platforms/android/capacitor-cordova-android-plugins/src/main/java/.gitkeep +0 -1
  339. package/platforms/android/capacitor.settings.gradle +66 -16
  340. package/platforms/android/gradle.properties +1 -0
  341. package/platforms/android/update-manifest/generate-manifest.mjs +97 -0
  342. package/platforms/android/update-manifest/schema.json +26 -0
  343. package/platforms/apple-store-entitlements.reviewed.json +155 -0
  344. package/platforms/electrobun/.generated/brand-config.json +3 -2
  345. package/platforms/electrobun/LICENSE +21 -0
  346. package/platforms/electrobun/README.md +15 -1
  347. package/platforms/electrobun/assets/appIcon.icns +0 -0
  348. package/platforms/electrobun/assets/appIcon.ico +0 -0
  349. package/platforms/electrobun/assets/appIcon.iconset/icon_128x128.png +0 -0
  350. package/platforms/electrobun/assets/appIcon.iconset/icon_128x128@2x.png +0 -0
  351. package/platforms/electrobun/assets/appIcon.iconset/icon_16x16.png +0 -0
  352. package/platforms/electrobun/assets/appIcon.iconset/icon_16x16@2x.png +0 -0
  353. package/platforms/electrobun/assets/appIcon.iconset/icon_256x256.png +0 -0
  354. package/platforms/electrobun/assets/appIcon.iconset/icon_256x256@2x.png +0 -0
  355. package/platforms/electrobun/assets/appIcon.iconset/icon_32x32.png +0 -0
  356. package/platforms/electrobun/assets/appIcon.iconset/icon_32x32@2x.png +0 -0
  357. package/platforms/electrobun/assets/appIcon.iconset/icon_512x512.png +0 -0
  358. package/platforms/electrobun/assets/brand-config.json +6 -6
  359. package/platforms/electrobun/biome.json +9 -9
  360. package/platforms/electrobun/docs/capability-collapse-matrix.json +318 -0
  361. package/platforms/electrobun/docs/capability-collapse-matrix.md +129 -0
  362. package/platforms/electrobun/docs/capability-routing.md +86 -0
  363. package/platforms/electrobun/docs/convergence-audit.json +3505 -0
  364. package/platforms/electrobun/docs/convergence-audit.md +694 -0
  365. package/platforms/electrobun/docs/database-boot-policy.md +90 -0
  366. package/platforms/electrobun/docs/riscv64-port.md +175 -0
  367. package/platforms/electrobun/docs/startup-first-run-cleanup.md +18 -0
  368. package/platforms/electrobun/docs/trace-first-annotations.md +52 -0
  369. package/platforms/electrobun/docs/ui-boundary-audit.json +580 -0
  370. package/platforms/electrobun/docs/ui-boundary-audit.md +257 -0
  371. package/platforms/electrobun/electrobun.config.ts +592 -364
  372. package/platforms/electrobun/entitlements/JUSTIFICATIONS.md +141 -0
  373. package/platforms/electrobun/entitlements/README.md +34 -6
  374. package/platforms/electrobun/entitlements/mas-bun.entitlements +15 -0
  375. package/platforms/electrobun/entitlements/mas.entitlements +6 -4
  376. package/platforms/electrobun/native/macos/window-effects.mm +1522 -0
  377. package/platforms/electrobun/package.json +18 -12
  378. package/platforms/electrobun/remotes/fs/README.md +70 -0
  379. package/platforms/electrobun/remotes/fs/electrobun.config.ts +38 -0
  380. package/platforms/electrobun/remotes/fs/package.json +12 -0
  381. package/platforms/electrobun/remotes/fs/plugin.json +25 -0
  382. package/platforms/electrobun/remotes/fs/src/bun/errors.ts +57 -0
  383. package/platforms/electrobun/remotes/fs/src/bun/file-limits.ts +50 -0
  384. package/platforms/electrobun/remotes/fs/src/bun/fs-service.ts +389 -0
  385. package/platforms/electrobun/remotes/fs/src/bun/path-guard.ts +270 -0
  386. package/platforms/electrobun/remotes/fs/src/bun/protocol.ts +149 -0
  387. package/platforms/electrobun/remotes/fs/src/bun/worker.ts +174 -0
  388. package/platforms/electrobun/remotes/fs/src/dev/phase5-smoke.ts +171 -0
  389. package/platforms/electrobun/remotes/fs/src/web/index.html +8 -0
  390. package/platforms/electrobun/remotes/git/README.md +75 -0
  391. package/platforms/electrobun/remotes/git/electrobun.config.ts +44 -0
  392. package/platforms/electrobun/remotes/git/package.json +12 -0
  393. package/platforms/electrobun/remotes/git/plugin.json +31 -0
  394. package/platforms/electrobun/remotes/git/src/bun/errors.ts +69 -0
  395. package/platforms/electrobun/remotes/git/src/bun/git-command.ts +156 -0
  396. package/platforms/electrobun/remotes/git/src/bun/git-service.ts +446 -0
  397. package/platforms/electrobun/remotes/git/src/bun/operation-history.ts +124 -0
  398. package/platforms/electrobun/remotes/git/src/bun/protocol.ts +252 -0
  399. package/platforms/electrobun/remotes/git/src/bun/worker.ts +316 -0
  400. package/platforms/electrobun/remotes/git/src/dev/phase7-smoke.ts +141 -0
  401. package/platforms/electrobun/remotes/git/src/web/index.html +8 -0
  402. package/platforms/electrobun/remotes/local-model/README.md +138 -0
  403. package/platforms/electrobun/remotes/local-model/electrobun.config.ts +46 -0
  404. package/platforms/electrobun/remotes/local-model/package.json +12 -0
  405. package/platforms/electrobun/remotes/local-model/plugin.json +33 -0
  406. package/platforms/electrobun/remotes/local-model/src/bun/download-state.ts +115 -0
  407. package/platforms/electrobun/remotes/local-model/src/bun/eliza1-catalog.ts +425 -0
  408. package/platforms/electrobun/remotes/local-model/src/bun/errors.ts +74 -0
  409. package/platforms/electrobun/remotes/local-model/src/bun/hf-eliza1-client.ts +169 -0
  410. package/platforms/electrobun/remotes/local-model/src/bun/local-inference-api-client.ts +245 -0
  411. package/platforms/electrobun/remotes/local-model/src/bun/model-service.ts +490 -0
  412. package/platforms/electrobun/remotes/local-model/src/bun/protocol.ts +301 -0
  413. package/platforms/electrobun/remotes/local-model/src/bun/worker.ts +248 -0
  414. package/platforms/electrobun/remotes/local-model/src/dev/phase8-smoke.ts +117 -0
  415. package/platforms/electrobun/remotes/local-model/src/web/index.html +13 -0
  416. package/platforms/electrobun/remotes/pty/README.md +65 -0
  417. package/platforms/electrobun/remotes/pty/electrobun.config.ts +47 -0
  418. package/platforms/electrobun/remotes/pty/package.json +12 -0
  419. package/platforms/electrobun/remotes/pty/plugin.json +34 -0
  420. package/platforms/electrobun/remotes/pty/src/bun/errors.ts +57 -0
  421. package/platforms/electrobun/remotes/pty/src/bun/output-buffer.ts +127 -0
  422. package/platforms/electrobun/remotes/pty/src/bun/protocol.ts +192 -0
  423. package/platforms/electrobun/remotes/pty/src/bun/pty-service.ts +562 -0
  424. package/platforms/electrobun/remotes/pty/src/bun/worker.ts +218 -0
  425. package/platforms/electrobun/remotes/pty/src/dev/phase6-smoke.ts +127 -0
  426. package/platforms/electrobun/remotes/pty/src/web/index.html +8 -0
  427. package/platforms/electrobun/remotes/runtime/README.md +370 -0
  428. package/platforms/electrobun/remotes/runtime/electrobun.config.ts +48 -0
  429. package/platforms/electrobun/remotes/runtime/package.json +14 -0
  430. package/platforms/electrobun/remotes/runtime/plugin.json +30 -0
  431. package/platforms/electrobun/remotes/runtime/src/bun/api-client.ts +620 -0
  432. package/platforms/electrobun/remotes/runtime/src/bun/errors.ts +45 -0
  433. package/platforms/electrobun/remotes/runtime/src/bun/log-buffer.ts +33 -0
  434. package/platforms/electrobun/remotes/runtime/src/bun/protocol.ts +366 -0
  435. package/platforms/electrobun/remotes/runtime/src/bun/route-discovery.ts +419 -0
  436. package/platforms/electrobun/remotes/runtime/src/bun/runtime-manager.ts +423 -0
  437. package/platforms/electrobun/remotes/runtime/src/bun/sse-parser.ts +99 -0
  438. package/platforms/electrobun/remotes/runtime/src/bun/stream-manager.ts +887 -0
  439. package/platforms/electrobun/remotes/runtime/src/bun/worker.ts +1231 -0
  440. package/platforms/electrobun/remotes/runtime/src/dev/phase1-smoke.ts +34 -0
  441. package/platforms/electrobun/remotes/runtime/src/dev/phase2-smoke.ts +86 -0
  442. package/platforms/electrobun/remotes/runtime/src/dev/phase3-smoke.ts +141 -0
  443. package/platforms/electrobun/remotes/runtime/src/web/index.css +187 -0
  444. package/platforms/electrobun/remotes/runtime/src/web/index.html +76 -0
  445. package/platforms/electrobun/remotes/runtime/src/web/index.ts +192 -0
  446. package/platforms/electrobun/remotes/surface/README.md +201 -0
  447. package/platforms/electrobun/remotes/surface/electrobun.config.ts +38 -0
  448. package/platforms/electrobun/remotes/surface/package.json +12 -0
  449. package/platforms/electrobun/remotes/surface/plugin.json +28 -0
  450. package/platforms/electrobun/remotes/surface/src/bun/worker.ts +132 -0
  451. package/platforms/electrobun/remotes/surface/src/dev/phase4-smoke.ts +566 -0
  452. package/platforms/electrobun/remotes/surface/src/protocol/event-types.ts +84 -0
  453. package/platforms/electrobun/remotes/surface/src/protocol/runtime-client.ts +673 -0
  454. package/platforms/electrobun/remotes/surface/src/web/app.ts +595 -0
  455. package/platforms/electrobun/remotes/surface/src/web/index.css +460 -0
  456. package/platforms/electrobun/remotes/surface/src/web/index.html +466 -0
  457. package/platforms/electrobun/remotes/surface/src/web/index.ts +5 -0
  458. package/platforms/electrobun/remotes/surface/src/web/render.ts +455 -0
  459. package/platforms/electrobun/remotes/surface/src/web/state.ts +427 -0
  460. package/platforms/electrobun/scripts/build-macos-effects.sh +4 -0
  461. package/platforms/electrobun/scripts/ensure-build-folder.ts +28 -0
  462. package/platforms/electrobun/scripts/ensure-whisper-gguf.sh +55 -0
  463. package/platforms/electrobun/scripts/ensure-whisper-model.sh +22 -80
  464. package/platforms/electrobun/scripts/generate-convergence-audit.ts +1203 -0
  465. package/platforms/electrobun/scripts/local-adhoc-sign-macos.ts +159 -159
  466. package/platforms/electrobun/scripts/postwrap-diagnostics.ts +424 -339
  467. package/platforms/electrobun/scripts/postwrap-sign-runtime-macos.ts +302 -271
  468. package/platforms/electrobun/scripts/smoke-test-windows.ps1 +17 -16
  469. package/platforms/electrobun/scripts/smoke-test.sh +5 -7
  470. package/platforms/electrobun/scripts/sync-web-assets.mjs +13 -13
  471. package/platforms/electrobun/scripts/verify-rpc-handlers.ts +109 -110
  472. package/platforms/electrobun/scripts/verify-windows-installer-proof.ps1 +3 -8
  473. package/platforms/electrobun/src/__stubs__/bun-ffi.ts +31 -31
  474. package/platforms/electrobun/src/__stubs__/electrobun-bun.ts +1 -1
  475. package/platforms/electrobun/src/agent-ready-state.ts +8 -8
  476. package/platforms/electrobun/src/agent-reset-from-main.test.ts +162 -0
  477. package/platforms/electrobun/src/agent-reset-from-main.ts +62 -62
  478. package/platforms/electrobun/src/agent-status-rpc.test.ts +95 -0
  479. package/platforms/electrobun/src/agent-status-rpc.ts +156 -0
  480. package/platforms/electrobun/src/api-base.test.ts +247 -0
  481. package/platforms/electrobun/src/api-base.ts +202 -93
  482. package/platforms/electrobun/src/application-menu-action-registry.ts +9 -9
  483. package/platforms/electrobun/src/application-menu.ts +348 -348
  484. package/platforms/electrobun/src/background-notice.ts +36 -36
  485. package/platforms/electrobun/src/boot-progress.test.ts +188 -0
  486. package/platforms/electrobun/src/boot-progress.ts +111 -0
  487. package/platforms/electrobun/src/brand-config.test.ts +39 -0
  488. package/platforms/electrobun/src/brand-config.ts +141 -129
  489. package/platforms/electrobun/src/bridge/browser-tabs-renderer-registry.ts +28 -28
  490. package/platforms/electrobun/src/bridge/electrobun-boot-config.ts +42 -0
  491. package/platforms/electrobun/src/bridge/electrobun-crypto-ready.ts +120 -0
  492. package/platforms/electrobun/src/bridge/electrobun-direct-rpc.ts +342 -357
  493. package/platforms/electrobun/src/bridge/electrobun-stub.ts +13 -13
  494. package/platforms/electrobun/src/browser-workspace-bridge-server.ts +285 -243
  495. package/platforms/electrobun/src/cloud-auth-window.ts +136 -136
  496. package/platforms/electrobun/src/cloud-disconnect-from-main.ts +90 -90
  497. package/platforms/electrobun/src/config-and-auth-rpc.test.ts +256 -0
  498. package/platforms/electrobun/src/config-and-auth-rpc.ts +302 -0
  499. package/platforms/electrobun/src/conversations-and-character-rpc.test.ts +185 -0
  500. package/platforms/electrobun/src/conversations-and-character-rpc.ts +131 -0
  501. package/platforms/electrobun/src/dashboard-rpc.test.ts +200 -0
  502. package/platforms/electrobun/src/dashboard-rpc.ts +344 -0
  503. package/platforms/electrobun/src/database/database-lock.ts +141 -0
  504. package/platforms/electrobun/src/database/database-mode.ts +149 -0
  505. package/platforms/electrobun/src/database/database-recovery.ts +72 -0
  506. package/platforms/electrobun/src/database/database-snapshot.ts +190 -0
  507. package/platforms/electrobun/src/database/database.test.ts +196 -0
  508. package/platforms/electrobun/src/database/index.ts +5 -0
  509. package/platforms/electrobun/src/database/pglite-paths.ts +100 -0
  510. package/platforms/electrobun/src/desktop-deep-link-events.test.ts +30 -0
  511. package/platforms/electrobun/src/desktop-deep-link-events.ts +17 -0
  512. package/platforms/electrobun/src/desktop-http-request.test.ts +73 -73
  513. package/platforms/electrobun/src/desktop-http-request.ts +85 -85
  514. package/platforms/electrobun/src/desktop-pill-config.test.ts +27 -0
  515. package/platforms/electrobun/src/desktop-pill-config.ts +40 -0
  516. package/platforms/electrobun/src/desktop-test-bridge-server.ts +204 -204
  517. package/platforms/electrobun/src/desktop-tray-config.test.ts +87 -0
  518. package/platforms/electrobun/src/desktop-tray-config.ts +84 -0
  519. package/platforms/electrobun/src/devtools-layout.ts +41 -41
  520. package/platforms/electrobun/src/diagnostic-format.test.ts +71 -0
  521. package/platforms/electrobun/src/diagnostic-format.ts +75 -36
  522. package/platforms/electrobun/src/dynamic-view-rpc-schema.test.ts +37 -0
  523. package/platforms/electrobun/src/dynamic-views/README.md +44 -0
  524. package/platforms/electrobun/src/dynamic-views/demo/agent-run-trace.html +135 -0
  525. package/platforms/electrobun/src/dynamic-views/errors.ts +29 -0
  526. package/platforms/electrobun/src/dynamic-views/host.test.ts +353 -0
  527. package/platforms/electrobun/src/dynamic-views/host.ts +332 -0
  528. package/platforms/electrobun/src/dynamic-views/index.ts +57 -0
  529. package/platforms/electrobun/src/dynamic-views/kiosk-canvas.ts +89 -0
  530. package/platforms/electrobun/src/dynamic-views/registry.test.ts +139 -0
  531. package/platforms/electrobun/src/dynamic-views/registry.ts +196 -0
  532. package/platforms/electrobun/src/dynamic-views/session-manager.test.ts +355 -0
  533. package/platforms/electrobun/src/dynamic-views/session-manager.ts +348 -0
  534. package/platforms/electrobun/src/dynamic-views/types.ts +105 -0
  535. package/platforms/electrobun/src/electrobun-boot-config.test.ts +50 -0
  536. package/platforms/electrobun/src/electrobun-config.test.ts +62 -0
  537. package/platforms/electrobun/src/electrobun-crypto-ready.test.ts +65 -0
  538. package/platforms/electrobun/src/electrobun-window-options.ts +25 -0
  539. package/platforms/electrobun/src/extension-rpc.test.ts +88 -0
  540. package/platforms/electrobun/src/extension-rpc.ts +102 -0
  541. package/platforms/electrobun/src/fatal-shutdown.test.ts +10 -10
  542. package/platforms/electrobun/src/fatal-shutdown.ts +1 -1
  543. package/platforms/electrobun/src/first-party-remotes.test.ts +169 -0
  544. package/platforms/electrobun/src/first-party-remotes.ts +297 -0
  545. package/platforms/electrobun/src/first-run-rpc.test.ts +192 -0
  546. package/platforms/electrobun/src/first-run-rpc.ts +146 -0
  547. package/platforms/electrobun/src/floating-chat-window.ts +181 -181
  548. package/platforms/electrobun/src/inbox-rpc.test.ts +123 -0
  549. package/platforms/electrobun/src/inbox-rpc.ts +158 -0
  550. package/platforms/electrobun/src/index.ts +2555 -2096
  551. package/platforms/electrobun/src/kiosk-mode.ts +50 -0
  552. package/platforms/electrobun/src/launch/index.ts +4 -0
  553. package/platforms/electrobun/src/launch/launch-dynamic-view.ts +37 -0
  554. package/platforms/electrobun/src/launch/launch-orchestrator.test.ts +224 -0
  555. package/platforms/electrobun/src/launch/launch-orchestrator.ts +456 -0
  556. package/platforms/electrobun/src/launch/launch-store.test.ts +97 -0
  557. package/platforms/electrobun/src/launch/launch-store.ts +134 -0
  558. package/platforms/electrobun/src/launch/types.ts +103 -0
  559. package/platforms/electrobun/src/launch/views/launch-diagnostics.html +205 -0
  560. package/platforms/electrobun/src/lifecycle/agent-ready-publish.test.ts +50 -0
  561. package/platforms/electrobun/src/lifecycle/agent-ready-publish.ts +27 -0
  562. package/platforms/electrobun/src/lifecycle/api-base-owner.ts +42 -31
  563. package/platforms/electrobun/src/lifecycle/desktop-session-prime.ts +44 -44
  564. package/platforms/electrobun/src/logger.ts +14 -14
  565. package/platforms/electrobun/src/main-window-runtime.ts +83 -83
  566. package/platforms/electrobun/src/main-window-session.test.ts +109 -0
  567. package/platforms/electrobun/src/main-window-session.ts +87 -51
  568. package/platforms/electrobun/src/menu-reset-from-main.ts +158 -158
  569. package/platforms/electrobun/src/native/agent-env.test.ts +52 -0
  570. package/platforms/electrobun/src/native/agent-runtime-layout.test.ts +42 -0
  571. package/platforms/electrobun/src/native/agent-state-dir.test.ts +91 -0
  572. package/platforms/electrobun/src/native/agent.ts +2122 -1682
  573. package/platforms/electrobun/src/native/auth-bridge.test.ts +67 -0
  574. package/platforms/electrobun/src/native/auth-bridge.ts +464 -360
  575. package/platforms/electrobun/src/native/browser-workspace.ts +723 -471
  576. package/platforms/electrobun/src/native/camera.ts +50 -50
  577. package/platforms/electrobun/src/native/canvas.ts +444 -445
  578. package/platforms/electrobun/src/native/credentials.ts +673 -616
  579. package/platforms/electrobun/src/native/desktop-window.test.ts +300 -0
  580. package/platforms/electrobun/src/native/desktop.ts +2196 -2156
  581. package/platforms/electrobun/src/native/editor-bridge.ts +201 -201
  582. package/platforms/electrobun/src/native/file-watcher.ts +154 -154
  583. package/platforms/electrobun/src/native/gateway.ts +179 -180
  584. package/platforms/electrobun/src/native/gpu-window.ts +256 -256
  585. package/platforms/electrobun/src/native/index.ts +76 -74
  586. package/platforms/electrobun/src/native/location.test.ts +44 -0
  587. package/platforms/electrobun/src/native/location.ts +90 -80
  588. package/platforms/electrobun/src/native/loopback-port.ts +60 -60
  589. package/platforms/electrobun/src/native/mac-window-effects.ts +166 -104
  590. package/platforms/electrobun/src/native/music-player.ts +38 -38
  591. package/platforms/electrobun/src/native/permissions-shared.ts +249 -150
  592. package/platforms/electrobun/src/native/permissions.ts +301 -208
  593. package/platforms/electrobun/src/native/power-state.ts +129 -129
  594. package/platforms/electrobun/src/native/remote-plugin-host.test.ts +1394 -0
  595. package/platforms/electrobun/src/native/remote-plugin-host.ts +1531 -0
  596. package/platforms/electrobun/src/native/screencapture.ts +667 -573
  597. package/platforms/electrobun/src/native/steward.ts +207 -204
  598. package/platforms/electrobun/src/native/swabble.ts +68 -324
  599. package/platforms/electrobun/src/native/talkmode.ts +253 -422
  600. package/platforms/electrobun/src/native/webgpu-browser-support.test.ts +18 -0
  601. package/platforms/electrobun/src/native/webgpu-browser-support.ts +165 -147
  602. package/platforms/electrobun/src/native/whisper-env.test.ts +71 -0
  603. package/platforms/electrobun/src/native/whisper-env.ts +68 -0
  604. package/platforms/electrobun/src/native-onboarding.ts +270 -0
  605. package/platforms/electrobun/src/onboarding-overlay-window.ts +141 -0
  606. package/platforms/electrobun/src/persisted-deployment.ts +91 -0
  607. package/platforms/electrobun/src/pill-window.test.ts +91 -0
  608. package/platforms/electrobun/src/pill-window.ts +99 -0
  609. package/platforms/electrobun/src/preload-validation.ts +44 -44
  610. package/platforms/electrobun/src/preload.js +1 -1
  611. package/platforms/electrobun/src/print-electrobun-dev-settings-banner.ts +120 -120
  612. package/platforms/electrobun/src/renderer-api-proxy.test.ts +73 -0
  613. package/platforms/electrobun/src/renderer-api-proxy.ts +86 -0
  614. package/platforms/electrobun/src/renderer-static.test.ts +53 -0
  615. package/platforms/electrobun/src/renderer-static.ts +144 -57
  616. package/platforms/electrobun/src/rpc-handler-slices.ts +121 -0
  617. package/platforms/electrobun/src/rpc-handlers.test.ts +267 -0
  618. package/platforms/electrobun/src/rpc-handlers.ts +1306 -913
  619. package/platforms/electrobun/src/rpc-parse-utils.ts +57 -0
  620. package/platforms/electrobun/src/rpc-port-resolver.test.ts +45 -0
  621. package/platforms/electrobun/src/rpc-port-resolver.ts +31 -0
  622. package/platforms/electrobun/src/rpc-schema.ts +2556 -1619
  623. package/platforms/electrobun/src/runtime-layout.ts +105 -105
  624. package/platforms/electrobun/src/runtime-permissions.ts +95 -95
  625. package/platforms/electrobun/src/runtime-rpc.test.ts +126 -0
  626. package/platforms/electrobun/src/runtime-rpc.ts +237 -0
  627. package/platforms/electrobun/src/screenshot-dev-server.ts +87 -87
  628. package/platforms/electrobun/src/settings-mutations-rpc.test.ts +193 -0
  629. package/platforms/electrobun/src/settings-mutations-rpc.ts +220 -0
  630. package/platforms/electrobun/src/startup-trace.ts +274 -270
  631. package/platforms/electrobun/src/subscription-rpc.test.ts +89 -0
  632. package/platforms/electrobun/src/subscription-rpc.ts +192 -0
  633. package/platforms/electrobun/src/surface-windows.test.ts +355 -0
  634. package/platforms/electrobun/src/surface-windows.ts +410 -410
  635. package/platforms/electrobun/src/trace/README.md +73 -0
  636. package/platforms/electrobun/src/trace/errors.ts +21 -0
  637. package/platforms/electrobun/src/trace/index.ts +40 -0
  638. package/platforms/electrobun/src/trace/trace-dynamic-view.ts +40 -0
  639. package/platforms/electrobun/src/trace/trace-host-requests.ts +473 -0
  640. package/platforms/electrobun/src/trace/trace-service.test.ts +186 -0
  641. package/platforms/electrobun/src/trace/trace-service.ts +324 -0
  642. package/platforms/electrobun/src/trace/trace-store.test.ts +141 -0
  643. package/platforms/electrobun/src/trace/trace-store.ts +551 -0
  644. package/platforms/electrobun/src/trace/types.ts +250 -0
  645. package/platforms/electrobun/src/trace/views/agent-run-trace.html +311 -0
  646. package/platforms/electrobun/src/types/web-speech.d.ts +28 -28
  647. package/platforms/electrobun/src/types.ts +5 -5
  648. package/platforms/electrobun/src/update-availability.test.ts +72 -0
  649. package/platforms/electrobun/src/update-availability.ts +90 -0
  650. package/platforms/electrobun/src/update-rpc.test.ts +83 -0
  651. package/platforms/electrobun/src/update-rpc.ts +123 -0
  652. package/platforms/electrobun/src/voice/README.md +184 -0
  653. package/platforms/electrobun/src/voice/errors.ts +42 -0
  654. package/platforms/electrobun/src/voice/index.ts +78 -0
  655. package/platforms/electrobun/src/voice/types.ts +316 -0
  656. package/platforms/electrobun/src/voice/voice-host-requests.ts +259 -0
  657. package/platforms/electrobun/src/voice/voice-latency-budget.test.ts +66 -0
  658. package/platforms/electrobun/src/voice/voice-latency-budget.ts +243 -0
  659. package/platforms/electrobun/src/voice/voice-live-validation.test.ts +352 -0
  660. package/platforms/electrobun/src/voice/voice-live-validation.ts +838 -0
  661. package/platforms/electrobun/src/voice/voice-pipeline.ts +250 -0
  662. package/platforms/electrobun/src/voice/voice-playback-adapter.ts +31 -0
  663. package/platforms/electrobun/src/voice/voice-runtime-adapter.test.ts +213 -0
  664. package/platforms/electrobun/src/voice/voice-runtime-adapter.ts +686 -0
  665. package/platforms/electrobun/src/voice/voice-service.test.ts +561 -0
  666. package/platforms/electrobun/src/voice/voice-service.ts +1027 -0
  667. package/platforms/electrobun/src/voice/voice-stream-coordinator.test.ts +115 -0
  668. package/platforms/electrobun/src/voice/voice-stream-coordinator.ts +270 -0
  669. package/platforms/electrobun/src/voice/voice-trace.ts +97 -0
  670. package/platforms/electrobun/src/voice/voice-tts-chunker.test.ts +91 -0
  671. package/platforms/electrobun/src/voice/voice-tts-chunker.ts +194 -0
  672. package/platforms/electrobun/src/windows-cef-profile.ts +88 -88
  673. package/platforms/electrobun/tsconfig.json +73 -13
  674. package/platforms/electrobun/update-channels.json +22 -0
  675. package/platforms/electrobun/vitest.electrobun.config.ts +72 -42
  676. package/platforms/ios/App/App/App.entitlements +4 -0
  677. package/platforms/ios/App/App/AppDelegate.swift +80 -18
  678. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ios-marketing-1024.png +0 -0
  679. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-20x20@1x.png +0 -0
  680. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-20x20@2x.png +0 -0
  681. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-29x29@1x.png +0 -0
  682. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-29x29@2x.png +0 -0
  683. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-40x40@1x.png +0 -0
  684. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-40x40@2x.png +0 -0
  685. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-76x76@1x.png +0 -0
  686. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-76x76@2x.png +0 -0
  687. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-83_5x83_5@2x.png +0 -0
  688. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-20x20@2x.png +0 -0
  689. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-20x20@3x.png +0 -0
  690. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-29x29@2x.png +0 -0
  691. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-29x29@3x.png +0 -0
  692. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-40x40@2x.png +0 -0
  693. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-40x40@3x.png +0 -0
  694. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-60x60@2x.png +0 -0
  695. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-60x60@3x.png +0 -0
  696. package/platforms/ios/App/App/Base.lproj/LaunchScreen.storyboard +1 -4
  697. package/platforms/ios/App/App/ComputerUseBridge.swift +589 -0
  698. package/platforms/ios/App/App/DeviceActivityMonitorExtension/DeviceActivityMonitorExtension.entitlements +12 -0
  699. package/platforms/ios/App/App/DeviceActivityMonitorExtension/DeviceActivityMonitorExtension.swift +34 -0
  700. package/platforms/ios/App/App/DeviceActivityMonitorExtension/Info.plist +29 -0
  701. package/platforms/ios/App/App/DeviceActivityReportExtension/DeviceActivityReportExtension.entitlements +12 -0
  702. package/platforms/ios/App/App/DeviceActivityReportExtension/DeviceActivityReportExtension.swift +53 -0
  703. package/platforms/ios/App/App/DeviceActivityReportExtension/Info.plist +27 -0
  704. package/platforms/ios/App/App/ElizaAppIntents.swift +183 -0
  705. package/platforms/ios/App/App/ElizaIntentPlugin.swift +342 -5
  706. package/platforms/ios/App/App/Info.plist +17 -1
  707. package/platforms/ios/App/App/runners/eliza-tasks.js +177 -0
  708. package/platforms/ios/App/App.xcodeproj/project.pbxproj +262 -6
  709. package/platforms/ios/App/BroadcastExtension/SampleHandler.swift +100 -0
  710. package/platforms/ios/App/Podfile +5 -0
  711. package/platforms/ios/App/Podfile.lock +83 -59
  712. package/register-runtime-hooks.js +11 -5
  713. package/registry/app-registry.d.ts +14 -0
  714. package/registry/app-registry.d.ts.map +1 -0
  715. package/registry/app-registry.js +29 -0
  716. package/registry/entries/apps/app-polymarket.json +31 -0
  717. package/registry/entries/apps/clawville.json +27 -0
  718. package/registry/entries/apps/companion.json +28 -0
  719. package/registry/entries/apps/database-viewer.json +27 -0
  720. package/registry/entries/apps/defense-of-the-agents.json +27 -0
  721. package/registry/entries/apps/documents.json +30 -0
  722. package/registry/entries/apps/feed.json +27 -0
  723. package/registry/entries/apps/hyperliquid.json +31 -0
  724. package/registry/entries/apps/log-viewer.json +27 -0
  725. package/registry/entries/apps/memory-viewer.json +27 -0
  726. package/registry/entries/apps/model-tester.json +31 -0
  727. package/registry/entries/apps/plugin-viewer.json +27 -0
  728. package/registry/entries/apps/relationship-viewer.json +27 -0
  729. package/registry/entries/apps/runtime-debugger.json +27 -0
  730. package/registry/entries/apps/shopify.json +31 -0
  731. package/registry/entries/apps/skills-viewer.json +27 -0
  732. package/registry/entries/apps/steward.json +31 -0
  733. package/registry/entries/apps/training.json +54 -0
  734. package/registry/entries/apps/trajectory-viewer.json +27 -0
  735. package/registry/entries/apps/vincent.json +31 -0
  736. package/registry/entries/connectors/bluebubbles.json +99 -0
  737. package/registry/entries/connectors/bluesky.json +173 -0
  738. package/registry/entries/connectors/discord.json +119 -0
  739. package/registry/entries/connectors/farcaster.json +174 -0
  740. package/registry/entries/connectors/feishu.json +79 -0
  741. package/registry/entries/connectors/google-chat.json +120 -0
  742. package/registry/entries/connectors/google.json +82 -0
  743. package/registry/entries/connectors/imessage.json +96 -0
  744. package/registry/entries/connectors/instagram.json +64 -0
  745. package/registry/entries/connectors/line.json +86 -0
  746. package/registry/entries/connectors/matrix.json +94 -0
  747. package/registry/entries/connectors/mattermost.json +110 -0
  748. package/registry/entries/connectors/msteams.json +104 -0
  749. package/registry/entries/connectors/nextcloud-talk.json +104 -0
  750. package/registry/entries/connectors/nostr.json +70 -0
  751. package/registry/entries/connectors/signal.json +81 -0
  752. package/registry/entries/connectors/slack.json +102 -0
  753. package/registry/entries/connectors/telegram.json +71 -0
  754. package/registry/entries/connectors/tlon.json +94 -0
  755. package/registry/entries/connectors/twitch.json +110 -0
  756. package/registry/entries/connectors/whatsapp.json +113 -0
  757. package/registry/entries/connectors/x.json +231 -0
  758. package/registry/entries/connectors/zalo.json +112 -0
  759. package/registry/entries/connectors/zalouser.json +122 -0
  760. package/registry/entries/plugins/agent-orchestrator.json +33 -0
  761. package/registry/entries/plugins/agent-skills.json +72 -0
  762. package/registry/entries/plugins/anthropic.json +73 -0
  763. package/registry/entries/plugins/app-control.json +23 -0
  764. package/registry/entries/plugins/auto-trader.json +203 -0
  765. package/registry/entries/plugins/background-runner.json +26 -0
  766. package/registry/entries/plugins/blooio.json +102 -0
  767. package/registry/entries/plugins/browser.json +75 -0
  768. package/registry/entries/plugins/cli.json +40 -0
  769. package/registry/entries/plugins/clipboard.json +44 -0
  770. package/registry/entries/plugins/coding-tools.json +71 -0
  771. package/registry/entries/plugins/commands.json +63 -0
  772. package/registry/entries/plugins/computeruse.json +74 -0
  773. package/registry/entries/plugins/copilot-proxy.json +93 -0
  774. package/registry/entries/plugins/directives.json +63 -0
  775. package/registry/entries/plugins/edge-tts.json +97 -0
  776. package/registry/entries/plugins/elevenlabs.json +169 -0
  777. package/registry/entries/plugins/elizacloud.json +208 -0
  778. package/registry/entries/plugins/evm.json +134 -0
  779. package/registry/entries/plugins/experience.json +34 -0
  780. package/registry/entries/plugins/facewear.json +131 -0
  781. package/registry/entries/plugins/form.json +26 -0
  782. package/registry/entries/plugins/github.json +93 -0
  783. package/registry/entries/plugins/gmail-watch.json +25 -0
  784. package/registry/entries/plugins/goals.json +77 -0
  785. package/registry/entries/plugins/google-genai.json +106 -0
  786. package/registry/entries/plugins/groq.json +93 -0
  787. package/registry/entries/plugins/hedera.json +48 -0
  788. package/registry/entries/plugins/inmemorydb.json +25 -0
  789. package/registry/entries/plugins/linear.json +51 -0
  790. package/registry/entries/plugins/local-inference.json +142 -0
  791. package/registry/entries/plugins/local-storage.json +36 -0
  792. package/registry/entries/plugins/localdb.json +25 -0
  793. package/registry/entries/plugins/mcp.json +44 -0
  794. package/registry/entries/plugins/memory.json +124 -0
  795. package/registry/entries/plugins/minecraft.json +79 -0
  796. package/registry/entries/plugins/moltbook.json +83 -0
  797. package/registry/entries/plugins/music.json +155 -0
  798. package/registry/entries/plugins/mysticism.json +48 -0
  799. package/registry/entries/plugins/nearai.json +82 -0
  800. package/registry/entries/plugins/ngrok.json +69 -0
  801. package/registry/entries/plugins/ollama.json +96 -0
  802. package/registry/entries/plugins/openai.json +189 -0
  803. package/registry/entries/plugins/openrouter.json +188 -0
  804. package/registry/entries/plugins/pdf.json +26 -0
  805. package/registry/entries/plugins/plugin-manager.json +23 -0
  806. package/registry/entries/plugins/prose.json +48 -0
  807. package/registry/entries/plugins/rlm.json +26 -0
  808. package/registry/entries/plugins/roblox.json +88 -0
  809. package/registry/entries/plugins/rss.json +64 -0
  810. package/registry/entries/plugins/s3-storage.json +91 -0
  811. package/registry/entries/plugins/scheduling.json +35 -0
  812. package/registry/entries/plugins/shell.json +94 -0
  813. package/registry/entries/plugins/social-alpha.json +72 -0
  814. package/registry/entries/plugins/tailscale.json +81 -0
  815. package/registry/entries/plugins/tee.json +53 -0
  816. package/registry/entries/plugins/todos.json +26 -0
  817. package/registry/entries/plugins/trajectory-logger.json +33 -0
  818. package/registry/entries/plugins/trust.json +39 -0
  819. package/registry/entries/plugins/tts.json +71 -0
  820. package/registry/entries/plugins/tunnel.json +45 -0
  821. package/registry/entries/plugins/twilio.json +168 -0
  822. package/registry/entries/plugins/vercel-ai-gateway.json +128 -0
  823. package/registry/entries/plugins/video.json +23 -0
  824. package/registry/entries/plugins/vision.json +43 -0
  825. package/registry/entries/plugins/webhooks.json +23 -0
  826. package/registry/entries/plugins/workflow.json +25 -0
  827. package/registry/entries/plugins/xai.json +75 -0
  828. package/registry/index.d.ts +2 -1
  829. package/registry/index.d.ts.map +1 -1
  830. package/registry/index.js +46 -12
  831. package/registry/loader.d.ts +2 -1
  832. package/registry/loader.d.ts.map +1 -1
  833. package/registry/loader.js +49 -2
  834. package/registry/schema.d.ts +244 -34
  835. package/registry/schema.d.ts.map +1 -1
  836. package/registry/schema.js +36 -0
  837. package/runtime/android-avf-microdroid-bridge.d.ts +29 -0
  838. package/runtime/android-avf-microdroid-bridge.d.ts.map +1 -0
  839. package/runtime/android-avf-microdroid-bridge.js +149 -0
  840. package/runtime/api-dev-settings-banner.d.ts.map +1 -1
  841. package/runtime/api-dev-settings-banner.js +5 -13
  842. package/runtime/app-core-runtime-hooks.d.ts +21 -0
  843. package/runtime/app-core-runtime-hooks.d.ts.map +1 -0
  844. package/runtime/app-core-runtime-hooks.js +10 -0
  845. package/runtime/autonomy-policy.d.ts +2 -0
  846. package/runtime/autonomy-policy.d.ts.map +1 -0
  847. package/runtime/autonomy-policy.js +4 -0
  848. package/runtime/desktop/AppWindowRenderer.d.ts +17 -0
  849. package/runtime/desktop/AppWindowRenderer.d.ts.map +1 -0
  850. package/runtime/desktop/AppWindowRenderer.js +360 -0
  851. package/runtime/desktop/DesktopSurfaceNavigationRuntime.d.ts +2 -0
  852. package/runtime/desktop/DesktopSurfaceNavigationRuntime.d.ts.map +1 -0
  853. package/runtime/desktop/DesktopSurfaceNavigationRuntime.js +41 -0
  854. package/runtime/desktop/DesktopTrayRuntime.d.ts +2 -0
  855. package/runtime/desktop/DesktopTrayRuntime.d.ts.map +1 -0
  856. package/runtime/desktop/DesktopTrayRuntime.js +174 -0
  857. package/runtime/desktop/DetachedShellRoot.d.ts +10 -0
  858. package/runtime/desktop/DetachedShellRoot.d.ts.map +1 -0
  859. package/runtime/desktop/DetachedShellRoot.js +111 -0
  860. package/runtime/desktop/index.d.ts +6 -0
  861. package/runtime/desktop/index.d.ts.map +1 -0
  862. package/runtime/desktop/index.js +5 -0
  863. package/runtime/desktop/tray-menu.d.ts +20 -0
  864. package/runtime/desktop/tray-menu.d.ts.map +1 -0
  865. package/runtime/desktop/tray-menu.js +143 -0
  866. package/runtime/dev-server.d.ts +1 -1
  867. package/runtime/dev-server.d.ts.map +1 -1
  868. package/runtime/dev-server.js +93 -17
  869. package/runtime/eliza.d.ts +75 -1
  870. package/runtime/eliza.d.ts.map +1 -1
  871. package/runtime/eliza.js +596 -122
  872. package/runtime/ensure-text-to-speech-handler.d.ts.map +1 -1
  873. package/runtime/ensure-text-to-speech-handler.js +10 -3
  874. package/runtime/mobile-safe-runtime.d.ts +181 -2
  875. package/runtime/mobile-safe-runtime.d.ts.map +1 -1
  876. package/runtime/mobile-safe-runtime.js +1019 -12
  877. package/runtime/mode/remote-forwarder.d.ts.map +1 -1
  878. package/runtime/mode/remote-forwarder.js +2 -2
  879. package/runtime/mode/route-mode-guard.d.ts +1 -2
  880. package/runtime/mode/route-mode-guard.d.ts.map +1 -1
  881. package/runtime/mode/route-mode-guard.js +4 -5
  882. package/runtime/mode/route-mode-matrix.d.ts.map +1 -1
  883. package/runtime/mode/route-mode-matrix.js +14 -1
  884. package/runtime/mode/runtime-mode.d.ts +1 -1
  885. package/runtime/mode/runtime-mode.d.ts.map +1 -1
  886. package/runtime/mode/runtime-mode.js +15 -4
  887. package/runtime/runtime-bootstrap-policy.d.ts.map +1 -1
  888. package/runtime/runtime-bootstrap-policy.js +14 -2
  889. package/runtime/telegram-standalone-handler.d.ts.map +1 -1
  890. package/runtime/telegram-standalone-handler.js +10 -9
  891. package/runtime/tts-cache-wiring.d.ts +29 -0
  892. package/runtime/tts-cache-wiring.d.ts.map +1 -0
  893. package/runtime/tts-cache-wiring.js +114 -0
  894. package/runtime/voice-warmup.d.ts +81 -0
  895. package/runtime/voice-warmup.d.ts.map +1 -0
  896. package/runtime/voice-warmup.js +111 -0
  897. package/scripts/android-sms-gateway-template.test.mjs +1014 -0
  898. package/scripts/aosp/README.md +19 -15
  899. package/scripts/aosp/compile-libllama.mjs +1344 -248
  900. package/scripts/aosp/compile-shim.mjs +47 -18
  901. package/scripts/aosp/deploy-pixel.mjs +405 -0
  902. package/scripts/aosp/lib/load-variant-config.mjs +3 -3
  903. package/scripts/aosp/llama-cpp-patches/README.md +8 -8
  904. package/scripts/aosp/llama-cpp-patches/apply-patches.mjs +23 -6
  905. package/scripts/aosp/llama-cpp-patches/polarquant/README.md +37 -0
  906. package/scripts/aosp/llama-cpp-patches/qjl/README.md +37 -0
  907. package/scripts/aosp/seccomp-shim/sigsys-handler-arm64.c +169 -0
  908. package/scripts/aosp/seccomp-shim/sigsys-handler-riscv64.c +217 -0
  909. package/scripts/aosp/smoke-cuttlefish.mjs +34 -4
  910. package/scripts/aosp/stage-default-models.mjs +18 -18
  911. package/scripts/aosp/variant-config-schema.ts +2 -2
  912. package/scripts/assert-required-bundled-packages.test.ts +534 -0
  913. package/scripts/audit-apple-store-sandbox.mjs +146 -0
  914. package/scripts/audit-live-test-surface.mjs +5 -2
  915. package/scripts/build-capacitor-app.mjs +21 -0
  916. package/scripts/build-flatpak.mjs +5 -5
  917. package/scripts/build-helpers/arm64-simd.mjs +72 -0
  918. package/scripts/build-helpers/omnivoice-merged.mjs +87 -0
  919. package/scripts/build-helpers/verify-fused-symbols.mjs +567 -0
  920. package/scripts/build-image.sh +1 -1
  921. package/scripts/build-llama-cpp-mtp.mjs +487 -0
  922. package/scripts/build-native-plugins.mjs +230 -18
  923. package/scripts/build-patched-electrobun-cli.mjs +68 -10
  924. package/scripts/build-win.mjs +1 -1
  925. package/scripts/bun-riscv64/Dockerfile +418 -0
  926. package/scripts/bun-riscv64/README.md +316 -0
  927. package/scripts/bun-riscv64/build.sh +469 -0
  928. package/scripts/bun-riscv64/bun-patches/0001-config-add-riscv64-arch.patch +74 -0
  929. package/scripts/bun-riscv64/bun-patches/0002-flags-add-riscv64-march-mabi.patch +16 -0
  930. package/scripts/bun-riscv64/bun-patches/0003-zig-add-riscv64-target-triple-and-cpu.patch +26 -0
  931. package/scripts/bun-riscv64/bun-patches/0004-webkit-force-local-mode-on-riscv64.patch +33 -0
  932. package/scripts/bun-riscv64/bun-patches/0005-tinycc-disable-on-riscv64.patch +16 -0
  933. package/scripts/bun-riscv64/bun-patches/0006-build-add-riscv64-cli-validation.patch +15 -0
  934. package/scripts/bun-riscv64/bun-patches/0007-deps-per-dep-riscv64-checks.patch +24 -0
  935. package/scripts/bun-riscv64/bun-patches/0008-source-stabilize-riscv64-musl-build.patch +226 -0
  936. package/scripts/bun-riscv64/bun-patches/0009-disable-wasm-streaming-hooks-for-c-loop.patch +162 -0
  937. package/scripts/bun-riscv64/bun-patches/0010-disable-inspector-profiler-for-riscv64-c-loop.patch +80 -0
  938. package/scripts/bun-riscv64/bun-patches/0011-process-arch-add-riscv64.patch +23 -0
  939. package/scripts/bun-riscv64/bun-patches/0012-cpu-features-add-riscv64-fallback.patch +13 -0
  940. package/scripts/bun-riscv64/bun-patches/0013-disable-console-inspector-hooks-for-riscv64-c-loop.patch +43 -0
  941. package/scripts/bun-riscv64/bun-patches/0014-disable-custom-inspector-dispatchers-on-riscv64.patch +127 -0
  942. package/scripts/bun-riscv64/bun-patches/0015-disable-jsc-profiler-builtins-on-riscv64.patch +75 -0
  943. package/scripts/bun-riscv64/bun-patches/0016-node-vm-disable-jit-cached-data-on-riscv64-c-loop.patch +96 -0
  944. package/scripts/bun-riscv64/bun-patches/0017-disable-performance-domjit-signature-on-riscv64-c-loop.patch +34 -0
  945. package/scripts/bun-riscv64/bun-patches/0018-fix-serialized-script-identifier-big-endian-path.patch +19 -0
  946. package/scripts/bun-riscv64/bun-patches/0019-add-wtf-timer-fire-bridge-for-c-loop.patch +24 -0
  947. package/scripts/bun-riscv64/bun-patches/0020-run-riscv64-smoke-test-under-qemu.patch +13 -0
  948. package/scripts/bun-riscv64/bun-patches/0021-fix-riscv64-linux-open-flags.patch +25 -0
  949. package/scripts/bun-riscv64/bun-patches/0022-zlib-riscv64-generic-kernels.patch +25 -0
  950. package/scripts/bun-riscv64/bun-patches/README.md +127 -0
  951. package/scripts/bun-riscv64/bun-version.json +202 -0
  952. package/scripts/bun-riscv64/run-build.sh +162 -0
  953. package/scripts/bun-riscv64/rust-core/0001-riscv64-rust-core-port.patch +868 -0
  954. package/scripts/bun-riscv64/rust-core/0002-second-wave-riscv64-source-gaps.patch +130 -0
  955. package/scripts/bun-riscv64/rust-core/0003-third-wave-riscv64-crash-handler-gaps.patch +78 -0
  956. package/scripts/bun-riscv64/rust-core/0004-rust-target-cpu-riscv64.patch +39 -0
  957. package/scripts/bun-riscv64/rust-core/0005-fifth-wave-riscv64-source-gaps.patch +96 -0
  958. package/scripts/bun-riscv64/rust-core/0006-cpp-wasm-and-inspector-guards-riscv64.patch +91 -0
  959. package/scripts/bun-riscv64/rust-core/0007-bun-alloc-max-align-t-riscv64.patch +36 -0
  960. package/scripts/bun-riscv64/rust-core/0008-workspace-lints-warn-not-deny-riscv64.patch +75 -0
  961. package/scripts/bun-riscv64/rust-core/0009-zigglobalobject-wasm-streaming-guards-riscv64.patch +109 -0
  962. package/scripts/bun-riscv64/rust-core/0010-tcc-externs-stub-on-riscv64.patch +62 -0
  963. package/scripts/bun-riscv64/rust-core/0011-clippy-ptr-cast-lints-warn-riscv64.patch +61 -0
  964. package/scripts/bun-riscv64/rust-core/README.md +80 -0
  965. package/scripts/bun-riscv64/rust-core/webkit-patches/0003-disable-dfg-ftl-on-riscv64.patch +60 -0
  966. package/scripts/bun-riscv64/rust-core/webkit-patches/0004-riscv64-do-not-force-wasm-in-c-loop.patch +31 -0
  967. package/scripts/bun-riscv64/rust-core/webkit-patches/0005-domjit-effect-allow-no-dfg-c-loop.patch +40 -0
  968. package/scripts/bun-riscv64/rust-core/webkit-patches/0006-disable-usewasm-when-webassembly-compiled-out.patch +33 -0
  969. package/scripts/bun-riscv64/rust-core/webkit-patches/0007-restore-dropped-includes-and-llint-fwd-decl.patch +31 -0
  970. package/scripts/bun-riscv64/validate.sh +264 -0
  971. package/scripts/bun-riscv64/webkit-patches/0001-cherry-pick-llint-riscv64.recipe +155 -0
  972. package/scripts/bun-riscv64/webkit-patches/0002-cherry-pick-baseline-jit-riscv64.recipe +40 -0
  973. package/scripts/bun-riscv64/webkit-patches/0003-disable-dfg-ftl-on-riscv64.patch +60 -0
  974. package/scripts/bun-riscv64/webkit-patches/0004-riscv64-do-not-force-wasm-in-c-loop.patch +31 -0
  975. package/scripts/bun-riscv64/webkit-patches/0005-domjit-effect-allow-no-dfg-c-loop.patch +40 -0
  976. package/scripts/bun-riscv64/webkit-patches/0006-disable-usewasm-when-webassembly-compiled-out.patch +33 -0
  977. package/scripts/bun-riscv64/webkit-patches/0007-restore-dropped-includes-and-llint-fwd-decl.patch +72 -0
  978. package/scripts/bun-riscv64/webkit-patches/README.md +146 -0
  979. package/scripts/check-homepage-public-readiness.mjs +353 -0
  980. package/scripts/check-homepage-release-data.mjs +110 -0
  981. package/scripts/check-i18n.mjs +2 -1
  982. package/scripts/check-real-local-chat.ts +147 -0
  983. package/scripts/check-real-local-provisioning.ts +104 -0
  984. package/scripts/check-real-local-reset.ts +249 -0
  985. package/scripts/check-sms-gateway-completion-audit.mjs +428 -0
  986. package/scripts/check-sms-gateway-readiness.mjs +266 -0
  987. package/scripts/clean-repo.mjs +5 -5
  988. package/scripts/codesign-mas.mjs +222 -16
  989. package/scripts/collect-docker-runtime-deps.mjs +229 -0
  990. package/scripts/continue-sms-gateway-work.mjs +121 -0
  991. package/scripts/copy-runtime-node-modules.ts +903 -195
  992. package/scripts/deploy-cloud-api-production-gateway.mjs +52 -0
  993. package/scripts/desktop-build.mjs +655 -101
  994. package/scripts/dev-platform.mjs +346 -102
  995. package/scripts/dev-startup-smoke.mjs +248 -0
  996. package/scripts/dev-ui.mjs +418 -176
  997. package/scripts/disable-local-eliza-workspace.mjs +35 -0
  998. package/scripts/docker-ci-smoke.sh +298 -96
  999. package/scripts/docker-entrypoint.sh +62 -1
  1000. package/scripts/docker-entrypoint.test.ts +283 -0
  1001. package/scripts/ensure-avatars.mjs +2 -2
  1002. package/scripts/ensure-electrobun-core.mjs +1 -1
  1003. package/scripts/ensure-generated-core-proto-js.mjs +1 -1
  1004. package/scripts/ensure-type-package-aliases.mjs +62 -5
  1005. package/scripts/ensure-vision-deps.mjs +20 -1
  1006. package/scripts/entry.ts +1 -1
  1007. package/scripts/ffi-stub/Makefile +64 -0
  1008. package/scripts/ffi-stub/README.md +391 -0
  1009. package/scripts/ffi-stub/asr-ffi-smoke.ts +139 -0
  1010. package/scripts/ffi-stub/ffi-stub.c +539 -0
  1011. package/scripts/ffi-stub/ffi.h +538 -0
  1012. package/scripts/ffi-stub/libelizainference_stub.so +0 -0
  1013. package/scripts/ffi-stub/tts-stream-ffi-smoke.ts +349 -0
  1014. package/scripts/generate-first-run-voicelines.mjs +194 -0
  1015. package/scripts/generate-plugin-index.js +4 -3
  1016. package/scripts/generate-static-asset-manifest.mjs +1 -1
  1017. package/scripts/i18n-dynamic-keys.json +5 -5
  1018. package/scripts/init-submodules.mjs +2 -2
  1019. package/scripts/install-android-sms-gateway.md +177 -0
  1020. package/scripts/install-android-sms-gateway.mjs +1088 -0
  1021. package/scripts/ios-xcframework/README.md +74 -72
  1022. package/scripts/ios-xcframework/build-xcframework.mjs +204 -43
  1023. package/scripts/ios-xcframework/run-physical-device-smoke.mjs +1943 -0
  1024. package/scripts/ios-xcframework/runtime-symbol-shim.c +450 -0
  1025. package/scripts/kernel-patches/cpu-polar-kernels.mjs +441 -0
  1026. package/scripts/kernel-patches/cpu-simd-kernels.mjs +253 -0
  1027. package/scripts/kernel-patches/cpu-thread-parallelism.mjs +368 -0
  1028. package/scripts/kernel-patches/cuda-kernels.mjs +117 -0
  1029. package/scripts/kernel-patches/metal-kernels.mjs +1698 -109
  1030. package/scripts/kernel-patches/server-omnivoice-route.mjs +718 -0
  1031. package/scripts/kernel-patches/server-structured-output.mjs +279 -0
  1032. package/scripts/kernel-patches/vulkan-dispatch-log.mjs +166 -0
  1033. package/scripts/kernel-patches/vulkan-dispatch-log.test.mjs +50 -0
  1034. package/scripts/kernel-patches/vulkan-dispatch-patches/01-vulkan-shaders-gen.patch +30 -16
  1035. package/scripts/kernel-patches/vulkan-dispatch-patches/02-ggml-vulkan-pipelines.patch +75 -30
  1036. package/scripts/kernel-patches/vulkan-kernels.mjs +800 -49
  1037. package/scripts/lib/agent-source-watcher.mjs +174 -0
  1038. package/scripts/lib/agent-source-watcher.test.mjs +184 -0
  1039. package/scripts/lib/api-supervisor.mjs +78 -9
  1040. package/scripts/lib/api-supervisor.test.mjs +121 -0
  1041. package/scripts/lib/app-dir.mjs +2 -16
  1042. package/scripts/lib/apple-entitlement-audit.mjs +655 -0
  1043. package/scripts/lib/apple-entitlement-audit.test.mjs +144 -0
  1044. package/scripts/lib/bun-version-guard.mjs +13 -13
  1045. package/scripts/lib/capacitor-plugin-build-needed.mjs +4 -3
  1046. package/scripts/lib/capacitor-plugin-names.mjs +30 -14
  1047. package/scripts/lib/desktop-preflight.mjs +9 -5
  1048. package/scripts/lib/desktop-startup-embedding-warmup-policy.mjs +51 -0
  1049. package/scripts/lib/desktop-startup-embedding-warmup-policy.test.mjs +55 -0
  1050. package/scripts/lib/duet-bridge.d.mts +63 -0
  1051. package/scripts/lib/duet-bridge.mjs +193 -0
  1052. package/scripts/lib/node-path-env.mjs +4 -2
  1053. package/scripts/lib/orchestrator-desktop-dev-banner.mjs +12 -3
  1054. package/scripts/lib/patch-bun-exports.mjs +90 -27
  1055. package/scripts/lib/patch-bun-exports.test.mjs +79 -0
  1056. package/scripts/lib/renderer-build-action.mjs +35 -0
  1057. package/scripts/lib/renderer-build-action.test.mjs +70 -0
  1058. package/scripts/lib/stage-android-agent.mjs +748 -99
  1059. package/scripts/lib/sync-eliza-env-aliases.mjs +3 -25
  1060. package/scripts/lib/ui-smoke-stub-decision.mjs +33 -0
  1061. package/scripts/lib/ui-smoke-stub-decision.test.mjs +46 -0
  1062. package/scripts/lib/vite-renderer-dist-stale.mjs +5 -0
  1063. package/scripts/lib/voice-latency-report.mjs +154 -0
  1064. package/scripts/lifeops-prompt-benchmark.ts +21 -12
  1065. package/scripts/link-docker-local-app-packages.mjs +89 -36
  1066. package/scripts/local-stt-bench.ts +192 -0
  1067. package/scripts/maintain-cloud-api-production-gateway.mjs +54 -0
  1068. package/scripts/mas-smoke.mjs +459 -0
  1069. package/scripts/mas-smoke.test.mjs +220 -0
  1070. package/scripts/mobile-auth-simulator-smoke.mjs +0 -1
  1071. package/scripts/normalize-eliza-capture.ts +97 -0
  1072. package/scripts/omnivoice-fuse/prepare.mjs +2543 -23
  1073. package/scripts/pack-upstreams.mjs +65 -5
  1074. package/scripts/package-electrobun-linux.mjs +303 -0
  1075. package/scripts/patch-deps.mjs +5 -3
  1076. package/scripts/patches/llama-mobile-kokoro-tts.patch +480 -0
  1077. package/scripts/playwright-ui-live-stack.ts +194 -49
  1078. package/scripts/playwright-ui-smoke-api-stub.mjs +3501 -109
  1079. package/scripts/pre-review-local.mjs +2 -2
  1080. package/scripts/prepare-ios-cocoapods.sh +41 -3
  1081. package/scripts/release-check.ts +180 -84
  1082. package/scripts/release-workflow-drift.test.ts +57 -0
  1083. package/scripts/relink-workspace-packages-to-dist.mjs +21 -4
  1084. package/scripts/rt.mjs +16 -1
  1085. package/scripts/run-biome-check.mjs +1 -1
  1086. package/scripts/run-coding-agent-e2e.mjs +3 -3
  1087. package/scripts/run-eliza-app-core-script.mjs +34 -0
  1088. package/scripts/run-local-plugin-live-smoke.mjs +71 -2
  1089. package/scripts/run-mobile-build-android-app-actions.test.mjs +426 -0
  1090. package/scripts/run-mobile-build.mjs +4757 -607
  1091. package/scripts/run-node-runtime.mjs +184 -7
  1092. package/scripts/run-node-runtime.test.mjs +167 -0
  1093. package/scripts/run-node-tsx.mjs +80 -33
  1094. package/scripts/run-node.mjs +41 -1
  1095. package/scripts/run-production-build.mjs +34 -27
  1096. package/scripts/run-release-check.mjs +19 -0
  1097. package/scripts/run-release-contract-suite.mjs +107 -14
  1098. package/scripts/run-ui-smoke-playwright-suite.mjs +0 -2
  1099. package/scripts/runtime-package-manifest.ts +21 -3
  1100. package/scripts/setup-upstreams.mjs +42 -1
  1101. package/scripts/sms-gateway-status.mjs +194 -0
  1102. package/scripts/stage-android-agent.test.mjs +97 -0
  1103. package/scripts/stage-elizavoice-lib.mjs +203 -0
  1104. package/scripts/startup-integration-script-drift.test.ts +82 -4
  1105. package/scripts/streaming-pipeline-bench.ts +543 -0
  1106. package/scripts/sync-homepage-porkbun-dns.mjs +262 -0
  1107. package/scripts/test-sms-gateway-software.mjs +100 -0
  1108. package/scripts/type-audit.mjs +1 -1
  1109. package/scripts/validate-bluebubbles-outbound.mjs +293 -0
  1110. package/scripts/validate-cdn-assets.mjs +15 -7
  1111. package/scripts/validate-regression-matrix.mjs +109 -8
  1112. package/scripts/verify-android-sms-gateway-e2e.mjs +362 -0
  1113. package/scripts/verify-bluebubbles-gateway-e2e.mjs +191 -0
  1114. package/scripts/verify-bluebubbles-inbound-readiness.mjs +88 -0
  1115. package/scripts/verify-cloud-api-production-deploy.mjs +87 -0
  1116. package/scripts/verify-cloud-sms-onboarding-flow.mjs +336 -0
  1117. package/scripts/voice/freeze-voice.mjs +521 -0
  1118. package/scripts/voice-attribution-smoke.ts +538 -0
  1119. package/scripts/voice-create-profile.mjs +379 -0
  1120. package/scripts/voice-duet.mjs +1355 -0
  1121. package/scripts/voice-e2e-hardware.ts +871 -0
  1122. package/scripts/voice-interactive.mjs +1750 -0
  1123. package/scripts/voice-latency-report.mjs +96 -0
  1124. package/scripts/voice-latency-report.test.ts +176 -0
  1125. package/scripts/voice-preset/build-default-voice-preset.mjs +249 -0
  1126. package/scripts/voice-preset/build-onboarding-voice.mjs +281 -0
  1127. package/scripts/watch-sms-gateway-readiness.mjs +303 -0
  1128. package/scripts/write-homepage-release-data.mjs +458 -26
  1129. package/security/agent-vault-id.d.ts +1 -1
  1130. package/security/agent-vault-id.js +1 -1
  1131. package/security/hydrate-wallet-keys-from-platform-store.d.ts.map +1 -1
  1132. package/security/hydrate-wallet-keys-from-platform-store.js +23 -14
  1133. package/security/platform-secure-store-node.d.ts +2 -2
  1134. package/security/platform-secure-store-node.js +3 -3
  1135. package/security/wallet-os-store-actions.d.ts +0 -9
  1136. package/security/wallet-os-store-actions.d.ts.map +1 -1
  1137. package/security/wallet-os-store-actions.js +3 -10
  1138. package/services/account-pool.d.ts +23 -14
  1139. package/services/account-pool.d.ts.map +1 -1
  1140. package/services/account-pool.js +86 -24
  1141. package/services/account-usage.d.ts.map +1 -1
  1142. package/services/account-usage.js +2 -5
  1143. package/services/ambient-audio/consent.d.ts +9 -0
  1144. package/services/ambient-audio/consent.d.ts.map +1 -0
  1145. package/services/ambient-audio/consent.js +28 -0
  1146. package/services/ambient-audio/index.d.ts +7 -0
  1147. package/services/ambient-audio/index.d.ts.map +1 -0
  1148. package/services/ambient-audio/index.js +4 -0
  1149. package/services/ambient-audio/replay-buffer.d.ts +14 -0
  1150. package/services/ambient-audio/replay-buffer.d.ts.map +1 -0
  1151. package/services/ambient-audio/replay-buffer.js +66 -0
  1152. package/services/ambient-audio/response-gate.d.ts +3 -0
  1153. package/services/ambient-audio/response-gate.d.ts.map +1 -0
  1154. package/services/ambient-audio/response-gate.js +33 -0
  1155. package/services/ambient-audio/service.d.ts +22 -0
  1156. package/services/ambient-audio/service.d.ts.map +1 -0
  1157. package/services/ambient-audio/service.js +47 -0
  1158. package/services/ambient-audio/types.d.ts +42 -0
  1159. package/services/ambient-audio/types.d.ts.map +1 -0
  1160. package/services/app-updates/update-policy.d.ts +64 -0
  1161. package/services/app-updates/update-policy.d.ts.map +1 -0
  1162. package/services/app-updates/update-policy.js +228 -0
  1163. package/services/auth-store.d.ts +37 -1
  1164. package/services/auth-store.d.ts.map +1 -1
  1165. package/services/auth-store.js +59 -26
  1166. package/services/cloud-jwks-store.d.ts +3 -3
  1167. package/services/cloud-jwks-store.d.ts.map +1 -1
  1168. package/services/cloud-jwks-store.js +5 -8
  1169. package/services/coding-account-bridge.d.ts +71 -0
  1170. package/services/coding-account-bridge.d.ts.map +1 -0
  1171. package/services/coding-account-bridge.js +267 -0
  1172. package/services/connector-target-catalog.d.ts +10 -3
  1173. package/services/connector-target-catalog.d.ts.map +1 -1
  1174. package/services/connector-target-catalog.js +7 -4
  1175. package/services/credential-tunnel-service.d.ts +66 -0
  1176. package/services/credential-tunnel-service.d.ts.map +1 -0
  1177. package/services/credential-tunnel-service.js +227 -0
  1178. package/services/github-credentials.d.ts +1 -1
  1179. package/services/github-credentials.js +1 -1
  1180. package/services/inference-abort.d.ts +47 -0
  1181. package/services/inference-abort.d.ts.map +1 -0
  1182. package/services/inference-abort.js +76 -0
  1183. package/services/persistence.d.ts +2 -3
  1184. package/services/persistence.d.ts.map +1 -1
  1185. package/services/persistence.js +2 -3
  1186. package/services/phrase-chunked-tts.d.ts +136 -0
  1187. package/services/phrase-chunked-tts.d.ts.map +1 -0
  1188. package/services/phrase-chunked-tts.js +208 -0
  1189. package/services/sandbox-registry.d.ts +78 -0
  1190. package/services/sandbox-registry.d.ts.map +1 -0
  1191. package/services/sandbox-registry.js +323 -0
  1192. package/services/secrets-manager-installer.d.ts +8 -1
  1193. package/services/secrets-manager-installer.d.ts.map +1 -1
  1194. package/services/secrets-manager-installer.js +27 -2
  1195. package/services/sensitive-requests/cloud-link-adapter.d.ts +15 -0
  1196. package/services/sensitive-requests/cloud-link-adapter.d.ts.map +1 -0
  1197. package/services/sensitive-requests/cloud-link-adapter.js +73 -0
  1198. package/services/sensitive-requests/index.d.ts +27 -0
  1199. package/services/sensitive-requests/index.d.ts.map +1 -0
  1200. package/services/sensitive-requests/index.js +51 -0
  1201. package/services/sensitive-requests/instruct-dm-only-adapter.d.ts +14 -0
  1202. package/services/sensitive-requests/instruct-dm-only-adapter.d.ts.map +1 -0
  1203. package/services/sensitive-requests/instruct-dm-only-adapter.js +22 -0
  1204. package/services/sensitive-requests/owner-app-inline-adapter.d.ts +3 -0
  1205. package/services/sensitive-requests/owner-app-inline-adapter.d.ts.map +1 -0
  1206. package/services/sensitive-requests/owner-app-inline-adapter.js +146 -0
  1207. package/services/sensitive-requests/owner-app-oauth-adapter.d.ts +3 -0
  1208. package/services/sensitive-requests/owner-app-oauth-adapter.d.ts.map +1 -0
  1209. package/services/sensitive-requests/owner-app-oauth-adapter.js +156 -0
  1210. package/services/sensitive-requests/public-link-adapter.d.ts +14 -0
  1211. package/services/sensitive-requests/public-link-adapter.d.ts.map +1 -0
  1212. package/services/sensitive-requests/public-link-adapter.js +86 -0
  1213. package/services/sensitive-requests/tunnel-link-adapter.d.ts +17 -0
  1214. package/services/sensitive-requests/tunnel-link-adapter.d.ts.map +1 -0
  1215. package/services/sensitive-requests/tunnel-link-adapter.js +38 -0
  1216. package/services/steward-credentials.d.ts +1 -1
  1217. package/services/steward-credentials.d.ts.map +1 -1
  1218. package/services/steward-credentials.js +10 -6
  1219. package/services/steward-sidecar/health-check.d.ts.map +1 -1
  1220. package/services/steward-sidecar/health-check.js +4 -3
  1221. package/services/steward-sidecar/process-management.d.ts +1 -1
  1222. package/services/steward-sidecar/process-management.d.ts.map +1 -1
  1223. package/services/steward-sidecar/process-management.js +9 -3
  1224. package/services/steward-sidecar/types.d.ts +1 -1
  1225. package/services/steward-sidecar/types.d.ts.map +1 -1
  1226. package/services/steward-sidecar/wallet-setup.d.ts.map +1 -1
  1227. package/services/steward-sidecar/wallet-setup.js +8 -7
  1228. package/services/steward-sidecar.d.ts +2 -2
  1229. package/services/steward-sidecar.d.ts.map +1 -1
  1230. package/services/steward-sidecar.js +27 -19
  1231. package/services/task-host-capabilities.d.ts +60 -0
  1232. package/services/task-host-capabilities.d.ts.map +1 -0
  1233. package/services/task-host-capabilities.js +122 -0
  1234. package/services/tool-call-cache/index.d.ts +2 -2
  1235. package/services/tool-call-cache/index.d.ts.map +1 -1
  1236. package/services/tool-call-cache/index.js +1 -1
  1237. package/services/trigger-event-bridge.js +1 -1
  1238. package/services/tunnel-to-mobile/index.d.ts +2 -0
  1239. package/services/tunnel-to-mobile/index.d.ts.map +1 -0
  1240. package/services/tunnel-to-mobile/index.js +1 -0
  1241. package/services/tunnel-to-mobile/tunnel-to-mobile-client.d.ts +105 -0
  1242. package/services/tunnel-to-mobile/tunnel-to-mobile-client.d.ts.map +1 -0
  1243. package/services/tunnel-to-mobile/tunnel-to-mobile-client.js +190 -0
  1244. package/services/vault-bootstrap.d.ts.map +1 -1
  1245. package/services/vault-bootstrap.js +48 -21
  1246. package/services/vault-mirror.d.ts +1 -1
  1247. package/services/vault-mirror.d.ts.map +1 -1
  1248. package/services/vault-mirror.js +29 -6
  1249. package/services/voice-profiles/diarization-pipeline.d.ts +6 -0
  1250. package/services/voice-profiles/diarization-pipeline.d.ts.map +1 -0
  1251. package/services/voice-profiles/diarization-pipeline.js +20 -0
  1252. package/services/voice-profiles/index.d.ts +12 -0
  1253. package/services/voice-profiles/index.d.ts.map +1 -0
  1254. package/services/voice-profiles/index.js +5 -0
  1255. package/services/voice-profiles/nickname-evaluator.d.ts +14 -0
  1256. package/services/voice-profiles/nickname-evaluator.d.ts.map +1 -0
  1257. package/services/voice-profiles/nickname-evaluator.js +46 -0
  1258. package/services/voice-profiles/owner-confidence.d.ts +10 -0
  1259. package/services/voice-profiles/owner-confidence.d.ts.map +1 -0
  1260. package/services/voice-profiles/owner-confidence.js +38 -0
  1261. package/services/voice-profiles/private-challenge.d.ts +20 -0
  1262. package/services/voice-profiles/private-challenge.d.ts.map +1 -0
  1263. package/services/voice-profiles/private-challenge.js +44 -0
  1264. package/services/voice-profiles/store.d.ts +21 -0
  1265. package/services/voice-profiles/store.d.ts.map +1 -0
  1266. package/services/voice-profiles/store.js +50 -0
  1267. package/services/voice-profiles/types.d.ts +38 -0
  1268. package/services/voice-profiles/types.d.ts.map +1 -0
  1269. package/services/voice-profiles/types.js +1 -0
  1270. package/styles/electrobun-mac-window-drag.css +4 -4
  1271. package/test/helpers/__tests__/live-agent-test.smoke.test.ts +43 -70
  1272. package/test/helpers/browser-mocks.ts +2 -2
  1273. package/test/helpers/conditional-tests.ts +2 -2
  1274. package/test/helpers/i18n.ts +1 -1
  1275. package/test/helpers/live-agent-test.ts +537 -551
  1276. package/test/helpers/live-provider.test.ts +4 -4
  1277. package/test/helpers/live-provider.ts +41 -7
  1278. package/test/helpers/live-runtime-server.ts +4 -4
  1279. package/test/helpers/pglite-runtime.ts +1 -1
  1280. package/test/helpers/real-runtime.ts +54 -15
  1281. package/test/helpers/trajectory-harness.ts +11 -7
  1282. package/test/scripts/start-eliza-live.ts +9 -0
  1283. package/test/scripts/test-parallel.mjs +1 -1
  1284. package/test/scripts/test-root-unit.mjs +6 -7
  1285. package/ui-compat.d.ts +13 -2
  1286. package/ui-compat.d.ts.map +1 -1
  1287. package/ui-compat.js +19 -3
  1288. package/api/auth-pairing-compat-routes.d.ts +0 -17
  1289. package/api/auth-pairing-compat-routes.d.ts.map +0 -1
  1290. package/api/auth-pairing-compat-routes.js +0 -301
  1291. package/api/local-inference-compat-routes.d.ts +0 -16
  1292. package/api/local-inference-compat-routes.d.ts.map +0 -1
  1293. package/api/local-inference-compat-routes.js +0 -617
  1294. package/api/onboarding-compat-routes.d.ts +0 -4
  1295. package/api/onboarding-compat-routes.d.ts.map +0 -1
  1296. package/api/onboarding-compat-routes.js +0 -207
  1297. package/api/plugins-compat-routes.d.ts +0 -103
  1298. package/api/plugins-compat-routes.d.ts.map +0 -1
  1299. package/api/plugins-compat-routes.js +0 -1181
  1300. package/api/server-onboarding-compat.d.ts +0 -31
  1301. package/api/server-onboarding-compat.d.ts.map +0 -1
  1302. package/api/server-onboarding-compat.js +0 -283
  1303. package/benchmark/cua-routes.d.ts +0 -10
  1304. package/benchmark/cua-routes.d.ts.map +0 -1
  1305. package/benchmark/cua-routes.js +0 -179
  1306. package/benchmark/mock-plugin-base.d.ts +0 -9
  1307. package/benchmark/mock-plugin-base.d.ts.map +0 -1
  1308. package/benchmark/mock-plugin-base.js +0 -325
  1309. package/cli/parse-duration.d.ts +0 -5
  1310. package/cli/parse-duration.d.ts.map +0 -1
  1311. package/cli/parse-duration.js +0 -27
  1312. package/patches/llama-cpp-capacitor@0.1.5.patch +0 -2387
  1313. package/platform/agent-browser-stub.d.ts +0 -27
  1314. package/platform/agent-browser-stub.d.ts.map +0 -1
  1315. package/platform/agent-browser-stub.js +0 -16
  1316. package/platforms/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java +0 -26
  1317. package/platforms/android/app/src/main/res/drawable/ic_launcher_background.xml +0 -170
  1318. package/platforms/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +0 -34
  1319. package/platforms/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java +0 -18
  1320. package/platforms/electrobun/assets/appIcon.iconset/icon_512x512@2x.png +0 -0
  1321. package/platforms/electrobun/assets/appIcon.png +0 -0
  1322. package/platforms/electrobun/scripts/build-whisper-universal.sh +0 -137
  1323. package/platforms/electrobun/scripts/build-whisper.sh +0 -95
  1324. package/platforms/electrobun/src/libMacWindowEffects.dylib +0 -0
  1325. package/platforms/electrobun/src/native/whisper.ts +0 -280
  1326. package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
  1327. package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
  1328. package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
  1329. package/registry/generate-apps.d.ts +0 -2
  1330. package/registry/generate-apps.d.ts.map +0 -1
  1331. package/registry/generate-apps.js +0 -338
  1332. package/registry/generate.d.ts +0 -2
  1333. package/registry/generate.d.ts.map +0 -1
  1334. package/registry/generate.js +0 -506
  1335. package/runtime/embedding-manager-support.d.ts +0 -77
  1336. package/runtime/embedding-manager-support.d.ts.map +0 -1
  1337. package/runtime/embedding-manager-support.js +0 -309
  1338. package/runtime/embedding-presets.d.ts +0 -5
  1339. package/runtime/embedding-presets.d.ts.map +0 -1
  1340. package/runtime/embedding-presets.js +0 -47
  1341. package/runtime/embedding-warmup-policy.d.ts +0 -13
  1342. package/runtime/embedding-warmup-policy.d.ts.map +0 -1
  1343. package/runtime/embedding-warmup-policy.js +0 -33
  1344. package/runtime/ensure-local-inference-handler.d.ts +0 -25
  1345. package/runtime/ensure-local-inference-handler.d.ts.map +0 -1
  1346. package/runtime/ensure-local-inference-handler.js +0 -389
  1347. package/runtime/mobile-local-inference-gate.d.ts +0 -21
  1348. package/runtime/mobile-local-inference-gate.d.ts.map +0 -1
  1349. package/runtime/mobile-local-inference-gate.js +0 -24
  1350. package/scripts/aosp/avd-test.mjs +0 -403
  1351. package/scripts/aosp/boot-validate.mjs +0 -536
  1352. package/scripts/aosp/build-aosp.mjs +0 -448
  1353. package/scripts/aosp/build-bootanimation.mjs +0 -178
  1354. package/scripts/aosp/capture-screens.mjs +0 -325
  1355. package/scripts/aosp/e2e-validate.mjs +0 -225
  1356. package/scripts/aosp/lint-init-rc.mjs +0 -258
  1357. package/scripts/aosp/llama-shim/eliza_llama_shim.c +0 -276
  1358. package/scripts/aosp/sim.mjs +0 -277
  1359. package/scripts/aosp/sync-to-aosp.mjs +0 -134
  1360. package/scripts/aosp/validate.mjs +0 -1273
  1361. package/scripts/build-llama-cpp-dflash.mjs +0 -1866
  1362. package/scripts/generate-onboarding-voicelines.mjs +0 -194
  1363. package/scripts/generated/static-asset-manifest.json +0 -4
  1364. package/scripts/normalize-parallax-capture.ts +0 -97
  1365. package/scripts/omnivoice-fuse/Makefile +0 -44
  1366. package/scripts/omnivoice-fuse/README.md +0 -266
  1367. package/scripts/omnivoice-fuse/cmake-graft.mjs +0 -180
  1368. package/scripts/omnivoice-fuse/ffi-stub.c +0 -222
  1369. package/scripts/omnivoice-fuse/ffi.h +0 -158
  1370. package/scripts/omnivoice-fuse/libelizainference_stub.dylib +0 -0
  1371. package/scripts/omnivoice-fuse/verify-symbols.mjs +0 -138
  1372. package/security/cloud-secret-store.d.ts +0 -34
  1373. package/security/cloud-secret-store.d.ts.map +0 -1
  1374. package/security/cloud-secret-store.js +0 -65
  1375. package/security/export-guard.d.ts +0 -34
  1376. package/security/export-guard.d.ts.map +0 -1
  1377. package/security/export-guard.js +0 -127
  1378. package/services/local-inference/__stress__/cache-stress-helpers.d.ts +0 -76
  1379. package/services/local-inference/__stress__/cache-stress-helpers.d.ts.map +0 -1
  1380. package/services/local-inference/__stress__/cache-stress-helpers.js +0 -238
  1381. package/services/local-inference/active-model.d.ts +0 -180
  1382. package/services/local-inference/active-model.d.ts.map +0 -1
  1383. package/services/local-inference/active-model.js +0 -362
  1384. package/services/local-inference/assignments.d.ts +0 -58
  1385. package/services/local-inference/assignments.d.ts.map +0 -1
  1386. package/services/local-inference/assignments.js +0 -179
  1387. package/services/local-inference/backend.d.ts +0 -200
  1388. package/services/local-inference/backend.d.ts.map +0 -1
  1389. package/services/local-inference/backend.js +0 -242
  1390. package/services/local-inference/bundled-models.d.ts +0 -34
  1391. package/services/local-inference/bundled-models.d.ts.map +0 -1
  1392. package/services/local-inference/bundled-models.js +0 -104
  1393. package/services/local-inference/cache-bridge.d.ts +0 -184
  1394. package/services/local-inference/cache-bridge.d.ts.map +0 -1
  1395. package/services/local-inference/cache-bridge.js +0 -333
  1396. package/services/local-inference/catalog.d.ts +0 -57
  1397. package/services/local-inference/catalog.d.ts.map +0 -1
  1398. package/services/local-inference/catalog.js +0 -262
  1399. package/services/local-inference/conversation-registry.d.ts +0 -122
  1400. package/services/local-inference/conversation-registry.d.ts.map +0 -1
  1401. package/services/local-inference/conversation-registry.js +0 -182
  1402. package/services/local-inference/device-bridge.d.ts +0 -139
  1403. package/services/local-inference/device-bridge.d.ts.map +0 -1
  1404. package/services/local-inference/device-bridge.js +0 -774
  1405. package/services/local-inference/dflash-doctor.d.ts +0 -27
  1406. package/services/local-inference/dflash-doctor.d.ts.map +0 -1
  1407. package/services/local-inference/dflash-doctor.js +0 -149
  1408. package/services/local-inference/dflash-server.d.ts +0 -248
  1409. package/services/local-inference/dflash-server.d.ts.map +0 -1
  1410. package/services/local-inference/dflash-server.js +0 -1076
  1411. package/services/local-inference/downloader.d.ts +0 -48
  1412. package/services/local-inference/downloader.d.ts.map +0 -1
  1413. package/services/local-inference/downloader.js +0 -688
  1414. package/services/local-inference/engine.d.ts +0 -282
  1415. package/services/local-inference/engine.d.ts.map +0 -1
  1416. package/services/local-inference/engine.js +0 -743
  1417. package/services/local-inference/external-scanner.d.ts +0 -17
  1418. package/services/local-inference/external-scanner.d.ts.map +0 -1
  1419. package/services/local-inference/external-scanner.js +0 -261
  1420. package/services/local-inference/handler-registry.d.ts +0 -72
  1421. package/services/local-inference/handler-registry.d.ts.map +0 -1
  1422. package/services/local-inference/handler-registry.js +0 -159
  1423. package/services/local-inference/hardware.d.ts +0 -26
  1424. package/services/local-inference/hardware.d.ts.map +0 -1
  1425. package/services/local-inference/hardware.js +0 -139
  1426. package/services/local-inference/hf-search.d.ts +0 -19
  1427. package/services/local-inference/hf-search.d.ts.map +0 -1
  1428. package/services/local-inference/hf-search.js +0 -169
  1429. package/services/local-inference/index.d.ts +0 -10
  1430. package/services/local-inference/index.d.ts.map +0 -1
  1431. package/services/local-inference/index.js +0 -7
  1432. package/services/local-inference/llama-server-metrics.d.ts +0 -108
  1433. package/services/local-inference/llama-server-metrics.d.ts.map +0 -1
  1434. package/services/local-inference/llama-server-metrics.js +0 -175
  1435. package/services/local-inference/manifest/index.d.ts +0 -4
  1436. package/services/local-inference/manifest/index.d.ts.map +0 -1
  1437. package/services/local-inference/manifest/index.js +0 -5
  1438. package/services/local-inference/manifest/schema.d.ts +0 -419
  1439. package/services/local-inference/manifest/schema.d.ts.map +0 -1
  1440. package/services/local-inference/manifest/schema.js +0 -227
  1441. package/services/local-inference/manifest/types.d.ts +0 -23
  1442. package/services/local-inference/manifest/types.d.ts.map +0 -1
  1443. package/services/local-inference/manifest/types.js +0 -5
  1444. package/services/local-inference/manifest/validator.d.ts +0 -43
  1445. package/services/local-inference/manifest/validator.d.ts.map +0 -1
  1446. package/services/local-inference/manifest/validator.js +0 -180
  1447. package/services/local-inference/paths.d.ts +0 -8
  1448. package/services/local-inference/paths.d.ts.map +0 -1
  1449. package/services/local-inference/paths.js +0 -7
  1450. package/services/local-inference/providers.d.ts +0 -61
  1451. package/services/local-inference/providers.d.ts.map +0 -1
  1452. package/services/local-inference/providers.js +0 -334
  1453. package/services/local-inference/ram-budget.d.ts +0 -57
  1454. package/services/local-inference/ram-budget.d.ts.map +0 -1
  1455. package/services/local-inference/ram-budget.js +0 -107
  1456. package/services/local-inference/readiness.d.ts +0 -9
  1457. package/services/local-inference/readiness.d.ts.map +0 -1
  1458. package/services/local-inference/readiness.js +0 -153
  1459. package/services/local-inference/recommendation.d.ts +0 -62
  1460. package/services/local-inference/recommendation.d.ts.map +0 -1
  1461. package/services/local-inference/recommendation.js +0 -309
  1462. package/services/local-inference/registry.d.ts +0 -35
  1463. package/services/local-inference/registry.d.ts.map +0 -1
  1464. package/services/local-inference/registry.js +0 -117
  1465. package/services/local-inference/router-handler.d.ts +0 -51
  1466. package/services/local-inference/router-handler.d.ts.map +0 -1
  1467. package/services/local-inference/router-handler.js +0 -165
  1468. package/services/local-inference/routing-policy.d.ts +0 -55
  1469. package/services/local-inference/routing-policy.d.ts.map +0 -1
  1470. package/services/local-inference/routing-policy.js +0 -195
  1471. package/services/local-inference/routing-preferences.d.ts +0 -8
  1472. package/services/local-inference/routing-preferences.d.ts.map +0 -1
  1473. package/services/local-inference/routing-preferences.js +0 -7
  1474. package/services/local-inference/service.d.ts +0 -88
  1475. package/services/local-inference/service.d.ts.map +0 -1
  1476. package/services/local-inference/service.js +0 -210
  1477. package/services/local-inference/session-pool.d.ts +0 -72
  1478. package/services/local-inference/session-pool.d.ts.map +0 -1
  1479. package/services/local-inference/session-pool.js +0 -125
  1480. package/services/local-inference/types.d.ts +0 -309
  1481. package/services/local-inference/types.d.ts.map +0 -1
  1482. package/services/local-inference/types.js +0 -23
  1483. package/services/local-inference/verify.d.ts +0 -8
  1484. package/services/local-inference/verify.d.ts.map +0 -1
  1485. package/services/local-inference/verify.js +0 -7
  1486. package/services/local-inference/voice/barge-in.d.ts +0 -15
  1487. package/services/local-inference/voice/barge-in.d.ts.map +0 -1
  1488. package/services/local-inference/voice/barge-in.js +0 -20
  1489. package/services/local-inference/voice/engine-bridge.d.ts +0 -256
  1490. package/services/local-inference/voice/engine-bridge.d.ts.map +0 -1
  1491. package/services/local-inference/voice/engine-bridge.js +0 -398
  1492. package/services/local-inference/voice/ffi-bindings.d.ts +0 -114
  1493. package/services/local-inference/voice/ffi-bindings.d.ts.map +0 -1
  1494. package/services/local-inference/voice/ffi-bindings.js +0 -281
  1495. package/services/local-inference/voice/index.d.ts +0 -51
  1496. package/services/local-inference/voice/index.d.ts.map +0 -1
  1497. package/services/local-inference/voice/index.js +0 -50
  1498. package/services/local-inference/voice/lifecycle.d.ts +0 -135
  1499. package/services/local-inference/voice/lifecycle.d.ts.map +0 -1
  1500. package/services/local-inference/voice/lifecycle.js +0 -189
  1501. package/services/local-inference/voice/phoneme-tokenizer.d.ts +0 -58
  1502. package/services/local-inference/voice/phoneme-tokenizer.d.ts.map +0 -1
  1503. package/services/local-inference/voice/phoneme-tokenizer.js +0 -53
  1504. package/services/local-inference/voice/phrase-cache.d.ts +0 -24
  1505. package/services/local-inference/voice/phrase-cache.d.ts.map +0 -1
  1506. package/services/local-inference/voice/phrase-cache.js +0 -32
  1507. package/services/local-inference/voice/phrase-chunker.d.ts +0 -20
  1508. package/services/local-inference/voice/phrase-chunker.d.ts.map +0 -1
  1509. package/services/local-inference/voice/phrase-chunker.js +0 -85
  1510. package/services/local-inference/voice/ring-buffer.d.ts +0 -40
  1511. package/services/local-inference/voice/ring-buffer.d.ts.map +0 -1
  1512. package/services/local-inference/voice/ring-buffer.js +0 -85
  1513. package/services/local-inference/voice/rollback-queue.d.ts +0 -24
  1514. package/services/local-inference/voice/rollback-queue.d.ts.map +0 -1
  1515. package/services/local-inference/voice/rollback-queue.js +0 -49
  1516. package/services/local-inference/voice/scheduler.d.ts +0 -47
  1517. package/services/local-inference/voice/scheduler.d.ts.map +0 -1
  1518. package/services/local-inference/voice/scheduler.js +0 -123
  1519. package/services/local-inference/voice/shared-resources.d.ts +0 -119
  1520. package/services/local-inference/voice/shared-resources.d.ts.map +0 -1
  1521. package/services/local-inference/voice/shared-resources.js +0 -83
  1522. package/services/local-inference/voice/speaker-preset-cache.d.ts +0 -28
  1523. package/services/local-inference/voice/speaker-preset-cache.d.ts.map +0 -1
  1524. package/services/local-inference/voice/speaker-preset-cache.js +0 -44
  1525. package/services/local-inference/voice/types.d.ts +0 -80
  1526. package/services/local-inference/voice/types.d.ts.map +0 -1
  1527. package/services/local-inference/voice/voice-preset-format.d.ts +0 -56
  1528. package/services/local-inference/voice/voice-preset-format.d.ts.map +0 -1
  1529. package/services/local-inference/voice/voice-preset-format.js +0 -184
  1530. package/services/plugin-installer.d.ts +0 -22
  1531. package/services/plugin-installer.d.ts.map +0 -1
  1532. package/services/plugin-installer.js +0 -41
  1533. package/test/scripts/task-agent-live-smoke.ts +0 -1335
  1534. /package/services/{local-inference/voice → ambient-audio}/types.js +0 -0
@@ -0,0 +1,1750 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * Interactive end-to-end voice harness for Eliza-1 (`eliza-1-2b`).
4
+ *
5
+ * Send a voice message, get a voice response back — the full optimized
6
+ * voice-assistant loop the W1–W13 swarm landed, run interactively:
7
+ *
8
+ * mic → VAD (RMS + Silero v5 GGUF) → streaming ASR (fused Qwen3-ASR)
9
+ * → turn controller (prewarm-on-speech-start, speculative-on-pause,
10
+ * abort-on-resume, promote-or-rerun on speech-end)
11
+ * → runtime message handler (Stage-1 forced-JSON grammar, streamed)
12
+ * → phrase chunker (`, . ! ?` / N words)
13
+ * → streaming TTS (Kokoro / OmniVoice per tier)
14
+ * → PCM ring buffer → system audio sink (aplay / afplay / paplay)
15
+ *
16
+ * with MTP speculative decoding, KV-prefix prewarm, streaming LLM→TTS,
17
+ * barge-in (pause/resume/hard-stop), and force-stop on a keypress.
18
+ *
19
+ * **No faking.** If the real `eliza-1-2b` bundle, the MTP `llama-server`
20
+ * binary, the fused `libelizainference`, a mic, or the Silero VAD model is
21
+ * missing, this prints the exact missing-prereq checklist + the fix
22
+ * command and exits non-zero. It never emits silence-and-calls-it-TTS
23
+ * and never pretends a model loaded.
24
+ *
25
+ * Run:
26
+ * bun run voice:interactive # real mic interactive
27
+ * bun run voice:interactive -- --list-active # print active optimizations + exit
28
+ * bun run voice:interactive -- --say "hi there" # skip ASR, inject text (LLM→TTS half)
29
+ * bun run voice:interactive -- --wav speech.wav # feed a WAV through the path once
30
+ * bun run voice:interactive -- --no-audio # write out-<ts>.wav instead of playing
31
+ * bun run voice:interactive -- --no-mtp # disable MTP (loud warning per AGENTS.md)
32
+ * bun run voice:interactive -- --room my-room # set the conversation id
33
+ *
34
+ * Keyboard controls (interactive modes, raw mode):
35
+ * s force-stop the in-flight LLM/drafter + TTS for the current turn (barge-in hard-stop)
36
+ * m mute / unmute the mic
37
+ * p print the full latency histogram (p50/p90/p99)
38
+ * q clean shutdown (stop session, disarm voice, unload model, exit 0)
39
+ * Ctrl-C once = force-stop; twice = clean shutdown
40
+ *
41
+ * Latency trace lines printed after each turn:
42
+ * VAD→first-LLM-token=Xms vad-trigger → llm-first-token
43
+ * →first-replyText-char=Yms llm-first-token → llm-first-replytext-char
44
+ * →first-TTS-audio=Zms vad-trigger → tts-first-audio-chunk
45
+ * →audio-played=Wms vad-trigger → audio-first-played (the headline TTAP)
46
+ * mtp-accept=N% MTP drafter token-acceptance rate (from llama-server /metrics)
47
+ */
48
+
49
+ import { existsSync } from "node:fs";
50
+ import fs from "node:fs/promises";
51
+ import path from "node:path";
52
+ import process from "node:process";
53
+ import readline from "node:readline";
54
+
55
+ // ---------------------------------------------------------------------------
56
+ // CLI parsing
57
+ // ---------------------------------------------------------------------------
58
+
59
+ function parseArgs(argv) {
60
+ const out = {
61
+ listActive: false,
62
+ platformReport: false,
63
+ say: null,
64
+ wav: null,
65
+ noAudio: false,
66
+ noMtp: false,
67
+ room: "voice-interactive",
68
+ help: false,
69
+ };
70
+ for (let i = 0; i < argv.length; i += 1) {
71
+ const a = argv[i];
72
+ if (a === "--list-active") out.listActive = true;
73
+ else if (a === "--platform-report" || a === "--list-active-platforms")
74
+ out.platformReport = true;
75
+ else if (a === "--no-audio") out.noAudio = true;
76
+ else if (a === "--no-mtp") out.noMtp = true;
77
+ else if (a === "--say") out.say = argv[++i] ?? "";
78
+ else if (a === "--wav") out.wav = argv[++i] ?? "";
79
+ else if (a === "--room") out.room = argv[++i] ?? out.room;
80
+ else if (a === "--help" || a === "-h") out.help = true;
81
+ else {
82
+ console.error(`[voice-interactive] unknown argument: ${a}`);
83
+ out.help = true;
84
+ }
85
+ }
86
+ return out;
87
+ }
88
+
89
+ const USAGE = `Usage: bun run voice:interactive [-- <options>]
90
+
91
+ --list-active print which optimizations are active, then exit
92
+ --platform-report print the cross-platform voice support matrix, then exit
93
+ (runtime path / kernel coverage / mic+player / VAD
94
+ runtime / TTS+ASR backend per platform×GPU; verified vs
95
+ needs-hardware/needs-SDK)
96
+ --say "<text>" skip ASR; inject <text> as a finalized transcript (LLM→TTS half)
97
+ --wav <path> feed a WAV file through the same path once (non-mic smoke)
98
+ --no-audio don't play to speakers; write out-<ts>.wav instead
99
+ --no-mtp set ELIZA_MTP_DISABLE=1 (sanity compare; warns loudly)
100
+ --room <id> conversation/room id (default: voice-interactive)
101
+ -h, --help this help
102
+ `;
103
+
104
+ // ---------------------------------------------------------------------------
105
+ // Pretty printing
106
+ // ---------------------------------------------------------------------------
107
+
108
+ const C = {
109
+ reset: "\x1b[0m",
110
+ dim: "\x1b[2m",
111
+ bold: "\x1b[1m",
112
+ red: "\x1b[31m",
113
+ green: "\x1b[32m",
114
+ yellow: "\x1b[33m",
115
+ blue: "\x1b[34m",
116
+ cyan: "\x1b[36m",
117
+ };
118
+ const useColor = process.stdout.isTTY && !process.env.NO_COLOR;
119
+ function c(color, s) {
120
+ return useColor ? `${C[color]}${s}${C.reset}` : s;
121
+ }
122
+ function log(s) {
123
+ process.stdout.write(`${s}\n`);
124
+ }
125
+ function tag(t, color, msg) {
126
+ log(`${c(color, `[${t}]`)} ${msg}`);
127
+ }
128
+
129
+ // ---------------------------------------------------------------------------
130
+ // Active optimizations report
131
+ // ---------------------------------------------------------------------------
132
+
133
+ /**
134
+ * Inspect the runtime/env and report which voice optimizations are wired
135
+ * on. Returns `{ active: [{name, on, detail}], missing: [{what, fix}] }`.
136
+ * Pure inspection — never starts a model or a session.
137
+ */
138
+ async function inspectActiveOptimizations(args) {
139
+ const active = [];
140
+ const missing = [];
141
+
142
+ // ── Catalog entry for eliza-1-2b ─────────────────────────────────────
143
+ let catalogEntry = null;
144
+ let drafterEntry = null;
145
+ try {
146
+ const { findCatalogModel, FIRST_RUN_DEFAULT_MODEL_ID } = await import(
147
+ "../../shared/src/local-inference/catalog.ts"
148
+ );
149
+ // The duet harness passes `args.modelId` (e.g. `eliza-1-0_8b`); the
150
+ // interactive harness leaves it unset → the first-run default.
151
+ catalogEntry = findCatalogModel(
152
+ args?.modelId ?? FIRST_RUN_DEFAULT_MODEL_ID,
153
+ );
154
+ const drafterId = catalogEntry?.runtime?.mtp?.drafterModelId;
155
+ if (drafterId) drafterEntry = findCatalogModel(drafterId);
156
+ } catch (err) {
157
+ missing.push({
158
+ what: `resolve the eliza-1-2b catalog entry (${err instanceof Error ? err.message : String(err)})`,
159
+ fix: "ensure @elizaos/shared is built: bun run build (or turbo run build --filter=@elizaos/shared)",
160
+ });
161
+ }
162
+ if (catalogEntry) {
163
+ active.push({
164
+ name: "model",
165
+ on: true,
166
+ detail: `${catalogEntry.id} (preferredBackend=${catalogEntry.runtime?.preferredBackend ?? "?"}, bundleManifest=${catalogEntry.bundleManifestFile ?? "?"})`,
167
+ });
168
+ const kernels = catalogEntry.runtime?.optimizations?.requiresKernel ?? [];
169
+ active.push({
170
+ name: "kernels (TurboQuant / QJL / PolarQuant / MTP)",
171
+ on: kernels.length > 0,
172
+ detail: kernels.join(", ") || "(none declared)",
173
+ });
174
+ }
175
+
176
+ // ── Bundle installed? ──────────────────────────────────────────────────
177
+ let bundleRoot = null;
178
+ try {
179
+ const { elizaModelsDir } = await import(
180
+ "../../shared/src/local-inference/paths.ts"
181
+ );
182
+ const candidate = path.join(
183
+ elizaModelsDir(),
184
+ `${(catalogEntry?.id ?? "eliza-1-2b").replace(/[^a-zA-Z0-9._-]/g, "_")}.bundle`,
185
+ );
186
+ if (existsSync(candidate)) bundleRoot = candidate;
187
+ } catch {
188
+ /* reported via the catalog branch already */
189
+ }
190
+ if (bundleRoot) {
191
+ active.push({
192
+ name: "bundle",
193
+ on: true,
194
+ detail: `installed at ${bundleRoot}`,
195
+ });
196
+ } else {
197
+ missing.push({
198
+ what: `the ${catalogEntry?.id ?? "eliza-1-2b"} bundle is not installed`,
199
+ fix: "download it (run the harness without --list-active for the auto-download prompt) or follow docs/eliza-1-pipeline/06-test-matrix.md to acquire/convert/quantize the bundle, then place it under <state-dir>/local-inference/models/<id>.bundle/",
200
+ });
201
+ }
202
+
203
+ // ── Native MTP metadata ─────────────────────────────────────────────
204
+ if (args?.noMtp) {
205
+ active.push({
206
+ name: "mtp speculative decoding",
207
+ on: false,
208
+ detail:
209
+ "DISABLED by --no-mtp (ELIZA_MTP_DISABLE=1) — sanity-compare only, NOT a product setting (AGENTS.md §4)",
210
+ });
211
+ } else {
212
+ if (catalogEntry?.runtime?.mtp) {
213
+ active.push({
214
+ name: "mtp speculative decoding",
215
+ on: true,
216
+ detail: `native in-process MTP (${catalogEntry.runtime.mtp.specType}, draft ${catalogEntry.runtime.mtp.draftMin}-${catalogEntry.runtime.mtp.draftMax})`,
217
+ });
218
+ } else {
219
+ missing.push({
220
+ what: `${catalogEntry?.id ?? "eliza-1"} does not declare native MTP metadata`,
221
+ fix: "update packages/shared/src/local-inference/catalog.ts so every eliza-1 tier has runtime.mtp",
222
+ });
223
+ }
224
+ }
225
+
226
+ // ── TTS backend (fused libelizainference vs stub) ──────────────────────
227
+ // Probe the same locations the engine bridge's `locateBundleLibrary` does:
228
+ // explicit env paths, the bundle's `lib/`, and the managed fused-runtime
229
+ // dirs under `<state-dir>/local-inference/bin/mtp/<platform>-<arch>-<backend>-fused/`.
230
+ let ttsLibPath = null;
231
+ {
232
+ const os = await import("node:os");
233
+ const libNames =
234
+ process.platform === "darwin"
235
+ ? ["libelizainference.dylib"]
236
+ : process.platform === "win32"
237
+ ? ["elizainference.dll", "libelizainference.dll"]
238
+ : ["libelizainference.so"];
239
+ const explicit = process.env.ELIZA_INFERENCE_LIBRARY?.trim();
240
+ if (explicit && existsSync(explicit)) ttsLibPath = explicit;
241
+ if (!ttsLibPath) {
242
+ let liRoot = null;
243
+ try {
244
+ liRoot = (
245
+ await import("../../shared/src/local-inference/paths.ts")
246
+ ).localInferenceRoot();
247
+ } catch {
248
+ /* ignore */
249
+ }
250
+ const fusedTargets =
251
+ liRoot && process.env.ELIZA_INFERENCE_MANAGED_LOOKUP?.trim() !== "0"
252
+ ? ["metal", "vulkan", "cuda", "cpu"].map((b) =>
253
+ path.join(
254
+ liRoot,
255
+ "bin",
256
+ "mtp",
257
+ `${process.platform}-${os.arch()}-${b}-fused`,
258
+ ),
259
+ )
260
+ : [];
261
+ const libDirs = [
262
+ bundleRoot ? path.join(bundleRoot, "lib") : null,
263
+ process.env.ELIZA_INFERENCE_LIB_DIR?.trim() || null,
264
+ explicit ? path.dirname(explicit) : null,
265
+ ...fusedTargets,
266
+ ].filter(Boolean);
267
+ for (const dir of libDirs) {
268
+ for (const n of libNames) {
269
+ const cand = path.join(dir, n);
270
+ if (existsSync(cand)) {
271
+ ttsLibPath = cand;
272
+ break;
273
+ }
274
+ }
275
+ if (ttsLibPath) break;
276
+ }
277
+ }
278
+ }
279
+ const ttsBackend = ttsLibPath ? "fused" : "stub";
280
+ if (ttsBackend === "fused") {
281
+ active.push({
282
+ name: "streaming OmniVoice TTS",
283
+ on: true,
284
+ detail: `fused libelizainference at ${ttsLibPath} (OmniVoice TTS + Qwen3-ASR); streaming LLM→TTS via the voice scheduler. On macOS-Metal this is the full graph; on a CPU fused build it runs but slower.`,
285
+ });
286
+ } else {
287
+ missing.push({
288
+ what: "no real TTS backend — interactive voice needs the fused libelizainference build (the stub backend emits silence and is rejected)",
289
+ fix: "build it: see packages/app-core/scripts/omnivoice-merged/README.md (the fused build ships real OmniVoice TTS + Qwen3-ASR on macOS-Metal; stub elsewhere)",
290
+ });
291
+ active.push({
292
+ name: "streaming OmniVoice TTS",
293
+ on: false,
294
+ detail:
295
+ "no fused build — the stub backend emits silence and is rejected by startVoiceSession",
296
+ });
297
+ }
298
+
299
+ // ── ASR backend (fused Qwen3-ASR via libelizainference only) ───────────
300
+ let asrBackend = null;
301
+ if (bundleRoot && existsSync(path.join(bundleRoot, "asr"))) {
302
+ asrBackend = "fused (Qwen3-ASR region in the bundle)";
303
+ }
304
+ if (asrBackend) {
305
+ active.push({ name: "streaming ASR", on: true, detail: asrBackend });
306
+ } else {
307
+ missing.push({
308
+ what: "no ASR backend (no fused Qwen3-ASR region in the bundle)",
309
+ fix: "rebuild or download a libelizainference bundle that ships the Qwen3-ASR region (asr/ subdirectory).",
310
+ });
311
+ }
312
+
313
+ // ── Silero VAD model ───────────────────────────────────────────────────
314
+ let vadPath = null;
315
+ try {
316
+ const { resolveSileroVadPath } = await import(
317
+ "../../../plugins/plugin-local-inference/src/services/voice/vad.ts"
318
+ );
319
+ vadPath = resolveSileroVadPath({
320
+ modelPath: process.env.ELIZA_VAD_MODEL_PATH,
321
+ bundleRoot: bundleRoot ?? undefined,
322
+ });
323
+ } catch {
324
+ /* fall through */
325
+ }
326
+ if (vadPath) {
327
+ active.push({
328
+ name: "VAD (RMS gate + fused Silero v5)",
329
+ on: true,
330
+ detail: `Silero model at ${vadPath} (via the fused libelizainference VAD ABI); the cheap RMS energy gate runs in front of it`,
331
+ });
332
+ } else {
333
+ missing.push({
334
+ what: "no Silero VAD GGML model (vad/silero-vad-v5.1.2.ggml.bin not in the bundle, ELIZA_VAD_MODEL_PATH unset)",
335
+ fix: "stage the Silero v5 VAD GGML model into <state-dir>/local-inference/vad/silero-vad-v5.1.2.ggml.bin or set ELIZA_VAD_MODEL_PATH",
336
+ });
337
+ active.push({
338
+ name: "VAD (RMS gate + fused Silero v5)",
339
+ on: false,
340
+ detail: "Silero model not found",
341
+ });
342
+ }
343
+
344
+ // ── Mic ────────────────────────────────────────────────────────────────
345
+ const wantsMic = !args?.say && !args?.wav;
346
+ if (wantsMic) {
347
+ let recorderName = null;
348
+ try {
349
+ const { resolveDesktopRecorder } = await import(
350
+ "../../../plugins/plugin-local-inference/src/services/voice/mic-source.ts"
351
+ );
352
+ const rec = resolveDesktopRecorder(16_000);
353
+ recorderName = rec ? rec.program : null;
354
+ } catch {
355
+ /* ignore */
356
+ }
357
+ const recHint =
358
+ process.platform === "win32"
359
+ ? "Windows: ffmpeg -f dshow (DirectShow), or the renderer's getUserMedia → PushMicSource"
360
+ : process.platform === "darwin"
361
+ ? "macOS: sox -d (rec), or ffmpeg -f avfoundation"
362
+ : "Linux: arecord (alsa-utils) / parec (PulseAudio) / sox";
363
+ if (recorderName) {
364
+ active.push({
365
+ name: "mic input (DesktopMicSource)",
366
+ on: true,
367
+ detail: `using '${recorderName}' to capture mono 16 kHz PCM (${recHint})`,
368
+ });
369
+ } else {
370
+ missing.push({
371
+ what: `no CLI mic recorder on PATH for ${process.platform}`,
372
+ fix: `install one (${recHint}), or feed PCM via PushMicSource (the renderer's getUserMedia, or --wav / --say), or use the Capacitor Microphone plugin on mobile`,
373
+ });
374
+ active.push({
375
+ name: "mic input (DesktopMicSource)",
376
+ on: false,
377
+ detail: `no recorder found; ${recHint}`,
378
+ });
379
+ }
380
+ }
381
+
382
+ // ── Always-wired pipeline pieces (these are structural, not gated) ─────
383
+ active.push({
384
+ name: "forced-JSON-structure grammar (Stage-1 envelope)",
385
+ on: true,
386
+ detail:
387
+ "buildResponseGrammar — forced {shouldRespond, replyText, contexts, ...}; single-value enums → literals; the local engine constrains the envelope with GBNF so no tokens are spent on scaffold",
388
+ });
389
+ active.push({
390
+ name: "KV-prefix prewarm",
391
+ on: true,
392
+ detail:
393
+ "prewarmResponseHandler(runtime, roomId) — KV-prefill the response-handler stable prefix on speech-start; the turn controller also prewarms on speech-start",
394
+ });
395
+ active.push({
396
+ name: "speculative-on-pause turn controller",
397
+ on: true,
398
+ detail:
399
+ "VoiceTurnController — prewarm on speech-start, speculative generate on speech-pause >~300ms (off the partial transcript), abort on resume, promote-or-rerun on speech-end",
400
+ });
401
+ active.push({
402
+ name: "barge-in (pause / resume / hard-stop)",
403
+ on: true,
404
+ detail:
405
+ "BargeInController — speech-active → pause-tts (provisional); blip → resume-tts; ASR-confirmed words → hard-stop with an AbortSignal that propagates past TTS into the LLM/drafter",
406
+ });
407
+ active.push({
408
+ name: "phrase-cache prewarm",
409
+ on: true,
410
+ detail:
411
+ "prewarmIdleVoicePhrases() on idle + playFirstAudioFiller() on speech-start; phrase chunker flushes on , . ! ? / 30 words",
412
+ });
413
+ active.push({
414
+ name: "latency tracing",
415
+ on: true,
416
+ detail:
417
+ "voiceLatencyTracer — vad-trigger → audio-first-played checkpoints; derived TTFT/TTFA/TTAP; printed per-turn + as a histogram on 'p'",
418
+ });
419
+
420
+ return {
421
+ active,
422
+ missing,
423
+ catalogEntry,
424
+ drafterEntry,
425
+ bundleRoot,
426
+ ttsBackend,
427
+ asrBackend,
428
+ vadPath,
429
+ };
430
+ }
431
+
432
+ function printActive(report, _args) {
433
+ log("");
434
+ log(c("bold", "Eliza-1 interactive voice — active optimizations"));
435
+ log("");
436
+ for (const o of report.active) {
437
+ const mark = o.on ? c("green", "ON ") : c("red", "OFF");
438
+ log(` ${mark} ${c("cyan", o.name)}`);
439
+ if (o.detail) log(` ${c("dim", o.detail)}`);
440
+ }
441
+ log("");
442
+ if (report.missing.length > 0) {
443
+ log(
444
+ c(
445
+ "yellow",
446
+ `Missing prerequisites (${report.missing.length}) — fix each before a real interactive turn:`,
447
+ ),
448
+ );
449
+ log("");
450
+ for (const m of report.missing) {
451
+ log(` ${c("red", "•")} ${m.what}`);
452
+ log(` ${c("dim", `→ ${m.fix}`)}`);
453
+ }
454
+ log("");
455
+ } else {
456
+ log(
457
+ c(
458
+ "green",
459
+ "All prerequisites present — ready for an interactive voice turn.",
460
+ ),
461
+ );
462
+ log("");
463
+ }
464
+ }
465
+
466
+ // ---------------------------------------------------------------------------
467
+ // Cross-platform voice support matrix
468
+ // ---------------------------------------------------------------------------
469
+
470
+ /**
471
+ * The static cross-platform support matrix for the Eliza-1 voice pipeline:
472
+ * for each {platform × GPU backend}, what runtime path it uses
473
+ * (llama-server-spawn vs in-process FFI), what kernel coverage the build
474
+ * produces, what mic + player it shells, what VAD runtime, what TTS/ASR
475
+ * backend, and what is verified vs needs-hardware/needs-SDK.
476
+ *
477
+ * This is the durable description; the `verified` column reflects the
478
+ * current state recorded in `packages/inference/README.md` and
479
+ * `docs/eliza-1-pipeline/06-test-matrix.md`.
480
+ */
481
+ const PLATFORM_MATRIX = [
482
+ {
483
+ platform: "Linux x64",
484
+ backends: [
485
+ {
486
+ gpu: "cpu",
487
+ runtime: "llama-server (spawn)",
488
+ kernels:
489
+ "TurboQuant/QJL/Polar CPU SIMD TUs compiled in; turbo3_tcq decode CPU",
490
+ mic: "arecord / parec / sox",
491
+ player: "aplay / paplay / sox / ffplay",
492
+ vad: "fused libelizainference Silero v5",
493
+ ttsAsr: "fused libelizainference (CPU build)",
494
+ verified:
495
+ "CPU SIMD kernels reference-verified; build runs on this host",
496
+ },
497
+ {
498
+ gpu: "cuda",
499
+ runtime: "llama-server (spawn) — fork binary ships .cu/.cuh for all 5",
500
+ kernels: "mtp + turbo3/4/tcq + qjl + polar (CUDA, fork binary)",
501
+ mic: "arecord / parec / sox",
502
+ player: "aplay / paplay / sox / ffplay",
503
+ vad: "fused libelizainference Silero v5",
504
+ ttsAsr: "fused libelizainference (CUDA build)",
505
+ verified:
506
+ "CUDA kernels hardware-verified on RTX 5080; build needs nvcc (not present here)",
507
+ },
508
+ {
509
+ gpu: "rocm",
510
+ runtime: "llama-server (spawn)",
511
+ kernels:
512
+ "HIP build; custom kernels not yet HIP-ported → reduced-optimization local mode (stock f16 KV; ELIZA_LOCAL_ALLOW_STOCK_KV=1)",
513
+ mic: "arecord / parec / sox",
514
+ player: "aplay / paplay / sox / ffplay",
515
+ vad: "fused libelizainference Silero v5",
516
+ ttsAsr: "fused libelizainference (HIP build)",
517
+ verified: "needs ROCm host (hipcc); not built here",
518
+ },
519
+ {
520
+ gpu: "vulkan",
521
+ runtime: "llama-server (spawn)",
522
+ kernels:
523
+ "mtp + turbo3/4/tcq + qjl + polar shaders staged + dispatch source-patched (runtime-verified Intel ANV; needs-hardware elsewhere)",
524
+ mic: "arecord / parec / sox",
525
+ player: "aplay / paplay / sox / ffplay",
526
+ vad: "fused libelizainference Silero v5",
527
+ ttsAsr: "fused libelizainference (Vulkan build)",
528
+ verified:
529
+ "Vulkan shaders + fused-attn graph dispatch verified on Intel ARL ANV; build runs on this host",
530
+ },
531
+ ],
532
+ },
533
+ {
534
+ platform: "Linux aarch64",
535
+ backends: [
536
+ {
537
+ gpu: "cpu",
538
+ runtime: "llama-server (spawn)",
539
+ kernels:
540
+ "TurboQuant/QJL/Polar CPU SIMD TUs (ARMv8.4 dotprod path) compiled in",
541
+ mic: "arecord / parec / sox",
542
+ player: "aplay / paplay / sox / ffplay",
543
+ vad: "fused libelizainference Silero v5 (arm64)",
544
+ ttsAsr: "fused libelizainference (CPU build)",
545
+ verified: "needs an arm64 Linux host or cross-toolchain (not present)",
546
+ },
547
+ {
548
+ gpu: "cuda",
549
+ runtime: "llama-server (spawn) — GH200 (aarch64 + Hopper)",
550
+ kernels: "mtp + turbo3/4/tcq + qjl + polar (CUDA, fork binary)",
551
+ mic: "arecord / parec / sox",
552
+ player: "aplay / paplay / sox / ffplay",
553
+ vad: "fused libelizainference Silero v5 (arm64)",
554
+ ttsAsr: "fused libelizainference (CUDA build)",
555
+ verified:
556
+ "needs aarch64+CUDA host (GH200/Grace-Hopper); not built here",
557
+ },
558
+ ],
559
+ },
560
+ {
561
+ platform: "Windows x64",
562
+ backends: [
563
+ {
564
+ gpu: "cpu",
565
+ runtime:
566
+ "llama-server (spawn) — QJL TUs folded into ggml-base for the DLL link",
567
+ kernels: "TurboQuant/QJL/Polar CPU SIMD TUs compiled in",
568
+ mic: "ffmpeg -f dshow (DirectShow) — or renderer getUserMedia → PushMicSource",
569
+ player: "ffplay (ffmpeg) — or renderer AudioContext",
570
+ vad: "fused libelizainference Silero v5",
571
+ ttsAsr: "fused libelizainference (CPU build)",
572
+ verified:
573
+ "build needs MSVC/mingw (cross from this Linux host: --dry-run only)",
574
+ },
575
+ {
576
+ gpu: "cuda",
577
+ runtime: "llama-server (spawn)",
578
+ kernels: "mtp + turbo3/4/tcq + qjl + polar (CUDA, fork binary)",
579
+ mic: "ffmpeg -f dshow — or renderer getUserMedia",
580
+ player: "ffplay — or renderer AudioContext",
581
+ vad: "fused libelizainference Silero v5",
582
+ ttsAsr: "fused libelizainference (CUDA build)",
583
+ verified: "needs Windows + CUDA SDK; not built here",
584
+ },
585
+ {
586
+ gpu: "vulkan",
587
+ runtime: "llama-server (spawn)",
588
+ kernels:
589
+ "mtp + turbo3/4/tcq + qjl + polar shaders + dispatch source-patched (needs-hardware)",
590
+ mic: "ffmpeg -f dshow — or renderer getUserMedia",
591
+ player: "ffplay — or renderer AudioContext",
592
+ vad: "fused libelizainference Silero v5",
593
+ ttsAsr: "fused libelizainference (Vulkan build)",
594
+ verified:
595
+ "needs Windows + a Vulkan 1.3 GPU; build cross-config --dry-run only here",
596
+ },
597
+ ],
598
+ },
599
+ {
600
+ platform: "Windows arm64",
601
+ backends: [
602
+ {
603
+ gpu: "cpu",
604
+ runtime: "llama-server (spawn) — Snapdragon X / Copilot+ PC",
605
+ kernels: "TurboQuant/QJL/Polar CPU SIMD TUs (NEON path) compiled in",
606
+ mic: "ffmpeg -f dshow — or renderer getUserMedia → PushMicSource",
607
+ player: "ffplay — or renderer AudioContext",
608
+ vad: "fused libelizainference Silero v5 (arm64)",
609
+ ttsAsr: "fused libelizainference (CPU build)",
610
+ verified:
611
+ "needs an MSVC arm64 cross-toolchain or a native Windows arm64 host",
612
+ },
613
+ {
614
+ gpu: "vulkan",
615
+ runtime: "llama-server (spawn) — Adreno X1 (Vulkan 1.3)",
616
+ kernels:
617
+ "mtp + turbo3/4/tcq + qjl + polar shaders + dispatch source-patched (needs-hardware)",
618
+ mic: "ffmpeg -f dshow — or renderer getUserMedia",
619
+ player: "ffplay — or renderer AudioContext",
620
+ vad: "fused libelizainference Silero v5 (arm64)",
621
+ ttsAsr: "fused libelizainference (Vulkan build)",
622
+ verified: "needs Windows arm64 + Adreno; not built here",
623
+ },
624
+ ],
625
+ },
626
+ {
627
+ platform: "macOS arm64",
628
+ backends: [
629
+ {
630
+ gpu: "metal",
631
+ runtime:
632
+ "llama-server (spawn) — fused build serves /v1/audio/speech in-process",
633
+ kernels:
634
+ "mtp + turbo3/4/tcq + qjl + polar — all 5 graph-dispatched on Apple Silicon",
635
+ mic: "sox -d (rec) — or ffmpeg -f avfoundation — or renderer getUserMedia",
636
+ player:
637
+ "sox/play — or ffplay — (afplay needs a file, not used) — or renderer AudioContext",
638
+ vad: "fused libelizainference Silero v5 (arm64)",
639
+ ttsAsr:
640
+ "fused libelizainference.dylib (real OmniVoice TTS + Qwen3-ASR, full graph)",
641
+ verified:
642
+ "Metal kernels hardware-verified on M4 Max; needs a macOS arm64 host to build",
643
+ },
644
+ ],
645
+ },
646
+ {
647
+ platform: "iOS arm64",
648
+ backends: [
649
+ {
650
+ gpu: "metal",
651
+ runtime:
652
+ "in-process FFI (@elizaos/llama-cpp-capacitor LlamaCpp.xcframework + @elizaos/plugin-aosp-local-inference aosp-llama/mtp adapters) — NOT llama-server-spawn",
653
+ kernels:
654
+ "static .a + embedded default.metallib carry the 5 eliza kernel symbols; runtime graph dispatch on-device same as macOS Metal once the xcframework is rebuilt with them",
655
+ mic: "Capacitor Microphone plugin → PushMicSource (no CLI recorder on iOS)",
656
+ player:
657
+ "Capacitor audio sink → PcmRingBuffer → native AudioQueue/AVAudioEngine",
658
+ vad: "fused libelizainference Silero v5 (iOS)",
659
+ ttsAsr:
660
+ "fused libelizainference (ios-arm64-metal-fused — to add) carried inside the xcframework, or the Capacitor framework links omnivoice symbols",
661
+ verified:
662
+ "needs an Xcode build (macOS + Xcode): packages/app-core/scripts/ios-xcframework/build-xcframework.mjs + a physical-device smoke",
663
+ },
664
+ ],
665
+ },
666
+ {
667
+ platform: "Android arm64",
668
+ backends: [
669
+ {
670
+ gpu: "cpu",
671
+ runtime:
672
+ "in-process FFI (@elizaos/plugin-aosp-local-inference compile-libllama.mjs → libllama .so + aosp-llama/mtp adapters) — NOT llama-server-spawn",
673
+ kernels:
674
+ "TurboQuant/QJL/Polar CPU SIMD TUs (NEON path) compiled into the .so",
675
+ mic: "Capacitor Microphone plugin → PushMicSource",
676
+ player: "Capacitor audio sink → PcmRingBuffer → native AudioTrack",
677
+ vad: "fused libelizainference Silero v5 (Android)",
678
+ ttsAsr:
679
+ "fused libelizainference (android-arm64-cpu-fused — to add) inside the AAR",
680
+ verified:
681
+ "needs an Android Studio / NDK build (compile-libllama.mjs cross-compiles)",
682
+ },
683
+ {
684
+ gpu: "vulkan",
685
+ runtime:
686
+ "in-process FFI (libllama .so, Vulkan backend) — NOT llama-server-spawn",
687
+ kernels:
688
+ "mtp + turbo3/4/tcq + qjl + polar shaders + dispatch source-patched (needs-hardware: needs a physical Android Vulkan device)",
689
+ mic: "Capacitor Microphone plugin → PushMicSource",
690
+ player: "Capacitor audio sink → PcmRingBuffer → native AudioTrack",
691
+ vad: "fused libelizainference Silero v5 (Android)",
692
+ ttsAsr:
693
+ "fused libelizainference (android-arm64-vulkan-fused — to add) inside the AAR",
694
+ verified:
695
+ "needs Android NDK + a Vulkan-1.3 Android device for the dispatch smoke",
696
+ },
697
+ ],
698
+ },
699
+ ];
700
+
701
+ /** Inspect what the *host* would actually use, for the local row callout. */
702
+ async function inspectHostPeripherals() {
703
+ const out = { recorder: null, player: null };
704
+ try {
705
+ const { resolveDesktopRecorder } = await import(
706
+ "../../../plugins/plugin-local-inference/src/services/voice/mic-source.ts"
707
+ );
708
+ const rec = resolveDesktopRecorder(16_000);
709
+ out.recorder = rec ? rec.program : null;
710
+ } catch {
711
+ /* ignore */
712
+ }
713
+ try {
714
+ const { resolveSystemPlayerName } = await import(
715
+ "../../../plugins/plugin-local-inference/src/services/voice/system-audio-sink.ts"
716
+ );
717
+ out.player = resolveSystemPlayerName(24_000);
718
+ } catch {
719
+ /* ignore */
720
+ }
721
+ return out;
722
+ }
723
+
724
+ async function printPlatformReport() {
725
+ log("");
726
+ log(c("bold", "Eliza-1 voice — cross-platform support matrix"));
727
+ log(
728
+ c(
729
+ "dim",
730
+ "mic → VAD → ASR → forced-grammar LLM (MTP) → streaming TTS → audio out",
731
+ ),
732
+ );
733
+ log("");
734
+ for (const row of PLATFORM_MATRIX) {
735
+ log(c("cyan", `## ${row.platform}`));
736
+ for (const b of row.backends) {
737
+ log(` ${c("bold", b.gpu.toUpperCase())}`);
738
+ log(` runtime path : ${b.runtime}`);
739
+ log(` kernels : ${b.kernels}`);
740
+ log(` mic : ${b.mic}`);
741
+ log(` player : ${b.player}`);
742
+ log(` VAD runtime : ${b.vad}`);
743
+ log(` TTS/ASR : ${b.ttsAsr}`);
744
+ log(` status : ${c("dim", b.verified)}`);
745
+ }
746
+ log("");
747
+ }
748
+ const host = await inspectHostPeripherals();
749
+ log(
750
+ c(
751
+ "bold",
752
+ `Host (${process.platform}-${process.arch}) — what this machine would use:`,
753
+ ),
754
+ );
755
+ log(
756
+ ` mic recorder : ${host.recorder ?? c("yellow", "(none on PATH — use PushMicSource / a connector)")}`,
757
+ );
758
+ log(
759
+ ` audio player : ${host.player ?? c("yellow", "(none on PATH — falls back to WavFileAudioSink)")}`,
760
+ );
761
+ log(
762
+ ` VAD : ${c("dim", "fused Silero v5 (via the libelizainference VAD ABI; no separate library)")}`,
763
+ );
764
+ log("");
765
+ log(
766
+ c(
767
+ "dim",
768
+ "Kernel coverage rule (AGENTS.md §3 vs the works-everywhere directive): the build dispatches\n" +
769
+ " the kernels on every backend where it can (Metal: all 5; CUDA: fork binary; Vulkan: source-\n" +
770
+ " patched; CPU: SIMD TUs); where it can't yet (ROCm/HIP), set ELIZA_LOCAL_ALLOW_STOCK_KV=1 to\n" +
771
+ " run with stock f16 KV (reduced-optimization local mode — loud warning, NOT publishable, NOT a\n" +
772
+ " default). defaultEligible bundles still require the verified kernels per backend.",
773
+ ),
774
+ );
775
+ log("");
776
+ }
777
+
778
+ // ---------------------------------------------------------------------------
779
+ // Auto-download helpers (gated; never faked)
780
+ // ---------------------------------------------------------------------------
781
+
782
+ async function tryAutoDownloadVad(_bundleRoot) {
783
+ // Silero v5 VAD GGUF (MIT, public).
784
+ try {
785
+ const { localInferenceRoot } = await import(
786
+ "../../shared/src/local-inference/paths.ts"
787
+ );
788
+ const dest = path.join(localInferenceRoot(), "vad", "silero-vad-v5.gguf");
789
+ if (existsSync(dest)) return dest;
790
+ const url =
791
+ process.env.ELIZA_SILERO_VAD_URL?.trim() ||
792
+ "https://huggingface.co/elizaos/eliza-1/resolve/main/voice/vad/silero-vad-v5.1.2.ggml.bin?download=true";
793
+ tag("setup", "blue", `downloading Silero VAD GGUF → ${dest}`);
794
+ const res = await fetch(url);
795
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
796
+ const buf = Buffer.from(await res.arrayBuffer());
797
+ await fs.mkdir(path.dirname(dest), { recursive: true });
798
+ await fs.writeFile(dest, buf);
799
+ return dest;
800
+ } catch (err) {
801
+ tag(
802
+ "setup",
803
+ "yellow",
804
+ `Silero VAD auto-download failed: ${err instanceof Error ? err.message : String(err)}`,
805
+ );
806
+ return null;
807
+ }
808
+ }
809
+
810
+ async function tryAutoDownloadBundle(catalogEntry) {
811
+ if (!catalogEntry) return null;
812
+ try {
813
+ const { Downloader } = await import(
814
+ "../../../plugins/plugin-local-inference/src/services/downloader.ts"
815
+ );
816
+ const { elizaModelsDir } = await import(
817
+ "../../shared/src/local-inference/paths.ts"
818
+ );
819
+ const dest = path.join(
820
+ elizaModelsDir(),
821
+ `${catalogEntry.id.replace(/[^a-zA-Z0-9._-]/g, "_")}.bundle`,
822
+ );
823
+ tag(
824
+ "setup",
825
+ "blue",
826
+ `downloading the ${catalogEntry.id} bundle (this is large — multiple GB)… → ${dest}`,
827
+ );
828
+ const dl = new Downloader();
829
+ await new Promise((resolve, reject) => {
830
+ const unsub = dl.subscribe((job) => {
831
+ if (job.modelId !== catalogEntry.id) return;
832
+ if (job.state === "completed") {
833
+ unsub();
834
+ resolve();
835
+ } else if (job.state === "failed" || job.state === "cancelled") {
836
+ unsub();
837
+ reject(new Error(`download ${job.state}`));
838
+ }
839
+ });
840
+ dl.start(catalogEntry.id).catch((e) => {
841
+ unsub();
842
+ reject(e);
843
+ });
844
+ });
845
+ return existsSync(dest) ? dest : null;
846
+ } catch (err) {
847
+ tag(
848
+ "setup",
849
+ "yellow",
850
+ `bundle auto-download failed: ${err instanceof Error ? err.message : String(err)} — follow docs/eliza-1-pipeline/06-test-matrix.md to acquire it manually`,
851
+ );
852
+ return null;
853
+ }
854
+ }
855
+
856
+ // ---------------------------------------------------------------------------
857
+ // System audio sink: shell aplay / afplay / paplay (or write a rolling WAV)
858
+ // ---------------------------------------------------------------------------
859
+
860
+ async function makeAudioSink(opts) {
861
+ const { sampleRate, noAudio } = opts;
862
+ const { SystemAudioSink, WavFileAudioSink } = await import(
863
+ "../../../plugins/plugin-local-inference/src/services/voice/system-audio-sink.ts"
864
+ );
865
+ if (noAudio) {
866
+ const out = path.resolve(process.cwd(), `out-${Date.now()}.wav`);
867
+ const sink = new WavFileAudioSink({ sampleRate, filePath: out });
868
+ return {
869
+ sink,
870
+ describe: () => `WAV file: ${out}`,
871
+ finalize: () => sink.finalize(),
872
+ };
873
+ }
874
+ const sink = new SystemAudioSink({ sampleRate });
875
+ if (!sink.available()) {
876
+ const out = path.resolve(process.cwd(), `out-${Date.now()}.wav`);
877
+ tag(
878
+ "audio",
879
+ "yellow",
880
+ `no playback device (aplay/afplay/paplay not on PATH) — falling back to a WAV file: ${out}`,
881
+ );
882
+ const wsink = new WavFileAudioSink({ sampleRate, filePath: out });
883
+ return {
884
+ sink: wsink,
885
+ describe: () => `WAV file: ${out}`,
886
+ finalize: () => wsink.finalize(),
887
+ };
888
+ }
889
+ return {
890
+ sink,
891
+ describe: () => `system playback (${sink.player()})`,
892
+ finalize: async () => sink.dispose(),
893
+ };
894
+ }
895
+
896
+ // ---------------------------------------------------------------------------
897
+ // Bundle registration
898
+ // ---------------------------------------------------------------------------
899
+
900
+ /**
901
+ * Ensure the eliza-1-2b bundle on disk is registered in the local-inference
902
+ * registry (so `listInstalledModels()` returns it and the engine can activate
903
+ * it). A bundle downloaded via the dashboard registers itself; a bundle that
904
+ * was staged/copied onto disk manually may not
905
+ * be — this re-registers it from the manifest. No-op when already registered
906
+ * or when the bundle isn't on disk. Returns the registered `InstalledModel`
907
+ * (text GGUF) or null.
908
+ */
909
+ async function ensureBundleRegistered(catalogEntry, bundleRoot) {
910
+ if (!catalogEntry || !bundleRoot || !existsSync(bundleRoot)) return null;
911
+ const { listInstalledModels } = await import(
912
+ "../../../plugins/plugin-local-inference/src/services/registry.ts"
913
+ );
914
+ const installed = await listInstalledModels();
915
+ const already = installed.find((m) => m.id === catalogEntry.id);
916
+ if (already?.path && existsSync(already.path)) return already;
917
+
918
+ const { upsertElizaModel } = await import(
919
+ "../../../plugins/plugin-local-inference/src/services/registry.ts"
920
+ );
921
+ const manifestPath = path.join(
922
+ bundleRoot,
923
+ catalogEntry.bundleManifestFile ?? "eliza-1.manifest.json",
924
+ );
925
+ const textGguf = path.join(bundleRoot, catalogEntry.ggufFile);
926
+ if (!existsSync(textGguf)) {
927
+ throw new Error(
928
+ `bundle at ${bundleRoot} is missing the primary text GGUF ${catalogEntry.ggufFile}`,
929
+ );
930
+ }
931
+ const stat = await fs.stat(textGguf);
932
+ const now = new Date().toISOString();
933
+ const bundleMeta = {
934
+ bundleRoot,
935
+ ...(existsSync(manifestPath) ? { manifestPath } : {}),
936
+ // Mark verified so the auto-assign path is allowed to fill TEXT_SMALL.
937
+ bundleVerifiedAt: now,
938
+ };
939
+ const model = {
940
+ id: catalogEntry.id,
941
+ displayName: catalogEntry.displayName ?? catalogEntry.id,
942
+ path: textGguf,
943
+ sizeBytes: stat.size,
944
+ hfRepo: catalogEntry.hfRepo,
945
+ installedAt: now,
946
+ lastUsedAt: null,
947
+ source: "eliza-download",
948
+ sha256: null,
949
+ lastVerifiedAt: now,
950
+ ...bundleMeta,
951
+ };
952
+ await upsertElizaModel(model);
953
+ tag(
954
+ "setup",
955
+ "blue",
956
+ `registered ${catalogEntry.id} bundle in the local-inference registry (text=${textGguf})`,
957
+ );
958
+
959
+ // Register the MTP drafter companion too (so the engine wires -md).
960
+ const companionId =
961
+ catalogEntry.runtime?.mtp?.drafterModelId ??
962
+ catalogEntry.companionModelIds?.[0];
963
+ if (companionId) {
964
+ const { findCatalogModel } = await import(
965
+ "../../shared/src/local-inference/catalog.ts"
966
+ );
967
+ const companion = findCatalogModel(companionId);
968
+ if (companion) {
969
+ const drafterGguf = path.join(bundleRoot, companion.ggufFile);
970
+ if (existsSync(drafterGguf)) {
971
+ const dstat = await fs.stat(drafterGguf);
972
+ await upsertElizaModel({
973
+ id: companion.id,
974
+ displayName: companion.displayName ?? companion.id,
975
+ path: drafterGguf,
976
+ sizeBytes: dstat.size,
977
+ hfRepo: companion.hfRepo,
978
+ installedAt: now,
979
+ lastUsedAt: null,
980
+ source: "eliza-download",
981
+ sha256: null,
982
+ lastVerifiedAt: now,
983
+ runtimeRole: "mtp-drafter",
984
+ companionFor: catalogEntry.id,
985
+ ...bundleMeta,
986
+ });
987
+ tag(
988
+ "setup",
989
+ "blue",
990
+ `registered ${companion.id} (MTP drafter) at ${drafterGguf}`,
991
+ );
992
+ }
993
+ }
994
+ }
995
+ return model;
996
+ }
997
+
998
+ // ---------------------------------------------------------------------------
999
+ // Standalone runtime bootstrap
1000
+ // ---------------------------------------------------------------------------
1001
+
1002
+ /**
1003
+ * Boot a minimal standalone AgentRuntime with the local-inference handler
1004
+ * registered and `eliza-1-2b` assigned to TEXT_SMALL. Returns
1005
+ * `{ runtime, generate }` where `generate` runs one transcript through the
1006
+ * runtime's message handler and streams `replyText` chunks via `onChunk`.
1007
+ *
1008
+ * Throws if the runtime can't be constructed (missing deps) — the caller
1009
+ * surfaces that as a prereq failure, not a crash.
1010
+ */
1011
+ async function bootStandaloneRuntime({ roomId }) {
1012
+ // The runtime needs plugin-sql (storage) + the local-inference model handler.
1013
+ // Core wires DefaultMessageService during initialize(). Fail loudly if a
1014
+ // piece is missing rather than half-booting.
1015
+ const { AgentRuntime, ModelType } = await import("@elizaos/core");
1016
+ let sqlPlugin;
1017
+ try {
1018
+ sqlPlugin =
1019
+ (await import("@elizaos/plugin-sql")).default ??
1020
+ (await import("@elizaos/plugin-sql")).sqlPlugin;
1021
+ } catch (err) {
1022
+ throw new Error(
1023
+ `@elizaos/plugin-sql not available: ${err instanceof Error ? err.message : String(err)}`,
1024
+ );
1025
+ }
1026
+
1027
+ // In-memory DB; assign the eliza-1-2b model to TEXT_SMALL.
1028
+ process.env.PGLITE_DATA_DIR = process.env.PGLITE_DATA_DIR || "memory://";
1029
+
1030
+ const runtime = new AgentRuntime({
1031
+ character: {
1032
+ name: "Eliza",
1033
+ bio: [
1034
+ "A local-first AI assistant running the eliza-1-2b model with the full optimized voice stack.",
1035
+ ],
1036
+ messageExamples: [],
1037
+ adjectives: [],
1038
+ plugins: [],
1039
+ settings: { secrets: {} },
1040
+ },
1041
+ plugins: [sqlPlugin],
1042
+ });
1043
+ await runtime.initialize();
1044
+
1045
+ // Register the local-inference model handlers (TEXT_SMALL / TEXT_LARGE /
1046
+ // TRANSCRIPTION / TEXT_TO_SPEECH) + prewarmResponseHandler / prewarmSystemPrefix.
1047
+ const { ensureLocalInferenceHandler, prewarmResponseHandler } = await import(
1048
+ "../../../plugins/plugin-local-inference/src/runtime/ensure-local-inference-handler.ts"
1049
+ );
1050
+ await ensureLocalInferenceHandler(runtime);
1051
+
1052
+ // Ensure the eliza-1-2b model is assigned to TEXT_SMALL (the eliza-1
1053
+ // tiers route through the mtp llama-server). Best-effort: if no model
1054
+ // is installed this throws downstream and the caller reports it.
1055
+ try {
1056
+ const { setAssignment, readAssignments } = await import(
1057
+ "../../../plugins/plugin-local-inference/src/services/assignments.ts"
1058
+ );
1059
+ if (typeof setAssignment === "function") {
1060
+ await setAssignment("TEXT_SMALL", "eliza-1-2b");
1061
+ } else if (typeof readAssignments === "function") {
1062
+ // older API — skip; ensure-local-inference-handler auto-assigns
1063
+ }
1064
+ } catch {
1065
+ /* the handler may auto-assign; reported later if generation fails */
1066
+ }
1067
+
1068
+ // The `generate` callback for the voice turn controller.
1069
+ const generate = async (request, onChunk) => {
1070
+ if (!runtime.messageService?.handleMessage) {
1071
+ throw new Error(
1072
+ "[voice] runtime.messageService.handleMessage is unavailable after initialize()",
1073
+ );
1074
+ }
1075
+ const entityId = `${roomId}-user`;
1076
+ const incoming = {
1077
+ id: `${roomId}-${Date.now()}`,
1078
+ content: {
1079
+ text: request.transcript,
1080
+ source: "voice-interactive",
1081
+ channelType: "VOICE_DM",
1082
+ ...(request.turnSignal
1083
+ ? {
1084
+ voiceTurnSignal: {
1085
+ endOfTurnProbability: request.turnSignal.endOfTurnProbability,
1086
+ nextSpeaker: request.turnSignal.nextSpeaker,
1087
+ agentShouldSpeak: request.turnSignal.agentShouldSpeak,
1088
+ source: request.turnSignal.source,
1089
+ model: request.turnSignal.model,
1090
+ latencyMs: request.turnSignal.latencyMs,
1091
+ },
1092
+ }
1093
+ : {}),
1094
+ },
1095
+ entityId,
1096
+ agentId: runtime.agentId,
1097
+ roomId,
1098
+ createdAt: Date.now(),
1099
+ };
1100
+ let replyText = "";
1101
+ const callback = async (content) => {
1102
+ const text = typeof content?.text === "string" ? content.text : "";
1103
+ if (text.trim().length > 0) {
1104
+ // Stream the delta into TTS.
1105
+ const delta = text.startsWith(replyText)
1106
+ ? text.slice(replyText.length)
1107
+ : text;
1108
+ replyText = text.length >= replyText.length ? text : replyText;
1109
+ if (delta.length > 0) await onChunk?.(delta);
1110
+ }
1111
+ return [];
1112
+ };
1113
+ // The message service streams `replyText` field-by-field via the
1114
+ // local engine's `onStreamChunk` → `onTextChunk` → voice scheduler when
1115
+ // voice is armed; the callback above mirrors the final text for the UI.
1116
+ const result = await runtime.messageService.handleMessage(
1117
+ runtime,
1118
+ incoming,
1119
+ callback,
1120
+ );
1121
+ const finalText =
1122
+ typeof result?.responseContent?.text === "string" &&
1123
+ result.responseContent.text.trim().length > 0
1124
+ ? result.responseContent.text
1125
+ : replyText;
1126
+ return {
1127
+ transcript: request.transcript,
1128
+ replyText: finalText,
1129
+ ...(request.source ? { source: request.source } : {}),
1130
+ ...(request.speaker ? { speaker: request.speaker } : {}),
1131
+ ...(request.segments ? { segments: request.segments } : {}),
1132
+ ...(request.turn ? { turn: request.turn } : {}),
1133
+ };
1134
+ };
1135
+
1136
+ return { runtime, generate, prewarmResponseHandler };
1137
+ }
1138
+
1139
+ // ---------------------------------------------------------------------------
1140
+ // MTP acceptance-rate readout
1141
+ // ---------------------------------------------------------------------------
1142
+
1143
+ async function readMtpAcceptance() {
1144
+ return null;
1145
+ }
1146
+
1147
+ // ---------------------------------------------------------------------------
1148
+ // Latency trace formatting
1149
+ // ---------------------------------------------------------------------------
1150
+
1151
+ function fmtMs(v) {
1152
+ return v == null ? "—" : `${Math.round(v)}ms`;
1153
+ }
1154
+
1155
+ async function printTurnLatency(_roomId) {
1156
+ try {
1157
+ const { voiceLatencyTracer } = await import(
1158
+ "../../../plugins/plugin-local-inference/src/services/latency-trace.ts"
1159
+ );
1160
+ const traces = voiceLatencyTracer.recentTraces(1);
1161
+ const t = traces[traces.length - 1];
1162
+ if (!t) return;
1163
+ const d = t.derived ?? {};
1164
+ const accept = await readMtpAcceptance();
1165
+ log(
1166
+ c(
1167
+ "dim",
1168
+ ` trace: VAD→first-LLM-token=${fmtMs(d.ttftMs)} →first-replyText-char=${fmtMs(d.envelopeToReplyTextMs)} →first-TTS-audio=${fmtMs(d.ttfaMs)} →audio-played=${fmtMs(d.ttapMs)} mtp-accept=${accept == null ? "—" : `${Math.round(accept * 100)}%`}`,
1169
+ ),
1170
+ );
1171
+ } catch {
1172
+ /* tracer unavailable — skip */
1173
+ }
1174
+ }
1175
+
1176
+ async function printLatencyHistogram() {
1177
+ try {
1178
+ const { voiceLatencyTracer } = await import(
1179
+ "../../../plugins/plugin-local-inference/src/services/latency-trace.ts"
1180
+ );
1181
+ const summaries =
1182
+ typeof voiceLatencyTracer.histogramSummaries === "function"
1183
+ ? voiceLatencyTracer.histogramSummaries()
1184
+ : null;
1185
+ if (!summaries) {
1186
+ log(c("yellow", " (no latency histogram available)"));
1187
+ return;
1188
+ }
1189
+ log("");
1190
+ log(c("bold", " Voice latency histogram (p50 / p90 / p99, ms)"));
1191
+ for (const [key, s] of Object.entries(summaries)) {
1192
+ if (!s || s.count === 0) continue;
1193
+ log(
1194
+ ` ${c("cyan", key.padEnd(28))} n=${String(s.count).padEnd(4)} p50=${fmtMs(s.p50)} p90=${fmtMs(s.p90)} p99=${fmtMs(s.p99)}`,
1195
+ );
1196
+ }
1197
+ log("");
1198
+ } catch (err) {
1199
+ log(
1200
+ c(
1201
+ "yellow",
1202
+ ` (histogram unavailable: ${err instanceof Error ? err.message : String(err)})`,
1203
+ ),
1204
+ );
1205
+ }
1206
+ }
1207
+
1208
+ // ---------------------------------------------------------------------------
1209
+ // Main
1210
+ // ---------------------------------------------------------------------------
1211
+
1212
+ async function main() {
1213
+ const args = parseArgs(process.argv.slice(2));
1214
+ if (args.help) {
1215
+ log(USAGE);
1216
+ process.exit(0);
1217
+ }
1218
+
1219
+ // Cross-platform support matrix — pure inspection, never starts a model
1220
+ // or a session. Always exits 0 (it's a status report).
1221
+ if (args.platformReport) {
1222
+ await printPlatformReport();
1223
+ process.exit(0);
1224
+ }
1225
+
1226
+ // AGENTS.md §4: disabling MTP is a developer-only kill switch and must
1227
+ // warn loudly on every generation. Set it up-front so the engine sees it.
1228
+ if (args.noMtp) {
1229
+ process.env.ELIZA_MTP_DISABLE = "1";
1230
+ log(
1231
+ c(
1232
+ "red",
1233
+ "⚠ --no-mtp: ELIZA_MTP_DISABLE=1 is set. MTP speculative decoding is OFF. This is a DEVELOPER-ONLY kill switch, NOT a product setting — the eliza-1 path is designed to run with MTP always on (packages/inference/AGENTS.md §4). Voice latency will be worse. Unset ELIZA_MTP_DISABLE to restore the contract.",
1234
+ ),
1235
+ );
1236
+ }
1237
+
1238
+ // ── Preflight ──────────────────────────────────────────────────────────
1239
+ let report = await inspectActiveOptimizations(args);
1240
+
1241
+ if (args.listActive) {
1242
+ printActive(report, args);
1243
+ process.exit(0);
1244
+ }
1245
+
1246
+ // Auto-download cheap prereqs (VAD GGUF). These never fake — a failed
1247
+ // download is a missing prereq, not silence.
1248
+ if (!report.vadPath) {
1249
+ const vp = await tryAutoDownloadVad(report.bundleRoot);
1250
+ if (vp) process.env.ELIZA_SILERO_VAD_GGUF = vp;
1251
+ }
1252
+ // ASR is delivered exclusively through the fused libelizainference bundle.
1253
+ // The bundle is large — only auto-download if explicitly requested via env.
1254
+ if (!report.bundleRoot && process.env.ELIZA_AUTO_DOWNLOAD_BUNDLE === "1") {
1255
+ const br = await tryAutoDownloadBundle(report.catalogEntry);
1256
+ if (br) report.bundleRoot = br;
1257
+ }
1258
+
1259
+ // Re-inspect after any auto-download.
1260
+ report = await inspectActiveOptimizations(args);
1261
+ printActive(report, args);
1262
+
1263
+ if (report.missing.length > 0) {
1264
+ log(
1265
+ c(
1266
+ "red",
1267
+ "Cannot start an interactive voice turn — the prerequisites above are not satisfied.",
1268
+ ),
1269
+ );
1270
+ log(
1271
+ c(
1272
+ "dim",
1273
+ "Set ELIZA_AUTO_DOWNLOAD_BUNDLE=1 to auto-download the (large) eliza-1-2b bundle, or follow docs/eliza-1-pipeline/06-test-matrix.md.",
1274
+ ),
1275
+ );
1276
+ process.exit(1);
1277
+ }
1278
+
1279
+ // ── Register the bundle in the local-inference registry (if not already) ─
1280
+ try {
1281
+ await ensureBundleRegistered(report.catalogEntry, report.bundleRoot);
1282
+ } catch (err) {
1283
+ log(
1284
+ c(
1285
+ "red",
1286
+ `Failed to register the eliza-1-2b bundle: ${err instanceof Error ? err.message : String(err)}`,
1287
+ ),
1288
+ );
1289
+ process.exit(1);
1290
+ }
1291
+
1292
+ // ── Boot runtime ───────────────────────────────────────────────────────
1293
+ tag(
1294
+ "boot",
1295
+ "blue",
1296
+ "starting standalone AgentRuntime (in-memory, eliza-1-2b → TEXT_SMALL)…",
1297
+ );
1298
+ let runtime;
1299
+ let generate;
1300
+ let prewarmResponseHandler;
1301
+ try {
1302
+ const booted = await bootStandaloneRuntime({ roomId: args.room });
1303
+ runtime = booted.runtime;
1304
+ generate = booted.generate;
1305
+ prewarmResponseHandler = booted.prewarmResponseHandler;
1306
+ } catch (err) {
1307
+ log(
1308
+ c(
1309
+ "red",
1310
+ `Failed to boot the runtime: ${err instanceof Error ? err.message : String(err)}`,
1311
+ ),
1312
+ );
1313
+ log(
1314
+ c(
1315
+ "dim",
1316
+ "This is a missing-dependency / install issue, not a transient error. Fix the dependency and re-run.",
1317
+ ),
1318
+ );
1319
+ process.exit(1);
1320
+ }
1321
+ tag(
1322
+ "boot",
1323
+ "green",
1324
+ `runtime ready — agent=${runtime.character?.name ?? "Eliza"}`,
1325
+ );
1326
+
1327
+ // ── Engine + voice bridge ──────────────────────────────────────────────
1328
+ const { localInferenceEngine } = await import(
1329
+ "../../../plugins/plugin-local-inference/src/services/engine.ts"
1330
+ );
1331
+ const engine = localInferenceEngine;
1332
+
1333
+ // Load the eliza-1-2b model into the engine (this activates the bundle).
1334
+ try {
1335
+ const { listInstalledModels } = await import(
1336
+ "../../../plugins/plugin-local-inference/src/services/registry.ts"
1337
+ );
1338
+ const installed = await listInstalledModels();
1339
+ const target = installed.find((m) => m.id === "eliza-1-2b");
1340
+ if (!target)
1341
+ throw new Error("eliza-1-2b is not registered as an installed model");
1342
+ await engine.load(target.path);
1343
+ } catch (err) {
1344
+ log(
1345
+ c(
1346
+ "red",
1347
+ `Failed to activate the eliza-1-2b bundle in the engine: ${err instanceof Error ? err.message : String(err)}`,
1348
+ ),
1349
+ );
1350
+ process.exit(1);
1351
+ }
1352
+
1353
+ // Sample rate from the bridge default (24 kHz).
1354
+ const SAMPLE_RATE = 24_000;
1355
+ const audio = await makeAudioSink({
1356
+ sampleRate: SAMPLE_RATE,
1357
+ noAudio: args.noAudio,
1358
+ });
1359
+
1360
+ // Start + arm voice (fused backend).
1361
+ try {
1362
+ engine.startVoice({
1363
+ bundleRoot: report.bundleRoot,
1364
+ useFfiBackend: true,
1365
+ sink: audio.sink,
1366
+ });
1367
+ await engine.armVoice();
1368
+ } catch (err) {
1369
+ log(
1370
+ c(
1371
+ "red",
1372
+ `Failed to start/arm voice: ${err instanceof Error ? err.message : String(err)}`,
1373
+ ),
1374
+ );
1375
+ await engine.unload().catch(() => {});
1376
+ process.exit(1);
1377
+ }
1378
+ tag("voice", "green", `armed — TTS=fused, audio sink=${audio.describe()}`);
1379
+
1380
+ // ── State for keyboard controls ────────────────────────────────────────
1381
+ let micMuted = false;
1382
+ let micSource = null;
1383
+ let controller = null;
1384
+ let shuttingDown = false;
1385
+ let lastCtrlC = 0;
1386
+
1387
+ const shutdown = async (code = 0) => {
1388
+ if (shuttingDown) return;
1389
+ shuttingDown = true;
1390
+ log(
1391
+ c(
1392
+ "dim",
1393
+ "\n[shutdown] stopping session, disarming voice, unloading model…",
1394
+ ),
1395
+ );
1396
+ try {
1397
+ controller?.stop();
1398
+ } catch {
1399
+ /* ignore */
1400
+ }
1401
+ try {
1402
+ await engine.disarmVoice();
1403
+ await engine.stopVoice();
1404
+ } catch {
1405
+ /* ignore */
1406
+ }
1407
+ try {
1408
+ await audio.finalize?.();
1409
+ } catch {
1410
+ /* ignore */
1411
+ }
1412
+ try {
1413
+ await engine.unload();
1414
+ } catch {
1415
+ /* ignore */
1416
+ }
1417
+ try {
1418
+ await runtime.stop?.();
1419
+ } catch {
1420
+ /* ignore */
1421
+ }
1422
+ log(c("green", "[shutdown] done."));
1423
+ process.exit(code);
1424
+ };
1425
+
1426
+ const forceStop = () => {
1427
+ tag(
1428
+ "barge-in",
1429
+ "yellow",
1430
+ "hard-stop — force-stopping the in-flight LLM/drafter + TTS for this turn",
1431
+ );
1432
+ try {
1433
+ engine.triggerBargeIn();
1434
+ } catch {
1435
+ /* ignore */
1436
+ }
1437
+ };
1438
+
1439
+ // ── Live UI wiring (turn controller events + scheduler/barge-in) ───────
1440
+ const bridge = engine.voice();
1441
+ if (bridge?.scheduler?.bargeIn?.onSignal) {
1442
+ bridge.scheduler.bargeIn.onSignal((signal) => {
1443
+ if (signal.type === "pause-tts") tag("barge-in", "yellow", "paused");
1444
+ else if (signal.type === "resume-tts")
1445
+ tag("barge-in", "green", "resumed");
1446
+ else if (signal.type === "hard-stop")
1447
+ tag("barge-in", "red", "hard-stop (words detected)");
1448
+ });
1449
+ }
1450
+ // Native verifier → rollback queue (no-op when not on the fused build).
1451
+ try {
1452
+ bridge?.subscribeNativeVerifier?.();
1453
+ } catch {
1454
+ /* not on a fused build with a context — fine */
1455
+ }
1456
+
1457
+ // The `generate` callback wrapped so it streams replyText to stdout +
1458
+ // logs the structured envelope fields as they close. The actual TTS
1459
+ // streaming happens inside `engine.generate` (voiceStreamingArgs wires
1460
+ // onStreamChunk → the voice scheduler) via the runtime message handler.
1461
+ let _lastReplyText = "";
1462
+ const wrappedGenerate = async (request) => {
1463
+ if (request.final) {
1464
+ tag("final", "bold", `"${request.transcript}"`);
1465
+ }
1466
+ _lastReplyText = "";
1467
+ process.stdout.write(c("cyan", "[agent] "));
1468
+ const outcome = await generate(request, async (delta) => {
1469
+ _lastReplyText += delta;
1470
+ process.stdout.write(delta);
1471
+ });
1472
+ process.stdout.write("\n");
1473
+ return outcome;
1474
+ };
1475
+
1476
+ const events = {
1477
+ onSpeculativeStart: (transcript) =>
1478
+ tag("speculative", "dim", `generating off partial: "${transcript}"`),
1479
+ onSpeculativeAbort: () =>
1480
+ tag("speculative", "dim", "aborted (speech resumed)"),
1481
+ onSpeculativePromoted: () =>
1482
+ tag("speculative", "green", "promoted (matched final transcript)"),
1483
+ onTurnComplete: async (outcome) => {
1484
+ tag(
1485
+ "envelope",
1486
+ "green",
1487
+ `shouldRespond=${outcome.replyText && outcome.replyText.length > 0 ? "RESPOND" : "IGNORE/STOP"} replyText.len=${outcome.replyText?.length ?? 0}`,
1488
+ );
1489
+ await printTurnLatency(args.room);
1490
+ // Idle-time phrase-cache prewarm after each turn.
1491
+ engine.prewarmIdleVoicePhrases().catch(() => {});
1492
+ },
1493
+ onError: (err) => tag("error", "red", err?.message ?? String(err)),
1494
+ };
1495
+
1496
+ // ── Modes ──────────────────────────────────────────────────────────────
1497
+ if (args.say != null) {
1498
+ // Text mode: inject the text directly as a finalized transcript — tests
1499
+ // the LLM→TTS half without a mic.
1500
+ tag("mode", "blue", `--say: injecting transcript "${args.say}"`);
1501
+ try {
1502
+ // Mark the latency trace's vad-trigger so the trace has a t0.
1503
+ const { markVoiceLatency } = await import(
1504
+ "../../../plugins/plugin-local-inference/src/services/latency-trace.ts"
1505
+ );
1506
+ markVoiceLatency(args.room, "vad-trigger");
1507
+ markVoiceLatency(args.room, "asr-final");
1508
+ const signal = new AbortController().signal;
1509
+ const outcome = await wrappedGenerate({
1510
+ transcript: args.say,
1511
+ final: true,
1512
+ signal,
1513
+ });
1514
+ await events.onTurnComplete(outcome);
1515
+ // Settle TTS so audio committed to the ring buffer surfaces.
1516
+ await bridge?.settle?.();
1517
+ await new Promise((r) => setTimeout(r, 200));
1518
+ } catch (err) {
1519
+ log(
1520
+ c(
1521
+ "red",
1522
+ `--say turn failed: ${err instanceof Error ? err.message : String(err)}`,
1523
+ ),
1524
+ );
1525
+ await shutdown(1);
1526
+ return;
1527
+ }
1528
+ log(c("green", `[done] audio → ${audio.describe()}`));
1529
+ await shutdown(0);
1530
+ return;
1531
+ }
1532
+
1533
+ if (args.wav != null) {
1534
+ // WAV mode: feed a WAV file through the same path once.
1535
+ const wavPath = path.resolve(args.wav);
1536
+ if (!existsSync(wavPath)) {
1537
+ log(c("red", `--wav: file not found: ${wavPath}`));
1538
+ await shutdown(1);
1539
+ return;
1540
+ }
1541
+ tag(
1542
+ "mode",
1543
+ "blue",
1544
+ `--wav: feeding ${wavPath} through the voice path once`,
1545
+ );
1546
+ try {
1547
+ const { PushMicSource } = await import(
1548
+ "../../../plugins/plugin-local-inference/src/services/voice/mic-source.ts"
1549
+ );
1550
+ const { decodeMonoPcm16Wav } = await import(
1551
+ "../../../plugins/plugin-local-inference/src/services/voice/engine-bridge.ts"
1552
+ );
1553
+ const wavBytes = await fs.readFile(wavPath);
1554
+ const decoded = decodeMonoPcm16Wav(new Uint8Array(wavBytes));
1555
+ const push = new PushMicSource({ sampleRate: decoded.sampleRate });
1556
+ micSource = push;
1557
+ // The engine constructs the fused Silero VAD (via the libelizainference
1558
+ // VAD ABI) from its own bridge ffi/ctx when no `vad` is supplied.
1559
+ controller = await engine.startVoiceSession({
1560
+ roomId: args.room,
1561
+ micSource: push,
1562
+ generate: wrappedGenerate,
1563
+ prewarm: async (rid) => {
1564
+ try {
1565
+ await prewarmResponseHandler(runtime, rid);
1566
+ } catch {
1567
+ /* best-effort */
1568
+ }
1569
+ },
1570
+ speculatePauseMs: 300,
1571
+ events,
1572
+ });
1573
+ // Feed the WAV PCM (the PushMicSource re-frames it). Convert int16→float.
1574
+ const view = new DataView(
1575
+ decoded.pcm.buffer,
1576
+ decoded.pcm.byteOffset,
1577
+ decoded.pcm.byteLength,
1578
+ );
1579
+ const n = Math.floor(decoded.pcm.byteLength / 2);
1580
+ const f = new Float32Array(n);
1581
+ for (let i = 0; i < n; i++) f[i] = view.getInt16(i * 2, true) / 0x8000;
1582
+ push.push(f);
1583
+ // Trailing silence so the VAD fires speech-end.
1584
+ push.push(new Float32Array(decoded.sampleRate)); // 1 s
1585
+ // Wait for the turn to complete.
1586
+ await new Promise((r) => setTimeout(r, 4000));
1587
+ await bridge?.settle?.();
1588
+ } catch (err) {
1589
+ log(
1590
+ c(
1591
+ "red",
1592
+ `--wav turn failed: ${err instanceof Error ? err.message : String(err)}`,
1593
+ ),
1594
+ );
1595
+ await shutdown(1);
1596
+ return;
1597
+ }
1598
+ log(c("green", `[done] audio → ${audio.describe()}`));
1599
+ await shutdown(0);
1600
+ return;
1601
+ }
1602
+
1603
+ // ── Real mic interactive ───────────────────────────────────────────────
1604
+ tag(
1605
+ "mode",
1606
+ "blue",
1607
+ "real mic — speak into your microphone. Controls: s=force-stop m=mute p=histogram q=quit (Ctrl-C twice = quit)",
1608
+ );
1609
+ try {
1610
+ const { DesktopMicSource } = await import(
1611
+ "../../../plugins/plugin-local-inference/src/services/voice/mic-source.ts"
1612
+ );
1613
+ micSource = new DesktopMicSource();
1614
+ // The engine constructs the fused Silero VAD (via the libelizainference
1615
+ // VAD ABI) from its own bridge ffi/ctx when no `vad` is supplied.
1616
+ controller = await engine.startVoiceSession({
1617
+ roomId: args.room,
1618
+ micSource,
1619
+ generate: wrappedGenerate,
1620
+ prewarm: async (rid) => {
1621
+ try {
1622
+ await prewarmResponseHandler(runtime, rid);
1623
+ } catch {
1624
+ /* best-effort */
1625
+ }
1626
+ },
1627
+ speculatePauseMs: 300,
1628
+ events,
1629
+ });
1630
+ // The first-audio filler is played by the turn controller on speech-start;
1631
+ // wire VAD events to the live UI too. The transcriber's partials are
1632
+ // surfaced via the controller; print them by subscribing to the VAD.
1633
+ if (typeof vad.onVadEvent === "function") {
1634
+ vad.onVadEvent((e) => {
1635
+ if (e.type === "speech-start") tag("heard", "dim", "(speech-start)");
1636
+ else if (e.type === "speech-end") tag("heard", "dim", "(speech-end)");
1637
+ });
1638
+ }
1639
+ } catch (err) {
1640
+ log(
1641
+ c(
1642
+ "red",
1643
+ `Failed to start the mic voice session: ${err instanceof Error ? err.message : String(err)}`,
1644
+ ),
1645
+ );
1646
+ if (process.platform === "win32") {
1647
+ log(
1648
+ c(
1649
+ "dim",
1650
+ 'Windows has no universal CLI recorder — use --wav <path> or --say "<text>" instead.',
1651
+ ),
1652
+ );
1653
+ } else {
1654
+ log(
1655
+ c(
1656
+ "dim",
1657
+ "Is arecord (alsa-utils) or sox on PATH? Try: sudo apt install alsa-utils (or) brew install sox",
1658
+ ),
1659
+ );
1660
+ }
1661
+ await shutdown(1);
1662
+ return;
1663
+ }
1664
+
1665
+ // Keyboard controls (raw mode).
1666
+ if (process.stdin.isTTY) {
1667
+ readline.emitKeypressEvents(process.stdin);
1668
+ process.stdin.setRawMode(true);
1669
+ process.stdin.resume();
1670
+ process.stdin.on("keypress", async (_str, key) => {
1671
+ if (!key) return;
1672
+ if (key.ctrl && key.name === "c") {
1673
+ const now = Date.now();
1674
+ if (now - lastCtrlC < 1500) {
1675
+ await shutdown(0);
1676
+ } else {
1677
+ lastCtrlC = now;
1678
+ forceStop();
1679
+ log(c("dim", " (Ctrl-C again within 1.5s to quit)"));
1680
+ }
1681
+ return;
1682
+ }
1683
+ switch (key.name) {
1684
+ case "s":
1685
+ forceStop();
1686
+ break;
1687
+ case "m":
1688
+ micMuted = !micMuted;
1689
+ if (micMuted) {
1690
+ try {
1691
+ await micSource?.stop();
1692
+ } catch {
1693
+ /* ignore */
1694
+ }
1695
+ tag("mic", "yellow", "muted");
1696
+ } else {
1697
+ try {
1698
+ await micSource?.start();
1699
+ } catch {
1700
+ /* ignore */
1701
+ }
1702
+ tag("mic", "green", "unmuted");
1703
+ }
1704
+ break;
1705
+ case "p":
1706
+ await printLatencyHistogram();
1707
+ break;
1708
+ case "q":
1709
+ await shutdown(0);
1710
+ break;
1711
+ default:
1712
+ break;
1713
+ }
1714
+ });
1715
+ }
1716
+
1717
+ // Fire an initial idle phrase-cache prewarm.
1718
+ engine.prewarmIdleVoicePhrases().catch(() => {});
1719
+
1720
+ // Keep the process alive; shutdown happens via 'q' / Ctrl-C / signals.
1721
+ process.on("SIGINT", () => {
1722
+ void shutdown(0);
1723
+ });
1724
+ process.on("SIGTERM", () => {
1725
+ void shutdown(0);
1726
+ });
1727
+ }
1728
+
1729
+ // Re-used by the two-agents duet harness (`voice-duet.mjs`): the prereq
1730
+ // inspector, the bundle-registration helper, and the cross-platform matrix.
1731
+ // Guarded so importing this module (instead of running it) doesn't kick off
1732
+ // the interactive `main()`.
1733
+ export {
1734
+ ensureBundleRegistered,
1735
+ inspectActiveOptimizations,
1736
+ PLATFORM_MATRIX,
1737
+ printPlatformReport,
1738
+ };
1739
+
1740
+ if (import.meta.main) {
1741
+ main().catch(async (err) => {
1742
+ console.error(
1743
+ c(
1744
+ "red",
1745
+ `[voice-interactive] fatal: ${err instanceof Error ? (err.stack ?? err.message) : String(err)}`,
1746
+ ),
1747
+ );
1748
+ process.exit(1);
1749
+ });
1750
+ }