@native-sdk/cli 0.8.4 → 0.9.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 +859 -62
- package/build.zig +543 -13
- package/build.zig.zon +1 -0
- package/native-sdk.d.ts +2 -0
- package/package.json +12 -11
- package/packages/core/compile-surface/core.ts +365 -2
- package/packages/core/package-lock.json +11 -11
- package/packages/core/package.json +2 -2
- package/packages/core/scripts/compiler_typecheck.mjs +116 -15
- package/packages/core/scripts/gen_service_surface.mjs +268 -0
- package/packages/core/scripts/npm_static_spike.mjs +64 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +77 -6
- package/packages/core/scripts/run_external_service_compiler.mjs +240 -0
- package/packages/core/scripts/stage_external_core.mjs +9 -1
- package/packages/core/scripts/stage_external_services.mjs +172 -0
- package/packages/core/scripts/surface_manifest_diff.mjs +253 -0
- package/packages/core/scripts/vendor_service_packages.mjs +189 -0
- package/packages/core/sdk/core.d.ts +149 -0
- package/packages/core/sdk/core.ts +529 -12
- package/packages/core/sdk/events.d.ts +36 -0
- package/packages/core/sdk/events.ts +57 -0
- package/packages/core/src/checker.ts +468 -15
- package/packages/core/src/cli.ts +143 -3
- package/packages/core/src/contract.ts +26 -5
- package/packages/core/src/devhost.ts +1847 -16
- package/packages/core/src/devhost_journal.mjs +181 -0
- package/packages/core/src/devhost_resolver.mjs +17 -1
- package/packages/core/src/devhost_service_worker.mjs +90 -0
- package/packages/core/src/diagnostics.ts +82 -16
- package/packages/core/src/frontend.ts +204 -34
- package/packages/core/src/modules.ts +129 -80
- package/packages/core/src/service_contract.ts +597 -0
- package/packages/core/src/sqlite_cli.ts +93 -0
- package/packages/core/src/sqlite_codegen.ts +806 -0
- package/packages/core/src/sqlite_runtime_policy.ts +364 -0
- package/packages/core/src/typed_ast.ts +36 -8
- package/skill-data/core/references/project-anatomy.md +1 -1
- package/skill-data/native-ui/SKILL.md +47 -0
- package/skill-data/ts-core/SKILL.md +80 -31
- package/skill-data/ts-services/SKILL.md +126 -0
- package/skill-data/ts-services/references/service-surface.md +603 -0
- package/skill-data/zig/SKILL.md +1 -1
- package/skills/native-sdk/SKILL.md +1 -1
- package/src/app_runner/no_migrations.zig +3 -0
- package/src/app_runner/no_services.zig +20 -0
- package/src/app_runner/root.zig +104 -4
- package/src/app_runner/ts_core_main.zig +249 -8
- package/src/automation/snapshot.zig +23 -5
- package/src/embed/app_exports.zig +11 -1
- package/src/embed/c_api.zig +48 -2
- package/src/embed/conversions.zig +4 -5
- package/src/embed/host.zig +109 -1
- package/src/embed/root.zig +7 -0
- package/src/embed/tests.zig +213 -0
- package/src/embed/types.zig +51 -0
- package/src/embed/ui_host.zig +119 -5
- package/src/platform/android/NativeSdkActivity.java +131 -0
- package/src/platform/android/android_host.c +182 -1
- package/src/platform/android/native_sdk_app.h +17 -0
- package/src/platform/ios/native_sdk_app.h +17 -0
- package/src/platform/ios/uikit_host.m +115 -0
- package/src/platform/linux/cef_host.cpp +1 -1
- package/src/platform/linux/gtk_host.c +89 -17
- package/src/platform/linux/gtk_host.h +3 -0
- package/src/platform/linux/root.zig +40 -18
- package/src/platform/macos/appkit_host.h +16 -3
- package/src/platform/macos/appkit_host.m +536 -36
- package/src/platform/macos/cef_host.mm +248 -36
- package/src/platform/macos/root.zig +244 -34
- package/src/platform/null_platform.zig +223 -19
- package/src/platform/null_platform_tests.zig +74 -0
- package/src/platform/root.zig +9 -0
- package/src/platform/types.zig +179 -15
- package/src/platform/windows/root.zig +187 -21
- package/src/platform/windows/webview2_host.cpp +293 -46
- package/src/primitives/app_manifest/comptime_scene.zig +2 -0
- package/src/primitives/app_manifest/root.zig +4 -0
- package/src/primitives/app_manifest/tests.zig +3 -0
- package/src/primitives/app_manifest/types.zig +32 -0
- package/src/primitives/app_manifest/validation.zig +19 -1
- package/src/root.zig +46 -0
- package/src/runtime/api.zig +11 -0
- package/src/runtime/automation_snapshot.zig +4 -0
- package/src/runtime/bridge_permission_tests.zig +23 -2
- package/src/runtime/bridge_responses.zig +3 -1
- package/src/runtime/canvas_frame.zig +18 -11
- package/src/runtime/canvas_frame_animation_tests.zig +4 -0
- package/src/runtime/clock.zig +13 -1
- package/src/runtime/core.zig +133 -1
- package/src/runtime/credentials_store.zig +115 -0
- package/src/runtime/effects.zig +2295 -113
- package/src/runtime/effects_credentials_tests.zig +332 -0
- package/src/runtime/effects_host_tests.zig +208 -1
- package/src/runtime/effects_relational_tests.zig +314 -0
- package/src/runtime/effects_store_tests.zig +211 -0
- package/src/runtime/flow.zig +14 -1
- package/src/runtime/gpu_surface_events.zig +6 -1
- package/src/runtime/native_command_event_tests.zig +42 -0
- package/src/runtime/persist_store.zig +666 -0
- package/src/runtime/record_store.zig +788 -0
- package/src/runtime/relational_store.zig +854 -0
- package/src/runtime/root.zig +49 -0
- package/src/runtime/runtime_event_tests.zig +70 -0
- package/src/runtime/service_host.zig +711 -0
- package/src/runtime/service_pool.zig +1314 -0
- package/src/runtime/session_blobs.zig +1 -1
- package/src/runtime/session_journal.zig +102 -0
- package/src/runtime/session_record.zig +177 -0
- package/src/runtime/session_replay.zig +109 -4
- package/src/runtime/shell_layout.zig +1 -0
- package/src/runtime/shell_layout_tests.zig +120 -0
- package/src/runtime/sqlite_engine.zig +474 -0
- package/src/runtime/state.zig +6 -0
- package/src/runtime/system_services.zig +49 -10
- package/src/runtime/tests.zig +4 -0
- package/src/runtime/ts_core_host.zig +788 -86
- package/src/runtime/ts_core_host_tests.zig +231 -11
- package/src/runtime/ts_ui_app.zig +499 -1
- package/src/runtime/ui_app.zig +142 -16
- package/src/runtime/ui_app_tests.zig +155 -5
- package/src/runtime/validation.zig +22 -0
- package/src/runtime/view.zig +9 -0
- package/src/runtime/window_storage.zig +1 -0
- package/src/runtime/window_view_runtime.zig +2 -3
- package/src/runtime/window_views.zig +19 -0
- package/src/tooling/android.zig +21 -16
- package/src/tooling/db.zig +160 -0
- package/src/tooling/ios.zig +7 -1
- package/src/tooling/manifest.zig +214 -2
- package/src/tooling/package.zig +116 -0
- package/src/tooling/raw_manifest.zig +30 -0
- package/src/tooling/root.zig +1 -0
- package/src/tooling/templates.zig +161 -4
- package/src/tooling/ts_core.zig +283 -17
- package/src/tooling/verbs.zig +7 -0
- package/third_party/sqlite/README.md +13 -0
- package/third_party/sqlite/sqlite3.c +269649 -0
- package/third_party/sqlite/sqlite3.h +14349 -0
- package/tools/corewire/core_abi.zig +14 -2
- package/tools/corewire/emit.zig +98 -29
- package/tools/corewire/emit_facade.zig +378 -23
- package/tools/corewire/emit_profile.zig +6 -2
- package/tools/corewire/emit_service.zig +924 -0
- package/tools/corewire/main.zig +122 -0
- package/tools/corewire/service_contract.zig +250 -0
- package/tools/corewire/sidecar.zig +26 -15
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const std = @import("std");
|
|
2
|
+
const credentials_store = @import("credentials_store.zig");
|
|
2
3
|
const json = @import("json");
|
|
3
4
|
const validation = @import("validation.zig");
|
|
4
5
|
const bridge_payload = @import("bridge_payload.zig");
|
|
@@ -88,31 +89,59 @@ pub fn RuntimeSystemServices(comptime Runtime: type) type {
|
|
|
88
89
|
|
|
89
90
|
pub fn setCredential(self: *Runtime, credential: platform.Credential) anyerror!void {
|
|
90
91
|
try validateCredential(credential);
|
|
91
|
-
|
|
92
|
+
const execution = credentials_store.execute(.{
|
|
93
|
+
.services = &self.options.platform.services,
|
|
94
|
+
.service = credential.service,
|
|
95
|
+
.permitted = true,
|
|
96
|
+
}, .set, credential.account, credential.secret, &.{});
|
|
97
|
+
try credentialOutcome(execution.outcome);
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
pub fn getCredential(self: *Runtime, key: platform.CredentialKey, buffer: []u8) anyerror!?[]const u8 {
|
|
95
101
|
try validateCredentialKey(key);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
const execution = credentials_store.execute(.{
|
|
103
|
+
.services = &self.options.platform.services,
|
|
104
|
+
.service = key.service,
|
|
105
|
+
.permitted = true,
|
|
106
|
+
}, .get, key.account, "", buffer);
|
|
107
|
+
if (execution.outcome == .miss) return null;
|
|
108
|
+
try credentialOutcome(execution.outcome);
|
|
109
|
+
return buffer[0..execution.len];
|
|
100
110
|
}
|
|
101
111
|
|
|
102
112
|
pub fn deleteCredential(self: *Runtime, key: platform.CredentialKey) anyerror!bool {
|
|
103
113
|
try validateCredentialKey(key);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
114
|
+
const execution = credentials_store.execute(.{
|
|
115
|
+
.services = &self.options.platform.services,
|
|
116
|
+
.service = key.service,
|
|
117
|
+
.permitted = true,
|
|
118
|
+
}, .delete, key.account, "", &.{});
|
|
119
|
+
if (execution.outcome == .miss) return false;
|
|
120
|
+
try credentialOutcome(execution.outcome);
|
|
108
121
|
return true;
|
|
109
122
|
}
|
|
110
123
|
|
|
124
|
+
fn credentialOutcome(outcome: credentials_store.Outcome) anyerror!void {
|
|
125
|
+
return switch (outcome) {
|
|
126
|
+
.ok => {},
|
|
127
|
+
.miss => error.CredentialNotFound,
|
|
128
|
+
.locked => error.UnsupportedService,
|
|
129
|
+
.denied => error.PermissionDenied,
|
|
130
|
+
.over_bound => error.CredentialFieldTooLarge,
|
|
131
|
+
.io_failed, .rejected => error.CredentialStoreFailed,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
pub fn formatLocalTime(self: *Runtime, timestamp_ms: i64, style: platform.LocalTimeStyle, buffer: []u8) anyerror![]const u8 {
|
|
136
|
+
return self.options.platform.services.formatLocalTime(timestamp_ms, style, buffer);
|
|
137
|
+
}
|
|
138
|
+
|
|
111
139
|
pub fn createTray(self: *Runtime, options: platform.TrayOptions) anyerror!void {
|
|
112
140
|
try validateTrayOptions(options);
|
|
113
141
|
try self.options.platform.services.createTray(options);
|
|
114
142
|
try storeTrayItems(self, options.items);
|
|
115
|
-
|
|
143
|
+
const title = if (options.presentation.title.len > 0) options.presentation.title else options.title;
|
|
144
|
+
self.tray_title = try copyInto(&self.tray_title_storage, title);
|
|
116
145
|
self.tray_created = true;
|
|
117
146
|
}
|
|
118
147
|
|
|
@@ -132,6 +161,12 @@ pub fn RuntimeSystemServices(comptime Runtime: type) type {
|
|
|
132
161
|
self.tray_title = try copyInto(&self.tray_title_storage, title);
|
|
133
162
|
}
|
|
134
163
|
|
|
164
|
+
pub fn updateTrayPresentation(self: *Runtime, presentation: platform.TrayPresentation) anyerror!void {
|
|
165
|
+
try validation.validateTrayPresentation(presentation);
|
|
166
|
+
try self.options.platform.services.updateTrayPresentation(presentation);
|
|
167
|
+
self.tray_title = try copyInto(&self.tray_title_storage, presentation.title);
|
|
168
|
+
}
|
|
169
|
+
|
|
135
170
|
pub fn removeTray(self: *Runtime) anyerror!void {
|
|
136
171
|
try self.options.platform.services.removeTray();
|
|
137
172
|
self.tray_item_count = 0;
|
|
@@ -369,8 +404,12 @@ fn storeTrayItems(self: anytype, items: []const platform.TrayMenuItem) !void {
|
|
|
369
404
|
self.tray_items[index].id = item.id;
|
|
370
405
|
self.tray_items[index].command = try copyInto(&self.tray_items[index].command_storage, item.command);
|
|
371
406
|
self.tray_items[index].label = try copyInto(&self.tray_items[index].label_storage, item.label);
|
|
407
|
+
self.tray_items[index].detail = try copyInto(&self.tray_items[index].detail_storage, item.detail);
|
|
372
408
|
self.tray_items[index].separator = item.separator;
|
|
373
409
|
self.tray_items[index].enabled = item.enabled;
|
|
410
|
+
self.tray_items[index].role = item.role;
|
|
411
|
+
self.tray_items[index].key = try copyInto(&self.tray_items[index].key_storage, item.key);
|
|
412
|
+
self.tray_items[index].modifiers = item.modifiers;
|
|
374
413
|
}
|
|
375
414
|
self.tray_item_count = items.len;
|
|
376
415
|
}
|
package/src/runtime/tests.zig
CHANGED
|
@@ -27,6 +27,9 @@ test {
|
|
|
27
27
|
_ = @import("effects_image_tests.zig");
|
|
28
28
|
_ = @import("effects_channel_tests.zig");
|
|
29
29
|
_ = @import("effects_host_tests.zig");
|
|
30
|
+
_ = @import("effects_credentials_tests.zig");
|
|
31
|
+
_ = @import("effects_store_tests.zig");
|
|
32
|
+
_ = @import("effects_relational_tests.zig");
|
|
30
33
|
_ = @import("effects_pty_tests.zig");
|
|
31
34
|
_ = @import("terminal_session_tests.zig");
|
|
32
35
|
_ = @import("pty.zig");
|
|
@@ -38,6 +41,7 @@ test {
|
|
|
38
41
|
_ = @import("platform_bridge_tests.zig");
|
|
39
42
|
_ = @import("session_journal.zig");
|
|
40
43
|
_ = @import("session_blobs.zig");
|
|
44
|
+
_ = @import("persist_store.zig");
|
|
41
45
|
_ = @import("session_record.zig");
|
|
42
46
|
_ = @import("session_tests.zig");
|
|
43
47
|
}
|