@native-sdk/cli 0.9.0 → 0.9.2

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 (181) hide show
  1. package/build/app.zig +357 -33
  2. package/build.zig +234 -11
  3. package/native-sdk.d.ts +8 -0
  4. package/package.json +10 -10
  5. package/packages/core/compile-surface/core.ts +70 -1
  6. package/packages/core/package-lock.json +11 -11
  7. package/packages/core/package.json +2 -2
  8. package/packages/core/scripts/merge_static_archives.mjs +78 -0
  9. package/packages/core/scripts/run_external_core_compiler.mjs +52 -7
  10. package/packages/core/scripts/run_external_service_compiler.mjs +53 -13
  11. package/packages/core/scripts/stage_external_services.mjs +1 -1
  12. package/packages/core/sdk/core.d.ts +75 -0
  13. package/packages/core/sdk/core.ts +170 -13
  14. package/packages/core/sdk/events.d.ts +53 -0
  15. package/packages/core/sdk/events.ts +78 -7
  16. package/packages/core/src/checker.ts +470 -2
  17. package/packages/core/src/cli.ts +13 -0
  18. package/packages/core/src/contract.ts +3 -1
  19. package/packages/core/src/devhost.ts +30 -1
  20. package/packages/core/src/devhost_journal.mjs +10 -8
  21. package/packages/core/src/diagnostics.ts +99 -8
  22. package/packages/core/src/frontend.ts +6 -0
  23. package/packages/core/src/infer.ts +24 -0
  24. package/skill-data/automation/SKILL.md +1 -1
  25. package/skill-data/native-ui/SKILL.md +18 -12
  26. package/skill-data/ts-core/SKILL.md +54 -21
  27. package/skill-data/ts-services/SKILL.md +4 -4
  28. package/skill-data/ts-services/references/service-surface.md +2 -1
  29. package/skill-data/zig/SKILL.md +1 -1
  30. package/src/app_runner/root.zig +122 -6
  31. package/src/app_runner/ts_core_main.zig +9 -4
  32. package/src/app_runner/ts_core_mobile.zig +241 -0
  33. package/src/app_runner/window_placement.zig +63 -0
  34. package/src/automation/protocol.zig +5 -1
  35. package/src/automation/snapshot.zig +8 -6
  36. package/src/embed/app_exports.zig +3 -1
  37. package/src/embed/conversions.zig +1 -0
  38. package/src/embed/host.zig +10 -3
  39. package/src/embed/root.zig +2 -0
  40. package/src/embed/tests.zig +41 -1
  41. package/src/embed/types.zig +2 -0
  42. package/src/embed/ui_host.zig +94 -4
  43. package/src/platform/android/NativeSdkActivity.java +49 -4
  44. package/src/platform/android/android_host.c +3 -3
  45. package/src/platform/android/native_sdk_app.h +1 -1
  46. package/src/platform/ios/apple_image_fit.h +38 -0
  47. package/src/platform/ios/files.zig +1 -0
  48. package/src/platform/ios/native_sdk_app.h +1 -1
  49. package/src/platform/ios/uikit_host.m +28 -5
  50. package/src/platform/linux/cef_host.cpp +17 -3
  51. package/src/platform/linux/gtk_host.c +243 -15
  52. package/src/platform/linux/gtk_host.h +5 -4
  53. package/src/platform/linux/root.zig +91 -11
  54. package/src/platform/macos/appkit_host.h +18 -11
  55. package/src/platform/macos/appkit_host.m +402 -128
  56. package/src/platform/macos/cef_host.mm +342 -122
  57. package/src/platform/macos/image_fit_test.m +44 -0
  58. package/src/platform/macos/root.zig +231 -39
  59. package/src/platform/null_platform.zig +251 -54
  60. package/src/platform/null_platform_tests.zig +97 -4
  61. package/src/platform/root.zig +12 -0
  62. package/src/platform/types.zig +174 -35
  63. package/src/platform/windows/root.zig +42 -13
  64. package/src/platform/windows/webview2_host.cpp +72 -11
  65. package/src/primitives/app_manifest/root.zig +3 -0
  66. package/src/primitives/app_manifest/tests.zig +24 -0
  67. package/src/primitives/app_manifest/types.zig +13 -0
  68. package/src/primitives/app_manifest/validation.zig +24 -0
  69. package/src/primitives/canvas/a11y_audit.zig +9 -7
  70. package/src/primitives/canvas/a11y_audit_tests.zig +24 -0
  71. package/src/primitives/canvas/events.zig +50 -0
  72. package/src/primitives/canvas/layout_audit.zig +6 -6
  73. package/src/primitives/canvas/markdown.zig +4 -0
  74. package/src/primitives/canvas/markdown_tests.zig +1 -0
  75. package/src/primitives/canvas/png.zig +138 -0
  76. package/src/primitives/canvas/root.zig +13 -2
  77. package/src/primitives/canvas/text_span_tests.zig +5 -3
  78. package/src/primitives/canvas/text_spans.zig +2 -0
  79. package/src/primitives/canvas/text_tests.zig +20 -0
  80. package/src/primitives/canvas/ui.zig +55 -2
  81. package/src/primitives/canvas/ui_markup.zig +40 -13
  82. package/src/primitives/canvas/ui_markup_binary.zig +8 -6
  83. package/src/primitives/canvas/ui_markup_binary_tests.zig +14 -4
  84. package/src/primitives/canvas/ui_markup_compiled.zig +5 -1
  85. package/src/primitives/canvas/ui_markup_compiled_tests.zig +52 -0
  86. package/src/primitives/canvas/ui_markup_tests.zig +11 -2
  87. package/src/primitives/canvas/ui_markup_view.zig +8 -2
  88. package/src/primitives/canvas/ui_markup_view_tests.zig +49 -4
  89. package/src/primitives/canvas/ui_schema.zig +17 -13
  90. package/src/primitives/canvas/ui_tests.zig +47 -0
  91. package/src/primitives/canvas/widget_access.zig +3 -3
  92. package/src/primitives/canvas/widget_anchored_tests.zig +106 -0
  93. package/src/primitives/canvas/widget_builtin_tests.zig +580 -32
  94. package/src/primitives/canvas/widget_invalidation.zig +33 -6
  95. package/src/primitives/canvas/widget_layout.zig +333 -126
  96. package/src/primitives/canvas/widget_layout_tests.zig +169 -0
  97. package/src/primitives/canvas/widget_metrics.zig +7 -8
  98. package/src/primitives/canvas/widget_render.zig +76 -44
  99. package/src/primitives/canvas/widget_render_controls.zig +110 -32
  100. package/src/primitives/canvas/widget_render_style.zig +58 -18
  101. package/src/primitives/canvas/widget_render_surfaces.zig +45 -14
  102. package/src/primitives/canvas/widget_routing.zig +40 -34
  103. package/src/primitives/canvas/widget_runtime.zig +11 -2
  104. package/src/primitives/canvas/widget_runtime_tests.zig +10 -14
  105. package/src/primitives/canvas/widget_semantics.zig +8 -3
  106. package/src/primitives/canvas/widget_semantics_tests.zig +6 -2
  107. package/src/primitives/canvas/widget_tree.zig +99 -5
  108. package/src/primitives/canvas/widgets.zig +20 -7
  109. package/src/root.zig +10 -0
  110. package/src/runtime/api.zig +14 -0
  111. package/src/runtime/automation_commands.zig +35 -2
  112. package/src/runtime/automation_snapshot.zig +32 -24
  113. package/src/runtime/automation_widget_dispatch.zig +48 -6
  114. package/src/runtime/bridge_permission_tests.zig +35 -1
  115. package/src/runtime/bridge_responses.zig +1 -1
  116. package/src/runtime/builtin_bridge.zig +16 -3
  117. package/src/runtime/canvas_frame_packet_tests.zig +22 -13
  118. package/src/runtime/canvas_image_tests.zig +146 -2
  119. package/src/runtime/canvas_images.zig +35 -16
  120. package/src/runtime/canvas_limits.zig +13 -3
  121. package/src/runtime/canvas_widget_accessibility_tests.zig +279 -4
  122. package/src/runtime/canvas_widget_anchored_tests.zig +54 -0
  123. package/src/runtime/canvas_widget_control_tests.zig +31 -1
  124. package/src/runtime/canvas_widget_events.zig +151 -26
  125. package/src/runtime/canvas_widget_floating_tests.zig +48 -0
  126. package/src/runtime/canvas_widget_runtime.zig +322 -102
  127. package/src/runtime/canvas_widget_scroll_driver_tests.zig +34 -0
  128. package/src/runtime/canvas_widget_scroll_drivers.zig +12 -10
  129. package/src/runtime/canvas_widget_scroll_tests.zig +193 -2
  130. package/src/runtime/canvas_widget_semantics_tests.zig +337 -3
  131. package/src/runtime/canvas_widget_split_tree_tests.zig +55 -0
  132. package/src/runtime/canvas_widget_state.zig +33 -7
  133. package/src/runtime/core.zig +28 -6
  134. package/src/runtime/effects.zig +1337 -49
  135. package/src/runtime/effects_file_tests.zig +587 -0
  136. package/src/runtime/effects_image_tests.zig +91 -0
  137. package/src/runtime/effects_notification_tests.zig +11 -0
  138. package/src/runtime/file_access.zig +400 -0
  139. package/src/runtime/file_effect_crash_helper.zig +28 -0
  140. package/src/runtime/file_effect_crash_tests.zig +37 -0
  141. package/src/runtime/flow.zig +21 -9
  142. package/src/runtime/gpu_surface_events.zig +25 -2
  143. package/src/runtime/native_command_event_tests.zig +44 -2
  144. package/src/runtime/pty.zig +5 -2
  145. package/src/runtime/root.zig +7 -0
  146. package/src/runtime/session_blobs.zig +4 -1
  147. package/src/runtime/session_journal.zig +56 -5
  148. package/src/runtime/session_record.zig +38 -0
  149. package/src/runtime/session_replay.zig +110 -15
  150. package/src/runtime/session_tests.zig +192 -4
  151. package/src/runtime/shell_layout_tests.zig +12 -0
  152. package/src/runtime/state.zig +10 -0
  153. package/src/runtime/system_services.zig +129 -36
  154. package/src/runtime/ts_core_host.zig +281 -11
  155. package/src/runtime/ts_core_host_tests.zig +142 -1
  156. package/src/runtime/ts_ui_app.zig +461 -8
  157. package/src/runtime/ui_app.zig +330 -112
  158. package/src/runtime/ui_app_tests.zig +251 -25
  159. package/src/runtime/ui_app_window_tests.zig +74 -8
  160. package/src/runtime/validation.zig +20 -0
  161. package/src/runtime/view.zig +3 -0
  162. package/src/runtime/view_widget_control.zig +18 -0
  163. package/src/runtime/view_widget_scroll.zig +112 -18
  164. package/src/runtime/view_widget_tree.zig +110 -13
  165. package/src/runtime/widget_bridge.zig +2 -0
  166. package/src/runtime/window_command_bridge_tests.zig +86 -0
  167. package/src/runtime/window_storage.zig +16 -1
  168. package/src/runtime/window_views.zig +1 -0
  169. package/src/tooling/ios.zig +3 -0
  170. package/src/tooling/manifest.zig +90 -2
  171. package/src/tooling/package.zig +67 -2
  172. package/src/tooling/raw_manifest.zig +10 -0
  173. package/src/tooling/templates.zig +156 -18
  174. package/src/tooling/ts_core.zig +83 -0
  175. package/src/tooling/web_engine.zig +1 -1
  176. package/tools/corewire/emit.zig +3 -3
  177. package/tools/corewire/emit_facade.zig +65 -5
  178. package/tools/corewire/emit_profile.zig +2 -2
  179. package/tools/corewire/emit_service.zig +2 -2
  180. package/tools/corewire/service_contract.zig +4 -4
  181. package/tools/corewire/sidecar.zig +4 -4
package/build.zig CHANGED
@@ -198,11 +198,55 @@ pub fn build(b: *std.Build) void {
198
198
  desktop_mod.addIncludePath(b.path("third_party/sqlite"));
199
199
  desktop_mod.addCSourceFile(.{
200
200
  .file = b.path("third_party/sqlite/sqlite3.c"),
201
- .flags = sqliteCompileFlags(),
201
+ // Mobile -Dtargets (the mobile e2e battery) compile the
202
+ // amalgamation against the platform SDK/NDK sysroot; desktop
203
+ // targets keep Zig's ordinary libc discovery.
204
+ .flags = if (target.result.os.tag == .ios or target.result.abi.isAndroid())
205
+ @import("build/app.zig").sqliteCFlags(b, target)
206
+ else
207
+ sqliteCompileFlags(),
202
208
  });
209
+ const app_runner_window_placement_mod = module(b, target, optimize, "src/app_runner/window_placement.zig");
210
+ app_runner_window_placement_mod.addImport("native_sdk", desktop_mod);
211
+ const app_runner_window_placement_tests = testArtifact(b, app_runner_window_placement_mod);
203
212
  desktop_mod.link_libc = true;
213
+ if (target.result.os.tag == .macos) {
214
+ const flags: []const []const u8 = if (b.sysroot) |sysroot|
215
+ &.{ "-fobjc-arc", "-fno-sanitize=builtin", "-ObjC", "-mmacosx-version-min=11.0", "-isysroot", sysroot, b.fmt("-I{s}/usr/include", .{sysroot}) }
216
+ else
217
+ &.{ "-fobjc-arc", "-fno-sanitize=builtin", "-ObjC", "-mmacosx-version-min=11.0" };
218
+ desktop_mod.addCSourceFile(.{ .file = b.path("src/platform/macos/image_fit_test.m"), .flags = flags });
219
+ desktop_mod.linkFramework("Foundation", .{});
220
+ desktop_mod.linkFramework("ImageIO", .{});
221
+ desktop_mod.linkSystemLibrary("objc", .{});
222
+ }
204
223
  const desktop_tests = testArtifact(b, desktop_mod);
205
224
  const desktop_test_shards = desktopTestShardArtifacts(b, desktop_mod);
225
+ // Tier-5 crash battery: a child uses the public streamed sink, signals
226
+ // after a chunk is durable only in the atomic temporary, then the parent
227
+ // kills it and verifies the destination still names the old generation.
228
+ const file_crash_helper_mod = module(b, target, optimize, "src/runtime/file_effect_crash_helper.zig");
229
+ file_crash_helper_mod.addImport("native_sdk", desktop_mod);
230
+ const file_crash_helper = b.addExecutable(.{ .name = "file-effect-crash-helper", .root_module = file_crash_helper_mod });
231
+ const file_crash_tests_mod = module(b, target, optimize, "src/runtime/file_effect_crash_tests.zig");
232
+ file_crash_tests_mod.addImport("native_sdk", desktop_mod);
233
+ const file_crash_options = b.addOptions();
234
+ file_crash_options.addOptionPath("helper_executable", file_crash_helper.getEmittedBin());
235
+ file_crash_tests_mod.addOptions("file_crash_options", file_crash_options);
236
+ const file_crash_tests = testArtifact(b, file_crash_tests_mod);
237
+ const file_crash_run = b.addRunArtifact(file_crash_tests);
238
+ const file_crash_step = b.step("test-file-effect-crash", "Kill a streamed writer before close and verify atomic destination visibility");
239
+ file_crash_step.dependOn(&file_crash_run.step);
240
+ const tier5_tests = filteredTestArtifact(b, desktop_mod, "storage-tier-5-tests", &.{
241
+ "runtime.effects_file_tests.test",
242
+ "runtime.file_access.test",
243
+ "runtime.session_record.test.recorder moves streamed file chunks",
244
+ "runtime.session_tests.test.a multi-megabyte file stream",
245
+ });
246
+ const tier5_run = b.addRunArtifact(tier5_tests);
247
+ const tier5_step = b.step("test-storage-tier-5", "Run file streaming, bounds, replay/blob, gating, and crash-atomicity batteries");
248
+ tier5_step.dependOn(&tier5_run.step);
249
+ tier5_step.dependOn(&file_crash_run.step);
206
250
 
207
251
  // SQLite is capability-shed from ordinary app artifacts. Its focused
208
252
  // engine/store suite gets a dedicated module that explicitly compiles the
@@ -562,8 +606,10 @@ pub fn build(b: *std.Build) void {
562
606
  test_step.dependOn(&b.addRunArtifact(platform_info_tests).step);
563
607
  test_step.dependOn(&b.addRunArtifact(json_tests).step);
564
608
  test_step.dependOn(&b.addRunArtifact(app_runner_assets_tests).step);
609
+ test_step.dependOn(&b.addRunArtifact(app_runner_window_placement_tests).step);
565
610
  test_step.dependOn(&b.addRunArtifact(canvas_tests).step);
566
611
  test_step.dependOn(&b.addRunArtifact(record_store_tests).step);
612
+ test_step.dependOn(&file_crash_run.step);
567
613
  for (desktop_test_shards) |shard_tests| {
568
614
  test_step.dependOn(&b.addRunArtifact(shard_tests).step);
569
615
  }
@@ -591,7 +637,9 @@ pub fn build(b: *std.Build) void {
591
637
  // no build inputs/outputs to hash, so always run it.
592
638
  scaffold_ide_e2e_run.has_side_effects = true;
593
639
  const ai_chat_e2e_run = b.addRunArtifact(ts_core_artifacts.ai_chat);
640
+ const feed_reader_e2e_run = b.addRunArtifact(ts_core_artifacts.feed_reader);
594
641
  const services_e2e_run = b.addRunArtifact(ts_core_artifacts.services);
642
+ ts_services_e2e_step.dependOn(&feed_reader_e2e_run.step);
595
643
  ts_services_e2e_step.dependOn(&services_e2e_run.step);
596
644
  // The same fixture through the in-process carrier (ServicePool over
597
645
  // the linked service archive): parallel keys, per-key FIFO,
@@ -618,13 +666,15 @@ pub fn build(b: *std.Build) void {
618
666
  const sidecar_conformance_run = b.addRunArtifact(ts_core_artifacts.sidecar_conformance);
619
667
  const sidecar_conformance_step = b.step("sidecar-conformance", "Validate corewire-generated mirrors over every fixture's frontend-emitted contract (requires node)");
620
668
  sidecar_conformance_step.dependOn(&sidecar_conformance_run.step);
621
- // ABI-law suite over a real compiled core: the markup fixture's
622
- // archive driven directly through the C ABI (collect invariant,
623
- // deterministic re-init, channel envelopes, integer classes).
669
+ // ABI-law suites over real compiled cores: the broad markup fixture
670
+ // plus the focused mixed bare-Model/[Model, Cmd] return regression.
624
671
  const abi_laws_run = b.addRunArtifact(ts_core_artifacts.external_core_abi_laws);
625
- const abi_laws_step = b.step("test-external-core-abi", "Run the compiled-core ABI-law suite over the markup fixture's archive (requires node and `npm ci` in packages/core)");
672
+ const mixed_return_abi_run = b.addRunArtifact(ts_core_artifacts.mixed_return_abi_laws);
673
+ const abi_laws_step = b.step("test-external-core-abi", "Run the compiled-core ABI-law suites, including mixed update returns (requires node and `npm ci` in packages/core)");
626
674
  abi_laws_step.dependOn(&abi_laws_run.step);
675
+ abi_laws_step.dependOn(&mixed_return_abi_run.step);
627
676
  test_step.dependOn(&abi_laws_run.step);
677
+ test_step.dependOn(&mixed_return_abi_run.step);
628
678
  // The cross-execution battery staging: the host-fixture and
629
679
  // markup batteries (update/snapshot/effects and the markup view
630
680
  // over genuinely compiled cores) plus, where the target admits
@@ -638,6 +688,14 @@ pub fn build(b: *std.Build) void {
638
688
  if (ts_core_artifacts.services_pool) |pool_tests| {
639
689
  cross_e2e_step.dependOn(&b.addInstallArtifact(pool_tests, .{ .dest_dir = e2e_dir }).step);
640
690
  }
691
+ // The mobile execution battery staging: one static library the
692
+ // platform toolchain (xcrun clang / NDK clang) links around a tiny
693
+ // harness for execution on the simulator or emulator. Registered
694
+ // only for a mobile -Dtarget; scripts/mobile-e2e.sh is the driver.
695
+ if (ts_core_artifacts.mobile_battery) |battery| {
696
+ const mobile_e2e_step = b.step("stage-mobile-e2e", "Install the TS mobile e2e battery archive under <prefix>/e2e (pair with -Dtarget=aarch64-ios-simulator or aarch64-linux-android and -p; see scripts/mobile-e2e.sh)");
697
+ mobile_e2e_step.dependOn(&b.addInstallFileWithDir(battery, .{ .custom = "e2e" }, "libts-mobile-e2e.a").step);
698
+ }
641
699
  // The corpus contract artifacts an external core toolchain
642
700
  // consumes: per fixture, the frontend-emitted contract sidecar
643
701
  // (after projection), the generated entry module, and the
@@ -657,6 +715,7 @@ pub fn build(b: *std.Build) void {
657
715
  ts_core_e2e_step.dependOn(&monitor_e2e_run.step);
658
716
  ts_core_e2e_step.dependOn(&scaffold_ide_e2e_run.step);
659
717
  ts_core_e2e_step.dependOn(&ai_chat_e2e_run.step);
718
+ ts_core_e2e_step.dependOn(&feed_reader_e2e_run.step);
660
719
  ts_core_e2e_step.dependOn(&services_e2e_run.step);
661
720
  if (services_pool_e2e_run) |run| ts_core_e2e_step.dependOn(&run.step);
662
721
  test_step.dependOn(&host_e2e_run.step);
@@ -667,6 +726,7 @@ pub fn build(b: *std.Build) void {
667
726
  test_step.dependOn(&monitor_e2e_run.step);
668
727
  test_step.dependOn(&scaffold_ide_e2e_run.step);
669
728
  test_step.dependOn(&ai_chat_e2e_run.step);
729
+ test_step.dependOn(&feed_reader_e2e_run.step);
670
730
  test_step.dependOn(&services_e2e_run.step);
671
731
  if (services_pool_e2e_run) |run| test_step.dependOn(&run.step);
672
732
  test_step.dependOn(&sidecar_conformance_run.step);
@@ -761,10 +821,16 @@ pub fn build(b: *std.Build) void {
761
821
  .{ .path = "build.zig", .pattern = "if (!app_build.linuxGlibcSpellingHitsDefaultFloor(target)) return;" },
762
822
  .{ .path = "build/app.zig", .pattern = "scriptcPlatformTriple(b, target),\n // Keep the core and service archives on the same cross compiler" },
763
823
  .{ .path = "build.zig", .pattern = "app_build.scriptcPlatformTriple(b, target),\n \"--zig-exe\",\n b.graph.zig_exe," },
764
- .{ .path = "build.zig", .pattern = "compile.addArgs(&.{ \"--host-platform\", host_platform, \"--target-platform\", app_build.scriptcPlatformTriple(b, target), \"--zig-exe\", b.graph.zig_exe });\n addScriptcGlibcFloorTeaching(b, target, &compile.step);" },
765
- .{ .path = "build.zig", .pattern = "app_build.scriptcPlatformTriple(b, target),\n \"--zig-exe\",\n b.graph.zig_exe,\n });\n addScriptcGlibcFloorTeaching(b, target, &compile.step);" },
824
+ .{ .path = "build.zig", .pattern = "compile.addArgs(&.{ \"--host-platform\", host_platform, \"--target-platform\", app_build.scriptcPlatformTriple(b, target), \"--zig-exe\", b.graph.zig_exe });\n app_build.addScriptcAndroidNdk(b, compile, target);\n addScriptcGlibcFloorTeaching(b, target, &compile.step);" },
825
+ .{ .path = "build.zig", .pattern = "app_build.scriptcPlatformTriple(b, target),\n \"--zig-exe\",\n b.graph.zig_exe,\n });\n app_build.addScriptcAndroidNdk(b, compile, target);\n addScriptcGlibcFloorTeaching(b, target, &compile.step);" },
766
826
  .{ .path = "build.zig", .pattern = "abi_laws_mod.addObjectFile(markup_fixture.archive);\n addScriptcArchiveSystemLibs(abi_laws_mod, target);" },
767
- .{ .path = "packages/core/scripts/run_external_core_compiler.mjs", .pattern = "SCRIPTC_TARGET: args[\"target-platform\"]" },
827
+ // Both drivers map the build graph's Zig triple onto the compiler's
828
+ // own mobile spellings and thread the NDK like --zig-exe.
829
+ .{ .path = "packages/core/scripts/run_external_core_compiler.mjs", .pattern = "SCRIPTC_TARGET: scriptcTarget" },
830
+ .{ .path = "packages/core/scripts/run_external_service_compiler.mjs", .pattern = "SCRIPTC_TARGET: scriptcTarget" },
831
+ .{ .path = "packages/core/scripts/run_external_core_compiler.mjs", .pattern = "ANDROID_NDK_ROOT: args[\"android-ndk\"]" },
832
+ .{ .path = "packages/core/scripts/run_external_service_compiler.mjs", .pattern = "ANDROID_NDK_ROOT: args[\"android-ndk\"]" },
833
+ .{ .path = "build/app.zig", .pattern = ".ios => host.os.tag == .macos and target.result.cpu.arch == .aarch64" },
768
834
  });
769
835
  addFileContainsCheckStep(b, file_contains_checker, test_step, "test-app-test-entry-analysis", "Verify the managed app test step force-analyzes the entry point (UiApp.create's Model-defaults rule must teach at `native test`, not ambush at `native build`)", &.{
770
836
  .{ .path = "build/app.zig", .pattern = "app_analysis.zig" },
@@ -772,6 +838,31 @@ pub fn build(b: *std.Build) void {
772
838
  .{ .path = "build/app.zig", .pattern = "test_step.dependOn(&analysis_obj.step);" },
773
839
  .{ .path = "src/runtime/ui_app.zig", .pattern = "has no default value - give every Model field a default" },
774
840
  });
841
+ addFileContainsCheckStep(b, file_contains_checker, test_step, "test-owned-runner-window-placement", "Verify owned example runners preserve explicit origins and distinguish successful state restoration", &.{
842
+ .{ .path = "examples/hello/src/runner.zig", .pattern = ".initial_placement = if (@hasField(@TypeOf(window), \"x\") or @hasField(@TypeOf(window), \"y\")) .explicit else .default" },
843
+ .{ .path = "examples/hello/src/runner.zig", .pattern = "window.initial_placement = .restored;" },
844
+ .{ .path = "examples/hello/src/runner.zig", .pattern = "app_info.main_window.initial_placement = .restored;" },
845
+ .{ .path = "examples/capabilities/src/runner.zig", .pattern = "info.main_window.default_frame = manifestShellStartupFrame(info.main_window.default_frame);" },
846
+ .{ .path = "examples/capabilities/src/runner.zig", .pattern = "info.main_window.restore_state = manifestShellStartupRestoreState(info.main_window.restore_state);" },
847
+ .{ .path = "examples/capabilities/src/runner.zig", .pattern = "info.main_window.restore_policy = manifestShellStartupRestorePolicy(info.main_window.restore_policy);" },
848
+ .{ .path = "examples/capabilities/src/runner.zig", .pattern = "info.main_window.initial_placement = manifestShellStartupInitialPlacement(info.main_window.initial_placement);" },
849
+ });
850
+ addFileContainsCheckStep(b, file_contains_checker, test_step, "test-macos-window-placement-contracts", "Verify both macOS hosts use the primary display and restore persisted content frames without titlebar growth", &.{
851
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "return [NSScreen screens].firstObject ?: [NSScreen mainScreen];" },
852
+ .{ .path = "src/platform/macos/cef_host.mm", .pattern = "return [NSScreen screens].firstObject ?: [NSScreen mainScreen];" },
853
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "[window frameRectForContentRect:restoredContentFrame]" },
854
+ .{ .path = "src/platform/macos/cef_host.mm", .pattern = "[window frameRectForContentRect:restoredContentFrame]" },
855
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "[window setFrame:restoredWindowFrame display:NO];" },
856
+ .{ .path = "src/platform/macos/cef_host.mm", .pattern = "[window setFrame:restoredWindowFrame display:NO];" },
857
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "[window setFrame:NativeSdkCenterFrameOnScreen(window.frame, primaryScreen) display:NO];" },
858
+ .{ .path = "src/platform/macos/cef_host.mm", .pattern = "[window setFrame:NativeSdkCenterFrameOnScreen(window.frame, primaryScreen) display:NO];" },
859
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "else if (initialPlacement == 1) {\n // Fresh authored dimensions are content size" },
860
+ .{ .path = "src/platform/macos/cef_host.mm", .pattern = "else if (initialPlacement == 1) {\n // AppKit adds titlebar chrome" },
861
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "[window setFrame:NativeSdkConstrainFrame(window.frame) display:NO];" },
862
+ .{ .path = "src/platform/macos/cef_host.mm", .pattern = "[window setFrame:NativeSdkConstrainFrame(window.frame) display:NO];" },
863
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "initWithFrame:window.contentView.bounds" },
864
+ .{ .path = "src/platform/macos/cef_host.mm", .pattern = "initWithFrame:window.contentView.bounds" },
865
+ });
775
866
  addFileContainsCheckStep(b, file_contains_checker, test_step, "test-bridge-view-selector-helpers", "Verify injected view helpers accept string selectors", &.{
776
867
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "viewSelectorPayload(options)" },
777
868
  .{ .path = "src/platform/macos/cef_host.mm", .pattern = "viewSelectorPayload(options)" },
@@ -1406,6 +1497,13 @@ pub fn build(b: *std.Build) void {
1406
1497
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "NativeSdkTextNavigationNeedsRawKeyEvent(event)" },
1407
1498
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "NSEventModifierFlagCommand | NSEventModifierFlagOption" },
1408
1499
  });
1500
+ addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-widget-accessibility-hierarchy", "Verify AppKit preserves retained-widget accessibility parentage", &.{
1501
+ .{ .path = "src/platform/macos/appkit_host.h", .pattern = "uint64_t parent_id;" },
1502
+ .{ .path = "src/platform/macos/root.zig", .pattern = ".parent_id = node.parent_id orelse 0" },
1503
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "element.accessibilityParent = parent;" },
1504
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "parent.accessibilityChildren = [childrenByParentId objectForKey:parentId];" },
1505
+ .{ .path = "src/platform/macos/appkit_host.m", .pattern = "return self.widgetAccessibilityRootElements ?: @[];" },
1506
+ });
1409
1507
  addFileContainsCheckStep(b, file_contains_checker, test_step, "test-appkit-appearance-bridge", "Verify AppKit reports system light and dark appearance changes", &.{
1410
1508
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "effectiveAppearance" },
1411
1509
  .{ .path = "src/platform/macos/appkit_host.m", .pattern = "accessibilityDisplayShouldReduceMotion" },
@@ -1428,6 +1526,7 @@ pub fn build(b: *std.Build) void {
1428
1526
  addTestStep(b, "test-diagnostics", "Run diagnostics module tests", diagnostics_tests);
1429
1527
  addTestStep(b, "test-platform-info", "Run platform info module tests", platform_info_tests);
1430
1528
  addTestStep(b, "test-json", "Run JSON primitive tests", json_tests);
1529
+ addTestStep(b, "test-app-runner-window-placement", "Run app-runner window placement decision tests", app_runner_window_placement_tests);
1431
1530
  addTestStep(b, "test-canvas", "Run canvas display list tests", canvas_tests);
1432
1531
  addTestStep(b, "test-desktop", "Run Native SDK framework tests", desktop_tests);
1433
1532
  for (desktop_test_shard_specs, desktop_test_shards) |spec, shard_tests| {
@@ -1661,6 +1760,7 @@ pub fn build(b: *std.Build) void {
1661
1760
  "examples/calculator/zig-out/package/test-ios-layout/calculator.xcodeproj/xcshareddata/xcschemes/calculator.xcscheme",
1662
1761
  "examples/calculator/zig-out/package/test-ios-layout/Host/uikit_host.m",
1663
1762
  "examples/calculator/zig-out/package/test-ios-layout/Host/native_sdk_app.h",
1763
+ "examples/calculator/zig-out/package/test-ios-layout/Host/apple_image_fit.h",
1664
1764
  "examples/calculator/zig-out/package/test-ios-layout/Host/Info.plist",
1665
1765
  "examples/calculator/zig-out/package/test-ios-layout/Assets.xcassets/AppIcon.appiconset/AppIcon.png",
1666
1766
  "examples/calculator/zig-out/package/test-ios-layout/Assets.xcassets/AppIcon.appiconset/Contents.json",
@@ -1761,13 +1861,20 @@ pub fn build(b: *std.Build) void {
1761
1861
  });
1762
1862
  addFileContainsCheckStep(b, file_contains_checker, mobile_examples_step, "test-example-mobile-widget-abi", "Verify mobile examples use stable widget ABI lookups", &.{
1763
1863
  .{ .path = "examples/ios/NativeSdkIOSExample/native_sdk.h", .pattern = "native_sdk_viewport_state_t" },
1864
+ .{ .path = "examples/ios/NativeSdkIOSExample/native_sdk.h", .pattern = "NATIVE_SDK_WIDGET_ROLE_RADIOGROUP = 21" },
1764
1865
  .{ .path = "examples/ios/NativeSdkIOSExample/native_sdk.h", .pattern = "native_sdk_app_scroll" },
1765
1866
  .{ .path = "examples/ios/NativeSdkIOSExample/native_sdk.h", .pattern = "native_sdk_app_set_text_measure" },
1867
+ .{ .path = "examples/android/app/src/main/cpp/native_sdk.h", .pattern = "NATIVE_SDK_WIDGET_ROLE_RADIOGROUP = 21" },
1766
1868
  .{ .path = "examples/android/app/src/main/cpp/native_sdk.h", .pattern = "native_sdk_app_set_text_measure" },
1767
1869
  .{ .path = "examples/mobile-canvas/ios/native_sdk_app.h", .pattern = "native_sdk_app_set_text_measure" },
1768
1870
  .{ .path = "examples/ios/NativeSdkIOSExample/NativeSdkHostViewController.swift", .pattern = "native_sdk_app_widget_semantics_by_id" },
1871
+ .{ .path = "examples/ios/NativeSdkIOSExample/NativeSdkHostViewController.swift", .pattern = "NATIVE_SDK_WIDGET_ROLE_RADIO" },
1872
+ .{ .path = "examples/ios/NativeSdkIOSExample/NativeSdkHostViewController.swift", .pattern = "childrenByParentId[node.parentId, default: []].append(element)" },
1873
+ .{ .path = "examples/ios/NativeSdkIOSExample/NativeSdkHostViewController.swift", .pattern = "parent.accessibilityContainerType = .semanticGroup" },
1874
+ .{ .path = "examples/ios/NativeSdkIOSExample/NativeSdkHostViewController.swift", .pattern = "parent.isAccessibilityElement = false" },
1769
1875
  .{ .path = "examples/android/app/src/main/cpp/native_sdk.h", .pattern = "native_sdk_app_widget_semantics_by_id" },
1770
1876
  .{ .path = "examples/android/app/src/main/java/dev/native_sdk/examples/android/MainActivity.kt", .pattern = "nativeScroll(nativeApp" },
1877
+ .{ .path = "examples/android/app/src/main/java/dev/native_sdk/examples/android/MainActivity.kt", .pattern = "WIDGET_ROLE_RADIOGROUP -> \"android.widget.RadioGroup\"" },
1771
1878
  .{ .path = "examples/android/app/src/main/java/dev/native_sdk/examples/android/MainActivity.kt", .pattern = "nativeWidgetSemanticsByIdFields" },
1772
1879
  .{ .path = "examples/android/app/src/main/cpp/native_sdk_jni.c", .pattern = "native_sdk_app_widget_semantics_by_id" },
1773
1880
  .{ .path = "examples/android/app/src/main/cpp/native_sdk_jni.c", .pattern = "native_sdk_app_scroll" },
@@ -2992,6 +3099,10 @@ const TsCoreE2eArtifacts = struct {
2992
3099
  /// paths, and builds keep working with node_modules deleted.
2993
3100
  scaffold_ide: *std.Build.Step.Compile,
2994
3101
  ai_chat: *std.Build.Step.Compile,
3102
+ /// The complete services loop over examples/service-feed-reader: a real
3103
+ /// loopback Cmd.fetch, the generated typed client into a real service
3104
+ /// child, the shipping markup, and record→replay without either.
3105
+ feed_reader: *std.Build.Step.Compile,
2995
3106
  /// The phase-1 service seam: a real compiled core plus a real plain-scriptc
2996
3107
  /// service executable driven through the out-of-process carrier.
2997
3108
  services: *std.Build.Step.Compile,
@@ -3001,6 +3112,13 @@ const TsCoreE2eArtifacts = struct {
3001
3112
  /// cancellation/deadlines, trap isolation, streaming, replay). Null when
3002
3113
  /// the target cannot carry the archive (cross or non-desktop builds).
3003
3114
  services_pool: ?*std.Build.Step.Compile,
3115
+ /// The mobile execution battery: the pool fixture's core and service
3116
+ /// archives linked into one static library exporting `nsme_run`, so
3117
+ /// the platform toolchain links a runnable harness for the simulator
3118
+ /// or emulator (scripts/mobile-e2e.sh). Present only for a mobile
3119
+ /// -Dtarget; the Android archive is flattened to plain objects (Zig's
3120
+ /// ELF static-library emission nests archive inputs).
3121
+ mobile_battery: ?std.Build.LazyPath,
3004
3122
  /// The service-host carrier benchmark: a bytes-echo service compiled
3005
3123
  /// through the same lane, driven directly through the production
3006
3124
  /// carrier bindings of BOTH carriers (cold start, round-trip latency,
@@ -3016,6 +3134,9 @@ const TsCoreE2eArtifacts = struct {
3016
3134
  /// (boot fence, collect invariant, deterministic re-init, channel
3017
3135
  /// envelopes, integer classes).
3018
3136
  external_core_abi_laws: *std.Build.Step.Compile,
3137
+ /// The mixed-return ABI regression: a real compiled core whose update
3138
+ /// returns both bare Model and [Model, Cmd] through the generated facade.
3139
+ mixed_return_abi_laws: *std.Build.Step.Compile,
3019
3140
  /// Per-fixture contract artifacts for an external core toolchain:
3020
3141
  /// the effective contract sidecar and its TypeScript facade/profile
3021
3142
  /// projections, installed by the stage-core-contracts step.
@@ -3110,6 +3231,13 @@ fn tsCoreE2eArtifact(
3110
3231
  .name = "markup_core",
3111
3232
  });
3112
3233
  const markup_fixture_mod = markup_fixture.module;
3234
+ const mixed_return_src = b.addWriteFiles();
3235
+ _ = mixed_return_src.addCopyFile(b.path("tests/ts-core/mixed_return_fixture.ts"), "mixed_return_fixture.ts");
3236
+ const mixed_return_fixture = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
3237
+ .entry = "tests/ts-core/mixed_return_fixture.ts",
3238
+ .src_dir = mixed_return_src.getDirectory(),
3239
+ .name = "mixed_return_core",
3240
+ });
3113
3241
 
3114
3242
  const e2e_mod = module(b, target, optimize, "tests/ts-core/host_e2e_tests.zig");
3115
3243
  e2e_mod.addImport("native_sdk", desktop_mod);
@@ -3174,6 +3302,8 @@ fn tsCoreE2eArtifact(
3174
3302
  const monitor_stage = b.addWriteFiles();
3175
3303
  const monitor_root = monitor_stage.addCopyFile(b.path("tests/ts-core/system_monitor_e2e_tests.zig"), "system_monitor_e2e_tests.zig");
3176
3304
  _ = monitor_stage.addCopyFile(b.path("examples/system-monitor-ts/src/app.native"), "app.native");
3305
+ _ = monitor_stage.addCopyFile(b.path("examples/system-monitor-ts/src/windows/settings.native"), "settings.native");
3306
+ _ = monitor_stage.addCopyFile(b.path("examples/system-monitor-ts/src/windows/components/sampling.native"), "components/sampling.native");
3177
3307
  _ = monitor_stage.addCopyFile(b.path("examples/system-monitor/src/fixtures/sysctl.txt"), "fixtures/sysctl.txt");
3178
3308
  _ = monitor_stage.addCopyFile(b.path("examples/system-monitor/src/fixtures/ps.txt"), "fixtures/ps.txt");
3179
3309
  _ = monitor_stage.addCopyFile(b.path("examples/system-monitor/src/fixtures/vm_stat.txt"), "fixtures/vm_stat.txt");
@@ -3211,6 +3341,42 @@ fn tsCoreE2eArtifact(
3211
3341
  ai_chat_mod.addImport("native_sdk", desktop_mod);
3212
3342
  ai_chat_mod.addImport("ts_ai_chat_core", ai_chat_core_mod);
3213
3343
 
3344
+ // The service-feed-reader example's core, service child, and shipping
3345
+ // markup, tested as one app: a real buffered Cmd.fetch against a
3346
+ // loopback fixture, the generated typed client into the real child,
3347
+ // and record→replay with neither the service nor the network present.
3348
+ const feed_reader_fixture = externalCoreFixtureModule(b, target, optimize, node, corewire_exe, .{
3349
+ .entry = "examples/service-feed-reader/src/core.ts",
3350
+ .src_dir = b.path("examples/service-feed-reader/src"),
3351
+ .name = "feed_reader_core",
3352
+ .emit_services = true,
3353
+ });
3354
+ const feed_reader_service = externalServiceFixture(
3355
+ b,
3356
+ target,
3357
+ optimize,
3358
+ node,
3359
+ corewire_exe,
3360
+ b.path("examples/service-feed-reader/src"),
3361
+ feed_reader_fixture.services_contract.?,
3362
+ "feed_reader_services",
3363
+ );
3364
+ const feed_reader_stage = b.addWriteFiles();
3365
+ const feed_reader_root = feed_reader_stage.addCopyFile(b.path("tests/ts-services/feed_reader_e2e_tests.zig"), "feed_reader_e2e_tests.zig");
3366
+ _ = feed_reader_stage.addCopyFile(b.path("examples/service-feed-reader/src/app.native"), "app.native");
3367
+ _ = feed_reader_stage.addCopyFile(b.path("examples/service-feed-reader/fixtures/feed.xml"), "fixture_feed.xml");
3368
+ const feed_reader_mod = b.createModule(.{
3369
+ .root_source_file = feed_reader_root,
3370
+ .target = target,
3371
+ .optimize = optimize,
3372
+ });
3373
+ feed_reader_mod.addImport("native_sdk", desktop_mod);
3374
+ feed_reader_mod.addImport("ts_feed_reader_core", feed_reader_fixture.module);
3375
+ feed_reader_mod.addImport("ts_feed_reader_registry", feed_reader_service.registry);
3376
+ const feed_reader_options = b.addOptions();
3377
+ feed_reader_options.addOptionPath("service_executable", feed_reader_service.executable);
3378
+ feed_reader_mod.addOptions("ts_feed_reader_options", feed_reader_options);
3379
+
3214
3380
  // Phase-1 TypeScript services, end to end: the frontend emits BOTH
3215
3381
  // sidecars from one checked two-class program; corewire derives the
3216
3382
  // registry/host only from the service sidecar; plain scriptc compiles the
@@ -3257,6 +3423,46 @@ fn tsCoreE2eArtifact(
3257
3423
  break :pool pool_mod;
3258
3424
  } else null;
3259
3425
 
3426
+ // The mobile execution battery: a static library over the same pool
3427
+ // fixture, linked into a runnable harness by the platform toolchain —
3428
+ // the same link pattern embedding apps use for the embed library. The
3429
+ // Android objects are PIC like the embed library's (the harness there
3430
+ // is a bionic executable; a future .so embedding needs it regardless).
3431
+ const battery_target_is_mobile = target.result.os.tag == .ios or target.result.abi.isAndroid();
3432
+ const mobile_battery: ?std.Build.LazyPath = if (battery_target_is_mobile and service_host_fixture.archive != null) battery: {
3433
+ const battery_mod = b.createModule(.{
3434
+ .root_source_file = b.path("tests/ts-services/mobile_e2e_battery.zig"),
3435
+ .target = target,
3436
+ .optimize = optimize,
3437
+ .pic = if (target.result.abi.isAndroid()) true else null,
3438
+ });
3439
+ battery_mod.addImport("native_sdk", desktop_mod);
3440
+ battery_mod.addImport("ts_services_core", services_fixture.module);
3441
+ battery_mod.addImport("ts_services_registry", service_host_fixture.registry);
3442
+ battery_mod.link_libc = true;
3443
+ battery_mod.addObjectFile(service_host_fixture.archive.?);
3444
+ const battery_lib = b.addLibrary(.{
3445
+ .linkage = .static,
3446
+ .name = "ts-mobile-e2e",
3447
+ .root_module = battery_mod,
3448
+ .use_llvm = @import("build/app.zig").useLlvmWorkaround(target),
3449
+ });
3450
+ if (target.result.abi.isAndroid()) {
3451
+ // Flatten the nested TypeScript archives (Zig's ELF static-lib
3452
+ // emission stores .a inputs as members) so the NDK link consumes
3453
+ // plain objects — the same normalization the app lane applies.
3454
+ const merge = b.addSystemCommand(&.{node});
3455
+ merge.addFileArg(b.path("packages/core/scripts/merge_static_archives.mjs"));
3456
+ merge.addArgs(&.{ "--zig", b.graph.zig_exe, "--format", "gnu" });
3457
+ merge.addArg("--out");
3458
+ const merged = merge.addOutputFileArg("libts-mobile-e2e.a");
3459
+ merge.addArg("--in");
3460
+ merge.addFileArg(battery_lib.getEmittedBin());
3461
+ break :battery merged;
3462
+ }
3463
+ break :battery battery_lib.getEmittedBin();
3464
+ } else null;
3465
+
3260
3466
  // Service-host carrier benchmark: the same production service lane
3261
3467
  // (frontend contract -> corewire host/registry -> exact-pinned
3262
3468
  // plain-scriptc executable) over a bytes-echo operation that returns
@@ -3369,6 +3575,9 @@ fn tsCoreE2eArtifact(
3369
3575
  abi_laws_mod.addObjectFile(markup_fixture.archive);
3370
3576
  addScriptcArchiveSystemLibs(abi_laws_mod, target);
3371
3577
 
3578
+ const mixed_return_abi_mod = module(b, target, optimize, "tests/sidecar/mixed_return_abi_tests.zig");
3579
+ mixed_return_abi_mod.addImport("mixed_return_core", mixed_return_fixture.module);
3580
+
3372
3581
  return .{
3373
3582
  .host = filteredTestArtifact(b, e2e_mod, "ts-core-e2e-tests", &.{}),
3374
3583
  .persist = filteredTestArtifact(b, persist_mod, "ts-persist-e2e-tests", &.{}),
@@ -3378,11 +3587,14 @@ fn tsCoreE2eArtifact(
3378
3587
  .system_monitor = filteredTestArtifact(b, monitor_mod, "ts-system-monitor-e2e-tests", &.{}),
3379
3588
  .scaffold_ide = filteredTestArtifact(b, scaffold_ide_mod, "ts-scaffold-ide-e2e-tests", &.{}),
3380
3589
  .ai_chat = filteredTestArtifact(b, ai_chat_mod, "ts-ai-chat-e2e-tests", &.{}),
3590
+ .feed_reader = filteredTestArtifact(b, feed_reader_mod, "ts-feed-reader-e2e-tests", &.{}),
3381
3591
  .services = filteredTestArtifact(b, services_e2e_mod, "ts-services-e2e-tests", &.{}),
3382
3592
  .services_pool = if (services_pool_mod) |pool_mod| filteredTestArtifact(b, pool_mod, "ts-services-pool-e2e-tests", &.{}) else null,
3593
+ .mobile_battery = mobile_battery,
3383
3594
  .service_host_bench = service_bench_exe,
3384
3595
  .sidecar_conformance = filteredTestArtifact(b, conformance_mod, "sidecar-conformance-tests", &.{}),
3385
3596
  .external_core_abi_laws = filteredTestArtifact(b, abi_laws_mod, "external-core-abi-tests", &.{}),
3597
+ .mixed_return_abi_laws = filteredTestArtifact(b, mixed_return_abi_mod, "mixed-return-abi-tests", &.{}),
3386
3598
  .core_contracts = core_contracts.toOwnedSlice(b.allocator) catch @panic("OOM"),
3387
3599
  };
3388
3600
  }
@@ -3485,15 +3697,24 @@ fn externalServiceFixture(
3485
3697
  compile.addFileArg(b.path("packages/core/package.json"));
3486
3698
  compile.addArg("--contract");
3487
3699
  compile.addFileArg(contract);
3488
- compile.addArg("--out-exe");
3489
- const suffix = if (target.result.os.tag == .windows) ".exe" else "";
3490
- const executable = compile.addOutputFileArg(b.fmt("{s}{s}", .{ name, suffix }));
3700
+ // Mobile targets are archive-only (no child process exists there): the
3701
+ // driver refuses --out-exe, so the child-carrier batteries get a stub
3702
+ // path they never execute for those targets.
3703
+ const mobile_target = target.result.os.tag == .ios or target.result.abi.isAndroid();
3704
+ const executable: std.Build.LazyPath = if (mobile_target)
3705
+ b.addWriteFiles().add(b.fmt("{s}-unavailable-on-mobile", .{name}), "")
3706
+ else exe: {
3707
+ compile.addArg("--out-exe");
3708
+ const suffix = if (target.result.os.tag == .windows) ".exe" else "";
3709
+ break :exe compile.addOutputFileArg(b.fmt("{s}{s}", .{ name, suffix }));
3710
+ };
3491
3711
  const archive: ?std.Build.LazyPath = if (emit_archive) archive: {
3492
3712
  compile.addArg("--out-archive");
3493
3713
  break :archive compile.addOutputFileArg(b.fmt("lib{s}.a", .{name}));
3494
3714
  } else null;
3495
3715
  const host_platform = b.fmt("{t}-{t}-{t}", .{ b.graph.host.result.cpu.arch, b.graph.host.result.os.tag, b.graph.host.result.abi });
3496
3716
  compile.addArgs(&.{ "--host-platform", host_platform, "--target-platform", app_build.scriptcPlatformTriple(b, target), "--zig-exe", b.graph.zig_exe });
3717
+ app_build.addScriptcAndroidNdk(b, compile, target);
3497
3718
  addScriptcGlibcFloorTeaching(b, target, &compile.step);
3498
3719
  if (b.graph.environ_map.get("NATIVE_SDK_CORE_COMPILER")) |override| {
3499
3720
  compile.addArgs(&.{ "--compiler", override });
@@ -3665,6 +3886,7 @@ fn externalCoreFixtureModule(
3665
3886
  if (spec.store_capability) check.addArgs(&.{ "--capability", "store" });
3666
3887
  if (spec.relational_capability) check.addArgs(&.{ "--capability", "sqlite" });
3667
3888
  if (spec.credentials_capability) check.addArgs(&.{ "--capability", "credentials", "--permission", "credentials" });
3889
+ if (std.mem.eql(u8, spec.entry, "tests/ts-core/fixture.ts")) check.addArgs(&.{ "--permission", "filesystem" });
3668
3890
  tsCoreAddDirInputs(b, check, "packages/core/sdk");
3669
3891
  tsCoreAddDirInputs(b, check, std.fs.path.dirname(spec.entry) orelse ".");
3670
3892
  const frontend_sources = [_][]const u8{
@@ -3737,6 +3959,7 @@ fn externalCoreFixtureModule(
3737
3959
  "--zig-exe",
3738
3960
  b.graph.zig_exe,
3739
3961
  });
3962
+ app_build.addScriptcAndroidNdk(b, compile, target);
3740
3963
  addScriptcGlibcFloorTeaching(b, target, &compile.step);
3741
3964
  if (b.graph.environ_map.get("NATIVE_SDK_CORE_COMPILER")) |override| {
3742
3965
  // The development override: point at any toolchain command; the
package/native-sdk.d.ts CHANGED
@@ -473,6 +473,8 @@ export interface NativeSdkCommandEvent {
473
473
  source: NativeSdkCommandSource;
474
474
  windowId: number;
475
475
  viewLabel: string;
476
+ /** Native status-item id for tray-sourced commands, otherwise 0. */
477
+ statusItemId: number;
476
478
  /** Native tray item id for tray-sourced commands, otherwise 0. */
477
479
  trayItemId: number;
478
480
  }
@@ -549,9 +551,15 @@ export interface NativeSdkRecentDocumentOptions {
549
551
  }
550
552
 
551
553
  export interface NativeSdkNotificationOptions {
554
+ /** Stable replacement/deduplication identifier. */
555
+ id?: string;
552
556
  title: string;
553
557
  subtitle?: string;
554
558
  body?: string;
559
+ /** Paired with actionCommand; both must be present or both omitted. */
560
+ actionLabel?: string;
561
+ /** Normal application command dispatched when the user activates the action. */
562
+ actionCommand?: string;
555
563
  }
556
564
 
557
565
  export interface NativeSdkClipboardReadOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@native-sdk/cli",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "The Native SDK: the complete toolkit for building native desktop applications — declarative markup, native rendering, WebView surfaces, and OS capabilities",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,17 +32,17 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@typescript/old": "npm:typescript@6.0.3",
35
- "scriptc": "0.0.28"
35
+ "scriptc": "0.0.31"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@native-sdk/cli-darwin-arm64": "0.9.0",
39
- "@native-sdk/cli-darwin-x64": "0.9.0",
40
- "@native-sdk/cli-linux-arm64-gnu": "0.9.0",
41
- "@native-sdk/cli-linux-arm64-musl": "0.9.0",
42
- "@native-sdk/cli-linux-x64-gnu": "0.9.0",
43
- "@native-sdk/cli-linux-x64-musl": "0.9.0",
44
- "@native-sdk/cli-win32-arm64": "0.9.0",
45
- "@native-sdk/cli-win32-x64": "0.9.0"
38
+ "@native-sdk/cli-darwin-arm64": "0.9.2",
39
+ "@native-sdk/cli-darwin-x64": "0.9.2",
40
+ "@native-sdk/cli-linux-arm64-gnu": "0.9.2",
41
+ "@native-sdk/cli-linux-arm64-musl": "0.9.2",
42
+ "@native-sdk/cli-linux-x64-gnu": "0.9.2",
43
+ "@native-sdk/cli-linux-x64-musl": "0.9.2",
44
+ "@native-sdk/cli-win32-arm64": "0.9.2",
45
+ "@native-sdk/cli-win32-x64": "0.9.2"
46
46
  },
47
47
  "repository": {
48
48
  "type": "git",
@@ -84,6 +84,31 @@ export function utf8Bytes(s: string): Uint8Array {
84
84
 
85
85
  export type Msgish = { readonly kind: string };
86
86
 
87
+ import { type WindowDescriptor, type WindowDescriptorSpec } from "./events.ts";
88
+
89
+ export function windowDescriptor(spec: WindowDescriptorSpec): WindowDescriptor {
90
+ return {
91
+ label: spec.label,
92
+ canvasLabel: spec.canvasLabel,
93
+ title: spec.title ?? new Uint8Array(0),
94
+ width: spec.width ?? 480,
95
+ height: spec.height ?? 360,
96
+ x: spec.x ?? null,
97
+ y: spec.y ?? null,
98
+ resizable: spec.resizable ?? true,
99
+ minWidth: spec.minWidth ?? 0,
100
+ minHeight: spec.minHeight ?? 0,
101
+ titlebar: spec.titlebar ?? "standard",
102
+ transparent: spec.transparent ?? false,
103
+ alwaysOnTop: spec.alwaysOnTop ?? false,
104
+ clickThrough: spec.clickThrough ?? false,
105
+ activateOnShow: spec.activateOnShow ?? true,
106
+ allowsFullscreen: spec.allowsFullscreen ?? true,
107
+ closePolicy: spec.closePolicy ?? "quit",
108
+ onCloseCommand: spec.onCloseCommand ?? new Uint8Array(0),
109
+ };
110
+ }
111
+
87
112
  /** Cooperative cancellation capability supplied by generated service hosts. */
88
113
  export interface ServiceCancellation {
89
114
  readonly cancelled: () => boolean;
@@ -143,6 +168,16 @@ export interface WriteRoute<M extends Msgish> {
143
168
  readonly err: M["kind"];
144
169
  }
145
170
 
171
+ export interface FileReadStreamRoute<M extends Msgish> {
172
+ readonly key?: string;
173
+ readonly chunk: M["kind"];
174
+ readonly done: M["kind"];
175
+ readonly err: M["kind"];
176
+ }
177
+
178
+ export interface FileStatArm { readonly exists: boolean; readonly size: number; readonly mtimeMs: number; }
179
+ export interface FileStatRoute<M extends Msgish> { readonly key?: string; readonly ok: M["kind"]; readonly err: M["kind"]; }
180
+
146
181
  export interface StoreScanOptions {
147
182
  readonly limit?: number;
148
183
  readonly after?: string | Uint8Array;
@@ -302,9 +337,12 @@ export interface FetchStreamSpec extends FetchSpec {
302
337
  }
303
338
 
304
339
  export interface NotificationSpec {
340
+ readonly id?: Uint8Array;
305
341
  readonly title: Uint8Array;
306
342
  readonly subtitle?: Uint8Array;
307
343
  readonly body?: Uint8Array;
344
+ readonly actionLabel?: Uint8Array;
345
+ readonly actionCommand?: Uint8Array;
308
346
  }
309
347
 
310
348
  export type LocalTimeStyle = "date" | "time" | "datetime";
@@ -355,6 +393,13 @@ export type CmdData =
355
393
  readonly path: Uint8Array;
356
394
  readonly bytes: Uint8Array;
357
395
  }
396
+ | { readonly op: "append_file"; readonly key: string; readonly okKind: string; readonly errKind: string; readonly path: Uint8Array; readonly bytes: Uint8Array }
397
+ | { readonly op: "stat_file"; readonly key: string; readonly okKind: string; readonly errKind: string; readonly path: Uint8Array }
398
+ | { readonly op: "delete_file"; readonly key: string; readonly okKind: string; readonly errKind: string; readonly path: Uint8Array }
399
+ | { readonly op: "read_file_stream"; readonly key: string; readonly chunkKind: string; readonly doneKind: string; readonly errKind: string; readonly path: Uint8Array }
400
+ | { readonly op: "write_file_stream"; readonly key: string; readonly okKind: string; readonly errKind: string; readonly path: Uint8Array }
401
+ | { readonly op: "write_file_chunk"; readonly key: string; readonly okKind: string; readonly errKind: string; readonly bytes: Uint8Array }
402
+ | { readonly op: "write_file_close"; readonly key: string; readonly okKind: string; readonly errKind: string }
358
403
  | {
359
404
  readonly op: "store_set";
360
405
  readonly key: string;
@@ -428,7 +473,7 @@ export type CmdData =
428
473
  }
429
474
  | { readonly op: "clip_write"; readonly bytes: Uint8Array }
430
475
  | { readonly op: "clip_read"; readonly key: string; readonly okKind: string; readonly errKind: string }
431
- | { readonly op: "show_notification"; readonly title: Uint8Array; readonly subtitle: Uint8Array; readonly body: Uint8Array }
476
+ | { readonly op: "show_notification"; readonly id: Uint8Array; readonly title: Uint8Array; readonly subtitle: Uint8Array; readonly body: Uint8Array; readonly actionLabel: Uint8Array; readonly actionCommand: Uint8Array }
432
477
  | { readonly op: "delay"; readonly key: string; readonly afterMs: number; readonly msgKind: string }
433
478
  | {
434
479
  readonly op: "spawn";
@@ -700,6 +745,27 @@ export const Cmd = {
700
745
  writeFile(path: Uint8Array, bytes: Uint8Array, route: { readonly key?: string; readonly ok: string; readonly err: string }): CmdData {
701
746
  return { op: "write_file", key: route.key ?? "", okKind: route.ok, errKind: route.err, path, bytes };
702
747
  },
748
+ appendFile(path: Uint8Array, bytes: Uint8Array, route: { readonly key?: string; readonly ok: string; readonly err: string }): CmdData {
749
+ return { op: "append_file", key: route.key ?? "", okKind: route.ok, errKind: route.err, path, bytes };
750
+ },
751
+ statFile(path: Uint8Array, route: { readonly key?: string; readonly ok: string; readonly err: string }): CmdData {
752
+ return { op: "stat_file", key: route.key ?? "", okKind: route.ok, errKind: route.err, path };
753
+ },
754
+ deleteFile(path: Uint8Array, route: { readonly key?: string; readonly ok: string; readonly err: string }): CmdData {
755
+ return { op: "delete_file", key: route.key ?? "", okKind: route.ok, errKind: route.err, path };
756
+ },
757
+ readFileStream(path: Uint8Array, route: { readonly key?: string; readonly chunk: string; readonly done: string; readonly err: string }): CmdData {
758
+ return { op: "read_file_stream", key: route.key ?? "", chunkKind: route.chunk, doneKind: route.done, errKind: route.err, path };
759
+ },
760
+ writeFileStream(key: string, path: Uint8Array, route: { readonly key?: string; readonly ok: string; readonly err: string }): CmdData {
761
+ return { op: "write_file_stream", key, okKind: route.ok, errKind: route.err, path };
762
+ },
763
+ writeFileChunk(key: string, bytes: Uint8Array, route: { readonly key?: string; readonly ok: string; readonly err: string }): CmdData {
764
+ return { op: "write_file_chunk", key, okKind: route.ok, errKind: route.err, bytes };
765
+ },
766
+ writeFileClose(key: string, route: { readonly key?: string; readonly ok: string; readonly err: string }): CmdData {
767
+ return { op: "write_file_close", key, okKind: route.ok, errKind: route.err };
768
+ },
703
769
 
704
770
  store: {
705
771
  set(storeKey: string, bytes: Uint8Array, route: { readonly key?: string; readonly ok: string; readonly err: string }): CmdData {
@@ -790,9 +856,12 @@ export const Cmd = {
790
856
  showNotification(spec: NotificationSpec): CmdData {
791
857
  return {
792
858
  op: "show_notification",
859
+ id: spec.id ?? new Uint8Array(0),
793
860
  title: spec.title,
794
861
  subtitle: spec.subtitle ?? new Uint8Array(0),
795
862
  body: spec.body ?? new Uint8Array(0),
863
+ actionLabel: spec.actionLabel ?? new Uint8Array(0),
864
+ actionCommand: spec.actionCommand ?? new Uint8Array(0),
796
865
  };
797
866
  },
798
867