@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
@@ -651,6 +651,61 @@ test "tree arrow navigation reveals and focuses rows below a scroll viewport" {
651
651
  try std.testing.expect(scrolled.findById(10).?.widget.value > 0);
652
652
  }
653
653
 
654
+ test "radio-group arrow navigation reveals selects and focuses an offscreen nested radio" {
655
+ const harness = try TestHarness().create(std.testing.allocator, .{});
656
+ defer harness.destroy(std.testing.allocator);
657
+ harness.null_platform.gpu_surfaces = true;
658
+ var app_state: ObservingApp = .{};
659
+ const app = app_state.app();
660
+ try harness.start(app);
661
+
662
+ _ = try harness.runtime.createView(.{
663
+ .window_id = 1,
664
+ .label = "canvas",
665
+ .kind = .gpu_surface,
666
+ .frame = geometry.RectF.init(0, 0, 240, 64),
667
+ });
668
+
669
+ const radios = [_]canvas.Widget{
670
+ .{ .id = 31, .kind = .radio, .frame = geometry.RectF.init(0, 0, 0, 28), .text = "One", .state = .{ .selected = true } },
671
+ .{ .id = 32, .kind = .radio, .frame = geometry.RectF.init(0, 0, 0, 28), .text = "Two" },
672
+ .{ .id = 33, .kind = .radio, .frame = geometry.RectF.init(0, 0, 0, 28), .text = "Three" },
673
+ .{ .id = 34, .kind = .radio, .frame = geometry.RectF.init(0, 0, 0, 28), .text = "Four" },
674
+ };
675
+ const nested = [_]canvas.Widget{.{
676
+ .kind = .column,
677
+ .layout = .{ .gap = 2 },
678
+ .children = &radios,
679
+ }};
680
+ const group = canvas.Widget{
681
+ .id = 30,
682
+ .kind = .radio_group,
683
+ .frame = geometry.RectF.init(0, 0, 0, 118),
684
+ .children = &nested,
685
+ };
686
+ const root = canvas.Widget{ .id = 20, .kind = .scroll_view, .children = &.{group} };
687
+ var nodes: [10]canvas.WidgetLayoutNode = undefined;
688
+ const layout = try canvas.layoutWidgetTree(root, geometry.RectF.init(0, 0, 240, 64), &nodes);
689
+ _ = try harness.runtime.setCanvasWidgetLayout(1, "canvas", layout);
690
+ const view = &harness.runtime.views[0];
691
+ view.canvas_widget_focused_id = 31;
692
+
693
+ try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{ .window_id = 1, .label = "canvas", .kind = .key_down, .key = "arrowdown" } });
694
+ try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{ .window_id = 1, .label = "canvas", .kind = .key_down, .key = "arrowdown" } });
695
+ try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_input = .{ .window_id = 1, .label = "canvas", .kind = .key_down, .key = "arrowdown" } });
696
+
697
+ try std.testing.expectEqual(@as(canvas.ObjectId, 34), view.canvas_widget_focused_id);
698
+ try std.testing.expectEqual(@as(canvas.ObjectId, 34), app_state.last_keyboard_target_id);
699
+ try std.testing.expect(app_state.last_keyboard_focus_moved);
700
+ const scrolled = try harness.runtime.canvasWidgetLayout(1, "canvas");
701
+ const viewport = scrolled.findById(20).?.frame.normalized();
702
+ const focused = scrolled.findById(34).?.frame.normalized();
703
+ try std.testing.expect(focused.y >= viewport.y);
704
+ try std.testing.expect(focused.maxY() <= viewport.maxY());
705
+ try std.testing.expect(!scrolled.findById(31).?.widget.state.selected);
706
+ try std.testing.expect(scrolled.findById(34).?.widget.state.selected);
707
+ }
708
+
654
709
  test "list arrow navigation reveals and focuses rows below a scroll viewport" {
655
710
  const harness = try TestHarness().create(std.testing.allocator, .{});
656
711
  defer harness.destroy(std.testing.allocator);
@@ -13,6 +13,7 @@ const runtime_canvas_widget_display = @import("canvas_widget_display.zig");
13
13
  const runtime_view = @import("view.zig");
14
14
  const runtime_canvas_widget_events = @import("canvas_widget_events.zig");
15
15
  const runtime_automation_widget_dispatch = @import("automation_widget_dispatch.zig");
16
+ const runtime_gpu_surface_events = @import("gpu_surface_events.zig");
16
17
  const widget_bridge = @import("widget_bridge.zig");
17
18
 
18
19
  const validateViewLabel = validation.validateViewLabel;
@@ -119,7 +120,7 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
119
120
  // the OS scroller's overscrolled offset instead of clamping it
120
121
  // and force-pushing the clamp into the live bounce (visible
121
122
  // jitter). Non-driver platforms clamp exactly as before.
122
- canvas_widget_runtime.clampCanvasWidgetLayoutScrollOffsets(reconciled_nodes[0..reconciled_layout.nodes.len], null);
123
+ try canvas_widget_runtime.clampCanvasWidgetLayoutScrollOffsetsAfterReconcile(reconciled_nodes[0..reconciled_layout.nodes.len], null, reconciled_layout.root_bounds, tokens);
123
124
  // Runtime-owned tooltip visibility normalizes BEFORE the
124
125
  // diff: the retained tree carries the intent machine's
125
126
  // hidden stamps on anchored tooltips while the source
@@ -203,11 +204,20 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
203
204
  if (render_state_changed) CanvasWidgetEventMethods(Runtime).invalidateForCanvasWidgetRenderStateDirty(self, index, render_state_dirty);
204
205
  const layout_dirty = invalidations.len > 0 or render_state_changed;
205
206
  if (autofocus_target) |autofocus_id| {
206
- // The same focus write every other focus source performs
207
- // (view focus + focused/visible ids + invalidation);
208
- // widgets that are not focusable ignore the request.
209
- if (self.views[index].widgetLayoutTree().focusTargetById(autofocus_id) != null) {
210
- try AutomationWidgetMethods(Runtime).focusAutomationCanvasWidget(self, index, autofocus_id);
207
+ // Autofocus is programmatic, not pointer hit testing: admit a
208
+ // logically focusable target even while a scroll ancestor
209
+ // clips it, then let the shared automation/keyboard reveal
210
+ // seam scroll, reconcile, and re-verify before focus lands.
211
+ // A disabled/hidden/fixed-clipped target still consumes the
212
+ // source edge; holding autofocus true never retries or steals.
213
+ const retained_layout = self.views[index].widgetLayoutTree();
214
+ if (canvas_widget_runtime.canvasWidgetLayoutNodeIndexById(retained_layout, autofocus_id)) |autofocus_index| {
215
+ if (canvas_widget_runtime.canvasWidgetLogicalFocusTarget(retained_layout, autofocus_index) != null) {
216
+ AutomationWidgetMethods(Runtime).focusAutomationCanvasWidget(self, index, autofocus_id) catch |err| switch (err) {
217
+ error.InvalidCommand => {},
218
+ else => return err,
219
+ };
220
+ }
211
221
  }
212
222
  }
213
223
  self.frame_profile.end(.reconcile, reconcile_begin);
@@ -330,11 +340,27 @@ pub fn RuntimeCanvasWidgetState(comptime Runtime: type) type {
330
340
  .set_composition => try AutomationWidgetMethods(Runtime).composeAutomationCanvasWidgetText(self, app, index, action.id, .ime_set_composition, action.text),
331
341
  .commit_composition => try AutomationWidgetMethods(Runtime).composeAutomationCanvasWidgetText(self, app, index, action.id, .ime_commit_composition, ""),
332
342
  .cancel_composition => try AutomationWidgetMethods(Runtime).composeAutomationCanvasWidgetText(self, app, index, action.id, .ime_cancel_composition, ""),
333
- .select => try AutomationWidgetMethods(Runtime).selectAutomationCanvasWidget(self, index, action.id),
343
+ .select => {
344
+ const node_index = self.views[index].canvasWidgetNodeIndexById(action.id) orelse return error.InvalidCommand;
345
+ if (self.views[index].widget_layout_nodes[node_index].widget.kind == .radio) {
346
+ // Radio selection is activation, not an echo-only
347
+ // retained-state write: drive the same Space path
348
+ // as keyboard and pointer input so a documented
349
+ // `on_change` handler updates the app model too.
350
+ try AutomationWidgetMethods(Runtime).dispatchAutomationWidgetKey(self, app, index, action.id, "space");
351
+ } else {
352
+ try AutomationWidgetMethods(Runtime).selectAutomationCanvasWidget(self, index, action.id);
353
+ }
354
+ },
334
355
  .drag => try AutomationWidgetMethods(Runtime).dispatchAutomationCanvasWidgetDrag(self, app, index, action.id, action.text),
335
356
  .drop_files => try AutomationWidgetMethods(Runtime).dispatchAutomationCanvasWidgetFileDrop(self, app, index, action.id, action.text),
336
357
  .dismiss => try AutomationWidgetMethods(Runtime).dismissAutomationCanvasWidget(self, app, index, action.id),
337
358
  }
359
+ // A direct focus action can reveal an offscreen target without
360
+ // passing through the GPU input dispatcher. Deliver the pending
361
+ // scroll observation in this semantic-action transaction too,
362
+ // rather than leaving it parked until unrelated future input.
363
+ try runtime_gpu_surface_events.RuntimeGpuSurfaceEvents(Runtime).dispatchPendingCanvasWidgetScrollEvents(self, app, index);
338
364
  // Key-driven action routes above dispatch real input events
339
365
  // whose refresh batches defer the platform publish; the AX
340
366
  // client reads the tree next, so force-flush here too.
@@ -39,6 +39,7 @@ const bridge = @import("../bridge/root.zig");
39
39
  const extensions = @import("../extensions/root.zig");
40
40
  const app_manifest = @import("app_manifest");
41
41
  const platform = @import("../platform/root.zig");
42
+ const window_state = @import("../window_state/root.zig");
42
43
  const runtime_effects = @import("effects.zig");
43
44
  const runtime_record_store = @import("record_store.zig");
44
45
  const runtime_relational_store = @import("relational_store.zig");
@@ -101,6 +102,7 @@ const RuntimeMainWebViewState = runtime_state.RuntimeMainWebViewState;
101
102
  const RuntimeSourceStorage = runtime_state.RuntimeSourceStorage;
102
103
  const RuntimeWebView = runtime_state.RuntimeWebView;
103
104
  const RuntimeTrayItem = runtime_state.RuntimeTrayItem;
105
+ const RuntimeStatusItem = runtime_state.RuntimeStatusItem;
104
106
  const ShellApplyMode = runtime_state.ShellApplyMode;
105
107
  const WindowSourcePolicy = runtime_state.WindowSourcePolicy;
106
108
  const FocusTraversalDirection = runtime_state.FocusTraversalDirection;
@@ -197,6 +199,10 @@ pub const Runtime = struct {
197
199
  /// frees, the `deinit` frees) goes through this field, never
198
200
  /// through `options.allocator`.
199
201
  owned_allocator: std.mem.Allocator,
202
+ /// Registered-image budget captured at init. Decode, registration,
203
+ /// replay validation, slot reuse, and deinit all observe this one
204
+ /// app-fixed limit even if public `options` is later mutated.
205
+ max_image_pixel_bytes: usize = canvas_limits.max_registered_canvas_image_pixel_bytes,
200
206
  surface: platform.Surface,
201
207
  appearance: platform.Appearance = .{},
202
208
  windows: [platform.max_windows]RuntimeWindow = undefined,
@@ -205,11 +211,8 @@ pub const Runtime = struct {
205
211
  view_count: usize = 0,
206
212
  webviews: [platform.max_webviews]RuntimeWebView = undefined,
207
213
  webview_count: usize = 0,
208
- tray_items: [platform.max_tray_items]RuntimeTrayItem = undefined,
209
- tray_item_count: usize = 0,
210
- tray_created: bool = false,
211
- tray_title: []const u8 = "",
212
- tray_title_storage: [platform.max_tray_title_bytes]u8 = undefined,
214
+ status_items: [platform.max_status_items]RuntimeStatusItem = [_]RuntimeStatusItem{.{}} ** platform.max_status_items,
215
+ status_item_count: usize = 0,
213
216
  /// Audio playback mirror for the automation snapshot, stamped by
214
217
  /// the ui-app layer whenever a dispatch or effect drain may have
215
218
  /// moved the effects channel's playback state. Like the tray, the
@@ -255,6 +258,11 @@ pub const Runtime = struct {
255
258
  video_height: u64 = 0,
256
259
  shell_layouts: [platform.max_windows]RuntimeShellLayout = undefined,
257
260
  shell_layout_count: usize = 0,
261
+ /// Reused by runtime-created window restoration. `Store.loadWindow`
262
+ /// needs the whole bounded state file plus decoded-string scratch; keep
263
+ /// that 64-KiB workspace on the already heap-owned Runtime instead of
264
+ /// placing it on the event-loop stack for every secondary-window create.
265
+ window_state_read_scratch: [window_state.max_serialized_bytes]u8 = undefined,
258
266
  next_window_id: platform.WindowId = 2,
259
267
  next_view_id: platform.ViewId = 1,
260
268
  invalidated: bool = true,
@@ -325,7 +333,8 @@ pub const Runtime = struct {
325
333
  /// list its full per-view item budget — the snapshot never truncates
326
334
  /// menus the runtime accepted.
327
335
  automation_widget_menu_items: [canvas_limits.max_canvas_widget_context_menu_items_per_view * platform.max_views]automation.snapshot.WidgetContextMenuItem = undefined,
328
- automation_tray_items: [platform.max_tray_items]automation.snapshot.TrayItem = undefined,
336
+ automation_tray_items: [platform.max_status_items * platform.max_tray_items]automation.snapshot.TrayItem = undefined,
337
+ automation_trays: [platform.max_status_items]automation.snapshot.Tray = undefined,
329
338
  /// Handshake for the `provenance` verb: cleared before the query is
330
339
  /// evented to the app, set by the app's response publish — so the
331
340
  /// dispatcher can answer with a teaching error when no app-side
@@ -500,10 +509,16 @@ pub const Runtime = struct {
500
509
  }
501
510
  }
502
511
  self.options = options;
512
+ if (options.max_image_pixel_bytes < canvas_limits.max_registered_canvas_image_pixel_bytes or
513
+ options.max_image_pixel_bytes > canvas_limits.max_registered_canvas_image_pixel_bytes_ceiling)
514
+ {
515
+ @panic("max_image_pixel_bytes must be between 1 MiB and 8 MiB; declare app.zon .images.max_image_pixel_bytes within that range");
516
+ }
503
517
  // Freeze the ownership allocator now (see the field doc):
504
518
  // `options` stays publicly mutable, but the identity that owns
505
519
  // on-demand storage must not move under live allocations.
506
520
  self.owned_allocator = options.allocator;
521
+ self.max_image_pixel_bytes = options.max_image_pixel_bytes;
507
522
  self.surface = options.platform.surface();
508
523
  // The profile rings exceed the small-default copy bound above;
509
524
  // assign explicitly so the disabled state is never undefined.
@@ -777,11 +792,18 @@ pub const Runtime = struct {
777
792
  pub const deleteCredential = SystemServiceMethods.deleteCredential;
778
793
  pub const formatLocalTime = SystemServiceMethods.formatLocalTime;
779
794
  pub const createTray = SystemServiceMethods.createTray;
795
+ pub const createStatusItem = SystemServiceMethods.createStatusItem;
796
+ pub const updateStatusItemShell = SystemServiceMethods.updateStatusItemShell;
797
+ pub const updateStatusItemMenu = SystemServiceMethods.updateStatusItemMenu;
798
+ pub const updateStatusItemTitle = SystemServiceMethods.updateStatusItemTitle;
799
+ pub const updateStatusItemPresentation = SystemServiceMethods.updateStatusItemPresentation;
800
+ pub const removeStatusItem = SystemServiceMethods.removeStatusItem;
780
801
  pub const updateTrayMenu = SystemServiceMethods.updateTrayMenu;
781
802
  pub const updateTrayTitle = SystemServiceMethods.updateTrayTitle;
782
803
  pub const updateTrayPresentation = SystemServiceMethods.updateTrayPresentation;
783
804
  pub const removeTray = SystemServiceMethods.removeTray;
784
805
  const trayCommandNameForItem = SystemServiceMethods.trayCommandNameForItem;
806
+ const statusItemCommandNameForItem = SystemServiceMethods.statusItemCommandNameForItem;
785
807
  const supportsFeatureFromJson = SystemServiceMethods.supportsFeatureFromJson;
786
808
  const readClipboardTextFromJson = SystemServiceMethods.readClipboardTextFromJson;
787
809
  const writeClipboardTextFromJson = SystemServiceMethods.writeClipboardTextFromJson;