@geastack/apple 0.2.8

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 (113) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +54 -0
  3. package/dist/index.d.ts +127 -0
  4. package/dist/index.js +3076 -0
  5. package/generated/AVFoundation.d.ts +112 -0
  6. package/generated/ActivityKit.d.ts +7 -0
  7. package/generated/AppKit.d.ts +268 -0
  8. package/generated/CoreGraphics.d.ts +18 -0
  9. package/generated/CoreLocation.d.ts +28 -0
  10. package/generated/CoreMedia.d.ts +8 -0
  11. package/generated/Dispatch.d.ts +2 -0
  12. package/generated/Foundation.d.ts +13 -0
  13. package/generated/MapKit.d.ts +28 -0
  14. package/generated/Metal.d.ts +91 -0
  15. package/generated/MetalKit.d.ts +22 -0
  16. package/generated/Photos.d.ts +5 -0
  17. package/generated/QuartzCore.d.ts +12 -0
  18. package/generated/SwiftData.d.ts +11 -0
  19. package/generated/UIKit.d.ts +187 -0
  20. package/package.json +123 -0
  21. package/runtime/AVFoundation.js +136 -0
  22. package/runtime/ActivityKit.js +18 -0
  23. package/runtime/AppKit.js +313 -0
  24. package/runtime/CoreGraphics.js +15 -0
  25. package/runtime/CoreLocation.js +30 -0
  26. package/runtime/CoreMedia.js +7 -0
  27. package/runtime/Dispatch.js +11 -0
  28. package/runtime/Foundation.js +21 -0
  29. package/runtime/MapKit.js +22 -0
  30. package/runtime/Metal.js +126 -0
  31. package/runtime/MetalKit.js +15 -0
  32. package/runtime/Photos.js +9 -0
  33. package/runtime/QuartzCore.js +9 -0
  34. package/runtime/SwiftData.js +29 -0
  35. package/runtime/UIKit.js +242 -0
  36. package/runtime/empty.js +1 -0
  37. package/targets/ios/Info.plist.in +25 -0
  38. package/targets/ios/README.md +46 -0
  39. package/targets/ios/build-ios.sh +395 -0
  40. package/targets/ios/detect-development-team.mjs +109 -0
  41. package/targets/ios/generate-resident-entry.mjs +67 -0
  42. package/targets/ios/generate-resident-registry.mjs +162 -0
  43. package/targets/ios/generate-xcode-project.mjs +520 -0
  44. package/targets/ios/main/canvas_view.h +7 -0
  45. package/targets/ios/main/canvas_view.mm +94 -0
  46. package/targets/ios/main/font_registry.h +17 -0
  47. package/targets/ios/main/font_registry.mm +129 -0
  48. package/targets/ios/main/image_bridge.h +13 -0
  49. package/targets/ios/main/image_bridge.mm +53 -0
  50. package/targets/ios/main/ios_apps.c +28 -0
  51. package/targets/ios/main/ios_camera.mm +446 -0
  52. package/targets/ios/main/ios_display.mm +344 -0
  53. package/targets/ios/main/ios_main.mm +811 -0
  54. package/targets/ios/main/ios_memory.cpp +55 -0
  55. package/targets/ios/main/ios_renderer.h +20 -0
  56. package/targets/ios/main/ios_renderer.mm +27 -0
  57. package/targets/ios/main/ios_root_background.cpp +20 -0
  58. package/targets/ios/main/ios_root_background.h +11 -0
  59. package/targets/ios/main/ios_sensors.mm +244 -0
  60. package/targets/ios/main/ios_timers.mm +53 -0
  61. package/targets/ios/main/renderer/ios_renderer_internal.h +65 -0
  62. package/targets/ios/main/renderer/ios_renderer_support.mm +111 -0
  63. package/targets/ios/main/renderer/native_button.mm +179 -0
  64. package/targets/ios/main/renderer/native_label.mm +161 -0
  65. package/targets/ios/main/renderer/native_scroll_container.mm +279 -0
  66. package/targets/ios/main/renderer/view_reconciler.mm +274 -0
  67. package/targets/macos/Info.plist.in +26 -0
  68. package/targets/macos/README.md +131 -0
  69. package/targets/macos/build-child-lifecycle.sh +119 -0
  70. package/targets/macos/build-macos.sh +2156 -0
  71. package/targets/macos/check-module-graph-freshness.mjs +82 -0
  72. package/targets/macos/compiler-input-fingerprint.mjs +32 -0
  73. package/targets/macos/finalize-apple-native-output.mjs +77 -0
  74. package/targets/macos/generate-resident-entry.mjs +80 -0
  75. package/targets/macos/generate-resident-registry.mjs +141 -0
  76. package/targets/macos/heavy-build-lock.sh +176 -0
  77. package/targets/macos/main/canvas_view.h +9 -0
  78. package/targets/macos/main/canvas_view.mm +176 -0
  79. package/targets/macos/main/color_convert.h +18 -0
  80. package/targets/macos/main/color_convert.mm +39 -0
  81. package/targets/macos/main/font_registry.h +35 -0
  82. package/targets/macos/main/font_registry.mm +350 -0
  83. package/targets/macos/main/image_bridge.h +16 -0
  84. package/targets/macos/main/image_bridge.mm +52 -0
  85. package/targets/macos/main/macos_app_platform.mm +95 -0
  86. package/targets/macos/main/macos_apps.c +31 -0
  87. package/targets/macos/main/macos_device_control.mm +56 -0
  88. package/targets/macos/main/macos_display.mm +484 -0
  89. package/targets/macos/main/macos_host_device_control.mm +95 -0
  90. package/targets/macos/main/macos_main.mm +839 -0
  91. package/targets/macos/main/macos_memory.cpp +31 -0
  92. package/targets/macos/main/macos_native_shell.h +31 -0
  93. package/targets/macos/main/macos_native_shell.mm +396 -0
  94. package/targets/macos/main/macos_network.mm +253 -0
  95. package/targets/macos/main/macos_renderer.h +39 -0
  96. package/targets/macos/main/macos_renderer.mm +1969 -0
  97. package/targets/macos/main/macos_sensors.cpp +148 -0
  98. package/targets/macos/main/macos_smoke_app.cpp +65 -0
  99. package/targets/macos/main/macos_timers.mm +52 -0
  100. package/targets/macos/main/press_bridge.h +21 -0
  101. package/targets/macos/main/press_bridge.mm +72 -0
  102. package/targets/macos/main/thermalright_hid_display.h +14 -0
  103. package/targets/macos/main/thermalright_hid_display.mm +995 -0
  104. package/targets/macos/native-artifact-provenance.mjs +421 -0
  105. package/targets/macos/order-compile-edges.mjs +64 -0
  106. package/targets/macos/preflight-hard-muted-artifact.mjs +93 -0
  107. package/targets/macos/prune-generated-modules.mjs +147 -0
  108. package/targets/macos/sync-resources.mjs +153 -0
  109. package/targets/shared/analyze-audio-capture.mjs +131 -0
  110. package/targets/shared/apple_audio.mm +1194 -0
  111. package/targets/shared/apple_audio_selftest.mm +602 -0
  112. package/targets/shared/apple_audio_testing.h +34 -0
  113. package/targets/shared/build-audio-selftest.sh +50 -0
@@ -0,0 +1,95 @@
1
+ // gea::host::DeviceControl::exec — host shell exec for gea (CSS-runtime) apps on
2
+ // macOS. The gea Companion drives scripts/esp32-device-control.py (GEADEV over
3
+ // USB) and scripts/install-app.mjs (install/uninstall) through this.
4
+ //
5
+ // NON-BLOCKING by design: the macOS gea runtime runs its rAF/update loop on the
6
+ // MAIN thread. A synchronous NSTask here (≈5s per call when the watch is offline,
7
+ // and the companion polls two per cycle) would freeze the window — no clicks, no
8
+ // scrolling, no resize. So exec() returns the LAST cached result for a command
9
+ // immediately and refreshes it on a background queue; the reactive store reads the
10
+ // updated value on a later tick. Action commands (setFace/brightness/install) are
11
+ // fire-and-forget — the ignored return is fine, the work still runs off-main.
12
+ #import <Foundation/Foundation.h>
13
+
14
+ #include <map>
15
+ #include <mutex>
16
+ #include <set>
17
+ #include <string>
18
+
19
+ #include "host/device_control.h"
20
+
21
+ namespace {
22
+ std::mutex g_mutex;
23
+ std::map<std::string, std::string> g_cache;
24
+ std::set<std::string> g_inflight;
25
+
26
+ std::string trimTrailingNewlines(std::string value)
27
+ {
28
+ while (!value.empty() && (value.back() == '\n' || value.back() == '\r')) {
29
+ value.pop_back();
30
+ }
31
+ return value;
32
+ }
33
+
34
+ std::string runBlocking(const std::string &command)
35
+ {
36
+ @autoreleasepool {
37
+ NSString *cmd = [NSString stringWithUTF8String:command.c_str()];
38
+ NSTask *task = [[NSTask alloc] init];
39
+ // -lc: login shell so PATH includes the user's python3/node (pyserial etc.).
40
+ task.launchPath = @"/bin/bash";
41
+ task.arguments = @[ @"-lc", cmd ];
42
+ NSMutableDictionary *environment = [[[NSProcessInfo processInfo] environment] mutableCopy];
43
+ NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
44
+ if (resourcePath) {
45
+ environment[@"GEA_COMPANION_RESOURCES"] = resourcePath;
46
+ NSString *toolsPath = [resourcePath stringByAppendingPathComponent:@"CompanionTools"];
47
+ environment[@"GEA_COMPANION_TOOLS"] = toolsPath;
48
+ }
49
+ task.environment = environment;
50
+ NSPipe *pipe = [NSPipe pipe];
51
+ task.standardOutput = pipe;
52
+ task.standardError = pipe;
53
+
54
+ std::string result;
55
+ @try {
56
+ [task launch];
57
+ NSData *data = [[pipe fileHandleForReading] readDataToEndOfFile];
58
+ [task waitUntilExit];
59
+ NSString *out = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
60
+ result = out ? std::string([out UTF8String]) : std::string();
61
+ } @catch (NSException *ex) {
62
+ result = std::string();
63
+ }
64
+ return trimTrailingNewlines(result);
65
+ }
66
+ }
67
+ } // namespace
68
+
69
+ std::string gea::host::DeviceControlFacade::exec(const std::string &command) const
70
+ {
71
+ std::string cached;
72
+ bool shouldDispatch = false;
73
+ {
74
+ std::lock_guard<std::mutex> lock(g_mutex);
75
+ auto it = g_cache.find(command);
76
+ if (it != g_cache.end()) cached = it->second;
77
+ // De-dupe only concurrent identical runs; once a run finishes, the next
78
+ // exec() of the same command re-dispatches — so polls refresh each cycle
79
+ // and repeated actions re-fire.
80
+ if (g_inflight.find(command) == g_inflight.end()) {
81
+ g_inflight.insert(command);
82
+ shouldDispatch = true;
83
+ }
84
+ }
85
+ if (shouldDispatch) {
86
+ std::string cmd = command;
87
+ dispatch_async(dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), ^{
88
+ std::string result = runBlocking(cmd);
89
+ std::lock_guard<std::mutex> lock(g_mutex);
90
+ g_cache[cmd] = result;
91
+ g_inflight.erase(cmd);
92
+ });
93
+ }
94
+ return cached;
95
+ }