@native-sdk/cli 0.5.4 → 0.6.0

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 (149) hide show
  1. package/build/app.zig +50 -1
  2. package/build.zig +534 -3
  3. package/build.zig.zon +7 -0
  4. package/native-sdk.d.ts +3 -1
  5. package/package.json +9 -9
  6. package/packages/core/package-lock.json +2 -2
  7. package/packages/core/package.json +1 -1
  8. package/packages/core/rt/rt.zig +280 -8
  9. package/packages/core/sdk/core.ts +481 -2
  10. package/packages/core/sdk/events.ts +17 -8
  11. package/packages/core/src/checker.ts +305 -2
  12. package/packages/core/src/diagnostics.ts +12 -0
  13. package/packages/core/src/emitter.ts +599 -3
  14. package/packages/core/src/typed_ast.ts +51 -4
  15. package/packages/core/src/types.ts +34 -1
  16. package/skill-data/native-ui/SKILL.md +39 -2
  17. package/skill-data/ts-core/SKILL.md +4 -2
  18. package/src/app_runner/root.zig +32 -10
  19. package/src/automation/layout_fingerprint.zig +160 -0
  20. package/src/automation/protocol.zig +82 -33
  21. package/src/automation/root.zig +1 -0
  22. package/src/automation/server.zig +1 -1
  23. package/src/automation/snapshot.zig +68 -9
  24. package/src/automation/watcher.zig +1 -1
  25. package/src/embed/host.zig +5 -0
  26. package/src/embed/ui_host.zig +13 -0
  27. package/src/platform/linux/gtk_host.c +527 -13
  28. package/src/platform/linux/gtk_host.h +25 -0
  29. package/src/platform/linux/root.zig +280 -7
  30. package/src/platform/macos/appkit_host.h +104 -6
  31. package/src/platform/macos/appkit_host.m +1283 -66
  32. package/src/platform/macos/cef_host.mm +110 -1
  33. package/src/platform/macos/root.zig +287 -7
  34. package/src/platform/null_platform.zig +398 -4
  35. package/src/platform/null_platform_tests.zig +35 -0
  36. package/src/platform/root.zig +9 -0
  37. package/src/platform/types.zig +386 -14
  38. package/src/platform/windows/root.zig +298 -9
  39. package/src/platform/windows/webview2_host.cpp +330 -5
  40. package/src/primitives/app_manifest/validation.zig +18 -0
  41. package/src/primitives/canvas/a11y_audit.zig +33 -11
  42. package/src/primitives/canvas/a11y_audit_tests.zig +20 -0
  43. package/src/primitives/canvas/drawing.zig +25 -0
  44. package/src/primitives/canvas/equality.zig +8 -0
  45. package/src/primitives/canvas/events.zig +103 -16
  46. package/src/primitives/canvas/frame.zig +125 -1
  47. package/src/primitives/canvas/layout_audit.zig +22 -5
  48. package/src/primitives/canvas/markdown_hostile_tests.zig +8 -4
  49. package/src/primitives/canvas/render_tests.zig +13 -10
  50. package/src/primitives/canvas/root.zig +48 -0
  51. package/src/primitives/canvas/terminal_box.zig +471 -0
  52. package/src/primitives/canvas/terminal_grid.zig +978 -0
  53. package/src/primitives/canvas/terminal_grid_tests.zig +1093 -0
  54. package/src/primitives/canvas/test_support.zig +1 -0
  55. package/src/primitives/canvas/tests.zig +1 -0
  56. package/src/primitives/canvas/text_tests.zig +39 -4
  57. package/src/primitives/canvas/tokens.zig +115 -12
  58. package/src/primitives/canvas/ui.zig +524 -5
  59. package/src/primitives/canvas/ui_markup.zig +195 -2
  60. package/src/primitives/canvas/ui_markup_compiled.zig +172 -1
  61. package/src/primitives/canvas/ui_markup_compiled_tests.zig +133 -8
  62. package/src/primitives/canvas/ui_markup_contract.zig +88 -5
  63. package/src/primitives/canvas/ui_markup_contract_tests.zig +39 -1
  64. package/src/primitives/canvas/ui_markup_huge_model_tests.zig +1 -0
  65. package/src/primitives/canvas/ui_markup_reflect.zig +75 -24
  66. package/src/primitives/canvas/ui_markup_tests.zig +149 -0
  67. package/src/primitives/canvas/ui_markup_view.zig +191 -0
  68. package/src/primitives/canvas/ui_markup_view_tests.zig +403 -19
  69. package/src/primitives/canvas/ui_schema.zig +97 -17
  70. package/src/primitives/canvas/ui_schema_tests.zig +18 -11
  71. package/src/primitives/canvas/ui_tests.zig +141 -9
  72. package/src/primitives/canvas/widget_access.zig +28 -2
  73. package/src/primitives/canvas/widget_anchored_tests.zig +48 -0
  74. package/src/primitives/canvas/widget_invalidation.zig +81 -1
  75. package/src/primitives/canvas/widget_layout.zig +59 -11
  76. package/src/primitives/canvas/widget_layout_tests.zig +125 -4
  77. package/src/primitives/canvas/widget_render.zig +272 -18
  78. package/src/primitives/canvas/widget_render_scroll.zig +108 -27
  79. package/src/primitives/canvas/widget_routing.zig +59 -7
  80. package/src/primitives/canvas/widget_runtime.zig +23 -0
  81. package/src/primitives/canvas/widget_runtime_tests.zig +149 -0
  82. package/src/primitives/canvas/widget_semantics.zig +119 -11
  83. package/src/primitives/canvas/widget_semantics_tests.zig +409 -0
  84. package/src/primitives/canvas/widget_tree.zig +17 -0
  85. package/src/primitives/canvas/widgets.zig +132 -0
  86. package/src/root.zig +16 -0
  87. package/src/runtime/api.zig +70 -1
  88. package/src/runtime/automation_commands.zig +20 -1
  89. package/src/runtime/automation_snapshot.zig +25 -1
  90. package/src/runtime/automation_widget_dispatch.zig +73 -8
  91. package/src/runtime/bridge_payload.zig +1 -0
  92. package/src/runtime/canvas_frame.zig +62 -7
  93. package/src/runtime/canvas_frame_animation_tests.zig +5 -4
  94. package/src/runtime/canvas_frame_helpers.zig +190 -1
  95. package/src/runtime/canvas_frame_invalidation_tests.zig +531 -0
  96. package/src/runtime/canvas_frame_patch_tests.zig +161 -10
  97. package/src/runtime/canvas_frame_retained_tests.zig +5 -2
  98. package/src/runtime/canvas_widget_accessibility_tests.zig +1 -1
  99. package/src/runtime/canvas_widget_clipboard_tests.zig +40 -0
  100. package/src/runtime/canvas_widget_context_menu.zig +269 -32
  101. package/src/runtime/canvas_widget_context_menu_tests.zig +640 -14
  102. package/src/runtime/canvas_widget_display.zig +1 -1
  103. package/src/runtime/canvas_widget_event_tests.zig +1823 -0
  104. package/src/runtime/canvas_widget_events.zig +240 -24
  105. package/src/runtime/canvas_widget_runtime.zig +213 -29
  106. package/src/runtime/canvas_widget_scroll_driver_tests.zig +170 -7
  107. package/src/runtime/canvas_widget_scroll_drivers.zig +151 -17
  108. package/src/runtime/canvas_widget_scroll_tests.zig +435 -23
  109. package/src/runtime/canvas_widget_state.zig +6 -0
  110. package/src/runtime/canvas_widget_text_tests.zig +1 -1
  111. package/src/runtime/core.zig +73 -2
  112. package/src/runtime/effects.zig +6389 -54
  113. package/src/runtime/effects_channel_tests.zig +3519 -0
  114. package/src/runtime/effects_pty_tests.zig +1362 -0
  115. package/src/runtime/effects_tests.zig +14 -9
  116. package/src/runtime/effects_video_tests.zig +3609 -0
  117. package/src/runtime/flow.zig +25 -4
  118. package/src/runtime/gpu_surface_events.zig +473 -13
  119. package/src/runtime/media_surface.zig +116 -11
  120. package/src/runtime/media_surface_tests.zig +61 -0
  121. package/src/runtime/pty.zig +1252 -0
  122. package/src/runtime/pty_windows.zig +1780 -0
  123. package/src/runtime/root.zig +25 -0
  124. package/src/runtime/runtime_event_tests.zig +20 -1
  125. package/src/runtime/session_journal.zig +367 -61
  126. package/src/runtime/session_record.zig +16 -0
  127. package/src/runtime/session_replay.zig +395 -11
  128. package/src/runtime/session_tests.zig +109 -15
  129. package/src/runtime/terminal_session.zig +1569 -0
  130. package/src/runtime/terminal_session_tests.zig +450 -0
  131. package/src/runtime/terminal_vt_ghostty.zig +15 -0
  132. package/src/runtime/terminal_vt_stub.zig +13 -0
  133. package/src/runtime/tests.zig +6 -0
  134. package/src/runtime/ts_core_host.zig +980 -140
  135. package/src/runtime/ts_core_host_tests.zig +1059 -1
  136. package/src/runtime/ts_ui_app.zig +16 -5
  137. package/src/runtime/ui_app.zig +2333 -63
  138. package/src/runtime/ui_app_tests.zig +3171 -744
  139. package/src/runtime/ui_app_virtual_variable_tests.zig +4 -2
  140. package/src/runtime/ui_app_window_tests.zig +268 -0
  141. package/src/runtime/view.zig +190 -2
  142. package/src/runtime/view_widget_scroll.zig +218 -68
  143. package/src/runtime/view_widget_text.zig +11 -2
  144. package/src/runtime/view_widget_tree.zig +111 -3
  145. package/src/runtime/window_storage.zig +45 -2
  146. package/src/runtime/window_view_runtime.zig +34 -2
  147. package/src/runtime/window_views.zig +1 -0
  148. package/src/terminal_session_tests_root.zig +15 -0
  149. package/src/tooling/templates.zig +25 -7
@@ -272,9 +272,13 @@ pub fn RuntimeWindowStorage(comptime Runtime: type) type {
272
272
  /// and the re-key restores focus where it was without revealing
273
273
  /// anything.
274
274
  pub fn setFocusedIndex(self: *Runtime, focused_index: usize) anyerror!void {
275
+ var first_error: ?anyerror = null;
275
276
  for (0..self.window_count) |index| {
276
- try Self.setWindowFocused(self, index, index == focused_index);
277
+ Self.setWindowFocused(self, index, index == focused_index) catch |err| {
278
+ if (first_error == null) first_error = err;
279
+ };
277
280
  }
281
+ if (first_error) |err| return err;
278
282
  }
279
283
 
280
284
  /// The ONE writer of a tracked window's `focused` flag: the
@@ -303,8 +307,47 @@ pub fn RuntimeWindowStorage(comptime Runtime: type) type {
303
307
  const window = &self.windows[index];
304
308
  const was_focused = window.info.focused;
305
309
  window.info.focused = focused;
310
+ var first_error: ?anyerror = null;
311
+ for (self.views[0..self.view_count], 0..) |*view, view_index| {
312
+ if (view.window_id != window.info.id) continue;
313
+ Self.setViewKeyboardActive(self, view_index, self.app_active and focused) catch |err| {
314
+ if (first_error == null) first_error = err;
315
+ };
316
+ }
306
317
  if (was_focused and !focused) {
307
- try CanvasWidgetEventMethods.resetCanvasTooltipIntentForWindowKeyLoss(self, window.info.id);
318
+ CanvasWidgetEventMethods.resetCanvasTooltipIntentForWindowKeyLoss(self, window.info.id) catch |err| {
319
+ if (first_error == null) first_error = err;
320
+ };
321
+ }
322
+ if (first_error) |err| return err;
323
+ }
324
+
325
+ /// Move the application-active register and project it into every
326
+ /// view's keyboard gate without disturbing per-window focus
327
+ /// memory. A deactivated app owns no keyboard focus; activation
328
+ /// reopens the gate only in the key window.
329
+ pub fn setAppActive(self: *Runtime, active: bool) anyerror!void {
330
+ self.app_active = active;
331
+ var first_error: ?anyerror = null;
332
+ for (self.views[0..self.view_count], 0..) |*view, view_index| {
333
+ const window_index = Self.findWindowIndexById(self, view.window_id);
334
+ const window_focused = if (window_index) |index| self.windows[index].info.focused else false;
335
+ Self.setViewKeyboardActive(self, view_index, active and window_focused) catch |err| {
336
+ if (first_error == null) first_error = err;
337
+ };
338
+ }
339
+ if (first_error) |err| return err;
340
+ }
341
+
342
+ fn setViewKeyboardActive(self: *Runtime, view_index: usize, active: bool) anyerror!void {
343
+ const CanvasWidgetEventMethods = runtime_canvas_widget_events.RuntimeCanvasWidgetEvents(Runtime);
344
+ const view = &self.views[view_index];
345
+ if (view.keyboard_active == active) return;
346
+ const previous_state = view.canvasWidgetRenderState();
347
+ view.keyboard_active = active;
348
+ const next_state = view.canvasWidgetRenderState();
349
+ if (!CanvasWidgetEventMethods.canvasWidgetRenderStatesEqual(previous_state, next_state)) {
350
+ try CanvasWidgetEventMethods.invalidateForCanvasWidgetRenderStateChange(self, view_index, previous_state, next_state);
308
351
  }
309
352
  }
310
353
 
@@ -7,6 +7,7 @@ const bridge_responses = @import("bridge_responses.zig");
7
7
  const runtime_canvas_widget_events = @import("canvas_widget_events.zig");
8
8
  const runtime_clock = @import("clock.zig");
9
9
  const runtime_state = @import("state.zig");
10
+ const runtime_view = @import("view.zig");
10
11
  const runtime_window_storage = @import("window_storage.zig");
11
12
  const platform = @import("../platform/root.zig");
12
13
  const security = @import("../security/root.zig");
@@ -492,6 +493,7 @@ pub fn RuntimeWindowViewRuntime(comptime Runtime: type) type {
492
493
  .gpu_status = if (options.kind == .gpu_surface) .ready else .unavailable,
493
494
  .gpu_surface_created_timestamp_ns = if (options.kind == .gpu_surface) timestampToU64(nowNanoseconds()) else 0,
494
495
  .focused = false,
496
+ .keyboard_active = windowKeyboardActive(self, options.window_id),
495
497
  .open = true,
496
498
  };
497
499
  self.views[index].label = try copyInto(&self.views[index].label_storage, options.label);
@@ -503,6 +505,12 @@ pub fn RuntimeWindowViewRuntime(comptime Runtime: type) type {
503
505
  self.view_count += 1;
504
506
  }
505
507
 
508
+ fn windowKeyboardActive(self: *const Runtime, window_id: platform.WindowId) bool {
509
+ if (!self.app_active) return false;
510
+ const window_index = WindowStorageMethods.findWindowIndexById(self, window_id) orelse return false;
511
+ return self.windows[window_index].info.focused;
512
+ }
513
+
506
514
  pub fn findViewIndex(self: *const Runtime, window_id: platform.WindowId, label: []const u8) ?usize {
507
515
  for (self.views[0..self.view_count], 0..) |*view, index| {
508
516
  if (view.open and view.window_id == window_id and std.mem.eql(u8, view.label, label)) return index;
@@ -542,9 +550,12 @@ pub fn RuntimeWindowViewRuntime(comptime Runtime: type) type {
542
550
  }
543
551
  // A view losing focus drops its tooltip state and
544
552
  // re-stamps hidden — no stale tooltip may keep floating
545
- // in a view the keyboard just left.
553
+ // in a view the keyboard just left — and its IME grace
554
+ // dies with the blur (the shared hygiene every
555
+ // focus-mutation path applies).
546
556
  if (was_focused and !view.focused) {
547
557
  try CanvasWidgetEventMethods.resetCanvasTooltipIntentForViewBlur(self, view_index);
558
+ runtime_view.clearImeGraceOnViewBlur(self, view);
548
559
  }
549
560
  }
550
561
  for (self.webviews[0..self.webview_count]) |*webview| {
@@ -566,9 +577,10 @@ pub fn RuntimeWindowViewRuntime(comptime Runtime: type) type {
566
577
  try CanvasWidgetEventMethods.invalidateForCanvasWidgetRenderStateChange(self, view_index, previous_state, next_state);
567
578
  }
568
579
  // Window-level focus loss blurs every view: same tooltip
569
- // reset as a per-view focus move.
580
+ // reset and IME-grace hygiene as a per-view focus move.
570
581
  if (was_focused) {
571
582
  try CanvasWidgetEventMethods.resetCanvasTooltipIntentForViewBlur(self, view_index);
583
+ runtime_view.clearImeGraceOnViewBlur(self, view);
572
584
  }
573
585
  }
574
586
  for (self.webviews[0..self.webview_count]) |*webview| {
@@ -629,6 +641,26 @@ pub fn RuntimeWindowViewRuntime(comptime Runtime: type) type {
629
641
 
630
642
  pub fn removeViewAt(self: *Runtime, index: usize) void {
631
643
  if (index >= self.view_count) return;
644
+ // A target-less IME composition owned by this view dies with
645
+ // it: a later view REUSING the same window+label must not
646
+ // inherit the stale sequence (its first composition update
647
+ // would be mistaken for a continuation and bypass its own
648
+ // focused editor) NOR the cancel-to-commit grace (whose
649
+ // trailing text would leak target-less into the new
650
+ // surface — cancellation zeroes the preedit length before
651
+ // arming the grace, so both states gate the clear). The
652
+ // buffer stays allocated; only the ownership state clears.
653
+ if ((self.targetless_ime_preedit_len > 0 or self.targetless_ime_commit_grace) and
654
+ self.targetless_ime_preedit_window == self.views[index].window_id and
655
+ std.mem.eql(
656
+ u8,
657
+ self.targetless_ime_preedit_label[0..self.targetless_ime_preedit_label_len],
658
+ self.views[index].label,
659
+ ))
660
+ {
661
+ self.targetless_ime_preedit_len = 0;
662
+ self.targetless_ime_commit_grace = false;
663
+ }
632
664
  var cursor = index;
633
665
  while (cursor + 1 < self.view_count) : (cursor += 1) {
634
666
  const next = &self.views[cursor + 1];
@@ -47,6 +47,7 @@ pub fn RuntimeWindowViews(comptime Runtime: type) type {
47
47
  pub const findShellLayoutIndex = WindowStorageMethods.findShellLayoutIndex;
48
48
  pub const removeShellLayoutForWindow = WindowStorageMethods.removeShellLayoutForWindow;
49
49
  pub const setFocusedIndex = WindowStorageMethods.setFocusedIndex;
50
+ pub const setAppActive = WindowStorageMethods.setAppActive;
50
51
  pub const findWindowIndexById = WindowStorageMethods.findWindowIndexById;
51
52
  pub const findWindowIndexByLabel = WindowStorageMethods.findWindowIndexByLabel;
52
53
  pub const allocateWindowId = WindowStorageMethods.allocateWindowId;
@@ -0,0 +1,15 @@
1
+ //! Test root for the terminal-session store tests, which only have
2
+ //! anything to assert in a build that WIRES the emulator behind
3
+ //! `<terminal pty={key}>`. This package pins no emulator (apps that want
4
+ //! live sessions pin it themselves and ask with
5
+ //! `addAppArtifacts(.{ .terminal_sessions = true })`), so under this
6
+ //! repository's own `zig build test` every case skips; an app build that
7
+ //! opts in points a test artifact at this file and runs them for real.
8
+ //! It lives beside `root.zig` because a test root sets the module path,
9
+ //! and the runtime's files import across `src/`.
10
+ //!
11
+ //! See `examples/workbench/build.zig` for the consumer-side wiring.
12
+
13
+ test {
14
+ _ = @import("runtime/terminal_session_tests.zig");
15
+ }
@@ -1726,6 +1726,7 @@ fn buildZig(allocator: std.mem.Allocator, names: TemplateNames, framework_path:
1726
1726
  \\ }
1727
1727
  \\ app_mod.linkFramework("AppKit", .{});
1728
1728
  \\ app_mod.linkFramework("AVFoundation", .{});
1729
+ \\ app_mod.linkFramework("CoreVideo", .{});
1729
1730
  \\ app_mod.linkFramework("MediaToolbox", .{});
1730
1731
  \\ app_mod.linkFramework("Accelerate", .{});
1731
1732
  \\ app_mod.linkFramework("Foundation", .{});
@@ -2582,7 +2583,12 @@ fn runnerZig() []const u8 {
2582
2583
  \\ var buffers: StateBuffers = undefined;
2583
2584
  \\ var app_info = options.appInfo(&buffers);
2584
2585
  \\ const store = prepareStateStore(init.io, init.environ_map, &app_info, &buffers);
2585
- \\ var null_platform = native_sdk.NullPlatform.initWithOptions(.{}, webEngine(), app_info);
2586
+ \\ // Heap wrapper, latch-gated free: worker threads hold this address
2587
+ \\ // as the channel wake context and an abandoned wake call may
2588
+ \\ // dereference it after this frame unwinds (see
2589
+ \\ // `NullPlatform.createWithOptions`/`destroy`).
2590
+ \\ const null_platform = try native_sdk.NullPlatform.createWithOptions(.{}, webEngine(), app_info);
2591
+ \\ defer null_platform.destroy();
2586
2592
  \\ var trace_sink = StdoutTraceSink{};
2587
2593
  \\ var log_buffers: native_sdk.debug.LogPathBuffers = .{};
2588
2594
  \\ const log_setup = native_sdk.debug.setupLogging(init.io, init.environ_map, app_info.bundle_id, &log_buffers) catch null;
@@ -2631,8 +2637,12 @@ fn runnerZig() []const u8 {
2631
2637
  \\ var buffers: StateBuffers = undefined;
2632
2638
  \\ var app_info = options.appInfo(&buffers);
2633
2639
  \\ const store = prepareStateStore(init.io, init.environ_map, &app_info, &buffers);
2634
- \\ var mac_platform = try native_sdk.platform.macos.MacPlatform.initWithOptions(native_sdk.geometry.SizeF.init(720, 480), webEngine(), app_info);
2635
- \\ defer mac_platform.deinit();
2640
+ \\ // Heap wrapper, latch-gated free: worker threads hold this address
2641
+ \\ // as the channel wake context and an abandoned wake call may
2642
+ \\ // dereference it after this frame unwinds (see
2643
+ \\ // `MacPlatform.createWithOptions`/`destroy`).
2644
+ \\ const mac_platform = try native_sdk.platform.macos.MacPlatform.createWithOptions(native_sdk.geometry.SizeF.init(720, 480), webEngine(), app_info);
2645
+ \\ defer mac_platform.destroy();
2636
2646
  \\ var trace_sink = StdoutTraceSink{};
2637
2647
  \\ var log_buffers: native_sdk.debug.LogPathBuffers = .{};
2638
2648
  \\ const log_setup = native_sdk.debug.setupLogging(init.io, init.environ_map, app_info.bundle_id, &log_buffers) catch null;
@@ -2681,8 +2691,12 @@ fn runnerZig() []const u8 {
2681
2691
  \\ var buffers: StateBuffers = undefined;
2682
2692
  \\ var app_info = options.appInfo(&buffers);
2683
2693
  \\ const store = prepareStateStore(init.io, init.environ_map, &app_info, &buffers);
2684
- \\ var linux_platform = try native_sdk.platform.linux.LinuxPlatform.initWithOptions(native_sdk.geometry.SizeF.init(720, 480), webEngine(), app_info);
2685
- \\ defer linux_platform.deinit();
2694
+ \\ // Heap wrapper, latch-gated free: worker threads hold this address
2695
+ \\ // as the channel wake context and an abandoned wake call may
2696
+ \\ // dereference it after this frame unwinds (see
2697
+ \\ // `LinuxPlatform.createWithOptions`/`destroy`).
2698
+ \\ const linux_platform = try native_sdk.platform.linux.LinuxPlatform.createWithOptions(native_sdk.geometry.SizeF.init(720, 480), webEngine(), app_info);
2699
+ \\ defer linux_platform.destroy();
2686
2700
  \\ var trace_sink = StdoutTraceSink{};
2687
2701
  \\ var log_buffers: native_sdk.debug.LogPathBuffers = .{};
2688
2702
  \\ const log_setup = native_sdk.debug.setupLogging(init.io, init.environ_map, app_info.bundle_id, &log_buffers) catch null;
@@ -2731,8 +2745,12 @@ fn runnerZig() []const u8 {
2731
2745
  \\ var buffers: StateBuffers = undefined;
2732
2746
  \\ var app_info = options.appInfo(&buffers);
2733
2747
  \\ const store = prepareStateStore(init.io, init.environ_map, &app_info, &buffers);
2734
- \\ var windows_platform = try native_sdk.platform.windows.WindowsPlatform.initWithOptions(native_sdk.geometry.SizeF.init(720, 480), webEngine(), app_info);
2735
- \\ defer windows_platform.deinit();
2748
+ \\ // Heap wrapper, latch-gated free: worker threads hold this address
2749
+ \\ // as the channel wake context and an abandoned wake call may
2750
+ \\ // dereference it after this frame unwinds (see
2751
+ \\ // `WindowsPlatform.createWithOptions`/`destroy`).
2752
+ \\ const windows_platform = try native_sdk.platform.windows.WindowsPlatform.createWithOptions(native_sdk.geometry.SizeF.init(720, 480), webEngine(), app_info);
2753
+ \\ defer windows_platform.destroy();
2736
2754
  \\ var trace_sink = StdoutTraceSink{};
2737
2755
  \\ var log_buffers: native_sdk.debug.LogPathBuffers = .{};
2738
2756
  \\ const log_setup = native_sdk.debug.setupLogging(init.io, init.environ_map, app_info.bundle_id, &log_buffers) catch null;