@native-sdk/cli 0.8.4 → 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 +1178 -74
- package/build.zig +715 -17
- package/build.zig.zon +1 -0
- package/native-sdk.d.ts +10 -0
- package/package.json +12 -11
- package/packages/core/compile-surface/core.ts +435 -3
- 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/merge_static_archives.mjs +78 -0
- package/packages/core/scripts/npm_static_spike.mjs +64 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +122 -6
- package/packages/core/scripts/run_external_service_compiler.mjs +280 -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 +224 -0
- package/packages/core/sdk/core.ts +694 -22
- package/packages/core/sdk/events.d.ts +89 -0
- package/packages/core/sdk/events.ts +128 -0
- package/packages/core/src/checker.ts +936 -15
- package/packages/core/src/cli.ts +156 -3
- package/packages/core/src/contract.ts +28 -5
- package/packages/core/src/devhost.ts +1876 -16
- package/packages/core/src/devhost_journal.mjs +183 -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 +179 -22
- package/packages/core/src/frontend.ts +210 -34
- package/packages/core/src/infer.ts +24 -0
- 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/automation/SKILL.md +1 -1
- package/skill-data/core/references/project-anatomy.md +1 -1
- package/skill-data/native-ui/SKILL.md +58 -5
- package/skill-data/ts-core/SKILL.md +123 -41
- package/skill-data/ts-services/SKILL.md +126 -0
- package/skill-data/ts-services/references/service-surface.md +604 -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 +133 -4
- package/src/app_runner/ts_core_main.zig +254 -8
- package/src/app_runner/ts_core_mobile.zig +241 -0
- package/src/automation/protocol.zig +5 -1
- package/src/automation/snapshot.zig +31 -11
- package/src/embed/app_exports.zig +12 -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 +8 -0
- package/src/embed/tests.zig +241 -0
- package/src/embed/types.zig +51 -0
- package/src/embed/ui_host.zig +185 -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 +8 -2
- package/src/platform/linux/gtk_host.c +289 -22
- package/src/platform/linux/gtk_host.h +5 -1
- package/src/platform/linux/root.zig +109 -22
- package/src/platform/macos/appkit_host.h +24 -7
- package/src/platform/macos/appkit_host.m +686 -64
- package/src/platform/macos/cef_host.mm +400 -66
- package/src/platform/macos/root.zig +304 -47
- package/src/platform/null_platform.zig +435 -48
- package/src/platform/null_platform_tests.zig +113 -0
- package/src/platform/root.zig +19 -0
- package/src/platform/types.zig +281 -28
- package/src/platform/windows/root.zig +207 -27
- package/src/platform/windows/webview2_host.cpp +334 -51
- 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 +53 -0
- package/src/runtime/api.zig +19 -0
- package/src/runtime/automation_commands.zig +35 -2
- package/src/runtime/automation_snapshot.zig +32 -20
- package/src/runtime/bridge_permission_tests.zig +58 -3
- package/src/runtime/bridge_responses.zig +4 -2
- package/src/runtime/builtin_bridge.zig +11 -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 +145 -7
- package/src/runtime/credentials_store.zig +115 -0
- package/src/runtime/effects.zig +3701 -231
- package/src/runtime/effects_credentials_tests.zig +332 -0
- package/src/runtime/effects_file_tests.zig +587 -0
- package/src/runtime/effects_host_tests.zig +208 -1
- package/src/runtime/effects_notification_tests.zig +11 -0
- package/src/runtime/effects_relational_tests.zig +314 -0
- package/src/runtime/effects_store_tests.zig +211 -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 +35 -10
- package/src/runtime/gpu_surface_events.zig +6 -1
- package/src/runtime/native_command_event_tests.zig +86 -2
- package/src/runtime/persist_store.zig +666 -0
- package/src/runtime/pty.zig +5 -2
- package/src/runtime/record_store.zig +788 -0
- package/src/runtime/relational_store.zig +854 -0
- package/src/runtime/root.zig +54 -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 +4 -1
- package/src/runtime/session_journal.zig +158 -5
- package/src/runtime/session_record.zig +215 -0
- package/src/runtime/session_replay.zig +206 -11
- package/src/runtime/session_tests.zig +81 -0
- 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 +16 -0
- package/src/runtime/system_services.zig +170 -38
- package/src/runtime/tests.zig +4 -0
- package/src/runtime/ts_core_host.zig +1067 -95
- package/src/runtime/ts_core_host_tests.zig +325 -11
- package/src/runtime/ts_ui_app.zig +953 -2
- package/src/runtime/ui_app.zig +434 -96
- package/src/runtime/ui_app_tests.zig +287 -11
- package/src/runtime/ui_app_window_tests.zig +61 -7
- package/src/runtime/validation.zig +42 -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 +189 -4
- package/src/tooling/ts_core.zig +366 -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 +442 -27
- 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");
|
|
@@ -25,8 +26,14 @@ const validateRevealPath = validation.validateRevealPath;
|
|
|
25
26
|
const validateSaveDialogOptions = validation.validateSaveDialogOptions;
|
|
26
27
|
const validateTrayMenuItems = validation.validateTrayMenuItems;
|
|
27
28
|
const validateTrayOptions = validation.validateTrayOptions;
|
|
29
|
+
const validateTrayShell = validation.validateTrayShell;
|
|
28
30
|
const validateTrayTitle = validation.validateTrayTitle;
|
|
29
31
|
|
|
32
|
+
fn optionalNotificationString(payload: []const u8, field: []const u8, storage: *json.StringStorage) ![]const u8 {
|
|
33
|
+
if (json.fieldValue(payload, field) == null) return "";
|
|
34
|
+
return jsonStringField(payload, field, storage) orelse error.InvalidNotificationOptions;
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
pub fn RuntimeSystemServices(comptime Runtime: type) type {
|
|
31
38
|
return struct {
|
|
32
39
|
pub fn readClipboard(self: *Runtime, buffer: []u8) anyerror![]const u8 {
|
|
@@ -88,71 +95,160 @@ pub fn RuntimeSystemServices(comptime Runtime: type) type {
|
|
|
88
95
|
|
|
89
96
|
pub fn setCredential(self: *Runtime, credential: platform.Credential) anyerror!void {
|
|
90
97
|
try validateCredential(credential);
|
|
91
|
-
|
|
98
|
+
const execution = credentials_store.execute(.{
|
|
99
|
+
.services = &self.options.platform.services,
|
|
100
|
+
.service = credential.service,
|
|
101
|
+
.permitted = true,
|
|
102
|
+
}, .set, credential.account, credential.secret, &.{});
|
|
103
|
+
try credentialOutcome(execution.outcome);
|
|
92
104
|
}
|
|
93
105
|
|
|
94
106
|
pub fn getCredential(self: *Runtime, key: platform.CredentialKey, buffer: []u8) anyerror!?[]const u8 {
|
|
95
107
|
try validateCredentialKey(key);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
const execution = credentials_store.execute(.{
|
|
109
|
+
.services = &self.options.platform.services,
|
|
110
|
+
.service = key.service,
|
|
111
|
+
.permitted = true,
|
|
112
|
+
}, .get, key.account, "", buffer);
|
|
113
|
+
if (execution.outcome == .miss) return null;
|
|
114
|
+
try credentialOutcome(execution.outcome);
|
|
115
|
+
return buffer[0..execution.len];
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
pub fn deleteCredential(self: *Runtime, key: platform.CredentialKey) anyerror!bool {
|
|
103
119
|
try validateCredentialKey(key);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
120
|
+
const execution = credentials_store.execute(.{
|
|
121
|
+
.services = &self.options.platform.services,
|
|
122
|
+
.service = key.service,
|
|
123
|
+
.permitted = true,
|
|
124
|
+
}, .delete, key.account, "", &.{});
|
|
125
|
+
if (execution.outcome == .miss) return false;
|
|
126
|
+
try credentialOutcome(execution.outcome);
|
|
108
127
|
return true;
|
|
109
128
|
}
|
|
110
129
|
|
|
111
|
-
|
|
130
|
+
fn credentialOutcome(outcome: credentials_store.Outcome) anyerror!void {
|
|
131
|
+
return switch (outcome) {
|
|
132
|
+
.ok => {},
|
|
133
|
+
.miss => error.CredentialNotFound,
|
|
134
|
+
.locked => error.UnsupportedService,
|
|
135
|
+
.denied => error.PermissionDenied,
|
|
136
|
+
.over_bound => error.CredentialFieldTooLarge,
|
|
137
|
+
.io_failed, .rejected => error.CredentialStoreFailed,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
pub fn formatLocalTime(self: *Runtime, timestamp_ms: i64, style: platform.LocalTimeStyle, buffer: []u8) anyerror![]const u8 {
|
|
142
|
+
return self.options.platform.services.formatLocalTime(timestamp_ms, style, buffer);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
pub fn createStatusItem(self: *Runtime, status_item_id: platform.StatusItemId, options: platform.TrayOptions) anyerror!void {
|
|
146
|
+
try validation.validateStatusItemId(status_item_id);
|
|
112
147
|
try validateTrayOptions(options);
|
|
113
|
-
try self
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
148
|
+
const status_item = try statusItemSlot(self, status_item_id);
|
|
149
|
+
const was_active = status_item.active;
|
|
150
|
+
try self.options.platform.services.createStatusItem(status_item_id, options);
|
|
151
|
+
try storeTrayItems(status_item, options.items);
|
|
152
|
+
const title = if (options.presentation.title.len > 0) options.presentation.title else options.title;
|
|
153
|
+
status_item.title = try copyInto(&status_item.title_storage, title);
|
|
154
|
+
status_item.id = status_item_id;
|
|
155
|
+
status_item.active = true;
|
|
156
|
+
status_item.visible = options.visible;
|
|
157
|
+
if (!was_active) self.status_item_count += 1;
|
|
117
158
|
}
|
|
118
159
|
|
|
119
|
-
pub fn
|
|
160
|
+
pub fn createTray(self: *Runtime, options: platform.TrayOptions) anyerror!void {
|
|
161
|
+
return self.createStatusItem(platform.primary_status_item_id, options);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
pub fn updateStatusItemShell(self: *Runtime, status_item_id: platform.StatusItemId, shell: platform.TrayShell) anyerror!void {
|
|
165
|
+
try validation.validateStatusItemId(status_item_id);
|
|
166
|
+
try validateTrayShell(shell);
|
|
167
|
+
const status_item = findStatusItem(self, status_item_id) orelse return error.InvalidTrayOptions;
|
|
168
|
+
try self.options.platform.services.updateStatusItemShell(status_item_id, shell);
|
|
169
|
+
status_item.visible = shell.visible;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
pub fn updateStatusItemMenu(self: *Runtime, status_item_id: platform.StatusItemId, items: []const platform.TrayMenuItem) anyerror!void {
|
|
173
|
+
try validation.validateStatusItemId(status_item_id);
|
|
120
174
|
try validateTrayMenuItems(items);
|
|
121
|
-
|
|
122
|
-
try
|
|
175
|
+
const status_item = findStatusItem(self, status_item_id) orelse return error.InvalidTrayOptions;
|
|
176
|
+
try self.options.platform.services.updateStatusItemMenu(status_item_id, items);
|
|
177
|
+
try storeTrayItems(status_item, items);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
pub fn updateTrayMenu(self: *Runtime, items: []const platform.TrayMenuItem) anyerror!void {
|
|
181
|
+
return self.updateStatusItemMenu(platform.primary_status_item_id, items);
|
|
123
182
|
}
|
|
124
183
|
|
|
125
184
|
/// Retitle the live status-bar button without re-creating the
|
|
126
185
|
/// status item (a model-driven badge like "3 open" in the menu
|
|
127
186
|
/// bar rides this seam). Platforms without the
|
|
128
187
|
/// title seam report `UnsupportedService`; the menu keeps working.
|
|
129
|
-
pub fn
|
|
188
|
+
pub fn updateStatusItemTitle(self: *Runtime, status_item_id: platform.StatusItemId, title: []const u8) anyerror!void {
|
|
189
|
+
try validation.validateStatusItemId(status_item_id);
|
|
130
190
|
try validateTrayTitle(title);
|
|
131
|
-
|
|
132
|
-
|
|
191
|
+
const status_item = findStatusItem(self, status_item_id) orelse return error.InvalidTrayOptions;
|
|
192
|
+
try self.options.platform.services.updateStatusItemTitle(status_item_id, title);
|
|
193
|
+
status_item.title = try copyInto(&status_item.title_storage, title);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
pub fn updateTrayTitle(self: *Runtime, title: []const u8) anyerror!void {
|
|
197
|
+
return self.updateStatusItemTitle(platform.primary_status_item_id, title);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
pub fn updateStatusItemPresentation(self: *Runtime, status_item_id: platform.StatusItemId, presentation: platform.TrayPresentation) anyerror!void {
|
|
201
|
+
try validation.validateStatusItemId(status_item_id);
|
|
202
|
+
try validation.validateTrayPresentation(presentation);
|
|
203
|
+
const status_item = findStatusItem(self, status_item_id) orelse return error.InvalidTrayOptions;
|
|
204
|
+
try self.options.platform.services.updateStatusItemPresentation(status_item_id, presentation);
|
|
205
|
+
status_item.title = try copyInto(&status_item.title_storage, presentation.title);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
pub fn updateTrayPresentation(self: *Runtime, presentation: platform.TrayPresentation) anyerror!void {
|
|
209
|
+
return self.updateStatusItemPresentation(platform.primary_status_item_id, presentation);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
pub fn removeStatusItem(self: *Runtime, status_item_id: platform.StatusItemId) anyerror!void {
|
|
213
|
+
try validation.validateStatusItemId(status_item_id);
|
|
214
|
+
const status_item = findStatusItem(self, status_item_id) orelse return;
|
|
215
|
+
try self.options.platform.services.removeStatusItem(status_item_id);
|
|
216
|
+
status_item.* = .{};
|
|
217
|
+
self.status_item_count -= 1;
|
|
133
218
|
}
|
|
134
219
|
|
|
135
220
|
pub fn removeTray(self: *Runtime) anyerror!void {
|
|
136
|
-
|
|
137
|
-
self.tray_item_count = 0;
|
|
138
|
-
self.tray_created = false;
|
|
139
|
-
self.tray_title = "";
|
|
221
|
+
return self.removeStatusItem(platform.primary_status_item_id);
|
|
140
222
|
}
|
|
141
223
|
|
|
142
|
-
pub fn
|
|
143
|
-
|
|
224
|
+
pub fn statusItemExists(self: *const Runtime, status_item_id: platform.StatusItemId) bool {
|
|
225
|
+
return findStatusItemConst(self, status_item_id) != null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
pub fn statusItemMenuItemExists(self: *const Runtime, status_item_id: platform.StatusItemId, item_id: platform.TrayItemId) bool {
|
|
229
|
+
const status_item = findStatusItemConst(self, status_item_id) orelse return false;
|
|
230
|
+
for (status_item.items[0..status_item.item_count]) |item| {
|
|
144
231
|
if (item.id == item_id) return true;
|
|
145
232
|
}
|
|
146
233
|
return false;
|
|
147
234
|
}
|
|
148
235
|
|
|
149
|
-
pub fn
|
|
150
|
-
|
|
236
|
+
pub fn trayItemExists(self: *const Runtime, item_id: platform.TrayItemId) bool {
|
|
237
|
+
return self.statusItemMenuItemExists(platform.primary_status_item_id, item_id);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
pub fn statusItemCommandNameForItem(self: *const Runtime, status_item_id: platform.StatusItemId, item_id: platform.TrayItemId) []const u8 {
|
|
241
|
+
const status_item = findStatusItemConst(self, status_item_id) orelse return "tray.action";
|
|
242
|
+
for (status_item.items[0..status_item.item_count]) |item| {
|
|
151
243
|
if (item.id == item_id and item.command.len > 0) return item.command;
|
|
152
244
|
}
|
|
153
245
|
return "tray.action";
|
|
154
246
|
}
|
|
155
247
|
|
|
248
|
+
pub fn trayCommandNameForItem(self: *const Runtime, item_id: platform.TrayItemId) []const u8 {
|
|
249
|
+
return self.statusItemCommandNameForItem(platform.primary_status_item_id, item_id);
|
|
250
|
+
}
|
|
251
|
+
|
|
156
252
|
pub fn supportsFeatureFromJson(self: *Runtime, payload: []const u8, output: []u8) ![]const u8 {
|
|
157
253
|
var scratch: [64]u8 = undefined;
|
|
158
254
|
var storage = json.StringStorage.init(&scratch);
|
|
@@ -235,12 +331,21 @@ pub fn RuntimeSystemServices(comptime Runtime: type) type {
|
|
|
235
331
|
pub fn showNotificationFromJson(self: *Runtime, payload: []const u8, output: []u8) ![]const u8 {
|
|
236
332
|
var storage = json.StringStorage.init(output);
|
|
237
333
|
const title = jsonStringField(payload, "title", &storage) orelse return error.InvalidNotificationOptions;
|
|
238
|
-
const subtitle =
|
|
239
|
-
const body =
|
|
334
|
+
const subtitle = try optionalNotificationString(payload, "subtitle", &storage);
|
|
335
|
+
const body = if (json.fieldValue(payload, "body") != null)
|
|
336
|
+
try optionalNotificationString(payload, "body", &storage)
|
|
337
|
+
else
|
|
338
|
+
try optionalNotificationString(payload, "message", &storage);
|
|
339
|
+
const notification_id = try optionalNotificationString(payload, "id", &storage);
|
|
340
|
+
const action_label = try optionalNotificationString(payload, "actionLabel", &storage);
|
|
341
|
+
const action_command = try optionalNotificationString(payload, "actionCommand", &storage);
|
|
240
342
|
try self.showNotification(.{
|
|
343
|
+
.id = notification_id,
|
|
241
344
|
.title = title,
|
|
242
345
|
.subtitle = subtitle,
|
|
243
346
|
.body = body,
|
|
347
|
+
.action_label = action_label,
|
|
348
|
+
.action_command = action_command,
|
|
244
349
|
});
|
|
245
350
|
return writeTrueJson(output);
|
|
246
351
|
}
|
|
@@ -363,16 +468,43 @@ pub fn RuntimeSystemServices(comptime Runtime: type) type {
|
|
|
363
468
|
};
|
|
364
469
|
}
|
|
365
470
|
|
|
366
|
-
fn storeTrayItems(
|
|
367
|
-
|
|
471
|
+
fn storeTrayItems(status_item: anytype, items: []const platform.TrayMenuItem) !void {
|
|
472
|
+
status_item.item_count = 0;
|
|
368
473
|
for (items, 0..) |item, index| {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
474
|
+
status_item.items[index].id = item.id;
|
|
475
|
+
status_item.items[index].command = try copyInto(&status_item.items[index].command_storage, item.command);
|
|
476
|
+
status_item.items[index].label = try copyInto(&status_item.items[index].label_storage, item.label);
|
|
477
|
+
status_item.items[index].detail = try copyInto(&status_item.items[index].detail_storage, item.detail);
|
|
478
|
+
status_item.items[index].separator = item.separator;
|
|
479
|
+
status_item.items[index].enabled = item.enabled;
|
|
480
|
+
status_item.items[index].role = item.role;
|
|
481
|
+
status_item.items[index].key = try copyInto(&status_item.items[index].key_storage, item.key);
|
|
482
|
+
status_item.items[index].modifiers = item.modifiers;
|
|
483
|
+
}
|
|
484
|
+
status_item.item_count = items.len;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
fn findStatusItem(self: anytype, status_item_id: platform.StatusItemId) ?@TypeOf(&self.status_items[0]) {
|
|
488
|
+
for (&self.status_items) |*status_item| {
|
|
489
|
+
if (status_item.active and status_item.id == status_item_id) return status_item;
|
|
490
|
+
}
|
|
491
|
+
return null;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
fn findStatusItemConst(self: anytype, status_item_id: platform.StatusItemId) ?@TypeOf(&self.status_items[0]) {
|
|
495
|
+
for (&self.status_items) |*status_item| {
|
|
496
|
+
if (status_item.active and status_item.id == status_item_id) return status_item;
|
|
497
|
+
}
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
fn statusItemSlot(self: anytype, status_item_id: platform.StatusItemId) !@TypeOf(&self.status_items[0]) {
|
|
502
|
+
if (findStatusItem(self, status_item_id)) |status_item| return status_item;
|
|
503
|
+
if (self.status_item_count >= self.status_items.len) return error.InvalidTrayOptions;
|
|
504
|
+
for (&self.status_items) |*status_item| {
|
|
505
|
+
if (!status_item.active) return status_item;
|
|
374
506
|
}
|
|
375
|
-
|
|
507
|
+
return error.InvalidTrayOptions;
|
|
376
508
|
}
|
|
377
509
|
|
|
378
510
|
fn validateExternalUrl(self: anytype, url: []const u8) !void {
|
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
|
}
|