@native-sdk/cli 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/app.zig +91 -2
- package/build.zig +756 -5
- package/build.zig.zon +7 -0
- package/native-sdk.d.ts +19 -1
- package/package.json +9 -9
- package/packages/core/package-lock.json +2 -2
- package/packages/core/package.json +1 -1
- package/packages/core/rt/rt.zig +416 -9
- package/packages/core/sdk/core.ts +706 -5
- package/packages/core/sdk/events.ts +17 -8
- package/packages/core/src/checker.ts +305 -2
- package/packages/core/src/diagnostics.ts +12 -0
- package/packages/core/src/emitter.ts +3187 -264
- package/packages/core/src/typed_ast.ts +51 -4
- package/packages/core/src/types.ts +34 -1
- package/skill-data/native-ui/SKILL.md +42 -4
- package/skill-data/ts-core/SKILL.md +13 -3
- package/src/app_runner/root.zig +112 -10
- package/src/app_runner/ts_core_main.zig +4 -0
- package/src/automation/layout_fingerprint.zig +160 -0
- package/src/automation/protocol.zig +82 -33
- package/src/automation/root.zig +1 -0
- package/src/automation/server.zig +1 -1
- package/src/automation/snapshot.zig +68 -9
- package/src/automation/watcher.zig +1 -1
- package/src/embed/host.zig +5 -0
- package/src/embed/tests.zig +119 -1
- package/src/embed/ui_host.zig +13 -0
- package/src/platform/linux/gtk_host.c +639 -16
- package/src/platform/linux/gtk_host.h +25 -0
- package/src/platform/linux/root.zig +351 -7
- package/src/platform/macos/appkit_host.h +152 -8
- package/src/platform/macos/appkit_host.m +1816 -100
- package/src/platform/macos/cef_host.mm +372 -11
- package/src/platform/macos/root.zig +379 -11
- package/src/platform/null_platform.zig +696 -9
- package/src/platform/null_platform_tests.zig +35 -0
- package/src/platform/root.zig +42 -0
- package/src/platform/types.zig +524 -18
- package/src/platform/windows/root.zig +432 -9
- package/src/platform/windows/webview2_host.cpp +482 -45
- package/src/primitives/app_manifest/comptime_scene.zig +5 -0
- package/src/primitives/app_manifest/root.zig +1 -0
- package/src/primitives/app_manifest/types.zig +32 -0
- package/src/primitives/app_manifest/validation.zig +18 -0
- package/src/primitives/canvas/a11y_audit.zig +33 -11
- package/src/primitives/canvas/a11y_audit_tests.zig +20 -0
- package/src/primitives/canvas/drawing.zig +25 -0
- package/src/primitives/canvas/equality.zig +8 -0
- package/src/primitives/canvas/events.zig +103 -16
- package/src/primitives/canvas/frame.zig +125 -1
- package/src/primitives/canvas/layout_audit.zig +22 -5
- package/src/primitives/canvas/markdown_hostile_tests.zig +8 -4
- package/src/primitives/canvas/render_tests.zig +13 -10
- package/src/primitives/canvas/root.zig +48 -0
- package/src/primitives/canvas/terminal_box.zig +471 -0
- package/src/primitives/canvas/terminal_grid.zig +978 -0
- package/src/primitives/canvas/terminal_grid_tests.zig +1093 -0
- package/src/primitives/canvas/test_support.zig +1 -0
- package/src/primitives/canvas/tests.zig +2 -0
- package/src/primitives/canvas/text_tests.zig +39 -4
- package/src/primitives/canvas/tokens.zig +115 -12
- package/src/primitives/canvas/ui.zig +535 -12
- package/src/primitives/canvas/ui_markup.zig +253 -36
- package/src/primitives/canvas/ui_markup_binary.zig +4 -1
- package/src/primitives/canvas/ui_markup_compiled.zig +195 -9
- package/src/primitives/canvas/ui_markup_compiled_tests.zig +188 -8
- package/src/primitives/canvas/ui_markup_contract.zig +89 -6
- package/src/primitives/canvas/ui_markup_contract_tests.zig +65 -1
- package/src/primitives/canvas/ui_markup_huge_document_tests.zig +154 -0
- package/src/primitives/canvas/ui_markup_huge_model_tests.zig +1 -0
- package/src/primitives/canvas/ui_markup_reflect.zig +75 -24
- package/src/primitives/canvas/ui_markup_tests.zig +178 -9
- package/src/primitives/canvas/ui_markup_view.zig +220 -11
- package/src/primitives/canvas/ui_markup_view_tests.zig +553 -28
- package/src/primitives/canvas/ui_schema.zig +110 -17
- package/src/primitives/canvas/ui_schema_tests.zig +18 -10
- package/src/primitives/canvas/ui_tests.zig +141 -9
- package/src/primitives/canvas/widget_access.zig +28 -2
- package/src/primitives/canvas/widget_anchored_tests.zig +48 -0
- package/src/primitives/canvas/widget_invalidation.zig +81 -1
- package/src/primitives/canvas/widget_layout.zig +59 -11
- package/src/primitives/canvas/widget_layout_tests.zig +125 -4
- package/src/primitives/canvas/widget_render.zig +272 -18
- package/src/primitives/canvas/widget_render_scroll.zig +108 -27
- package/src/primitives/canvas/widget_routing.zig +59 -7
- package/src/primitives/canvas/widget_runtime.zig +23 -0
- package/src/primitives/canvas/widget_runtime_tests.zig +149 -0
- package/src/primitives/canvas/widget_semantics.zig +119 -11
- package/src/primitives/canvas/widget_semantics_tests.zig +409 -0
- package/src/primitives/canvas/widget_tree.zig +17 -0
- package/src/primitives/canvas/widgets.zig +132 -0
- package/src/root.zig +23 -0
- package/src/runtime/api.zig +76 -5
- package/src/runtime/automation_commands.zig +20 -1
- package/src/runtime/automation_snapshot.zig +25 -1
- package/src/runtime/automation_widget_dispatch.zig +73 -8
- package/src/runtime/bridge_payload.zig +8 -0
- package/src/runtime/bridge_responses.zig +5 -0
- package/src/runtime/builtin_bridge.zig +9 -4
- package/src/runtime/canvas_font_tests.zig +439 -2
- package/src/runtime/canvas_fonts.zig +61 -6
- package/src/runtime/canvas_frame.zig +62 -7
- package/src/runtime/canvas_frame_animation_tests.zig +5 -4
- package/src/runtime/canvas_frame_helpers.zig +190 -1
- package/src/runtime/canvas_frame_invalidation_tests.zig +531 -0
- package/src/runtime/canvas_frame_patch_tests.zig +161 -10
- package/src/runtime/canvas_frame_retained_tests.zig +5 -2
- package/src/runtime/canvas_image_tests.zig +195 -0
- package/src/runtime/canvas_images.zig +45 -12
- package/src/runtime/canvas_widget_accessibility_tests.zig +1 -1
- package/src/runtime/canvas_widget_clipboard_tests.zig +40 -0
- package/src/runtime/canvas_widget_context_menu.zig +269 -32
- package/src/runtime/canvas_widget_context_menu_tests.zig +640 -14
- package/src/runtime/canvas_widget_display.zig +1 -1
- package/src/runtime/canvas_widget_event_tests.zig +1823 -0
- package/src/runtime/canvas_widget_events.zig +240 -24
- package/src/runtime/canvas_widget_runtime.zig +213 -29
- package/src/runtime/canvas_widget_scroll_driver_tests.zig +170 -7
- package/src/runtime/canvas_widget_scroll_drivers.zig +151 -17
- package/src/runtime/canvas_widget_scroll_tests.zig +435 -23
- package/src/runtime/canvas_widget_state.zig +6 -0
- package/src/runtime/canvas_widget_text_tests.zig +1 -1
- package/src/runtime/core.zig +131 -13
- package/src/runtime/effects.zig +8136 -180
- package/src/runtime/effects_channel_tests.zig +3519 -0
- package/src/runtime/effects_fetch_tests.zig +89 -1
- package/src/runtime/effects_file_tests.zig +41 -1
- package/src/runtime/effects_image_tests.zig +1304 -0
- package/src/runtime/effects_pty_tests.zig +1362 -0
- package/src/runtime/effects_tests.zig +167 -9
- package/src/runtime/effects_video_tests.zig +3609 -0
- package/src/runtime/flow.zig +42 -4
- package/src/runtime/gpu_surface_events.zig +473 -13
- package/src/runtime/media_surface.zig +116 -11
- package/src/runtime/media_surface_tests.zig +61 -0
- package/src/runtime/pty.zig +1252 -0
- package/src/runtime/pty_windows.zig +1780 -0
- package/src/runtime/root.zig +36 -0
- package/src/runtime/runtime_event_tests.zig +20 -1
- package/src/runtime/session_blobs.zig +689 -0
- package/src/runtime/session_journal.zig +432 -62
- package/src/runtime/session_record.zig +43 -2
- package/src/runtime/session_replay.zig +556 -20
- package/src/runtime/session_tests.zig +2087 -1
- package/src/runtime/shell_layout.zig +7 -0
- package/src/runtime/terminal_session.zig +1569 -0
- package/src/runtime/terminal_session_tests.zig +450 -0
- package/src/runtime/terminal_vt_ghostty.zig +15 -0
- package/src/runtime/terminal_vt_stub.zig +13 -0
- package/src/runtime/testdata/fonts/NotoSansSC-Receipt.ttf +0 -0
- package/src/runtime/testdata/fonts/OFL.txt +93 -0
- package/src/runtime/tests.zig +8 -0
- package/src/runtime/ts_core_host.zig +1320 -45
- package/src/runtime/ts_core_host_tests.zig +1100 -1
- package/src/runtime/ts_ui_app.zig +23 -5
- package/src/runtime/ui_app.zig +2444 -69
- package/src/runtime/ui_app_tests.zig +3171 -744
- package/src/runtime/ui_app_virtual_variable_tests.zig +4 -2
- package/src/runtime/ui_app_window_tests.zig +736 -0
- package/src/runtime/view.zig +190 -2
- package/src/runtime/view_widget_scroll.zig +218 -68
- package/src/runtime/view_widget_text.zig +11 -2
- package/src/runtime/view_widget_tree.zig +111 -3
- package/src/runtime/window_command_bridge_tests.zig +117 -0
- package/src/runtime/window_storage.zig +77 -2
- package/src/runtime/window_view_runtime.zig +34 -2
- package/src/runtime/window_views.zig +62 -1
- package/src/terminal_session_tests_root.zig +15 -0
- package/src/tooling/manifest.zig +75 -0
- package/src/tooling/raw_manifest.zig +2 -0
- package/src/tooling/templates.zig +244 -8
package/src/runtime/flow.zig
CHANGED
|
@@ -242,7 +242,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
242
242
|
log(self, "app.start", "app started", &.{trace.string("app", app.name)});
|
|
243
243
|
},
|
|
244
244
|
.app_activated => {
|
|
245
|
-
self
|
|
245
|
+
try WindowViewMethods().setAppActive(self, true);
|
|
246
246
|
try dispatchEvent(self, app, .{ .lifecycle = .activate });
|
|
247
247
|
emitAppLifecycleEvent(self, "app:activate") catch |err| log(self, "app.activate.emit_failed", @errorName(err), &.{});
|
|
248
248
|
},
|
|
@@ -254,7 +254,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
254
254
|
// that already knows the app is inactive: the
|
|
255
255
|
// adoption arm's reveal/arm paths are gated on this
|
|
256
256
|
// register and stay silent.
|
|
257
|
-
self
|
|
257
|
+
try WindowViewMethods().setAppActive(self, false);
|
|
258
258
|
// Deactivation drops every tooltip conversation in
|
|
259
259
|
// every window (see the seam's own rationale) BEFORE
|
|
260
260
|
// the app hears the lifecycle event, so a model that
|
|
@@ -342,6 +342,17 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
342
342
|
if (WindowViewMethods().findWindowIndexById(self, window_id)) |index| try WindowViewMethods().setFocusedIndex(self, index);
|
|
343
343
|
self.invalidated = true;
|
|
344
344
|
},
|
|
345
|
+
.view_focused => |focus| {
|
|
346
|
+
// Native children (notably embedded webviews) own
|
|
347
|
+
// their pointer stream, so the host reports the
|
|
348
|
+
// focus edge explicitly. Keep the canvas widget id
|
|
349
|
+
// as per-view focus memory while its view blurs:
|
|
350
|
+
// inactive terminal/text carets paint honestly, and
|
|
351
|
+
// clicking back into the canvas resumes its normal
|
|
352
|
+
// pointer-driven widget focus path.
|
|
353
|
+
try WindowViewMethods().setFocusedView(self, focus.window_id, focus.label);
|
|
354
|
+
self.invalidated = true;
|
|
355
|
+
},
|
|
345
356
|
.frame_requested => try frame(self, app),
|
|
346
357
|
.bridge_message => |message| try handleBridgeMessage(self, app, message),
|
|
347
358
|
.tray_action => |item_id| {
|
|
@@ -433,6 +444,9 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
433
444
|
.audio => |audio_event| {
|
|
434
445
|
try dispatchEvent(self, app, .{ .audio = audio_event });
|
|
435
446
|
},
|
|
447
|
+
.video => |video_event| {
|
|
448
|
+
try dispatchEvent(self, app, .{ .video = video_event });
|
|
449
|
+
},
|
|
436
450
|
.wake => {
|
|
437
451
|
try dispatchEvent(self, app, .effects_wake);
|
|
438
452
|
},
|
|
@@ -498,6 +512,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
498
512
|
.timer => {},
|
|
499
513
|
.effects_wake => {},
|
|
500
514
|
.audio => {},
|
|
515
|
+
.video => {},
|
|
501
516
|
.files_dropped => {},
|
|
502
517
|
.gpu_surface_frame => {},
|
|
503
518
|
.gpu_surface_resized => {},
|
|
@@ -510,6 +525,12 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
510
525
|
.canvas_widget_context_menu => {
|
|
511
526
|
self.invalidateFor(.command, null);
|
|
512
527
|
},
|
|
528
|
+
// The shown notice only arms UiApp's selection snapshot:
|
|
529
|
+
// no visual change (the popover is an OS surface).
|
|
530
|
+
.canvas_widget_context_menu_shown => {},
|
|
531
|
+
// The dismissal notice only disarms UiApp's snapshot and
|
|
532
|
+
// pin: no visual change either.
|
|
533
|
+
.canvas_widget_context_menu_dismissed => {},
|
|
513
534
|
.canvas_widget_context_menu_request => {
|
|
514
535
|
// The app loop answers by mounting the anchored
|
|
515
536
|
// fallback surface: a visual change.
|
|
@@ -618,6 +639,23 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
618
639
|
};
|
|
619
640
|
self.windows[runtime_index].source_reloads_from_app = true;
|
|
620
641
|
if (index > 0) {
|
|
642
|
+
// The same `.hide` gate as the runtime create path
|
|
643
|
+
// (window_storage): secondary startup windows reach
|
|
644
|
+
// the platform through this direct create, so the
|
|
645
|
+
// policy check must ride here too or a declared
|
|
646
|
+
// `.hide` is silently accepted on hosts that cannot
|
|
647
|
+
// re-show a closed window. `.hide` needs a host that
|
|
648
|
+
// can keep a closed-by-the-user window alive and
|
|
649
|
+
// re-show it; refusing here is the loud teaching
|
|
650
|
+
// (GTK: no status item exists to bring the window
|
|
651
|
+
// back, declare .quit — the default — instead).
|
|
652
|
+
// NEVER a silent no-op that strands a hidden window.
|
|
653
|
+
// The main window (index 0) is created by the host
|
|
654
|
+
// itself, which refuses the declaration at its own
|
|
655
|
+
// init.
|
|
656
|
+
if (window.close_policy == .hide and !self.options.platform.supports(.window_hide_on_close)) {
|
|
657
|
+
return error.UnsupportedWindowClosePolicy;
|
|
658
|
+
}
|
|
621
659
|
_ = try self.options.platform.services.createWindow(window);
|
|
622
660
|
}
|
|
623
661
|
try self.options.platform.services.loadWindowWebView(window.id, self.windows[runtime_index].source.?);
|
|
@@ -1181,7 +1219,7 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
1181
1219
|
/// app: record it in the bounded ring (queryable through
|
|
1182
1220
|
/// `Runtime.dispatchErrors` and the automation snapshot), trace
|
|
1183
1221
|
/// it at `.err`, and republish observable state.
|
|
1184
|
-
fn recordDispatchError(self: *Runtime, event_name: []const u8, err: anyerror) void {
|
|
1222
|
+
pub fn recordDispatchError(self: *Runtime, event_name: []const u8, err: anyerror) void {
|
|
1185
1223
|
recordDispatchErrorDetail(self, event_name, err, "");
|
|
1186
1224
|
}
|
|
1187
1225
|
|
|
@@ -1193,9 +1231,9 @@ pub fn RuntimeFlow(comptime Runtime: type) type {
|
|
|
1193
1231
|
self.dispatch_error_total +%= 1;
|
|
1194
1232
|
var record: automation.snapshot.DispatchError = .{
|
|
1195
1233
|
.timestamp_ns = runtime_clock.timestampToU64(nowNanoseconds()),
|
|
1196
|
-
.event = event_name,
|
|
1197
1234
|
.error_name = @errorName(err),
|
|
1198
1235
|
};
|
|
1236
|
+
record.setEvent(event_name);
|
|
1199
1237
|
record.setDetail(detail);
|
|
1200
1238
|
if (self.dispatch_error_len == self.dispatch_errors.len) {
|
|
1201
1239
|
std.mem.copyForwards(automation.snapshot.DispatchError, self.dispatch_errors[0 .. self.dispatch_errors.len - 1], self.dispatch_errors[1..]);
|