@native-sdk/cli 0.9.0 → 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.
- package/build/app.zig +331 -24
- package/build.zig +179 -11
- package/native-sdk.d.ts +8 -0
- package/package.json +10 -10
- package/packages/core/compile-surface/core.ts +70 -1
- package/packages/core/package-lock.json +11 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/merge_static_archives.mjs +78 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +52 -7
- package/packages/core/scripts/run_external_service_compiler.mjs +53 -13
- package/packages/core/scripts/stage_external_services.mjs +1 -1
- package/packages/core/sdk/core.d.ts +75 -0
- package/packages/core/sdk/core.ts +167 -12
- package/packages/core/sdk/events.d.ts +53 -0
- package/packages/core/sdk/events.ts +78 -7
- package/packages/core/src/checker.ts +470 -2
- package/packages/core/src/cli.ts +13 -0
- package/packages/core/src/contract.ts +3 -1
- package/packages/core/src/devhost.ts +30 -1
- package/packages/core/src/devhost_journal.mjs +10 -8
- package/packages/core/src/diagnostics.ts +99 -8
- package/packages/core/src/frontend.ts +6 -0
- package/packages/core/src/infer.ts +24 -0
- package/skill-data/automation/SKILL.md +1 -1
- package/skill-data/native-ui/SKILL.md +11 -5
- package/skill-data/ts-core/SKILL.md +53 -20
- package/skill-data/ts-services/SKILL.md +4 -4
- package/skill-data/ts-services/references/service-surface.md +2 -1
- package/skill-data/zig/SKILL.md +1 -1
- package/src/app_runner/root.zig +29 -0
- package/src/app_runner/ts_core_main.zig +5 -0
- package/src/app_runner/ts_core_mobile.zig +241 -0
- package/src/automation/protocol.zig +5 -1
- package/src/automation/snapshot.zig +8 -6
- package/src/embed/app_exports.zig +1 -0
- package/src/embed/root.zig +1 -0
- package/src/embed/tests.zig +28 -0
- package/src/embed/ui_host.zig +68 -2
- package/src/platform/linux/cef_host.cpp +7 -1
- package/src/platform/linux/gtk_host.c +200 -5
- package/src/platform/linux/gtk_host.h +2 -1
- package/src/platform/linux/root.zig +69 -4
- package/src/platform/macos/appkit_host.h +11 -7
- package/src/platform/macos/appkit_host.m +210 -88
- package/src/platform/macos/cef_host.mm +210 -88
- package/src/platform/macos/root.zig +77 -30
- package/src/platform/null_platform.zig +234 -51
- package/src/platform/null_platform_tests.zig +39 -0
- package/src/platform/root.zig +10 -0
- package/src/platform/types.zig +105 -16
- package/src/platform/windows/root.zig +20 -6
- package/src/platform/windows/webview2_host.cpp +41 -5
- package/src/root.zig +7 -0
- package/src/runtime/api.zig +8 -0
- package/src/runtime/automation_commands.zig +35 -2
- package/src/runtime/automation_snapshot.zig +32 -24
- package/src/runtime/bridge_permission_tests.zig +35 -1
- package/src/runtime/bridge_responses.zig +1 -1
- package/src/runtime/builtin_bridge.zig +11 -1
- package/src/runtime/core.zig +12 -6
- package/src/runtime/effects.zig +1323 -35
- package/src/runtime/effects_file_tests.zig +587 -0
- package/src/runtime/effects_notification_tests.zig +11 -0
- package/src/runtime/file_access.zig +400 -0
- package/src/runtime/file_effect_crash_helper.zig +28 -0
- package/src/runtime/file_effect_crash_tests.zig +37 -0
- package/src/runtime/flow.zig +21 -9
- package/src/runtime/native_command_event_tests.zig +44 -2
- package/src/runtime/pty.zig +5 -2
- package/src/runtime/root.zig +5 -0
- package/src/runtime/session_blobs.zig +4 -1
- package/src/runtime/session_journal.zig +56 -5
- package/src/runtime/session_record.zig +38 -0
- package/src/runtime/session_replay.zig +97 -7
- package/src/runtime/session_tests.zig +81 -0
- package/src/runtime/state.zig +10 -0
- package/src/runtime/system_services.zig +129 -36
- package/src/runtime/ts_core_host.zig +281 -11
- package/src/runtime/ts_core_host_tests.zig +95 -1
- package/src/runtime/ts_ui_app.zig +461 -8
- package/src/runtime/ui_app.zig +321 -109
- package/src/runtime/ui_app_tests.zig +132 -6
- package/src/runtime/ui_app_window_tests.zig +61 -7
- package/src/runtime/validation.zig +20 -0
- package/src/tooling/templates.zig +28 -0
- package/src/tooling/ts_core.zig +83 -0
- package/tools/corewire/emit.zig +3 -3
- package/tools/corewire/emit_facade.zig +65 -5
- package/tools/corewire/emit_profile.zig +2 -2
- package/tools/corewire/emit_service.zig +2 -2
- package/tools/corewire/service_contract.zig +4 -4
- package/tools/corewire/sidecar.zig +4 -4
|
@@ -3895,14 +3895,140 @@ test "ui app status item installs a tray and dispatches its commands" {
|
|
|
3895
3895
|
try std.testing.expectEqual(@as(usize, 1), harness.null_platform.trayCreateCount());
|
|
3896
3896
|
|
|
3897
3897
|
// Selecting the item dispatches its command through on_command.
|
|
3898
|
-
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = 1 });
|
|
3898
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = .{ .item_id = 1 } });
|
|
3899
3899
|
try std.testing.expectEqual(@as(u32, 1), app_state.model.refresh_count);
|
|
3900
3900
|
// Items without commands fall back to the generic name and map to
|
|
3901
3901
|
// no Msg here.
|
|
3902
|
-
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = 2 });
|
|
3902
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = .{ .item_id = 2 } });
|
|
3903
3903
|
try std.testing.expectEqual(@as(u32, 1), app_state.model.refresh_count);
|
|
3904
3904
|
}
|
|
3905
3905
|
|
|
3906
|
+
const MultiStatusModel = struct {
|
|
3907
|
+
spend: u32 = 7,
|
|
3908
|
+
controls_visible: bool = true,
|
|
3909
|
+
spend_visible: bool = true,
|
|
3910
|
+
};
|
|
3911
|
+
|
|
3912
|
+
const MultiStatusMsg = union(enum) { bump_spend, toggle_controls, remove_spend };
|
|
3913
|
+
const MultiStatusApp = ui_app_model.UiApp(MultiStatusModel, MultiStatusMsg);
|
|
3914
|
+
|
|
3915
|
+
fn multiStatusUpdate(model: *MultiStatusModel, msg: MultiStatusMsg) void {
|
|
3916
|
+
switch (msg) {
|
|
3917
|
+
.bump_spend => model.spend += 1,
|
|
3918
|
+
.toggle_controls => model.controls_visible = !model.controls_visible,
|
|
3919
|
+
.remove_spend => model.spend_visible = false,
|
|
3920
|
+
}
|
|
3921
|
+
}
|
|
3922
|
+
|
|
3923
|
+
fn multiStatusView(ui: *MultiStatusApp.Ui, model: *const MultiStatusModel) MultiStatusApp.Ui.Node {
|
|
3924
|
+
return ui.text(.{}, ui.fmt("Spend {d}", .{model.spend}));
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3927
|
+
fn multiStatusCommand(name: []const u8) ?MultiStatusMsg {
|
|
3928
|
+
if (std.mem.eql(u8, name, "spend.bump")) return .bump_spend;
|
|
3929
|
+
if (std.mem.eql(u8, name, "control.toggle") or std.mem.eql(u8, name, "control.hide") or std.mem.eql(u8, name, "control.show")) return .toggle_controls;
|
|
3930
|
+
if (std.mem.eql(u8, name, "spend.remove")) return .remove_spend;
|
|
3931
|
+
return null;
|
|
3932
|
+
}
|
|
3933
|
+
|
|
3934
|
+
fn multiStatusItems(model: *const MultiStatusModel, scratch: *MultiStatusApp.StatusItemsScratch) []const MultiStatusApp.StatusItemDescriptor {
|
|
3935
|
+
var count: usize = 0;
|
|
3936
|
+
if (model.spend_visible) {
|
|
3937
|
+
const title = std.fmt.bufPrint(&scratch.title_buffers[count], "${d}", .{model.spend}) catch "$";
|
|
3938
|
+
scratch.items[0] = .{ .id = 1, .label = "Refresh spend", .command = "spend.bump" };
|
|
3939
|
+
scratch.items[1] = .{ .id = 2, .label = "Remove spend", .command = "spend.remove" };
|
|
3940
|
+
scratch.status_items[count] = .{
|
|
3941
|
+
.id = 100,
|
|
3942
|
+
.state = .{
|
|
3943
|
+
.presentation = .{ .title = title, .monospaced = true },
|
|
3944
|
+
.icon_path = if (model.spend % 2 == 0) "spend-even.png" else "spend-odd.png",
|
|
3945
|
+
.tooltip = "Vercel spend",
|
|
3946
|
+
.items = scratch.items[0..2],
|
|
3947
|
+
},
|
|
3948
|
+
};
|
|
3949
|
+
count += 1;
|
|
3950
|
+
}
|
|
3951
|
+
const row_start = zero_platform.max_tray_items;
|
|
3952
|
+
scratch.items[row_start] = .{
|
|
3953
|
+
.id = 1,
|
|
3954
|
+
.label = if (model.controls_visible) "Hide controls" else "Show controls",
|
|
3955
|
+
.command = "control.toggle",
|
|
3956
|
+
};
|
|
3957
|
+
scratch.status_items[count] = .{
|
|
3958
|
+
.id = 200,
|
|
3959
|
+
.visible = model.controls_visible,
|
|
3960
|
+
.state = .{
|
|
3961
|
+
.presentation = .{ .title = "V" },
|
|
3962
|
+
.icon_path = if (model.controls_visible) "control-on.png" else "control-off.png",
|
|
3963
|
+
.tooltip = if (model.controls_visible) "Controls visible" else "Controls hidden",
|
|
3964
|
+
.activation_command = if (model.controls_visible) "control.hide" else "control.show",
|
|
3965
|
+
.items = scratch.items[row_start .. row_start + 1],
|
|
3966
|
+
},
|
|
3967
|
+
};
|
|
3968
|
+
count += 1;
|
|
3969
|
+
return scratch.status_items[0..count];
|
|
3970
|
+
}
|
|
3971
|
+
|
|
3972
|
+
test "ui app reconciles multiple status items independently by id" {
|
|
3973
|
+
const harness = try core.TestHarness().create(std.testing.allocator, .{ .size = geometry.SizeF.init(400, 300) });
|
|
3974
|
+
defer harness.destroy(std.testing.allocator);
|
|
3975
|
+
harness.null_platform.gpu_surfaces = true;
|
|
3976
|
+
|
|
3977
|
+
const app_state = try std.testing.allocator.create(MultiStatusApp);
|
|
3978
|
+
defer std.testing.allocator.destroy(app_state);
|
|
3979
|
+
app_state.* = MultiStatusApp.init(std.heap.page_allocator, .{}, .{
|
|
3980
|
+
.name = "ui-app-multi-status",
|
|
3981
|
+
.scene = counter_scene,
|
|
3982
|
+
.canvas_label = canvas_label,
|
|
3983
|
+
.update = multiStatusUpdate,
|
|
3984
|
+
.view = multiStatusView,
|
|
3985
|
+
.on_command = multiStatusCommand,
|
|
3986
|
+
.status_items_fn = multiStatusItems,
|
|
3987
|
+
});
|
|
3988
|
+
defer app_state.deinit();
|
|
3989
|
+
const app = app_state.app();
|
|
3990
|
+
try harness.start(app);
|
|
3991
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_frame = .{
|
|
3992
|
+
.label = canvas_label,
|
|
3993
|
+
.size = geometry.SizeF.init(400, 300),
|
|
3994
|
+
.scale_factor = 1,
|
|
3995
|
+
.frame_index = 1,
|
|
3996
|
+
.timestamp_ns = 1_000_000,
|
|
3997
|
+
.nonblank = true,
|
|
3998
|
+
} });
|
|
3999
|
+
|
|
4000
|
+
try std.testing.expectEqual(@as(usize, 2), harness.null_platform.statusItemCount());
|
|
4001
|
+
try std.testing.expectEqual(@as(usize, 2), harness.null_platform.trayCreateCount());
|
|
4002
|
+
try std.testing.expectEqualStrings("$7", harness.null_platform.statusItemTitle(100));
|
|
4003
|
+
try std.testing.expectEqualStrings("V", harness.null_platform.statusItemTitle(200));
|
|
4004
|
+
try std.testing.expectEqualStrings("spend-odd.png", harness.null_platform.statusItemIconPath(100));
|
|
4005
|
+
try std.testing.expectEqualStrings("control.hide", harness.null_platform.statusItemActivationCommand(200));
|
|
4006
|
+
|
|
4007
|
+
// Both menus deliberately reuse row id 1; the status-item id keeps
|
|
4008
|
+
// command resolution independent.
|
|
4009
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = .{ .status_item_id = 100, .item_id = 1 } });
|
|
4010
|
+
try std.testing.expectEqual(@as(u32, 8), app_state.model.spend);
|
|
4011
|
+
try std.testing.expectEqualStrings("$8", harness.null_platform.statusItemTitle(100));
|
|
4012
|
+
try std.testing.expectEqualStrings("spend-even.png", harness.null_platform.statusItemIconPath(100));
|
|
4013
|
+
try std.testing.expectEqual(@as(usize, 2), harness.null_platform.trayCreateCount());
|
|
4014
|
+
|
|
4015
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = .{ .status_item_id = 200, .item_id = 1 } });
|
|
4016
|
+
try std.testing.expect(!harness.null_platform.statusItemVisible(200));
|
|
4017
|
+
try std.testing.expectEqualStrings("control-off.png", harness.null_platform.statusItemIconPath(200));
|
|
4018
|
+
try std.testing.expectEqualStrings("Controls hidden", harness.null_platform.statusItemTooltip(200));
|
|
4019
|
+
try std.testing.expectEqualStrings("control.show", harness.null_platform.statusItemActivationCommand(200));
|
|
4020
|
+
try std.testing.expectEqualStrings("Show controls", harness.null_platform.statusItemMenu(200)[0].label);
|
|
4021
|
+
try std.testing.expectEqual(@as(usize, 2), harness.null_platform.trayCreateCount());
|
|
4022
|
+
try std.testing.expectEqual(@as(usize, 2), harness.null_platform.trayShellUpdateCount());
|
|
4023
|
+
try std.testing.expectEqual(@as(usize, 3), harness.null_platform.trayUpdateCount());
|
|
4024
|
+
|
|
4025
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = .{ .status_item_id = 100, .item_id = 2 } });
|
|
4026
|
+
try std.testing.expect(!harness.null_platform.statusItemExists(100));
|
|
4027
|
+
try std.testing.expect(harness.null_platform.statusItemExists(200));
|
|
4028
|
+
try std.testing.expectEqual(@as(usize, 1), harness.null_platform.statusItemCount());
|
|
4029
|
+
try std.testing.expectEqual(@as(usize, 1), harness.null_platform.trayRemoveCount());
|
|
4030
|
+
}
|
|
4031
|
+
|
|
3906
4032
|
// ------------------------------------------------ model-driven status item
|
|
3907
4033
|
|
|
3908
4034
|
const TrayStateModel = struct {
|
|
@@ -4001,7 +4127,7 @@ test "ui app status_item_fn drives the tray title and menu from the model" {
|
|
|
4001
4127
|
|
|
4002
4128
|
// A model change that only affects the TITLE re-titles the live
|
|
4003
4129
|
// button without rebuilding the menu or re-creating the item.
|
|
4004
|
-
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = 1 });
|
|
4130
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = .{ .item_id = 1 } });
|
|
4005
4131
|
try std.testing.expectEqual(@as(u32, 4), app_state.model.open_count);
|
|
4006
4132
|
try std.testing.expectEqualStrings("ZN 4", harness.null_platform.lastTrayTitle());
|
|
4007
4133
|
try std.testing.expectEqual(@as(usize, 1), harness.null_platform.trayTitleUpdateCount());
|
|
@@ -4010,7 +4136,7 @@ test "ui app status_item_fn drives the tray title and menu from the model" {
|
|
|
4010
4136
|
|
|
4011
4137
|
// Selecting a dropdown row closes the loop: tray action -> command ->
|
|
4012
4138
|
// Msg -> model, and the menu (not the title) re-applies.
|
|
4013
|
-
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = 11 });
|
|
4139
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = .{ .item_id = 11 } });
|
|
4014
4140
|
try std.testing.expectEqual(@as(u32, 1), app_state.model.selected_issue);
|
|
4015
4141
|
try std.testing.expectEqual(updates_after_install + 1, harness.null_platform.trayUpdateCount());
|
|
4016
4142
|
try std.testing.expectEqual(@as(usize, 1), harness.null_platform.trayTitleUpdateCount());
|
|
@@ -4018,7 +4144,7 @@ test "ui app status_item_fn drives the tray title and menu from the model" {
|
|
|
4018
4144
|
|
|
4019
4145
|
// A rebuild whose tray output is unchanged touches nothing (the
|
|
4020
4146
|
// repeat selection Msg still rebuilds the view).
|
|
4021
|
-
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = 11 });
|
|
4147
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .tray_action = .{ .item_id = 11 } });
|
|
4022
4148
|
try std.testing.expectEqual(updates_after_install + 1, harness.null_platform.trayUpdateCount());
|
|
4023
4149
|
try std.testing.expectEqual(@as(usize, 1), harness.null_platform.trayTitleUpdateCount());
|
|
4024
4150
|
try std.testing.expectEqual(@as(usize, 1), harness.null_platform.trayCreateCount());
|
|
@@ -4072,7 +4198,7 @@ test "ui app tray state rides automation snapshots and tray-action drives a row"
|
|
|
4072
4198
|
var writer = std.Io.Writer.fixed(&buffer);
|
|
4073
4199
|
try automation.snapshot.writeText(harness.runtime.automationSnapshot("Tray"), &writer);
|
|
4074
4200
|
const text = writer.buffered();
|
|
4075
|
-
try std.testing.expect(std.mem.indexOf(u8, text, "tray title=\"ZN 3\" items=4\n") != null);
|
|
4201
|
+
try std.testing.expect(std.mem.indexOf(u8, text, "tray #1 title=\"ZN 3\" visible=true items=4\n") != null);
|
|
4076
4202
|
try std.testing.expect(std.mem.indexOf(u8, text, " tray-item #1 label=\"Refresh\" command=\"app.refresh\" enabled=true detail=\"\" role=command key=\"\" modifiers=(primary=false,command=false,control=false,option=false,shift=false)\n") != null);
|
|
4077
4203
|
try std.testing.expect(std.mem.indexOf(u8, text, " tray-item separator\n") != null);
|
|
4078
4204
|
// The fixture disables the SELECTED row (initially issue 0).
|
|
@@ -669,6 +669,7 @@ test "a padded secondary drag header keeps its layout (no double reservation)" {
|
|
|
669
669
|
|
|
670
670
|
const VerbModel = struct {
|
|
671
671
|
settings_open: bool = true,
|
|
672
|
+
close_policy: app_manifest.WindowClosePolicy = .quit,
|
|
672
673
|
};
|
|
673
674
|
|
|
674
675
|
const VerbMsg = union(enum) {
|
|
@@ -709,6 +710,7 @@ fn verbWindows(model: *const VerbModel, scratch: *VerbApp.WindowsScratch) []cons
|
|
|
709
710
|
.title = "Settings",
|
|
710
711
|
.width = 320,
|
|
711
712
|
.height = 240,
|
|
713
|
+
.close_policy = model.close_policy,
|
|
712
714
|
.on_close = .settings_closed,
|
|
713
715
|
};
|
|
714
716
|
count += 1;
|
|
@@ -837,6 +839,7 @@ test "the .hide close then showWindow round-trip: tray Open brings the hidden wi
|
|
|
837
839
|
.window_view = verbWindowView,
|
|
838
840
|
});
|
|
839
841
|
defer app_state.destroy();
|
|
842
|
+
app_state.model.close_policy = .hide;
|
|
840
843
|
const app = app_state.app();
|
|
841
844
|
try harness.start(app);
|
|
842
845
|
try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_frame = .{
|
|
@@ -853,17 +856,32 @@ test "the .hide close then showWindow round-trip: tray Open brings the hidden wi
|
|
|
853
856
|
if (std.mem.eql(u8, info.label, settings_window_label)) settings_id = info.id;
|
|
854
857
|
}
|
|
855
858
|
try std.testing.expect(settings_id != 0);
|
|
859
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_frame = .{
|
|
860
|
+
.window_id = settings_id,
|
|
861
|
+
.label = settings_canvas_label,
|
|
862
|
+
.size = geometry.SizeF.init(320, 240),
|
|
863
|
+
.scale_factor = 2,
|
|
864
|
+
.frame_index = 1,
|
|
865
|
+
.timestamp_ns = 2_000_000,
|
|
866
|
+
.nonblank = true,
|
|
867
|
+
} });
|
|
868
|
+
_ = try harness.runtime.canvasWidgetLayout(settings_id, settings_canvas_label);
|
|
856
869
|
|
|
857
|
-
//
|
|
858
|
-
//
|
|
859
|
-
//
|
|
860
|
-
|
|
861
|
-
if (window.id == settings_id) harness.null_platform.window_close_policy[index] = .hide;
|
|
862
|
-
}
|
|
870
|
+
// The model-declared descriptor's policy reached the REAL platform
|
|
871
|
+
// create seam. Closing as the user hides the window instead of
|
|
872
|
+
// tearing down its slot, views, or model declaration.
|
|
873
|
+
try std.testing.expectEqual(support.platform.WindowClosePolicy.hide, harness.null_platform.closePolicyForWindow(settings_id).?);
|
|
863
874
|
const hide_event = harness.null_platform.userCloseWindow(settings_id).?;
|
|
864
875
|
try harness.runtime.dispatchPlatformEvent(app, hide_event);
|
|
876
|
+
try std.testing.expect(app_state.model.settings_open);
|
|
877
|
+
try std.testing.expectEqual(@as(usize, 1), app_state.window_slot_count);
|
|
878
|
+
// The canvas tree and view stay installed under the same identity.
|
|
879
|
+
_ = try harness.runtime.canvasWidgetLayout(settings_id, settings_canvas_label);
|
|
865
880
|
for (harness.runtime.listWindows(&buffer)) |info| {
|
|
866
|
-
if (info.id == settings_id)
|
|
881
|
+
if (info.id == settings_id) {
|
|
882
|
+
try std.testing.expect(info.open);
|
|
883
|
+
try std.testing.expect(info.hidden);
|
|
884
|
+
}
|
|
867
885
|
}
|
|
868
886
|
|
|
869
887
|
// The tray "Open" consequence: the model returns the show verb, the
|
|
@@ -882,6 +900,42 @@ test "the .hide close then showWindow round-trip: tray Open brings the hidden wi
|
|
|
882
900
|
}
|
|
883
901
|
}
|
|
884
902
|
|
|
903
|
+
test "a model-declared .hide window is refused on a host that cannot bring it back" {
|
|
904
|
+
const harness = try core.TestHarness().create(std.testing.allocator, .{ .size = geometry.SizeF.init(400, 300) });
|
|
905
|
+
defer harness.destroy(std.testing.allocator);
|
|
906
|
+
harness.null_platform.gpu_surfaces = true;
|
|
907
|
+
harness.null_platform.window_hide_on_close = false;
|
|
908
|
+
const app_state = try VerbApp.create(std.heap.page_allocator, .{
|
|
909
|
+
.name = "ui-app-hide-unsupported",
|
|
910
|
+
.scene = panel_scene,
|
|
911
|
+
.canvas_label = canvas_label,
|
|
912
|
+
.update_fx = verbUpdate,
|
|
913
|
+
.view = verbView,
|
|
914
|
+
.windows_fn = verbWindows,
|
|
915
|
+
.window_view = verbWindowView,
|
|
916
|
+
});
|
|
917
|
+
defer app_state.destroy();
|
|
918
|
+
app_state.model.close_policy = .hide;
|
|
919
|
+
const app = app_state.app();
|
|
920
|
+
try harness.start(app);
|
|
921
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_frame = .{
|
|
922
|
+
.label = canvas_label,
|
|
923
|
+
.size = geometry.SizeF.init(400, 300),
|
|
924
|
+
.scale_factor = 2,
|
|
925
|
+
.frame_index = 1,
|
|
926
|
+
.timestamp_ns = 1_000_000,
|
|
927
|
+
.nonblank = true,
|
|
928
|
+
} });
|
|
929
|
+
|
|
930
|
+
// UiApp creation failures degrade to a warning, so the observable
|
|
931
|
+
// contract is that no unreachable window or retained slot exists.
|
|
932
|
+
var buffer: [support.platform.max_windows]support.platform.WindowInfo = undefined;
|
|
933
|
+
for (harness.runtime.listWindows(&buffer)) |info| {
|
|
934
|
+
try std.testing.expect(!std.mem.eql(u8, info.label, settings_window_label));
|
|
935
|
+
}
|
|
936
|
+
try std.testing.expectEqual(@as(usize, 0), app_state.window_slot_count);
|
|
937
|
+
}
|
|
938
|
+
|
|
885
939
|
// ------------------------------------- close_policy (.quit | .hide)
|
|
886
940
|
|
|
887
941
|
test "close_policy .hide: the user close hides the window, nothing tears down, and the reopen re-shows it" {
|
|
@@ -77,9 +77,14 @@ fn validateDialogString(value: []const u8, max_len: usize, allow_empty: bool) !v
|
|
|
77
77
|
|
|
78
78
|
pub fn validateNotificationOptions(options: platform.NotificationOptions) !void {
|
|
79
79
|
if (options.title.len == 0) return error.InvalidNotificationOptions;
|
|
80
|
+
try validateNotificationField(options.id, platform.max_notification_id_bytes);
|
|
80
81
|
try validateNotificationField(options.title, platform.max_notification_title_bytes);
|
|
81
82
|
try validateNotificationField(options.subtitle, platform.max_notification_subtitle_bytes);
|
|
82
83
|
try validateNotificationField(options.body, platform.max_notification_body_bytes);
|
|
84
|
+
try validateNotificationField(options.action_label, platform.max_notification_action_label_bytes);
|
|
85
|
+
try validateNotificationField(options.action_command, platform.max_notification_action_command_bytes);
|
|
86
|
+
if ((options.action_label.len == 0) != (options.action_command.len == 0)) return error.InvalidNotificationOptions;
|
|
87
|
+
if (options.action_command.len > 0) try validateCommandName(options.action_command);
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
pub fn validateClipboardData(data: platform.ClipboardData) !void {
|
|
@@ -130,6 +135,21 @@ pub fn validateTrayOptions(options: platform.TrayOptions) !void {
|
|
|
130
135
|
try validateTrayMenuItems(options.items);
|
|
131
136
|
}
|
|
132
137
|
|
|
138
|
+
pub fn validateStatusItemId(status_item_id: platform.StatusItemId) !void {
|
|
139
|
+
if (status_item_id == 0) return error.InvalidTrayOptions;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
pub fn validateTrayShell(shell: platform.TrayShell) !void {
|
|
143
|
+
try validateTrayField(shell.icon_path, platform.max_tray_icon_path_bytes);
|
|
144
|
+
try validateTrayField(shell.tooltip, platform.max_tray_tooltip_bytes);
|
|
145
|
+
try validateTrayField(shell.activation_command, platform.max_tray_item_command_bytes);
|
|
146
|
+
try validateTrayField(shell.alternate_activation_command, platform.max_tray_item_command_bytes);
|
|
147
|
+
try validateTrayField(shell.open_command, platform.max_tray_item_command_bytes);
|
|
148
|
+
if (shell.activation_command.len > 0) try validateCommandName(shell.activation_command);
|
|
149
|
+
if (shell.alternate_activation_command.len > 0) try validateCommandName(shell.alternate_activation_command);
|
|
150
|
+
if (shell.open_command.len > 0) try validateCommandName(shell.open_command);
|
|
151
|
+
}
|
|
152
|
+
|
|
133
153
|
pub fn validateTrayTitle(title: []const u8) !void {
|
|
134
154
|
try validateTrayField(title, platform.max_tray_title_bytes);
|
|
135
155
|
}
|
|
@@ -2337,6 +2337,8 @@ fn runnerZig() []const u8 {
|
|
|
2337
2337
|
\\ shortcuts: ?[]const native_sdk.Shortcut = null,
|
|
2338
2338
|
\\ record_store: ?native_sdk.RecordStoreBinding = null,
|
|
2339
2339
|
\\ relational_store: ?native_sdk.RelationalStoreBinding = null,
|
|
2340
|
+
\\ file_access: ?native_sdk.FileAccessBinding = null,
|
|
2341
|
+
\\ file_access_enforce: bool = true,
|
|
2340
2342
|
\\ relational_migrations: []const native_sdk.relational_store.Migration = &built_relational_migrations.migrations,
|
|
2341
2343
|
\\
|
|
2342
2344
|
\\ fn appInfo(self: RunOptions, buffers: *StateBuffers) native_sdk.AppInfo {
|
|
@@ -2732,6 +2734,24 @@ fn runnerZig() []const u8 {
|
|
|
2732
2734
|
\\ var record_store_value: RecordStoreType = undefined;
|
|
2733
2735
|
\\ var record_store_open = false;
|
|
2734
2736
|
\\ var resolved_options = options;
|
|
2737
|
+
\\ var file_root_buffers: [6][1024]u8 = undefined;
|
|
2738
|
+
\\ var file_roots: [6][]const u8 = undefined;
|
|
2739
|
+
\\ const resolved_file_dirs = native_sdk.app_dirs.resolve(
|
|
2740
|
+
\\ .{ .name = options.bundle_id },
|
|
2741
|
+
\\ native_sdk.app_dirs.currentPlatform(),
|
|
2742
|
+
\\ native_sdk.debug.envFromMap(init.environ_map),
|
|
2743
|
+
\\ native_sdk.app_dirs.Buffers.fromArray(1024, &file_root_buffers),
|
|
2744
|
+
\\ ) catch null;
|
|
2745
|
+
\\ var file_root_count: usize = 0;
|
|
2746
|
+
\\ if (resolved_file_dirs) |dirs| {
|
|
2747
|
+
\\ file_roots = .{ dirs.config, dirs.cache, dirs.data, dirs.state, dirs.logs, dirs.temp };
|
|
2748
|
+
\\ file_root_count = file_roots.len;
|
|
2749
|
+
\\ }
|
|
2750
|
+
\\ resolved_options.file_access = .{
|
|
2751
|
+
\\ .roots = file_roots[0..file_root_count],
|
|
2752
|
+
\\ .permitted = native_sdk.security.hasPermission(options.security.permissions, native_sdk.security.permission_filesystem),
|
|
2753
|
+
\\ .enforce = options.file_access_enforce,
|
|
2754
|
+
\\ };
|
|
2735
2755
|
\\ if (comptime manifestDeclaresStore()) {
|
|
2736
2756
|
\\ var data_dir_buffer: [512]u8 = undefined;
|
|
2737
2757
|
\\ const app_data_dir = native_sdk.app_dirs.resolveOne(
|
|
@@ -2835,6 +2855,7 @@ fn runnerZig() []const u8 {
|
|
|
2835
2855
|
\\ .window_state_store = store,
|
|
2836
2856
|
\\ .record_store = options.record_store,
|
|
2837
2857
|
\\ .relational_store = options.relational_store,
|
|
2858
|
+
\\ .file_access = options.file_access,
|
|
2838
2859
|
\\ .environ = init.minimal.environ,
|
|
2839
2860
|
\\ });
|
|
2840
2861
|
\\
|
|
@@ -2891,6 +2912,7 @@ fn runnerZig() []const u8 {
|
|
|
2891
2912
|
\\ .window_state_store = store,
|
|
2892
2913
|
\\ .record_store = options.record_store,
|
|
2893
2914
|
\\ .relational_store = options.relational_store,
|
|
2915
|
+
\\ .file_access = options.file_access,
|
|
2894
2916
|
\\ .environ = init.minimal.environ,
|
|
2895
2917
|
\\ });
|
|
2896
2918
|
\\
|
|
@@ -2947,6 +2969,7 @@ fn runnerZig() []const u8 {
|
|
|
2947
2969
|
\\ .window_state_store = store,
|
|
2948
2970
|
\\ .record_store = options.record_store,
|
|
2949
2971
|
\\ .relational_store = options.relational_store,
|
|
2972
|
+
\\ .file_access = options.file_access,
|
|
2950
2973
|
\\ .environ = init.minimal.environ,
|
|
2951
2974
|
\\ });
|
|
2952
2975
|
\\
|
|
@@ -3003,6 +3026,7 @@ fn runnerZig() []const u8 {
|
|
|
3003
3026
|
\\ .window_state_store = store,
|
|
3004
3027
|
\\ .record_store = options.record_store,
|
|
3005
3028
|
\\ .relational_store = options.relational_store,
|
|
3029
|
+
\\ .file_access = options.file_access,
|
|
3006
3030
|
\\ .environ = init.minimal.environ,
|
|
3007
3031
|
\\ });
|
|
3008
3032
|
\\
|
|
@@ -4082,6 +4106,10 @@ test "writeDefaultApp emits Vite project files" {
|
|
|
4082
4106
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "relational_store: ?native_sdk.RelationalStoreBinding = null") != null);
|
|
4083
4107
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "fn manifestDeclaresSqlite()") != null);
|
|
4084
4108
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, ".relational_store = options.relational_store") != null);
|
|
4109
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "file_access: ?native_sdk.FileAccessBinding = null") != null);
|
|
4110
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "file_access_enforce: bool = true") != null);
|
|
4111
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "native_sdk.app_dirs.Buffers.fromArray") != null);
|
|
4112
|
+
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, ".file_access = options.file_access") != null);
|
|
4085
4113
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "resolvedShortcuts") != null);
|
|
4086
4114
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "const manifest_windows") != null);
|
|
4087
4115
|
try std.testing.expect(std.mem.indexOf(u8, runner_zig_text, "fn appInfo(self: RunOptions, buffers: *StateBuffers)") != null);
|
package/src/tooling/ts_core.zig
CHANGED
|
@@ -27,6 +27,7 @@ pub const Error = error{
|
|
|
27
27
|
MissingTranspiler,
|
|
28
28
|
BrokenToolchainInstall,
|
|
29
29
|
ToolchainVersionMismatch,
|
|
30
|
+
InvalidWindowViewLabel,
|
|
30
31
|
CoreCheckFailed,
|
|
31
32
|
DevHostFailed,
|
|
32
33
|
};
|
|
@@ -412,6 +413,48 @@ pub const PersistRoutes = struct {
|
|
|
412
413
|
err: []const u8,
|
|
413
414
|
};
|
|
414
415
|
|
|
416
|
+
/// Direct `src/windows/<label>.native` roots, sorted by label. Nested files
|
|
417
|
+
/// are import components, never independently addressable windows.
|
|
418
|
+
pub fn collectWindowViewLabels(allocator: std.mem.Allocator, io: std.Io, app_root: []const u8) ![][]const u8 {
|
|
419
|
+
const windows_path = try std.fs.path.join(allocator, &.{ app_root, "src", "windows" });
|
|
420
|
+
defer allocator.free(windows_path);
|
|
421
|
+
var cwd = std.Io.Dir.cwd();
|
|
422
|
+
var dir = cwd.openDir(io, windows_path, .{ .iterate = true }) catch return try allocator.alloc([]const u8, 0);
|
|
423
|
+
defer dir.close(io);
|
|
424
|
+
var labels: std.ArrayList([]const u8) = .empty;
|
|
425
|
+
errdefer {
|
|
426
|
+
for (labels.items) |label| allocator.free(label);
|
|
427
|
+
labels.deinit(allocator);
|
|
428
|
+
}
|
|
429
|
+
var it = dir.iterate();
|
|
430
|
+
while (try it.next(io)) |entry| {
|
|
431
|
+
if (entry.kind != .file or !std.mem.endsWith(u8, entry.name, ".native")) continue;
|
|
432
|
+
const label = entry.name[0 .. entry.name.len - ".native".len];
|
|
433
|
+
if (label.len == 0 or label.len > 64 or std.mem.eql(u8, label, ".") or std.mem.eql(u8, label, "..")) {
|
|
434
|
+
std.debug.print("invalid TypeScript secondary-window view filename '{s}': use src/windows/<label>.native with a non-empty label of at most 64 bytes\n", .{entry.name});
|
|
435
|
+
return error.InvalidWindowViewLabel;
|
|
436
|
+
}
|
|
437
|
+
for (label) |ch| {
|
|
438
|
+
if (ch == 0 or ch == '/' or ch == '\\') {
|
|
439
|
+
std.debug.print("invalid TypeScript secondary-window view filename '{s}': the filename stem must be a valid window label\n", .{entry.name});
|
|
440
|
+
return error.InvalidWindowViewLabel;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
try labels.append(allocator, try allocator.dupe(u8, label));
|
|
444
|
+
}
|
|
445
|
+
std.mem.sort([]const u8, labels.items, {}, struct {
|
|
446
|
+
fn lessThan(_: void, a: []const u8, b: []const u8) bool {
|
|
447
|
+
return std.mem.order(u8, a, b) == .lt;
|
|
448
|
+
}
|
|
449
|
+
}.lessThan);
|
|
450
|
+
return try labels.toOwnedSlice(allocator);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
pub fn freeWindowViewLabels(allocator: std.mem.Allocator, labels: [][]const u8) void {
|
|
454
|
+
for (labels) |label| allocator.free(label);
|
|
455
|
+
allocator.free(labels);
|
|
456
|
+
}
|
|
457
|
+
|
|
415
458
|
/// Run the real-SQLite schema/query lane used by the build and return the
|
|
416
459
|
/// generated SDK core path that exposes this app's Cmd.q/Sub.q surface.
|
|
417
460
|
/// Generated outputs live under ignored .native/cache. The append-only
|
|
@@ -487,6 +530,7 @@ pub fn checkCore(
|
|
|
487
530
|
persist_version: ?u64,
|
|
488
531
|
persist_routes: ?PersistRoutes,
|
|
489
532
|
sdk_core_path: ?[]const u8,
|
|
533
|
+
window_views: []const []const u8,
|
|
490
534
|
) !void {
|
|
491
535
|
const cli_path = try transpilerPath(allocator, io, framework_root, "src/cli.ts");
|
|
492
536
|
defer allocator.free(cli_path);
|
|
@@ -536,6 +580,8 @@ pub fn checkCore(
|
|
|
536
580
|
});
|
|
537
581
|
}
|
|
538
582
|
if (sdk_core_path) |sdk_core| try argv.appendSlice(allocator, &.{ "--sdk-core", sdk_core });
|
|
583
|
+
try argv.append(allocator, "--window-views");
|
|
584
|
+
for (window_views) |label| try argv.appendSlice(allocator, &.{ "--window-view", label });
|
|
539
585
|
var child = std.process.spawn(io, .{
|
|
540
586
|
.argv = argv.items,
|
|
541
587
|
.stdin = .ignore,
|
|
@@ -605,6 +651,7 @@ pub const DevHostOptions = struct {
|
|
|
605
651
|
watch: bool = false,
|
|
606
652
|
persist_routes: ?PersistRoutes = null,
|
|
607
653
|
service_packages: []const ServicePackage = &.{},
|
|
654
|
+
window_views: []const []const u8 = &.{},
|
|
608
655
|
};
|
|
609
656
|
|
|
610
657
|
/// `native dev --core`: the node dev-harness over src/core.ts — the
|
|
@@ -696,6 +743,8 @@ pub fn runDevHost(allocator: std.mem.Allocator, io: std.Io, framework_root: []co
|
|
|
696
743
|
for (options.permissions) |permission| {
|
|
697
744
|
try argv.appendSlice(allocator, &.{ "--permission", permission });
|
|
698
745
|
}
|
|
746
|
+
try argv.append(allocator, "--window-views");
|
|
747
|
+
for (options.window_views) |label| try argv.appendSlice(allocator, &.{ "--window-view", label });
|
|
699
748
|
if (sqlite_source) |sdk_core| {
|
|
700
749
|
try argv.appendSlice(allocator, &.{ "--sdk-core", sdk_core, "--sqlite-src", "src" });
|
|
701
750
|
}
|
|
@@ -954,6 +1003,40 @@ test "a stray package.json is not a language marker: detection keys on the core
|
|
|
954
1003
|
try std.testing.expectEqual(CoreTree.ts, detectAt(io, root));
|
|
955
1004
|
}
|
|
956
1005
|
|
|
1006
|
+
test "window view discovery includes only direct native roots and sorts labels" {
|
|
1007
|
+
const io = std.testing.io;
|
|
1008
|
+
var cwd = std.Io.Dir.cwd();
|
|
1009
|
+
const root = ".zig-cache/test-ts-window-view-labels";
|
|
1010
|
+
cwd.deleteTree(io, root) catch {};
|
|
1011
|
+
defer cwd.deleteTree(io, root) catch {};
|
|
1012
|
+
try cwd.createDirPath(io, root ++ "/src/windows/components");
|
|
1013
|
+
try cwd.writeFile(io, .{ .sub_path = root ++ "/src/windows/settings.native", .data = "<column/>" });
|
|
1014
|
+
try cwd.writeFile(io, .{ .sub_path = root ++ "/src/windows/about.native", .data = "<column/>" });
|
|
1015
|
+
try cwd.writeFile(io, .{ .sub_path = root ++ "/src/windows/ignored.txt", .data = "" });
|
|
1016
|
+
try cwd.writeFile(io, .{ .sub_path = root ++ "/src/windows/components/shared.native", .data = "<template name=\"shared\"/>" });
|
|
1017
|
+
|
|
1018
|
+
const labels = try collectWindowViewLabels(std.testing.allocator, io, root);
|
|
1019
|
+
defer freeWindowViewLabels(std.testing.allocator, labels);
|
|
1020
|
+
try std.testing.expectEqual(@as(usize, 2), labels.len);
|
|
1021
|
+
try std.testing.expectEqualStrings("about", labels[0]);
|
|
1022
|
+
try std.testing.expectEqualStrings("settings", labels[1]);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
test "window view discovery rejects labels beyond the platform budget" {
|
|
1026
|
+
const io = std.testing.io;
|
|
1027
|
+
var cwd = std.Io.Dir.cwd();
|
|
1028
|
+
const root = ".zig-cache/test-ts-window-view-label-budget";
|
|
1029
|
+
cwd.deleteTree(io, root) catch {};
|
|
1030
|
+
defer cwd.deleteTree(io, root) catch {};
|
|
1031
|
+
try cwd.createDirPath(io, root ++ "/src/windows");
|
|
1032
|
+
try cwd.writeFile(io, .{
|
|
1033
|
+
.sub_path = root ++ "/src/windows/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.native",
|
|
1034
|
+
.data = "<column/>",
|
|
1035
|
+
});
|
|
1036
|
+
|
|
1037
|
+
try std.testing.expectError(error.InvalidWindowViewLabel, collectWindowViewLabels(std.testing.allocator, io, root));
|
|
1038
|
+
}
|
|
1039
|
+
|
|
957
1040
|
test "package.json version extraction" {
|
|
958
1041
|
try std.testing.expectEqualStrings("0.0.1", parsePackageVersion(
|
|
959
1042
|
\\{
|
package/tools/corewire/emit.zig
CHANGED
|
@@ -1764,7 +1764,7 @@ test "a u64 attestation on chrome geometry refuses at check time" {
|
|
|
1764
1764
|
// class cannot carry.
|
|
1765
1765
|
const source =
|
|
1766
1766
|
\\{
|
|
1767
|
-
\\ "format": 1, "wire_version":
|
|
1767
|
+
\\ "format": 1, "wire_version": 7, "abi_version": 2,
|
|
1768
1768
|
\\ "compiler_version": "0.0.1", "entry": "src/core.ts",
|
|
1769
1769
|
\\ "source_hash": "00000000c0ffee00", "build_id": "00000000b01dface", "model_fingerprint": "00000000a11ce001",
|
|
1770
1770
|
\\ "types": {
|
|
@@ -1945,7 +1945,7 @@ test "a shared authored type spelling like a synthesized name stays a top-level
|
|
|
1945
1945
|
// first site would leave the second dangling.
|
|
1946
1946
|
const source =
|
|
1947
1947
|
\\{
|
|
1948
|
-
\\ "format": 1, "wire_version":
|
|
1948
|
+
\\ "format": 1, "wire_version": 7, "abi_version": 2,
|
|
1949
1949
|
\\ "compiler_version": "0.0.1", "entry": "src/core.ts",
|
|
1950
1950
|
\\ "source_hash": "00000000c0ffee00", "build_id": "00000000b01dface", "model_fingerprint": "00000000a11ce001",
|
|
1951
1951
|
\\ "types": {
|
|
@@ -2381,7 +2381,7 @@ test "a chrome arm holding its insets by reference refuses" {
|
|
|
2381
2381
|
// node (by-reference) insets record cannot take that construction.
|
|
2382
2382
|
const source =
|
|
2383
2383
|
\\{
|
|
2384
|
-
\\ "format": 1, "wire_version":
|
|
2384
|
+
\\ "format": 1, "wire_version": 7, "abi_version": 2,
|
|
2385
2385
|
\\ "compiler_version": "0.0.1", "entry": "src/core.ts",
|
|
2386
2386
|
\\ "source_hash": "00000000c0ffee00", "build_id": "00000000b01dface", "model_fingerprint": "00000000a11ce001",
|
|
2387
2387
|
\\ "types": {
|
|
@@ -2663,7 +2663,7 @@ const FacadeEmitter = struct {
|
|
|
2663
2663
|
\\// ---------------------------------------------------- the cmd wire
|
|
2664
2664
|
\\// Encoder for the inert Cmd data the author's update returns —
|
|
2665
2665
|
\\// byte-for-byte the layouts the host's command decoder expects
|
|
2666
|
-
\\// (cmd_format_version
|
|
2666
|
+
\\// (cmd_format_version 7). nscfTagOf maps a Msg arm name onto its
|
|
2667
2667
|
\\// declaration-order wire tag.
|
|
2668
2668
|
\\
|
|
2669
2669
|
\\const nscfFetchMethods = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"];
|
|
@@ -2772,6 +2772,56 @@ const FacadeEmitter = struct {
|
|
|
2772
2772
|
\\ nscfWBytes(sink, cmd.path);
|
|
2773
2773
|
\\ nscfWBytes(sink, cmd.bytes);
|
|
2774
2774
|
\\ return;
|
|
2775
|
+
\\ case "append_file":
|
|
2776
|
+
\\ nscfWU8(sink, 0x2b);
|
|
2777
|
+
\\ nscfWShortText(sink, cmd.key);
|
|
2778
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.okKind));
|
|
2779
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.errKind));
|
|
2780
|
+
\\ nscfWBytes(sink, cmd.path);
|
|
2781
|
+
\\ nscfWBytes(sink, cmd.bytes);
|
|
2782
|
+
\\ return;
|
|
2783
|
+
\\ case "stat_file":
|
|
2784
|
+
\\ nscfWU8(sink, 0x2c);
|
|
2785
|
+
\\ nscfWShortText(sink, cmd.key);
|
|
2786
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.okKind));
|
|
2787
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.errKind));
|
|
2788
|
+
\\ nscfWBytes(sink, cmd.path);
|
|
2789
|
+
\\ return;
|
|
2790
|
+
\\ case "delete_file":
|
|
2791
|
+
\\ nscfWU8(sink, 0x32);
|
|
2792
|
+
\\ nscfWShortText(sink, cmd.key);
|
|
2793
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.okKind));
|
|
2794
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.errKind));
|
|
2795
|
+
\\ nscfWBytes(sink, cmd.path);
|
|
2796
|
+
\\ return;
|
|
2797
|
+
\\ case "read_file_stream":
|
|
2798
|
+
\\ nscfWU8(sink, 0x2d);
|
|
2799
|
+
\\ nscfWShortText(sink, cmd.key);
|
|
2800
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.chunkKind));
|
|
2801
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.doneKind));
|
|
2802
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.errKind));
|
|
2803
|
+
\\ nscfWBytes(sink, cmd.path);
|
|
2804
|
+
\\ return;
|
|
2805
|
+
\\ case "write_file_stream":
|
|
2806
|
+
\\ nscfWU8(sink, 0x2e);
|
|
2807
|
+
\\ nscfWShortText(sink, cmd.key);
|
|
2808
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.okKind));
|
|
2809
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.errKind));
|
|
2810
|
+
\\ nscfWBytes(sink, cmd.path);
|
|
2811
|
+
\\ return;
|
|
2812
|
+
\\ case "write_file_chunk":
|
|
2813
|
+
\\ nscfWU8(sink, 0x2f);
|
|
2814
|
+
\\ nscfWShortText(sink, cmd.key);
|
|
2815
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.okKind));
|
|
2816
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.errKind));
|
|
2817
|
+
\\ nscfWBytes(sink, cmd.bytes);
|
|
2818
|
+
\\ return;
|
|
2819
|
+
\\ case "write_file_close":
|
|
2820
|
+
\\ nscfWU8(sink, 0x30);
|
|
2821
|
+
\\ nscfWShortText(sink, cmd.key);
|
|
2822
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.okKind));
|
|
2823
|
+
\\ nscfWU8(sink, nscfTagOf(cmd.errKind));
|
|
2824
|
+
\\ return;
|
|
2775
2825
|
\\ case "fetch": {
|
|
2776
2826
|
\\ nscfWU8(sink, 0x09);
|
|
2777
2827
|
\\ nscfWShortText(sink, cmd.key);
|
|
@@ -2999,10 +3049,20 @@ const FacadeEmitter = struct {
|
|
|
2999
3049
|
\\ nscfWShortText(sink, cmd.key);
|
|
3000
3050
|
\\ return;
|
|
3001
3051
|
\\ case "show_notification":
|
|
3002
|
-
\\
|
|
3003
|
-
\\
|
|
3004
|
-
\\
|
|
3005
|
-
\\
|
|
3052
|
+
\\ if (cmd.id.length === 0 && cmd.actionLabel.length === 0 && cmd.actionCommand.length === 0) {
|
|
3053
|
+
\\ nscfWU8(sink, 0x1d);
|
|
3054
|
+
\\ nscfWBytes(sink, cmd.title);
|
|
3055
|
+
\\ nscfWBytes(sink, cmd.subtitle);
|
|
3056
|
+
\\ nscfWBytes(sink, cmd.body);
|
|
3057
|
+
\\ } else {
|
|
3058
|
+
\\ nscfWU8(sink, 0x31);
|
|
3059
|
+
\\ nscfWBytes(sink, cmd.id);
|
|
3060
|
+
\\ nscfWBytes(sink, cmd.title);
|
|
3061
|
+
\\ nscfWBytes(sink, cmd.subtitle);
|
|
3062
|
+
\\ nscfWBytes(sink, cmd.body);
|
|
3063
|
+
\\ nscfWBytes(sink, cmd.actionLabel);
|
|
3064
|
+
\\ nscfWBytes(sink, cmd.actionCommand);
|
|
3065
|
+
\\ }
|
|
3006
3066
|
\\ return;
|
|
3007
3067
|
\\ case "audio_capture_start":
|
|
3008
3068
|
\\ nscfWU8(sink, 0x1e);
|