@native-sdk/cli 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/build/app.zig +357 -33
  2. package/build.zig +234 -11
  3. package/native-sdk.d.ts +8 -0
  4. package/package.json +10 -10
  5. package/packages/core/compile-surface/core.ts +70 -1
  6. package/packages/core/package-lock.json +11 -11
  7. package/packages/core/package.json +2 -2
  8. package/packages/core/scripts/merge_static_archives.mjs +78 -0
  9. package/packages/core/scripts/run_external_core_compiler.mjs +52 -7
  10. package/packages/core/scripts/run_external_service_compiler.mjs +53 -13
  11. package/packages/core/scripts/stage_external_services.mjs +1 -1
  12. package/packages/core/sdk/core.d.ts +75 -0
  13. package/packages/core/sdk/core.ts +170 -13
  14. package/packages/core/sdk/events.d.ts +53 -0
  15. package/packages/core/sdk/events.ts +78 -7
  16. package/packages/core/src/checker.ts +470 -2
  17. package/packages/core/src/cli.ts +13 -0
  18. package/packages/core/src/contract.ts +3 -1
  19. package/packages/core/src/devhost.ts +30 -1
  20. package/packages/core/src/devhost_journal.mjs +10 -8
  21. package/packages/core/src/diagnostics.ts +99 -8
  22. package/packages/core/src/frontend.ts +6 -0
  23. package/packages/core/src/infer.ts +24 -0
  24. package/skill-data/automation/SKILL.md +1 -1
  25. package/skill-data/native-ui/SKILL.md +18 -12
  26. package/skill-data/ts-core/SKILL.md +54 -21
  27. package/skill-data/ts-services/SKILL.md +4 -4
  28. package/skill-data/ts-services/references/service-surface.md +2 -1
  29. package/skill-data/zig/SKILL.md +1 -1
  30. package/src/app_runner/root.zig +122 -6
  31. package/src/app_runner/ts_core_main.zig +9 -4
  32. package/src/app_runner/ts_core_mobile.zig +241 -0
  33. package/src/app_runner/window_placement.zig +63 -0
  34. package/src/automation/protocol.zig +5 -1
  35. package/src/automation/snapshot.zig +8 -6
  36. package/src/embed/app_exports.zig +3 -1
  37. package/src/embed/conversions.zig +1 -0
  38. package/src/embed/host.zig +10 -3
  39. package/src/embed/root.zig +2 -0
  40. package/src/embed/tests.zig +41 -1
  41. package/src/embed/types.zig +2 -0
  42. package/src/embed/ui_host.zig +94 -4
  43. package/src/platform/android/NativeSdkActivity.java +49 -4
  44. package/src/platform/android/android_host.c +3 -3
  45. package/src/platform/android/native_sdk_app.h +1 -1
  46. package/src/platform/ios/apple_image_fit.h +38 -0
  47. package/src/platform/ios/files.zig +1 -0
  48. package/src/platform/ios/native_sdk_app.h +1 -1
  49. package/src/platform/ios/uikit_host.m +28 -5
  50. package/src/platform/linux/cef_host.cpp +17 -3
  51. package/src/platform/linux/gtk_host.c +243 -15
  52. package/src/platform/linux/gtk_host.h +5 -4
  53. package/src/platform/linux/root.zig +91 -11
  54. package/src/platform/macos/appkit_host.h +18 -11
  55. package/src/platform/macos/appkit_host.m +402 -128
  56. package/src/platform/macos/cef_host.mm +342 -122
  57. package/src/platform/macos/image_fit_test.m +44 -0
  58. package/src/platform/macos/root.zig +231 -39
  59. package/src/platform/null_platform.zig +251 -54
  60. package/src/platform/null_platform_tests.zig +97 -4
  61. package/src/platform/root.zig +12 -0
  62. package/src/platform/types.zig +174 -35
  63. package/src/platform/windows/root.zig +42 -13
  64. package/src/platform/windows/webview2_host.cpp +72 -11
  65. package/src/primitives/app_manifest/root.zig +3 -0
  66. package/src/primitives/app_manifest/tests.zig +24 -0
  67. package/src/primitives/app_manifest/types.zig +13 -0
  68. package/src/primitives/app_manifest/validation.zig +24 -0
  69. package/src/primitives/canvas/a11y_audit.zig +9 -7
  70. package/src/primitives/canvas/a11y_audit_tests.zig +24 -0
  71. package/src/primitives/canvas/events.zig +50 -0
  72. package/src/primitives/canvas/layout_audit.zig +6 -6
  73. package/src/primitives/canvas/markdown.zig +4 -0
  74. package/src/primitives/canvas/markdown_tests.zig +1 -0
  75. package/src/primitives/canvas/png.zig +138 -0
  76. package/src/primitives/canvas/root.zig +13 -2
  77. package/src/primitives/canvas/text_span_tests.zig +5 -3
  78. package/src/primitives/canvas/text_spans.zig +2 -0
  79. package/src/primitives/canvas/text_tests.zig +20 -0
  80. package/src/primitives/canvas/ui.zig +55 -2
  81. package/src/primitives/canvas/ui_markup.zig +40 -13
  82. package/src/primitives/canvas/ui_markup_binary.zig +8 -6
  83. package/src/primitives/canvas/ui_markup_binary_tests.zig +14 -4
  84. package/src/primitives/canvas/ui_markup_compiled.zig +5 -1
  85. package/src/primitives/canvas/ui_markup_compiled_tests.zig +52 -0
  86. package/src/primitives/canvas/ui_markup_tests.zig +11 -2
  87. package/src/primitives/canvas/ui_markup_view.zig +8 -2
  88. package/src/primitives/canvas/ui_markup_view_tests.zig +49 -4
  89. package/src/primitives/canvas/ui_schema.zig +17 -13
  90. package/src/primitives/canvas/ui_tests.zig +47 -0
  91. package/src/primitives/canvas/widget_access.zig +3 -3
  92. package/src/primitives/canvas/widget_anchored_tests.zig +106 -0
  93. package/src/primitives/canvas/widget_builtin_tests.zig +580 -32
  94. package/src/primitives/canvas/widget_invalidation.zig +33 -6
  95. package/src/primitives/canvas/widget_layout.zig +333 -126
  96. package/src/primitives/canvas/widget_layout_tests.zig +169 -0
  97. package/src/primitives/canvas/widget_metrics.zig +7 -8
  98. package/src/primitives/canvas/widget_render.zig +76 -44
  99. package/src/primitives/canvas/widget_render_controls.zig +110 -32
  100. package/src/primitives/canvas/widget_render_style.zig +58 -18
  101. package/src/primitives/canvas/widget_render_surfaces.zig +45 -14
  102. package/src/primitives/canvas/widget_routing.zig +40 -34
  103. package/src/primitives/canvas/widget_runtime.zig +11 -2
  104. package/src/primitives/canvas/widget_runtime_tests.zig +10 -14
  105. package/src/primitives/canvas/widget_semantics.zig +8 -3
  106. package/src/primitives/canvas/widget_semantics_tests.zig +6 -2
  107. package/src/primitives/canvas/widget_tree.zig +99 -5
  108. package/src/primitives/canvas/widgets.zig +20 -7
  109. package/src/root.zig +10 -0
  110. package/src/runtime/api.zig +14 -0
  111. package/src/runtime/automation_commands.zig +35 -2
  112. package/src/runtime/automation_snapshot.zig +32 -24
  113. package/src/runtime/automation_widget_dispatch.zig +48 -6
  114. package/src/runtime/bridge_permission_tests.zig +35 -1
  115. package/src/runtime/bridge_responses.zig +1 -1
  116. package/src/runtime/builtin_bridge.zig +16 -3
  117. package/src/runtime/canvas_frame_packet_tests.zig +22 -13
  118. package/src/runtime/canvas_image_tests.zig +146 -2
  119. package/src/runtime/canvas_images.zig +35 -16
  120. package/src/runtime/canvas_limits.zig +13 -3
  121. package/src/runtime/canvas_widget_accessibility_tests.zig +279 -4
  122. package/src/runtime/canvas_widget_anchored_tests.zig +54 -0
  123. package/src/runtime/canvas_widget_control_tests.zig +31 -1
  124. package/src/runtime/canvas_widget_events.zig +151 -26
  125. package/src/runtime/canvas_widget_floating_tests.zig +48 -0
  126. package/src/runtime/canvas_widget_runtime.zig +322 -102
  127. package/src/runtime/canvas_widget_scroll_driver_tests.zig +34 -0
  128. package/src/runtime/canvas_widget_scroll_drivers.zig +12 -10
  129. package/src/runtime/canvas_widget_scroll_tests.zig +193 -2
  130. package/src/runtime/canvas_widget_semantics_tests.zig +337 -3
  131. package/src/runtime/canvas_widget_split_tree_tests.zig +55 -0
  132. package/src/runtime/canvas_widget_state.zig +33 -7
  133. package/src/runtime/core.zig +28 -6
  134. package/src/runtime/effects.zig +1337 -49
  135. package/src/runtime/effects_file_tests.zig +587 -0
  136. package/src/runtime/effects_image_tests.zig +91 -0
  137. package/src/runtime/effects_notification_tests.zig +11 -0
  138. package/src/runtime/file_access.zig +400 -0
  139. package/src/runtime/file_effect_crash_helper.zig +28 -0
  140. package/src/runtime/file_effect_crash_tests.zig +37 -0
  141. package/src/runtime/flow.zig +21 -9
  142. package/src/runtime/gpu_surface_events.zig +25 -2
  143. package/src/runtime/native_command_event_tests.zig +44 -2
  144. package/src/runtime/pty.zig +5 -2
  145. package/src/runtime/root.zig +7 -0
  146. package/src/runtime/session_blobs.zig +4 -1
  147. package/src/runtime/session_journal.zig +56 -5
  148. package/src/runtime/session_record.zig +38 -0
  149. package/src/runtime/session_replay.zig +110 -15
  150. package/src/runtime/session_tests.zig +192 -4
  151. package/src/runtime/shell_layout_tests.zig +12 -0
  152. package/src/runtime/state.zig +10 -0
  153. package/src/runtime/system_services.zig +129 -36
  154. package/src/runtime/ts_core_host.zig +281 -11
  155. package/src/runtime/ts_core_host_tests.zig +142 -1
  156. package/src/runtime/ts_ui_app.zig +461 -8
  157. package/src/runtime/ui_app.zig +330 -112
  158. package/src/runtime/ui_app_tests.zig +251 -25
  159. package/src/runtime/ui_app_window_tests.zig +74 -8
  160. package/src/runtime/validation.zig +20 -0
  161. package/src/runtime/view.zig +3 -0
  162. package/src/runtime/view_widget_control.zig +18 -0
  163. package/src/runtime/view_widget_scroll.zig +112 -18
  164. package/src/runtime/view_widget_tree.zig +110 -13
  165. package/src/runtime/widget_bridge.zig +2 -0
  166. package/src/runtime/window_command_bridge_tests.zig +86 -0
  167. package/src/runtime/window_storage.zig +16 -1
  168. package/src/runtime/window_views.zig +1 -0
  169. package/src/tooling/ios.zig +3 -0
  170. package/src/tooling/manifest.zig +90 -2
  171. package/src/tooling/package.zig +67 -2
  172. package/src/tooling/raw_manifest.zig +10 -0
  173. package/src/tooling/templates.zig +156 -18
  174. package/src/tooling/ts_core.zig +83 -0
  175. package/src/tooling/web_engine.zig +1 -1
  176. package/tools/corewire/emit.zig +3 -3
  177. package/tools/corewire/emit_facade.zig +65 -5
  178. package/tools/corewire/emit_profile.zig +2 -2
  179. package/tools/corewire/emit_service.zig +2 -2
  180. package/tools/corewire/service_contract.zig +4 -4
  181. package/tools/corewire/sidecar.zig +4 -4
package/build/app.zig CHANGED
@@ -75,6 +75,156 @@ fn appFileExists(b: *std.Build, app_root: []const u8, sub_path: []const u8) bool
75
75
  return true;
76
76
  }
77
77
 
78
+ const TsWindowView = struct {
79
+ label: []const u8,
80
+ source_path: []const u8,
81
+ staged_path: []const u8,
82
+ };
83
+
84
+ const TsWindowSource = struct {
85
+ set_path: []const u8,
86
+ source_path: []const u8,
87
+ staged_path: []const u8,
88
+ };
89
+
90
+ const TsWindowViews = struct {
91
+ views: []const TsWindowView,
92
+ sources: []const TsWindowSource,
93
+ };
94
+
95
+ /// Default TypeScript secondary-window views are statically discovered under
96
+ /// `src/windows/`: `settings.native` serves descriptor label `settings`.
97
+ /// Direct files form the generated launcher's closed, comptime-compiled view
98
+ /// set while nested `.native` files are the shared import source set and
99
+ /// `windows(model)` owns dynamic liveness.
100
+ fn collectTsWindowViews(b: *std.Build, app_root: []const u8) TsWindowViews {
101
+ const windows_path = appPath(b, app_root, "src/windows");
102
+ var dir = b.build_root.handle.openDir(b.graph.io, windows_path, .{ .iterate = true }) catch return .{ .views = &.{}, .sources = &.{} };
103
+ defer dir.close(b.graph.io);
104
+ var walker = dir.walk(b.allocator) catch return .{ .views = &.{}, .sources = &.{} };
105
+ defer walker.deinit();
106
+ var views: std.ArrayList(TsWindowView) = .empty;
107
+ var sources: std.ArrayList(TsWindowSource) = .empty;
108
+ while (walker.next(b.graph.io) catch null) |entry| {
109
+ if (entry.kind != .file or !std.mem.endsWith(u8, entry.path, ".native")) continue;
110
+ const normalized_path = b.dupe(entry.path);
111
+ for (normalized_path) |*char| {
112
+ if (char.* == '\\') char.* = '/';
113
+ }
114
+ sources.append(b.allocator, .{
115
+ .set_path = normalized_path,
116
+ .source_path = b.fmt("src/windows/{s}", .{normalized_path}),
117
+ .staged_path = b.fmt("windows/{s}", .{normalized_path}),
118
+ }) catch @panic("OOM");
119
+ // Direct children are label-addressed window roots. Nested files
120
+ // are component sources those roots may import transitively.
121
+ if (std.mem.indexOfScalar(u8, entry.path, '/') != null or std.mem.indexOfScalar(u8, entry.path, '\\') != null) continue;
122
+ const label = entry.path[0 .. entry.path.len - ".native".len];
123
+ if (label.len == 0 or label.len > 64 or std.mem.eql(u8, label, ".") or std.mem.eql(u8, label, "..")) {
124
+ @panic("\ninvalid TypeScript secondary-window view filename: use src/windows/<label>.native with a non-empty label of at most 64 bytes\n");
125
+ }
126
+ for (label) |ch| {
127
+ if (ch == 0 or ch == '/' or ch == '\\') {
128
+ @panic("\ninvalid TypeScript secondary-window view filename: the filename stem must be a valid window label\n");
129
+ }
130
+ }
131
+ views.append(b.allocator, .{
132
+ .label = b.dupe(label),
133
+ .source_path = b.fmt("src/windows/{s}", .{entry.path}),
134
+ .staged_path = b.fmt("windows/{s}", .{entry.path}),
135
+ }) catch @panic("OOM");
136
+ }
137
+ const less = struct {
138
+ fn than(_: void, a: TsWindowView, z: TsWindowView) bool {
139
+ return std.mem.order(u8, a.label, z.label) == .lt;
140
+ }
141
+ }.than;
142
+ std.mem.sort(TsWindowView, views.items, {}, less);
143
+ const source_less = struct {
144
+ fn than(_: void, a: TsWindowSource, z: TsWindowSource) bool {
145
+ return std.mem.order(u8, a.set_path, z.set_path) == .lt;
146
+ }
147
+ }.than;
148
+ std.mem.sort(TsWindowSource, sources.items, {}, source_less);
149
+ return .{ .views = views.items, .sources = sources.items };
150
+ }
151
+
152
+ fn tsWindowRegistrySource(b: *std.Build, registry: TsWindowViews) []const u8 {
153
+ const views = registry.views;
154
+ var out: std.ArrayList(u8) = .empty;
155
+ out.appendSlice(b.allocator,
156
+ \\//! Generated by build/app.zig from src/windows/<label>.native.
157
+ \\const std = @import("std");
158
+ \\const native_sdk = @import("native_sdk");
159
+ \\const core = @import("core.zig");
160
+ \\const canvas = native_sdk.canvas;
161
+ \\const Adapter = native_sdk.TsUiApp(core);
162
+ \\const App = Adapter.App;
163
+ \\
164
+ ) catch @panic("OOM");
165
+ if (registry.sources.len > 0) {
166
+ out.appendSlice(b.allocator,
167
+ \\const window_sources = [_]canvas.ui_markup.SourceFile{
168
+ \\
169
+ ) catch @panic("OOM");
170
+ for (registry.sources) |source| {
171
+ const line = std.fmt.allocPrint(
172
+ b.allocator,
173
+ " .{{ .path = \"{f}\", .source = @embedFile(\"{f}\") }},\n",
174
+ .{ std.zig.fmtString(source.set_path), std.zig.fmtString(source.staged_path) },
175
+ ) catch @panic("OOM");
176
+ out.appendSlice(b.allocator, line) catch @panic("OOM");
177
+ }
178
+ out.appendSlice(b.allocator, "};\n") catch @panic("OOM");
179
+ }
180
+ for (views, 0..) |view, index| {
181
+ const line = std.fmt.allocPrint(
182
+ b.allocator,
183
+ "const WindowView{d} = canvas.CompiledMarkupImports(core.Model, core.Msg, \"{f}\", &window_sources);\n",
184
+ .{ index, std.zig.fmtString(std.fs.path.basename(view.staged_path)) },
185
+ ) catch @panic("OOM");
186
+ out.appendSlice(b.allocator, line) catch @panic("OOM");
187
+ }
188
+ if (views.len == 0) {
189
+ out.appendSlice(b.allocator,
190
+ \\pub fn build(_: *App.Ui, _: *const core.Model, _: []const u8) App.Ui.Node {
191
+ \\ @compileError("this TypeScript core exports windows(model), but the app has no src/windows/<label>.native views");
192
+ \\}
193
+ \\pub const fragments = [_]canvas.MarkupFragment{};
194
+ \\
195
+ ) catch @panic("OOM");
196
+ return out.items;
197
+ }
198
+ out.appendSlice(b.allocator,
199
+ \\pub fn build(ui: *App.Ui, model: *const core.Model, label: []const u8) App.Ui.Node {
200
+ \\
201
+ ) catch @panic("OOM");
202
+ for (views, 0..) |view, index| {
203
+ const line = std.fmt.allocPrint(
204
+ b.allocator,
205
+ " if (std.mem.eql(u8, label, \"{f}\")) return WindowView{d}.build(ui, model);\n",
206
+ .{ std.zig.fmtString(view.label), index },
207
+ ) catch @panic("OOM");
208
+ out.appendSlice(b.allocator, line) catch @panic("OOM");
209
+ }
210
+ out.appendSlice(b.allocator,
211
+ \\ @panic("windows(model) declared a label with no src/windows/<label>.native view");
212
+ \\}
213
+ \\pub const fragments = [_]canvas.MarkupFragment{
214
+ \\
215
+ ) catch @panic("OOM");
216
+ for (views, 0..) |view, index| {
217
+ const line = std.fmt.allocPrint(
218
+ b.allocator,
219
+ " WindowView{d}.fragment(\"{f}\"),\n",
220
+ .{ index, std.zig.fmtString(view.source_path) },
221
+ ) catch @panic("OOM");
222
+ out.appendSlice(b.allocator, line) catch @panic("OOM");
223
+ }
224
+ out.appendSlice(b.allocator, "};\n") catch @panic("OOM");
225
+ return out.items;
226
+ }
227
+
78
228
  /// How a TypeScript core compiles: through the external core compiler,
79
229
  /// always. The frontend checks the core and emits its contract sidecar,
80
230
  /// corewire projects the compile entry and profile, the exact-pinned
@@ -96,6 +246,10 @@ const core_compiler_teaching =
96
246
  /// and test modules.
97
247
  const TsCoreStage = struct {
98
248
  main_root: std.Build.LazyPath,
249
+ /// The staged mobile wiring (ts_core_mobile.zig beside the same
250
+ /// mirror/markup/registry files): the embed static library's `app`
251
+ /// module roots here on iOS/Android targets.
252
+ mobile_root: std.Build.LazyPath,
99
253
  /// The compiled-core archive: the app module links it (with libc,
100
254
  /// for the toolchain's runtime) beside the staged mirror.
101
255
  archive: std.Build.LazyPath,
@@ -125,7 +279,11 @@ const ServiceCarrier = enum { none, child, in_process };
125
279
  /// this host/target pairing. Native desktop targets use their host toolchain,
126
280
  /// including native Windows/MSVC. Cross-Windows builds use Zig's bundled GNU
127
281
  /// sysroot; an MSVC cross target has no CRT headers or libraries to compile
128
- /// the ScriptC runtime against.
282
+ /// the ScriptC runtime against. Mobile targets are aarch64 only and
283
+ /// archive-only (library mode — the app links the archive; no standalone
284
+ /// executable exists there): iOS device/simulator archives build on a macOS
285
+ /// host against the selected Apple SDK, Android archives build on any
286
+ /// desktop host against a discovered NDK sysroot.
129
287
  pub fn scriptcCompileSupported(host: std.Target, target: std.Build.ResolvedTarget) bool {
130
288
  const desktop_host = switch (host.os.tag) {
131
289
  .macos, .linux, .windows => true,
@@ -134,9 +292,10 @@ pub fn scriptcCompileSupported(host: std.Target, target: std.Build.ResolvedTarge
134
292
  if (!desktop_host) return false;
135
293
  const cross = scriptcTargetIsCross(host, target);
136
294
  return switch (target.result.os.tag) {
137
- .linux => true,
295
+ .linux => if (target.result.abi.isAndroid()) target.result.cpu.arch == .aarch64 else true,
138
296
  .windows => !cross or target.result.abi == .gnu,
139
297
  .macos => host.os.tag == .macos,
298
+ .ios => host.os.tag == .macos and target.result.cpu.arch == .aarch64,
140
299
  else => false,
141
300
  };
142
301
  }
@@ -144,16 +303,18 @@ pub fn scriptcCompileSupported(host: std.Target, target: std.Build.ResolvedTarge
144
303
  /// Whether the pinned service compiler can build the in-process carrier's
145
304
  /// archive (runtime-localized, thread-instanced) on this build host for
146
305
  /// this target. Its object localizers are deliberately architecture-aware:
147
- /// native Linux uses host binutils, cross-ELF accepts x86_64/aarch64, COFF
148
- /// accepts x86_64 (GNU when cross-compiled; the host ABI when native), and
149
- /// Mach-O needs a macOS host (Apple linking rides the host toolchain's SDK).
306
+ /// native Linux uses host binutils, cross-ELF accepts x86_64/aarch64
307
+ /// (Android's aarch64 archives ride this lane), COFF accepts x86_64 (GNU
308
+ /// when cross-compiled; the host ABI when native), and Mach-O — macOS, iOS
309
+ /// device, and iOS simulator — needs a macOS host (Apple linking rides the
310
+ /// host toolchain's SDK).
150
311
  pub fn serviceArchiveSupported(host: std.Target, target: std.Build.ResolvedTarget) bool {
151
312
  if (!scriptcCompileSupported(host, target)) return false;
152
313
  const cross = scriptcTargetIsCross(host, target);
153
314
  return switch (target.result.os.tag) {
154
315
  .linux => !cross or target.result.cpu.arch == .x86_64 or target.result.cpu.arch == .aarch64,
155
316
  .windows => target.result.cpu.arch == .x86_64,
156
- .macos => host.os.tag == .macos,
317
+ .macos, .ios => host.os.tag == .macos,
157
318
  else => false,
158
319
  };
159
320
  }
@@ -216,9 +377,16 @@ pub fn panicUnsupportedScriptcTarget(b: *std.Build, host: std.Target, target: st
216
377
  .{ target.result.cpu.arch, target.result.cpu.arch },
217
378
  ));
218
379
  }
380
+ if (target.result.os.tag == .ios and host.os.tag != .macos) {
381
+ @panic(
382
+ "\nTypeScript iOS builds run on a macOS build host only: the Apple SDK sysroot" ++
383
+ " and Mach-O symbol localization live there.\nBuild iOS apps on a Mac.\n",
384
+ );
385
+ }
219
386
  @panic(
220
- "\nTypeScript desktop builds support native host targets, Linux and Windows GNU" ++
221
- " cross targets from macOS/Linux/Windows, and macOS targets from macOS." ++
387
+ "\nTypeScript builds support native host targets, Linux and Windows GNU cross" ++
388
+ " targets from macOS/Linux/Windows, macOS targets from macOS, and the mobile" ++
389
+ " targets aarch64 iOS/iOS-simulator (from macOS) and aarch64 Android." ++
222
390
  "\nChoose a supported target/host pairing.\n",
223
391
  );
224
392
  }
@@ -232,13 +400,27 @@ fn resolveServiceCarrier(
232
400
  if (!has_services) return .none;
233
401
  const host = b.graph.host.result;
234
402
  const supported = serviceArchiveSupported(host, target);
403
+ // Mobile has no child processes, so the in-process pool is the only
404
+ // carrier there: auto resolves to it, and an explicit "child" is a
405
+ // stated impossibility, taught rather than quietly rewritten.
406
+ if (target.result.os.tag == .ios or target.result.abi.isAndroid()) {
407
+ return switch (choice) {
408
+ .auto, .in_process => if (supported) .in_process else panicUnsupportedScriptcTarget(b, host, target),
409
+ .child => @panic(
410
+ "\nservice_carrier = \"child\" is unavailable on mobile targets: iOS and Android" ++
411
+ " apps cannot spawn a sibling service process, so src/services operations run" ++
412
+ " on the in-process pool there.\nUse \"auto\" or \"in_process\" (desktop" ++
413
+ " builds of the same app keep the child carrier under auto).\n",
414
+ ),
415
+ };
416
+ }
235
417
  const carrier: ServiceCarrier = switch (choice) {
236
418
  .auto, .child => .child,
237
419
  .in_process => if (supported) .in_process else @panic(
238
420
  "\nservice_carrier = \"in_process\" requires a target the pinned service compiler" ++
239
421
  " can produce a runtime-localized archive for: native Linux, cross-Linux" ++
240
422
  " x86_64/aarch64, native Windows x86_64, cross-Windows x86_64 GNU," ++
241
- " or macOS from a macOS build host." ++
423
+ " macOS from a macOS build host, or a mobile target." ++
242
424
  "\nUse \"child\" (or drop the setting — auto selects the child carrier)" ++
243
425
  " for this target.\n",
244
426
  ),
@@ -574,6 +756,7 @@ fn tsCoreStage(
574
756
  service_pool_workers: ?u8,
575
757
  ) TsCoreStage {
576
758
  const node = tsCorePreflight(b, dep, app_root);
759
+ const window_views = collectTsWindowViews(b, app_root);
577
760
  const has_services = appHasServiceFiles(b, app_root);
578
761
  if (!scriptcCompileSupported(b.graph.host.result, target)) {
579
762
  panicUnsupportedScriptcTarget(b, b.graph.host.result, target);
@@ -659,6 +842,10 @@ fn tsCoreStage(
659
842
  if (relational_capability) check.addArgs(&.{ "--capability", "sqlite" });
660
843
  if (credentials_capability) check.addArgs(&.{ "--capability", "credentials" });
661
844
  if (credentials_permission) check.addArgs(&.{ "--permission", "credentials" });
845
+ // Activate the cross-tier registry check even when discovery found no
846
+ // roots: the empty set must reject a core that declares a window.
847
+ check.addArg("--window-views");
848
+ for (window_views.views) |view| check.addArgs(&.{ "--window-view", view.label });
662
849
  if (relational_capability) {
663
850
  check.addArg("--sdk-core");
664
851
  check.addFileArg(checked_sdk_core);
@@ -717,7 +904,7 @@ fn tsCoreStage(
717
904
 
718
905
  // Ordinary service TypeScript is staged without core-subset rewrites.
719
906
  // The one service-boundary lowering turns NS1067's `{ kind, message }`
720
- // throw into the tagged Error shape scriptc 0.0.28 can catch from an
907
+ // throw into the tagged Error shape the pinned compiler can catch from an
721
908
  // imported op; no deterministic profile fences participate here.
722
909
  const service_stage_run = b.addSystemCommand(&.{node});
723
910
  service_stage_run.addFileArg(dep.path("packages/core/scripts/stage_external_services.mjs"));
@@ -770,6 +957,7 @@ fn tsCoreStage(
770
957
  "--zig-exe",
771
958
  b.graph.zig_exe,
772
959
  });
960
+ addScriptcAndroidNdk(b, service_compile, target);
773
961
  if (b.graph.environ_map.get("NATIVE_SDK_CORE_COMPILER")) |override| {
774
962
  service_compile.addArgs(&.{ "--compiler", override });
775
963
  } else {
@@ -826,6 +1014,7 @@ fn tsCoreStage(
826
1014
  "--zig-exe",
827
1015
  b.graph.zig_exe,
828
1016
  });
1017
+ addScriptcAndroidNdk(b, compile, target);
829
1018
  if (b.graph.environ_map.get("NATIVE_SDK_CORE_COMPILER")) |override| {
830
1019
  // The development override: point at any toolchain command; the
831
1020
  // driver still refuses a release other than the SDK's pin.
@@ -863,9 +1052,18 @@ fn tsCoreStage(
863
1052
  , .{ service_carrier, service_pool_workers }));
864
1053
  _ = staged.addCopyFile(migrations_zig, "migrations.zig");
865
1054
  _ = staged.addCopyFile(b.path(appPath(b, app_root, "src/app.native")), "app.native");
1055
+ for (window_views.sources) |source| {
1056
+ _ = staged.addCopyFile(b.path(appPath(b, app_root, source.source_path)), source.staged_path);
1057
+ }
1058
+ _ = staged.add("window_views.zig", tsWindowRegistrySource(b, window_views));
866
1059
  const main_root = staged.addCopyFile(dep.path("src/app_runner/ts_core_main.zig"), "main.zig");
1060
+ // The mobile wiring stages beside the desktop entry: same mirror, same
1061
+ // registry, same carrier constant — only the shell differs (the embed
1062
+ // host's AppDef contract instead of a process `main`).
1063
+ const mobile_root = staged.addCopyFile(dep.path("src/app_runner/ts_core_mobile.zig"), "mobile.zig");
867
1064
  return .{
868
1065
  .main_root = main_root,
1066
+ .mobile_root = mobile_root,
869
1067
  .archive = archive,
870
1068
  .service_exe = service_exe,
871
1069
  .service_archive = service_archive,
@@ -1052,8 +1250,33 @@ pub const MobileLibOptions = struct {
1052
1250
  credentials_capability: bool = false,
1053
1251
  /// Grant those effects access to the registered OS credential service.
1054
1252
  credentials_permission: bool = false,
1253
+ /// Grant raw file effects access outside the OS-owned app data root.
1254
+ filesystem_permission: bool = false,
1055
1255
  /// Stable app identity used as the Keychain/Keystore service namespace.
1056
1256
  credentials_service: []const u8 = "dev.native_sdk.app",
1257
+ /// Frozen registered-image pixel budget. Standard app builds infer it
1258
+ /// from app.zon; low-level embedders default to the SDK's 1 MiB tier.
1259
+ max_image_pixel_bytes: usize = 1024 * 1024,
1260
+ /// A TypeScript core's staged mobile wiring: set by `addAppArtifacts`
1261
+ /// when the tree carries src/core.ts. The `app` module roots at the
1262
+ /// staged mobile entry instead of `main`, and the compiled core (and
1263
+ /// in-process service) archives merge into the embed static library —
1264
+ /// the host tiers keep linking exactly one archive.
1265
+ ts_core: ?MobileTsCore = null,
1266
+ };
1267
+
1268
+ /// The TypeScript pieces a mobile embed library consumes (see
1269
+ /// `MobileLibOptions.ts_core`).
1270
+ pub const MobileTsCore = struct {
1271
+ /// The staged mobile wiring (mobile.zig beside the generated mirror).
1272
+ main_root: std.Build.LazyPath,
1273
+ /// The compiled-core archive; merged into the embed library.
1274
+ archive: std.Build.LazyPath,
1275
+ /// The in-process service archive, when src/services exists.
1276
+ service_archive: ?std.Build.LazyPath,
1277
+ /// The app.zon module the mobile wiring reads scene chrome, identity,
1278
+ /// and theme from (`app_manifest_zon`).
1279
+ manifest_mod: *std.Build.Module,
1057
1280
  };
1058
1281
 
1059
1282
  /// Mobile counterpart of `addApp`: produce the embed static library
@@ -1096,16 +1319,41 @@ fn addMobileLibWithTarget(b: *std.Build, dep: *std.Build.Dependency, target: std
1096
1319
  mobile_options.addOption(bool, "relational_capability", options.relational_capability);
1097
1320
  mobile_options.addOption(bool, "credentials_capability", options.credentials_capability);
1098
1321
  mobile_options.addOption(bool, "credentials_permission", options.credentials_permission);
1322
+ mobile_options.addOption(bool, "filesystem_permission", options.filesystem_permission);
1099
1323
  mobile_options.addOption([]const u8, "credentials_service", options.credentials_service);
1324
+ mobile_options.addOption(usize, "max_image_pixel_bytes", options.max_image_pixel_bytes);
1100
1325
  exports_mod.addImport("mobile_build_options", mobile_options.createModule());
1101
1326
  const migration_path = options.relational_migrations orelse dep.path("src/app_runner/no_migrations.zig");
1102
1327
  const migration_mod = b.createModule(.{ .root_source_file = migration_path, .target = target, .optimize = optimize });
1103
1328
  migration_mod.addImport("native_sdk", native_sdk_mod);
1104
1329
  exports_mod.addImport("relational_migrations", migration_mod);
1105
- const app_mod = localModule(b, target, optimize, options.main);
1330
+ // A TypeScript core's app module roots at the staged mobile wiring;
1331
+ // a Zig core's at the app's own mobile entry. Either way the embed
1332
+ // host sees the same AppDef contract (Model/Msg/initModel/
1333
+ // mobileOptions).
1334
+ const app_mod = if (options.ts_core) |ts| ts_app: {
1335
+ const mod = b.createModule(.{
1336
+ .root_source_file = ts.main_root,
1337
+ .target = target,
1338
+ .optimize = optimize,
1339
+ });
1340
+ mod.addImport("app_manifest_zon", ts.manifest_mod);
1341
+ break :ts_app mod;
1342
+ } else localModule(b, target, optimize, options.main);
1106
1343
  app_mod.addImport("native_sdk", native_sdk_mod);
1107
1344
  exports_mod.addImport("app", app_mod);
1108
1345
  }
1346
+ if (options.ts_core) |ts| {
1347
+ // The compiled TypeScript archives merge into the embed static
1348
+ // library (Zig's static-lib emission bundles archive inputs), so
1349
+ // the iOS/Android host tiers keep linking the one archive they
1350
+ // already stage. The toolchain's runtime needs libc; the host
1351
+ // link supplies it (plus -lm/-ldl on Android, which the Android
1352
+ // host link already passes).
1353
+ exports_mod.link_libc = true;
1354
+ exports_mod.addObjectFile(ts.archive);
1355
+ if (ts.service_archive) |service_archive| exports_mod.addObjectFile(service_archive);
1356
+ }
1109
1357
  if (options.store_capability or options.relational_capability) {
1110
1358
  exports_mod.addIncludePath(dep.path("third_party/sqlite"));
1111
1359
  exports_mod.addCSourceFile(.{
@@ -1128,10 +1376,39 @@ fn addMobileLibWithTarget(b: *std.Build, dep: *std.Build.Dependency, target: std
1128
1376
  // Intel simulators). Force LLVM there; Release already uses it.
1129
1377
  .use_llvm = useLlvmWorkaround(target),
1130
1378
  });
1131
- b.installArtifact(lib);
1132
1379
 
1133
1380
  const lib_step = b.step("lib", "Build the mobile embed static library");
1134
- lib_step.dependOn(&b.addInstallArtifact(lib, .{}).step);
1381
+ if (options.ts_core != null and target.result.abi.isAndroid()) {
1382
+ // Zig's ELF static-library emission stores the compiled TypeScript
1383
+ // archives as nested members instead of merging their objects (the
1384
+ // Mach-O emission merges), and the NDK's -shared host link would
1385
+ // skip those blobs with only a warning. Flatten to one plain
1386
+ // object archive so the Android host tier keeps linking exactly
1387
+ // the archive it already stages.
1388
+ const merged = mergeMobileArchive(b, dep, lib, options.name);
1389
+ const lib_name = b.fmt("lib{s}.a", .{options.name});
1390
+ b.getInstallStep().dependOn(&b.addInstallFileWithDir(merged, .lib, lib_name).step);
1391
+ lib_step.dependOn(&b.addInstallFileWithDir(merged, .lib, lib_name).step);
1392
+ } else {
1393
+ b.installArtifact(lib);
1394
+ lib_step.dependOn(&b.addInstallArtifact(lib, .{}).step);
1395
+ }
1396
+ }
1397
+
1398
+ /// Flatten an Android embed library whose members include the compiled
1399
+ /// TypeScript archives (see the call site above). Runs under node like the
1400
+ /// rest of the TypeScript lane's drivers.
1401
+ fn mergeMobileArchive(b: *std.Build, dep: *std.Build.Dependency, lib: *std.Build.Step.Compile, name: []const u8) std.Build.LazyPath {
1402
+ const node = b.findProgram(&.{"node"}, &.{}) catch
1403
+ @panic("\nmerging the mobile TypeScript archives needs node on PATH (the TypeScript core lane already requires it).\n");
1404
+ const merge = b.addSystemCommand(&.{node});
1405
+ merge.addFileArg(dep.path("packages/core/scripts/merge_static_archives.mjs"));
1406
+ merge.addArgs(&.{ "--zig", b.graph.zig_exe, "--format", "gnu" });
1407
+ merge.addArg("--out");
1408
+ const merged = merge.addOutputFileArg(b.fmt("lib{s}.a", .{name}));
1409
+ merge.addArg("--in");
1410
+ merge.addFileArg(lib.getEmittedBin());
1411
+ return merged;
1135
1412
  }
1136
1413
 
1137
1414
  /// The pieces `addApp` wires, for callers that extend the standard app
@@ -1182,14 +1459,6 @@ pub fn addAppArtifacts(b: *std.Build, dep: *std.Build.Dependency, app_options: A
1182
1459
  " a Zig core.\nDrop the flag or port the core to TypeScript.\n");
1183
1460
  }
1184
1461
  }
1185
- // Mobile targets are taught BEFORE lane selection: TypeScript cores
1186
- // are desktop-only until the external core toolchain grows mobile
1187
- // targets; Zig/markup cores stay fully supported on mobile.
1188
- if (core_tree == .ts and (target.result.os.tag == .ios or target.result.abi.isAndroid())) {
1189
- @panic("\nTypeScript app cores are desktop-only today: the external core compiler does not" ++
1190
- " target mobile yet.\nBuild for a desktop target, or port the core to a Zig" ++
1191
- " `mobileOptions` app — Zig and markup cores are fully supported on mobile.\n");
1192
- }
1193
1462
  // The service-carrier selection: `-Dservice-carrier` overrides app.zon's
1194
1463
  // `.service_carrier`; both default to auto (the child carrier).
1195
1464
  const service_carrier_choice: ServiceCarrierOption = choice: {
@@ -1236,7 +1505,9 @@ pub fn addAppArtifacts(b: *std.Build, dep: *std.Build.Dependency, app_options: A
1236
1505
  // artifact the toolkit-owned iOS host (and any hand-written shim)
1237
1506
  // links, so `native dev|package --target ios` works against every
1238
1507
  // standard app build — generated graph or ejected — with nothing but
1239
- // `-Dtarget`. Desktop targets keep the step absent.
1508
+ // `-Dtarget`. Desktop targets keep the step absent. A TypeScript core
1509
+ // roots the library's app module at the staged mobile wiring and
1510
+ // merges the compiled archives into it.
1240
1511
  if (target.result.os.tag == .ios or target.result.abi.isAndroid()) {
1241
1512
  addMobileLibWithTarget(b, dep, target, optimize, .{
1242
1513
  .name = app_options.name,
@@ -1246,7 +1517,15 @@ pub fn addAppArtifacts(b: *std.Build, dep: *std.Build.Dependency, app_options: A
1246
1517
  .relational_migrations = relational_migrations,
1247
1518
  .credentials_capability = app_config.credentials_capability,
1248
1519
  .credentials_permission = app_config.credentials_permission,
1520
+ .filesystem_permission = app_config.filesystem_permission,
1249
1521
  .credentials_service = app_config.app_id,
1522
+ .max_image_pixel_bytes = app_config.max_image_pixel_bytes,
1523
+ .ts_core = if (ts_stage) |stage| .{
1524
+ .main_root = stage.mobile_root,
1525
+ .archive = stage.archive,
1526
+ .service_archive = stage.service_archive,
1527
+ .manifest_mod = b.createModule(.{ .root_source_file = b.path(appPath(b, app_options.app_root, "app.zon")) }),
1528
+ } else null,
1250
1529
  });
1251
1530
  }
1252
1531
  const platform_option = b.option(PlatformOption, "platform", "Desktop backend: auto, null, macos, linux, windows") orelse .auto;
@@ -1576,19 +1855,23 @@ fn appModule(b: *std.Build, dep: *std.Build.Dependency, target: std.Build.Resolv
1576
1855
  });
1577
1856
  app_mod.link_libc = true;
1578
1857
  }
1579
- addMacosPrivacyInfoPlist(b, app_mod, target, app_config);
1858
+ addMacosInfoPlist(b, app_mod, target, app_config);
1580
1859
  return app_mod;
1581
1860
  }
1582
1861
 
1583
1862
  /// Bare Mach-O executables launched by the dev loop do not have an app
1584
- /// bundle's external Info.plist. macOS still requires capture usage strings
1585
- /// before it will show the consent prompt, so put the permission-derived
1586
- /// fragment in the conventional embedded section too. Packaged apps retain
1587
- /// their richer external plist generated by package.zig.
1588
- fn addMacosPrivacyInfoPlist(b: *std.Build, app_mod: *std.Build.Module, target: std.Build.ResolvedTarget, config: AppManifestBuildConfig) void {
1863
+ /// bundle's external Info.plist. Embed launch policy plus capture usage
1864
+ /// strings in the conventional section so LaunchServices starts accessory
1865
+ /// apps without a transient Dock tile and capture consent can be presented.
1866
+ /// Packaged apps retain their richer external plist generated by package.zig.
1867
+ fn addMacosInfoPlist(b: *std.Build, app_mod: *std.Build.Module, target: std.Build.ResolvedTarget, config: AppManifestBuildConfig) void {
1589
1868
  if (target.result.os.tag != .macos) return;
1590
- if (!config.microphone_permission and !config.system_audio_permission) return;
1869
+ if (config.dock_visible and !config.microphone_permission and !config.system_audio_permission) return;
1591
1870
 
1871
+ const launch_policy = if (!config.dock_visible)
1872
+ " <key>LSUIElement</key>\\n <true/>\\n"
1873
+ else
1874
+ "";
1592
1875
  const microphone = if (config.microphone_permission)
1593
1876
  " <key>NSMicrophoneUsageDescription</key>\\n <string>This app captures microphone audio when you start recording.</string>\\n"
1594
1877
  else
@@ -1599,11 +1882,11 @@ fn addMacosPrivacyInfoPlist(b: *std.Build, app_mod: *std.Build.Module, target: s
1599
1882
  else
1600
1883
  "";
1601
1884
  const source = b.fmt(
1602
- \\#define NATIVE_SDK_INFO_PLIST "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" "<plist version=\"1.0\">\n<dict>\n{s}{s}</dict>\n</plist>\n"
1885
+ \\#define NATIVE_SDK_INFO_PLIST "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" "<plist version=\"1.0\">\n<dict>\n{s}{s}{s}</dict>\n</plist>\n"
1603
1886
  \\__attribute__((used, section("__TEXT,__info_plist")))
1604
1887
  \\static const unsigned char native_sdk_info_plist[sizeof(NATIVE_SDK_INFO_PLIST) - 1] = NATIVE_SDK_INFO_PLIST;
1605
1888
  \\
1606
- , .{ microphone, system_audio });
1889
+ , .{ launch_policy, microphone, system_audio });
1607
1890
  const generated = b.addWriteFiles().add("native_sdk_macos_info_plist.c", source);
1608
1891
  app_mod.addCSourceFile(.{ .file = generated, .flags = &.{} });
1609
1892
  }
@@ -1636,8 +1919,10 @@ const sqlite_c_defines = [_][]const u8{
1636
1919
  /// Zig deliberately supplies no libc headers for Apple/Android cross targets.
1637
1920
  /// Store-capable mobile libraries therefore compile the vendored amalgamation
1638
1921
  /// against the same platform SDK the host tier will use to link the archive.
1639
- /// Desktop targets keep Zig's ordinary libc discovery.
1640
- fn sqliteCFlags(b: *std.Build, target: std.Build.ResolvedTarget) []const []const u8 {
1922
+ /// Desktop targets keep Zig's ordinary libc discovery. Pub because the SDK's
1923
+ /// own build graph compiles the same amalgamation into modules that also
1924
+ /// configure under a mobile -Dtarget (the mobile e2e battery).
1925
+ pub fn sqliteCFlags(b: *std.Build, target: std.Build.ResolvedTarget) []const []const u8 {
1641
1926
  if (target.result.os.tag == .ios) {
1642
1927
  const sysroot = b.sysroot orelse iosSdkPath(b, target.result.abi == .simulator) orelse
1643
1928
  std.debug.panic("a store-capable iOS library needs the Apple SDK; install Xcode or pass --sysroot <iphone SDK path>", .{});
@@ -1689,6 +1974,35 @@ fn iosSdkPath(b: *std.Build, simulator: bool) ?[]const u8 {
1689
1974
  return std.mem.trimEnd(u8, result.stdout, "\r\n");
1690
1975
  }
1691
1976
 
1977
+ /// Thread the Android NDK location into a ScriptC driver invocation the
1978
+ /// way `--zig-exe` threads this build's zig: resolved here, at the one
1979
+ /// boundary that already knows how to discover it, so the compiler's own
1980
+ /// discovery never depends on the ambient environment. A missing NDK stays
1981
+ /// quiet — the driver and compiler own the teaching when an Android
1982
+ /// compile actually needs one.
1983
+ pub fn addScriptcAndroidNdk(b: *std.Build, run: *std.Build.Step.Run, target: std.Build.ResolvedTarget) void {
1984
+ if (!target.result.abi.isAndroid()) return;
1985
+ const ndk_root = androidNdkRootPath(b) orelse return;
1986
+ run.addArgs(&.{ "--android-ndk", ndk_root });
1987
+ }
1988
+
1989
+ /// The NDK's root directory (the directory holding toolchains/llvm):
1990
+ /// ANDROID_NDK_ROOT/ANDROID_NDK_HOME wins, else the newest ndk/<version>
1991
+ /// under the platform SDK location — the same order the compiler's own
1992
+ /// discovery uses, so threading it changes nothing but the authority.
1993
+ fn androidNdkRootPath(b: *std.Build) ?[]const u8 {
1994
+ for ([_][]const u8{ "ANDROID_NDK_ROOT", "ANDROID_NDK_HOME", "ANDROID_NDK_LATEST_HOME" }) |name| {
1995
+ if (b.graph.environ_map.get(name)) |root| {
1996
+ if (root.len > 0 and buildDirExists(b, root)) return root;
1997
+ }
1998
+ }
1999
+ const sdk_root = androidSdkRoot(b) orelse return null;
2000
+ return latestVersionSubdir(b, sdk_root, "ndk") orelse blk: {
2001
+ const legacy = b.pathJoin(&.{ sdk_root, "ndk-bundle" });
2002
+ break :blk if (buildDirExists(b, legacy)) legacy else null;
2003
+ };
2004
+ }
2005
+
1692
2006
  fn androidNdkSysrootPath(b: *std.Build) ?[]const u8 {
1693
2007
  for ([_][]const u8{ "ANDROID_NDK_ROOT", "ANDROID_NDK_HOME", "ANDROID_NDK_LATEST_HOME" }) |name| {
1694
2008
  if (b.graph.environ_map.get(name)) |root| {
@@ -2176,6 +2490,7 @@ const AppManifestBuildConfig = struct {
2176
2490
  cef_dir: []const u8 = "third_party/cef/macos",
2177
2491
  cef_auto_install: bool = false,
2178
2492
  webview_layer: WebLayerOption = .auto,
2493
+ dock_visible: bool = true,
2179
2494
  microphone_permission: bool = false,
2180
2495
  system_audio_permission: bool = false,
2181
2496
  persist_capability: bool = false,
@@ -2187,6 +2502,8 @@ const AppManifestBuildConfig = struct {
2187
2502
  relational_capability: bool = false,
2188
2503
  credentials_capability: bool = false,
2189
2504
  credentials_permission: bool = false,
2505
+ filesystem_permission: bool = false,
2506
+ max_image_pixel_bytes: usize = 1024 * 1024,
2190
2507
  sqlite_capability: bool = false,
2191
2508
  /// The first web declaration found (for teaching messages), or null
2192
2509
  /// when app.zon declares no web use. `web_engine = "system"` alone is
@@ -2208,6 +2525,7 @@ const InferenceManifest = struct {
2208
2525
  id: []const u8 = "dev.native_sdk.app",
2209
2526
  capabilities: []const []const u8 = &.{},
2210
2527
  permissions: []const []const u8 = &.{},
2528
+ dock_visible: bool = true,
2211
2529
  web_engine: []const u8 = "system",
2212
2530
  webview_layer: []const u8 = "auto",
2213
2531
  core_compiler: []const u8 = "external",
@@ -2219,6 +2537,9 @@ const InferenceManifest = struct {
2219
2537
  persist: ?struct {
2220
2538
  version: u64,
2221
2539
  } = null,
2540
+ images: struct {
2541
+ max_image_pixel_bytes: usize = 1024 * 1024,
2542
+ } = .{},
2222
2543
  service_packages: []const ServicePackageConfig = &.{},
2223
2544
  service_carrier: []const u8 = "auto",
2224
2545
  service_pool_size: u8 = 0,
@@ -2269,6 +2590,7 @@ fn appManifestBuildConfig(b: *std.Build, app_root: []const u8) AppManifestBuildC
2269
2590
  .cef_dir = raw.cef.dir,
2270
2591
  .cef_auto_install = raw.cef.auto_install,
2271
2592
  .webview_layer = web_layer_contract.parseWebViewLayer(raw.webview_layer) orelse @panic("app.zon .webview_layer must be \"auto\", \"include\", or \"exclude\""),
2593
+ .dock_visible = raw.dock_visible,
2272
2594
  .microphone_permission = hasManifestPermission(raw.permissions, "microphone"),
2273
2595
  .system_audio_permission = hasManifestPermission(raw.permissions, "system_audio"),
2274
2596
  .persist_capability = hasManifestCapability(raw.capabilities, "persist"),
@@ -2280,6 +2602,8 @@ fn appManifestBuildConfig(b: *std.Build, app_root: []const u8) AppManifestBuildC
2280
2602
  .relational_capability = hasManifestCapability(raw.capabilities, "sqlite"),
2281
2603
  .credentials_capability = hasManifestCapability(raw.capabilities, "credentials"),
2282
2604
  .credentials_permission = hasManifestPermission(raw.permissions, "credentials"),
2605
+ .filesystem_permission = hasManifestPermission(raw.permissions, "filesystem"),
2606
+ .max_image_pixel_bytes = raw.images.max_image_pixel_bytes,
2283
2607
  .sqlite_capability = hasManifestCapability(raw.capabilities, "store") or hasManifestCapability(raw.capabilities, "sqlite"),
2284
2608
  .web_declaration = web_layer_contract.manifestDeclaration(raw),
2285
2609
  };