@elizaos/app-core 2.0.0-beta.3 → 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 (1530) 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.js +5 -5
  88. package/api/server-cors.d.ts.map +1 -1
  89. package/api/server-cors.js +13 -2
  90. package/api/server-first-run-helpers.d.ts +26 -0
  91. package/api/server-first-run-helpers.d.ts.map +1 -0
  92. package/api/server-first-run-helpers.js +271 -0
  93. package/api/server-security.js +1 -1
  94. package/api/server-startup.d.ts.map +1 -1
  95. package/api/server-startup.js +3 -4
  96. package/api/server-wallet-trade.js +1 -1
  97. package/api/server.d.ts +4 -4
  98. package/api/server.d.ts.map +1 -1
  99. package/api/server.js +222 -88
  100. package/api/setup-contract.d.ts +63 -0
  101. package/api/setup-contract.d.ts.map +1 -0
  102. package/api/setup-contract.js +39 -0
  103. package/api/training-benchmarks.d.ts +97 -0
  104. package/api/training-benchmarks.d.ts.map +1 -0
  105. package/api/training-benchmarks.js +307 -0
  106. package/api/workbench-compat-routes.js +2 -2
  107. package/benchmark/cerebras-autowire.d.ts +28 -0
  108. package/benchmark/cerebras-autowire.d.ts.map +1 -0
  109. package/benchmark/cerebras-autowire.js +62 -0
  110. package/benchmark/lifeops-bench-handler.d.ts +36 -0
  111. package/benchmark/lifeops-bench-handler.d.ts.map +1 -1
  112. package/benchmark/lifeops-bench-handler.js +63 -1
  113. package/benchmark/lifeops-fake-backend.d.ts +39 -0
  114. package/benchmark/lifeops-fake-backend.d.ts.map +1 -1
  115. package/benchmark/lifeops-fake-backend.js +993 -21
  116. package/benchmark/mock-plugin.d.ts.map +1 -1
  117. package/benchmark/mock-plugin.js +0 -24
  118. package/benchmark/plugin.d.ts +2 -1
  119. package/benchmark/plugin.d.ts.map +1 -1
  120. package/benchmark/plugin.js +989 -68
  121. package/benchmark/replay-capture.d.ts +2 -2
  122. package/benchmark/replay-capture.d.ts.map +1 -1
  123. package/benchmark/replay-capture.js +3 -3
  124. package/benchmark/server-utils.d.ts +162 -9
  125. package/benchmark/server-utils.d.ts.map +1 -1
  126. package/benchmark/server-utils.js +625 -62
  127. package/benchmark/server.d.ts.map +1 -1
  128. package/benchmark/server.js +1962 -118
  129. package/boot-profile.d.ts +3 -0
  130. package/boot-profile.d.ts.map +1 -0
  131. package/boot-profile.js +30 -0
  132. package/browser.d.ts +23 -1
  133. package/browser.d.ts.map +1 -1
  134. package/browser.js +20 -1
  135. package/cli/argv.js +1 -1
  136. package/cli/banner.js +1 -1
  137. package/cli/command-format.js +2 -2
  138. package/cli/doctor/checks.d.ts.map +1 -1
  139. package/cli/doctor/checks.js +6 -6
  140. package/cli/plugins-cli.d.ts.map +1 -1
  141. package/cli/plugins-cli.js +77 -32
  142. package/cli/profile.d.ts.map +1 -1
  143. package/cli/profile.js +5 -4
  144. package/cli/program/build-program.js +4 -4
  145. package/cli/program/command-registry.d.ts.map +1 -1
  146. package/cli/program/command-registry.js +13 -11
  147. package/cli/program/help.js +5 -5
  148. package/cli/program/preaction.js +5 -5
  149. package/cli/program/register.auth.d.ts.map +1 -1
  150. package/cli/program/register.auth.js +6 -12
  151. package/cli/program/register.capability-router.d.ts +29 -0
  152. package/cli/program/register.capability-router.d.ts.map +1 -0
  153. package/cli/program/register.capability-router.js +568 -0
  154. package/cli/program/register.config.js +1 -1
  155. package/cli/program/register.configure.d.ts.map +1 -1
  156. package/cli/program/register.configure.js +1 -1
  157. package/cli/program/register.dashboard.d.ts.map +1 -1
  158. package/cli/program/register.dashboard.js +6 -7
  159. package/cli/program/register.db.d.ts.map +1 -1
  160. package/cli/program/register.db.js +3 -4
  161. package/cli/program/register.doctor.js +7 -7
  162. package/cli/program/register.setup.d.ts.map +1 -1
  163. package/cli/program/register.setup.js +14 -10
  164. package/cli/program/register.start.d.ts.map +1 -1
  165. package/cli/program/register.start.js +5 -3
  166. package/cli/program/register.subclis.js +3 -3
  167. package/cli/program/register.update.d.ts +6 -0
  168. package/cli/program/register.update.d.ts.map +1 -1
  169. package/cli/program/register.update.js +58 -6
  170. package/cli/program.js +1 -1
  171. package/cli/run-main.js +4 -4
  172. package/config/app-config.d.ts +2 -0
  173. package/config/app-config.d.ts.map +1 -0
  174. package/config/app-config.js +1 -0
  175. package/connectors/capacitor-jsc.d.ts.map +1 -1
  176. package/connectors/capacitor-jsc.js +16 -10
  177. package/connectors/capacitor-quickjs.d.ts.map +1 -1
  178. package/connectors/capacitor-quickjs.js +18 -13
  179. package/connectors/capacitor-sqlite.d.ts.map +1 -1
  180. package/connectors/capacitor-sqlite.js +27 -12
  181. package/dispatch/approval-queue.d.ts +37 -0
  182. package/dispatch/approval-queue.d.ts.map +1 -0
  183. package/dispatch/approval-queue.js +25 -0
  184. package/dispatch/channel-registry.d.ts +30 -0
  185. package/dispatch/channel-registry.d.ts.map +1 -0
  186. package/dispatch/channel-registry.js +22 -0
  187. package/dispatch/connector-registry.d.ts +39 -0
  188. package/dispatch/connector-registry.d.ts.map +1 -0
  189. package/dispatch/connector-registry.js +24 -0
  190. package/dispatch/index.d.ts +14 -0
  191. package/dispatch/index.d.ts.map +1 -0
  192. package/dispatch/index.js +13 -0
  193. package/dispatch/send-policy.d.ts +36 -0
  194. package/dispatch/send-policy.d.ts.map +1 -0
  195. package/dispatch/send-policy.js +16 -0
  196. package/entry.js +28 -11
  197. package/first-run/first-run-config.d.ts +55 -0
  198. package/first-run/first-run-config.d.ts.map +1 -0
  199. package/first-run/first-run-config.js +178 -0
  200. package/first-run/runtime-target.d.ts +4 -0
  201. package/first-run/runtime-target.d.ts.map +1 -0
  202. package/first-run/runtime-target.js +13 -0
  203. package/index.d.ts +16 -3
  204. package/index.d.ts.map +1 -1
  205. package/index.js +57 -33
  206. package/package.json +159 -50
  207. package/packaging/debian/apt-repo-config/README.md +18 -0
  208. package/packaging/debian/apt-repo-config/conf/distributions +11 -0
  209. package/packaging/flatpak/README.md +26 -16
  210. package/packaging/flatpak/ai.elizaos.App.metainfo.xml +17 -12
  211. package/packaging/flatpak/ai.elizaos.App.store.yml +5 -5
  212. package/packaging/flatpak/ai.elizaos.App.yml +10 -24
  213. package/packaging/flatpak/elizaos-app-wrapper.store.sh +2 -2
  214. package/packaging/flatpak/generate-sources.sh +74 -0
  215. package/packaging/flatpak/node-sources.json +7930 -0
  216. package/packaging/inno/build-inno.ps1 +34 -9
  217. package/packaging/msix/AppxManifest.store.xml +1 -1
  218. package/packaging/msix/README.md +39 -19
  219. package/packaging/msix/build-msix.ps1 +44 -14
  220. package/packaging/snap/snapcraft.yaml +22 -21
  221. package/packaging/test-packaging.sh +2 -2
  222. package/permissions/types.d.ts +1 -1
  223. package/permissions/types.js +1 -1
  224. package/platform/elizaos-agent-browser-stub.d.ts +144 -0
  225. package/platform/elizaos-agent-browser-stub.d.ts.map +1 -0
  226. package/platform/elizaos-agent-browser-stub.js +158 -0
  227. package/platform/elizaos-plugin-elizacloud-browser-stub.d.ts +34 -0
  228. package/platform/elizaos-plugin-elizacloud-browser-stub.d.ts.map +1 -0
  229. package/platform/elizaos-plugin-elizacloud-browser-stub.js +51 -0
  230. package/platform/empty-node-module.d.ts +148 -0
  231. package/platform/empty-node-module.d.ts.map +1 -1
  232. package/platform/empty-node-module.js +140 -3
  233. package/platform/ios-runtime-backends.d.ts +83 -0
  234. package/platform/ios-runtime-backends.d.ts.map +1 -0
  235. package/platform/ios-runtime-backends.js +133 -0
  236. package/platform/ios-runtime-bridge.d.ts +15 -0
  237. package/platform/ios-runtime-bridge.d.ts.map +1 -0
  238. package/platform/ios-runtime-bridge.js +527 -0
  239. package/platform/native-library-policy.d.ts +23 -0
  240. package/platform/native-library-policy.d.ts.map +1 -0
  241. package/platform/native-library-policy.js +112 -0
  242. package/platform/native-plugin-entrypoints.d.ts +19 -0
  243. package/platform/native-plugin-entrypoints.d.ts.map +1 -0
  244. package/platform/native-plugin-entrypoints.js +29 -0
  245. package/platforms/android/README.md +68 -10
  246. package/platforms/android/app/build.gradle +268 -3
  247. package/platforms/android/app/capacitor.build.gradle +18 -1
  248. package/platforms/android/app/proguard-rules.pro +17 -2
  249. package/platforms/android/app/src/androidTest/java/ai/elizaos/app/ElizaOsInstrumentedTest.java +1 -1
  250. package/platforms/android/app/src/main/AndroidManifest.xml +334 -17
  251. package/platforms/android/app/src/main/assets/runners/eliza-tasks.js +177 -0
  252. package/platforms/android/app/src/main/elizavoice-jni/CMakeLists.txt +75 -0
  253. package/platforms/android/app/src/main/elizavoice-jni/elizavoice-jni.cpp +1045 -0
  254. package/platforms/android/app/src/main/java/ai/elizaos/app/AgentPlugin.java +111 -171
  255. package/platforms/android/app/src/main/java/ai/elizaos/app/AndroidVirtualizationBridge.java +284 -0
  256. package/platforms/android/app/src/main/java/ai/elizaos/app/BatteryOptimizationPlugin.java +95 -0
  257. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAccessibilityService.java +55 -0
  258. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAgentService.java +1198 -141
  259. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAndroidSystemBridge.java +83 -0
  260. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAssistActivity.java +50 -1
  261. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaBootReceiver.java +90 -8
  262. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaBrowserActivity.java +2 -2
  263. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaCalendarActivity.java +1 -1
  264. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaCameraActivity.java +1 -1
  265. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaClockActivity.java +2 -2
  266. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaContactsActivity.java +1 -1
  267. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaDialActivity.java +1 -1
  268. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaInCallService.java +1 -1
  269. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaMmsReceiver.java +1 -1
  270. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaNativeBridge.java +22 -0
  271. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaNotificationListenerService.java +45 -0
  272. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaQuickActionsWidgetProvider.java +68 -0
  273. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaShareActivity.java +132 -0
  274. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsComposeActivity.java +1 -1
  275. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsGatewayService.java +268 -0
  276. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsReceiver.java +12 -1
  277. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaTasksWorker.java +194 -0
  278. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoiceCaptureService.java +198 -0
  279. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoiceNative.java +160 -0
  280. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoicePlugin.java +450 -0
  281. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoiceTileService.java +39 -0
  282. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaWorkScheduler.java +60 -0
  283. package/platforms/android/app/src/main/java/ai/elizaos/app/GatewayConnectionService.java +53 -19
  284. package/platforms/android/app/src/main/java/ai/elizaos/app/MainActivity.java +160 -33
  285. package/platforms/android/app/src/main/java/ai/elizaos/app/ResourceProbePlugin.java +169 -0
  286. package/platforms/android/app/src/main/java/ai/elizaos/app/VoiceCapturePlugin.java +119 -0
  287. package/platforms/android/app/src/main/res/drawable/eliza_widget_background.xml +10 -0
  288. package/platforms/android/app/src/main/res/drawable/eliza_widget_button_background.xml +13 -0
  289. package/platforms/android/app/src/main/res/drawable/splash.png +0 -0
  290. package/platforms/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
  291. package/platforms/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
  292. package/platforms/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
  293. package/platforms/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
  294. package/platforms/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
  295. package/platforms/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
  296. package/platforms/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
  297. package/platforms/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
  298. package/platforms/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
  299. package/platforms/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
  300. package/platforms/android/app/src/main/res/layout/eliza_quick_actions_widget.xml +86 -0
  301. package/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +2 -1
  302. package/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +2 -1
  303. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  304. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
  305. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png +0 -0
  306. package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  307. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  308. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
  309. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png +0 -0
  310. package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  311. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  312. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
  313. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png +0 -0
  314. package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  315. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  316. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
  317. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png +0 -0
  318. package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  319. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  320. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
  321. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png +0 -0
  322. package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  323. package/platforms/android/app/src/main/res/values/android_app_actions.xml +48 -0
  324. package/platforms/android/app/src/main/res/values/colors.xml +8 -0
  325. package/platforms/android/app/src/main/res/values/ic_launcher_background.xml +2 -2
  326. package/platforms/android/app/src/main/res/values/strings.xml +2 -2
  327. package/platforms/android/app/src/main/res/values/styles.xml +25 -1
  328. package/platforms/android/app/src/main/res/xml/eliza_accessibility_service.xml +9 -0
  329. package/platforms/android/app/src/main/res/xml/eliza_quick_actions_widget.xml +13 -0
  330. package/platforms/android/app/src/main/res/xml/shortcuts.xml +121 -0
  331. package/platforms/android/build.gradle +2 -2
  332. package/platforms/android/capacitor-cordova-android-plugins/build.gradle +9 -3
  333. package/platforms/android/capacitor-cordova-android-plugins/cordova.variables.gradle +6 -2
  334. package/platforms/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml +7 -2
  335. package/platforms/android/capacitor-cordova-android-plugins/src/main/java/.gitkeep +0 -1
  336. package/platforms/android/capacitor.settings.gradle +66 -16
  337. package/platforms/android/gradle.properties +1 -0
  338. package/platforms/android/update-manifest/generate-manifest.mjs +97 -0
  339. package/platforms/android/update-manifest/schema.json +26 -0
  340. package/platforms/apple-store-entitlements.reviewed.json +155 -0
  341. package/platforms/electrobun/.generated/brand-config.json +3 -2
  342. package/platforms/electrobun/LICENSE +21 -0
  343. package/platforms/electrobun/README.md +15 -1
  344. package/platforms/electrobun/assets/appIcon.icns +0 -0
  345. package/platforms/electrobun/assets/appIcon.ico +0 -0
  346. package/platforms/electrobun/assets/appIcon.iconset/icon_128x128.png +0 -0
  347. package/platforms/electrobun/assets/appIcon.iconset/icon_128x128@2x.png +0 -0
  348. package/platforms/electrobun/assets/appIcon.iconset/icon_16x16.png +0 -0
  349. package/platforms/electrobun/assets/appIcon.iconset/icon_16x16@2x.png +0 -0
  350. package/platforms/electrobun/assets/appIcon.iconset/icon_256x256.png +0 -0
  351. package/platforms/electrobun/assets/appIcon.iconset/icon_256x256@2x.png +0 -0
  352. package/platforms/electrobun/assets/appIcon.iconset/icon_32x32.png +0 -0
  353. package/platforms/electrobun/assets/appIcon.iconset/icon_32x32@2x.png +0 -0
  354. package/platforms/electrobun/assets/appIcon.iconset/icon_512x512.png +0 -0
  355. package/platforms/electrobun/assets/brand-config.json +6 -6
  356. package/platforms/electrobun/biome.json +9 -9
  357. package/platforms/electrobun/docs/capability-collapse-matrix.json +318 -0
  358. package/platforms/electrobun/docs/capability-collapse-matrix.md +129 -0
  359. package/platforms/electrobun/docs/capability-routing.md +86 -0
  360. package/platforms/electrobun/docs/convergence-audit.json +3505 -0
  361. package/platforms/electrobun/docs/convergence-audit.md +694 -0
  362. package/platforms/electrobun/docs/database-boot-policy.md +90 -0
  363. package/platforms/electrobun/docs/riscv64-port.md +175 -0
  364. package/platforms/electrobun/docs/startup-first-run-cleanup.md +18 -0
  365. package/platforms/electrobun/docs/trace-first-annotations.md +52 -0
  366. package/platforms/electrobun/docs/ui-boundary-audit.json +580 -0
  367. package/platforms/electrobun/docs/ui-boundary-audit.md +257 -0
  368. package/platforms/electrobun/electrobun.config.ts +592 -364
  369. package/platforms/electrobun/entitlements/JUSTIFICATIONS.md +141 -0
  370. package/platforms/electrobun/entitlements/README.md +34 -6
  371. package/platforms/electrobun/entitlements/mas-bun.entitlements +15 -0
  372. package/platforms/electrobun/entitlements/mas.entitlements +6 -4
  373. package/platforms/electrobun/native/macos/window-effects.mm +1522 -0
  374. package/platforms/electrobun/package.json +18 -12
  375. package/platforms/electrobun/remotes/fs/README.md +70 -0
  376. package/platforms/electrobun/remotes/fs/electrobun.config.ts +38 -0
  377. package/platforms/electrobun/remotes/fs/package.json +12 -0
  378. package/platforms/electrobun/remotes/fs/plugin.json +25 -0
  379. package/platforms/electrobun/remotes/fs/src/bun/errors.ts +57 -0
  380. package/platforms/electrobun/remotes/fs/src/bun/file-limits.ts +50 -0
  381. package/platforms/electrobun/remotes/fs/src/bun/fs-service.ts +389 -0
  382. package/platforms/electrobun/remotes/fs/src/bun/path-guard.ts +270 -0
  383. package/platforms/electrobun/remotes/fs/src/bun/protocol.ts +149 -0
  384. package/platforms/electrobun/remotes/fs/src/bun/worker.ts +174 -0
  385. package/platforms/electrobun/remotes/fs/src/dev/phase5-smoke.ts +171 -0
  386. package/platforms/electrobun/remotes/fs/src/web/index.html +8 -0
  387. package/platforms/electrobun/remotes/git/README.md +75 -0
  388. package/platforms/electrobun/remotes/git/electrobun.config.ts +44 -0
  389. package/platforms/electrobun/remotes/git/package.json +12 -0
  390. package/platforms/electrobun/remotes/git/plugin.json +31 -0
  391. package/platforms/electrobun/remotes/git/src/bun/errors.ts +69 -0
  392. package/platforms/electrobun/remotes/git/src/bun/git-command.ts +156 -0
  393. package/platforms/electrobun/remotes/git/src/bun/git-service.ts +446 -0
  394. package/platforms/electrobun/remotes/git/src/bun/operation-history.ts +124 -0
  395. package/platforms/electrobun/remotes/git/src/bun/protocol.ts +252 -0
  396. package/platforms/electrobun/remotes/git/src/bun/worker.ts +316 -0
  397. package/platforms/electrobun/remotes/git/src/dev/phase7-smoke.ts +141 -0
  398. package/platforms/electrobun/remotes/git/src/web/index.html +8 -0
  399. package/platforms/electrobun/remotes/local-model/README.md +138 -0
  400. package/platforms/electrobun/remotes/local-model/electrobun.config.ts +46 -0
  401. package/platforms/electrobun/remotes/local-model/package.json +12 -0
  402. package/platforms/electrobun/remotes/local-model/plugin.json +33 -0
  403. package/platforms/electrobun/remotes/local-model/src/bun/download-state.ts +115 -0
  404. package/platforms/electrobun/remotes/local-model/src/bun/eliza1-catalog.ts +425 -0
  405. package/platforms/electrobun/remotes/local-model/src/bun/errors.ts +74 -0
  406. package/platforms/electrobun/remotes/local-model/src/bun/hf-eliza1-client.ts +169 -0
  407. package/platforms/electrobun/remotes/local-model/src/bun/local-inference-api-client.ts +245 -0
  408. package/platforms/electrobun/remotes/local-model/src/bun/model-service.ts +490 -0
  409. package/platforms/electrobun/remotes/local-model/src/bun/protocol.ts +301 -0
  410. package/platforms/electrobun/remotes/local-model/src/bun/worker.ts +248 -0
  411. package/platforms/electrobun/remotes/local-model/src/dev/phase8-smoke.ts +117 -0
  412. package/platforms/electrobun/remotes/local-model/src/web/index.html +13 -0
  413. package/platforms/electrobun/remotes/pty/README.md +65 -0
  414. package/platforms/electrobun/remotes/pty/electrobun.config.ts +47 -0
  415. package/platforms/electrobun/remotes/pty/package.json +12 -0
  416. package/platforms/electrobun/remotes/pty/plugin.json +34 -0
  417. package/platforms/electrobun/remotes/pty/src/bun/errors.ts +57 -0
  418. package/platforms/electrobun/remotes/pty/src/bun/output-buffer.ts +127 -0
  419. package/platforms/electrobun/remotes/pty/src/bun/protocol.ts +192 -0
  420. package/platforms/electrobun/remotes/pty/src/bun/pty-service.ts +562 -0
  421. package/platforms/electrobun/remotes/pty/src/bun/worker.ts +218 -0
  422. package/platforms/electrobun/remotes/pty/src/dev/phase6-smoke.ts +127 -0
  423. package/platforms/electrobun/remotes/pty/src/web/index.html +8 -0
  424. package/platforms/electrobun/remotes/runtime/README.md +370 -0
  425. package/platforms/electrobun/remotes/runtime/electrobun.config.ts +48 -0
  426. package/platforms/electrobun/remotes/runtime/package.json +14 -0
  427. package/platforms/electrobun/remotes/runtime/plugin.json +30 -0
  428. package/platforms/electrobun/remotes/runtime/src/bun/api-client.ts +620 -0
  429. package/platforms/electrobun/remotes/runtime/src/bun/errors.ts +45 -0
  430. package/platforms/electrobun/remotes/runtime/src/bun/log-buffer.ts +33 -0
  431. package/platforms/electrobun/remotes/runtime/src/bun/protocol.ts +366 -0
  432. package/platforms/electrobun/remotes/runtime/src/bun/route-discovery.ts +419 -0
  433. package/platforms/electrobun/remotes/runtime/src/bun/runtime-manager.ts +423 -0
  434. package/platforms/electrobun/remotes/runtime/src/bun/sse-parser.ts +99 -0
  435. package/platforms/electrobun/remotes/runtime/src/bun/stream-manager.ts +887 -0
  436. package/platforms/electrobun/remotes/runtime/src/bun/worker.ts +1231 -0
  437. package/platforms/electrobun/remotes/runtime/src/dev/phase1-smoke.ts +34 -0
  438. package/platforms/electrobun/remotes/runtime/src/dev/phase2-smoke.ts +86 -0
  439. package/platforms/electrobun/remotes/runtime/src/dev/phase3-smoke.ts +141 -0
  440. package/platforms/electrobun/remotes/runtime/src/web/index.css +187 -0
  441. package/platforms/electrobun/remotes/runtime/src/web/index.html +76 -0
  442. package/platforms/electrobun/remotes/runtime/src/web/index.ts +192 -0
  443. package/platforms/electrobun/remotes/surface/README.md +201 -0
  444. package/platforms/electrobun/remotes/surface/electrobun.config.ts +38 -0
  445. package/platforms/electrobun/remotes/surface/package.json +12 -0
  446. package/platforms/electrobun/remotes/surface/plugin.json +28 -0
  447. package/platforms/electrobun/remotes/surface/src/bun/worker.ts +132 -0
  448. package/platforms/electrobun/remotes/surface/src/dev/phase4-smoke.ts +566 -0
  449. package/platforms/electrobun/remotes/surface/src/protocol/event-types.ts +84 -0
  450. package/platforms/electrobun/remotes/surface/src/protocol/runtime-client.ts +673 -0
  451. package/platforms/electrobun/remotes/surface/src/web/app.ts +595 -0
  452. package/platforms/electrobun/remotes/surface/src/web/index.css +460 -0
  453. package/platforms/electrobun/remotes/surface/src/web/index.html +466 -0
  454. package/platforms/electrobun/remotes/surface/src/web/index.ts +5 -0
  455. package/platforms/electrobun/remotes/surface/src/web/render.ts +455 -0
  456. package/platforms/electrobun/remotes/surface/src/web/state.ts +427 -0
  457. package/platforms/electrobun/scripts/build-macos-effects.sh +4 -0
  458. package/platforms/electrobun/scripts/ensure-build-folder.ts +28 -0
  459. package/platforms/electrobun/scripts/ensure-whisper-gguf.sh +55 -0
  460. package/platforms/electrobun/scripts/ensure-whisper-model.sh +22 -80
  461. package/platforms/electrobun/scripts/generate-convergence-audit.ts +1203 -0
  462. package/platforms/electrobun/scripts/local-adhoc-sign-macos.ts +159 -159
  463. package/platforms/electrobun/scripts/postwrap-diagnostics.ts +424 -339
  464. package/platforms/electrobun/scripts/postwrap-sign-runtime-macos.ts +302 -271
  465. package/platforms/electrobun/scripts/smoke-test-windows.ps1 +17 -16
  466. package/platforms/electrobun/scripts/smoke-test.sh +5 -7
  467. package/platforms/electrobun/scripts/sync-web-assets.mjs +13 -13
  468. package/platforms/electrobun/scripts/verify-rpc-handlers.ts +109 -110
  469. package/platforms/electrobun/scripts/verify-windows-installer-proof.ps1 +3 -8
  470. package/platforms/electrobun/src/__stubs__/bun-ffi.ts +31 -31
  471. package/platforms/electrobun/src/__stubs__/electrobun-bun.ts +1 -1
  472. package/platforms/electrobun/src/agent-ready-state.ts +8 -8
  473. package/platforms/electrobun/src/agent-reset-from-main.test.ts +162 -0
  474. package/platforms/electrobun/src/agent-reset-from-main.ts +62 -62
  475. package/platforms/electrobun/src/agent-status-rpc.test.ts +95 -0
  476. package/platforms/electrobun/src/agent-status-rpc.ts +156 -0
  477. package/platforms/electrobun/src/api-base.test.ts +247 -0
  478. package/platforms/electrobun/src/api-base.ts +202 -93
  479. package/platforms/electrobun/src/application-menu-action-registry.ts +9 -9
  480. package/platforms/electrobun/src/application-menu.ts +348 -348
  481. package/platforms/electrobun/src/background-notice.ts +36 -36
  482. package/platforms/electrobun/src/boot-progress.test.ts +188 -0
  483. package/platforms/electrobun/src/boot-progress.ts +111 -0
  484. package/platforms/electrobun/src/brand-config.test.ts +39 -0
  485. package/platforms/electrobun/src/brand-config.ts +141 -129
  486. package/platforms/electrobun/src/bridge/browser-tabs-renderer-registry.ts +28 -28
  487. package/platforms/electrobun/src/bridge/electrobun-boot-config.ts +42 -0
  488. package/platforms/electrobun/src/bridge/electrobun-crypto-ready.ts +120 -0
  489. package/platforms/electrobun/src/bridge/electrobun-direct-rpc.ts +342 -357
  490. package/platforms/electrobun/src/bridge/electrobun-stub.ts +13 -13
  491. package/platforms/electrobun/src/browser-workspace-bridge-server.ts +285 -243
  492. package/platforms/electrobun/src/cloud-auth-window.ts +136 -136
  493. package/platforms/electrobun/src/cloud-disconnect-from-main.ts +90 -90
  494. package/platforms/electrobun/src/config-and-auth-rpc.test.ts +256 -0
  495. package/platforms/electrobun/src/config-and-auth-rpc.ts +302 -0
  496. package/platforms/electrobun/src/conversations-and-character-rpc.test.ts +185 -0
  497. package/platforms/electrobun/src/conversations-and-character-rpc.ts +131 -0
  498. package/platforms/electrobun/src/dashboard-rpc.test.ts +200 -0
  499. package/platforms/electrobun/src/dashboard-rpc.ts +344 -0
  500. package/platforms/electrobun/src/database/database-lock.ts +141 -0
  501. package/platforms/electrobun/src/database/database-mode.ts +149 -0
  502. package/platforms/electrobun/src/database/database-recovery.ts +72 -0
  503. package/platforms/electrobun/src/database/database-snapshot.ts +190 -0
  504. package/platforms/electrobun/src/database/database.test.ts +196 -0
  505. package/platforms/electrobun/src/database/index.ts +5 -0
  506. package/platforms/electrobun/src/database/pglite-paths.ts +100 -0
  507. package/platforms/electrobun/src/desktop-deep-link-events.test.ts +30 -0
  508. package/platforms/electrobun/src/desktop-deep-link-events.ts +17 -0
  509. package/platforms/electrobun/src/desktop-http-request.test.ts +73 -73
  510. package/platforms/electrobun/src/desktop-http-request.ts +85 -85
  511. package/platforms/electrobun/src/desktop-pill-config.test.ts +27 -0
  512. package/platforms/electrobun/src/desktop-pill-config.ts +40 -0
  513. package/platforms/electrobun/src/desktop-test-bridge-server.ts +204 -204
  514. package/platforms/electrobun/src/desktop-tray-config.test.ts +87 -0
  515. package/platforms/electrobun/src/desktop-tray-config.ts +84 -0
  516. package/platforms/electrobun/src/devtools-layout.ts +41 -41
  517. package/platforms/electrobun/src/diagnostic-format.test.ts +71 -0
  518. package/platforms/electrobun/src/diagnostic-format.ts +75 -36
  519. package/platforms/electrobun/src/dynamic-view-rpc-schema.test.ts +37 -0
  520. package/platforms/electrobun/src/dynamic-views/README.md +44 -0
  521. package/platforms/electrobun/src/dynamic-views/demo/agent-run-trace.html +135 -0
  522. package/platforms/electrobun/src/dynamic-views/errors.ts +29 -0
  523. package/platforms/electrobun/src/dynamic-views/host.test.ts +353 -0
  524. package/platforms/electrobun/src/dynamic-views/host.ts +332 -0
  525. package/platforms/electrobun/src/dynamic-views/index.ts +57 -0
  526. package/platforms/electrobun/src/dynamic-views/kiosk-canvas.ts +89 -0
  527. package/platforms/electrobun/src/dynamic-views/registry.test.ts +139 -0
  528. package/platforms/electrobun/src/dynamic-views/registry.ts +196 -0
  529. package/platforms/electrobun/src/dynamic-views/session-manager.test.ts +355 -0
  530. package/platforms/electrobun/src/dynamic-views/session-manager.ts +348 -0
  531. package/platforms/electrobun/src/dynamic-views/types.ts +105 -0
  532. package/platforms/electrobun/src/electrobun-boot-config.test.ts +50 -0
  533. package/platforms/electrobun/src/electrobun-config.test.ts +62 -0
  534. package/platforms/electrobun/src/electrobun-crypto-ready.test.ts +65 -0
  535. package/platforms/electrobun/src/electrobun-window-options.ts +25 -0
  536. package/platforms/electrobun/src/extension-rpc.test.ts +88 -0
  537. package/platforms/electrobun/src/extension-rpc.ts +102 -0
  538. package/platforms/electrobun/src/fatal-shutdown.test.ts +10 -10
  539. package/platforms/electrobun/src/fatal-shutdown.ts +1 -1
  540. package/platforms/electrobun/src/first-party-remotes.test.ts +169 -0
  541. package/platforms/electrobun/src/first-party-remotes.ts +297 -0
  542. package/platforms/electrobun/src/first-run-rpc.test.ts +192 -0
  543. package/platforms/electrobun/src/first-run-rpc.ts +146 -0
  544. package/platforms/electrobun/src/floating-chat-window.ts +181 -181
  545. package/platforms/electrobun/src/inbox-rpc.test.ts +123 -0
  546. package/platforms/electrobun/src/inbox-rpc.ts +158 -0
  547. package/platforms/electrobun/src/index.ts +2555 -2096
  548. package/platforms/electrobun/src/kiosk-mode.ts +50 -0
  549. package/platforms/electrobun/src/launch/index.ts +4 -0
  550. package/platforms/electrobun/src/launch/launch-dynamic-view.ts +37 -0
  551. package/platforms/electrobun/src/launch/launch-orchestrator.test.ts +224 -0
  552. package/platforms/electrobun/src/launch/launch-orchestrator.ts +456 -0
  553. package/platforms/electrobun/src/launch/launch-store.test.ts +97 -0
  554. package/platforms/electrobun/src/launch/launch-store.ts +134 -0
  555. package/platforms/electrobun/src/launch/types.ts +103 -0
  556. package/platforms/electrobun/src/launch/views/launch-diagnostics.html +205 -0
  557. package/platforms/electrobun/src/lifecycle/agent-ready-publish.test.ts +50 -0
  558. package/platforms/electrobun/src/lifecycle/agent-ready-publish.ts +27 -0
  559. package/platforms/electrobun/src/lifecycle/api-base-owner.ts +42 -31
  560. package/platforms/electrobun/src/lifecycle/desktop-session-prime.ts +44 -44
  561. package/platforms/electrobun/src/logger.ts +14 -14
  562. package/platforms/electrobun/src/main-window-runtime.ts +83 -83
  563. package/platforms/electrobun/src/main-window-session.test.ts +109 -0
  564. package/platforms/electrobun/src/main-window-session.ts +87 -51
  565. package/platforms/electrobun/src/menu-reset-from-main.ts +158 -158
  566. package/platforms/electrobun/src/native/agent-env.test.ts +52 -0
  567. package/platforms/electrobun/src/native/agent-runtime-layout.test.ts +42 -0
  568. package/platforms/electrobun/src/native/agent-state-dir.test.ts +91 -0
  569. package/platforms/electrobun/src/native/agent.ts +2122 -1682
  570. package/platforms/electrobun/src/native/auth-bridge.test.ts +67 -0
  571. package/platforms/electrobun/src/native/auth-bridge.ts +464 -360
  572. package/platforms/electrobun/src/native/browser-workspace.ts +723 -471
  573. package/platforms/electrobun/src/native/camera.ts +50 -50
  574. package/platforms/electrobun/src/native/canvas.ts +444 -445
  575. package/platforms/electrobun/src/native/credentials.ts +673 -616
  576. package/platforms/electrobun/src/native/desktop-window.test.ts +300 -0
  577. package/platforms/electrobun/src/native/desktop.ts +2196 -2156
  578. package/platforms/electrobun/src/native/editor-bridge.ts +201 -201
  579. package/platforms/electrobun/src/native/file-watcher.ts +154 -154
  580. package/platforms/electrobun/src/native/gateway.ts +179 -180
  581. package/platforms/electrobun/src/native/gpu-window.ts +256 -256
  582. package/platforms/electrobun/src/native/index.ts +76 -74
  583. package/platforms/electrobun/src/native/location.test.ts +44 -0
  584. package/platforms/electrobun/src/native/location.ts +90 -80
  585. package/platforms/electrobun/src/native/loopback-port.ts +60 -60
  586. package/platforms/electrobun/src/native/mac-window-effects.ts +166 -104
  587. package/platforms/electrobun/src/native/music-player.ts +38 -38
  588. package/platforms/electrobun/src/native/permissions-shared.ts +249 -150
  589. package/platforms/electrobun/src/native/permissions.ts +301 -208
  590. package/platforms/electrobun/src/native/power-state.ts +129 -129
  591. package/platforms/electrobun/src/native/remote-plugin-host.test.ts +1394 -0
  592. package/platforms/electrobun/src/native/remote-plugin-host.ts +1531 -0
  593. package/platforms/electrobun/src/native/screencapture.ts +667 -573
  594. package/platforms/electrobun/src/native/steward.ts +207 -204
  595. package/platforms/electrobun/src/native/swabble.ts +68 -324
  596. package/platforms/electrobun/src/native/talkmode.ts +253 -422
  597. package/platforms/electrobun/src/native/webgpu-browser-support.test.ts +18 -0
  598. package/platforms/electrobun/src/native/webgpu-browser-support.ts +165 -147
  599. package/platforms/electrobun/src/native/whisper-env.test.ts +71 -0
  600. package/platforms/electrobun/src/native/whisper-env.ts +68 -0
  601. package/platforms/electrobun/src/native-onboarding.ts +270 -0
  602. package/platforms/electrobun/src/onboarding-overlay-window.ts +141 -0
  603. package/platforms/electrobun/src/persisted-deployment.ts +91 -0
  604. package/platforms/electrobun/src/pill-window.test.ts +91 -0
  605. package/platforms/electrobun/src/pill-window.ts +99 -0
  606. package/platforms/electrobun/src/preload-validation.ts +44 -44
  607. package/platforms/electrobun/src/preload.js +1 -1
  608. package/platforms/electrobun/src/print-electrobun-dev-settings-banner.ts +120 -120
  609. package/platforms/electrobun/src/renderer-api-proxy.test.ts +73 -0
  610. package/platforms/electrobun/src/renderer-api-proxy.ts +86 -0
  611. package/platforms/electrobun/src/renderer-static.test.ts +53 -0
  612. package/platforms/electrobun/src/renderer-static.ts +144 -57
  613. package/platforms/electrobun/src/rpc-handler-slices.ts +121 -0
  614. package/platforms/electrobun/src/rpc-handlers.test.ts +267 -0
  615. package/platforms/electrobun/src/rpc-handlers.ts +1306 -913
  616. package/platforms/electrobun/src/rpc-parse-utils.ts +57 -0
  617. package/platforms/electrobun/src/rpc-port-resolver.test.ts +45 -0
  618. package/platforms/electrobun/src/rpc-port-resolver.ts +31 -0
  619. package/platforms/electrobun/src/rpc-schema.ts +2556 -1619
  620. package/platforms/electrobun/src/runtime-layout.ts +105 -105
  621. package/platforms/electrobun/src/runtime-permissions.ts +95 -95
  622. package/platforms/electrobun/src/runtime-rpc.test.ts +126 -0
  623. package/platforms/electrobun/src/runtime-rpc.ts +237 -0
  624. package/platforms/electrobun/src/screenshot-dev-server.ts +87 -87
  625. package/platforms/electrobun/src/settings-mutations-rpc.test.ts +193 -0
  626. package/platforms/electrobun/src/settings-mutations-rpc.ts +220 -0
  627. package/platforms/electrobun/src/startup-trace.ts +274 -270
  628. package/platforms/electrobun/src/subscription-rpc.test.ts +89 -0
  629. package/platforms/electrobun/src/subscription-rpc.ts +192 -0
  630. package/platforms/electrobun/src/surface-windows.test.ts +355 -0
  631. package/platforms/electrobun/src/surface-windows.ts +410 -410
  632. package/platforms/electrobun/src/trace/README.md +73 -0
  633. package/platforms/electrobun/src/trace/errors.ts +21 -0
  634. package/platforms/electrobun/src/trace/index.ts +40 -0
  635. package/platforms/electrobun/src/trace/trace-dynamic-view.ts +40 -0
  636. package/platforms/electrobun/src/trace/trace-host-requests.ts +473 -0
  637. package/platforms/electrobun/src/trace/trace-service.test.ts +186 -0
  638. package/platforms/electrobun/src/trace/trace-service.ts +324 -0
  639. package/platforms/electrobun/src/trace/trace-store.test.ts +141 -0
  640. package/platforms/electrobun/src/trace/trace-store.ts +551 -0
  641. package/platforms/electrobun/src/trace/types.ts +250 -0
  642. package/platforms/electrobun/src/trace/views/agent-run-trace.html +311 -0
  643. package/platforms/electrobun/src/types/web-speech.d.ts +28 -28
  644. package/platforms/electrobun/src/types.ts +5 -5
  645. package/platforms/electrobun/src/update-availability.test.ts +72 -0
  646. package/platforms/electrobun/src/update-availability.ts +90 -0
  647. package/platforms/electrobun/src/update-rpc.test.ts +83 -0
  648. package/platforms/electrobun/src/update-rpc.ts +123 -0
  649. package/platforms/electrobun/src/voice/README.md +184 -0
  650. package/platforms/electrobun/src/voice/errors.ts +42 -0
  651. package/platforms/electrobun/src/voice/index.ts +78 -0
  652. package/platforms/electrobun/src/voice/types.ts +316 -0
  653. package/platforms/electrobun/src/voice/voice-host-requests.ts +259 -0
  654. package/platforms/electrobun/src/voice/voice-latency-budget.test.ts +66 -0
  655. package/platforms/electrobun/src/voice/voice-latency-budget.ts +243 -0
  656. package/platforms/electrobun/src/voice/voice-live-validation.test.ts +352 -0
  657. package/platforms/electrobun/src/voice/voice-live-validation.ts +838 -0
  658. package/platforms/electrobun/src/voice/voice-pipeline.ts +250 -0
  659. package/platforms/electrobun/src/voice/voice-playback-adapter.ts +31 -0
  660. package/platforms/electrobun/src/voice/voice-runtime-adapter.test.ts +213 -0
  661. package/platforms/electrobun/src/voice/voice-runtime-adapter.ts +686 -0
  662. package/platforms/electrobun/src/voice/voice-service.test.ts +561 -0
  663. package/platforms/electrobun/src/voice/voice-service.ts +1027 -0
  664. package/platforms/electrobun/src/voice/voice-stream-coordinator.test.ts +115 -0
  665. package/platforms/electrobun/src/voice/voice-stream-coordinator.ts +270 -0
  666. package/platforms/electrobun/src/voice/voice-trace.ts +97 -0
  667. package/platforms/electrobun/src/voice/voice-tts-chunker.test.ts +91 -0
  668. package/platforms/electrobun/src/voice/voice-tts-chunker.ts +194 -0
  669. package/platforms/electrobun/src/windows-cef-profile.ts +88 -88
  670. package/platforms/electrobun/tsconfig.json +73 -13
  671. package/platforms/electrobun/update-channels.json +22 -0
  672. package/platforms/electrobun/vitest.electrobun.config.ts +72 -42
  673. package/platforms/ios/App/App/App.entitlements +4 -0
  674. package/platforms/ios/App/App/AppDelegate.swift +80 -18
  675. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ios-marketing-1024.png +0 -0
  676. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-20x20@1x.png +0 -0
  677. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-20x20@2x.png +0 -0
  678. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-29x29@1x.png +0 -0
  679. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-29x29@2x.png +0 -0
  680. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-40x40@1x.png +0 -0
  681. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-40x40@2x.png +0 -0
  682. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-76x76@1x.png +0 -0
  683. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-76x76@2x.png +0 -0
  684. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-83_5x83_5@2x.png +0 -0
  685. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-20x20@2x.png +0 -0
  686. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-20x20@3x.png +0 -0
  687. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-29x29@2x.png +0 -0
  688. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-29x29@3x.png +0 -0
  689. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-40x40@2x.png +0 -0
  690. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-40x40@3x.png +0 -0
  691. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-60x60@2x.png +0 -0
  692. package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-60x60@3x.png +0 -0
  693. package/platforms/ios/App/App/Base.lproj/LaunchScreen.storyboard +1 -4
  694. package/platforms/ios/App/App/ComputerUseBridge.swift +589 -0
  695. package/platforms/ios/App/App/DeviceActivityMonitorExtension/DeviceActivityMonitorExtension.entitlements +12 -0
  696. package/platforms/ios/App/App/DeviceActivityMonitorExtension/DeviceActivityMonitorExtension.swift +34 -0
  697. package/platforms/ios/App/App/DeviceActivityMonitorExtension/Info.plist +29 -0
  698. package/platforms/ios/App/App/DeviceActivityReportExtension/DeviceActivityReportExtension.entitlements +12 -0
  699. package/platforms/ios/App/App/DeviceActivityReportExtension/DeviceActivityReportExtension.swift +53 -0
  700. package/platforms/ios/App/App/DeviceActivityReportExtension/Info.plist +27 -0
  701. package/platforms/ios/App/App/ElizaAppIntents.swift +183 -0
  702. package/platforms/ios/App/App/ElizaIntentPlugin.swift +342 -5
  703. package/platforms/ios/App/App/Info.plist +17 -1
  704. package/platforms/ios/App/App/runners/eliza-tasks.js +177 -0
  705. package/platforms/ios/App/App.xcodeproj/project.pbxproj +262 -6
  706. package/platforms/ios/App/BroadcastExtension/SampleHandler.swift +100 -0
  707. package/platforms/ios/App/Podfile +5 -0
  708. package/platforms/ios/App/Podfile.lock +83 -59
  709. package/register-runtime-hooks.js +11 -5
  710. package/registry/app-registry.d.ts +14 -0
  711. package/registry/app-registry.d.ts.map +1 -0
  712. package/registry/app-registry.js +29 -0
  713. package/registry/entries/apps/app-polymarket.json +31 -0
  714. package/registry/entries/apps/clawville.json +27 -0
  715. package/registry/entries/apps/companion.json +28 -0
  716. package/registry/entries/apps/database-viewer.json +27 -0
  717. package/registry/entries/apps/defense-of-the-agents.json +27 -0
  718. package/registry/entries/apps/documents.json +30 -0
  719. package/registry/entries/apps/feed.json +27 -0
  720. package/registry/entries/apps/hyperliquid.json +31 -0
  721. package/registry/entries/apps/log-viewer.json +27 -0
  722. package/registry/entries/apps/memory-viewer.json +27 -0
  723. package/registry/entries/apps/model-tester.json +31 -0
  724. package/registry/entries/apps/plugin-viewer.json +27 -0
  725. package/registry/entries/apps/relationship-viewer.json +27 -0
  726. package/registry/entries/apps/runtime-debugger.json +27 -0
  727. package/registry/entries/apps/shopify.json +31 -0
  728. package/registry/entries/apps/skills-viewer.json +27 -0
  729. package/registry/entries/apps/steward.json +31 -0
  730. package/registry/entries/apps/training.json +54 -0
  731. package/registry/entries/apps/trajectory-viewer.json +27 -0
  732. package/registry/entries/apps/vincent.json +31 -0
  733. package/registry/entries/connectors/bluebubbles.json +99 -0
  734. package/registry/entries/connectors/bluesky.json +173 -0
  735. package/registry/entries/connectors/discord.json +119 -0
  736. package/registry/entries/connectors/farcaster.json +174 -0
  737. package/registry/entries/connectors/feishu.json +79 -0
  738. package/registry/entries/connectors/google-chat.json +120 -0
  739. package/registry/entries/connectors/google.json +82 -0
  740. package/registry/entries/connectors/imessage.json +96 -0
  741. package/registry/entries/connectors/instagram.json +64 -0
  742. package/registry/entries/connectors/line.json +86 -0
  743. package/registry/entries/connectors/matrix.json +94 -0
  744. package/registry/entries/connectors/mattermost.json +110 -0
  745. package/registry/entries/connectors/msteams.json +104 -0
  746. package/registry/entries/connectors/nextcloud-talk.json +104 -0
  747. package/registry/entries/connectors/nostr.json +70 -0
  748. package/registry/entries/connectors/signal.json +81 -0
  749. package/registry/entries/connectors/slack.json +102 -0
  750. package/registry/entries/connectors/telegram.json +71 -0
  751. package/registry/entries/connectors/tlon.json +94 -0
  752. package/registry/entries/connectors/twitch.json +110 -0
  753. package/registry/entries/connectors/whatsapp.json +113 -0
  754. package/registry/entries/connectors/x.json +231 -0
  755. package/registry/entries/connectors/zalo.json +112 -0
  756. package/registry/entries/connectors/zalouser.json +122 -0
  757. package/registry/entries/plugins/agent-orchestrator.json +33 -0
  758. package/registry/entries/plugins/agent-skills.json +72 -0
  759. package/registry/entries/plugins/anthropic.json +73 -0
  760. package/registry/entries/plugins/app-control.json +23 -0
  761. package/registry/entries/plugins/auto-trader.json +203 -0
  762. package/registry/entries/plugins/background-runner.json +26 -0
  763. package/registry/entries/plugins/blooio.json +102 -0
  764. package/registry/entries/plugins/browser.json +75 -0
  765. package/registry/entries/plugins/cli.json +40 -0
  766. package/registry/entries/plugins/clipboard.json +44 -0
  767. package/registry/entries/plugins/coding-tools.json +71 -0
  768. package/registry/entries/plugins/commands.json +63 -0
  769. package/registry/entries/plugins/computeruse.json +74 -0
  770. package/registry/entries/plugins/copilot-proxy.json +93 -0
  771. package/registry/entries/plugins/directives.json +63 -0
  772. package/registry/entries/plugins/edge-tts.json +97 -0
  773. package/registry/entries/plugins/elevenlabs.json +169 -0
  774. package/registry/entries/plugins/elizacloud.json +208 -0
  775. package/registry/entries/plugins/evm.json +134 -0
  776. package/registry/entries/plugins/experience.json +34 -0
  777. package/registry/entries/plugins/facewear.json +131 -0
  778. package/registry/entries/plugins/form.json +26 -0
  779. package/registry/entries/plugins/github.json +93 -0
  780. package/registry/entries/plugins/gmail-watch.json +25 -0
  781. package/registry/entries/plugins/goals.json +77 -0
  782. package/registry/entries/plugins/google-genai.json +106 -0
  783. package/registry/entries/plugins/groq.json +93 -0
  784. package/registry/entries/plugins/hedera.json +48 -0
  785. package/registry/entries/plugins/inmemorydb.json +25 -0
  786. package/registry/entries/plugins/linear.json +51 -0
  787. package/registry/entries/plugins/local-inference.json +142 -0
  788. package/registry/entries/plugins/local-storage.json +36 -0
  789. package/registry/entries/plugins/localdb.json +25 -0
  790. package/registry/entries/plugins/mcp.json +44 -0
  791. package/registry/entries/plugins/memory.json +124 -0
  792. package/registry/entries/plugins/minecraft.json +79 -0
  793. package/registry/entries/plugins/moltbook.json +83 -0
  794. package/registry/entries/plugins/music.json +155 -0
  795. package/registry/entries/plugins/mysticism.json +48 -0
  796. package/registry/entries/plugins/nearai.json +82 -0
  797. package/registry/entries/plugins/ngrok.json +69 -0
  798. package/registry/entries/plugins/ollama.json +96 -0
  799. package/registry/entries/plugins/openai.json +189 -0
  800. package/registry/entries/plugins/openrouter.json +188 -0
  801. package/registry/entries/plugins/pdf.json +26 -0
  802. package/registry/entries/plugins/plugin-manager.json +23 -0
  803. package/registry/entries/plugins/prose.json +48 -0
  804. package/registry/entries/plugins/rlm.json +26 -0
  805. package/registry/entries/plugins/roblox.json +88 -0
  806. package/registry/entries/plugins/rss.json +64 -0
  807. package/registry/entries/plugins/s3-storage.json +91 -0
  808. package/registry/entries/plugins/scheduling.json +35 -0
  809. package/registry/entries/plugins/shell.json +94 -0
  810. package/registry/entries/plugins/social-alpha.json +72 -0
  811. package/registry/entries/plugins/tailscale.json +81 -0
  812. package/registry/entries/plugins/tee.json +53 -0
  813. package/registry/entries/plugins/todos.json +26 -0
  814. package/registry/entries/plugins/trajectory-logger.json +33 -0
  815. package/registry/entries/plugins/trust.json +39 -0
  816. package/registry/entries/plugins/tts.json +71 -0
  817. package/registry/entries/plugins/tunnel.json +45 -0
  818. package/registry/entries/plugins/twilio.json +168 -0
  819. package/registry/entries/plugins/vercel-ai-gateway.json +128 -0
  820. package/registry/entries/plugins/video.json +23 -0
  821. package/registry/entries/plugins/vision.json +43 -0
  822. package/registry/entries/plugins/webhooks.json +23 -0
  823. package/registry/entries/plugins/workflow.json +25 -0
  824. package/registry/entries/plugins/xai.json +75 -0
  825. package/registry/index.d.ts +2 -1
  826. package/registry/index.d.ts.map +1 -1
  827. package/registry/index.js +46 -12
  828. package/registry/loader.d.ts +2 -1
  829. package/registry/loader.d.ts.map +1 -1
  830. package/registry/loader.js +49 -2
  831. package/registry/schema.d.ts +244 -34
  832. package/registry/schema.d.ts.map +1 -1
  833. package/registry/schema.js +36 -0
  834. package/runtime/android-avf-microdroid-bridge.d.ts +29 -0
  835. package/runtime/android-avf-microdroid-bridge.d.ts.map +1 -0
  836. package/runtime/android-avf-microdroid-bridge.js +149 -0
  837. package/runtime/api-dev-settings-banner.d.ts.map +1 -1
  838. package/runtime/api-dev-settings-banner.js +5 -13
  839. package/runtime/app-core-runtime-hooks.d.ts +21 -0
  840. package/runtime/app-core-runtime-hooks.d.ts.map +1 -0
  841. package/runtime/app-core-runtime-hooks.js +10 -0
  842. package/runtime/autonomy-policy.d.ts +2 -0
  843. package/runtime/autonomy-policy.d.ts.map +1 -0
  844. package/runtime/autonomy-policy.js +4 -0
  845. package/runtime/desktop/AppWindowRenderer.d.ts +17 -0
  846. package/runtime/desktop/AppWindowRenderer.d.ts.map +1 -0
  847. package/runtime/desktop/AppWindowRenderer.js +360 -0
  848. package/runtime/desktop/DesktopSurfaceNavigationRuntime.d.ts +2 -0
  849. package/runtime/desktop/DesktopSurfaceNavigationRuntime.d.ts.map +1 -0
  850. package/runtime/desktop/DesktopSurfaceNavigationRuntime.js +41 -0
  851. package/runtime/desktop/DesktopTrayRuntime.d.ts +2 -0
  852. package/runtime/desktop/DesktopTrayRuntime.d.ts.map +1 -0
  853. package/runtime/desktop/DesktopTrayRuntime.js +174 -0
  854. package/runtime/desktop/DetachedShellRoot.d.ts +10 -0
  855. package/runtime/desktop/DetachedShellRoot.d.ts.map +1 -0
  856. package/runtime/desktop/DetachedShellRoot.js +111 -0
  857. package/runtime/desktop/index.d.ts +6 -0
  858. package/runtime/desktop/index.d.ts.map +1 -0
  859. package/runtime/desktop/index.js +5 -0
  860. package/runtime/desktop/tray-menu.d.ts +20 -0
  861. package/runtime/desktop/tray-menu.d.ts.map +1 -0
  862. package/runtime/desktop/tray-menu.js +143 -0
  863. package/runtime/dev-server.d.ts +1 -1
  864. package/runtime/dev-server.d.ts.map +1 -1
  865. package/runtime/dev-server.js +93 -17
  866. package/runtime/eliza.d.ts +75 -1
  867. package/runtime/eliza.d.ts.map +1 -1
  868. package/runtime/eliza.js +596 -122
  869. package/runtime/ensure-text-to-speech-handler.d.ts.map +1 -1
  870. package/runtime/ensure-text-to-speech-handler.js +10 -3
  871. package/runtime/mobile-safe-runtime.d.ts +181 -2
  872. package/runtime/mobile-safe-runtime.d.ts.map +1 -1
  873. package/runtime/mobile-safe-runtime.js +1019 -12
  874. package/runtime/mode/remote-forwarder.d.ts.map +1 -1
  875. package/runtime/mode/remote-forwarder.js +2 -2
  876. package/runtime/mode/route-mode-guard.d.ts +1 -2
  877. package/runtime/mode/route-mode-guard.d.ts.map +1 -1
  878. package/runtime/mode/route-mode-guard.js +4 -5
  879. package/runtime/mode/route-mode-matrix.d.ts.map +1 -1
  880. package/runtime/mode/route-mode-matrix.js +14 -1
  881. package/runtime/mode/runtime-mode.d.ts +1 -1
  882. package/runtime/mode/runtime-mode.js +1 -1
  883. package/runtime/runtime-bootstrap-policy.d.ts.map +1 -1
  884. package/runtime/runtime-bootstrap-policy.js +14 -2
  885. package/runtime/telegram-standalone-handler.d.ts.map +1 -1
  886. package/runtime/telegram-standalone-handler.js +10 -9
  887. package/runtime/tts-cache-wiring.d.ts +29 -0
  888. package/runtime/tts-cache-wiring.d.ts.map +1 -0
  889. package/runtime/tts-cache-wiring.js +114 -0
  890. package/runtime/voice-warmup.d.ts +81 -0
  891. package/runtime/voice-warmup.d.ts.map +1 -0
  892. package/runtime/voice-warmup.js +111 -0
  893. package/scripts/android-sms-gateway-template.test.mjs +1014 -0
  894. package/scripts/aosp/README.md +19 -15
  895. package/scripts/aosp/compile-libllama.mjs +1344 -248
  896. package/scripts/aosp/compile-shim.mjs +47 -18
  897. package/scripts/aosp/deploy-pixel.mjs +405 -0
  898. package/scripts/aosp/lib/load-variant-config.mjs +3 -3
  899. package/scripts/aosp/llama-cpp-patches/README.md +8 -8
  900. package/scripts/aosp/llama-cpp-patches/apply-patches.mjs +23 -6
  901. package/scripts/aosp/llama-cpp-patches/polarquant/README.md +37 -0
  902. package/scripts/aosp/llama-cpp-patches/qjl/README.md +37 -0
  903. package/scripts/aosp/seccomp-shim/sigsys-handler-arm64.c +169 -0
  904. package/scripts/aosp/seccomp-shim/sigsys-handler-riscv64.c +217 -0
  905. package/scripts/aosp/smoke-cuttlefish.mjs +34 -4
  906. package/scripts/aosp/stage-default-models.mjs +18 -18
  907. package/scripts/aosp/variant-config-schema.ts +2 -2
  908. package/scripts/assert-required-bundled-packages.test.ts +534 -0
  909. package/scripts/audit-apple-store-sandbox.mjs +146 -0
  910. package/scripts/audit-live-test-surface.mjs +5 -2
  911. package/scripts/build-capacitor-app.mjs +21 -0
  912. package/scripts/build-flatpak.mjs +5 -5
  913. package/scripts/build-helpers/arm64-simd.mjs +72 -0
  914. package/scripts/build-helpers/omnivoice-merged.mjs +87 -0
  915. package/scripts/build-helpers/verify-fused-symbols.mjs +567 -0
  916. package/scripts/build-image.sh +1 -1
  917. package/scripts/build-llama-cpp-mtp.mjs +487 -0
  918. package/scripts/build-native-plugins.mjs +230 -18
  919. package/scripts/build-patched-electrobun-cli.mjs +68 -10
  920. package/scripts/build-win.mjs +1 -1
  921. package/scripts/bun-riscv64/Dockerfile +418 -0
  922. package/scripts/bun-riscv64/README.md +316 -0
  923. package/scripts/bun-riscv64/build.sh +469 -0
  924. package/scripts/bun-riscv64/bun-patches/0001-config-add-riscv64-arch.patch +74 -0
  925. package/scripts/bun-riscv64/bun-patches/0002-flags-add-riscv64-march-mabi.patch +16 -0
  926. package/scripts/bun-riscv64/bun-patches/0003-zig-add-riscv64-target-triple-and-cpu.patch +26 -0
  927. package/scripts/bun-riscv64/bun-patches/0004-webkit-force-local-mode-on-riscv64.patch +33 -0
  928. package/scripts/bun-riscv64/bun-patches/0005-tinycc-disable-on-riscv64.patch +16 -0
  929. package/scripts/bun-riscv64/bun-patches/0006-build-add-riscv64-cli-validation.patch +15 -0
  930. package/scripts/bun-riscv64/bun-patches/0007-deps-per-dep-riscv64-checks.patch +24 -0
  931. package/scripts/bun-riscv64/bun-patches/0008-source-stabilize-riscv64-musl-build.patch +226 -0
  932. package/scripts/bun-riscv64/bun-patches/0009-disable-wasm-streaming-hooks-for-c-loop.patch +162 -0
  933. package/scripts/bun-riscv64/bun-patches/0010-disable-inspector-profiler-for-riscv64-c-loop.patch +80 -0
  934. package/scripts/bun-riscv64/bun-patches/0011-process-arch-add-riscv64.patch +23 -0
  935. package/scripts/bun-riscv64/bun-patches/0012-cpu-features-add-riscv64-fallback.patch +13 -0
  936. package/scripts/bun-riscv64/bun-patches/0013-disable-console-inspector-hooks-for-riscv64-c-loop.patch +43 -0
  937. package/scripts/bun-riscv64/bun-patches/0014-disable-custom-inspector-dispatchers-on-riscv64.patch +127 -0
  938. package/scripts/bun-riscv64/bun-patches/0015-disable-jsc-profiler-builtins-on-riscv64.patch +75 -0
  939. package/scripts/bun-riscv64/bun-patches/0016-node-vm-disable-jit-cached-data-on-riscv64-c-loop.patch +96 -0
  940. package/scripts/bun-riscv64/bun-patches/0017-disable-performance-domjit-signature-on-riscv64-c-loop.patch +34 -0
  941. package/scripts/bun-riscv64/bun-patches/0018-fix-serialized-script-identifier-big-endian-path.patch +19 -0
  942. package/scripts/bun-riscv64/bun-patches/0019-add-wtf-timer-fire-bridge-for-c-loop.patch +24 -0
  943. package/scripts/bun-riscv64/bun-patches/0020-run-riscv64-smoke-test-under-qemu.patch +13 -0
  944. package/scripts/bun-riscv64/bun-patches/0021-fix-riscv64-linux-open-flags.patch +25 -0
  945. package/scripts/bun-riscv64/bun-patches/0022-zlib-riscv64-generic-kernels.patch +25 -0
  946. package/scripts/bun-riscv64/bun-patches/README.md +127 -0
  947. package/scripts/bun-riscv64/bun-version.json +202 -0
  948. package/scripts/bun-riscv64/run-build.sh +162 -0
  949. package/scripts/bun-riscv64/rust-core/0001-riscv64-rust-core-port.patch +868 -0
  950. package/scripts/bun-riscv64/rust-core/0002-second-wave-riscv64-source-gaps.patch +130 -0
  951. package/scripts/bun-riscv64/rust-core/0003-third-wave-riscv64-crash-handler-gaps.patch +78 -0
  952. package/scripts/bun-riscv64/rust-core/0004-rust-target-cpu-riscv64.patch +39 -0
  953. package/scripts/bun-riscv64/rust-core/0005-fifth-wave-riscv64-source-gaps.patch +96 -0
  954. package/scripts/bun-riscv64/rust-core/0006-cpp-wasm-and-inspector-guards-riscv64.patch +91 -0
  955. package/scripts/bun-riscv64/rust-core/0007-bun-alloc-max-align-t-riscv64.patch +36 -0
  956. package/scripts/bun-riscv64/rust-core/0008-workspace-lints-warn-not-deny-riscv64.patch +75 -0
  957. package/scripts/bun-riscv64/rust-core/0009-zigglobalobject-wasm-streaming-guards-riscv64.patch +109 -0
  958. package/scripts/bun-riscv64/rust-core/0010-tcc-externs-stub-on-riscv64.patch +62 -0
  959. package/scripts/bun-riscv64/rust-core/0011-clippy-ptr-cast-lints-warn-riscv64.patch +61 -0
  960. package/scripts/bun-riscv64/rust-core/README.md +80 -0
  961. package/scripts/bun-riscv64/rust-core/webkit-patches/0003-disable-dfg-ftl-on-riscv64.patch +60 -0
  962. package/scripts/bun-riscv64/rust-core/webkit-patches/0004-riscv64-do-not-force-wasm-in-c-loop.patch +31 -0
  963. package/scripts/bun-riscv64/rust-core/webkit-patches/0005-domjit-effect-allow-no-dfg-c-loop.patch +40 -0
  964. package/scripts/bun-riscv64/rust-core/webkit-patches/0006-disable-usewasm-when-webassembly-compiled-out.patch +33 -0
  965. package/scripts/bun-riscv64/rust-core/webkit-patches/0007-restore-dropped-includes-and-llint-fwd-decl.patch +31 -0
  966. package/scripts/bun-riscv64/validate.sh +264 -0
  967. package/scripts/bun-riscv64/webkit-patches/0001-cherry-pick-llint-riscv64.recipe +155 -0
  968. package/scripts/bun-riscv64/webkit-patches/0002-cherry-pick-baseline-jit-riscv64.recipe +40 -0
  969. package/scripts/bun-riscv64/webkit-patches/0003-disable-dfg-ftl-on-riscv64.patch +60 -0
  970. package/scripts/bun-riscv64/webkit-patches/0004-riscv64-do-not-force-wasm-in-c-loop.patch +31 -0
  971. package/scripts/bun-riscv64/webkit-patches/0005-domjit-effect-allow-no-dfg-c-loop.patch +40 -0
  972. package/scripts/bun-riscv64/webkit-patches/0006-disable-usewasm-when-webassembly-compiled-out.patch +33 -0
  973. package/scripts/bun-riscv64/webkit-patches/0007-restore-dropped-includes-and-llint-fwd-decl.patch +72 -0
  974. package/scripts/bun-riscv64/webkit-patches/README.md +146 -0
  975. package/scripts/check-homepage-public-readiness.mjs +353 -0
  976. package/scripts/check-homepage-release-data.mjs +110 -0
  977. package/scripts/check-i18n.mjs +2 -1
  978. package/scripts/check-real-local-chat.ts +147 -0
  979. package/scripts/check-real-local-provisioning.ts +104 -0
  980. package/scripts/check-real-local-reset.ts +249 -0
  981. package/scripts/check-sms-gateway-completion-audit.mjs +428 -0
  982. package/scripts/check-sms-gateway-readiness.mjs +266 -0
  983. package/scripts/clean-repo.mjs +5 -5
  984. package/scripts/codesign-mas.mjs +222 -16
  985. package/scripts/collect-docker-runtime-deps.mjs +229 -0
  986. package/scripts/continue-sms-gateway-work.mjs +121 -0
  987. package/scripts/copy-runtime-node-modules.ts +903 -195
  988. package/scripts/deploy-cloud-api-production-gateway.mjs +52 -0
  989. package/scripts/desktop-build.mjs +655 -101
  990. package/scripts/dev-platform.mjs +346 -102
  991. package/scripts/dev-startup-smoke.mjs +248 -0
  992. package/scripts/dev-ui.mjs +418 -176
  993. package/scripts/disable-local-eliza-workspace.mjs +35 -0
  994. package/scripts/docker-ci-smoke.sh +298 -96
  995. package/scripts/docker-entrypoint.sh +62 -1
  996. package/scripts/docker-entrypoint.test.ts +283 -0
  997. package/scripts/ensure-avatars.mjs +2 -2
  998. package/scripts/ensure-electrobun-core.mjs +1 -1
  999. package/scripts/ensure-generated-core-proto-js.mjs +1 -1
  1000. package/scripts/ensure-type-package-aliases.mjs +62 -5
  1001. package/scripts/ensure-vision-deps.mjs +20 -1
  1002. package/scripts/entry.ts +1 -1
  1003. package/scripts/ffi-stub/Makefile +64 -0
  1004. package/scripts/ffi-stub/README.md +391 -0
  1005. package/scripts/ffi-stub/asr-ffi-smoke.ts +139 -0
  1006. package/scripts/ffi-stub/ffi-stub.c +539 -0
  1007. package/scripts/ffi-stub/ffi.h +538 -0
  1008. package/scripts/ffi-stub/libelizainference_stub.so +0 -0
  1009. package/scripts/ffi-stub/tts-stream-ffi-smoke.ts +349 -0
  1010. package/scripts/generate-first-run-voicelines.mjs +194 -0
  1011. package/scripts/generate-plugin-index.js +4 -3
  1012. package/scripts/generate-static-asset-manifest.mjs +1 -1
  1013. package/scripts/i18n-dynamic-keys.json +5 -5
  1014. package/scripts/init-submodules.mjs +2 -2
  1015. package/scripts/install-android-sms-gateway.md +177 -0
  1016. package/scripts/install-android-sms-gateway.mjs +1088 -0
  1017. package/scripts/ios-xcframework/README.md +74 -72
  1018. package/scripts/ios-xcframework/build-xcframework.mjs +204 -43
  1019. package/scripts/ios-xcframework/run-physical-device-smoke.mjs +1943 -0
  1020. package/scripts/ios-xcframework/runtime-symbol-shim.c +450 -0
  1021. package/scripts/kernel-patches/cpu-polar-kernels.mjs +441 -0
  1022. package/scripts/kernel-patches/cpu-simd-kernels.mjs +253 -0
  1023. package/scripts/kernel-patches/cpu-thread-parallelism.mjs +368 -0
  1024. package/scripts/kernel-patches/cuda-kernels.mjs +117 -0
  1025. package/scripts/kernel-patches/metal-kernels.mjs +1698 -109
  1026. package/scripts/kernel-patches/server-omnivoice-route.mjs +718 -0
  1027. package/scripts/kernel-patches/server-structured-output.mjs +279 -0
  1028. package/scripts/kernel-patches/vulkan-dispatch-log.mjs +166 -0
  1029. package/scripts/kernel-patches/vulkan-dispatch-log.test.mjs +50 -0
  1030. package/scripts/kernel-patches/vulkan-dispatch-patches/01-vulkan-shaders-gen.patch +30 -16
  1031. package/scripts/kernel-patches/vulkan-dispatch-patches/02-ggml-vulkan-pipelines.patch +75 -30
  1032. package/scripts/kernel-patches/vulkan-kernels.mjs +800 -49
  1033. package/scripts/lib/agent-source-watcher.mjs +174 -0
  1034. package/scripts/lib/agent-source-watcher.test.mjs +184 -0
  1035. package/scripts/lib/api-supervisor.mjs +78 -9
  1036. package/scripts/lib/api-supervisor.test.mjs +121 -0
  1037. package/scripts/lib/app-dir.mjs +2 -16
  1038. package/scripts/lib/apple-entitlement-audit.mjs +655 -0
  1039. package/scripts/lib/apple-entitlement-audit.test.mjs +144 -0
  1040. package/scripts/lib/bun-version-guard.mjs +13 -13
  1041. package/scripts/lib/capacitor-plugin-build-needed.mjs +4 -3
  1042. package/scripts/lib/capacitor-plugin-names.mjs +30 -14
  1043. package/scripts/lib/desktop-preflight.mjs +9 -5
  1044. package/scripts/lib/desktop-startup-embedding-warmup-policy.mjs +51 -0
  1045. package/scripts/lib/desktop-startup-embedding-warmup-policy.test.mjs +55 -0
  1046. package/scripts/lib/duet-bridge.d.mts +63 -0
  1047. package/scripts/lib/duet-bridge.mjs +193 -0
  1048. package/scripts/lib/node-path-env.mjs +4 -2
  1049. package/scripts/lib/orchestrator-desktop-dev-banner.mjs +12 -3
  1050. package/scripts/lib/patch-bun-exports.mjs +90 -27
  1051. package/scripts/lib/patch-bun-exports.test.mjs +79 -0
  1052. package/scripts/lib/renderer-build-action.mjs +35 -0
  1053. package/scripts/lib/renderer-build-action.test.mjs +70 -0
  1054. package/scripts/lib/stage-android-agent.mjs +748 -99
  1055. package/scripts/lib/sync-eliza-env-aliases.mjs +3 -25
  1056. package/scripts/lib/ui-smoke-stub-decision.mjs +33 -0
  1057. package/scripts/lib/ui-smoke-stub-decision.test.mjs +46 -0
  1058. package/scripts/lib/vite-renderer-dist-stale.mjs +5 -0
  1059. package/scripts/lib/voice-latency-report.mjs +154 -0
  1060. package/scripts/lifeops-prompt-benchmark.ts +21 -12
  1061. package/scripts/link-docker-local-app-packages.mjs +89 -36
  1062. package/scripts/local-stt-bench.ts +192 -0
  1063. package/scripts/maintain-cloud-api-production-gateway.mjs +54 -0
  1064. package/scripts/mas-smoke.mjs +459 -0
  1065. package/scripts/mas-smoke.test.mjs +220 -0
  1066. package/scripts/mobile-auth-simulator-smoke.mjs +0 -1
  1067. package/scripts/normalize-eliza-capture.ts +97 -0
  1068. package/scripts/omnivoice-fuse/prepare.mjs +2543 -23
  1069. package/scripts/pack-upstreams.mjs +65 -5
  1070. package/scripts/package-electrobun-linux.mjs +303 -0
  1071. package/scripts/patch-deps.mjs +5 -3
  1072. package/scripts/patches/llama-mobile-kokoro-tts.patch +480 -0
  1073. package/scripts/playwright-ui-live-stack.ts +194 -49
  1074. package/scripts/playwright-ui-smoke-api-stub.mjs +3501 -109
  1075. package/scripts/pre-review-local.mjs +2 -2
  1076. package/scripts/prepare-ios-cocoapods.sh +41 -3
  1077. package/scripts/release-check.ts +180 -84
  1078. package/scripts/release-workflow-drift.test.ts +57 -0
  1079. package/scripts/relink-workspace-packages-to-dist.mjs +21 -4
  1080. package/scripts/rt.mjs +16 -1
  1081. package/scripts/run-biome-check.mjs +1 -1
  1082. package/scripts/run-coding-agent-e2e.mjs +3 -3
  1083. package/scripts/run-eliza-app-core-script.mjs +34 -0
  1084. package/scripts/run-local-plugin-live-smoke.mjs +71 -2
  1085. package/scripts/run-mobile-build-android-app-actions.test.mjs +426 -0
  1086. package/scripts/run-mobile-build.mjs +4757 -607
  1087. package/scripts/run-node-runtime.mjs +184 -7
  1088. package/scripts/run-node-runtime.test.mjs +167 -0
  1089. package/scripts/run-node-tsx.mjs +80 -33
  1090. package/scripts/run-node.mjs +41 -1
  1091. package/scripts/run-production-build.mjs +34 -27
  1092. package/scripts/run-release-check.mjs +19 -0
  1093. package/scripts/run-release-contract-suite.mjs +107 -14
  1094. package/scripts/run-ui-smoke-playwright-suite.mjs +0 -2
  1095. package/scripts/runtime-package-manifest.ts +21 -3
  1096. package/scripts/setup-upstreams.mjs +42 -1
  1097. package/scripts/sms-gateway-status.mjs +194 -0
  1098. package/scripts/stage-android-agent.test.mjs +97 -0
  1099. package/scripts/stage-elizavoice-lib.mjs +203 -0
  1100. package/scripts/startup-integration-script-drift.test.ts +82 -4
  1101. package/scripts/streaming-pipeline-bench.ts +543 -0
  1102. package/scripts/sync-homepage-porkbun-dns.mjs +262 -0
  1103. package/scripts/test-sms-gateway-software.mjs +100 -0
  1104. package/scripts/type-audit.mjs +1 -1
  1105. package/scripts/validate-bluebubbles-outbound.mjs +293 -0
  1106. package/scripts/validate-cdn-assets.mjs +15 -7
  1107. package/scripts/validate-regression-matrix.mjs +109 -8
  1108. package/scripts/verify-android-sms-gateway-e2e.mjs +362 -0
  1109. package/scripts/verify-bluebubbles-gateway-e2e.mjs +191 -0
  1110. package/scripts/verify-bluebubbles-inbound-readiness.mjs +88 -0
  1111. package/scripts/verify-cloud-api-production-deploy.mjs +87 -0
  1112. package/scripts/verify-cloud-sms-onboarding-flow.mjs +336 -0
  1113. package/scripts/voice/freeze-voice.mjs +521 -0
  1114. package/scripts/voice-attribution-smoke.ts +538 -0
  1115. package/scripts/voice-create-profile.mjs +379 -0
  1116. package/scripts/voice-duet.mjs +1355 -0
  1117. package/scripts/voice-e2e-hardware.ts +871 -0
  1118. package/scripts/voice-interactive.mjs +1750 -0
  1119. package/scripts/voice-latency-report.mjs +96 -0
  1120. package/scripts/voice-latency-report.test.ts +176 -0
  1121. package/scripts/voice-preset/build-default-voice-preset.mjs +249 -0
  1122. package/scripts/voice-preset/build-onboarding-voice.mjs +281 -0
  1123. package/scripts/watch-sms-gateway-readiness.mjs +303 -0
  1124. package/scripts/write-homepage-release-data.mjs +458 -26
  1125. package/security/agent-vault-id.d.ts +1 -1
  1126. package/security/agent-vault-id.js +1 -1
  1127. package/security/hydrate-wallet-keys-from-platform-store.d.ts.map +1 -1
  1128. package/security/hydrate-wallet-keys-from-platform-store.js +23 -14
  1129. package/security/platform-secure-store-node.d.ts +2 -2
  1130. package/security/platform-secure-store-node.js +3 -3
  1131. package/security/wallet-os-store-actions.d.ts +0 -9
  1132. package/security/wallet-os-store-actions.d.ts.map +1 -1
  1133. package/security/wallet-os-store-actions.js +3 -10
  1134. package/services/account-pool.d.ts +23 -14
  1135. package/services/account-pool.d.ts.map +1 -1
  1136. package/services/account-pool.js +86 -24
  1137. package/services/account-usage.d.ts.map +1 -1
  1138. package/services/account-usage.js +2 -5
  1139. package/services/ambient-audio/consent.d.ts +9 -0
  1140. package/services/ambient-audio/consent.d.ts.map +1 -0
  1141. package/services/ambient-audio/consent.js +28 -0
  1142. package/services/ambient-audio/index.d.ts +7 -0
  1143. package/services/ambient-audio/index.d.ts.map +1 -0
  1144. package/services/ambient-audio/index.js +4 -0
  1145. package/services/ambient-audio/replay-buffer.d.ts +14 -0
  1146. package/services/ambient-audio/replay-buffer.d.ts.map +1 -0
  1147. package/services/ambient-audio/replay-buffer.js +66 -0
  1148. package/services/ambient-audio/response-gate.d.ts +3 -0
  1149. package/services/ambient-audio/response-gate.d.ts.map +1 -0
  1150. package/services/ambient-audio/response-gate.js +33 -0
  1151. package/services/ambient-audio/service.d.ts +22 -0
  1152. package/services/ambient-audio/service.d.ts.map +1 -0
  1153. package/services/ambient-audio/service.js +47 -0
  1154. package/services/ambient-audio/types.d.ts +42 -0
  1155. package/services/ambient-audio/types.d.ts.map +1 -0
  1156. package/services/app-updates/update-policy.d.ts +64 -0
  1157. package/services/app-updates/update-policy.d.ts.map +1 -0
  1158. package/services/app-updates/update-policy.js +228 -0
  1159. package/services/auth-store.d.ts +37 -1
  1160. package/services/auth-store.d.ts.map +1 -1
  1161. package/services/auth-store.js +59 -26
  1162. package/services/cloud-jwks-store.d.ts +3 -3
  1163. package/services/cloud-jwks-store.d.ts.map +1 -1
  1164. package/services/cloud-jwks-store.js +5 -8
  1165. package/services/coding-account-bridge.d.ts +71 -0
  1166. package/services/coding-account-bridge.d.ts.map +1 -0
  1167. package/services/coding-account-bridge.js +267 -0
  1168. package/services/connector-target-catalog.d.ts +10 -3
  1169. package/services/connector-target-catalog.d.ts.map +1 -1
  1170. package/services/connector-target-catalog.js +7 -4
  1171. package/services/credential-tunnel-service.d.ts +66 -0
  1172. package/services/credential-tunnel-service.d.ts.map +1 -0
  1173. package/services/credential-tunnel-service.js +227 -0
  1174. package/services/github-credentials.d.ts +1 -1
  1175. package/services/github-credentials.js +1 -1
  1176. package/services/inference-abort.d.ts +47 -0
  1177. package/services/inference-abort.d.ts.map +1 -0
  1178. package/services/inference-abort.js +76 -0
  1179. package/services/persistence.d.ts +2 -3
  1180. package/services/persistence.d.ts.map +1 -1
  1181. package/services/persistence.js +2 -3
  1182. package/services/phrase-chunked-tts.d.ts +136 -0
  1183. package/services/phrase-chunked-tts.d.ts.map +1 -0
  1184. package/services/phrase-chunked-tts.js +208 -0
  1185. package/services/sandbox-registry.d.ts +78 -0
  1186. package/services/sandbox-registry.d.ts.map +1 -0
  1187. package/services/sandbox-registry.js +323 -0
  1188. package/services/secrets-manager-installer.d.ts +8 -1
  1189. package/services/secrets-manager-installer.d.ts.map +1 -1
  1190. package/services/secrets-manager-installer.js +27 -2
  1191. package/services/sensitive-requests/cloud-link-adapter.d.ts +15 -0
  1192. package/services/sensitive-requests/cloud-link-adapter.d.ts.map +1 -0
  1193. package/services/sensitive-requests/cloud-link-adapter.js +73 -0
  1194. package/services/sensitive-requests/index.d.ts +27 -0
  1195. package/services/sensitive-requests/index.d.ts.map +1 -0
  1196. package/services/sensitive-requests/index.js +51 -0
  1197. package/services/sensitive-requests/instruct-dm-only-adapter.d.ts +14 -0
  1198. package/services/sensitive-requests/instruct-dm-only-adapter.d.ts.map +1 -0
  1199. package/services/sensitive-requests/instruct-dm-only-adapter.js +22 -0
  1200. package/services/sensitive-requests/owner-app-inline-adapter.d.ts +3 -0
  1201. package/services/sensitive-requests/owner-app-inline-adapter.d.ts.map +1 -0
  1202. package/services/sensitive-requests/owner-app-inline-adapter.js +146 -0
  1203. package/services/sensitive-requests/owner-app-oauth-adapter.d.ts +3 -0
  1204. package/services/sensitive-requests/owner-app-oauth-adapter.d.ts.map +1 -0
  1205. package/services/sensitive-requests/owner-app-oauth-adapter.js +156 -0
  1206. package/services/sensitive-requests/public-link-adapter.d.ts +14 -0
  1207. package/services/sensitive-requests/public-link-adapter.d.ts.map +1 -0
  1208. package/services/sensitive-requests/public-link-adapter.js +86 -0
  1209. package/services/sensitive-requests/tunnel-link-adapter.d.ts +17 -0
  1210. package/services/sensitive-requests/tunnel-link-adapter.d.ts.map +1 -0
  1211. package/services/sensitive-requests/tunnel-link-adapter.js +38 -0
  1212. package/services/steward-credentials.d.ts +1 -1
  1213. package/services/steward-credentials.d.ts.map +1 -1
  1214. package/services/steward-credentials.js +10 -6
  1215. package/services/steward-sidecar/health-check.d.ts.map +1 -1
  1216. package/services/steward-sidecar/health-check.js +4 -3
  1217. package/services/steward-sidecar/process-management.d.ts +1 -1
  1218. package/services/steward-sidecar/process-management.d.ts.map +1 -1
  1219. package/services/steward-sidecar/process-management.js +9 -3
  1220. package/services/steward-sidecar/types.d.ts +1 -1
  1221. package/services/steward-sidecar/types.d.ts.map +1 -1
  1222. package/services/steward-sidecar/wallet-setup.d.ts.map +1 -1
  1223. package/services/steward-sidecar/wallet-setup.js +8 -7
  1224. package/services/steward-sidecar.d.ts +2 -2
  1225. package/services/steward-sidecar.d.ts.map +1 -1
  1226. package/services/steward-sidecar.js +27 -19
  1227. package/services/task-host-capabilities.d.ts +60 -0
  1228. package/services/task-host-capabilities.d.ts.map +1 -0
  1229. package/services/task-host-capabilities.js +122 -0
  1230. package/services/tool-call-cache/index.d.ts +2 -2
  1231. package/services/tool-call-cache/index.d.ts.map +1 -1
  1232. package/services/tool-call-cache/index.js +1 -1
  1233. package/services/trigger-event-bridge.js +1 -1
  1234. package/services/tunnel-to-mobile/index.d.ts +2 -0
  1235. package/services/tunnel-to-mobile/index.d.ts.map +1 -0
  1236. package/services/tunnel-to-mobile/index.js +1 -0
  1237. package/services/tunnel-to-mobile/tunnel-to-mobile-client.d.ts +105 -0
  1238. package/services/tunnel-to-mobile/tunnel-to-mobile-client.d.ts.map +1 -0
  1239. package/services/tunnel-to-mobile/tunnel-to-mobile-client.js +190 -0
  1240. package/services/vault-bootstrap.d.ts.map +1 -1
  1241. package/services/vault-bootstrap.js +48 -21
  1242. package/services/vault-mirror.d.ts +1 -1
  1243. package/services/vault-mirror.d.ts.map +1 -1
  1244. package/services/vault-mirror.js +29 -6
  1245. package/services/voice-profiles/diarization-pipeline.d.ts +6 -0
  1246. package/services/voice-profiles/diarization-pipeline.d.ts.map +1 -0
  1247. package/services/voice-profiles/diarization-pipeline.js +20 -0
  1248. package/services/voice-profiles/index.d.ts +12 -0
  1249. package/services/voice-profiles/index.d.ts.map +1 -0
  1250. package/services/voice-profiles/index.js +5 -0
  1251. package/services/voice-profiles/nickname-evaluator.d.ts +14 -0
  1252. package/services/voice-profiles/nickname-evaluator.d.ts.map +1 -0
  1253. package/services/voice-profiles/nickname-evaluator.js +46 -0
  1254. package/services/voice-profiles/owner-confidence.d.ts +10 -0
  1255. package/services/voice-profiles/owner-confidence.d.ts.map +1 -0
  1256. package/services/voice-profiles/owner-confidence.js +38 -0
  1257. package/services/voice-profiles/private-challenge.d.ts +20 -0
  1258. package/services/voice-profiles/private-challenge.d.ts.map +1 -0
  1259. package/services/voice-profiles/private-challenge.js +44 -0
  1260. package/services/voice-profiles/store.d.ts +21 -0
  1261. package/services/voice-profiles/store.d.ts.map +1 -0
  1262. package/services/voice-profiles/store.js +50 -0
  1263. package/services/voice-profiles/types.d.ts +38 -0
  1264. package/services/voice-profiles/types.d.ts.map +1 -0
  1265. package/services/voice-profiles/types.js +1 -0
  1266. package/styles/electrobun-mac-window-drag.css +4 -4
  1267. package/test/helpers/__tests__/live-agent-test.smoke.test.ts +43 -70
  1268. package/test/helpers/browser-mocks.ts +2 -2
  1269. package/test/helpers/conditional-tests.ts +2 -2
  1270. package/test/helpers/i18n.ts +1 -1
  1271. package/test/helpers/live-agent-test.ts +537 -551
  1272. package/test/helpers/live-provider.test.ts +4 -4
  1273. package/test/helpers/live-provider.ts +41 -7
  1274. package/test/helpers/live-runtime-server.ts +4 -4
  1275. package/test/helpers/pglite-runtime.ts +1 -1
  1276. package/test/helpers/real-runtime.ts +54 -15
  1277. package/test/helpers/trajectory-harness.ts +11 -7
  1278. package/test/scripts/start-eliza-live.ts +9 -0
  1279. package/test/scripts/test-parallel.mjs +1 -1
  1280. package/test/scripts/test-root-unit.mjs +6 -7
  1281. package/ui-compat.d.ts +13 -2
  1282. package/ui-compat.d.ts.map +1 -1
  1283. package/ui-compat.js +19 -3
  1284. package/api/auth-pairing-compat-routes.d.ts +0 -17
  1285. package/api/auth-pairing-compat-routes.d.ts.map +0 -1
  1286. package/api/auth-pairing-compat-routes.js +0 -301
  1287. package/api/local-inference-compat-routes.d.ts +0 -16
  1288. package/api/local-inference-compat-routes.d.ts.map +0 -1
  1289. package/api/local-inference-compat-routes.js +0 -617
  1290. package/api/onboarding-compat-routes.d.ts +0 -4
  1291. package/api/onboarding-compat-routes.d.ts.map +0 -1
  1292. package/api/onboarding-compat-routes.js +0 -207
  1293. package/api/plugins-compat-routes.d.ts +0 -103
  1294. package/api/plugins-compat-routes.d.ts.map +0 -1
  1295. package/api/plugins-compat-routes.js +0 -1181
  1296. package/api/server-onboarding-compat.d.ts +0 -31
  1297. package/api/server-onboarding-compat.d.ts.map +0 -1
  1298. package/api/server-onboarding-compat.js +0 -283
  1299. package/benchmark/cua-routes.d.ts +0 -10
  1300. package/benchmark/cua-routes.d.ts.map +0 -1
  1301. package/benchmark/cua-routes.js +0 -179
  1302. package/benchmark/mock-plugin-base.d.ts +0 -9
  1303. package/benchmark/mock-plugin-base.d.ts.map +0 -1
  1304. package/benchmark/mock-plugin-base.js +0 -325
  1305. package/cli/parse-duration.d.ts +0 -5
  1306. package/cli/parse-duration.d.ts.map +0 -1
  1307. package/cli/parse-duration.js +0 -27
  1308. package/patches/llama-cpp-capacitor@0.1.5.patch +0 -2387
  1309. package/platform/agent-browser-stub.d.ts +0 -27
  1310. package/platform/agent-browser-stub.d.ts.map +0 -1
  1311. package/platform/agent-browser-stub.js +0 -16
  1312. package/platforms/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java +0 -26
  1313. package/platforms/android/app/src/main/res/drawable/ic_launcher_background.xml +0 -170
  1314. package/platforms/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +0 -34
  1315. package/platforms/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java +0 -18
  1316. package/platforms/electrobun/assets/appIcon.iconset/icon_512x512@2x.png +0 -0
  1317. package/platforms/electrobun/assets/appIcon.png +0 -0
  1318. package/platforms/electrobun/scripts/build-whisper-universal.sh +0 -137
  1319. package/platforms/electrobun/scripts/build-whisper.sh +0 -95
  1320. package/platforms/electrobun/src/libMacWindowEffects.dylib +0 -0
  1321. package/platforms/electrobun/src/native/whisper.ts +0 -280
  1322. package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
  1323. package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
  1324. package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
  1325. package/registry/generate-apps.d.ts +0 -2
  1326. package/registry/generate-apps.d.ts.map +0 -1
  1327. package/registry/generate-apps.js +0 -338
  1328. package/registry/generate.d.ts +0 -2
  1329. package/registry/generate.d.ts.map +0 -1
  1330. package/registry/generate.js +0 -506
  1331. package/runtime/embedding-manager-support.d.ts +0 -77
  1332. package/runtime/embedding-manager-support.d.ts.map +0 -1
  1333. package/runtime/embedding-manager-support.js +0 -309
  1334. package/runtime/embedding-presets.d.ts +0 -5
  1335. package/runtime/embedding-presets.d.ts.map +0 -1
  1336. package/runtime/embedding-presets.js +0 -47
  1337. package/runtime/embedding-warmup-policy.d.ts +0 -13
  1338. package/runtime/embedding-warmup-policy.d.ts.map +0 -1
  1339. package/runtime/embedding-warmup-policy.js +0 -33
  1340. package/runtime/ensure-local-inference-handler.d.ts +0 -25
  1341. package/runtime/ensure-local-inference-handler.d.ts.map +0 -1
  1342. package/runtime/ensure-local-inference-handler.js +0 -389
  1343. package/runtime/mobile-local-inference-gate.d.ts +0 -21
  1344. package/runtime/mobile-local-inference-gate.d.ts.map +0 -1
  1345. package/runtime/mobile-local-inference-gate.js +0 -24
  1346. package/scripts/aosp/avd-test.mjs +0 -403
  1347. package/scripts/aosp/boot-validate.mjs +0 -536
  1348. package/scripts/aosp/build-aosp.mjs +0 -448
  1349. package/scripts/aosp/build-bootanimation.mjs +0 -178
  1350. package/scripts/aosp/capture-screens.mjs +0 -325
  1351. package/scripts/aosp/e2e-validate.mjs +0 -225
  1352. package/scripts/aosp/lint-init-rc.mjs +0 -258
  1353. package/scripts/aosp/llama-shim/eliza_llama_shim.c +0 -276
  1354. package/scripts/aosp/sim.mjs +0 -277
  1355. package/scripts/aosp/sync-to-aosp.mjs +0 -134
  1356. package/scripts/aosp/validate.mjs +0 -1273
  1357. package/scripts/build-llama-cpp-dflash.mjs +0 -1866
  1358. package/scripts/generate-onboarding-voicelines.mjs +0 -194
  1359. package/scripts/generated/static-asset-manifest.json +0 -4
  1360. package/scripts/normalize-parallax-capture.ts +0 -97
  1361. package/scripts/omnivoice-fuse/Makefile +0 -44
  1362. package/scripts/omnivoice-fuse/README.md +0 -266
  1363. package/scripts/omnivoice-fuse/cmake-graft.mjs +0 -180
  1364. package/scripts/omnivoice-fuse/ffi-stub.c +0 -222
  1365. package/scripts/omnivoice-fuse/ffi.h +0 -158
  1366. package/scripts/omnivoice-fuse/libelizainference_stub.dylib +0 -0
  1367. package/scripts/omnivoice-fuse/verify-symbols.mjs +0 -138
  1368. package/security/cloud-secret-store.d.ts +0 -34
  1369. package/security/cloud-secret-store.d.ts.map +0 -1
  1370. package/security/cloud-secret-store.js +0 -65
  1371. package/security/export-guard.d.ts +0 -34
  1372. package/security/export-guard.d.ts.map +0 -1
  1373. package/security/export-guard.js +0 -127
  1374. package/services/local-inference/__stress__/cache-stress-helpers.d.ts +0 -76
  1375. package/services/local-inference/__stress__/cache-stress-helpers.d.ts.map +0 -1
  1376. package/services/local-inference/__stress__/cache-stress-helpers.js +0 -238
  1377. package/services/local-inference/active-model.d.ts +0 -180
  1378. package/services/local-inference/active-model.d.ts.map +0 -1
  1379. package/services/local-inference/active-model.js +0 -362
  1380. package/services/local-inference/assignments.d.ts +0 -58
  1381. package/services/local-inference/assignments.d.ts.map +0 -1
  1382. package/services/local-inference/assignments.js +0 -179
  1383. package/services/local-inference/backend.d.ts +0 -200
  1384. package/services/local-inference/backend.d.ts.map +0 -1
  1385. package/services/local-inference/backend.js +0 -242
  1386. package/services/local-inference/bundled-models.d.ts +0 -34
  1387. package/services/local-inference/bundled-models.d.ts.map +0 -1
  1388. package/services/local-inference/bundled-models.js +0 -104
  1389. package/services/local-inference/cache-bridge.d.ts +0 -184
  1390. package/services/local-inference/cache-bridge.d.ts.map +0 -1
  1391. package/services/local-inference/cache-bridge.js +0 -333
  1392. package/services/local-inference/catalog.d.ts +0 -57
  1393. package/services/local-inference/catalog.d.ts.map +0 -1
  1394. package/services/local-inference/catalog.js +0 -262
  1395. package/services/local-inference/conversation-registry.d.ts +0 -122
  1396. package/services/local-inference/conversation-registry.d.ts.map +0 -1
  1397. package/services/local-inference/conversation-registry.js +0 -182
  1398. package/services/local-inference/device-bridge.d.ts +0 -139
  1399. package/services/local-inference/device-bridge.d.ts.map +0 -1
  1400. package/services/local-inference/device-bridge.js +0 -774
  1401. package/services/local-inference/dflash-doctor.d.ts +0 -27
  1402. package/services/local-inference/dflash-doctor.d.ts.map +0 -1
  1403. package/services/local-inference/dflash-doctor.js +0 -149
  1404. package/services/local-inference/dflash-server.d.ts +0 -248
  1405. package/services/local-inference/dflash-server.d.ts.map +0 -1
  1406. package/services/local-inference/dflash-server.js +0 -1076
  1407. package/services/local-inference/downloader.d.ts +0 -48
  1408. package/services/local-inference/downloader.d.ts.map +0 -1
  1409. package/services/local-inference/downloader.js +0 -688
  1410. package/services/local-inference/engine.d.ts +0 -282
  1411. package/services/local-inference/engine.d.ts.map +0 -1
  1412. package/services/local-inference/engine.js +0 -743
  1413. package/services/local-inference/external-scanner.d.ts +0 -17
  1414. package/services/local-inference/external-scanner.d.ts.map +0 -1
  1415. package/services/local-inference/external-scanner.js +0 -261
  1416. package/services/local-inference/handler-registry.d.ts +0 -72
  1417. package/services/local-inference/handler-registry.d.ts.map +0 -1
  1418. package/services/local-inference/handler-registry.js +0 -159
  1419. package/services/local-inference/hardware.d.ts +0 -26
  1420. package/services/local-inference/hardware.d.ts.map +0 -1
  1421. package/services/local-inference/hardware.js +0 -139
  1422. package/services/local-inference/hf-search.d.ts +0 -19
  1423. package/services/local-inference/hf-search.d.ts.map +0 -1
  1424. package/services/local-inference/hf-search.js +0 -169
  1425. package/services/local-inference/index.d.ts +0 -10
  1426. package/services/local-inference/index.d.ts.map +0 -1
  1427. package/services/local-inference/index.js +0 -7
  1428. package/services/local-inference/llama-server-metrics.d.ts +0 -108
  1429. package/services/local-inference/llama-server-metrics.d.ts.map +0 -1
  1430. package/services/local-inference/llama-server-metrics.js +0 -175
  1431. package/services/local-inference/manifest/index.d.ts +0 -4
  1432. package/services/local-inference/manifest/index.d.ts.map +0 -1
  1433. package/services/local-inference/manifest/index.js +0 -5
  1434. package/services/local-inference/manifest/schema.d.ts +0 -419
  1435. package/services/local-inference/manifest/schema.d.ts.map +0 -1
  1436. package/services/local-inference/manifest/schema.js +0 -227
  1437. package/services/local-inference/manifest/types.d.ts +0 -23
  1438. package/services/local-inference/manifest/types.d.ts.map +0 -1
  1439. package/services/local-inference/manifest/types.js +0 -5
  1440. package/services/local-inference/manifest/validator.d.ts +0 -43
  1441. package/services/local-inference/manifest/validator.d.ts.map +0 -1
  1442. package/services/local-inference/manifest/validator.js +0 -187
  1443. package/services/local-inference/paths.d.ts +0 -8
  1444. package/services/local-inference/paths.d.ts.map +0 -1
  1445. package/services/local-inference/paths.js +0 -7
  1446. package/services/local-inference/providers.d.ts +0 -61
  1447. package/services/local-inference/providers.d.ts.map +0 -1
  1448. package/services/local-inference/providers.js +0 -334
  1449. package/services/local-inference/ram-budget.d.ts +0 -57
  1450. package/services/local-inference/ram-budget.d.ts.map +0 -1
  1451. package/services/local-inference/ram-budget.js +0 -107
  1452. package/services/local-inference/readiness.d.ts +0 -9
  1453. package/services/local-inference/readiness.d.ts.map +0 -1
  1454. package/services/local-inference/readiness.js +0 -153
  1455. package/services/local-inference/recommendation.d.ts +0 -62
  1456. package/services/local-inference/recommendation.d.ts.map +0 -1
  1457. package/services/local-inference/recommendation.js +0 -309
  1458. package/services/local-inference/registry.d.ts +0 -35
  1459. package/services/local-inference/registry.d.ts.map +0 -1
  1460. package/services/local-inference/registry.js +0 -117
  1461. package/services/local-inference/router-handler.d.ts +0 -51
  1462. package/services/local-inference/router-handler.d.ts.map +0 -1
  1463. package/services/local-inference/router-handler.js +0 -165
  1464. package/services/local-inference/routing-policy.d.ts +0 -55
  1465. package/services/local-inference/routing-policy.d.ts.map +0 -1
  1466. package/services/local-inference/routing-policy.js +0 -195
  1467. package/services/local-inference/routing-preferences.d.ts +0 -8
  1468. package/services/local-inference/routing-preferences.d.ts.map +0 -1
  1469. package/services/local-inference/routing-preferences.js +0 -7
  1470. package/services/local-inference/service.d.ts +0 -88
  1471. package/services/local-inference/service.d.ts.map +0 -1
  1472. package/services/local-inference/service.js +0 -210
  1473. package/services/local-inference/session-pool.d.ts +0 -72
  1474. package/services/local-inference/session-pool.d.ts.map +0 -1
  1475. package/services/local-inference/session-pool.js +0 -125
  1476. package/services/local-inference/types.d.ts +0 -309
  1477. package/services/local-inference/types.d.ts.map +0 -1
  1478. package/services/local-inference/types.js +0 -23
  1479. package/services/local-inference/verify.d.ts +0 -8
  1480. package/services/local-inference/verify.d.ts.map +0 -1
  1481. package/services/local-inference/verify.js +0 -7
  1482. package/services/local-inference/voice/barge-in.d.ts +0 -15
  1483. package/services/local-inference/voice/barge-in.d.ts.map +0 -1
  1484. package/services/local-inference/voice/barge-in.js +0 -20
  1485. package/services/local-inference/voice/engine-bridge.d.ts +0 -256
  1486. package/services/local-inference/voice/engine-bridge.d.ts.map +0 -1
  1487. package/services/local-inference/voice/engine-bridge.js +0 -398
  1488. package/services/local-inference/voice/ffi-bindings.d.ts +0 -114
  1489. package/services/local-inference/voice/ffi-bindings.d.ts.map +0 -1
  1490. package/services/local-inference/voice/ffi-bindings.js +0 -281
  1491. package/services/local-inference/voice/index.d.ts +0 -51
  1492. package/services/local-inference/voice/index.d.ts.map +0 -1
  1493. package/services/local-inference/voice/index.js +0 -50
  1494. package/services/local-inference/voice/lifecycle.d.ts +0 -135
  1495. package/services/local-inference/voice/lifecycle.d.ts.map +0 -1
  1496. package/services/local-inference/voice/lifecycle.js +0 -189
  1497. package/services/local-inference/voice/phoneme-tokenizer.d.ts +0 -58
  1498. package/services/local-inference/voice/phoneme-tokenizer.d.ts.map +0 -1
  1499. package/services/local-inference/voice/phoneme-tokenizer.js +0 -53
  1500. package/services/local-inference/voice/phrase-cache.d.ts +0 -24
  1501. package/services/local-inference/voice/phrase-cache.d.ts.map +0 -1
  1502. package/services/local-inference/voice/phrase-cache.js +0 -32
  1503. package/services/local-inference/voice/phrase-chunker.d.ts +0 -20
  1504. package/services/local-inference/voice/phrase-chunker.d.ts.map +0 -1
  1505. package/services/local-inference/voice/phrase-chunker.js +0 -85
  1506. package/services/local-inference/voice/ring-buffer.d.ts +0 -40
  1507. package/services/local-inference/voice/ring-buffer.d.ts.map +0 -1
  1508. package/services/local-inference/voice/ring-buffer.js +0 -85
  1509. package/services/local-inference/voice/rollback-queue.d.ts +0 -24
  1510. package/services/local-inference/voice/rollback-queue.d.ts.map +0 -1
  1511. package/services/local-inference/voice/rollback-queue.js +0 -49
  1512. package/services/local-inference/voice/scheduler.d.ts +0 -47
  1513. package/services/local-inference/voice/scheduler.d.ts.map +0 -1
  1514. package/services/local-inference/voice/scheduler.js +0 -123
  1515. package/services/local-inference/voice/shared-resources.d.ts +0 -119
  1516. package/services/local-inference/voice/shared-resources.d.ts.map +0 -1
  1517. package/services/local-inference/voice/shared-resources.js +0 -83
  1518. package/services/local-inference/voice/speaker-preset-cache.d.ts +0 -28
  1519. package/services/local-inference/voice/speaker-preset-cache.d.ts.map +0 -1
  1520. package/services/local-inference/voice/speaker-preset-cache.js +0 -44
  1521. package/services/local-inference/voice/types.d.ts +0 -80
  1522. package/services/local-inference/voice/types.d.ts.map +0 -1
  1523. package/services/local-inference/voice/voice-preset-format.d.ts +0 -56
  1524. package/services/local-inference/voice/voice-preset-format.d.ts.map +0 -1
  1525. package/services/local-inference/voice/voice-preset-format.js +0 -184
  1526. package/services/plugin-installer.d.ts +0 -22
  1527. package/services/plugin-installer.d.ts.map +0 -1
  1528. package/services/plugin-installer.js +0 -41
  1529. package/test/scripts/task-agent-live-smoke.ts +0 -1335
  1530. /package/services/{local-inference/voice → ambient-audio}/types.js +0 -0
@@ -0,0 +1,1943 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Physical iOS runtime smoke for the Eliza-1 local-inference xcframework.
4
+ *
5
+ * This is intentionally device-only. Simulator and macOS Metal runs prove
6
+ * shader correctness, but they do not prove the Capacitor-consumed iOS
7
+ * artifact can link, launch, and resolve the required runtime symbols on a
8
+ * real iPhone/iPad. If no physical iOS device is attached, this script exits
9
+ * non-zero with an explicit diagnostic.
10
+ *
11
+ * The smoke creates a temporary hosted iOS XCTest project instead of editing
12
+ * the checked-in Capacitor Xcode project. Physical iOS devices cannot run
13
+ * SwiftPM tool-hosted tests, so the generated project contains a tiny host app
14
+ * plus a unit-test bundle. The host app links the same LlamaCpp.xcframework
15
+ * slot used by llama-cpp-capacitor, force-loads its static archive, then runs
16
+ * these checks on the physical device:
17
+ *
18
+ * - Metal is available through MTLCreateSystemDefaultDevice().
19
+ * - LlamaCpp bridge symbols resolve.
20
+ * - QJL / Polar / MTP runtime symbols resolve.
21
+ * - libelizainference voice ABI symbols resolve, unless explicitly disabled
22
+ * with --skip-voice-abi for diagnosis.
23
+ *
24
+ * No model weights are bundled here, so this does not claim text/voice
25
+ * numerical generation. It is the device-runtime gate that must pass before a
26
+ * real Eliza-1 bundle smoke can run.
27
+ */
28
+
29
+ import { spawn, spawnSync } from "node:child_process";
30
+ import fs from "node:fs";
31
+ import os from "node:os";
32
+ import path from "node:path";
33
+ import process from "node:process";
34
+ import { fileURLToPath } from "node:url";
35
+
36
+ const __filename = fileURLToPath(import.meta.url);
37
+ const __dirname = path.dirname(__filename);
38
+ const REPO_ROOT = path.resolve(__dirname, "..", "..", "..", "..");
39
+ const APP_DIR = path.join(REPO_ROOT, "packages", "app");
40
+ const XCFRAMEWORK_BUILD_SCRIPT = path.join(__dirname, "build-xcframework.mjs");
41
+
42
+ const LLAMA_SYMBOLS = [
43
+ "llama_init_context",
44
+ "llama_release_context",
45
+ "llama_completion",
46
+ "llama_stop_completion",
47
+ "llama_get_formatted_chat",
48
+ "llama_toggle_native_log",
49
+ "llama_embedding",
50
+ "llama_embedding_register_context",
51
+ "llama_embedding_unregister_context",
52
+ "llama_get_model_info",
53
+ "llama_get_context_ptr",
54
+ "llama_get_last_error",
55
+ "llama_free_string",
56
+ ];
57
+
58
+ const KERNEL_SYMBOLS = [
59
+ "ggml_attn_score_qjl",
60
+ "ggml_compute_forward_attn_score_qjl",
61
+ "dequantize_row_qjl1_256",
62
+ "quantize_qjl1_256",
63
+ "dequantize_row_q4_polar",
64
+ "quantize_q4_polar",
65
+ "llama_decode",
66
+ ];
67
+
68
+ const VOICE_ABI_SYMBOLS = [
69
+ "eliza_inference_abi_version",
70
+ "eliza_inference_create",
71
+ "eliza_inference_destroy",
72
+ "eliza_inference_mmap_acquire",
73
+ "eliza_inference_mmap_evict",
74
+ "eliza_inference_tts_synthesize",
75
+ "eliza_inference_asr_transcribe",
76
+ "eliza_inference_free_string",
77
+ ];
78
+
79
+ const EXIT = {
80
+ noDevice: 20,
81
+ missingXcframework: 21,
82
+ localPreflight: 22,
83
+ xcodebuildFailed: 23,
84
+ };
85
+
86
+ const DEFAULT_DESTINATION_TIMEOUT_SECONDS = 45;
87
+ const DEFAULT_XCODEBUILD_TIMEOUT_MS = 5 * 60 * 1000;
88
+ const DEFAULT_XCODEBUILD_IDLE_TIMEOUT_MS = 90 * 1000;
89
+ const BENCHMARK_XCODEBUILD_TIMEOUT_MS = 20 * 60 * 1000;
90
+ const BENCHMARK_XCODEBUILD_IDLE_TIMEOUT_MS = 10 * 60 * 1000;
91
+ const XCODEBUILD_PROGRESS_INTERVAL_MS = 30 * 1000;
92
+
93
+ function parseIntegerOption(name, value, { min = 1 } = {}) {
94
+ const parsed = Number(value);
95
+ if (!Number.isInteger(parsed) || parsed < min) {
96
+ throw new Error(`${name} must be an integer >= ${min}`);
97
+ }
98
+ return parsed;
99
+ }
100
+
101
+ function parseIntegerEnv(name, { min = 1 } = {}) {
102
+ const value = process.env[name]?.trim();
103
+ if (!value) return null;
104
+ return parseIntegerOption(name, value, { min });
105
+ }
106
+
107
+ function parseArgs(argv) {
108
+ const args = {
109
+ xcframework: null,
110
+ deviceId: null,
111
+ buildIfMissing: false,
112
+ skipVoiceAbi: false,
113
+ keepTemp: false,
114
+ report: null,
115
+ benchmarkModel: null,
116
+ derivedDataPath: null,
117
+ resultBundlePath: null,
118
+ developmentTeam: process.env.ELIZA_IOS_DEVELOPMENT_TEAM ?? null,
119
+ destinationTimeoutSeconds:
120
+ parseIntegerEnv("ELIZA_IOS_DESTINATION_TIMEOUT_SECONDS") ??
121
+ DEFAULT_DESTINATION_TIMEOUT_SECONDS,
122
+ xcodebuildTimeoutMs: parseIntegerEnv("ELIZA_IOS_XCODEBUILD_TIMEOUT_MS"),
123
+ xcodebuildIdleTimeoutMs: parseIntegerEnv(
124
+ "ELIZA_IOS_XCODEBUILD_IDLE_TIMEOUT_MS",
125
+ ),
126
+ xcodebuildProgressIntervalMs:
127
+ parseIntegerEnv("ELIZA_IOS_XCODEBUILD_PROGRESS_INTERVAL_MS") ??
128
+ XCODEBUILD_PROGRESS_INTERVAL_MS,
129
+ collectTestDiagnostics:
130
+ process.env.ELIZA_IOS_COLLECT_TEST_DIAGNOSTICS ?? "never",
131
+ xcodebuildArgs: [],
132
+ };
133
+
134
+ for (let i = 0; i < argv.length; i++) {
135
+ const a = argv[i];
136
+ const next = () => {
137
+ i += 1;
138
+ if (i >= argv.length) throw new Error(`${a} requires a value`);
139
+ return argv[i];
140
+ };
141
+ switch (a) {
142
+ case "--xcframework":
143
+ args.xcframework = next();
144
+ break;
145
+ case "--device-id":
146
+ args.deviceId = next();
147
+ break;
148
+ case "--build-if-missing":
149
+ args.buildIfMissing = true;
150
+ break;
151
+ case "--skip-voice-abi":
152
+ args.skipVoiceAbi = true;
153
+ break;
154
+ case "--keep-temp":
155
+ args.keepTemp = true;
156
+ break;
157
+ case "--report":
158
+ args.report = next();
159
+ break;
160
+ case "--benchmark-model":
161
+ args.benchmarkModel = next();
162
+ break;
163
+ case "--derived-data-path":
164
+ args.derivedDataPath = next();
165
+ break;
166
+ case "--result-bundle-path":
167
+ args.resultBundlePath = next();
168
+ break;
169
+ case "--destination-timeout-seconds":
170
+ case "--destination-timeout":
171
+ args.destinationTimeoutSeconds = parseIntegerOption(a, next());
172
+ break;
173
+ case "--xcodebuild-timeout-ms":
174
+ args.xcodebuildTimeoutMs = parseIntegerOption(a, next());
175
+ break;
176
+ case "--xcodebuild-idle-timeout-ms":
177
+ args.xcodebuildIdleTimeoutMs = parseIntegerOption(a, next());
178
+ break;
179
+ case "--xcodebuild-progress-interval-ms":
180
+ args.xcodebuildProgressIntervalMs = parseIntegerOption(a, next());
181
+ break;
182
+ case "--collect-test-diagnostics": {
183
+ const value = next();
184
+ if (!["never", "on-failure"].includes(value)) {
185
+ throw new Error(
186
+ "--collect-test-diagnostics must be one of: never, on-failure",
187
+ );
188
+ }
189
+ args.collectTestDiagnostics = value;
190
+ break;
191
+ }
192
+ case "--development-team":
193
+ args.developmentTeam = next();
194
+ break;
195
+ case "--xcodebuild-arg":
196
+ args.xcodebuildArgs.push(next());
197
+ break;
198
+ case "--help":
199
+ case "-h":
200
+ printHelp();
201
+ process.exit(0);
202
+ default:
203
+ throw new Error(`Unknown argument: ${a}`);
204
+ }
205
+ }
206
+ if (!["never", "on-failure"].includes(args.collectTestDiagnostics)) {
207
+ throw new Error(
208
+ "ELIZA_IOS_COLLECT_TEST_DIAGNOSTICS must be one of: never, on-failure",
209
+ );
210
+ }
211
+ return args;
212
+ }
213
+
214
+ function printHelp() {
215
+ process.stdout.write(`Usage: node packages/app-core/scripts/ios-xcframework/run-physical-device-smoke.mjs [options]
216
+
217
+ Runs a physical-device XCTest smoke against the Eliza-1 LlamaCpp.xcframework.
218
+ This command refuses to run against simulators.
219
+
220
+ Options:
221
+ --xcframework <path> LlamaCpp.xcframework to test. Defaults to the
222
+ llama-cpp-capacitor xcframework slot, then the
223
+ smoke output under $ELIZA_STATE_DIR.
224
+ --device-id <udid> Physical iPhone/iPad UDID. If omitted, the first
225
+ connected physical iOS device is used.
226
+ --build-if-missing Build/package the xcframework first if missing.
227
+ --development-team <team> Apple Developer Team ID for XCTest signing.
228
+ Defaults to ELIZA_IOS_DEVELOPMENT_TEAM.
229
+ --skip-voice-abi Diagnostic only: do not require libelizainference
230
+ voice ABI symbols. Default is to require them.
231
+ --derived-data-path <path> Override xcodebuild DerivedData path.
232
+ --result-bundle-path <path> Override xcodebuild result bundle path.
233
+ --destination-timeout <sec> Fail device destination lookup after this many
234
+ seconds. Default: ${DEFAULT_DESTINATION_TIMEOUT_SECONDS}.
235
+ --xcodebuild-timeout-ms <n> Kill xcodebuild after total elapsed ms. Default:
236
+ ${DEFAULT_XCODEBUILD_TIMEOUT_MS} without
237
+ --benchmark-model, ${BENCHMARK_XCODEBUILD_TIMEOUT_MS}
238
+ with one.
239
+ --xcodebuild-idle-timeout-ms <n>
240
+ Kill xcodebuild after this many ms with no
241
+ stdout/stderr. Default: ${DEFAULT_XCODEBUILD_IDLE_TIMEOUT_MS}
242
+ without --benchmark-model,
243
+ ${BENCHMARK_XCODEBUILD_IDLE_TIMEOUT_MS} with one.
244
+ --collect-test-diagnostics <never|on-failure>
245
+ Controls xcodebuild sysdiagnose collection.
246
+ Default: never, to avoid hanging on locked
247
+ physical devices.
248
+ --xcodebuild-arg <arg> Append one raw xcodebuild argument. Repeatable.
249
+ --report <path> Write a JSON report after success/failure.
250
+ --benchmark-model <path> Optional GGUF to bundle into the host app and
251
+ benchmark with llama_init_context/completion on
252
+ physical-device CPU and Metal.
253
+ --keep-temp Keep the generated temporary XCTest project.
254
+ -h, --help Print this message.
255
+
256
+ Typical device run:
257
+ ELIZA_IOS_DEVELOPMENT_TEAM=ABCDE12345 \\
258
+ node packages/app-core/scripts/ios-xcframework/run-physical-device-smoke.mjs \\
259
+ --build-if-missing \\
260
+ --report packages/inference/reports/porting/2026-05-11/ios_device_smoke.json
261
+ `);
262
+ }
263
+
264
+ function elizaStateDir() {
265
+ const env = process.env.ELIZA_STATE_DIR?.trim();
266
+ return env || path.join(os.homedir(), ".eliza");
267
+ }
268
+
269
+ function defaultSmokeXcframeworkPath() {
270
+ return path.join(
271
+ elizaStateDir(),
272
+ "local-inference",
273
+ "bin",
274
+ "mtp",
275
+ "ios-physical-smoke",
276
+ "LlamaCpp.xcframework",
277
+ );
278
+ }
279
+
280
+ function defaultXcframeworkCandidates() {
281
+ return [
282
+ path.join(
283
+ APP_DIR,
284
+ "node_modules",
285
+ "llama-cpp-capacitor",
286
+ "ios",
287
+ "Frameworks-xcframework",
288
+ "LlamaCpp.xcframework",
289
+ ),
290
+ path.join(
291
+ REPO_ROOT,
292
+ "node_modules",
293
+ "llama-cpp-capacitor",
294
+ "ios",
295
+ "Frameworks-xcframework",
296
+ "LlamaCpp.xcframework",
297
+ ),
298
+ defaultSmokeXcframeworkPath(),
299
+ ];
300
+ }
301
+
302
+ function firstExisting(paths) {
303
+ for (const p of paths) {
304
+ if (p && fs.existsSync(p)) return p;
305
+ }
306
+ return null;
307
+ }
308
+
309
+ function detectDefaultDevelopmentTeam() {
310
+ const candidates = [
311
+ path.join(APP_DIR, "ios", "App", "App.xcodeproj", "project.pbxproj"),
312
+ path.join(
313
+ REPO_ROOT,
314
+ "packages",
315
+ "app-core",
316
+ "platforms",
317
+ "ios",
318
+ "App",
319
+ "App.xcodeproj",
320
+ "project.pbxproj",
321
+ ),
322
+ ];
323
+ for (const candidate of candidates) {
324
+ try {
325
+ const text = fs.readFileSync(candidate, "utf8");
326
+ const match = text.match(/DEVELOPMENT_TEAM\s*=\s*([A-Z0-9]+);/);
327
+ if (match?.[1]) return match[1];
328
+ } catch {
329
+ // Keep looking; a missing app checkout should not block smoke setup.
330
+ }
331
+ }
332
+ return null;
333
+ }
334
+
335
+ function runCapture(cmd, args, opts = {}) {
336
+ const result = spawnSync(cmd, args, {
337
+ encoding: "utf8",
338
+ stdio: ["ignore", "pipe", "pipe"],
339
+ cwd: opts.cwd,
340
+ env: { ...process.env, ...(opts.env ?? {}) },
341
+ timeout: opts.timeout ?? 120_000,
342
+ maxBuffer: opts.maxBuffer ?? 64 * 1024 * 1024,
343
+ });
344
+ return {
345
+ status: result.status,
346
+ signal: result.signal,
347
+ stdout: result.stdout ?? "",
348
+ stderr: result.stderr ?? "",
349
+ error: result.error,
350
+ };
351
+ }
352
+
353
+ function summarizeText(text, maxChars = 16_000) {
354
+ if (!text || text.length <= maxChars) return text ?? "";
355
+ return text.slice(text.length - maxChars);
356
+ }
357
+
358
+ function commandMetadata(cmd, args, opts = {}) {
359
+ const result = runCapture(cmd, args, opts);
360
+ return {
361
+ command: [cmd, ...args],
362
+ status: result.status,
363
+ signal: result.signal,
364
+ stdout: summarizeText(result.stdout, 4_000),
365
+ stderr: summarizeText(result.stderr, 4_000),
366
+ error: result.error ? String(result.error) : null,
367
+ };
368
+ }
369
+
370
+ function appendBounded(buffer, chunk, maxChars) {
371
+ const next = `${buffer}${chunk}`;
372
+ if (next.length <= maxChars) return next;
373
+ return next.slice(next.length - maxChars);
374
+ }
375
+
376
+ function formatDurationMs(ms) {
377
+ const seconds = Math.max(0, Math.round(ms / 1000));
378
+ const minutes = Math.floor(seconds / 60);
379
+ const remainder = seconds % 60;
380
+ return minutes > 0 ? `${minutes}m ${remainder}s` : `${remainder}s`;
381
+ }
382
+
383
+ function lastNonEmptyLine(text) {
384
+ const lines = (text ?? "")
385
+ .split(/\r?\n/)
386
+ .map((line) => line.trim())
387
+ .filter(Boolean);
388
+ return lines.length > 0 ? lines[lines.length - 1] : "";
389
+ }
390
+
391
+ function runStreamingCapture(cmd, args, opts = {}) {
392
+ return new Promise((resolve) => {
393
+ const startedAtMs = Date.now();
394
+ const startedAt = new Date(startedAtMs).toISOString();
395
+ const maxBuffer = opts.maxBuffer ?? 64 * 1024 * 1024;
396
+ let stdout = "";
397
+ let stderr = "";
398
+ let lastOutputAtMs = startedAtMs;
399
+ let lastOutputAt = startedAt;
400
+ let lastOutputStream = null;
401
+ let lastOutputLine = "";
402
+ let timeoutReason = null;
403
+ let spawnError = null;
404
+ let killTimer = null;
405
+
406
+ const child = spawn(cmd, args, {
407
+ stdio: ["ignore", "pipe", "pipe"],
408
+ cwd: opts.cwd,
409
+ env: { ...process.env, ...(opts.env ?? {}) },
410
+ });
411
+
412
+ const onData = (streamName, chunk) => {
413
+ const text = chunk.toString("utf8");
414
+ if (streamName === "stdout") {
415
+ stdout = appendBounded(stdout, text, maxBuffer);
416
+ process.stdout.write(text);
417
+ } else {
418
+ stderr = appendBounded(stderr, text, maxBuffer);
419
+ process.stderr.write(text);
420
+ }
421
+ lastOutputAtMs = Date.now();
422
+ lastOutputAt = new Date(lastOutputAtMs).toISOString();
423
+ lastOutputStream = streamName;
424
+ lastOutputLine = lastNonEmptyLine(text) || lastOutputLine;
425
+ };
426
+
427
+ child.stdout.on("data", (chunk) => onData("stdout", chunk));
428
+ child.stderr.on("data", (chunk) => onData("stderr", chunk));
429
+ child.on("error", (err) => {
430
+ spawnError = err;
431
+ });
432
+
433
+ const terminate = (reason) => {
434
+ if (timeoutReason) return;
435
+ timeoutReason = reason;
436
+ const elapsed = Date.now() - startedAtMs;
437
+ const lastOutputAgo = Date.now() - lastOutputAtMs;
438
+ process.stderr.write(
439
+ `[ios-smoke] ${cmd} ${reason}; terminating after ${formatDurationMs(
440
+ elapsed,
441
+ )}. Last output was ${formatDurationMs(lastOutputAgo)} ago` +
442
+ `${lastOutputLine ? `: ${lastOutputLine.slice(0, 240)}` : "."}\n`,
443
+ );
444
+ child.kill("SIGTERM");
445
+ killTimer = setTimeout(() => {
446
+ child.kill("SIGKILL");
447
+ }, 10_000);
448
+ };
449
+
450
+ const timeoutTimer = opts.timeoutMs
451
+ ? setTimeout(() => terminate("timeout"), opts.timeoutMs)
452
+ : null;
453
+ const idleTimer = opts.idleTimeoutMs
454
+ ? setInterval(
455
+ () => {
456
+ if (Date.now() - lastOutputAtMs >= opts.idleTimeoutMs) {
457
+ terminate("idle-timeout");
458
+ }
459
+ },
460
+ Math.min(opts.idleTimeoutMs, 5_000),
461
+ )
462
+ : null;
463
+ const progressTimer = opts.progressIntervalMs
464
+ ? setInterval(() => {
465
+ const elapsed = Date.now() - startedAtMs;
466
+ const lastOutputAgo = Date.now() - lastOutputAtMs;
467
+ process.stderr.write(
468
+ `[ios-smoke] ${cmd} still running after ${formatDurationMs(
469
+ elapsed,
470
+ )}; last output ${formatDurationMs(lastOutputAgo)} ago` +
471
+ `${lastOutputLine ? `: ${lastOutputLine.slice(0, 240)}` : "."}\n`,
472
+ );
473
+ }, opts.progressIntervalMs)
474
+ : null;
475
+
476
+ child.on("close", (status, signal) => {
477
+ if (timeoutTimer) clearTimeout(timeoutTimer);
478
+ if (idleTimer) clearInterval(idleTimer);
479
+ if (progressTimer) clearInterval(progressTimer);
480
+ if (killTimer) clearTimeout(killTimer);
481
+ const finishedAtMs = Date.now();
482
+ resolve({
483
+ status,
484
+ signal,
485
+ stdout,
486
+ stderr,
487
+ error: spawnError,
488
+ startedAt,
489
+ finishedAt: new Date(finishedAtMs).toISOString(),
490
+ elapsedMs: finishedAtMs - startedAtMs,
491
+ timeoutMs: opts.timeoutMs ?? null,
492
+ idleTimeoutMs: opts.idleTimeoutMs ?? null,
493
+ timeoutReason,
494
+ timedOut: timeoutReason === "timeout",
495
+ idleTimedOut: timeoutReason === "idle-timeout",
496
+ lastOutputAt,
497
+ lastOutputStream,
498
+ lastOutputLine,
499
+ });
500
+ });
501
+ });
502
+ }
503
+
504
+ function runInherit(cmd, args, opts = {}) {
505
+ const result = spawnSync(cmd, args, {
506
+ stdio: "inherit",
507
+ cwd: opts.cwd,
508
+ env: { ...process.env, ...(opts.env ?? {}) },
509
+ });
510
+ if (result.status !== 0) {
511
+ throw new Error(`${cmd} ${args.join(" ")} failed with ${result.status}`);
512
+ }
513
+ }
514
+
515
+ function ensureTool(name) {
516
+ const result = runCapture("xcrun", ["--find", name], { timeout: 30_000 });
517
+ if (result.status !== 0 || !result.stdout.trim()) {
518
+ throw new Error(
519
+ `[ios-smoke] required Xcode tool not found via xcrun: ${name}`,
520
+ );
521
+ }
522
+ }
523
+
524
+ function parsePlistJson(plistPath) {
525
+ const result = runCapture(
526
+ "plutil",
527
+ ["-convert", "json", "-o", "-", plistPath],
528
+ {
529
+ timeout: 30_000,
530
+ },
531
+ );
532
+ if (result.status !== 0) {
533
+ throw Object.assign(
534
+ new Error(
535
+ `[ios-smoke] failed to parse ${plistPath} with plutil\n${result.stderr}`,
536
+ ),
537
+ { exitCode: EXIT.localPreflight },
538
+ );
539
+ }
540
+ try {
541
+ return JSON.parse(result.stdout);
542
+ } catch (err) {
543
+ throw Object.assign(
544
+ new Error(
545
+ `[ios-smoke] malformed JSON from plutil for ${plistPath}: ${err}`,
546
+ ),
547
+ { exitCode: EXIT.localPreflight },
548
+ );
549
+ }
550
+ }
551
+
552
+ function validateXcframeworkDeviceSlice(xcframework) {
553
+ const infoPlist = path.join(xcframework, "Info.plist");
554
+ if (!fs.existsSync(infoPlist)) {
555
+ throw Object.assign(
556
+ new Error(`[ios-smoke] xcframework is missing Info.plist: ${infoPlist}`),
557
+ { exitCode: EXIT.localPreflight },
558
+ );
559
+ }
560
+ const info = parsePlistJson(infoPlist);
561
+ const libraries = Array.isArray(info.AvailableLibraries)
562
+ ? info.AvailableLibraries
563
+ : [];
564
+ const deviceLibraries = libraries.filter((library) => {
565
+ const platform = library.SupportedPlatform;
566
+ const variant = library.SupportedPlatformVariant;
567
+ const archs = Array.isArray(library.SupportedArchitectures)
568
+ ? library.SupportedArchitectures
569
+ : [];
570
+ return platform === "ios" && !variant && archs.includes("arm64");
571
+ });
572
+ if (deviceLibraries.length !== 1) {
573
+ throw Object.assign(
574
+ new Error(
575
+ `[ios-smoke] xcframework must contain exactly one ios arm64 physical-device slice; found ${deviceLibraries.length} in ${infoPlist}`,
576
+ ),
577
+ { exitCode: EXIT.localPreflight, xcframeworkInfo: info },
578
+ );
579
+ }
580
+ const library = deviceLibraries[0];
581
+ const libraryPath = path.join(xcframework, library.LibraryIdentifier);
582
+ if (!fs.existsSync(libraryPath)) {
583
+ throw Object.assign(
584
+ new Error(
585
+ `[ios-smoke] xcframework device slice path is missing: ${libraryPath}`,
586
+ ),
587
+ { exitCode: EXIT.localPreflight, xcframeworkInfo: info },
588
+ );
589
+ }
590
+ return { infoPlist, library };
591
+ }
592
+
593
+ function parseXctraceDevices(text) {
594
+ /** @type {{ section: string, name: string, version: string | null, id: string }[]} */
595
+ const connected = [];
596
+ /** @type {{ section: string, name: string, version: string | null, id: string }[]} */
597
+ const offline = [];
598
+ let section = "";
599
+
600
+ for (const raw of text.split(/\r?\n/)) {
601
+ const line = raw.trim();
602
+ if (!line) continue;
603
+ const sectionMatch = line.match(/^==\s*(.+?)\s*==$/);
604
+ if (sectionMatch) {
605
+ section = sectionMatch[1];
606
+ continue;
607
+ }
608
+ const m = line.match(/^(.+?)\s+\(([^()]*)\)\s+\(([0-9A-Fa-f-]{8,})\)$/);
609
+ if (!m) continue;
610
+ const [, name, version, id] = m;
611
+ const isIosPhysicalName = /\b(iPhone|iPad|iPod)\b/i.test(name);
612
+ if (!isIosPhysicalName) continue;
613
+ const record = { section, name, version, id };
614
+ if (section === "Devices") connected.push(record);
615
+ if (section === "Devices Offline") offline.push(record);
616
+ }
617
+ return { connected, offline };
618
+ }
619
+
620
+ function parseDevicectlDevices(text) {
621
+ /** @type {{ section: string, name: string, version: string | null, id: string, hostname?: string, state?: string, model?: string, idSource?: string }[]} */
622
+ const connected = [];
623
+ /** @type {{ section: string, name: string, version: string | null, id: string, hostname?: string, state?: string, model?: string, idSource?: string }[]} */
624
+ const offline = [];
625
+
626
+ for (const raw of text.split(/\r?\n/)) {
627
+ const line = raw.trim();
628
+ if (
629
+ !line ||
630
+ /^-+$/.test(line) ||
631
+ /^Name\s+Hostname\s+Identifier\s+State\s+Model/i.test(line)
632
+ ) {
633
+ continue;
634
+ }
635
+ const cols = line.split(/\s{2,}/).map((part) => part.trim());
636
+ if (cols.length < 5) continue;
637
+ const [name, hostname, id, state, model] = cols;
638
+ const isIosPhysical =
639
+ /\b(iPhone|iPad|iPod)\b/i.test(name) ||
640
+ /\b(iPhone|iPad|iPod)\b/i.test(model);
641
+ if (!isIosPhysical) continue;
642
+ const record = {
643
+ section: "CoreDevice",
644
+ name,
645
+ version: null,
646
+ id,
647
+ hostname,
648
+ state,
649
+ model,
650
+ idSource: "devicectl",
651
+ };
652
+ if (
653
+ /(available|connected)/i.test(state) &&
654
+ !/unavailable|offline|disconnected/i.test(state)
655
+ ) {
656
+ connected.push(record);
657
+ } else {
658
+ offline.push(record);
659
+ }
660
+ }
661
+ return { connected, offline };
662
+ }
663
+
664
+ function escapeRegExp(value) {
665
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
666
+ }
667
+
668
+ function parseBulletValue(text, key) {
669
+ const match = text.match(
670
+ new RegExp(`•\\s+${escapeRegExp(key)}:\\s*([^\\n]+)`),
671
+ );
672
+ return match?.[1]?.trim() ?? null;
673
+ }
674
+
675
+ function parseDevicectlDetails(text) {
676
+ return {
677
+ identifier: parseBulletValue(text, "identifier"),
678
+ name: parseBulletValue(text, "name"),
679
+ marketingName: parseBulletValue(text, "marketingName"),
680
+ productType: parseBulletValue(text, "productType"),
681
+ platform: parseBulletValue(text, "platform"),
682
+ reality: parseBulletValue(text, "reality"),
683
+ udid: parseBulletValue(text, "udid"),
684
+ osVersionNumber: parseBulletValue(text, "osVersionNumber"),
685
+ osBuildUpdate: parseBulletValue(text, "osBuildUpdate"),
686
+ bootState: parseBulletValue(text, "bootState"),
687
+ ddiServicesAvailable: parseBulletValue(text, "ddiServicesAvailable"),
688
+ developerModeStatus: parseBulletValue(text, "developerModeStatus"),
689
+ authenticationType: parseBulletValue(text, "authenticationType"),
690
+ pairingState: parseBulletValue(text, "pairingState"),
691
+ transportType: parseBulletValue(text, "transportType"),
692
+ tunnelState: parseBulletValue(text, "tunnelState"),
693
+ };
694
+ }
695
+
696
+ function parseDevicectlLockState(text) {
697
+ return {
698
+ deviceIdentifier: parseBulletValue(text, "deviceIdentifier"),
699
+ passcodeRequired: parseBulletValue(text, "passcodeRequired"),
700
+ unlockedSinceBoot: parseBulletValue(text, "unlockedSinceBoot"),
701
+ };
702
+ }
703
+
704
+ function devicectlInfoMetadata(args, parser) {
705
+ const result = runCapture("xcrun", args, { timeout: 30_000 });
706
+ return {
707
+ command: ["xcrun", ...args],
708
+ status: result.status,
709
+ signal: result.signal,
710
+ stdout: summarizeText(result.stdout, 8_000),
711
+ stderr: summarizeText(result.stderr, 4_000),
712
+ summary: result.status === 0 ? parser(result.stdout) : null,
713
+ error: result.error ? String(result.error) : null,
714
+ };
715
+ }
716
+
717
+ function captureDeviceDiagnostics(deviceId) {
718
+ return {
719
+ capturedAt: new Date().toISOString(),
720
+ details: devicectlInfoMetadata(
721
+ ["devicectl", "device", "info", "details", "--device", deviceId],
722
+ parseDevicectlDetails,
723
+ ),
724
+ lockState: devicectlInfoMetadata(
725
+ ["devicectl", "device", "info", "lockState", "--device", deviceId],
726
+ parseDevicectlLockState,
727
+ ),
728
+ };
729
+ }
730
+
731
+ function captureUnavailableDeviceDiagnostics(devices) {
732
+ const offline = Array.isArray(devices?.offline) ? devices.offline : [];
733
+ return {
734
+ capturedAt: new Date().toISOString(),
735
+ unavailablePhysicalDevices: offline.slice(0, 5).map((device) => {
736
+ const details = devicectlInfoMetadata(
737
+ ["devicectl", "device", "info", "details", "--device", device.id],
738
+ parseDevicectlDetails,
739
+ );
740
+ const detailSummary = details.summary;
741
+ const lockStateDeviceId =
742
+ detailSummary?.udid || detailSummary?.identifier || device.id;
743
+ return {
744
+ device,
745
+ details,
746
+ lockState: devicectlInfoMetadata(
747
+ [
748
+ "devicectl",
749
+ "device",
750
+ "info",
751
+ "lockState",
752
+ "--device",
753
+ lockStateDeviceId,
754
+ ],
755
+ parseDevicectlLockState,
756
+ ),
757
+ };
758
+ }),
759
+ };
760
+ }
761
+
762
+ function mergeDeviceLists(primary, secondary) {
763
+ const byId = new Map();
764
+ for (const record of [...primary, ...secondary]) {
765
+ if (!byId.has(record.id)) {
766
+ byId.set(record.id, record);
767
+ }
768
+ }
769
+ return [...byId.values()];
770
+ }
771
+
772
+ function listPhysicalIosDevices() {
773
+ const xctrace = runCapture("xcrun", ["xctrace", "list", "devices"], {
774
+ timeout: 90_000,
775
+ });
776
+ if (xctrace.status !== 0) {
777
+ throw new Error(
778
+ `[ios-smoke] xcrun xctrace list devices failed with ${xctrace.status}\n${xctrace.stderr}`,
779
+ );
780
+ }
781
+ const xctraceDevices = parseXctraceDevices(xctrace.stdout);
782
+ const devicectl = runCapture("xcrun", ["devicectl", "list", "devices"], {
783
+ timeout: 90_000,
784
+ });
785
+ const coreDevices =
786
+ devicectl.status === 0
787
+ ? parseDevicectlDevices(devicectl.stdout)
788
+ : { connected: [], offline: [] };
789
+ return {
790
+ connected: mergeDeviceLists(
791
+ xctraceDevices.connected,
792
+ coreDevices.connected,
793
+ ),
794
+ offline: mergeDeviceLists(xctraceDevices.offline, coreDevices.offline),
795
+ raw: xctrace.stdout,
796
+ xctraceRaw: xctrace.stdout,
797
+ devicectlRaw: devicectl.stdout,
798
+ devicectlError:
799
+ devicectl.status === 0
800
+ ? null
801
+ : devicectl.error
802
+ ? String(devicectl.error)
803
+ : devicectl.stderr,
804
+ };
805
+ }
806
+
807
+ function resolveDevice(deviceId) {
808
+ const devices = listPhysicalIosDevices();
809
+ if (deviceId) {
810
+ const exact = devices.connected.find((d) => d.id === deviceId);
811
+ if (exact) return { device: exact, devices };
812
+ const offline = devices.offline.find((d) => d.id === deviceId);
813
+ const suffix = offline
814
+ ? `\nRequested device is present but offline: ${offline.name} (${offline.version}) ${offline.id}`
815
+ : "";
816
+ throw Object.assign(
817
+ new Error(
818
+ `[ios-smoke] requested physical iOS device is not connected: ${deviceId}${suffix}`,
819
+ ),
820
+ { exitCode: EXIT.noDevice, devices },
821
+ );
822
+ }
823
+ if (devices.connected.length > 0) {
824
+ return { device: devices.connected[0], devices };
825
+ }
826
+ const offlineLines = devices.offline.length
827
+ ? `\nOffline physical iOS devices seen:\n${devices.offline
828
+ .map((d) => ` - ${d.name} (${d.version ?? "unknown"}) ${d.id}`)
829
+ .join("\n")}`
830
+ : "";
831
+ throw Object.assign(
832
+ new Error(
833
+ `[ios-smoke] no connected physical iOS device found. Connect, unlock, trust the iPhone/iPad, enable Developer Mode, then rerun.${offlineLines}`,
834
+ ),
835
+ { exitCode: EXIT.noDevice, devices },
836
+ );
837
+ }
838
+
839
+ function ensureXcframework(args) {
840
+ if (args.xcframework) {
841
+ const resolved = path.resolve(args.xcframework);
842
+ if (!fs.existsSync(resolved)) {
843
+ throw Object.assign(
844
+ new Error(`[ios-smoke] --xcframework path does not exist: ${resolved}`),
845
+ { exitCode: EXIT.missingXcframework },
846
+ );
847
+ }
848
+ return resolved;
849
+ }
850
+
851
+ const existing = firstExisting(defaultXcframeworkCandidates());
852
+ if (existing) {
853
+ try {
854
+ locateDeviceFrameworkBinary(existing);
855
+ return existing;
856
+ } catch (err) {
857
+ if (!args.buildIfMissing) throw err;
858
+ console.warn(
859
+ `[ios-smoke] existing LlamaCpp.xcframework is not device-smokeable; rebuilding into smoke output: ${err.message}`,
860
+ );
861
+ }
862
+ }
863
+
864
+ if (!args.buildIfMissing) {
865
+ throw Object.assign(
866
+ new Error(
867
+ `[ios-smoke] LlamaCpp.xcframework not found in default locations:\n` +
868
+ defaultXcframeworkCandidates()
869
+ .map((p) => ` - ${p}`)
870
+ .join("\n") +
871
+ `\nRun with --build-if-missing, or pass --xcframework <path>.`,
872
+ ),
873
+ { exitCode: EXIT.missingXcframework },
874
+ );
875
+ }
876
+
877
+ const output = defaultSmokeXcframeworkPath();
878
+ fs.mkdirSync(path.dirname(output), { recursive: true });
879
+ runInherit("node", [
880
+ XCFRAMEWORK_BUILD_SCRIPT,
881
+ "--output",
882
+ output,
883
+ "--build-if-missing",
884
+ "--verify",
885
+ ]);
886
+ return output;
887
+ }
888
+
889
+ function walkFiles(root) {
890
+ const out = [];
891
+ const stack = [root];
892
+ while (stack.length > 0) {
893
+ const current = stack.pop();
894
+ if (!current) continue;
895
+ for (const name of fs.readdirSync(current)) {
896
+ const full = path.join(current, name);
897
+ const stat = fs.statSync(full);
898
+ if (stat.isDirectory()) stack.push(full);
899
+ else out.push(full);
900
+ }
901
+ }
902
+ return out;
903
+ }
904
+
905
+ function locateDeviceFrameworkBinary(xcframework) {
906
+ const binaries = walkFiles(xcframework).filter(
907
+ (file) =>
908
+ path.basename(file) === "LlamaCpp" &&
909
+ /LlamaCpp\.framework[/\\]LlamaCpp$/.test(file),
910
+ );
911
+ const exact = binaries.find((file) =>
912
+ file.split(path.sep).includes("ios-arm64"),
913
+ );
914
+ if (exact) return exact;
915
+ const nonsim = binaries.find((file) => !/simulator/i.test(file));
916
+ if (nonsim) return nonsim;
917
+ throw Object.assign(
918
+ new Error(
919
+ `[ios-smoke] could not locate an iOS-device LlamaCpp.framework/LlamaCpp binary under ${xcframework}`,
920
+ ),
921
+ { exitCode: EXIT.localPreflight },
922
+ );
923
+ }
924
+
925
+ function classifyXcodebuildFailure(result) {
926
+ const text = `${result.stdout}\n${result.stderr}`;
927
+ if (/invalid option|Usage: xcodebuild/i.test(text))
928
+ return "xcodebuild-invocation";
929
+ if (/Developer Mode/i.test(text)) return "developer-mode-disabled";
930
+ if (
931
+ /device .*not trusted|not trusted by this computer|trust this computer/i.test(
932
+ text,
933
+ )
934
+ ) {
935
+ return "device-not-trusted";
936
+ }
937
+ if (
938
+ /Tool-hosted testing is unavailable on device destinations|Select a host application for the test target/i.test(
939
+ text,
940
+ )
941
+ ) {
942
+ return "requires-host-app-test-target";
943
+ }
944
+ if (
945
+ /testOptionalElizaTextGenerationBenchmark.*failed|Benchmark GGUF resource missing|llama_completion failed|llama_init_context failed/i.test(
946
+ text,
947
+ )
948
+ ) {
949
+ return "ios-text-benchmark-failed";
950
+ }
951
+ if (/not paired|pair/i.test(text)) return "device-not-paired";
952
+ if (/locked/i.test(text)) return "device-locked";
953
+ if (
954
+ /No profiles for|requires a provisioning profile|Signing for .* requires a development team|Code signing/i.test(
955
+ text,
956
+ )
957
+ ) {
958
+ return "code-signing";
959
+ }
960
+ if (
961
+ /Failed to install the app on the device/i.test(text) &&
962
+ /(?:CoreDeviceError[\s\S]*Code: 3002|IXRemoteErrorDomain[\s\S]*Code: 6|Connection (?:with the remote side was unexpectedly closed|interrupted)|IDEInstallCoreDeviceWorker)/i.test(
963
+ text,
964
+ )
965
+ ) {
966
+ return "coredevice-install-connection-interrupted";
967
+ }
968
+ if (
969
+ /The device .* is not available|Unable to find a destination|Ineligible destinations/i.test(
970
+ text,
971
+ )
972
+ ) {
973
+ return "device-destination-unavailable";
974
+ }
975
+ if (/duplicate symbol|duplicate symbols/i.test(text)) {
976
+ return "duplicate-static-linkage";
977
+ }
978
+ if (
979
+ /framework 'Accelerate' not found|Undefined symbol: _(?:cblas_|vDSP_)/i.test(
980
+ text,
981
+ )
982
+ ) {
983
+ return "missing-system-framework-linkage";
984
+ }
985
+ if (
986
+ /Crash:\s+ElizaIosRuntimeSmokeHost\s+at\s+eliza_ios_ffi_abi_smoke_run|testLibElizaInferenceAbiV1CallsMatchHeader.*Failed|unexpected exit, crash, or test timeout/i.test(
987
+ text,
988
+ )
989
+ ) {
990
+ return "voice-abi-runtime-crash";
991
+ }
992
+ const undefinedSymbolFailure =
993
+ /Undefined symbols|symbol\(s\) not found|ld: symbol/i.test(text);
994
+ const missingVoiceAbi =
995
+ undefinedSymbolFailure &&
996
+ /_eliza_inference_(?:abi_version|create|destroy|mmap_acquire|mmap_evict|tts_synthesize|asr_transcribe|free_string)\b/i.test(
997
+ text,
998
+ );
999
+ const missingCapacitorBridge =
1000
+ undefinedSymbolFailure &&
1001
+ /_llama_(?:init_context|release_context|completion|stop_completion|get_formatted_chat|toggle_native_log|embedding|embedding_register_context|embedding_unregister_context|get_model_info|get_context_ptr|get_last_error|free_string)\b/i.test(
1002
+ text,
1003
+ );
1004
+ if (missingVoiceAbi && missingCapacitorBridge) {
1005
+ return "missing-capacitor-bridge-and-voice-abi-symbols";
1006
+ }
1007
+ if (missingVoiceAbi) return "missing-voice-abi-symbols";
1008
+ if (missingCapacitorBridge) return "missing-capacitor-bridge-symbols";
1009
+ if (
1010
+ /symbol\(s\) not found|Undefined symbols|Missing required Eliza-1 iOS runtime symbols/i.test(
1011
+ text,
1012
+ )
1013
+ ) {
1014
+ return "runtime-symbol-resolution";
1015
+ }
1016
+ if (result.timeoutReason === "idle-timeout") return "xcodebuild-idle-timeout";
1017
+ if (result.timeoutReason === "timeout") return "xcodebuild-timeout";
1018
+ return "xcodebuild-failed";
1019
+ }
1020
+
1021
+ function blockerNextAction(category, deviceName = "the iPhone/iPad") {
1022
+ switch (category) {
1023
+ case "no-connected-physical-device":
1024
+ return `Connect ${deviceName} by USB, unlock it, accept any Trust This Computer prompt, keep it awake, and rerun the smoke. If it still appears as unavailable, open Xcode Devices and Simulators once to refresh CoreDevice pairing.`;
1025
+ case "device-locked":
1026
+ return `Unlock ${deviceName}, keep it awake on the Home screen, then rerun the smoke.`;
1027
+ case "device-not-trusted":
1028
+ return `Unlock ${deviceName}, accept the "Trust This Computer" prompt, enter the passcode, then rerun.`;
1029
+ case "device-not-paired":
1030
+ return `Pair ${deviceName} with this Mac in Xcode Devices and Simulators, trust the Mac on-device, then rerun.`;
1031
+ case "developer-mode-disabled":
1032
+ return `Enable Developer Mode on ${deviceName} in Settings > Privacy & Security, restart if prompted, then rerun.`;
1033
+ case "code-signing":
1034
+ return "Set ELIZA_IOS_DEVELOPMENT_TEAM or pass --development-team with a team that can sign for this device, then rerun.";
1035
+ case "device-destination-unavailable":
1036
+ return `Reconnect ${deviceName} by USB, unlock it, confirm Developer Mode and trust, then rerun.`;
1037
+ case "coredevice-install-connection-interrupted":
1038
+ return `Keep ${deviceName} unlocked and awake, unplug/replug USB, dismiss any install/trust prompts, remove any stale ElizaIosRuntimeSmokeHost app if visible, then rerun.`;
1039
+ case "xcodebuild-idle-timeout":
1040
+ return `Check ${deviceName} for trust, unlock, Developer Mode, or signing prompts; the harness killed xcodebuild after no progress.`;
1041
+ case "xcodebuild-timeout":
1042
+ return "Inspect xcodebuild stdoutTail/stderrTail and the recorded device diagnostics; increase --xcodebuild-timeout-ms only if progress is visible.";
1043
+ default:
1044
+ return "Inspect xcodebuild stdoutTail/stderrTail and deviceDiagnostics in this report, then rerun after clearing the reported blocker.";
1045
+ }
1046
+ }
1047
+
1048
+ function extractBenchmarkResults(text) {
1049
+ const results = [];
1050
+ const re = /ELIZA_IOS_TPS_RESULT\s+(\{[^\n]+\})/g;
1051
+ let match;
1052
+ while ((match = re.exec(text)) !== null) {
1053
+ try {
1054
+ results.push(JSON.parse(match[1]));
1055
+ } catch {
1056
+ // A malformed benchmark line should not hide the XCTest result.
1057
+ }
1058
+ }
1059
+ return results;
1060
+ }
1061
+
1062
+ async function runXcodebuildForReport(
1063
+ xcodeArgs,
1064
+ { cwd, timeoutMs, idleTimeoutMs, progressIntervalMs },
1065
+ ) {
1066
+ const result = await runStreamingCapture("xcodebuild", xcodeArgs, {
1067
+ cwd,
1068
+ timeoutMs,
1069
+ idleTimeoutMs,
1070
+ progressIntervalMs,
1071
+ });
1072
+ return {
1073
+ command: ["xcodebuild", ...xcodeArgs],
1074
+ cwd,
1075
+ status: result.status,
1076
+ signal: result.signal,
1077
+ startedAt: result.startedAt,
1078
+ finishedAt: result.finishedAt,
1079
+ elapsedMs: result.elapsedMs,
1080
+ timeoutMs: result.timeoutMs,
1081
+ idleTimeoutMs: result.idleTimeoutMs,
1082
+ timeoutReason: result.timeoutReason,
1083
+ timedOut: result.timedOut,
1084
+ idleTimedOut: result.idleTimedOut,
1085
+ lastOutputAt: result.lastOutputAt,
1086
+ lastOutputStream: result.lastOutputStream,
1087
+ lastOutputLine: result.lastOutputLine,
1088
+ stdoutTail: summarizeText(result.stdout),
1089
+ stderrTail: summarizeText(result.stderr),
1090
+ benchmarkResults: extractBenchmarkResults(
1091
+ `${result.stdout}\n${result.stderr}`,
1092
+ ),
1093
+ error: result.error ? String(result.error) : null,
1094
+ failureCategory:
1095
+ result.status === 0 && !result.signal && !result.error
1096
+ ? null
1097
+ : classifyXcodebuildFailure(result),
1098
+ };
1099
+ }
1100
+
1101
+ function jsString(value) {
1102
+ return JSON.stringify(value);
1103
+ }
1104
+
1105
+ function swiftArray(values) {
1106
+ return `[${values.map((value) => jsString(value)).join(", ")}]`;
1107
+ }
1108
+
1109
+ function yamlList(values, indent = 10) {
1110
+ const pad = " ".repeat(indent);
1111
+ return values.map((value) => `${pad}- ${jsString(value)}`).join("\n");
1112
+ }
1113
+
1114
+ function hostRuntimeLinkerFlags({ frameworkBinary, symbols }) {
1115
+ const flags = [
1116
+ "$(inherited)",
1117
+ "-framework",
1118
+ "Accelerate",
1119
+ "-framework",
1120
+ "Foundation",
1121
+ "-framework",
1122
+ "Metal",
1123
+ "-framework",
1124
+ "MetalKit",
1125
+ ];
1126
+ for (const symbol of symbols) {
1127
+ flags.push("-u", `_${symbol}`);
1128
+ }
1129
+ flags.push(frameworkBinary);
1130
+ return flags;
1131
+ }
1132
+
1133
+ function writeSmokeProject({
1134
+ tempDir,
1135
+ xcframework,
1136
+ frameworkBinary,
1137
+ skipVoiceAbi,
1138
+ developmentTeam,
1139
+ benchmarkModel,
1140
+ }) {
1141
+ const vendorDir = path.join(tempDir, "Vendor");
1142
+ const hostDir = path.join(tempDir, "Sources", "HostApp");
1143
+ const testDir = path.join(tempDir, "Tests", "ElizaIosRuntimeSmokeTests");
1144
+ const resourcesDir = path.join(tempDir, "Resources");
1145
+ fs.mkdirSync(vendorDir, { recursive: true });
1146
+ fs.mkdirSync(hostDir, { recursive: true });
1147
+ fs.mkdirSync(testDir, { recursive: true });
1148
+ fs.mkdirSync(resourcesDir, { recursive: true });
1149
+ fs.symlinkSync(
1150
+ xcframework,
1151
+ path.join(vendorDir, "LlamaCpp.xcframework"),
1152
+ "dir",
1153
+ );
1154
+ let benchmarkResourceName = "";
1155
+ if (benchmarkModel) {
1156
+ const source = path.resolve(benchmarkModel);
1157
+ if (!fs.existsSync(source)) {
1158
+ throw Object.assign(
1159
+ new Error(`[ios-smoke] --benchmark-model does not exist: ${source}`),
1160
+ { exitCode: EXIT.localPreflight },
1161
+ );
1162
+ }
1163
+ benchmarkResourceName = path.basename(source);
1164
+ const dest = path.join(resourcesDir, benchmarkResourceName);
1165
+ try {
1166
+ fs.linkSync(source, dest);
1167
+ } catch {
1168
+ fs.copyFileSync(source, dest);
1169
+ }
1170
+ }
1171
+ fs.copyFileSync(
1172
+ path.join(__dirname, "..", "ffi-stub", "ffi.h"),
1173
+ path.join(testDir, "ffi.h"),
1174
+ );
1175
+
1176
+ fs.writeFileSync(
1177
+ path.join(hostDir, "AppDelegate.swift"),
1178
+ `import UIKit
1179
+
1180
+ @main
1181
+ final class AppDelegate: UIResponder, UIApplicationDelegate {
1182
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1183
+ true
1184
+ }
1185
+ }
1186
+ `,
1187
+ );
1188
+
1189
+ fs.writeFileSync(
1190
+ path.join(hostDir, "Info.plist"),
1191
+ `<?xml version="1.0" encoding="UTF-8"?>
1192
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
1193
+ <plist version="1.0">
1194
+ <dict>
1195
+ <key>CFBundleExecutable</key><string>$(EXECUTABLE_NAME)</string>
1196
+ <key>CFBundleIdentifier</key><string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
1197
+ <key>CFBundleName</key><string>ElizaIosRuntimeSmokeHost</string>
1198
+ <key>CFBundlePackageType</key><string>APPL</string>
1199
+ <key>UIApplicationSceneManifest</key>
1200
+ <dict>
1201
+ <key>UIApplicationSupportsMultipleScenes</key><false/>
1202
+ </dict>
1203
+ </dict>
1204
+ </plist>
1205
+ `,
1206
+ );
1207
+
1208
+ const voiceSymbols = skipVoiceAbi ? [] : VOICE_ABI_SYMBOLS;
1209
+ const requiredRuntimeSymbols = [
1210
+ ...LLAMA_SYMBOLS,
1211
+ ...KERNEL_SYMBOLS,
1212
+ ...voiceSymbols,
1213
+ ];
1214
+ const hostOtherLdFlags = hostRuntimeLinkerFlags({
1215
+ frameworkBinary,
1216
+ symbols: requiredRuntimeSymbols,
1217
+ });
1218
+ const testOtherLdFlags = [
1219
+ "$(inherited)",
1220
+ "-framework",
1221
+ "Foundation",
1222
+ "-framework",
1223
+ "Metal",
1224
+ ];
1225
+ fs.writeFileSync(
1226
+ path.join(testDir, "ElizaFfiAbiSmoke.h"),
1227
+ `#pragma once
1228
+
1229
+ #ifdef __cplusplus
1230
+ extern "C" {
1231
+ #endif
1232
+
1233
+ char * eliza_ios_ffi_abi_smoke_run(const char * bundle_dir);
1234
+ char * eliza_ios_text_benchmark_run(const char * model_path, const char * mode);
1235
+ void eliza_ios_ffi_abi_smoke_free(char * message);
1236
+
1237
+ #ifdef __cplusplus
1238
+ }
1239
+ #endif
1240
+ `,
1241
+ );
1242
+ fs.writeFileSync(
1243
+ path.join(testDir, "ElizaFfiAbiSmoke.c"),
1244
+ `#include "ElizaFfiAbiSmoke.h"
1245
+ #include "ffi.h"
1246
+
1247
+ #include <stdint.h>
1248
+ #include <stdio.h>
1249
+ #include <stdlib.h>
1250
+ #include <string.h>
1251
+
1252
+ extern int64_t llama_init_context(const char * model_path, const char * params_json);
1253
+ extern char * llama_completion(int64_t context_id, const char * prompt, const char * params_json);
1254
+ extern void llama_release_context(int64_t context_id);
1255
+ extern char * llama_get_last_error(void);
1256
+ extern void llama_free_string(char * value);
1257
+
1258
+ static char * smoke_strdup(const char * s) {
1259
+ const char * value = s ? s : "";
1260
+ const size_t len = strlen(value);
1261
+ char * out = (char *) malloc(len + 1);
1262
+ if (!out) return NULL;
1263
+ memcpy(out, value, len + 1);
1264
+ return out;
1265
+ }
1266
+
1267
+ static char * smoke_message(const char * prefix, const char * detail) {
1268
+ const char * p = prefix ? prefix : "failure";
1269
+ const char * d = detail ? detail : "";
1270
+ const size_t len = strlen(p) + strlen(d) + 3;
1271
+ char * out = (char *) malloc(len);
1272
+ if (!out) return NULL;
1273
+ snprintf(out, len, "%s: %s", p, d);
1274
+ return out;
1275
+ }
1276
+
1277
+ static size_t smoke_json_escaped_len(const char * s) {
1278
+ size_t out = 0;
1279
+ const unsigned char * p = (const unsigned char *) (s ? s : "");
1280
+ while (*p) {
1281
+ out += (*p == '"' || *p == '\\\\') ? 2 : 1;
1282
+ p++;
1283
+ }
1284
+ return out;
1285
+ }
1286
+
1287
+ static char * smoke_json_append_escaped(char * dst, const char * s) {
1288
+ const unsigned char * p = (const unsigned char *) (s ? s : "");
1289
+ while (*p) {
1290
+ if (*p == '"' || *p == '\\\\') {
1291
+ *dst++ = '\\\\';
1292
+ }
1293
+ *dst++ = (char) *p++;
1294
+ }
1295
+ return dst;
1296
+ }
1297
+
1298
+ static char * smoke_json_error(const char * stage, const char * mode, const char * detail) {
1299
+ const char * st = stage ? stage : "unknown";
1300
+ const char * md = mode ? mode : "unknown";
1301
+ const char * dt = detail ? detail : "";
1302
+ const char * a = "{\\"error\\":\\"";
1303
+ const char * b = "\\",\\"mode\\":\\"";
1304
+ const char * c = "\\",\\"stage\\":\\"";
1305
+ const char * d = "\\"}";
1306
+ const size_t len =
1307
+ strlen(a) + smoke_json_escaped_len(dt) +
1308
+ strlen(b) + smoke_json_escaped_len(md) +
1309
+ strlen(c) + smoke_json_escaped_len(st) +
1310
+ strlen(d) + 1;
1311
+ char * out = (char *) malloc(len);
1312
+ if (!out) return NULL;
1313
+ char * p = out;
1314
+ memcpy(p, a, strlen(a)); p += strlen(a);
1315
+ p = smoke_json_append_escaped(p, dt);
1316
+ memcpy(p, b, strlen(b)); p += strlen(b);
1317
+ p = smoke_json_append_escaped(p, md);
1318
+ memcpy(p, c, strlen(c)); p += strlen(c);
1319
+ p = smoke_json_append_escaped(p, st);
1320
+ memcpy(p, d, strlen(d)); p += strlen(d);
1321
+ *p = '\\0';
1322
+ return out;
1323
+ }
1324
+
1325
+ static char * smoke_json_last_error(const char * stage, const char * mode) {
1326
+ char * err = llama_get_last_error();
1327
+ char * out = smoke_json_error(stage, mode, err ? err : "No detailed native error captured");
1328
+ if (err) llama_free_string(err);
1329
+ return out;
1330
+ }
1331
+
1332
+ static void clear_error(char ** err) {
1333
+ if (err && *err) {
1334
+ eliza_inference_free_string(*err);
1335
+ *err = NULL;
1336
+ }
1337
+ }
1338
+
1339
+ char * eliza_ios_ffi_abi_smoke_run(const char * bundle_dir) {
1340
+ const char * version = eliza_inference_abi_version();
1341
+ if (!version || strcmp(version, "1") != 0) {
1342
+ return smoke_message("bad ABI version", version ? version : "(null)");
1343
+ }
1344
+
1345
+ char * err = NULL;
1346
+ EliInferenceContext * ctx = eliza_inference_create(bundle_dir, &err);
1347
+ if (!ctx) {
1348
+ char * out = smoke_message("create failed", err);
1349
+ clear_error(&err);
1350
+ return out;
1351
+ }
1352
+
1353
+ int rc = eliza_inference_mmap_acquire(ctx, "text", &err);
1354
+ if (rc != ELIZA_OK) {
1355
+ char * out = smoke_message("mmap_acquire(text) failed", err);
1356
+ clear_error(&err);
1357
+ eliza_inference_destroy(ctx);
1358
+ return out;
1359
+ }
1360
+ clear_error(&err);
1361
+
1362
+ rc = eliza_inference_mmap_acquire(ctx, "tts", &err);
1363
+ if (rc >= 0) {
1364
+ clear_error(&err);
1365
+ eliza_inference_destroy(ctx);
1366
+ return smoke_strdup("mmap_acquire(tts) unexpectedly succeeded for an empty test bundle");
1367
+ }
1368
+ if (!err || err[0] == '\\0') {
1369
+ clear_error(&err);
1370
+ eliza_inference_destroy(ctx);
1371
+ return smoke_strdup("mmap_acquire(tts) failed without an out_error diagnostic");
1372
+ }
1373
+ clear_error(&err);
1374
+
1375
+ float pcm_out[64] = {0};
1376
+ const char * text = "hello";
1377
+ rc = eliza_inference_tts_synthesize(
1378
+ ctx,
1379
+ text,
1380
+ strlen(text),
1381
+ NULL,
1382
+ pcm_out,
1383
+ sizeof(pcm_out) / sizeof(pcm_out[0]),
1384
+ &err);
1385
+ if (rc >= 0) {
1386
+ clear_error(&err);
1387
+ eliza_inference_destroy(ctx);
1388
+ return smoke_strdup("tts_synthesize unexpectedly succeeded for an empty test bundle");
1389
+ }
1390
+ if (!err || err[0] == '\\0') {
1391
+ clear_error(&err);
1392
+ eliza_inference_destroy(ctx);
1393
+ return smoke_strdup("tts_synthesize failed without an out_error diagnostic");
1394
+ }
1395
+ clear_error(&err);
1396
+
1397
+ float pcm_in[8] = {0};
1398
+ char transcript[64] = {0};
1399
+ rc = eliza_inference_asr_transcribe(
1400
+ ctx,
1401
+ pcm_in,
1402
+ sizeof(pcm_in) / sizeof(pcm_in[0]),
1403
+ 16000,
1404
+ transcript,
1405
+ sizeof(transcript),
1406
+ &err);
1407
+ if (rc >= 0) {
1408
+ clear_error(&err);
1409
+ eliza_inference_destroy(ctx);
1410
+ return smoke_strdup("asr_transcribe unexpectedly succeeded for an empty test bundle");
1411
+ }
1412
+ if (!err || err[0] == '\\0') {
1413
+ clear_error(&err);
1414
+ eliza_inference_destroy(ctx);
1415
+ return smoke_strdup("asr_transcribe failed without an out_error diagnostic");
1416
+ }
1417
+ clear_error(&err);
1418
+
1419
+ rc = eliza_inference_mmap_evict(ctx, "text", &err);
1420
+ if (rc != ELIZA_OK) {
1421
+ char * out = smoke_message("mmap_evict(text) failed", err);
1422
+ clear_error(&err);
1423
+ eliza_inference_destroy(ctx);
1424
+ return out;
1425
+ }
1426
+ clear_error(&err);
1427
+
1428
+ eliza_inference_destroy(ctx);
1429
+ return NULL;
1430
+ }
1431
+
1432
+ void eliza_ios_ffi_abi_smoke_free(char * message) {
1433
+ free(message);
1434
+ }
1435
+
1436
+ char * eliza_ios_text_benchmark_run(const char * model_path, const char * mode) {
1437
+ const int use_cpu = mode && strcmp(mode, "cpu") == 0;
1438
+ const char * ctx_params_cpu = "{\\"n_ctx\\":512,\\"n_batch\\":512,\\"n_ubatch\\":128,\\"no_gpu_devices\\":true,\\"n_gpu_layers\\":0,\\"flash_attn\\":false,\\"use_mmap\\":true,\\"n_threads\\":4}";
1439
+ const char * ctx_params_metal = "{\\"n_ctx\\":512,\\"n_batch\\":512,\\"n_ubatch\\":128,\\"n_gpu_layers\\":999,\\"flash_attn\\":true,\\"use_mmap\\":true,\\"n_threads\\":4}";
1440
+ const char * completion_params = "{\\"n_predict\\":32,\\"temperature\\":0,\\"seed\\":42,\\"top_k\\":1,\\"n_threads\\":4,\\"stop\\":[\\"<|im_end|>\\"]}";
1441
+ const char * prompt = "You are Eliza. Write one short benchmark sentence.";
1442
+ int64_t ctx = llama_init_context(model_path, use_cpu ? ctx_params_cpu : ctx_params_metal);
1443
+ if (ctx <= 0) {
1444
+ return smoke_json_last_error("llama_init_context", mode ? mode : "unknown");
1445
+ }
1446
+
1447
+ char * completion = llama_completion(ctx, prompt, completion_params);
1448
+ llama_release_context(ctx);
1449
+ if (!completion) {
1450
+ return smoke_json_last_error("llama_completion", mode ? mode : "unknown");
1451
+ }
1452
+ const size_t len = strlen(completion);
1453
+ char * out = (char *) malloc(len + 1);
1454
+ if (out) memcpy(out, completion, len + 1);
1455
+ llama_free_string(completion);
1456
+ return out;
1457
+ }
1458
+ `,
1459
+ );
1460
+ fs.writeFileSync(
1461
+ path.join(testDir, "ElizaIosRuntimeSmokeTests.swift"),
1462
+ `import XCTest
1463
+ import Metal
1464
+ import Darwin
1465
+
1466
+ final class ElizaIosRuntimeSmokeTests: XCTestCase {
1467
+ private let llamaSymbols: [String] = ${swiftArray(LLAMA_SYMBOLS)}
1468
+ private let kernelSymbols: [String] = ${swiftArray(KERNEL_SYMBOLS)}
1469
+ private let voiceSymbols: [String] = ${swiftArray(voiceSymbols)}
1470
+ private let benchmarkResourceName = ${jsString(benchmarkResourceName)}
1471
+
1472
+ func testMetalDeviceIsAvailableOnPhysicalIos() throws {
1473
+ XCTAssertNil(ProcessInfo.processInfo.environment["SIMULATOR_DEVICE_NAME"], "This smoke must run on physical iOS hardware, not a simulator.")
1474
+ let device = MTLCreateSystemDefaultDevice()
1475
+ XCTAssertNotNil(device, "MTLCreateSystemDefaultDevice returned nil; Metal is unavailable on this device/runtime.")
1476
+ XCTAssertFalse(device!.name.isEmpty, "Metal device name is empty.")
1477
+ }
1478
+
1479
+ func testLlamaKernelAndVoiceSymbolsResolve() throws {
1480
+ var missing: [String] = []
1481
+ for symbol in llamaSymbols + kernelSymbols + voiceSymbols {
1482
+ if dlsym(UnsafeMutableRawPointer(bitPattern: -2), symbol) == nil {
1483
+ missing.append(symbol)
1484
+ }
1485
+ }
1486
+ XCTAssertTrue(
1487
+ missing.isEmpty,
1488
+ "Missing required Eliza-1 iOS runtime symbols: \\(missing.joined(separator: ", ")). This is a runtime failure, not a shader-fixture failure."
1489
+ )
1490
+ }
1491
+
1492
+ func testLibElizaInferenceAbiV1CallsMatchHeader() throws {
1493
+ let bundleDir = NSTemporaryDirectory().appending("/eliza-ios-ffi-empty-bundle-\\(UUID().uuidString)")
1494
+ try FileManager.default.createDirectory(atPath: bundleDir, withIntermediateDirectories: true)
1495
+ defer { try? FileManager.default.removeItem(atPath: bundleDir) }
1496
+
1497
+ let failure = bundleDir.withCString { cBundleDir in
1498
+ eliza_ios_ffi_abi_smoke_run(cBundleDir)
1499
+ }
1500
+ if let failure {
1501
+ let message = String(cString: failure)
1502
+ eliza_ios_ffi_abi_smoke_free(failure)
1503
+ XCTFail(message)
1504
+ }
1505
+ }
1506
+
1507
+ func testOptionalElizaTextGenerationBenchmark() throws {
1508
+ guard !benchmarkResourceName.isEmpty else {
1509
+ throw XCTSkip("No --benchmark-model provided.")
1510
+ }
1511
+
1512
+ let base = (benchmarkResourceName as NSString).deletingPathExtension
1513
+ let ext = (benchmarkResourceName as NSString).pathExtension
1514
+ let modelURL = try XCTUnwrap(
1515
+ Bundle.main.url(forResource: base, withExtension: ext),
1516
+ "Benchmark GGUF resource missing from host app bundle: \\(benchmarkResourceName)"
1517
+ )
1518
+
1519
+ for mode in ["cpu", "metal"] {
1520
+ let ptr = modelURL.path.withCString { cPath in
1521
+ mode.withCString { cMode in
1522
+ eliza_ios_text_benchmark_run(cPath, cMode)
1523
+ }
1524
+ }
1525
+ let raw = try XCTUnwrap(ptr, "eliza_ios_text_benchmark_run returned null for \\(mode)")
1526
+ defer { eliza_ios_ffi_abi_smoke_free(raw) }
1527
+
1528
+ let text = String(cString: raw)
1529
+ let data = try XCTUnwrap(text.data(using: .utf8), "Benchmark result is not UTF-8 for \\(mode): \\(text)")
1530
+ let jsonObject = try JSONSerialization.jsonObject(with: data)
1531
+ let json = try XCTUnwrap(jsonObject as? [String: Any], "Benchmark result is not a JSON object for \\(mode): \\(text)")
1532
+ if let error = json["error"] as? String {
1533
+ let report: [String: Any] = [
1534
+ "mode": mode,
1535
+ "model": benchmarkResourceName,
1536
+ "error": error,
1537
+ "stage": (json["stage"] as? String) ?? "unknown",
1538
+ "tokens_predicted": 0,
1539
+ "tokens_evaluated": 0,
1540
+ "prompt_per_second": 0,
1541
+ "predicted_per_second": 0
1542
+ ]
1543
+ let reportData = try JSONSerialization.data(withJSONObject: report, options: [.sortedKeys])
1544
+ print("ELIZA_IOS_TPS_RESULT " + String(data: reportData, encoding: .utf8)!)
1545
+ XCTFail("llama_completion failed for \\(mode): \\(error)")
1546
+ continue
1547
+ }
1548
+
1549
+ let timings = try XCTUnwrap(json["timings"] as? [String: Any], "Missing timings in benchmark result for \\(mode): \\(text)")
1550
+ let predictedPerSecond = try XCTUnwrap(timings["predicted_per_second"] as? Double, "Missing predicted_per_second for \\(mode): \\(text)")
1551
+ let promptPerSecond = (timings["prompt_per_second"] as? Double) ?? 0
1552
+ let predicted = (json["tokens_predicted"] as? Int) ?? 0
1553
+ let evaluated = (json["tokens_evaluated"] as? Int) ?? 0
1554
+
1555
+ XCTAssertGreaterThan(predictedPerSecond, 0, "predicted_per_second must be positive for \\(mode)")
1556
+ XCTAssertGreaterThan(predicted, 0, "tokens_predicted must be positive for \\(mode)")
1557
+
1558
+ let report: [String: Any] = [
1559
+ "mode": mode,
1560
+ "model": benchmarkResourceName,
1561
+ "tokens_predicted": predicted,
1562
+ "tokens_evaluated": evaluated,
1563
+ "prompt_per_second": promptPerSecond,
1564
+ "predicted_per_second": predictedPerSecond
1565
+ ]
1566
+ let reportData = try JSONSerialization.data(withJSONObject: report, options: [.sortedKeys])
1567
+ print("ELIZA_IOS_TPS_RESULT " + String(data: reportData, encoding: .utf8)!)
1568
+ }
1569
+ }
1570
+ }
1571
+ `,
1572
+ );
1573
+
1574
+ fs.writeFileSync(
1575
+ path.join(tempDir, "project.yml"),
1576
+ `name: ElizaIosRuntimeSmoke
1577
+ options:
1578
+ bundleIdPrefix: ai.elizaos
1579
+ settings:
1580
+ base:
1581
+ CODE_SIGN_STYLE: Automatic
1582
+ IPHONEOS_DEPLOYMENT_TARGET: "14.0"
1583
+ ${developmentTeam ? `DEVELOPMENT_TEAM: ${developmentTeam}` : ""}
1584
+ targets:
1585
+ ElizaIosRuntimeSmokeHost:
1586
+ type: application
1587
+ platform: iOS
1588
+ deploymentTarget: "14.0"
1589
+ sources:
1590
+ - Sources/HostApp
1591
+ - path: Resources
1592
+ buildPhase: resources
1593
+ settings:
1594
+ base:
1595
+ PRODUCT_BUNDLE_IDENTIFIER: ai.elizaos.ElizaIosRuntimeSmokeHost
1596
+ INFOPLIST_FILE: Sources/HostApp/Info.plist
1597
+ OTHER_LDFLAGS:
1598
+ ${yamlList(hostOtherLdFlags)}
1599
+ ElizaIosRuntimeSmokeTests:
1600
+ type: bundle.unit-test
1601
+ platform: iOS
1602
+ deploymentTarget: "14.0"
1603
+ sources:
1604
+ - Tests/ElizaIosRuntimeSmokeTests
1605
+ dependencies:
1606
+ - target: ElizaIosRuntimeSmokeHost
1607
+ settings:
1608
+ base:
1609
+ PRODUCT_BUNDLE_IDENTIFIER: ai.elizaos.ElizaIosRuntimeSmokeTests
1610
+ GENERATE_INFOPLIST_FILE: YES
1611
+ TEST_HOST: "$(BUILT_PRODUCTS_DIR)/ElizaIosRuntimeSmokeHost.app/ElizaIosRuntimeSmokeHost"
1612
+ BUNDLE_LOADER: "$(TEST_HOST)"
1613
+ SWIFT_OBJC_BRIDGING_HEADER: Tests/ElizaIosRuntimeSmokeTests/ElizaFfiAbiSmoke.h
1614
+ HEADER_SEARCH_PATHS:
1615
+ - "$(SRCROOT)/Tests/ElizaIosRuntimeSmokeTests"
1616
+ OTHER_LDFLAGS:
1617
+ ${yamlList(testOtherLdFlags)}
1618
+ schemes:
1619
+ ElizaIosRuntimeSmoke:
1620
+ build:
1621
+ targets:
1622
+ ElizaIosRuntimeSmokeHost: all
1623
+ ElizaIosRuntimeSmokeTests: [test]
1624
+ test:
1625
+ targets:
1626
+ - ElizaIosRuntimeSmokeTests
1627
+ `,
1628
+ );
1629
+
1630
+ runInherit("xcrun", ["xcodegen", "generate"], { cwd: tempDir });
1631
+ }
1632
+
1633
+ function writeReport(reportPath, report) {
1634
+ if (!reportPath) return;
1635
+ fs.mkdirSync(path.dirname(path.resolve(reportPath)), { recursive: true });
1636
+ fs.writeFileSync(
1637
+ path.resolve(reportPath),
1638
+ `${JSON.stringify(report, null, 2)}\n`,
1639
+ );
1640
+ }
1641
+
1642
+ function hasXcodebuildArg(args, flag) {
1643
+ return args.xcodebuildArgs.includes(flag);
1644
+ }
1645
+
1646
+ function resolveXcodebuildTimeouts(args) {
1647
+ return {
1648
+ timeoutMs:
1649
+ args.xcodebuildTimeoutMs ??
1650
+ (args.benchmarkModel
1651
+ ? BENCHMARK_XCODEBUILD_TIMEOUT_MS
1652
+ : DEFAULT_XCODEBUILD_TIMEOUT_MS),
1653
+ idleTimeoutMs:
1654
+ args.xcodebuildIdleTimeoutMs ??
1655
+ (args.benchmarkModel
1656
+ ? BENCHMARK_XCODEBUILD_IDLE_TIMEOUT_MS
1657
+ : DEFAULT_XCODEBUILD_IDLE_TIMEOUT_MS),
1658
+ progressIntervalMs: args.xcodebuildProgressIntervalMs,
1659
+ destinationTimeoutSeconds: args.destinationTimeoutSeconds,
1660
+ collectTestDiagnostics: args.collectTestDiagnostics,
1661
+ };
1662
+ }
1663
+
1664
+ function buildXcodeArgs({
1665
+ tempDir,
1666
+ device,
1667
+ args,
1668
+ derivedDataPath,
1669
+ resultBundlePath,
1670
+ xcodebuildDestinationId,
1671
+ }) {
1672
+ const xcodeArgs = [
1673
+ "test",
1674
+ "-project",
1675
+ path.join(tempDir, "ElizaIosRuntimeSmoke.xcodeproj"),
1676
+ "-scheme",
1677
+ "ElizaIosRuntimeSmoke",
1678
+ "-destination",
1679
+ `platform=iOS,id=${xcodebuildDestinationId ?? device.id}`,
1680
+ "-derivedDataPath",
1681
+ derivedDataPath,
1682
+ "-resultBundlePath",
1683
+ resultBundlePath,
1684
+ ];
1685
+ if (
1686
+ args.destinationTimeoutSeconds &&
1687
+ !hasXcodebuildArg(args, "-destination-timeout")
1688
+ ) {
1689
+ xcodeArgs.push(
1690
+ "-destination-timeout",
1691
+ String(args.destinationTimeoutSeconds),
1692
+ );
1693
+ }
1694
+ if (
1695
+ args.collectTestDiagnostics &&
1696
+ !hasXcodebuildArg(args, "-collect-test-diagnostics")
1697
+ ) {
1698
+ xcodeArgs.push("-collect-test-diagnostics", args.collectTestDiagnostics);
1699
+ }
1700
+ xcodeArgs.push("CODE_SIGNING_ALLOWED=YES");
1701
+ if (args.developmentTeam) {
1702
+ xcodeArgs.push(`DEVELOPMENT_TEAM=${args.developmentTeam}`);
1703
+ }
1704
+ xcodeArgs.push(...args.xcodebuildArgs);
1705
+ return xcodeArgs;
1706
+ }
1707
+
1708
+ async function main() {
1709
+ const startedAt = new Date().toISOString();
1710
+ const args = parseArgs(process.argv.slice(2));
1711
+ let tempDir = null;
1712
+ let report = {
1713
+ status: "not-started",
1714
+ startedAt,
1715
+ finishedAt: null,
1716
+ device: null,
1717
+ xcframework: null,
1718
+ benchmarkModel: args.benchmarkModel
1719
+ ? path.resolve(args.benchmarkModel)
1720
+ : null,
1721
+ skippedVoiceAbi: args.skipVoiceAbi,
1722
+ failClosed: {
1723
+ physicalDeviceOnly: true,
1724
+ requiresIosArm64XcframeworkSlice: true,
1725
+ requiresRuntimeSymbols: true,
1726
+ requiresVoiceAbi: !args.skipVoiceAbi,
1727
+ capturesXcodebuildOutput: true,
1728
+ capturesXcodebuildProgress: true,
1729
+ capturesDeviceDiagnostics: true,
1730
+ },
1731
+ toolchain: null,
1732
+ xcodebuild: null,
1733
+ xcodebuildTimeouts: null,
1734
+ xcodebuildDestinationId: null,
1735
+ deviceDiagnostics: null,
1736
+ blocker: null,
1737
+ resultBundlePath: null,
1738
+ derivedDataPath: null,
1739
+ };
1740
+ let exitingFromSignal = false;
1741
+ const signalHandler = (signal) => {
1742
+ if (exitingFromSignal) return;
1743
+ exitingFromSignal = true;
1744
+ report.status = "failed";
1745
+ report.finishedAt = new Date().toISOString();
1746
+ report.error = `[ios-smoke] interrupted by ${signal}`;
1747
+ report.blocker = report.blocker ?? {
1748
+ category: "interrupted",
1749
+ detail:
1750
+ "The smoke was interrupted before xcodebuild completed; rerun with the recorded timeouts enabled.",
1751
+ nextAction:
1752
+ "Rerun the smoke and let the harness timeout produce the full xcodebuild diagnostics report.",
1753
+ };
1754
+ writeReport(args.report, report);
1755
+ if (tempDir && !args.keepTemp) {
1756
+ fs.rmSync(tempDir, { recursive: true, force: true });
1757
+ }
1758
+ process.stderr.write(`${report.error}\n`);
1759
+ process.exit(signal === "SIGINT" ? 130 : 143);
1760
+ };
1761
+ process.once("SIGINT", signalHandler);
1762
+ process.once("SIGTERM", signalHandler);
1763
+
1764
+ try {
1765
+ if (process.platform !== "darwin") {
1766
+ throw Object.assign(
1767
+ new Error("[ios-smoke] physical iOS smoke requires macOS with Xcode."),
1768
+ { exitCode: EXIT.localPreflight },
1769
+ );
1770
+ }
1771
+ ensureTool("xcodebuild");
1772
+ ensureTool("xctrace");
1773
+ ensureTool("plutil");
1774
+ ensureTool("xcodegen");
1775
+ if (!args.developmentTeam) {
1776
+ args.developmentTeam = detectDefaultDevelopmentTeam();
1777
+ }
1778
+
1779
+ const toolchain = {
1780
+ xcodebuild: commandMetadata("xcodebuild", ["-version"], {
1781
+ timeout: 30_000,
1782
+ }),
1783
+ xctrace: commandMetadata("xcrun", ["xctrace", "version"], {
1784
+ timeout: 30_000,
1785
+ }),
1786
+ };
1787
+ report.toolchain = toolchain;
1788
+
1789
+ const { device, devices } = resolveDevice(args.deviceId);
1790
+ const deviceDiagnostics = captureDeviceDiagnostics(device.id);
1791
+ const deviceDetailSummary = deviceDiagnostics.details.summary;
1792
+ const xcodebuildDestinationId = deviceDetailSummary?.udid || device.id;
1793
+ const xcodebuildTimeouts = resolveXcodebuildTimeouts(args);
1794
+ const xcframework = path.resolve(ensureXcframework(args));
1795
+ const xcframeworkDeviceSlice = validateXcframeworkDeviceSlice(xcframework);
1796
+ const frameworkBinary = locateDeviceFrameworkBinary(xcframework);
1797
+
1798
+ tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "eliza-ios-smoke-"));
1799
+ const derivedDataPath =
1800
+ args.derivedDataPath ?? path.join(tempDir, "DerivedData");
1801
+ const resultBundlePath =
1802
+ args.resultBundlePath ??
1803
+ path.join(tempDir, "ElizaIosRuntimeSmoke.xcresult");
1804
+ writeSmokeProject({
1805
+ tempDir,
1806
+ xcframework,
1807
+ frameworkBinary,
1808
+ skipVoiceAbi: args.skipVoiceAbi,
1809
+ developmentTeam: args.developmentTeam,
1810
+ benchmarkModel: args.benchmarkModel
1811
+ ? path.resolve(args.benchmarkModel)
1812
+ : null,
1813
+ });
1814
+
1815
+ report = {
1816
+ ...report,
1817
+ status: "running",
1818
+ toolchain,
1819
+ device,
1820
+ connectedPhysicalDeviceCount: devices.connected.length,
1821
+ offlinePhysicalDeviceCount: devices.offline.length,
1822
+ xcframework,
1823
+ benchmarkModel: args.benchmarkModel
1824
+ ? path.resolve(args.benchmarkModel)
1825
+ : null,
1826
+ xcframeworkDeviceSlice,
1827
+ frameworkBinary,
1828
+ developmentTeam: args.developmentTeam,
1829
+ tempPackage: tempDir,
1830
+ derivedDataPath,
1831
+ resultBundlePath,
1832
+ xcodebuildTimeouts,
1833
+ xcodebuildDestinationId,
1834
+ deviceDiagnostics: {
1835
+ beforeXcodebuild: deviceDiagnostics,
1836
+ },
1837
+ requiredSymbols: {
1838
+ llama: LLAMA_SYMBOLS,
1839
+ kernels: KERNEL_SYMBOLS,
1840
+ voiceAbi: args.skipVoiceAbi ? [] : VOICE_ABI_SYMBOLS,
1841
+ },
1842
+ };
1843
+
1844
+ const xcodeArgs = buildXcodeArgs({
1845
+ tempDir,
1846
+ device,
1847
+ args,
1848
+ derivedDataPath,
1849
+ resultBundlePath,
1850
+ xcodebuildDestinationId,
1851
+ });
1852
+ console.log(
1853
+ `[ios-smoke] running physical-device XCTest on ${device.name} (${device.version ?? "unknown"}) ${device.id}`,
1854
+ );
1855
+ if (xcodebuildDestinationId !== device.id) {
1856
+ console.log(
1857
+ `[ios-smoke] using hardware UDID ${xcodebuildDestinationId} for xcodebuild destination`,
1858
+ );
1859
+ }
1860
+ console.log(`[ios-smoke] xcframework: ${xcframework}`);
1861
+ report.xcodebuild = await runXcodebuildForReport(xcodeArgs, {
1862
+ cwd: tempDir,
1863
+ timeoutMs: xcodebuildTimeouts.timeoutMs,
1864
+ idleTimeoutMs: xcodebuildTimeouts.idleTimeoutMs,
1865
+ progressIntervalMs: xcodebuildTimeouts.progressIntervalMs,
1866
+ });
1867
+ if (
1868
+ report.xcodebuild.status !== 0 ||
1869
+ report.xcodebuild.signal ||
1870
+ report.xcodebuild.error ||
1871
+ report.xcodebuild.timedOut ||
1872
+ report.xcodebuild.idleTimedOut
1873
+ ) {
1874
+ report.deviceDiagnostics.afterXcodebuild = captureDeviceDiagnostics(
1875
+ device.id,
1876
+ );
1877
+ report.blocker = {
1878
+ category: report.xcodebuild.failureCategory,
1879
+ detail:
1880
+ "xcodebuild test did not complete successfully; see xcodebuild stdoutTail/stderrTail and deviceDiagnostics in this report.",
1881
+ nextAction: blockerNextAction(
1882
+ report.xcodebuild.failureCategory,
1883
+ device.name,
1884
+ ),
1885
+ };
1886
+ throw Object.assign(
1887
+ new Error(
1888
+ `[ios-smoke] xcodebuild failed: ${report.xcodebuild.failureCategory}`,
1889
+ ),
1890
+ { exitCode: EXIT.xcodebuildFailed },
1891
+ );
1892
+ }
1893
+
1894
+ report.status = "passed";
1895
+ report.finishedAt = new Date().toISOString();
1896
+ writeReport(args.report, report);
1897
+ console.log("[ios-smoke] physical-device XCTest PASS");
1898
+ } catch (err) {
1899
+ report.status = "failed";
1900
+ report.finishedAt = new Date().toISOString();
1901
+ report.error = err instanceof Error ? err.message : String(err);
1902
+ if (!report.blocker) {
1903
+ const category =
1904
+ err?.exitCode === EXIT.noDevice
1905
+ ? "no-connected-physical-device"
1906
+ : err?.exitCode === EXIT.missingXcframework
1907
+ ? "missing-xcframework"
1908
+ : err?.exitCode === EXIT.localPreflight
1909
+ ? "local-preflight"
1910
+ : "unknown";
1911
+ report.blocker = {
1912
+ category,
1913
+ detail: report.error,
1914
+ nextAction: blockerNextAction(category, report.device?.name),
1915
+ };
1916
+ }
1917
+ if (err?.devices) {
1918
+ report.connectedPhysicalDevices = err.devices.connected;
1919
+ report.offlinePhysicalDevices = err.devices.offline;
1920
+ if (err?.exitCode === EXIT.noDevice) {
1921
+ report.deviceDiagnostics = captureUnavailableDeviceDiagnostics(
1922
+ err.devices,
1923
+ );
1924
+ }
1925
+ }
1926
+ if (err?.xcframeworkInfo) {
1927
+ report.xcframeworkInfo = err.xcframeworkInfo;
1928
+ }
1929
+ writeReport(args.report, report);
1930
+ process.stderr.write(`${report.error}\n`);
1931
+ process.exit(err?.exitCode ?? EXIT.xcodebuildFailed);
1932
+ } finally {
1933
+ process.off("SIGINT", signalHandler);
1934
+ process.off("SIGTERM", signalHandler);
1935
+ if (tempDir && !args.keepTemp) {
1936
+ fs.rmSync(tempDir, { recursive: true, force: true });
1937
+ } else if (tempDir) {
1938
+ console.log(`[ios-smoke] kept temp package at ${tempDir}`);
1939
+ }
1940
+ }
1941
+ }
1942
+
1943
+ main();