@native-sdk/cli 0.8.3 → 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.
Files changed (188) hide show
  1. package/build/app.zig +905 -61
  2. package/build.zig +674 -373
  3. package/build.zig.zon +1 -0
  4. package/native-sdk.d.ts +6 -0
  5. package/package.json +12 -11
  6. package/packages/core/compile-surface/core.ts +455 -3
  7. package/packages/core/package-lock.json +11 -11
  8. package/packages/core/package.json +2 -2
  9. package/packages/core/scripts/compiler_typecheck.mjs +116 -15
  10. package/packages/core/scripts/gen_service_surface.mjs +268 -0
  11. package/packages/core/scripts/npm_static_spike.mjs +64 -0
  12. package/packages/core/scripts/run_external_core_compiler.mjs +77 -6
  13. package/packages/core/scripts/run_external_service_compiler.mjs +240 -0
  14. package/packages/core/scripts/stage_external_core.mjs +9 -1
  15. package/packages/core/scripts/stage_external_services.mjs +172 -0
  16. package/packages/core/scripts/surface_manifest_diff.mjs +253 -0
  17. package/packages/core/scripts/vendor_service_packages.mjs +189 -0
  18. package/packages/core/sdk/core.d.ts +214 -2
  19. package/packages/core/sdk/core.ts +715 -42
  20. package/packages/core/sdk/events.d.ts +50 -0
  21. package/packages/core/sdk/events.ts +75 -0
  22. package/packages/core/src/checker.ts +528 -15
  23. package/packages/core/src/cli.ts +143 -3
  24. package/packages/core/src/contract.ts +26 -5
  25. package/packages/core/src/devhost.ts +1849 -18
  26. package/packages/core/src/devhost_journal.mjs +181 -0
  27. package/packages/core/src/devhost_resolver.mjs +17 -1
  28. package/packages/core/src/devhost_service_worker.mjs +90 -0
  29. package/packages/core/src/diagnostics.ts +84 -18
  30. package/packages/core/src/frontend.ts +204 -34
  31. package/packages/core/src/modules.ts +129 -80
  32. package/packages/core/src/service_contract.ts +597 -0
  33. package/packages/core/src/sqlite_cli.ts +93 -0
  34. package/packages/core/src/sqlite_codegen.ts +806 -0
  35. package/packages/core/src/sqlite_runtime_policy.ts +364 -0
  36. package/packages/core/src/typed_ast.ts +36 -8
  37. package/skill-data/core/SKILL.md +4 -2
  38. package/skill-data/core/references/project-anatomy.md +3 -2
  39. package/skill-data/core/references/web-engines-packaging-debugging.md +3 -1
  40. package/skill-data/native-ui/SKILL.md +55 -8
  41. package/skill-data/ts-core/SKILL.md +92 -40
  42. package/skill-data/ts-services/SKILL.md +126 -0
  43. package/skill-data/ts-services/references/service-surface.md +603 -0
  44. package/skill-data/zig/SKILL.md +1 -1
  45. package/skills/native-sdk/SKILL.md +1 -1
  46. package/src/app_runner/no_migrations.zig +3 -0
  47. package/src/app_runner/no_services.zig +20 -0
  48. package/src/app_runner/root.zig +104 -4
  49. package/src/app_runner/ts_core_main.zig +268 -4
  50. package/src/automation/snapshot.zig +23 -5
  51. package/src/embed/app_exports.zig +11 -1
  52. package/src/embed/c_api.zig +48 -2
  53. package/src/embed/conversions.zig +4 -5
  54. package/src/embed/host.zig +115 -1
  55. package/src/embed/root.zig +7 -0
  56. package/src/embed/tests.zig +213 -0
  57. package/src/embed/types.zig +51 -0
  58. package/src/embed/ui_host.zig +121 -5
  59. package/src/platform/android/NativeSdkActivity.java +131 -0
  60. package/src/platform/android/android_host.c +182 -1
  61. package/src/platform/android/native_sdk_app.h +17 -0
  62. package/src/platform/ios/native_sdk_app.h +17 -0
  63. package/src/platform/ios/uikit_host.m +115 -0
  64. package/src/platform/linux/cef_host.cpp +1 -1
  65. package/src/platform/linux/gtk_host.c +89 -17
  66. package/src/platform/linux/gtk_host.h +3 -0
  67. package/src/platform/linux/root.zig +41 -18
  68. package/src/platform/macos/appkit_host.h +26 -3
  69. package/src/platform/macos/appkit_host.m +1051 -129
  70. package/src/platform/macos/capture_info_plist.c +25 -0
  71. package/src/platform/macos/cef_host.mm +270 -36
  72. package/src/platform/macos/root.zig +312 -34
  73. package/src/platform/null_platform.zig +281 -19
  74. package/src/platform/null_platform_tests.zig +74 -0
  75. package/src/platform/root.zig +16 -0
  76. package/src/platform/types.zig +279 -15
  77. package/src/platform/windows/root.zig +243 -21
  78. package/src/platform/windows/webview2_host.cpp +464 -46
  79. package/src/primitives/app_manifest/comptime_scene.zig +2 -0
  80. package/src/primitives/app_manifest/root.zig +4 -0
  81. package/src/primitives/app_manifest/tests.zig +3 -0
  82. package/src/primitives/app_manifest/types.zig +34 -0
  83. package/src/primitives/app_manifest/validation.zig +19 -1
  84. package/src/primitives/canvas/code_tests.zig +9 -9
  85. package/src/primitives/canvas/events.zig +12 -11
  86. package/src/primitives/canvas/frame.zig +44 -9
  87. package/src/primitives/canvas/icons/mic.svg +1 -0
  88. package/src/primitives/canvas/icons.zig +2 -0
  89. package/src/primitives/canvas/root.zig +8 -0
  90. package/src/primitives/canvas/text_span_tests.zig +39 -0
  91. package/src/primitives/canvas/ui.zig +23 -4
  92. package/src/primitives/canvas/ui_markup.zig +15 -0
  93. package/src/primitives/canvas/ui_markup_compiled.zig +9 -0
  94. package/src/primitives/canvas/ui_markup_compiled_tests.zig +1 -1
  95. package/src/primitives/canvas/ui_markup_tests.zig +5 -0
  96. package/src/primitives/canvas/ui_markup_view.zig +9 -0
  97. package/src/primitives/canvas/ui_markup_view_tests.zig +9 -6
  98. package/src/primitives/canvas/ui_schema.zig +19 -10
  99. package/src/primitives/canvas/ui_schema_tests.zig +5 -3
  100. package/src/primitives/canvas/ui_tests.zig +18 -4
  101. package/src/primitives/canvas/widget_invalidation.zig +9 -2
  102. package/src/primitives/canvas/widget_render.zig +296 -114
  103. package/src/primitives/canvas/widget_runtime_tests.zig +133 -0
  104. package/src/primitives/canvas/widget_text_input.zig +10 -10
  105. package/src/primitives/canvas/widget_tree.zig +1 -1
  106. package/src/primitives/canvas/widgets.zig +29 -5
  107. package/src/root.zig +56 -0
  108. package/src/runtime/api.zig +11 -0
  109. package/src/runtime/automation_snapshot.zig +4 -0
  110. package/src/runtime/automation_widget_dispatch.zig +1 -0
  111. package/src/runtime/bridge_payload.zig +2 -0
  112. package/src/runtime/bridge_permission_tests.zig +23 -2
  113. package/src/runtime/bridge_responses.zig +3 -1
  114. package/src/runtime/canvas_frame.zig +31 -13
  115. package/src/runtime/canvas_frame_animation_tests.zig +4 -0
  116. package/src/runtime/canvas_frame_invalidation_tests.zig +35 -10
  117. package/src/runtime/canvas_widget_anchored_tests.zig +83 -0
  118. package/src/runtime/canvas_widget_events.zig +69 -24
  119. package/src/runtime/canvas_widget_runtime.zig +101 -6
  120. package/src/runtime/canvas_widget_scroll_driver_tests.zig +47 -4
  121. package/src/runtime/canvas_widget_scroll_drivers.zig +3 -3
  122. package/src/runtime/canvas_widget_semantics_tests.zig +2 -0
  123. package/src/runtime/canvas_widget_split_tree_tests.zig +228 -0
  124. package/src/runtime/canvas_widget_state.zig +6 -1
  125. package/src/runtime/canvas_widget_text_tests.zig +112 -3
  126. package/src/runtime/clock.zig +13 -1
  127. package/src/runtime/core.zig +133 -1
  128. package/src/runtime/credentials_store.zig +115 -0
  129. package/src/runtime/effects.zig +2568 -75
  130. package/src/runtime/effects_audio_capture_tests.zig +251 -0
  131. package/src/runtime/effects_credentials_tests.zig +332 -0
  132. package/src/runtime/effects_host_tests.zig +208 -1
  133. package/src/runtime/effects_relational_tests.zig +314 -0
  134. package/src/runtime/effects_store_tests.zig +211 -0
  135. package/src/runtime/flow.zig +14 -1
  136. package/src/runtime/gpu_surface_events.zig +6 -1
  137. package/src/runtime/native_command_event_tests.zig +42 -0
  138. package/src/runtime/persist_store.zig +666 -0
  139. package/src/runtime/record_store.zig +788 -0
  140. package/src/runtime/relational_store.zig +854 -0
  141. package/src/runtime/root.zig +52 -0
  142. package/src/runtime/runtime_event_tests.zig +70 -0
  143. package/src/runtime/service_host.zig +711 -0
  144. package/src/runtime/service_pool.zig +1314 -0
  145. package/src/runtime/session_blobs.zig +1 -1
  146. package/src/runtime/session_journal.zig +102 -0
  147. package/src/runtime/session_record.zig +177 -0
  148. package/src/runtime/session_replay.zig +109 -4
  149. package/src/runtime/shell_layout.zig +1 -0
  150. package/src/runtime/shell_layout_tests.zig +120 -0
  151. package/src/runtime/sqlite_engine.zig +474 -0
  152. package/src/runtime/state.zig +6 -0
  153. package/src/runtime/system_services.zig +49 -10
  154. package/src/runtime/tests.zig +5 -0
  155. package/src/runtime/ts_core_host.zig +1189 -118
  156. package/src/runtime/ts_core_host_tests.zig +638 -11
  157. package/src/runtime/ts_ui_app.zig +537 -1
  158. package/src/runtime/ui_app.zig +160 -19
  159. package/src/runtime/ui_app_tests.zig +203 -5
  160. package/src/runtime/validation.zig +22 -0
  161. package/src/runtime/view.zig +11 -0
  162. package/src/runtime/view_widget_scroll.zig +56 -5
  163. package/src/runtime/view_widget_text.zig +24 -5
  164. package/src/runtime/view_widget_tree.zig +1 -1
  165. package/src/runtime/window_storage.zig +1 -0
  166. package/src/runtime/window_view_runtime.zig +2 -3
  167. package/src/runtime/window_views.zig +19 -0
  168. package/src/tooling/android.zig +21 -16
  169. package/src/tooling/db.zig +160 -0
  170. package/src/tooling/ios.zig +7 -1
  171. package/src/tooling/manifest.zig +1248 -2
  172. package/src/tooling/package.zig +953 -6
  173. package/src/tooling/raw_manifest.zig +65 -0
  174. package/src/tooling/root.zig +1 -0
  175. package/src/tooling/templates.zig +216 -4
  176. package/src/tooling/ts_core.zig +283 -17
  177. package/src/tooling/verbs.zig +7 -0
  178. package/third_party/sqlite/README.md +13 -0
  179. package/third_party/sqlite/sqlite3.c +269649 -0
  180. package/third_party/sqlite/sqlite3.h +14349 -0
  181. package/tools/corewire/core_abi.zig +14 -2
  182. package/tools/corewire/emit.zig +98 -29
  183. package/tools/corewire/emit_facade.zig +414 -23
  184. package/tools/corewire/emit_profile.zig +6 -2
  185. package/tools/corewire/emit_service.zig +924 -0
  186. package/tools/corewire/main.zig +122 -0
  187. package/tools/corewire/service_contract.zig +250 -0
  188. package/tools/corewire/sidecar.zig +26 -15
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Hand-wired example build graphs launch bare Mach-O executables and do not
3
+ * have the managed graph's permission-aware plist generation step. Keep the
4
+ * capture usage descriptions in the conventional embedded section so macOS
5
+ * can present consent instead of terminating an example that adopts capture.
6
+ */
7
+ #define NATIVE_SDK_CAPTURE_INFO_PLIST \
8
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
9
+ "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" " \
10
+ "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" \
11
+ "<plist version=\"1.0\">\n<dict>\n" \
12
+ " <key>NSMicrophoneUsageDescription</key>\n" \
13
+ " <string>This app captures microphone audio when you start " \
14
+ "recording.</string>\n" \
15
+ " <key>NSAudioCaptureUsageDescription</key>\n" \
16
+ " <string>This app captures system audio when you start " \
17
+ "recording.</string>\n" \
18
+ " <key>NSScreenCaptureUsageDescription</key>\n" \
19
+ " <string>This app captures system audio when you start " \
20
+ "recording.</string>\n" \
21
+ "</dict>\n</plist>\n"
22
+
23
+ __attribute__((used, section("__TEXT,__info_plist")))
24
+ static const unsigned char native_sdk_capture_info_plist
25
+ [sizeof(NATIVE_SDK_CAPTURE_INFO_PLIST) - 1] = NATIVE_SDK_CAPTURE_INFO_PLIST;
@@ -2,10 +2,12 @@
2
2
 
3
3
  #import <AppKit/AppKit.h>
4
4
  #import <CoreFoundation/CoreFoundation.h>
5
+ #import <dispatch/dispatch.h>
5
6
  #import <ImageIO/ImageIO.h>
6
7
  #import <Security/Security.h>
7
8
  #import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
8
9
  #include <crt_externs.h>
10
+ #include <dlfcn.h>
9
11
  #include <stdint.h>
10
12
  #include <stdio.h>
11
13
  #include <stdlib.h>
@@ -44,6 +46,52 @@ static const uint32_t NativeSdkShortcutModifierCommand = 1u << 1;
44
46
  static const uint32_t NativeSdkShortcutModifierControl = 1u << 2;
45
47
  static const uint32_t NativeSdkShortcutModifierOption = 1u << 3;
46
48
  static const uint32_t NativeSdkShortcutModifierShift = 1u << 4;
49
+
50
+ // Class lookup alone does not load ServiceManagement. Load the framework
51
+ // explicitly on first use, then keep resolving SMAppService dynamically so
52
+ // hosts on older macOS releases report unsupported.
53
+ static id NativeSdkMainAppService(void) {
54
+ static void *serviceManagementHandle = NULL;
55
+ static dispatch_once_t serviceManagementOnce;
56
+ dispatch_once(&serviceManagementOnce, ^{
57
+ serviceManagementHandle = dlopen(
58
+ "/System/Library/Frameworks/ServiceManagement.framework/ServiceManagement",
59
+ RTLD_LAZY | RTLD_LOCAL);
60
+ });
61
+ if (!serviceManagementHandle) return nil;
62
+ Class serviceClass = NSClassFromString(@"SMAppService");
63
+ SEL selector = NSSelectorFromString(@"mainApp");
64
+ if (!serviceClass || ![serviceClass respondsToSelector:selector]) return nil;
65
+ IMP implementation = [serviceClass methodForSelector:selector];
66
+ return ((id (*)(id, SEL))implementation)(serviceClass, selector);
67
+ }
68
+
69
+ static int NativeSdkLaunchAtLoginStatus(void) {
70
+ id service = NativeSdkMainAppService();
71
+ SEL selector = NSSelectorFromString(@"status");
72
+ if (!service || ![service respondsToSelector:selector]) return -1;
73
+ IMP implementation = [service methodForSelector:selector];
74
+ return (int)((NSInteger (*)(id, SEL))implementation)(service, selector);
75
+ }
76
+
77
+ static int NativeSdkSetLaunchAtLogin(BOOL enabled) {
78
+ id service = NativeSdkMainAppService();
79
+ if (!service) return -1;
80
+ int before = NativeSdkLaunchAtLoginStatus();
81
+ // Requires-approval is already registered in the requested enabled
82
+ // direction. Re-registering it returns kSMErrorAlreadyRegistered or
83
+ // kSMErrorLaunchDeniedByUser instead of advancing the user's consent.
84
+ if ((enabled && (before == 1 || before == 2)) || (!enabled && before == 0)) return before;
85
+ SEL selector = NSSelectorFromString(enabled ? @"registerAndReturnError:" : @"unregisterAndReturnError:");
86
+ if (![service respondsToSelector:selector]) return -1;
87
+ NSError *error = nil;
88
+ IMP implementation = [service methodForSelector:selector];
89
+ BOOL succeeded = ((BOOL (*)(id, SEL, NSError **))implementation)(service, selector, &error);
90
+ // -1 is reserved for an unavailable service/API. A supported service
91
+ // refusing the operation is a real failure so the TypeScript effect can
92
+ // distinguish "failed" from "unsupported".
93
+ return succeeded ? NativeSdkLaunchAtLoginStatus() : -2;
94
+ }
47
95
  static const char *NativeSdkCefBridgeScript();
48
96
  static NSRect NativeSdkConstrainFrame(NSRect frame);
49
97
  static NSString *NativeSdkResolvedAssetRoot(NSString *rootPath);
@@ -84,6 +132,14 @@ static NSMutableDictionary *NativeSdkCredentialQuery(NSString *service, NSString
84
132
  } mutableCopy];
85
133
  }
86
134
 
135
+ static int NativeSdkCredentialStatus(OSStatus status, int missingCode) {
136
+ if (status == errSecSuccess) return 1;
137
+ if (status == errSecItemNotFound) return missingCode;
138
+ if (status == errSecInteractionNotAllowed || status == errSecNotAvailable) return -2;
139
+ if (status == errSecAuthFailed || status == errSecUserCanceled || status == errSecMissingEntitlement) return -3;
140
+ return -1;
141
+ }
142
+
87
143
  class NativeSdkCefBridgeV8Handler final : public CefV8Handler {
88
144
  public:
89
145
  bool Execute(const CefString& name, CefRefPtr<CefV8Value> object, const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval, CefString& exception) override {
@@ -512,7 +568,7 @@ static const char *NativeSdkCefBridgeScript() {
512
568
 
513
569
  @end
514
570
 
515
- @interface NativeSdkChromiumHost : NSObject
571
+ @interface NativeSdkChromiumHost : NSObject <NSMenuDelegate>
516
572
  @property(nonatomic, strong) NSWindow *window;
517
573
  @property(nonatomic, strong) NSView *browserContainer;
518
574
  @property(nonatomic, strong) NativeSdkChromiumWindowDelegate *delegate;
@@ -563,6 +619,15 @@ static const char *NativeSdkCefBridgeScript() {
563
619
  @property(nonatomic, strong) id shortcutEventMonitor;
564
620
  @property(nonatomic, strong) NSArray<NativeSdkChromiumShortcut *> *shortcuts;
565
621
  @property(nonatomic, strong) NSStatusItem *statusItem;
622
+ @property(nonatomic, strong) NSImage *statusItemBaseImage;
623
+ @property(nonatomic, strong) NSMenu *statusMenu;
624
+ @property(nonatomic, assign) double statusPresentationWidth;
625
+ @property(nonatomic, assign) int statusPresentationTone;
626
+ @property(nonatomic, assign) double statusPresentationIconOpacity;
627
+ @property(nonatomic, assign) BOOL statusPresentationMonospaced;
628
+ @property(nonatomic, strong) NSString *statusActivationCommand;
629
+ @property(nonatomic, strong) NSString *statusAlternateActivationCommand;
630
+ @property(nonatomic, strong) NSString *statusOpenCommand;
566
631
  @property(nonatomic, assign) native_sdk_appkit_tray_callback_t trayCallback;
567
632
  @property(nonatomic, assign) void *trayContext;
568
633
  @property(nonatomic) CefRefPtr<NativeSdkCefClient> cefClient;
@@ -637,6 +702,9 @@ static const char *NativeSdkCefBridgeScript() {
637
702
  - (BOOL)handleShortcutEvent:(NSEvent *)event;
638
703
  - (void)emitShortcutWithId:(NSString *)identifier key:(NSString *)key modifiers:(uint32_t)modifiers event:(NSEvent *)event;
639
704
  - (void)trayMenuItemClicked:(NSMenuItem *)menuItem;
705
+ - (void)menuWillOpen:(NSMenu *)menu;
706
+ - (void)emitStatusCommand:(NSString *)command;
707
+ - (void)statusItemActivated:(id)sender;
640
708
  @end
641
709
 
642
710
  @implementation NativeSdkChromiumShortcut
@@ -945,6 +1013,12 @@ static const char *NativeSdkCefBridgeScript() {
945
1013
  if ((windowFlags & (1u << 1)) != 0) window.level = NSFloatingWindowLevel;
946
1014
  if ((windowFlags & (1u << 2)) != 0) window.ignoresMouseEvents = YES;
947
1015
  if ((windowFlags & (1u << 3)) != 0) [self.passiveShowWindows addObject:key];
1016
+ if ((windowFlags & (1u << 4)) != 0) {
1017
+ NSWindowCollectionBehavior behavior = window.collectionBehavior;
1018
+ behavior &= ~(NSWindowCollectionBehaviorFullScreenPrimary | NSWindowCollectionBehaviorFullScreenAuxiliary);
1019
+ window.collectionBehavior = behavior | NSWindowCollectionBehaviorFullScreenNone;
1020
+ [window standardWindowButton:NSWindowZoomButton].enabled = NO;
1021
+ }
948
1022
  [window setTitle:title.length > 0 ? title : @"native-sdk"];
949
1023
  if (!restoreFrame) {
950
1024
  [window center];
@@ -1006,16 +1080,17 @@ static const char *NativeSdkCefBridgeScript() {
1006
1080
  if ([self.passiveShowWindows containsObject:@(windowId)]) {
1007
1081
  [window orderFront:nil];
1008
1082
  } else {
1009
- [window makeKeyAndOrderFront:nil];
1010
1083
  [NSApp activateIgnoringOtherApps:YES];
1084
+ [window makeKeyAndOrderFront:nil];
1011
1085
  }
1012
1086
  }
1013
1087
 
1014
1088
  - (void)focusWindowWithId:(uint64_t)windowId {
1015
1089
  NSWindow *window = self.windows[@(windowId)];
1016
1090
  if (!window) return;
1017
- [window makeKeyAndOrderFront:nil];
1091
+ [self.policyHiddenWindows removeObject:@(windowId)];
1018
1092
  [NSApp activateIgnoringOtherApps:YES];
1093
+ [window makeKeyAndOrderFront:nil];
1019
1094
  [self emitWindowFrameForWindowId:windowId open:YES];
1020
1095
  }
1021
1096
 
@@ -1138,7 +1213,7 @@ static const char *NativeSdkCefBridgeScript() {
1138
1213
  NSApp.delegate = reopenDelegate;
1139
1214
  }
1140
1215
 
1141
- [self orderWindowForImplicitShow:1];
1216
+ if (![self.policyHiddenWindows containsObject:@1]) [self orderWindowForImplicitShow:1];
1142
1217
  if (!self.shortcutEventMonitor) {
1143
1218
  __weak NativeSdkChromiumHost *weakSelf = self;
1144
1219
  self.shortcutEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^NSEvent *(NSEvent *event) {
@@ -1917,6 +1992,32 @@ static const char *NativeSdkCefBridgeScript() {
1917
1992
  if (self.trayCallback) self.trayCallback(self.trayContext, (uint32_t)menuItem.tag);
1918
1993
  }
1919
1994
 
1995
+ - (void)emitStatusCommand:(NSString *)command {
1996
+ if (command.length == 0) return;
1997
+ const char *bytes = command.UTF8String;
1998
+ [self emitEvent:(native_sdk_appkit_event_t){
1999
+ .kind = NATIVE_SDK_APPKIT_EVENT_TRAY_COMMAND,
2000
+ .window_id = 1,
2001
+ .command_name = bytes,
2002
+ .command_name_len = [command lengthOfBytesUsingEncoding:NSUTF8StringEncoding],
2003
+ }];
2004
+ }
2005
+
2006
+ - (void)menuWillOpen:(NSMenu *)menu {
2007
+ if (!self.statusItem || menu != self.statusMenu) return;
2008
+ [self emitStatusCommand:self.statusOpenCommand];
2009
+ }
2010
+
2011
+ - (void)statusItemActivated:(id)sender {
2012
+ (void)sender;
2013
+ if ((NSEvent.modifierFlags & NSEventModifierFlagOption) != 0 && self.statusAlternateActivationCommand.length > 0) {
2014
+ [self emitStatusCommand:self.statusAlternateActivationCommand];
2015
+ return;
2016
+ }
2017
+ [self emitStatusCommand:self.statusActivationCommand];
2018
+ if (self.statusMenu) [self.statusItem popUpStatusItemMenu:self.statusMenu];
2019
+ }
2020
+
1920
2021
  @end
1921
2022
 
1922
2023
  namespace {
@@ -2147,6 +2248,12 @@ static void NativeSdkApplyOverlayWindowFlags(NativeSdkChromiumHost *host, uint64
2147
2248
  if ((window_flags & (1u << 1)) != 0) window.level = NSFloatingWindowLevel;
2148
2249
  if ((window_flags & (1u << 2)) != 0) window.ignoresMouseEvents = YES;
2149
2250
  if ((window_flags & (1u << 3)) != 0) [host.passiveShowWindows addObject:@(window_id)];
2251
+ if ((window_flags & (1u << 4)) != 0) {
2252
+ NSWindowCollectionBehavior behavior = window.collectionBehavior;
2253
+ behavior &= ~(NSWindowCollectionBehaviorFullScreenPrimary | NSWindowCollectionBehaviorFullScreenAuxiliary);
2254
+ window.collectionBehavior = behavior | NSWindowCollectionBehaviorFullScreenNone;
2255
+ [window standardWindowButton:NSWindowZoomButton].enabled = NO;
2256
+ }
2150
2257
  }
2151
2258
 
2152
2259
  native_sdk_appkit_host_t *native_sdk_appkit_create(const char *app_name, size_t app_name_len, const char *display_name, size_t display_name_len, const char *version, size_t version_len, const char *about_description, size_t about_description_len, int has_web_content, const char *window_title, size_t window_title_len, const char *bundle_id, size_t bundle_id_len, const char *icon_path, size_t icon_path_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int resizable, int titlebar_style, int show_policy, uint32_t window_flags) {
@@ -2160,9 +2267,10 @@ native_sdk_appkit_host_t *native_sdk_appkit_create(const char *app_name, size_t
2160
2267
  // hosts webviews only (gpu-surface presents are unsupported on
2161
2268
  // this engine), so the policy is accepted for ABI parity and
2162
2269
  // windows show immediately — the web engine owns first paint.
2270
+ // Policy 2 is different: it is an explicit initially-hidden
2271
+ // lifecycle request and is honored below.
2163
2272
  // has_web_content is likewise ABI parity: this host always
2164
2273
  // hosts web content, and its menus already assume it.
2165
- (void)show_policy;
2166
2274
  (void)has_web_content;
2167
2275
  (void)bundle_id;
2168
2276
  (void)bundle_id_len;
@@ -2184,6 +2292,7 @@ native_sdk_appkit_host_t *native_sdk_appkit_create(const char *app_name, size_t
2184
2292
  }
2185
2293
  NativeSdkApplyHiddenInsetTitlebar(host.window, titlebar_style, host.delegates[@1]);
2186
2294
  NativeSdkApplyOverlayWindowFlags(host, 1, window_flags);
2295
+ if (show_policy == 2) [host.policyHiddenWindows addObject:@1];
2187
2296
  return (__bridge_retained native_sdk_appkit_host_t *)host;
2188
2297
  }
2189
2298
  }
@@ -2430,8 +2539,6 @@ void native_sdk_appkit_set_shortcuts(native_sdk_appkit_host_t *host, const char
2430
2539
  }
2431
2540
 
2432
2541
  int native_sdk_appkit_create_window(native_sdk_appkit_host_t *host, uint64_t window_id, const char *window_title, size_t window_title_len, const char *window_label, size_t window_label_len, double x, double y, double width, double height, int restore_frame, int resizable, int titlebar_style, int show_policy, uint32_t window_flags) {
2433
- // Accepted for ABI parity; see native_sdk_appkit_create.
2434
- (void)show_policy;
2435
2542
  if ((window_flags & (1u << 0)) != 0) return 0;
2436
2543
  NativeSdkChromiumHost *object = (__bridge NativeSdkChromiumHost *)host;
2437
2544
  NSString *titleString = window_title ? [[NSString alloc] initWithBytes:window_title length:window_title_len encoding:NSUTF8StringEncoding] : @"native-sdk";
@@ -2440,7 +2547,11 @@ int native_sdk_appkit_create_window(native_sdk_appkit_host_t *host, uint64_t win
2440
2547
  NativeSdkApplyHiddenInsetTitlebar(object.windows[@(window_id)], titlebar_style, object.delegates[@(window_id)]);
2441
2548
  // Apply chrome and overlay presentation while still hidden, then
2442
2549
  // reveal once so a secondary window cannot flash its default frame.
2443
- [object orderWindowForImplicitShow:window_id];
2550
+ if (show_policy == 2) {
2551
+ [object.policyHiddenWindows addObject:@(window_id)];
2552
+ } else {
2553
+ [object orderWindowForImplicitShow:window_id];
2554
+ }
2444
2555
  return 1;
2445
2556
  }
2446
2557
 
@@ -2465,6 +2576,13 @@ int native_sdk_appkit_minimize_window(native_sdk_appkit_host_t *host, uint64_t w
2465
2576
  return 1;
2466
2577
  }
2467
2578
 
2579
+ int native_sdk_appkit_hide_window(native_sdk_appkit_host_t *host, uint64_t window_id) {
2580
+ NativeSdkChromiumHost *object = (__bridge NativeSdkChromiumHost *)host;
2581
+ if (!object.windows[@(window_id)]) return 0;
2582
+ [object hideWindowWithId:window_id];
2583
+ return 1;
2584
+ }
2585
+
2468
2586
  int native_sdk_appkit_show_window(native_sdk_appkit_host_t *host, uint64_t window_id) {
2469
2587
  NativeSdkChromiumHost *object = (__bridge NativeSdkChromiumHost *)host;
2470
2588
  if (!object.windows[@(window_id)]) return 0;
@@ -2476,6 +2594,23 @@ int native_sdk_appkit_show_window(native_sdk_appkit_host_t *host, uint64_t windo
2476
2594
  return 1;
2477
2595
  }
2478
2596
 
2597
+ int native_sdk_appkit_set_dock_presence(native_sdk_appkit_host_t *host, int visible) {
2598
+ (void)host;
2599
+ NSApplicationActivationPolicy policy = visible ? NSApplicationActivationPolicyRegular : NSApplicationActivationPolicyAccessory;
2600
+ BOOL changed = [NSApp setActivationPolicy:policy];
2601
+ return changed || NSApp.activationPolicy == policy ? 1 : 0;
2602
+ }
2603
+
2604
+ int native_sdk_appkit_launch_at_login_status(native_sdk_appkit_host_t *host) {
2605
+ (void)host;
2606
+ return NativeSdkLaunchAtLoginStatus();
2607
+ }
2608
+
2609
+ int native_sdk_appkit_set_launch_at_login(native_sdk_appkit_host_t *host, int enabled) {
2610
+ (void)host;
2611
+ return NativeSdkSetLaunchAtLogin(enabled != 0);
2612
+ }
2613
+
2479
2614
  int native_sdk_appkit_set_window_close_policy(native_sdk_appkit_host_t *host, uint64_t window_id, int close_policy) {
2480
2615
  NativeSdkChromiumHost *object = (__bridge NativeSdkChromiumHost *)host;
2481
2616
  if (!object.windows[@(window_id)]) return 0;
@@ -3082,7 +3217,7 @@ int native_sdk_appkit_set_credential(native_sdk_appkit_host_t *host, const char
3082
3217
  @autoreleasepool {
3083
3218
  NSString *serviceString = NativeSdkStringFromBytes(service, service_len);
3084
3219
  NSString *accountString = NativeSdkStringFromBytes(account, account_len);
3085
- if (serviceString.length == 0 || accountString.length == 0 || !secret || secret_len == 0) return 0;
3220
+ if (serviceString.length == 0 || accountString.length == 0 || (!secret && secret_len > 0)) return 0;
3086
3221
  NSData *secretData = [NSData dataWithBytes:secret length:secret_len];
3087
3222
  NSMutableDictionary *query = NativeSdkCredentialQuery(serviceString, accountString);
3088
3223
  NSDictionary *update = @{ (__bridge id)kSecValueData: secretData };
@@ -3091,7 +3226,7 @@ int native_sdk_appkit_set_credential(native_sdk_appkit_host_t *host, const char
3091
3226
  query[(__bridge id)kSecValueData] = secretData;
3092
3227
  status = SecItemAdd((__bridge CFDictionaryRef)query, NULL);
3093
3228
  }
3094
- return status == errSecSuccess ? 1 : 0;
3229
+ return NativeSdkCredentialStatus(status, -1);
3095
3230
  }
3096
3231
  }
3097
3232
 
@@ -3100,13 +3235,16 @@ size_t native_sdk_appkit_get_credential(native_sdk_appkit_host_t *host, const ch
3100
3235
  @autoreleasepool {
3101
3236
  NSString *serviceString = NativeSdkStringFromBytes(service, service_len);
3102
3237
  NSString *accountString = NativeSdkStringFromBytes(account, account_len);
3103
- if (serviceString.length == 0 || accountString.length == 0 || !buffer) return 0;
3238
+ if (serviceString.length == 0 || accountString.length == 0 || (!buffer && buffer_len > 0)) return SIZE_MAX - 1;
3104
3239
  NSMutableDictionary *query = NativeSdkCredentialQuery(serviceString, accountString);
3105
3240
  query[(__bridge id)kSecReturnData] = @YES;
3106
3241
  query[(__bridge id)kSecMatchLimit] = (__bridge id)kSecMatchLimitOne;
3107
3242
  CFTypeRef result = NULL;
3108
3243
  OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
3109
- if (status != errSecSuccess || !result) return 0;
3244
+ if (status == errSecItemNotFound) return SIZE_MAX;
3245
+ if (status == errSecInteractionNotAllowed || status == errSecNotAvailable) return SIZE_MAX - 2;
3246
+ if (status == errSecAuthFailed || status == errSecUserCanceled || status == errSecMissingEntitlement) return SIZE_MAX - 3;
3247
+ if (status != errSecSuccess || !result) return SIZE_MAX - 1;
3110
3248
  NSData *data = CFBridgingRelease(result);
3111
3249
  if (data.length > buffer_len) return data.length;
3112
3250
  memcpy(buffer, data.bytes, data.length);
@@ -3122,7 +3260,7 @@ int native_sdk_appkit_delete_credential(native_sdk_appkit_host_t *host, const ch
3122
3260
  if (serviceString.length == 0 || accountString.length == 0) return 0;
3123
3261
  NSMutableDictionary *query = NativeSdkCredentialQuery(serviceString, accountString);
3124
3262
  OSStatus status = SecItemDelete((__bridge CFDictionaryRef)query);
3125
- return status == errSecSuccess ? 1 : 0;
3263
+ return NativeSdkCredentialStatus(status, 0);
3126
3264
  }
3127
3265
  }
3128
3266
 
@@ -3259,16 +3397,52 @@ int native_sdk_appkit_show_message_dialog(native_sdk_appkit_host_t *host, const
3259
3397
  }
3260
3398
  }
3261
3399
 
3262
- void native_sdk_appkit_create_tray(native_sdk_appkit_host_t *host, const char *icon_path, size_t icon_path_len, const char *title, size_t title_len, const char *tooltip, size_t tooltip_len) {
3400
+ static NSImage *NativeSdkCefTrayImageWithOpacity(NSImage *source, double opacity) {
3401
+ if (!source) return nil;
3402
+ const CGFloat fraction = MAX(0.0, MIN(1.0, opacity));
3403
+ if (fraction >= 1.0) return source;
3404
+ NSImage *image = [[NSImage alloc] initWithSize:source.size];
3405
+ [image lockFocus];
3406
+ [source drawInRect:NSMakeRect(0, 0, source.size.width, source.size.height) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:fraction];
3407
+ [image unlockFocus];
3408
+ image.template = YES;
3409
+ return image;
3410
+ }
3411
+
3412
+ static void NativeSdkCefApplyTrayPresentation(NativeSdkChromiumHost *object, NSString *requestedTitle, double width, int tone, double iconOpacity, BOOL monospaced) {
3413
+ if (!object.statusItem) return;
3414
+ object.statusPresentationWidth = width;
3415
+ object.statusPresentationTone = tone;
3416
+ object.statusPresentationIconOpacity = iconOpacity;
3417
+ object.statusPresentationMonospaced = monospaced;
3418
+ NSString *title = requestedTitle ?: @"";
3419
+ if (!object.statusItemBaseImage && title.length == 0) title = object.appName.length > 0 ? [object.appName substringToIndex:MIN(1, object.appName.length)] : @"Z";
3420
+ NSFont *font = monospaced ? [NSFont monospacedDigitSystemFontOfSize:11 weight:NSFontWeightRegular] : [NSFont systemFontOfSize:11];
3421
+ if (tone == 0) {
3422
+ object.statusItem.button.title = title;
3423
+ object.statusItem.button.font = font;
3424
+ object.statusItem.button.contentTintColor = nil;
3425
+ } else {
3426
+ NSColor *color = tone == 1 ? NSColor.systemOrangeColor : NSColor.systemRedColor;
3427
+ object.statusItem.button.attributedTitle = [[NSAttributedString alloc] initWithString:title attributes:@{ NSForegroundColorAttributeName: color, NSFontAttributeName: font }];
3428
+ object.statusItem.button.contentTintColor = color;
3429
+ }
3430
+ object.statusItem.button.image = NativeSdkCefTrayImageWithOpacity(object.statusItemBaseImage, iconOpacity);
3431
+ object.statusItem.length = width > 0 ? width : (requestedTitle.length > 0 ? NSVariableStatusItemLength : NSSquareStatusItemLength);
3432
+ }
3433
+
3434
+ void native_sdk_appkit_create_tray(native_sdk_appkit_host_t *host, const char *icon_path, size_t icon_path_len, const char *title, size_t title_len, const char *tooltip, size_t tooltip_len, double width, int tone, double icon_opacity, int monospaced, const char *activation_command, size_t activation_command_len, const char *alternate_activation_command, size_t alternate_activation_command_len, const char *open_command, size_t open_command_len) {
3263
3435
  NativeSdkChromiumHost *object = (__bridge NativeSdkChromiumHost *)host;
3264
3436
  @autoreleasepool {
3265
3437
  if (object.statusItem) {
3266
3438
  [[NSStatusBar systemStatusBar] removeStatusItem:object.statusItem];
3267
3439
  }
3440
+ object.statusMenu = nil;
3268
3441
  // A titled menu-bar extra needs variable width; icon-only status
3269
3442
  // items keep the classic square well.
3270
3443
  BOOL hasTitle = title != NULL && title_len > 0;
3271
3444
  object.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:hasTitle ? NSVariableStatusItemLength : NSSquareStatusItemLength];
3445
+ object.statusItemBaseImage = nil;
3272
3446
 
3273
3447
  if (icon_path && icon_path_len > 0) {
3274
3448
  NSString *path = [[NSString alloc] initWithBytes:icon_path length:icon_path_len encoding:NSUTF8StringEncoding];
@@ -3276,26 +3450,46 @@ void native_sdk_appkit_create_tray(native_sdk_appkit_host_t *host, const char *i
3276
3450
  if (image) {
3277
3451
  [image setTemplate:YES];
3278
3452
  image.size = NSMakeSize(18, 18);
3279
- object.statusItem.button.image = image;
3453
+ object.statusItemBaseImage = image;
3280
3454
  }
3281
3455
  }
3282
- if (hasTitle) {
3283
- object.statusItem.button.title = [[NSString alloc] initWithBytes:title length:title_len encoding:NSUTF8StringEncoding] ?: @"";
3284
- }
3285
- if (!object.statusItem.button.image && object.statusItem.button.title.length == 0) {
3286
- object.statusItem.button.title = object.appName.length > 0 ? [object.appName substringToIndex:MIN(1, object.appName.length)] : @"Z";
3287
- }
3456
+ NSString *titleString = hasTitle ? ([[NSString alloc] initWithBytes:title length:title_len encoding:NSUTF8StringEncoding] ?: @"") : @"";
3288
3457
  if (tooltip && tooltip_len > 0) {
3289
3458
  object.statusItem.button.toolTip = [[NSString alloc] initWithBytes:tooltip length:tooltip_len encoding:NSUTF8StringEncoding];
3290
3459
  }
3460
+ object.statusActivationCommand = activation_command ? ([[NSString alloc] initWithBytes:activation_command length:activation_command_len encoding:NSUTF8StringEncoding] ?: @"") : @"";
3461
+ object.statusAlternateActivationCommand = alternate_activation_command ? ([[NSString alloc] initWithBytes:alternate_activation_command length:alternate_activation_command_len encoding:NSUTF8StringEncoding] ?: @"") : @"";
3462
+ object.statusOpenCommand = open_command ? ([[NSString alloc] initWithBytes:open_command length:open_command_len encoding:NSUTF8StringEncoding] ?: @"") : @"";
3463
+ if (object.statusActivationCommand.length > 0 || object.statusAlternateActivationCommand.length > 0) {
3464
+ object.statusItem.button.target = object;
3465
+ object.statusItem.button.action = @selector(statusItemActivated:);
3466
+ [object.statusItem.button sendActionOn:NSEventMaskLeftMouseUp];
3467
+ }
3468
+ NativeSdkCefApplyTrayPresentation(object, titleString, width, tone, icon_opacity, monospaced != 0);
3291
3469
  }
3292
3470
  }
3293
3471
 
3294
- void native_sdk_appkit_update_tray_menu(native_sdk_appkit_host_t *host, const uint32_t *item_ids, const char *const *labels, const size_t *label_lens, const int *separators, const int *enabled_flags, size_t count) {
3472
+ static NSEventModifierFlags NativeSdkCefTrayModifiers(uint32_t modifiers) {
3473
+ NSEventModifierFlags flags = 0;
3474
+ if ((modifiers & (1u << 0)) != 0 || (modifiers & (1u << 1)) != 0) flags |= NSEventModifierFlagCommand;
3475
+ if ((modifiers & (1u << 2)) != 0) flags |= NSEventModifierFlagControl;
3476
+ if ((modifiers & (1u << 3)) != 0) flags |= NSEventModifierFlagOption;
3477
+ if ((modifiers & (1u << 4)) != 0) flags |= NSEventModifierFlagShift;
3478
+ return flags;
3479
+ }
3480
+
3481
+ void native_sdk_appkit_update_tray_menu(native_sdk_appkit_host_t *host, const uint32_t *item_ids, const char *const *labels, const size_t *label_lens, const int *separators, const int *enabled_flags, const char *const *details, const size_t *detail_lens, const int *roles, const char *const *keys, const size_t *key_lens, const uint32_t *modifiers, size_t count) {
3295
3482
  NativeSdkChromiumHost *object = (__bridge NativeSdkChromiumHost *)host;
3296
3483
  @autoreleasepool {
3297
3484
  if (!object.statusItem) return;
3298
- NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
3485
+ NSMenu *menu = object.statusMenu;
3486
+ if (menu == nil) {
3487
+ menu = [[NSMenu alloc] initWithTitle:@""];
3488
+ object.statusMenu = menu;
3489
+ } else {
3490
+ [menu removeAllItems];
3491
+ }
3492
+ menu.autoenablesItems = NO;
3299
3493
  for (size_t i = 0; i < count; i++) {
3300
3494
  if (separators[i]) {
3301
3495
  [menu addItem:[NSMenuItem separatorItem]];
@@ -3307,10 +3501,20 @@ void native_sdk_appkit_update_tray_menu(native_sdk_appkit_host_t *host, const ui
3307
3501
  keyEquivalent:@""];
3308
3502
  item.tag = (NSInteger)item_ids[i];
3309
3503
  item.target = object;
3310
- item.enabled = enabled_flags[i] != 0;
3504
+ item.enabled = enabled_flags[i] != 0 && (roles[i] == 0 || roles[i] == 4);
3505
+ if (details[i] && detail_lens[i] > 0) {
3506
+ NSString *detail = [[NSString alloc] initWithBytes:details[i] length:detail_lens[i] encoding:NSUTF8StringEncoding] ?: @"";
3507
+ if (detail.length > 0 && roles[i] != 0) item.title = [NSString stringWithFormat:@"%@ — %@", label ?: @"", detail];
3508
+ }
3509
+ if (keys[i] && key_lens[i] > 0) {
3510
+ NSString *key = [[NSString alloc] initWithBytes:keys[i] length:key_lens[i] encoding:NSUTF8StringEncoding] ?: @"";
3511
+ item.keyEquivalent = key.lowercaseString;
3512
+ item.keyEquivalentModifierMask = NativeSdkCefTrayModifiers(modifiers[i]);
3513
+ }
3311
3514
  [menu addItem:item];
3312
3515
  }
3313
- object.statusItem.menu = menu;
3516
+ menu.delegate = object;
3517
+ if (object.statusActivationCommand.length == 0 && object.statusAlternateActivationCommand.length == 0) object.statusItem.menu = menu;
3314
3518
  }
3315
3519
  }
3316
3520
 
@@ -3331,17 +3535,23 @@ void native_sdk_appkit_update_tray_title(native_sdk_appkit_host_t *host, const c
3331
3535
  NativeSdkChromiumHost *object = (__bridge NativeSdkChromiumHost *)host;
3332
3536
  @autoreleasepool {
3333
3537
  if (!object.statusItem) return;
3334
- BOOL hasTitle = title != NULL && title_len > 0;
3335
- NSString *value = hasTitle ? ([[NSString alloc] initWithBytes:title length:title_len encoding:NSUTF8StringEncoding] ?: @"") : @"";
3336
- object.statusItem.button.title = value;
3337
- if (!object.statusItem.button.image && value.length == 0) {
3338
- // Same fallback as create: a bare status item must still show
3339
- // SOMETHING to stay clickable.
3340
- object.statusItem.button.title = object.appName.length > 0 ? [object.appName substringToIndex:MIN(1, object.appName.length)] : @"Z";
3341
- }
3342
- // Titled extras need variable width; icon-only ones keep the
3343
- // classic square well (mirrors create's length choice).
3344
- object.statusItem.length = object.statusItem.button.title.length > 0 ? NSVariableStatusItemLength : NSSquareStatusItemLength;
3538
+ NSString *value = title && title_len > 0 ? ([[NSString alloc] initWithBytes:title length:title_len encoding:NSUTF8StringEncoding] ?: @"") : @"";
3539
+ NativeSdkCefApplyTrayPresentation(
3540
+ object,
3541
+ value,
3542
+ object.statusPresentationWidth,
3543
+ object.statusPresentationTone,
3544
+ object.statusPresentationIconOpacity,
3545
+ object.statusPresentationMonospaced
3546
+ );
3547
+ }
3548
+ }
3549
+
3550
+ void native_sdk_appkit_update_tray_presentation(native_sdk_appkit_host_t *host, const char *title, size_t title_len, double width, int tone, double icon_opacity, int monospaced) {
3551
+ NativeSdkChromiumHost *object = (__bridge NativeSdkChromiumHost *)host;
3552
+ @autoreleasepool {
3553
+ NSString *value = title ? ([[NSString alloc] initWithBytes:title length:title_len encoding:NSUTF8StringEncoding] ?: @"") : @"";
3554
+ NativeSdkCefApplyTrayPresentation(object, value, width, tone, icon_opacity, monospaced != 0);
3345
3555
  }
3346
3556
  }
3347
3557
 
@@ -3350,6 +3560,8 @@ void native_sdk_appkit_remove_tray(native_sdk_appkit_host_t *host) {
3350
3560
  if (object.statusItem) {
3351
3561
  [[NSStatusBar systemStatusBar] removeStatusItem:object.statusItem];
3352
3562
  object.statusItem = nil;
3563
+ object.statusItemBaseImage = nil;
3564
+ object.statusMenu = nil;
3353
3565
  }
3354
3566
  }
3355
3567
 
@@ -3411,6 +3623,28 @@ void native_sdk_appkit_set_tray_callback(native_sdk_appkit_host_t *host, native_
3411
3623
  object.trayContext = context;
3412
3624
  }
3413
3625
 
3626
+ int native_sdk_appkit_audio_capture_start(native_sdk_appkit_host_t *host, int source, uint32_t sample_rate, uint8_t channels, native_sdk_appkit_audio_capture_push_t callback, void *context) {
3627
+ (void)host;
3628
+ (void)source;
3629
+ (void)sample_rate;
3630
+ (void)channels;
3631
+ (void)callback;
3632
+ (void)context;
3633
+ return 0;
3634
+ }
3635
+
3636
+ int native_sdk_appkit_audio_capture_stop(native_sdk_appkit_host_t *host, int source) {
3637
+ (void)host;
3638
+ (void)source;
3639
+ return 0;
3640
+ }
3641
+
3642
+ int native_sdk_appkit_audio_capture_supported(native_sdk_appkit_host_t *host, int source) {
3643
+ (void)host;
3644
+ (void)source;
3645
+ return 0;
3646
+ }
3647
+
3414
3648
  /* Native context menu, CEF engine: same NSMenu presentation as the
3415
3649
  * system-engine host, anchored to the window content view (gpu-surface
3416
3650
  * views are system-engine-only, so `label` resolves to the window). */