@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
|
@@ -394,7 +394,7 @@ test "profile emission is deterministic and carries the library-mode surface" {
|
|
|
394
394
|
// declares the SDK's emission path, identity-getter symbols, the
|
|
395
395
|
// facade's designated entries, and the integer-slot declarations.
|
|
396
396
|
try testing.expect(std.mem.indexOf(u8, first, "\"path\": \"core.contract.json\"") != null);
|
|
397
|
-
try testing.expect(std.mem.indexOf(u8, first, "\"wire_version\":
|
|
397
|
+
try testing.expect(std.mem.indexOf(u8, first, "\"wire_version\": 7") != null);
|
|
398
398
|
try testing.expect(std.mem.indexOf(u8, first, "\"build_id_symbol\": \"nsc_core_build_id\"") != null);
|
|
399
399
|
try testing.expect(std.mem.indexOf(u8, first, "\"abi_version_symbol\": \"nsc_core_abi_version\"") != null);
|
|
400
400
|
try testing.expect(std.mem.indexOf(u8, first, "\"init_export\": \"init\"") != null);
|
|
@@ -440,7 +440,7 @@ test "the profile tracks the contract's prefix and generations" {
|
|
|
440
440
|
defer arena_state.deinit();
|
|
441
441
|
const arena = arena_state.allocator();
|
|
442
442
|
var source = try std.mem.replaceOwned(u8, arena, sidecar_mod.minimal_valid_json, "\"prefix\": \"nsc_core_\"", "\"prefix\": \"app2_\"");
|
|
443
|
-
source = try std.mem.replaceOwned(u8, arena, source, "\"wire_version\":
|
|
443
|
+
source = try std.mem.replaceOwned(u8, arena, source, "\"wire_version\": 7", "\"wire_version\": 7");
|
|
444
444
|
const generated = try profileFromJson(arena, source, "my_facade.ts");
|
|
445
445
|
try testing.expect(std.mem.indexOf(u8, generated, "\"entry\": \"my_facade.ts\"") != null);
|
|
446
446
|
try testing.expect(std.mem.indexOf(u8, generated, "\"prefix\": \"app2_\"") != null);
|
|
@@ -860,7 +860,7 @@ test "service projection derives host dispatch and registry from one contract" {
|
|
|
860
860
|
const contract: service.Contract = .{
|
|
861
861
|
.format = 3,
|
|
862
862
|
.protocol_version = 3,
|
|
863
|
-
.compiler_version = "
|
|
863
|
+
.compiler_version = "1.2.3",
|
|
864
864
|
.deterministic = false,
|
|
865
865
|
.packages = &.{},
|
|
866
866
|
.types = .{ .records = &.{}, .enums = &.{}, .unions = &.{} },
|
|
@@ -901,7 +901,7 @@ test "service projection derives host dispatch and registry from one contract" {
|
|
|
901
901
|
try std.testing.expect(std.mem.indexOf(u8, registry, ".name = \"feeds.parse\", .index = 0") != null);
|
|
902
902
|
try std.testing.expect(std.mem.indexOf(u8, registry, "0 => true") != null);
|
|
903
903
|
try std.testing.expect(std.mem.indexOf(u8, registry, "copyServiceBytes(bytes)") != null);
|
|
904
|
-
try std.testing.expect(std.mem.indexOf(u8, registry, "pub const compiler_version = \"
|
|
904
|
+
try std.testing.expect(std.mem.indexOf(u8, registry, "pub const compiler_version = \"1.2.3\"") != null);
|
|
905
905
|
try std.testing.expect(std.mem.indexOf(u8, registry, "pub const contract_fingerprint = [_]u8{") != null);
|
|
906
906
|
|
|
907
907
|
const client = try emitClient(std.testing.allocator, contract);
|
|
@@ -216,7 +216,7 @@ test "service contract validates typed operations and authority attestation" {
|
|
|
216
216
|
defer arena_state.deinit();
|
|
217
217
|
const arena = arena_state.allocator();
|
|
218
218
|
const good =
|
|
219
|
-
\\{"format":3,"protocol_version":3,"compiler_version":"
|
|
219
|
+
\\{"format":3,"protocol_version":3,"compiler_version":"1.2.3","deterministic":false,"packages":[],"types":{"records":[],"enums":[],"unions":[]},"operations":[{"name":"feeds.parse","client":"feedsParse","module":"src/services/feeds.ts","export":"parse","request":{"kind":"bytes"},"result":{"kind":"bytes"},"deadline_ms":null,"cancellable":false,"stream":null,"source_hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]}
|
|
220
220
|
;
|
|
221
221
|
var diagnostics: [512]u8 = undefined;
|
|
222
222
|
var writer = std.Io.Writer.fixed(&diagnostics);
|
|
@@ -225,7 +225,7 @@ test "service contract validates typed operations and authority attestation" {
|
|
|
225
225
|
try std.testing.expectEqualStrings("feeds.parse", contract.operations[0].name);
|
|
226
226
|
|
|
227
227
|
const dollar =
|
|
228
|
-
\\{"format":3,"protocol_version":3,"compiler_version":"
|
|
228
|
+
\\{"format":3,"protocol_version":3,"compiler_version":"1.2.3","deterministic":false,"packages":[],"types":{"records":[],"enums":[],"unions":[]},"operations":[{"name":"feeds.$parse","client":"feeds$parse","module":"src/services/feeds.ts","export":"$parse","request":{"kind":"bytes"},"result":{"kind":"bytes"},"deadline_ms":null,"cancellable":true,"stream":null,"source_hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]}
|
|
229
229
|
;
|
|
230
230
|
var dollar_diagnostics: [512]u8 = undefined;
|
|
231
231
|
var dollar_writer = std.Io.Writer.fixed(&dollar_diagnostics);
|
|
@@ -233,7 +233,7 @@ test "service contract validates typed operations and authority attestation" {
|
|
|
233
233
|
try std.testing.expectEqualStrings("$parse", dollar_contract.operations[0].@"export");
|
|
234
234
|
|
|
235
235
|
const bad =
|
|
236
|
-
\\{"format":3,"protocol_version":3,"compiler_version":"
|
|
236
|
+
\\{"format":3,"protocol_version":3,"compiler_version":"1.2.3","deterministic":true,"packages":[],"types":{"records":[],"enums":[],"unions":[]},"operations":[{"name":"feeds.parse","client":"feedsParse","module":"src/services/feeds.ts","export":"parse","request":{"kind":"bytes"},"result":{"kind":"bytes"},"deadline_ms":null,"cancellable":false,"stream":null,"source_hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]}
|
|
237
237
|
;
|
|
238
238
|
var bad_diagnostics: [512]u8 = undefined;
|
|
239
239
|
var bad_writer = std.Io.Writer.fixed(&bad_diagnostics);
|
|
@@ -241,7 +241,7 @@ test "service contract validates typed operations and authority attestation" {
|
|
|
241
241
|
try std.testing.expect(std.mem.indexOf(u8, bad_writer.buffered(), "deterministic=true") != null);
|
|
242
242
|
|
|
243
243
|
const skewed =
|
|
244
|
-
\\{"format":3,"protocol_version":3,"compiler_version":"
|
|
244
|
+
\\{"format":3,"protocol_version":3,"compiler_version":"1.2.3","deterministic":false,"packages":[],"types":{"records":[],"enums":[],"unions":[]},"operations":[{"name":"other.parse","client":"otherParse","module":"src/services/feeds.ts","export":"parse","request":{"kind":"bytes"},"result":{"kind":"bytes"},"deadline_ms":null,"cancellable":false,"stream":null,"source_hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]}
|
|
245
245
|
;
|
|
246
246
|
var skewed_diagnostics: [512]u8 = undefined;
|
|
247
247
|
var skewed_writer = std.Io.Writer.fixed(&skewed_diagnostics);
|
|
@@ -34,7 +34,7 @@ pub const supported_format: i64 = 1;
|
|
|
34
34
|
/// The command-wire vocabulary generation the SDK's bridge speaks
|
|
35
35
|
/// (rt.zig `cmd_format_version`). A sidecar declaring a different
|
|
36
36
|
/// generation is refused at generate time.
|
|
37
|
-
pub const supported_wire_version: i64 =
|
|
37
|
+
pub const supported_wire_version: i64 = 7;
|
|
38
38
|
|
|
39
39
|
/// The C-ABI generation of the core entry points this generator binds
|
|
40
40
|
/// (core_abi.zig `abi_version`).
|
|
@@ -1832,7 +1832,7 @@ const testing = std.testing;
|
|
|
1832
1832
|
pub const minimal_valid_json =
|
|
1833
1833
|
\\{
|
|
1834
1834
|
\\ "format": 1,
|
|
1835
|
-
\\ "wire_version":
|
|
1835
|
+
\\ "wire_version": 7,
|
|
1836
1836
|
\\ "abi_version": 2,
|
|
1837
1837
|
\\ "compiler_version": "0.0.1",
|
|
1838
1838
|
\\ "entry": "src/core.ts",
|
|
@@ -2428,8 +2428,8 @@ test "unknown payload descriptor kinds refuse as reader-too-old" {
|
|
|
2428
2428
|
test "wire and abi version mismatches refuse with both values named" {
|
|
2429
2429
|
var arena_state = std.heap.ArenaAllocator.init(testing.allocator);
|
|
2430
2430
|
defer arena_state.deinit();
|
|
2431
|
-
const source = try replaced(arena_state.allocator(), minimal_valid_json, "\"wire_version\":
|
|
2432
|
-
try expectRefusal(source, "wire_version", "generation
|
|
2431
|
+
const source = try replaced(arena_state.allocator(), minimal_valid_json, "\"wire_version\": 7", "\"wire_version\": 8");
|
|
2432
|
+
try expectRefusal(source, "wire_version", "generation 7, the sidecar declares 8");
|
|
2433
2433
|
}
|
|
2434
2434
|
|
|
2435
2435
|
test "unknown fields warn and are ignored" {
|