@native-sdk/cli 0.8.4 → 0.9.1

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 (161) hide show
  1. package/build/app.zig +1178 -74
  2. package/build.zig +715 -17
  3. package/build.zig.zon +1 -0
  4. package/native-sdk.d.ts +10 -0
  5. package/package.json +12 -11
  6. package/packages/core/compile-surface/core.ts +435 -3
  7. package/packages/core/package-lock.json +11 -11
  8. package/packages/core/package.json +2 -2
  9. package/packages/core/scripts/compiler_typecheck.mjs +116 -15
  10. package/packages/core/scripts/gen_service_surface.mjs +268 -0
  11. package/packages/core/scripts/merge_static_archives.mjs +78 -0
  12. package/packages/core/scripts/npm_static_spike.mjs +64 -0
  13. package/packages/core/scripts/run_external_core_compiler.mjs +122 -6
  14. package/packages/core/scripts/run_external_service_compiler.mjs +280 -0
  15. package/packages/core/scripts/stage_external_core.mjs +9 -1
  16. package/packages/core/scripts/stage_external_services.mjs +172 -0
  17. package/packages/core/scripts/surface_manifest_diff.mjs +253 -0
  18. package/packages/core/scripts/vendor_service_packages.mjs +189 -0
  19. package/packages/core/sdk/core.d.ts +224 -0
  20. package/packages/core/sdk/core.ts +694 -22
  21. package/packages/core/sdk/events.d.ts +89 -0
  22. package/packages/core/sdk/events.ts +128 -0
  23. package/packages/core/src/checker.ts +936 -15
  24. package/packages/core/src/cli.ts +156 -3
  25. package/packages/core/src/contract.ts +28 -5
  26. package/packages/core/src/devhost.ts +1876 -16
  27. package/packages/core/src/devhost_journal.mjs +183 -0
  28. package/packages/core/src/devhost_resolver.mjs +17 -1
  29. package/packages/core/src/devhost_service_worker.mjs +90 -0
  30. package/packages/core/src/diagnostics.ts +179 -22
  31. package/packages/core/src/frontend.ts +210 -34
  32. package/packages/core/src/infer.ts +24 -0
  33. package/packages/core/src/modules.ts +129 -80
  34. package/packages/core/src/service_contract.ts +597 -0
  35. package/packages/core/src/sqlite_cli.ts +93 -0
  36. package/packages/core/src/sqlite_codegen.ts +806 -0
  37. package/packages/core/src/sqlite_runtime_policy.ts +364 -0
  38. package/packages/core/src/typed_ast.ts +36 -8
  39. package/skill-data/automation/SKILL.md +1 -1
  40. package/skill-data/core/references/project-anatomy.md +1 -1
  41. package/skill-data/native-ui/SKILL.md +58 -5
  42. package/skill-data/ts-core/SKILL.md +123 -41
  43. package/skill-data/ts-services/SKILL.md +126 -0
  44. package/skill-data/ts-services/references/service-surface.md +604 -0
  45. package/skill-data/zig/SKILL.md +1 -1
  46. package/skills/native-sdk/SKILL.md +1 -1
  47. package/src/app_runner/no_migrations.zig +3 -0
  48. package/src/app_runner/no_services.zig +20 -0
  49. package/src/app_runner/root.zig +133 -4
  50. package/src/app_runner/ts_core_main.zig +254 -8
  51. package/src/app_runner/ts_core_mobile.zig +241 -0
  52. package/src/automation/protocol.zig +5 -1
  53. package/src/automation/snapshot.zig +31 -11
  54. package/src/embed/app_exports.zig +12 -1
  55. package/src/embed/c_api.zig +48 -2
  56. package/src/embed/conversions.zig +4 -5
  57. package/src/embed/host.zig +109 -1
  58. package/src/embed/root.zig +8 -0
  59. package/src/embed/tests.zig +241 -0
  60. package/src/embed/types.zig +51 -0
  61. package/src/embed/ui_host.zig +185 -5
  62. package/src/platform/android/NativeSdkActivity.java +131 -0
  63. package/src/platform/android/android_host.c +182 -1
  64. package/src/platform/android/native_sdk_app.h +17 -0
  65. package/src/platform/ios/native_sdk_app.h +17 -0
  66. package/src/platform/ios/uikit_host.m +115 -0
  67. package/src/platform/linux/cef_host.cpp +8 -2
  68. package/src/platform/linux/gtk_host.c +289 -22
  69. package/src/platform/linux/gtk_host.h +5 -1
  70. package/src/platform/linux/root.zig +109 -22
  71. package/src/platform/macos/appkit_host.h +24 -7
  72. package/src/platform/macos/appkit_host.m +686 -64
  73. package/src/platform/macos/cef_host.mm +400 -66
  74. package/src/platform/macos/root.zig +304 -47
  75. package/src/platform/null_platform.zig +435 -48
  76. package/src/platform/null_platform_tests.zig +113 -0
  77. package/src/platform/root.zig +19 -0
  78. package/src/platform/types.zig +281 -28
  79. package/src/platform/windows/root.zig +207 -27
  80. package/src/platform/windows/webview2_host.cpp +334 -51
  81. package/src/primitives/app_manifest/comptime_scene.zig +2 -0
  82. package/src/primitives/app_manifest/root.zig +4 -0
  83. package/src/primitives/app_manifest/tests.zig +3 -0
  84. package/src/primitives/app_manifest/types.zig +32 -0
  85. package/src/primitives/app_manifest/validation.zig +19 -1
  86. package/src/root.zig +53 -0
  87. package/src/runtime/api.zig +19 -0
  88. package/src/runtime/automation_commands.zig +35 -2
  89. package/src/runtime/automation_snapshot.zig +32 -20
  90. package/src/runtime/bridge_permission_tests.zig +58 -3
  91. package/src/runtime/bridge_responses.zig +4 -2
  92. package/src/runtime/builtin_bridge.zig +11 -1
  93. package/src/runtime/canvas_frame.zig +18 -11
  94. package/src/runtime/canvas_frame_animation_tests.zig +4 -0
  95. package/src/runtime/clock.zig +13 -1
  96. package/src/runtime/core.zig +145 -7
  97. package/src/runtime/credentials_store.zig +115 -0
  98. package/src/runtime/effects.zig +3701 -231
  99. package/src/runtime/effects_credentials_tests.zig +332 -0
  100. package/src/runtime/effects_file_tests.zig +587 -0
  101. package/src/runtime/effects_host_tests.zig +208 -1
  102. package/src/runtime/effects_notification_tests.zig +11 -0
  103. package/src/runtime/effects_relational_tests.zig +314 -0
  104. package/src/runtime/effects_store_tests.zig +211 -0
  105. package/src/runtime/file_access.zig +400 -0
  106. package/src/runtime/file_effect_crash_helper.zig +28 -0
  107. package/src/runtime/file_effect_crash_tests.zig +37 -0
  108. package/src/runtime/flow.zig +35 -10
  109. package/src/runtime/gpu_surface_events.zig +6 -1
  110. package/src/runtime/native_command_event_tests.zig +86 -2
  111. package/src/runtime/persist_store.zig +666 -0
  112. package/src/runtime/pty.zig +5 -2
  113. package/src/runtime/record_store.zig +788 -0
  114. package/src/runtime/relational_store.zig +854 -0
  115. package/src/runtime/root.zig +54 -0
  116. package/src/runtime/runtime_event_tests.zig +70 -0
  117. package/src/runtime/service_host.zig +711 -0
  118. package/src/runtime/service_pool.zig +1314 -0
  119. package/src/runtime/session_blobs.zig +4 -1
  120. package/src/runtime/session_journal.zig +158 -5
  121. package/src/runtime/session_record.zig +215 -0
  122. package/src/runtime/session_replay.zig +206 -11
  123. package/src/runtime/session_tests.zig +81 -0
  124. package/src/runtime/shell_layout.zig +1 -0
  125. package/src/runtime/shell_layout_tests.zig +120 -0
  126. package/src/runtime/sqlite_engine.zig +474 -0
  127. package/src/runtime/state.zig +16 -0
  128. package/src/runtime/system_services.zig +170 -38
  129. package/src/runtime/tests.zig +4 -0
  130. package/src/runtime/ts_core_host.zig +1067 -95
  131. package/src/runtime/ts_core_host_tests.zig +325 -11
  132. package/src/runtime/ts_ui_app.zig +953 -2
  133. package/src/runtime/ui_app.zig +434 -96
  134. package/src/runtime/ui_app_tests.zig +287 -11
  135. package/src/runtime/ui_app_window_tests.zig +61 -7
  136. package/src/runtime/validation.zig +42 -0
  137. package/src/runtime/view.zig +9 -0
  138. package/src/runtime/window_storage.zig +1 -0
  139. package/src/runtime/window_view_runtime.zig +2 -3
  140. package/src/runtime/window_views.zig +19 -0
  141. package/src/tooling/android.zig +21 -16
  142. package/src/tooling/db.zig +160 -0
  143. package/src/tooling/ios.zig +7 -1
  144. package/src/tooling/manifest.zig +214 -2
  145. package/src/tooling/package.zig +116 -0
  146. package/src/tooling/raw_manifest.zig +30 -0
  147. package/src/tooling/root.zig +1 -0
  148. package/src/tooling/templates.zig +189 -4
  149. package/src/tooling/ts_core.zig +366 -17
  150. package/src/tooling/verbs.zig +7 -0
  151. package/third_party/sqlite/README.md +13 -0
  152. package/third_party/sqlite/sqlite3.c +269649 -0
  153. package/third_party/sqlite/sqlite3.h +14349 -0
  154. package/tools/corewire/core_abi.zig +14 -2
  155. package/tools/corewire/emit.zig +98 -29
  156. package/tools/corewire/emit_facade.zig +442 -27
  157. package/tools/corewire/emit_profile.zig +6 -2
  158. package/tools/corewire/emit_service.zig +924 -0
  159. package/tools/corewire/main.zig +122 -0
  160. package/tools/corewire/service_contract.zig +250 -0
  161. package/tools/corewire/sidecar.zig +26 -15
@@ -85,6 +85,8 @@ fn shellWindowFrom(comptime window: anytype) types.ShellWindow {
85
85
  if (@hasField(@TypeOf(window), "always_on_top")) out.always_on_top = window.always_on_top;
86
86
  if (@hasField(@TypeOf(window), "click_through")) out.click_through = window.click_through;
87
87
  if (@hasField(@TypeOf(window), "activate_on_show")) out.activate_on_show = window.activate_on_show;
88
+ if (@hasField(@TypeOf(window), "initially_hidden")) out.initially_hidden = window.initially_hidden;
89
+ if (@hasField(@TypeOf(window), "allows_fullscreen")) out.allows_fullscreen = window.allows_fullscreen;
88
90
  if (@hasField(@TypeOf(window), "min_width")) out.min_width = window.min_width;
89
91
  if (@hasField(@TypeOf(window), "min_height")) out.min_height = window.min_height;
90
92
  if (@hasField(@TypeOf(window), "close_policy")) {
@@ -9,6 +9,7 @@ pub const web_layer = @import("web_layer.zig");
9
9
  pub const ValidationError = types.ValidationError;
10
10
  pub const max_shortcuts = types.max_shortcuts;
11
11
  pub const max_shortcut_id_bytes = types.max_shortcut_id_bytes;
12
+ pub const max_app_id_bytes = types.max_app_id_bytes;
12
13
  pub const max_shortcut_key_bytes = types.max_shortcut_key_bytes;
13
14
  pub const max_shell_windows = types.max_shell_windows;
14
15
  pub const max_shell_views_per_window = types.max_shell_views_per_window;
@@ -38,6 +39,8 @@ pub const PermissionKind = types.PermissionKind;
38
39
  pub const Permission = types.Permission;
39
40
  pub const CapabilityKind = types.CapabilityKind;
40
41
  pub const Capability = types.Capability;
42
+ pub const PersistRestore = types.PersistRestore;
43
+ pub const PersistConfig = types.PersistConfig;
41
44
  pub const AppIdentity = types.AppIdentity;
42
45
  pub const Version = types.Version;
43
46
  pub const Icon = types.Icon;
@@ -102,6 +105,7 @@ pub const validateUrl = validation.validateUrl;
102
105
  pub const validateIcons = validation.validateIcons;
103
106
  pub const validatePermissions = validation.validatePermissions;
104
107
  pub const validateCapabilities = validation.validateCapabilities;
108
+ pub const validatePersist = validation.validatePersist;
105
109
  pub const validateBridge = validation.validateBridge;
106
110
  pub const validateFrontend = validation.validateFrontend;
107
111
  pub const validateBridgeOrigin = validation.validateBridgeOrigin;
@@ -617,7 +617,10 @@ test "app id validation" {
617
617
  try validateAppId("com.example.app", .reverse_dns);
618
618
  try validateAppId("my-tool", .simple);
619
619
 
620
+ const oversized_id = [_]u8{'a'} ** (types.max_app_id_bytes + 1);
621
+
620
622
  try std.testing.expectError(error.InvalidId, validateAppId("", .reverse_dns));
623
+ try std.testing.expectError(error.InvalidId, validateAppId(&oversized_id, .simple));
621
624
  try std.testing.expectError(error.InvalidId, validateAppId("example", .reverse_dns));
622
625
  try std.testing.expectError(error.InvalidId, validateAppId("Com.example.app", .reverse_dns));
623
626
  try std.testing.expectError(error.InvalidId, validateAppId("com/example/app", .reverse_dns));
@@ -32,6 +32,9 @@ pub const ValidationError = error{
32
32
 
33
33
  pub const max_shortcuts: usize = 64;
34
34
  pub const max_shortcut_id_bytes: usize = 64;
35
+ /// App identities double as the credential-manager service namespace, whose
36
+ /// cross-platform ABI is bounded to this size.
37
+ pub const max_app_id_bytes: usize = 128;
35
38
  pub const max_shortcut_key_bytes: usize = 32;
36
39
  pub const max_shell_windows: usize = 16;
37
40
  pub const max_shell_views_per_window: usize = 128;
@@ -161,6 +164,9 @@ pub const CapabilityKind = enum {
161
164
  dialog,
162
165
  clipboard,
163
166
  credentials,
167
+ persist,
168
+ store,
169
+ sqlite,
164
170
  open_url,
165
171
  reveal_path,
166
172
  recent_documents,
@@ -186,6 +192,9 @@ pub const Capability = union(CapabilityKind) {
186
192
  dialog: void,
187
193
  clipboard: void,
188
194
  credentials: void,
195
+ persist: void,
196
+ store: void,
197
+ sqlite: void,
189
198
  open_url: void,
190
199
  reveal_path: void,
191
200
  recent_documents: void,
@@ -363,6 +372,8 @@ pub const Window = struct {
363
372
  /// Show without activating the app or taking keyboard focus when
364
373
  /// false. An explicit focus action can still activate the window.
365
374
  activate_on_show: bool = true,
375
+ initially_hidden: bool = false,
376
+ allows_fullscreen: bool = true,
366
377
  /// Content min-size floor the window itself enforces (macOS
367
378
  /// `contentMinSize`): the resize stops at the floor instead of the
368
379
  /// layout clamping/clipping panes below it. 0 = no floor.
@@ -496,6 +507,14 @@ pub const ShellWindow = struct {
496
507
  always_on_top: bool = false,
497
508
  click_through: bool = false,
498
509
  activate_on_show: bool = true,
510
+ /// Create the native window ordered out and keep it hidden until an
511
+ /// explicit show/focus request. Intended for retained menu-bar app
512
+ /// host windows that must never flash during launch.
513
+ initially_hidden: bool = false,
514
+ /// Whether macOS exposes native fullscreen for this window. False
515
+ /// keeps ordinary resizing but disables the green fullscreen button
516
+ /// and the fullscreen command.
517
+ allows_fullscreen: bool = true,
499
518
  /// Content min-size floor the window itself enforces (macOS
500
519
  /// `contentMinSize`): the resize stops at the floor instead of the
501
520
  /// layout clamping/clipping panes below it. 0 = no floor. Like
@@ -627,12 +646,25 @@ pub const UpdateConfig = struct {
627
646
  check_on_start: bool = false,
628
647
  };
629
648
 
649
+ pub const PersistRestore = struct {
650
+ ok: []const u8,
651
+ none: []const u8,
652
+ err: []const u8,
653
+ };
654
+
655
+ pub const PersistConfig = struct {
656
+ version: u64,
657
+ debounce_ms: u32 = 500,
658
+ restore: PersistRestore,
659
+ };
660
+
630
661
  pub const Manifest = struct {
631
662
  identity: AppIdentity,
632
663
  version: Version,
633
664
  icons: []const Icon = &.{},
634
665
  permissions: []const Permission = &.{},
635
666
  capabilities: []const Capability = &.{},
667
+ persist: ?PersistConfig = null,
636
668
  bridge: BridgeConfig = .{},
637
669
  frontend: ?FrontendConfig = null,
638
670
  security: SecurityConfig = .{},
@@ -74,6 +74,7 @@ pub fn validateManifest(manifest: Manifest) ValidationError!void {
74
74
  try validateIcons(manifest.icons);
75
75
  try validatePermissions(manifest.permissions);
76
76
  try validateCapabilities(manifest.capabilities);
77
+ try validatePersist(manifest.persist, manifest.capabilities);
77
78
  try validateBridge(manifest.bridge);
78
79
  if (manifest.frontend) |frontend| try validateFrontend(frontend);
79
80
  try validateSecurity(manifest.security);
@@ -403,7 +404,7 @@ pub const AppIdMode = enum {
403
404
  };
404
405
 
405
406
  pub fn validateAppId(id: []const u8, mode: AppIdMode) ValidationError!void {
406
- if (id.len == 0) return error.InvalidId;
407
+ if (id.len == 0 or id.len > types.max_app_id_bytes) return error.InvalidId;
407
408
  if (id[0] == '.' or id[id.len - 1] == '.') return error.InvalidId;
408
409
 
409
410
  var segments: usize = 0;
@@ -543,6 +544,23 @@ pub fn validateCapabilities(capabilities: []const Capability) ValidationError!vo
543
544
  }
544
545
  }
545
546
 
547
+ pub fn validatePersist(config: ?types.PersistConfig, capabilities: []const Capability) ValidationError!void {
548
+ var declared = false;
549
+ for (capabilities) |capability| {
550
+ if (capability == .persist) declared = true;
551
+ }
552
+ if (declared != (config != null)) return error.MissingRequiredField;
553
+ const persist = config orelse return;
554
+ if (persist.version == 0 or persist.version > 9_007_199_254_740_991) return error.InvalidVersion;
555
+ if (persist.debounce_ms > 60_000) return error.InvalidTimeout;
556
+ try validateName(persist.restore.ok);
557
+ try validateName(persist.restore.none);
558
+ try validateName(persist.restore.err);
559
+ if (std.mem.eql(u8, persist.restore.ok, persist.restore.none) or
560
+ std.mem.eql(u8, persist.restore.ok, persist.restore.err) or
561
+ std.mem.eql(u8, persist.restore.none, persist.restore.err)) return error.InvalidName;
562
+ }
563
+
546
564
  pub fn validateBridge(bridge: BridgeConfig) ValidationError!void {
547
565
  for (bridge.commands, 0..) |command, i| {
548
566
  try validateName(command.name);
package/src/root.zig CHANGED
@@ -44,8 +44,44 @@ pub const FetchResponseMode = runtime.FetchResponseMode;
44
44
  pub const EffectResponse = runtime.EffectResponse;
45
45
  pub const EffectFetchOutcome = runtime.EffectFetchOutcome;
46
46
  pub const EffectFileOp = runtime.EffectFileOp;
47
+ pub const EffectFileEvent = runtime.EffectFileEvent;
47
48
  pub const EffectFileOutcome = runtime.EffectFileOutcome;
48
49
  pub const EffectFileResult = runtime.EffectFileResult;
50
+ pub const FileAccessBinding = runtime.FileAccessBinding;
51
+ pub const effect_file_stream_chunk_bytes = runtime.effect_file_stream_chunk_bytes;
52
+ pub const max_effect_file_streams = runtime.max_effect_file_streams;
53
+ pub const EffectCredentialsOperation = runtime.EffectCredentialsOperation;
54
+ pub const EffectCredentialsOutcome = runtime.EffectCredentialsOutcome;
55
+ pub const EffectCredentialsResult = runtime.EffectCredentialsResult;
56
+ pub const EffectPersistOutcome = runtime.EffectPersistOutcome;
57
+ pub const EffectPersistResult = runtime.EffectPersistResult;
58
+ pub const max_effect_persist_snapshot_bytes = runtime.max_effect_persist_snapshot_bytes;
59
+ pub const EffectStoreOutcome = runtime.EffectStoreOutcome;
60
+ pub const EffectStoreOp = runtime.EffectStoreOp;
61
+ pub const RecordStoreBinding = runtime.RecordStoreBinding;
62
+ pub const EffectDbValue = runtime.EffectDbValue;
63
+ pub const EffectDbStatement = runtime.EffectDbStatement;
64
+ pub const EffectDbOutcome = runtime.EffectDbOutcome;
65
+ pub const EffectDbResultKind = runtime.EffectDbResultKind;
66
+ pub const EffectDbResult = runtime.EffectDbResult;
67
+ pub const RelationalStoreBinding = runtime.RelationalStoreBinding;
68
+ pub const max_db_effects = runtime.max_db_effects;
69
+ pub const max_effect_db_sql_bytes = runtime.max_effect_db_sql_bytes;
70
+ pub const max_effect_db_parameters = runtime.max_effect_db_parameters;
71
+ pub const max_effect_db_exec_statements = runtime.max_effect_db_exec_statements;
72
+ pub const max_effect_db_parameter_bytes = runtime.max_effect_db_parameter_bytes;
73
+ pub const max_effect_db_exec_parameter_bytes = runtime.max_effect_db_exec_parameter_bytes;
74
+ pub const default_effect_db_page_rows = runtime.default_effect_db_page_rows;
75
+ pub const max_effect_db_page_bytes = runtime.max_effect_db_page_bytes;
76
+ pub const max_effect_db_result_rows = runtime.max_effect_db_result_rows;
77
+ pub const max_effect_db_result_bytes = runtime.max_effect_db_result_bytes;
78
+ pub const max_effect_store_key_bytes = runtime.max_effect_store_key_bytes;
79
+ pub const max_effect_store_value_bytes = runtime.max_effect_store_value_bytes;
80
+ pub const max_effect_store_batch_entries = runtime.max_effect_store_batch_entries;
81
+ pub const max_effect_store_batch_bytes = runtime.max_effect_store_batch_bytes;
82
+ pub const max_effect_store_result_bytes = runtime.max_effect_store_result_bytes;
83
+ pub const default_effect_store_scan_limit = runtime.default_effect_store_scan_limit;
84
+ pub const max_effect_store_scan_limit = runtime.max_effect_store_scan_limit;
49
85
  pub const effect_error_exit_code = runtime.effect_error_exit_code;
50
86
  pub const max_effects = runtime.max_effects;
51
87
  pub const max_effect_argv = runtime.max_effect_argv;
@@ -64,6 +100,14 @@ pub const max_effect_body_bytes = runtime.max_effect_body_bytes;
64
100
  pub const default_effect_fetch_timeout_ms = runtime.default_effect_fetch_timeout_ms;
65
101
  pub const max_effect_file_path_bytes = runtime.max_effect_file_path_bytes;
66
102
  pub const max_effect_file_bytes = runtime.max_effect_file_bytes;
103
+ pub const persist_store = runtime.persist_store;
104
+ pub const PersistStore = runtime.PersistStore;
105
+ pub const PersistOutcome = runtime.PersistOutcome;
106
+ pub const max_persist_snapshot_bytes = runtime.max_persist_snapshot_bytes;
107
+ pub const record_store = runtime.record_store;
108
+ pub const RecordStore = runtime.RecordStore;
109
+ pub const relational_store = runtime.relational_store;
110
+ pub const RelationalStore = runtime.RelationalStore;
67
111
  pub const EffectClipboardOp = runtime.EffectClipboardOp;
68
112
  pub const EffectClipboardOutcome = runtime.EffectClipboardOutcome;
69
113
  pub const EffectClipboardResult = runtime.EffectClipboardResult;
@@ -104,6 +148,11 @@ pub const max_effect_pty_write_bytes = runtime.max_effect_pty_write_bytes;
104
148
  pub const max_effect_pty_term_bytes = runtime.max_effect_pty_term_bytes;
105
149
  pub const EffectHostResult = runtime.EffectHostResult;
106
150
  pub const HostCallBinding = runtime.HostCallBinding;
151
+ pub const HostCallCompletion = runtime.HostCallCompletion;
152
+ pub const ServiceHost = runtime.ServiceHost;
153
+ pub const serviceEnvironmentVariableAllowed = runtime.serviceEnvironmentVariableAllowed;
154
+ pub const ServicePool = runtime.ServicePool;
155
+ pub const service_pool = runtime.service_pool;
107
156
  pub const max_effect_host_name_bytes = runtime.max_effect_host_name_bytes;
108
157
  pub const max_effect_host_payload_bytes = runtime.max_effect_host_payload_bytes;
109
158
  pub const max_effect_host_result_bytes = runtime.max_effect_host_result_bytes;
@@ -171,6 +220,7 @@ pub const FormFactor = platform.FormFactor;
171
220
  pub const WindowDragRegion = platform.WindowDragRegion;
172
221
  pub const WindowShowMode = platform.WindowShowMode;
173
222
  pub const WindowClosePolicy = platform.WindowClosePolicy;
223
+ pub const LaunchAtLoginStatus = platform.LaunchAtLoginStatus;
174
224
  pub const Menu = platform.Menu;
175
225
  pub const MenuItem = platform.MenuItem;
176
226
  pub const Shortcut = platform.Shortcut;
@@ -194,8 +244,11 @@ pub const MessageDialogStyle = platform.MessageDialogStyle;
194
244
  pub const MessageDialogResult = platform.MessageDialogResult;
195
245
  pub const MessageDialogOptions = platform.MessageDialogOptions;
196
246
  pub const NotificationOptions = platform.NotificationOptions;
247
+ pub const StatusItemId = platform.StatusItemId;
248
+ pub const primary_status_item_id = platform.primary_status_item_id;
197
249
  pub const TrayItemId = platform.TrayItemId;
198
250
  pub const TrayOptions = platform.TrayOptions;
251
+ pub const TrayShell = platform.TrayShell;
199
252
  pub const TrayMenuItem = platform.TrayMenuItem;
200
253
  pub const BridgeDispatcher = bridge.Dispatcher;
201
254
  pub const BridgePolicy = bridge.Policy;
@@ -27,6 +27,7 @@ pub const CommandEvent = struct {
27
27
  source: CommandSource = .runtime,
28
28
  window_id: platform.WindowId = 0,
29
29
  view_label: []const u8 = "",
30
+ status_item_id: platform.StatusItemId = 0,
30
31
  tray_item_id: platform.TrayItemId = 0,
31
32
  };
32
33
 
@@ -38,6 +39,7 @@ pub const CommandSource = enum {
38
39
  shortcut,
39
40
  toolbar,
40
41
  tray,
42
+ notification,
41
43
  native_view,
42
44
  bridge,
43
45
  };
@@ -489,6 +491,23 @@ pub const Options = struct {
489
491
  shortcuts: []const platform.Shortcut = &.{},
490
492
  automation: ?automation.Server = null,
491
493
  window_state_store: ?window_state.Store = null,
494
+ /// Engine-owned record-store service. The app runner sets this only
495
+ /// when app.zon declares the `store` capability; replay leaves it null
496
+ /// because journaled effect results are the whole external world.
497
+ record_store: ?runtime_effects.RecordStoreBinding = null,
498
+ /// Engine-owned relational database, installed only for the `sqlite`
499
+ /// capability. Replay keeps it null and feeds journaled DB results.
500
+ relational_store: ?runtime_effects.RelationalStoreBinding = null,
501
+ /// Whether the app declared the `credentials` capability. Permission is
502
+ /// checked separately; both gates must be open before core effects may
503
+ /// reach the platform keychain.
504
+ credentials_enabled: bool = false,
505
+ /// Raw-file policy resolved by the app runner. Six app-owned roots are
506
+ /// allowed without a grant; `filesystem` opens arbitrary paths.
507
+ /// Standard runners install the six resolved app-owned roots here. If a
508
+ /// custom runner omits the binding, UiApp fails closed with no exempt roots
509
+ /// while still honoring an explicit `filesystem` permission.
510
+ file_access: ?runtime_effects.FileAccessBinding = null,
492
511
  js_window_api: bool = false,
493
512
  /// Whether this build ships the embedded web layer. The app runner
494
513
  /// sets it from the build graph's app.zon inference (declare-to-use:
@@ -153,8 +153,8 @@ pub fn parseAutomationCommandName(value: []const u8) ![]const u8 {
153
153
  return trimmed[0..separator];
154
154
  }
155
155
 
156
- /// `tray-action <item-id>`: the numeric dropdown item id printed by the
157
- /// snapshot's `tray-item #N` lines (bare number, like widget ids).
156
+ /// Parses the one-id `tray-action <item-id>` compatibility form: the
157
+ /// numeric dropdown row id printed by a primary item's `tray-item #N` line.
158
158
  pub fn parseAutomationTrayItemId(value: []const u8) !platform.TrayItemId {
159
159
  const trimmed = std.mem.trim(u8, value, " \n\r\t");
160
160
  if (trimmed.len == 0) return error.InvalidCommand;
@@ -164,6 +164,27 @@ pub fn parseAutomationTrayItemId(value: []const u8) !platform.TrayItemId {
164
164
  return id;
165
165
  }
166
166
 
167
+ pub const AutomationTrayTarget = struct {
168
+ status_item_id: platform.StatusItemId = platform.primary_status_item_id,
169
+ item_id: platform.TrayItemId,
170
+ };
171
+
172
+ /// `tray-action <item-id>` targets the reserved primary status item;
173
+ /// `tray-action <status-item-id> <item-id>` addresses any live item.
174
+ pub fn parseAutomationTrayTarget(value: []const u8) !AutomationTrayTarget {
175
+ var tokens = std.mem.tokenizeAny(u8, value, " \t\r\n");
176
+ const first = tokens.next() orelse return error.InvalidCommand;
177
+ const second = tokens.next();
178
+ if (tokens.next() != null) return error.InvalidCommand;
179
+ if (second) |item_text| {
180
+ const status_item_id = std.fmt.parseUnsigned(platform.StatusItemId, first, 10) catch return error.InvalidCommand;
181
+ const item_id = std.fmt.parseUnsigned(platform.TrayItemId, item_text, 10) catch return error.InvalidCommand;
182
+ if (status_item_id == 0 or item_id == 0) return error.InvalidCommand;
183
+ return .{ .status_item_id = status_item_id, .item_id = item_id };
184
+ }
185
+ return .{ .item_id = try parseAutomationTrayItemId(first) };
186
+ }
187
+
167
188
  pub fn parseAutomationViewLabel(value: []const u8) ![]const u8 {
168
189
  const trimmed = std.mem.trim(u8, value, " \n\r\t");
169
190
  if (trimmed.len == 0) return error.InvalidCommand;
@@ -601,6 +622,18 @@ test "runtime parses automation tray item ids" {
601
622
  try std.testing.expectError(error.InvalidCommand, parseAutomationTrayItemId("4 5"));
602
623
  }
603
624
 
625
+ test "runtime parses primary and explicit automation tray targets" {
626
+ const primary = try parseAutomationTrayTarget("4");
627
+ try std.testing.expectEqual(platform.primary_status_item_id, primary.status_item_id);
628
+ try std.testing.expectEqual(@as(platform.TrayItemId, 4), primary.item_id);
629
+ const explicit = try parseAutomationTrayTarget("23 12");
630
+ try std.testing.expectEqual(@as(platform.StatusItemId, 23), explicit.status_item_id);
631
+ try std.testing.expectEqual(@as(platform.TrayItemId, 12), explicit.item_id);
632
+ try std.testing.expectError(error.InvalidCommand, parseAutomationTrayTarget("0 2"));
633
+ try std.testing.expectError(error.InvalidCommand, parseAutomationTrayTarget("2 0"));
634
+ try std.testing.expectError(error.InvalidCommand, parseAutomationTrayTarget("1 2 3"));
635
+ }
636
+
604
637
  test "runtime parses automation widget click targets" {
605
638
  const target = try parseAutomationWidgetTarget("canvas 42");
606
639
  try std.testing.expectEqualStrings("canvas", target.view_label);
@@ -32,7 +32,7 @@ pub fn RuntimeAutomationSnapshot(comptime Runtime: type) type {
32
32
  .widgets = &.{},
33
33
  .diagnostics = automationDiagnostics(self),
34
34
  .frame_profile = automationFrameProfile(self),
35
- .tray = automationTray(self),
35
+ .trays = automationTrays(self),
36
36
  .audio = automationAudio(self),
37
37
  .video = automationVideo(self),
38
38
  .errors = self.dispatchErrors(),
@@ -66,7 +66,7 @@ pub fn RuntimeAutomationSnapshot(comptime Runtime: type) type {
66
66
  .widgets = self.automation_widgets[0..widget_count],
67
67
  .diagnostics = automationDiagnostics(self),
68
68
  .frame_profile = automationFrameProfile(self),
69
- .tray = automationTray(self),
69
+ .trays = automationTrays(self),
70
70
  .audio = automationAudio(self),
71
71
  .video = automationVideo(self),
72
72
  .errors = self.dispatchErrors(),
@@ -79,26 +79,38 @@ pub fn RuntimeAutomationSnapshot(comptime Runtime: type) type {
79
79
  };
80
80
  }
81
81
 
82
- /// The live tray as the runtime last applied it: title +
83
- /// dropdown rows, or null when no status item exists. The menu
84
- /// bar is outside every window capture, so the snapshot is the
85
- /// only automation-visible evidence of the model-driven tray.
86
- fn automationTray(self: *Runtime) ?automation.snapshot.Tray {
87
- if (!self.tray_created) return null;
88
- const count = @min(self.tray_item_count, self.automation_tray_items.len);
89
- for (self.tray_items[0..count], 0..) |item, index| {
90
- self.automation_tray_items[index] = .{
91
- .id = item.id,
92
- .label = item.label,
93
- .command = item.command,
94
- .separator = item.separator,
95
- .enabled = item.enabled,
82
+ /// Every live status item as the runtime last applied it. Menu
83
+ /// bar contents live outside window captures, so identifiers
84
+ /// are explicit in both snapshots and automation commands.
85
+ fn automationTrays(self: *Runtime) []const automation.snapshot.Tray {
86
+ var tray_count: usize = 0;
87
+ var item_offset: usize = 0;
88
+ for (self.status_items) |status_item| {
89
+ if (!status_item.active or tray_count >= self.automation_trays.len) continue;
90
+ const count = @min(status_item.item_count, self.automation_tray_items.len - item_offset);
91
+ for (status_item.items[0..count], 0..) |item, index| {
92
+ self.automation_tray_items[item_offset + index] = .{
93
+ .id = item.id,
94
+ .label = item.label,
95
+ .command = item.command,
96
+ .separator = item.separator,
97
+ .enabled = item.enabled,
98
+ .detail = item.detail,
99
+ .role = item.role,
100
+ .key = item.key,
101
+ .modifiers = item.modifiers,
102
+ };
103
+ }
104
+ self.automation_trays[tray_count] = .{
105
+ .id = status_item.id,
106
+ .visible = status_item.visible,
107
+ .title = status_item.title,
108
+ .items = self.automation_tray_items[item_offset .. item_offset + count],
96
109
  };
110
+ tray_count += 1;
111
+ item_offset += count;
97
112
  }
98
- return .{
99
- .title = self.tray_title,
100
- .items = self.automation_tray_items[0..count],
101
- };
113
+ return self.automation_trays[0..tray_count];
102
114
  }
103
115
 
104
116
  /// Live audio playback as the ui-app layer last mirrored it
@@ -320,22 +320,43 @@ test "runtime validates native OS actions before platform dispatch" {
320
320
 
321
321
  try std.testing.expectError(error.InvalidTrayOptions, harness.runtime.createTray(.{ .items = &.{.{ .label = "" }} }));
322
322
  try std.testing.expectError(error.InvalidTrayOptions, harness.runtime.updateTrayMenu(&.{.{ .label = "" }}));
323
+ try std.testing.expectError(error.InvalidTrayOptions, harness.runtime.createTray(.{ .presentation = .{ .width = -1 } }));
324
+ try std.testing.expectError(error.InvalidTrayOptions, harness.runtime.createTray(.{ .presentation = .{ .icon_opacity = 1.1 } }));
325
+ try std.testing.expectError(error.InvalidTrayOptions, harness.runtime.updateTrayMenu(&.{.{ .id = 7, .label = "Readout", .command = "app.bad", .role = .info }}));
326
+ try std.testing.expectError(error.InvalidTrayOptions, harness.runtime.updateTrayMenu(&.{.{ .id = 7, .label = "Command", .detail = "not allowed" }}));
327
+ try std.testing.expectError(error.InvalidTrayOptions, harness.runtime.updateTrayMenu(&.{.{ .id = 7, .label = "No command", .key = "q" }}));
328
+ try std.testing.expectError(error.InvalidTrayOptions, harness.runtime.updateTrayMenu(&.{.{ .id = 7, .label = "Bad key", .command = "app.bad-key", .key = "not-a-key", .modifiers = .{ .command = true } }}));
329
+ try std.testing.expectError(error.InvalidTrayOptions, harness.runtime.updateTrayMenu(&.{.{ .id = 7, .label = "Unsafe key", .command = "app.unsafe-key", .key = "q" }}));
323
330
  try harness.runtime.createTray(.{
324
331
  .icon_path = "/tmp/tray.png",
325
332
  .tooltip = "native-sdk",
333
+ .presentation = .{ .title = "LIVE", .width = 62, .tone = .warning, .icon_opacity = 0.5, .monospaced = true },
334
+ .activation_command = "app.refresh",
335
+ .alternate_activation_command = "app.mode",
336
+ .open_command = "app.opened",
326
337
  .items = &.{
327
- .{ .id = 1, .label = "Open" },
338
+ .{ .id = 1, .label = "Open", .detail = "ready", .role = .info },
328
339
  .{ .separator = true },
329
- .{ .id = 2, .label = "Quit", .enabled = false },
340
+ .{ .id = 2, .label = "Quit", .command = "app.quit", .enabled = false, .detail = "warning", .role = .agent, .key = "q", .modifiers = .{ .command = true } },
330
341
  },
331
342
  });
332
343
  try std.testing.expectEqual(@as(usize, 1), harness.null_platform.trayCreateCount());
333
344
  try std.testing.expectEqualStrings("/tmp/tray.png", harness.null_platform.lastTrayIconPath());
334
345
  try std.testing.expectEqualStrings("native-sdk", harness.null_platform.lastTrayTooltip());
346
+ try std.testing.expectEqualStrings("LIVE", harness.null_platform.lastTrayTitle());
347
+ try std.testing.expectEqualStrings("app.refresh", harness.null_platform.lastTrayActivationCommand());
348
+ try std.testing.expectEqualStrings("app.mode", harness.null_platform.lastTrayAlternateActivationCommand());
349
+ try std.testing.expectEqualStrings("app.opened", harness.null_platform.lastTrayOpenCommand());
350
+ try std.testing.expectEqual(platform.TrayTone.warning, harness.null_platform.lastTrayPresentation().tone);
351
+ try std.testing.expectEqual(@as(f32, 62), harness.null_platform.lastTrayPresentation().width);
335
352
  try std.testing.expectEqual(@as(usize, 3), harness.null_platform.trayItems().len);
336
353
  try std.testing.expectEqualStrings("Open", harness.null_platform.trayItems()[0].label);
337
354
  try std.testing.expect(harness.null_platform.trayItems()[1].separator);
338
355
  try std.testing.expect(!harness.null_platform.trayItems()[2].enabled);
356
+ try std.testing.expectEqual(platform.TrayItemRole.agent, harness.null_platform.trayItems()[2].role);
357
+ try std.testing.expectEqualStrings("warning", harness.null_platform.trayItems()[2].detail);
358
+ try std.testing.expectEqualStrings("q", harness.null_platform.trayItems()[2].key);
359
+ try std.testing.expect(harness.null_platform.trayItems()[2].modifiers.command);
339
360
  try harness.runtime.updateTrayMenu(&.{.{ .id = 3, .label = "Settings" }});
340
361
  try std.testing.expectEqual(@as(usize, 2), harness.null_platform.trayUpdateCount());
341
362
  try std.testing.expectEqualStrings("Settings", harness.null_platform.trayItems()[0].label);
@@ -356,10 +377,11 @@ test "runtime gates built-in OS bridge commands through explicit policy" {
356
377
  try std.testing.expect(std.mem.indexOf(u8, denied.null_platform.lastBridgeResponse(), "OS API is not permitted") != null);
357
378
  try std.testing.expect(std.mem.indexOf(u8, denied.null_platform.lastBridgeResponse(), "\"permission_denied\"") != null);
358
379
 
359
- const grants = [_][]const u8{ security.permission_network, security.permission_filesystem, security.permission_notifications };
380
+ const grants = [_][]const u8{ security.permission_network, security.permission_filesystem, security.permission_notifications, security.permission_command };
360
381
  const network_permission = [_][]const u8{security.permission_network};
361
382
  const filesystem_permission = [_][]const u8{security.permission_filesystem};
362
383
  const notifications_permission = [_][]const u8{security.permission_notifications};
384
+ const command_permission = [_][]const u8{security.permission_command};
363
385
  const origins = [_][]const u8{"zero://inline"};
364
386
  const policies = [_]bridge.CommandPolicy{
365
387
  .{ .name = "native-sdk.os.openUrl", .permissions = &network_permission, .origins = &origins },
@@ -368,6 +390,14 @@ test "runtime gates built-in OS bridge commands through explicit policy" {
368
390
  .{ .name = "native-sdk.os.addRecentDocument", .permissions = &filesystem_permission, .origins = &origins },
369
391
  .{ .name = "native-sdk.os.clearRecentDocuments", .permissions = &filesystem_permission, .origins = &origins },
370
392
  };
393
+ const action_policies = [_]bridge.CommandPolicy{
394
+ .{ .name = "native-sdk.os.openUrl", .permissions = &network_permission, .origins = &origins },
395
+ .{ .name = "native-sdk.os.showNotification", .permissions = &notifications_permission, .origins = &origins },
396
+ .{ .name = "native-sdk.os.revealPath", .permissions = &filesystem_permission, .origins = &origins },
397
+ .{ .name = "native-sdk.os.addRecentDocument", .permissions = &filesystem_permission, .origins = &origins },
398
+ .{ .name = "native-sdk.os.clearRecentDocuments", .permissions = &filesystem_permission, .origins = &origins },
399
+ .{ .name = "native-sdk.command.invoke", .permissions = &command_permission, .origins = &origins },
400
+ };
371
401
  const allowed_urls = [_][]const u8{"https://example.com/*"};
372
402
 
373
403
  const allowed = try TestHarness().create(std.testing.allocator, .{});
@@ -387,6 +417,31 @@ test "runtime gates built-in OS bridge commands through explicit policy" {
387
417
  try std.testing.expectEqual(@as(usize, 1), allowed.null_platform.notificationCount());
388
418
  try std.testing.expectEqualStrings("Build finished", allowed.null_platform.lastNotificationTitle());
389
419
 
420
+ try allowed.runtime.dispatchPlatformEvent(app, .{ .bridge_message = .{
421
+ .bytes = "{\"id\":\"action-denied\",\"command\":\"native-sdk.os.showNotification\",\"payload\":{\"id\":\"build\",\"title\":\"Build finished\",\"actionLabel\":\"Open\",\"actionCommand\":\"build.open\"}}",
422
+ .origin = "zero://inline",
423
+ } });
424
+ try std.testing.expect(std.mem.indexOf(u8, allowed.null_platform.lastBridgeResponse(), "Notification actions require command invoke permission") != null);
425
+ try std.testing.expectEqual(@as(usize, 1), allowed.null_platform.notificationCount());
426
+
427
+ allowed.runtime.options.builtin_bridge = .{ .enabled = true, .commands = &action_policies };
428
+ try allowed.runtime.dispatchPlatformEvent(app, .{ .bridge_message = .{
429
+ .bytes = "{\"id\":\"action-allowed\",\"command\":\"native-sdk.os.showNotification\",\"payload\":{\"id\":\"build\",\"title\":\"Build finished\",\"actionLabel\":\"Open\",\"actionCommand\":\"build.open\"}}",
430
+ .origin = "zero://inline",
431
+ } });
432
+ try std.testing.expect(std.mem.indexOf(u8, allowed.null_platform.lastBridgeResponse(), "\"ok\":true") != null);
433
+ try std.testing.expectEqual(@as(usize, 2), allowed.null_platform.notificationCount());
434
+ try std.testing.expectEqualStrings("build", allowed.null_platform.lastNotificationId());
435
+ try std.testing.expectEqualStrings("Open", allowed.null_platform.lastNotificationActionLabel());
436
+ try std.testing.expectEqualStrings("build.open", allowed.null_platform.lastNotificationActionCommand());
437
+
438
+ try allowed.runtime.dispatchPlatformEvent(app, .{ .bridge_message = .{
439
+ .bytes = "{\"id\":\"invalid-notification\",\"command\":\"native-sdk.os.showNotification\",\"payload\":{\"id\":42,\"title\":\"Build finished\"}}",
440
+ .origin = "zero://inline",
441
+ } });
442
+ try std.testing.expect(std.mem.indexOf(u8, allowed.null_platform.lastBridgeResponse(), "\"invalid_request\"") != null);
443
+ try std.testing.expectEqual(@as(usize, 2), allowed.null_platform.notificationCount());
444
+
390
445
  try allowed.runtime.dispatchPlatformEvent(app, .{ .bridge_message = .{
391
446
  .bytes = "{\"id\":\"open\",\"command\":\"native-sdk.os.openUrl\",\"payload\":{\"url\":\"https://example.com/docs\"}}",
392
447
  .origin = "zero://inline",
@@ -49,7 +49,7 @@ pub fn writeCommandEventJson(event_value: anytype, output: []u8) ![]const u8 {
49
49
  try json.writeString(&writer, @tagName(event_value.source));
50
50
  try writer.print(",\"windowId\":{d},\"viewLabel\":", .{event_value.window_id});
51
51
  try json.writeString(&writer, event_value.view_label);
52
- try writer.print(",\"trayItemId\":{d}", .{event_value.tray_item_id});
52
+ try writer.print(",\"statusItemId\":{d},\"trayItemId\":{d}", .{ event_value.status_item_id, event_value.tray_item_id });
53
53
  try writer.writeByte('}');
54
54
  return writer.buffered();
55
55
  }
@@ -83,7 +83,7 @@ pub fn writeViewJsonToWriter(view: platform.ViewInfo, writer: anytype) !void {
83
83
  try json.writeString(writer, view.command);
84
84
  try writer.writeAll(",\"url\":");
85
85
  try json.writeString(writer, view.url);
86
- try writer.print(",\"x\":{d},\"y\":{d},\"width\":{d},\"height\":{d},\"layer\":{d},\"visible\":{},\"enabled\":{},\"transparent\":{},\"bridge\":{},\"gpuWidth\":{d},\"gpuHeight\":{d},\"gpuScale\":{d},\"gpuFrame\":{d},\"gpuTimestampNs\":{d},\"gpuFrameIntervalNs\":{d},\"gpuInputTimestampNs\":{d},\"gpuInputLatencyNs\":{d},\"gpuInputLatencyBudgetNs\":{d},\"gpuInputLatencyBudgetExceededCount\":{d},\"gpuInputLatencyBudgetOk\":{},\"gpuFirstFrameLatencyNs\":{d},\"gpuFirstFrameLatencyBudgetNs\":{d},\"gpuFirstFrameLatencyBudgetExceededCount\":{d},\"gpuFirstFrameLatencyBudgetOk\":{},\"gpuNonblank\":{},\"gpuSampleColor\":{d},\"gpuBackend\":", .{
86
+ try writer.print(",\"x\":{d},\"y\":{d},\"width\":{d},\"height\":{d},\"layer\":{d},\"visible\":{},\"enabled\":{},\"transparent\":{},\"bridge\":{},\"gpuWidth\":{d},\"gpuHeight\":{d},\"gpuScale\":{d},\"gpuFrame\":{d},\"gpuTimestampNs\":{d},\"gpuFrameIntervalNs\":{d},\"gpuInputCount\":{d},\"gpuInputTimestampNs\":{d},\"gpuInputLatencyNs\":{d},\"gpuInputLatencyBudgetNs\":{d},\"gpuInputLatencyBudgetExceededCount\":{d},\"gpuInputLatencyBudgetOk\":{},\"gpuFirstFrameLatencyNs\":{d},\"gpuFirstFrameLatencyBudgetNs\":{d},\"gpuFirstFrameLatencyBudgetExceededCount\":{d},\"gpuFirstFrameLatencyBudgetOk\":{},\"gpuNonblank\":{},\"gpuOccluded\":{},\"gpuSampleColor\":{d},\"gpuBackend\":", .{
87
87
  view.frame.x,
88
88
  view.frame.y,
89
89
  view.frame.width,
@@ -99,6 +99,7 @@ pub fn writeViewJsonToWriter(view: platform.ViewInfo, writer: anytype) !void {
99
99
  view.gpu_frame_index,
100
100
  view.gpu_timestamp_ns,
101
101
  view.gpu_frame_interval_ns,
102
+ view.gpu_input_event_count,
102
103
  view.gpu_input_timestamp_ns,
103
104
  view.gpu_input_latency_ns,
104
105
  view.gpu_input_latency_budget_ns,
@@ -109,6 +110,7 @@ pub fn writeViewJsonToWriter(view: platform.ViewInfo, writer: anytype) !void {
109
110
  view.gpu_first_frame_latency_budget_exceeded_count,
110
111
  view.gpu_first_frame_latency_budget_ok,
111
112
  view.gpu_frame_nonblank,
113
+ view.gpu_occluded,
112
114
  view.gpu_sample_color,
113
115
  });
114
116
  try json.writeString(writer, @tagName(view.gpu_backend));
@@ -186,7 +186,17 @@ pub fn RuntimeBuiltinBridge(comptime Runtime: type) type {
186
186
  return bridge.writeSuccessResponse(response_buffer, request.id, result);
187
187
  }
188
188
 
189
- pub fn dispatchOsBridgeCommand(self: *Runtime, request: bridge.Request, result_buffer: []u8, response_buffer: []u8) []const u8 {
189
+ pub fn dispatchOsBridgeCommand(self: *Runtime, request: bridge.Request, origin: []const u8, result_buffer: []u8, response_buffer: []u8) []const u8 {
190
+ if (std.mem.eql(u8, request.command, "native-sdk.os.showNotification")) {
191
+ var action_scratch: [platform.max_notification_action_command_bytes]u8 = undefined;
192
+ var action_storage = json.StringStorage.init(&action_scratch);
193
+ const action_command = jsonStringField(request.payload, "actionCommand", &action_storage) orelse "";
194
+ if (action_command.len > 0 and
195
+ !Self.allowsBuiltinBridgeCommand(self, "native-sdk.command.invoke", origin, security.permission_command))
196
+ {
197
+ return bridge.writeErrorResponse(response_buffer, request.id, .permission_denied, "Notification actions require command invoke permission");
198
+ }
199
+ }
190
200
  const result = if (std.mem.eql(u8, request.command, "native-sdk.os.openUrl"))
191
201
  SystemServiceMethods.openExternalUrlFromJson(self, request.payload, result_buffer) catch |err| return bridge.writeErrorResponse(response_buffer, request.id, builtinBridgeErrorCode(err), builtinBridgeErrorMessage(err))
192
202
  else if (std.mem.eql(u8, request.command, "native-sdk.os.showNotification"))