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

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 (97) hide show
  1. package/api/i18n-locale-routes.d.ts +7 -0
  2. package/api/i18n-locale-routes.d.ts.map +1 -0
  3. package/api/i18n-locale-routes.js +58 -0
  4. package/api/ios-local-agent-transport.d.ts +3 -0
  5. package/api/ios-local-agent-transport.d.ts.map +1 -1
  6. package/api/ios-local-agent-transport.js +22 -1
  7. package/api/server.d.ts.map +1 -1
  8. package/api/server.js +5 -0
  9. package/benchmark/cerebras-autowire.d.ts.map +1 -1
  10. package/benchmark/cerebras-autowire.js +9 -2
  11. package/package.json +36 -36
  12. package/packaging/debian/rules +1 -1
  13. package/packaging/flatpak/generate-sources.sh +6 -1
  14. package/packaging/snap/snapcraft.yaml +15 -11
  15. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAgentService.java +2 -1
  16. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaNativeBridge.java +5 -0
  17. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaStartupTrace.java +28 -0
  18. package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoicePlugin.java +1 -1
  19. package/platforms/android/app/src/main/java/ai/elizaos/app/MainActivity.java +1 -0
  20. package/platforms/electrobun/electrobun.config.ts +31 -1
  21. package/platforms/electrobun/package.json +10 -10
  22. package/platforms/electrobun/remotes/local-model/README.md +2 -5
  23. package/platforms/electrobun/remotes/local-model/src/bun/eliza1-catalog.ts +0 -16
  24. package/platforms/electrobun/remotes/local-model/src/dev/phase8-smoke.ts +0 -2
  25. package/platforms/electrobun/scripts/smoke-test.sh +8 -2
  26. package/platforms/electrobun/scripts/stage-macos-release-artifacts.sh +8 -2
  27. package/platforms/electrobun/scripts/sync-web-assets.mjs +31 -2
  28. package/platforms/electrobun/src/bridge/electrobun-boot-config.ts +8 -0
  29. package/platforms/electrobun/src/bridge/electrobun-crypto-ready.ts +5 -1
  30. package/platforms/electrobun/src/bridge/electrobun-direct-rpc.ts +5 -11
  31. package/platforms/electrobun/src/preload.js +1 -1
  32. package/platforms/ios/App/App/Base.lproj/Main.storyboard +1 -1
  33. package/platforms/ios/App/App/ElizaBridgeViewController.swift +22 -0
  34. package/platforms/ios/App/App/ElizaStartupTrace.swift +12 -0
  35. package/platforms/ios/App/App.xcodeproj/project.pbxproj +8 -0
  36. package/runtime/eliza.d.ts.map +1 -1
  37. package/runtime/eliza.js +18 -0
  38. package/runtime/voice-warmup.d.ts +4 -4
  39. package/runtime/voice-warmup.d.ts.map +1 -1
  40. package/runtime/voice-warmup.js +4 -4
  41. package/scripts/aosp/compile-libllama.mjs +25 -5
  42. package/scripts/aosp/compile-libllama.test.mjs +17 -1
  43. package/scripts/assert-required-bundled-packages.test.ts +24 -2
  44. package/scripts/benchmark-preflight.mjs +31 -2
  45. package/scripts/build-bundled-agent-skills-artifact.mjs +32 -8
  46. package/scripts/build-bundled-orchestrator-artifact.mjs +34 -12
  47. package/scripts/build-llama-cpp-mtp.mjs +27 -3
  48. package/scripts/build-patched-electrobun-cli.mjs +30 -2
  49. package/scripts/bun-riscv64/bun-version.json +1 -1
  50. package/scripts/bun-riscv64/validate.sh +21 -8
  51. package/scripts/check-real-local-reset.ts +13 -1
  52. package/scripts/check-sms-gateway-completion-audit.mjs +96 -31
  53. package/scripts/check-sms-gateway-readiness.mjs +54 -17
  54. package/scripts/clean-repo.mjs +21 -3
  55. package/scripts/copy-runtime-node-modules.ts +68 -63
  56. package/scripts/desktop-build.mjs +46 -5
  57. package/scripts/dev-platform-no-install.test.mjs +19 -0
  58. package/scripts/dev-platform.mjs +6 -2
  59. package/scripts/disable-local-eliza-workspace.mjs +23 -1
  60. package/scripts/docker-ci-smoke.sh +6 -5
  61. package/scripts/ensure-avatars.mjs +18 -5
  62. package/scripts/ensure-bundled-workspaces.mjs +4 -15
  63. package/scripts/ensure-type-package-aliases.mjs +47 -3
  64. package/scripts/ffi-stub/Makefile +5 -2
  65. package/scripts/ios-xcframework/build-xcframework.mjs +22 -11
  66. package/scripts/ios-xcframework/run-physical-device-smoke.mjs +99 -6
  67. package/scripts/ios-xcframework/runtime-symbol-shim.c +560 -105
  68. package/scripts/lib/agent-source-watcher.test.mjs +24 -4
  69. package/scripts/lib/apple-entitlement-audit.test.mjs +19 -2
  70. package/scripts/lib/artifact-staleness.test.mts +18 -1
  71. package/scripts/lib/patch-bun-exports.mjs +20 -2
  72. package/scripts/lib/patch-bun-exports.test.mjs +108 -4
  73. package/scripts/lib/renderer-build-manifest.test.mts +18 -1
  74. package/scripts/lib/stage-android-agent.mjs +16 -3
  75. package/scripts/lib/verify-ondevice-artifact.test.mts +18 -1
  76. package/scripts/link-docker-local-app-packages.mjs +26 -1
  77. package/scripts/mas-smoke.test.mjs +25 -9
  78. package/scripts/omnivoice-fuse/prepare.mjs +27 -4
  79. package/scripts/package-electrobun-linux.mjs +22 -7
  80. package/scripts/patch-deps.mjs +18 -5
  81. package/scripts/playwright-ui-live-stack.ts +16 -3
  82. package/scripts/playwright-ui-smoke-api-stub.mjs +167 -2
  83. package/scripts/prepare-ios-cocoapods.sh +5 -1
  84. package/scripts/prune-cdn-local-assets.mjs +52 -5
  85. package/scripts/run-mobile-build-android-app-actions.test.mjs +19 -1
  86. package/scripts/run-mobile-build-mtp-staleness.test.mts +20 -4
  87. package/scripts/run-mobile-build.mjs +74 -16
  88. package/scripts/stage-android-agent.test.mjs +19 -1
  89. package/scripts/stage-desktop-fused-lib.mjs +26 -1
  90. package/scripts/sync-desktop-renderer.mjs +53 -12
  91. package/scripts/test-sms-gateway-software.mjs +20 -4
  92. package/cli/command-format.d.ts +0 -2
  93. package/cli/command-format.d.ts.map +0 -1
  94. package/cli/command-format.js +0 -20
  95. package/register-runtime-hooks.d.ts +0 -2
  96. package/register-runtime-hooks.d.ts.map +0 -1
  97. package/register-runtime-hooks.js +0 -19
@@ -29,7 +29,7 @@
29
29
  * - xcodebuild -create-xcframework failure = hard error.
30
30
  */
31
31
 
32
- import { spawnSync } from "node:child_process";
32
+ import { execFileSync, spawnSync } from "node:child_process";
33
33
  import fs from "node:fs";
34
34
  import os from "node:os";
35
35
  import path from "node:path";
@@ -41,9 +41,10 @@ const __dirname = path.dirname(__filename);
41
41
 
42
42
  // packages/app-core/scripts/ios-xcframework → packages/app-core/scripts
43
43
  const SCRIPTS_DIR = path.resolve(__dirname, "..");
44
- const MTP_BUILD_SCRIPT = path.join(
44
+ const MTP_BUILD_SCRIPT = path.join(SCRIPTS_DIR, "build-llama-cpp-mtp.mjs");
45
+ const RECURSIVE_CLEANUP_SCRIPT = path.resolve(
45
46
  SCRIPTS_DIR,
46
- "build-llama-cpp-mtp.mjs",
47
+ "../../scripts/rm-path-recursive.mjs",
47
48
  );
48
49
 
49
50
  // Per AGENTS.md §3, the required kernels for any Eliza-1 binary.
@@ -273,6 +274,20 @@ function run(cmd, args, opts = {}) {
273
274
  }
274
275
  }
275
276
 
277
+ function removeDirectoryRecursive(targetPath) {
278
+ try {
279
+ execFileSync("node", [RECURSIVE_CLEANUP_SCRIPT, path.resolve(targetPath)], {
280
+ encoding: "utf8",
281
+ stdio: "pipe",
282
+ });
283
+ } catch (error) {
284
+ const detail = [error?.stdout, error?.stderr].filter(Boolean).join("\n");
285
+ throw new Error(detail || error?.message || String(error), {
286
+ cause: error,
287
+ });
288
+ }
289
+ }
290
+
276
291
  /**
277
292
  * @param {string} cmd
278
293
  * @param {string[]} args
@@ -350,7 +365,7 @@ function buildStaticFramework(tmpDir, slice, target) {
350
365
  `${target.platform}-arm64${target.isSimulator ? "-simulator" : ""}`,
351
366
  "LlamaCpp.framework",
352
367
  );
353
- fs.rmSync(frameworkDir, { recursive: true, force: true });
368
+ removeDirectoryRecursive(frameworkDir);
354
369
  fs.mkdirSync(frameworkDir, { recursive: true });
355
370
 
356
371
  // Combine every produced .a into one universal-of-one archive named
@@ -580,11 +595,7 @@ async function main() {
580
595
  console.log(
581
596
  `[ios-xcframework] simulator slice missing — invoking mtp build`,
582
597
  );
583
- run("node", [
584
- MTP_BUILD_SCRIPT,
585
- "--target",
586
- "ios-arm64-simulator-metal",
587
- ]);
598
+ run("node", [MTP_BUILD_SCRIPT, "--target", "ios-arm64-simulator-metal"]);
588
599
  }
589
600
  }
590
601
 
@@ -621,7 +632,7 @@ async function main() {
621
632
  });
622
633
 
623
634
  fs.mkdirSync(path.dirname(args.output), { recursive: true });
624
- fs.rmSync(args.output, { recursive: true, force: true });
635
+ removeDirectoryRecursive(args.output);
625
636
 
626
637
  run("xcodebuild", [
627
638
  "-create-xcframework",
@@ -638,7 +649,7 @@ async function main() {
638
649
  }
639
650
  console.log(`[ios-xcframework] wrote ${args.output}`);
640
651
  } finally {
641
- fs.rmSync(tmpDir, { recursive: true, force: true });
652
+ removeDirectoryRecursive(tmpDir);
642
653
  }
643
654
  }
644
655
 
@@ -26,7 +26,7 @@
26
26
  * real Eliza-1 bundle smoke can run.
27
27
  */
28
28
 
29
- import { spawn, spawnSync } from "node:child_process";
29
+ import { execFileSync, spawn, spawnSync } from "node:child_process";
30
30
  import fs from "node:fs";
31
31
  import os from "node:os";
32
32
  import path from "node:path";
@@ -38,6 +38,12 @@ const __dirname = path.dirname(__filename);
38
38
  const REPO_ROOT = path.resolve(__dirname, "..", "..", "..", "..");
39
39
  const APP_DIR = path.join(REPO_ROOT, "packages", "app");
40
40
  const XCFRAMEWORK_BUILD_SCRIPT = path.join(__dirname, "build-xcframework.mjs");
41
+ const RECURSIVE_CLEANUP_SCRIPT = path.join(
42
+ REPO_ROOT,
43
+ "packages",
44
+ "scripts",
45
+ "rm-path-recursive.mjs",
46
+ );
41
47
 
42
48
  const LLAMA_SYMBOLS = [
43
49
  "llama_init_context",
@@ -196,9 +202,13 @@ function parseArgs(argv) {
196
202
  args.xcodebuildArgs.push(next());
197
203
  break;
198
204
  case "--help":
205
+ printHelp();
206
+ process.exit(0);
207
+ break;
199
208
  case "-h":
200
209
  printHelp();
201
210
  process.exit(0);
211
+ break;
202
212
  default:
203
213
  throw new Error(`Unknown argument: ${a}`);
204
214
  }
@@ -1049,7 +1059,9 @@ function extractBenchmarkResults(text) {
1049
1059
  const results = [];
1050
1060
  const re = /ELIZA_IOS_TPS_RESULT\s+(\{[^\n]+\})/g;
1051
1061
  let match;
1052
- while ((match = re.exec(text)) !== null) {
1062
+ while (true) {
1063
+ match = re.exec(text);
1064
+ if (match === null) break;
1053
1065
  try {
1054
1066
  results.push(JSON.parse(match[1]));
1055
1067
  } catch {
@@ -1469,6 +1481,55 @@ final class ElizaIosRuntimeSmokeTests: XCTestCase {
1469
1481
  private let voiceSymbols: [String] = ${swiftArray(voiceSymbols)}
1470
1482
  private let benchmarkResourceName = ${jsString(benchmarkResourceName)}
1471
1483
 
1484
+ private func thermalStateName() -> String {
1485
+ switch ProcessInfo.processInfo.thermalState {
1486
+ case .nominal:
1487
+ return "nominal"
1488
+ case .fair:
1489
+ return "fair"
1490
+ case .serious:
1491
+ return "serious"
1492
+ case .critical:
1493
+ return "critical"
1494
+ @unknown default:
1495
+ return "unknown"
1496
+ }
1497
+ }
1498
+
1499
+ private func memoryFootprintBytes() -> Int64? {
1500
+ var info = task_vm_info_data_t()
1501
+ var count = mach_msg_type_number_t(MemoryLayout<task_vm_info_data_t>.stride / MemoryLayout<integer_t>.stride)
1502
+ let result = withUnsafeMutablePointer(to: &info) { pointer in
1503
+ pointer.withMemoryRebound(to: integer_t.self, capacity: Int(count)) { rebound in
1504
+ task_info(mach_task_self_, task_flavor_t(TASK_VM_INFO), rebound, &count)
1505
+ }
1506
+ }
1507
+ guard result == KERN_SUCCESS else {
1508
+ return nil
1509
+ }
1510
+ return Int64(info.phys_footprint)
1511
+ }
1512
+
1513
+ private func addBenchmarkTelemetry(
1514
+ to report: inout [String: Any],
1515
+ memoryBeforeBytes: Int64?,
1516
+ memoryAfterBytes: Int64?,
1517
+ thermalStateBefore: String,
1518
+ thermalStateAfter: String
1519
+ ) {
1520
+ report["thermal_state_before"] = thermalStateBefore
1521
+ report["thermal_state_after"] = thermalStateAfter
1522
+ if let memoryBeforeBytes {
1523
+ report["memory_footprint_before_bytes"] = memoryBeforeBytes
1524
+ }
1525
+ if let memoryAfterBytes {
1526
+ report["memory_footprint_after_bytes"] = memoryAfterBytes
1527
+ }
1528
+ if let memoryBeforeBytes, let memoryAfterBytes {
1529
+ report["memory_footprint_delta_bytes"] = memoryAfterBytes - memoryBeforeBytes
1530
+ }
1531
+ }
1532
+
1472
1533
  func testMetalDeviceIsAvailableOnPhysicalIos() throws {
1473
1534
  XCTAssertNil(ProcessInfo.processInfo.environment["SIMULATOR_DEVICE_NAME"], "This smoke must run on physical iOS hardware, not a simulator.")
1474
1535
  let device = MTLCreateSystemDefaultDevice()
@@ -1517,11 +1578,15 @@ final class ElizaIosRuntimeSmokeTests: XCTestCase {
1517
1578
  )
1518
1579
 
1519
1580
  for mode in ["cpu", "metal"] {
1581
+ let memoryBeforeBytes = memoryFootprintBytes()
1582
+ let thermalStateBefore = thermalStateName()
1520
1583
  let ptr = modelURL.path.withCString { cPath in
1521
1584
  mode.withCString { cMode in
1522
1585
  eliza_ios_text_benchmark_run(cPath, cMode)
1523
1586
  }
1524
1587
  }
1588
+ let memoryAfterBytes = memoryFootprintBytes()
1589
+ let thermalStateAfter = thermalStateName()
1525
1590
  let raw = try XCTUnwrap(ptr, "eliza_ios_text_benchmark_run returned null for \\(mode)")
1526
1591
  defer { eliza_ios_ffi_abi_smoke_free(raw) }
1527
1592
 
@@ -1530,7 +1595,7 @@ final class ElizaIosRuntimeSmokeTests: XCTestCase {
1530
1595
  let jsonObject = try JSONSerialization.jsonObject(with: data)
1531
1596
  let json = try XCTUnwrap(jsonObject as? [String: Any], "Benchmark result is not a JSON object for \\(mode): \\(text)")
1532
1597
  if let error = json["error"] as? String {
1533
- let report: [String: Any] = [
1598
+ var report: [String: Any] = [
1534
1599
  "mode": mode,
1535
1600
  "model": benchmarkResourceName,
1536
1601
  "error": error,
@@ -1540,6 +1605,13 @@ final class ElizaIosRuntimeSmokeTests: XCTestCase {
1540
1605
  "prompt_per_second": 0,
1541
1606
  "predicted_per_second": 0
1542
1607
  ]
1608
+ addBenchmarkTelemetry(
1609
+ to: &report,
1610
+ memoryBeforeBytes: memoryBeforeBytes,
1611
+ memoryAfterBytes: memoryAfterBytes,
1612
+ thermalStateBefore: thermalStateBefore,
1613
+ thermalStateAfter: thermalStateAfter
1614
+ )
1543
1615
  let reportData = try JSONSerialization.data(withJSONObject: report, options: [.sortedKeys])
1544
1616
  print("ELIZA_IOS_TPS_RESULT " + String(data: reportData, encoding: .utf8)!)
1545
1617
  XCTFail("llama_completion failed for \\(mode): \\(error)")
@@ -1555,7 +1627,7 @@ final class ElizaIosRuntimeSmokeTests: XCTestCase {
1555
1627
  XCTAssertGreaterThan(predictedPerSecond, 0, "predicted_per_second must be positive for \\(mode)")
1556
1628
  XCTAssertGreaterThan(predicted, 0, "tokens_predicted must be positive for \\(mode)")
1557
1629
 
1558
- let report: [String: Any] = [
1630
+ var report: [String: Any] = [
1559
1631
  "mode": mode,
1560
1632
  "model": benchmarkResourceName,
1561
1633
  "tokens_predicted": predicted,
@@ -1563,6 +1635,13 @@ final class ElizaIosRuntimeSmokeTests: XCTestCase {
1563
1635
  "prompt_per_second": promptPerSecond,
1564
1636
  "predicted_per_second": predictedPerSecond
1565
1637
  ]
1638
+ addBenchmarkTelemetry(
1639
+ to: &report,
1640
+ memoryBeforeBytes: memoryBeforeBytes,
1641
+ memoryAfterBytes: memoryAfterBytes,
1642
+ thermalStateBefore: thermalStateBefore,
1643
+ thermalStateAfter: thermalStateAfter
1644
+ )
1566
1645
  let reportData = try JSONSerialization.data(withJSONObject: report, options: [.sortedKeys])
1567
1646
  print("ELIZA_IOS_TPS_RESULT " + String(data: reportData, encoding: .utf8)!)
1568
1647
  }
@@ -1639,6 +1718,20 @@ function writeReport(reportPath, report) {
1639
1718
  );
1640
1719
  }
1641
1720
 
1721
+ function removeDirectoryRecursive(targetPath) {
1722
+ try {
1723
+ execFileSync("node", [RECURSIVE_CLEANUP_SCRIPT, path.resolve(targetPath)], {
1724
+ encoding: "utf8",
1725
+ stdio: "pipe",
1726
+ });
1727
+ } catch (error) {
1728
+ const detail = [error?.stdout, error?.stderr].filter(Boolean).join("\n");
1729
+ throw new Error(detail || error?.message || String(error), {
1730
+ cause: error,
1731
+ });
1732
+ }
1733
+ }
1734
+
1642
1735
  function hasXcodebuildArg(args, flag) {
1643
1736
  return args.xcodebuildArgs.includes(flag);
1644
1737
  }
@@ -1753,7 +1846,7 @@ async function main() {
1753
1846
  };
1754
1847
  writeReport(args.report, report);
1755
1848
  if (tempDir && !args.keepTemp) {
1756
- fs.rmSync(tempDir, { recursive: true, force: true });
1849
+ removeDirectoryRecursive(tempDir);
1757
1850
  }
1758
1851
  process.stderr.write(`${report.error}\n`);
1759
1852
  process.exit(signal === "SIGINT" ? 130 : 143);
@@ -1933,7 +2026,7 @@ async function main() {
1933
2026
  process.off("SIGINT", signalHandler);
1934
2027
  process.off("SIGTERM", signalHandler);
1935
2028
  if (tempDir && !args.keepTemp) {
1936
- fs.rmSync(tempDir, { recursive: true, force: true });
2029
+ removeDirectoryRecursive(tempDir);
1937
2030
  } else if (tempDir) {
1938
2031
  console.log(`[ios-smoke] kept temp package at ${tempDir}`);
1939
2032
  }