@jsonstudio/zterm-daemon-darwin-arm64 0.0.0-stage → 0.1.3

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 (318) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +2 -2
  3. package/package.json +25 -4
  4. package/runtime/dagpipe.node +0 -0
  5. package/runtime/node_modules/@roamhq/wrtc/AUTHORS +17 -0
  6. package/runtime/node_modules/@roamhq/wrtc/CHANGELOG.md +1094 -0
  7. package/runtime/node_modules/@roamhq/wrtc/LICENSE.md +30 -0
  8. package/runtime/node_modules/@roamhq/wrtc/README.md +74 -0
  9. package/runtime/node_modules/@roamhq/wrtc/lib/binding.js +31 -0
  10. package/runtime/node_modules/@roamhq/wrtc/lib/browser.js +18 -0
  11. package/runtime/node_modules/@roamhq/wrtc/lib/datachannelevent.js +26 -0
  12. package/runtime/node_modules/@roamhq/wrtc/lib/datachannelmessageevent.js +9 -0
  13. package/runtime/node_modules/@roamhq/wrtc/lib/error.js +20 -0
  14. package/runtime/node_modules/@roamhq/wrtc/lib/eventtarget.js +59 -0
  15. package/runtime/node_modules/@roamhq/wrtc/lib/icecandidate.js +43 -0
  16. package/runtime/node_modules/@roamhq/wrtc/lib/index.js +85 -0
  17. package/runtime/node_modules/@roamhq/wrtc/lib/mediadevices.js +30 -0
  18. package/runtime/node_modules/@roamhq/wrtc/lib/peerconnection.js +333 -0
  19. package/runtime/node_modules/@roamhq/wrtc/lib/rtcpeerconnectioniceerrorevent.js +36 -0
  20. package/runtime/node_modules/@roamhq/wrtc/lib/rtcpeerconnectioniceevent.js +20 -0
  21. package/runtime/node_modules/@roamhq/wrtc/lib/sessiondescription.js +19 -0
  22. package/runtime/node_modules/@roamhq/wrtc/package.json +68 -0
  23. package/runtime/node_modules/@roamhq/wrtc/types/index.d.ts +32 -0
  24. package/runtime/node_modules/@roamhq/wrtc/types/nonstandard.d.ts +81 -0
  25. package/runtime/node_modules/@roamhq/wrtc-darwin-arm64/index.js +1 -0
  26. package/runtime/node_modules/@roamhq/wrtc-darwin-arm64/package.json +16 -0
  27. package/runtime/node_modules/@roamhq/wrtc-darwin-arm64/wrtc.node +0 -0
  28. package/runtime/node_modules/node-pty/LICENSE +69 -0
  29. package/runtime/node_modules/node-pty/README.md +165 -0
  30. package/runtime/node_modules/node-pty/binding.gyp +111 -0
  31. package/runtime/node_modules/node-pty/deps/.editorconfig +2 -0
  32. package/runtime/node_modules/node-pty/deps/winpty/.drone.yml +17 -0
  33. package/runtime/node_modules/node-pty/deps/winpty/.gitattributes +19 -0
  34. package/runtime/node_modules/node-pty/deps/winpty/LICENSE +21 -0
  35. package/runtime/node_modules/node-pty/deps/winpty/Makefile +166 -0
  36. package/runtime/node_modules/node-pty/deps/winpty/README.md +151 -0
  37. package/runtime/node_modules/node-pty/deps/winpty/RELEASES.md +280 -0
  38. package/runtime/node_modules/node-pty/deps/winpty/VERSION.txt +1 -0
  39. package/runtime/node_modules/node-pty/deps/winpty/configure +167 -0
  40. package/runtime/node_modules/node-pty/deps/winpty/misc/BufferResizeTests.cc +90 -0
  41. package/runtime/node_modules/node-pty/deps/winpty/misc/ChangeScreenBuffer.cc +53 -0
  42. package/runtime/node_modules/node-pty/deps/winpty/misc/ClearConsole.cc +72 -0
  43. package/runtime/node_modules/node-pty/deps/winpty/misc/ConinMode.cc +117 -0
  44. package/runtime/node_modules/node-pty/deps/winpty/misc/ConinMode.ps1 +116 -0
  45. package/runtime/node_modules/node-pty/deps/winpty/misc/ConoutMode.cc +113 -0
  46. package/runtime/node_modules/node-pty/deps/winpty/misc/DebugClient.py +42 -0
  47. package/runtime/node_modules/node-pty/deps/winpty/misc/DebugServer.py +63 -0
  48. package/runtime/node_modules/node-pty/deps/winpty/misc/DumpLines.py +5 -0
  49. package/runtime/node_modules/node-pty/deps/winpty/misc/EnableExtendedFlags.txt +46 -0
  50. package/runtime/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +528 -0
  51. package/runtime/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +633 -0
  52. package/runtime/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP932.txt +630 -0
  53. package/runtime/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP936.txt +630 -0
  54. package/runtime/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP949.txt +630 -0
  55. package/runtime/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP950.txt +630 -0
  56. package/runtime/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +16 -0
  57. package/runtime/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Results.txt +4 -0
  58. package/runtime/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +144 -0
  59. package/runtime/node_modules/node-pty/deps/winpty/misc/FontSurvey.cc +100 -0
  60. package/runtime/node_modules/node-pty/deps/winpty/misc/FormatChar.h +21 -0
  61. package/runtime/node_modules/node-pty/deps/winpty/misc/FreezePerfTest.cc +62 -0
  62. package/runtime/node_modules/node-pty/deps/winpty/misc/GetCh.cc +20 -0
  63. package/runtime/node_modules/node-pty/deps/winpty/misc/GetConsolePos.cc +41 -0
  64. package/runtime/node_modules/node-pty/deps/winpty/misc/GetFont.cc +261 -0
  65. package/runtime/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 +51 -0
  66. package/runtime/node_modules/node-pty/deps/winpty/misc/IsNewConsole.cc +87 -0
  67. package/runtime/node_modules/node-pty/deps/winpty/misc/MouseInputNotes.txt +90 -0
  68. package/runtime/node_modules/node-pty/deps/winpty/misc/MoveConsoleWindow.cc +34 -0
  69. package/runtime/node_modules/node-pty/deps/winpty/misc/Notes.txt +219 -0
  70. package/runtime/node_modules/node-pty/deps/winpty/misc/OSVersion.cc +27 -0
  71. package/runtime/node_modules/node-pty/deps/winpty/misc/ScreenBufferFreezeInactive.cc +101 -0
  72. package/runtime/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest.cc +671 -0
  73. package/runtime/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest2.cc +151 -0
  74. package/runtime/node_modules/node-pty/deps/winpty/misc/SelectAllTest.cc +45 -0
  75. package/runtime/node_modules/node-pty/deps/winpty/misc/SetBufferSize.cc +32 -0
  76. package/runtime/node_modules/node-pty/deps/winpty/misc/SetCursorPos.cc +10 -0
  77. package/runtime/node_modules/node-pty/deps/winpty/misc/SetFont.cc +145 -0
  78. package/runtime/node_modules/node-pty/deps/winpty/misc/SetWindowRect.cc +36 -0
  79. package/runtime/node_modules/node-pty/deps/winpty/misc/ShowArgv.cc +12 -0
  80. package/runtime/node_modules/node-pty/deps/winpty/misc/ShowConsoleInput.cc +40 -0
  81. package/runtime/node_modules/node-pty/deps/winpty/misc/Spew.py +5 -0
  82. package/runtime/node_modules/node-pty/deps/winpty/misc/TestUtil.cc +172 -0
  83. package/runtime/node_modules/node-pty/deps/winpty/misc/UnicodeDoubleWidthTest.cc +102 -0
  84. package/runtime/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest1.cc +246 -0
  85. package/runtime/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest2.cc +130 -0
  86. package/runtime/node_modules/node-pty/deps/winpty/misc/UnixEcho.cc +89 -0
  87. package/runtime/node_modules/node-pty/deps/winpty/misc/Utf16Echo.cc +46 -0
  88. package/runtime/node_modules/node-pty/deps/winpty/misc/VeryLargeRead.cc +122 -0
  89. package/runtime/node_modules/node-pty/deps/winpty/misc/VkEscapeTest.cc +56 -0
  90. package/runtime/node_modules/node-pty/deps/winpty/misc/Win10ResizeWhileFrozen.cc +52 -0
  91. package/runtime/node_modules/node-pty/deps/winpty/misc/Win10WrapTest1.cc +57 -0
  92. package/runtime/node_modules/node-pty/deps/winpty/misc/Win10WrapTest2.cc +30 -0
  93. package/runtime/node_modules/node-pty/deps/winpty/misc/Win32Echo1.cc +26 -0
  94. package/runtime/node_modules/node-pty/deps/winpty/misc/Win32Echo2.cc +19 -0
  95. package/runtime/node_modules/node-pty/deps/winpty/misc/Win32Test1.cc +46 -0
  96. package/runtime/node_modules/node-pty/deps/winpty/misc/Win32Test2.cc +70 -0
  97. package/runtime/node_modules/node-pty/deps/winpty/misc/Win32Test3.cc +78 -0
  98. package/runtime/node_modules/node-pty/deps/winpty/misc/Win32Write1.cc +44 -0
  99. package/runtime/node_modules/node-pty/deps/winpty/misc/WindowsBugCrashReader.cc +27 -0
  100. package/runtime/node_modules/node-pty/deps/winpty/misc/WriteConsole.cc +106 -0
  101. package/runtime/node_modules/node-pty/deps/winpty/misc/build32.sh +9 -0
  102. package/runtime/node_modules/node-pty/deps/winpty/misc/build64.sh +9 -0
  103. package/runtime/node_modules/node-pty/deps/winpty/misc/color-test.sh +212 -0
  104. package/runtime/node_modules/node-pty/deps/winpty/misc/font-notes.txt +300 -0
  105. package/runtime/node_modules/node-pty/deps/winpty/misc/winbug-15048.cc +201 -0
  106. package/runtime/node_modules/node-pty/deps/winpty/ship/build-pty4j-libpty.bat +36 -0
  107. package/runtime/node_modules/node-pty/deps/winpty/ship/common_ship.py +53 -0
  108. package/runtime/node_modules/node-pty/deps/winpty/ship/make_msvc_package.py +165 -0
  109. package/runtime/node_modules/node-pty/deps/winpty/ship/ship.py +108 -0
  110. package/runtime/node_modules/node-pty/deps/winpty/src/agent/Agent.cc +613 -0
  111. package/runtime/node_modules/node-pty/deps/winpty/src/agent/Agent.h +103 -0
  112. package/runtime/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.cc +84 -0
  113. package/runtime/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.h +28 -0
  114. package/runtime/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.cc +632 -0
  115. package/runtime/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.h +28 -0
  116. package/runtime/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.cc +852 -0
  117. package/runtime/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.h +109 -0
  118. package/runtime/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.cc +121 -0
  119. package/runtime/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.h +36 -0
  120. package/runtime/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.cc +152 -0
  121. package/runtime/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.h +41 -0
  122. package/runtime/node_modules/node-pty/deps/winpty/src/agent/Coord.h +87 -0
  123. package/runtime/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.cc +239 -0
  124. package/runtime/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.h +32 -0
  125. package/runtime/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.cc +422 -0
  126. package/runtime/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.h +28 -0
  127. package/runtime/node_modules/node-pty/deps/winpty/src/agent/DsrSender.h +30 -0
  128. package/runtime/node_modules/node-pty/deps/winpty/src/agent/EventLoop.cc +99 -0
  129. package/runtime/node_modules/node-pty/deps/winpty/src/agent/EventLoop.h +47 -0
  130. package/runtime/node_modules/node-pty/deps/winpty/src/agent/InputMap.cc +246 -0
  131. package/runtime/node_modules/node-pty/deps/winpty/src/agent/InputMap.h +114 -0
  132. package/runtime/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.cc +71 -0
  133. package/runtime/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.h +68 -0
  134. package/runtime/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.cc +378 -0
  135. package/runtime/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.h +125 -0
  136. package/runtime/node_modules/node-pty/deps/winpty/src/agent/Scraper.cc +699 -0
  137. package/runtime/node_modules/node-pty/deps/winpty/src/agent/Scraper.h +103 -0
  138. package/runtime/node_modules/node-pty/deps/winpty/src/agent/SimplePool.h +75 -0
  139. package/runtime/node_modules/node-pty/deps/winpty/src/agent/SmallRect.h +143 -0
  140. package/runtime/node_modules/node-pty/deps/winpty/src/agent/Terminal.cc +535 -0
  141. package/runtime/node_modules/node-pty/deps/winpty/src/agent/Terminal.h +69 -0
  142. package/runtime/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncoding.h +157 -0
  143. package/runtime/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncodingTest.cc +189 -0
  144. package/runtime/node_modules/node-pty/deps/winpty/src/agent/Win32Console.cc +107 -0
  145. package/runtime/node_modules/node-pty/deps/winpty/src/agent/Win32Console.h +67 -0
  146. package/runtime/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.cc +193 -0
  147. package/runtime/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.h +99 -0
  148. package/runtime/node_modules/node-pty/deps/winpty/src/agent/main.cc +114 -0
  149. package/runtime/node_modules/node-pty/deps/winpty/src/agent/subdir.mk +61 -0
  150. package/runtime/node_modules/node-pty/deps/winpty/src/configurations.gypi +60 -0
  151. package/runtime/node_modules/node-pty/deps/winpty/src/debugserver/DebugServer.cc +117 -0
  152. package/runtime/node_modules/node-pty/deps/winpty/src/debugserver/subdir.mk +41 -0
  153. package/runtime/node_modules/node-pty/deps/winpty/src/include/winpty.h +242 -0
  154. package/runtime/node_modules/node-pty/deps/winpty/src/include/winpty_constants.h +131 -0
  155. package/runtime/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.cc +75 -0
  156. package/runtime/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.h +28 -0
  157. package/runtime/node_modules/node-pty/deps/winpty/src/libwinpty/LibWinptyException.h +54 -0
  158. package/runtime/node_modules/node-pty/deps/winpty/src/libwinpty/WinptyInternal.h +72 -0
  159. package/runtime/node_modules/node-pty/deps/winpty/src/libwinpty/subdir.mk +46 -0
  160. package/runtime/node_modules/node-pty/deps/winpty/src/libwinpty/winpty.cc +970 -0
  161. package/runtime/node_modules/node-pty/deps/winpty/src/shared/AgentMsg.h +38 -0
  162. package/runtime/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.cc +122 -0
  163. package/runtime/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.h +73 -0
  164. package/runtime/node_modules/node-pty/deps/winpty/src/shared/Buffer.cc +103 -0
  165. package/runtime/node_modules/node-pty/deps/winpty/src/shared/Buffer.h +102 -0
  166. package/runtime/node_modules/node-pty/deps/winpty/src/shared/DebugClient.cc +187 -0
  167. package/runtime/node_modules/node-pty/deps/winpty/src/shared/DebugClient.h +38 -0
  168. package/runtime/node_modules/node-pty/deps/winpty/src/shared/GenRandom.cc +138 -0
  169. package/runtime/node_modules/node-pty/deps/winpty/src/shared/GenRandom.h +55 -0
  170. package/runtime/node_modules/node-pty/deps/winpty/src/shared/GetCommitHash.bat +13 -0
  171. package/runtime/node_modules/node-pty/deps/winpty/src/shared/Mutex.h +54 -0
  172. package/runtime/node_modules/node-pty/deps/winpty/src/shared/OsModule.h +63 -0
  173. package/runtime/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.cc +36 -0
  174. package/runtime/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.h +45 -0
  175. package/runtime/node_modules/node-pty/deps/winpty/src/shared/PrecompiledHeader.h +43 -0
  176. package/runtime/node_modules/node-pty/deps/winpty/src/shared/StringBuilder.h +227 -0
  177. package/runtime/node_modules/node-pty/deps/winpty/src/shared/StringBuilderTest.cc +114 -0
  178. package/runtime/node_modules/node-pty/deps/winpty/src/shared/StringUtil.cc +55 -0
  179. package/runtime/node_modules/node-pty/deps/winpty/src/shared/StringUtil.h +80 -0
  180. package/runtime/node_modules/node-pty/deps/winpty/src/shared/TimeMeasurement.h +63 -0
  181. package/runtime/node_modules/node-pty/deps/winpty/src/shared/UnixCtrlChars.h +45 -0
  182. package/runtime/node_modules/node-pty/deps/winpty/src/shared/UpdateGenVersion.bat +20 -0
  183. package/runtime/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.cc +460 -0
  184. package/runtime/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.h +104 -0
  185. package/runtime/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.cc +252 -0
  186. package/runtime/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.h +29 -0
  187. package/runtime/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.cc +55 -0
  188. package/runtime/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.h +64 -0
  189. package/runtime/node_modules/node-pty/deps/winpty/src/shared/WinptyException.cc +57 -0
  190. package/runtime/node_modules/node-pty/deps/winpty/src/shared/WinptyException.h +43 -0
  191. package/runtime/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.cc +42 -0
  192. package/runtime/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.h +27 -0
  193. package/runtime/node_modules/node-pty/deps/winpty/src/shared/winpty_snprintf.h +99 -0
  194. package/runtime/node_modules/node-pty/deps/winpty/src/subdir.mk +5 -0
  195. package/runtime/node_modules/node-pty/deps/winpty/src/tests/subdir.mk +28 -0
  196. package/runtime/node_modules/node-pty/deps/winpty/src/tests/trivial_test.cc +158 -0
  197. package/runtime/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.cc +114 -0
  198. package/runtime/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.h +56 -0
  199. package/runtime/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.cc +80 -0
  200. package/runtime/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.h +53 -0
  201. package/runtime/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.cc +86 -0
  202. package/runtime/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.h +31 -0
  203. package/runtime/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.cc +70 -0
  204. package/runtime/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.h +42 -0
  205. package/runtime/node_modules/node-pty/deps/winpty/src/unix-adapter/main.cc +729 -0
  206. package/runtime/node_modules/node-pty/deps/winpty/src/unix-adapter/subdir.mk +41 -0
  207. package/runtime/node_modules/node-pty/deps/winpty/src/winpty.gyp +234 -0
  208. package/runtime/node_modules/node-pty/deps/winpty/vcbuild.bat +83 -0
  209. package/runtime/node_modules/node-pty/lib/conpty_console_list_agent.js +16 -0
  210. package/runtime/node_modules/node-pty/lib/conpty_console_list_agent.js.map +1 -0
  211. package/runtime/node_modules/node-pty/lib/eventEmitter2.js +47 -0
  212. package/runtime/node_modules/node-pty/lib/eventEmitter2.js.map +1 -0
  213. package/runtime/node_modules/node-pty/lib/eventEmitter2.test.js +30 -0
  214. package/runtime/node_modules/node-pty/lib/eventEmitter2.test.js.map +1 -0
  215. package/runtime/node_modules/node-pty/lib/index.js +52 -0
  216. package/runtime/node_modules/node-pty/lib/index.js.map +1 -0
  217. package/runtime/node_modules/node-pty/lib/interfaces.js +7 -0
  218. package/runtime/node_modules/node-pty/lib/interfaces.js.map +1 -0
  219. package/runtime/node_modules/node-pty/lib/shared/conout.js +11 -0
  220. package/runtime/node_modules/node-pty/lib/shared/conout.js.map +1 -0
  221. package/runtime/node_modules/node-pty/lib/terminal.js +190 -0
  222. package/runtime/node_modules/node-pty/lib/terminal.js.map +1 -0
  223. package/runtime/node_modules/node-pty/lib/terminal.test.js +139 -0
  224. package/runtime/node_modules/node-pty/lib/terminal.test.js.map +1 -0
  225. package/runtime/node_modules/node-pty/lib/testUtils.test.js +28 -0
  226. package/runtime/node_modules/node-pty/lib/testUtils.test.js.map +1 -0
  227. package/runtime/node_modules/node-pty/lib/types.js +7 -0
  228. package/runtime/node_modules/node-pty/lib/types.js.map +1 -0
  229. package/runtime/node_modules/node-pty/lib/unixTerminal.js +346 -0
  230. package/runtime/node_modules/node-pty/lib/unixTerminal.js.map +1 -0
  231. package/runtime/node_modules/node-pty/lib/unixTerminal.test.js +351 -0
  232. package/runtime/node_modules/node-pty/lib/unixTerminal.test.js.map +1 -0
  233. package/runtime/node_modules/node-pty/lib/utils.js +39 -0
  234. package/runtime/node_modules/node-pty/lib/utils.js.map +1 -0
  235. package/runtime/node_modules/node-pty/lib/windowsConoutConnection.js +125 -0
  236. package/runtime/node_modules/node-pty/lib/windowsConoutConnection.js.map +1 -0
  237. package/runtime/node_modules/node-pty/lib/windowsPtyAgent.js +320 -0
  238. package/runtime/node_modules/node-pty/lib/windowsPtyAgent.js.map +1 -0
  239. package/runtime/node_modules/node-pty/lib/windowsPtyAgent.test.js +90 -0
  240. package/runtime/node_modules/node-pty/lib/windowsPtyAgent.test.js.map +1 -0
  241. package/runtime/node_modules/node-pty/lib/windowsTerminal.js +199 -0
  242. package/runtime/node_modules/node-pty/lib/windowsTerminal.js.map +1 -0
  243. package/runtime/node_modules/node-pty/lib/windowsTerminal.test.js +219 -0
  244. package/runtime/node_modules/node-pty/lib/windowsTerminal.test.js.map +1 -0
  245. package/runtime/node_modules/node-pty/lib/worker/conoutSocketWorker.js +22 -0
  246. package/runtime/node_modules/node-pty/lib/worker/conoutSocketWorker.js.map +1 -0
  247. package/runtime/node_modules/node-pty/package.json +64 -0
  248. package/runtime/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
  249. package/runtime/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
  250. package/runtime/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
  251. package/runtime/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
  252. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
  253. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
  254. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
  255. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/conpty.pdb +0 -0
  256. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
  257. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
  258. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/pty.node +0 -0
  259. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/pty.pdb +0 -0
  260. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/winpty-agent.exe +0 -0
  261. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/winpty-agent.pdb +0 -0
  262. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/winpty.dll +0 -0
  263. package/runtime/node_modules/node-pty/prebuilds/win32-arm64/winpty.pdb +0 -0
  264. package/runtime/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  265. package/runtime/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  266. package/runtime/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
  267. package/runtime/node_modules/node-pty/prebuilds/win32-x64/conpty.pdb +0 -0
  268. package/runtime/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
  269. package/runtime/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
  270. package/runtime/node_modules/node-pty/prebuilds/win32-x64/pty.node +0 -0
  271. package/runtime/node_modules/node-pty/prebuilds/win32-x64/pty.pdb +0 -0
  272. package/runtime/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
  273. package/runtime/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.pdb +0 -0
  274. package/runtime/node_modules/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
  275. package/runtime/node_modules/node-pty/prebuilds/win32-x64/winpty.pdb +0 -0
  276. package/runtime/node_modules/node-pty/scripts/gen-compile-commands.js +8 -0
  277. package/runtime/node_modules/node-pty/scripts/increment-version.js +54 -0
  278. package/runtime/node_modules/node-pty/scripts/post-install.js +80 -0
  279. package/runtime/node_modules/node-pty/scripts/prebuild.js +34 -0
  280. package/runtime/node_modules/node-pty/src/conpty_console_list_agent.ts +15 -0
  281. package/runtime/node_modules/node-pty/src/eventEmitter2.test.ts +30 -0
  282. package/runtime/node_modules/node-pty/src/eventEmitter2.ts +48 -0
  283. package/runtime/node_modules/node-pty/src/index.ts +52 -0
  284. package/runtime/node_modules/node-pty/src/interfaces.ts +130 -0
  285. package/runtime/node_modules/node-pty/src/native.d.ts +54 -0
  286. package/runtime/node_modules/node-pty/src/shared/conout.ts +15 -0
  287. package/runtime/node_modules/node-pty/src/terminal.test.ts +119 -0
  288. package/runtime/node_modules/node-pty/src/terminal.ts +211 -0
  289. package/runtime/node_modules/node-pty/src/testUtils.test.ts +23 -0
  290. package/runtime/node_modules/node-pty/src/tsconfig.json +22 -0
  291. package/runtime/node_modules/node-pty/src/types.ts +15 -0
  292. package/runtime/node_modules/node-pty/src/unix/pty.cc +799 -0
  293. package/runtime/node_modules/node-pty/src/unix/spawn-helper.cc +23 -0
  294. package/runtime/node_modules/node-pty/src/unixTerminal.test.ts +367 -0
  295. package/runtime/node_modules/node-pty/src/unixTerminal.ts +388 -0
  296. package/runtime/node_modules/node-pty/src/utils.ts +29 -0
  297. package/runtime/node_modules/node-pty/src/win/conpty.cc +583 -0
  298. package/runtime/node_modules/node-pty/src/win/conpty.h +41 -0
  299. package/runtime/node_modules/node-pty/src/win/conpty_console_list.cc +44 -0
  300. package/runtime/node_modules/node-pty/src/win/path_util.cc +95 -0
  301. package/runtime/node_modules/node-pty/src/win/path_util.h +26 -0
  302. package/runtime/node_modules/node-pty/src/win/winpty.cc +333 -0
  303. package/runtime/node_modules/node-pty/src/windowsConoutConnection.ts +82 -0
  304. package/runtime/node_modules/node-pty/src/windowsPtyAgent.test.ts +94 -0
  305. package/runtime/node_modules/node-pty/src/windowsPtyAgent.ts +321 -0
  306. package/runtime/node_modules/node-pty/src/windowsTerminal.test.ts +229 -0
  307. package/runtime/node_modules/node-pty/src/windowsTerminal.ts +203 -0
  308. package/runtime/node_modules/node-pty/src/worker/conoutSocketWorker.ts +22 -0
  309. package/runtime/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/OpenConsole.exe +0 -0
  310. package/runtime/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/conpty.dll +0 -0
  311. package/runtime/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/OpenConsole.exe +0 -0
  312. package/runtime/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/conpty.dll +0 -0
  313. package/runtime/node_modules/node-pty/typings/node-pty.d.ts +211 -0
  314. package/runtime/server.cjs +27142 -0
  315. package/support/terminal-config-command.cjs +579 -0
  316. package/support/zterm-daemon +0 -0
  317. package/support/zterm-daemon.sh +742 -0
  318. package/zterm-package.json +27 -0
@@ -0,0 +1,579 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/server/terminal-config-command.ts
21
+ var terminal_config_command_exports = {};
22
+ __export(terminal_config_command_exports, {
23
+ runTerminalConfigCommand: () => runTerminalConfigCommand
24
+ });
25
+ module.exports = __toCommonJS(terminal_config_command_exports);
26
+ var import_node_os2 = require("node:os");
27
+ var import_node_util = require("node:util");
28
+
29
+ // ../packages/shared/src/node/shared-config.ts
30
+ var import_node_crypto = require("node:crypto");
31
+ var import_promises = require("node:fs/promises");
32
+ var import_node_os = require("node:os");
33
+ var import_node_path = require("node:path");
34
+ var ConfigStoreError = class extends Error {
35
+ constructor(code, message, path, options) {
36
+ super(message);
37
+ Object.defineProperty(this, "cause", {
38
+ value: options?.cause,
39
+ writable: true,
40
+ configurable: true
41
+ });
42
+ this.name = "ConfigStoreError";
43
+ this.code = code;
44
+ this.path = path;
45
+ this.lockPath = options?.lockPath;
46
+ }
47
+ };
48
+ var DEFAULT_LOCK_TIMEOUT_MS = 5e3;
49
+ var DEFAULT_LOCK_RETRY_MS = 20;
50
+ function isJsonObject(value) {
51
+ return value !== null && typeof value === "object" && !Array.isArray(value);
52
+ }
53
+ function isErrno(error, code) {
54
+ return error instanceof Error && "code" in error && error.code === code;
55
+ }
56
+ function positiveDuration(value, fallback) {
57
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
58
+ }
59
+ function waitForRetry(delayMs, signal, path, lockPath) {
60
+ if (signal?.aborted) {
61
+ return Promise.reject(
62
+ new ConfigStoreError("config_aborted", `Config transaction aborted: ${path}`, path, { lockPath })
63
+ );
64
+ }
65
+ return new Promise((resolve, reject) => {
66
+ const timer = setTimeout(() => {
67
+ signal?.removeEventListener("abort", onAbort);
68
+ resolve();
69
+ }, delayMs);
70
+ const onAbort = () => {
71
+ clearTimeout(timer);
72
+ reject(
73
+ new ConfigStoreError("config_aborted", `Config transaction aborted: ${path}`, path, { lockPath })
74
+ );
75
+ };
76
+ signal?.addEventListener("abort", onAbort, { once: true });
77
+ });
78
+ }
79
+ function getSharedConfigPath(homeDir = (0, import_node_os.homedir)()) {
80
+ return (0, import_node_path.join)(homeDir, ".zterm", "config.json");
81
+ }
82
+ var SharedConfigStore = class {
83
+ constructor(options = {}) {
84
+ this.path = getSharedConfigPath(options.homeDir);
85
+ this.lockPath = `${this.path}.lock`;
86
+ this.lockTimeoutMs = positiveDuration(options.lockTimeoutMs, DEFAULT_LOCK_TIMEOUT_MS);
87
+ this.lockRetryMs = Math.max(1, positiveDuration(options.lockRetryMs, DEFAULT_LOCK_RETRY_MS));
88
+ }
89
+ async read() {
90
+ let raw;
91
+ try {
92
+ raw = await (0, import_promises.readFile)(this.path, "utf8");
93
+ } catch (error) {
94
+ if (isErrno(error, "ENOENT")) {
95
+ return { path: this.path, found: false, config: {} };
96
+ }
97
+ throw new ConfigStoreError(
98
+ "config_read_failed",
99
+ `Unable to read config: ${this.path}`,
100
+ this.path,
101
+ { cause: error }
102
+ );
103
+ }
104
+ if (!raw.trim()) {
105
+ throw new ConfigStoreError(
106
+ "invalid_json",
107
+ `Config is empty: ${this.path}`,
108
+ this.path
109
+ );
110
+ }
111
+ let parsed;
112
+ try {
113
+ parsed = JSON.parse(raw);
114
+ } catch (error) {
115
+ throw new ConfigStoreError(
116
+ "invalid_json",
117
+ `Config contains invalid JSON: ${this.path}`,
118
+ this.path,
119
+ { cause: error }
120
+ );
121
+ }
122
+ if (!isJsonObject(parsed)) {
123
+ throw new ConfigStoreError(
124
+ "invalid_config",
125
+ `Config root must be a JSON object: ${this.path}`,
126
+ this.path
127
+ );
128
+ }
129
+ return { path: this.path, found: true, config: parsed };
130
+ }
131
+ async update(mutate, signal) {
132
+ signal?.throwIfAborted();
133
+ await (0, import_promises.mkdir)((0, import_node_path.dirname)(this.path), { recursive: true, mode: 448 });
134
+ const lock = await this.acquireLock(signal);
135
+ let temporaryPath;
136
+ try {
137
+ const snapshot = await this.read();
138
+ const mutation = mutate(snapshot.config);
139
+ if (!mutation || typeof mutation.changed !== "boolean") {
140
+ throw new ConfigStoreError(
141
+ "invalid_config",
142
+ "Config mutation did not return { value, changed }: " + this.path,
143
+ this.path
144
+ );
145
+ }
146
+ if (!mutation.changed) {
147
+ return mutation.value;
148
+ }
149
+ signal?.throwIfAborted();
150
+ const body = `${JSON.stringify(snapshot.config, null, 2)}
151
+ `;
152
+ temporaryPath = `${this.path}.${process.pid}.${(0, import_node_crypto.randomUUID)()}.tmp`;
153
+ const handle = await (0, import_promises.open)(temporaryPath, "wx", 384);
154
+ try {
155
+ await handle.writeFile(body, "utf8");
156
+ await handle.sync();
157
+ } finally {
158
+ await handle.close();
159
+ }
160
+ await (0, import_promises.rename)(temporaryPath, this.path);
161
+ temporaryPath = void 0;
162
+ return mutation.value;
163
+ } catch (error) {
164
+ if (error instanceof ConfigStoreError) {
165
+ throw error;
166
+ }
167
+ if (signal?.aborted) {
168
+ throw new ConfigStoreError(
169
+ "config_aborted",
170
+ `Config transaction aborted: ${this.path}`,
171
+ this.path,
172
+ { lockPath: this.lockPath, cause: error }
173
+ );
174
+ }
175
+ throw new ConfigStoreError(
176
+ "config_write_failed",
177
+ `Unable to commit config: ${this.path}`,
178
+ this.path,
179
+ { lockPath: this.lockPath, cause: error }
180
+ );
181
+ } finally {
182
+ if (temporaryPath) {
183
+ await (0, import_promises.rm)(temporaryPath, { force: true }).catch(() => void 0);
184
+ }
185
+ await this.releaseLock(lock);
186
+ }
187
+ }
188
+ async acquireLock(signal) {
189
+ const deadline = Date.now() + this.lockTimeoutMs;
190
+ while (true) {
191
+ signal?.throwIfAborted();
192
+ try {
193
+ const handle = await (0, import_promises.open)(this.lockPath, "wx", 384);
194
+ try {
195
+ await handle.writeFile(
196
+ `pid=${process.pid}
197
+ createdAt=${(/* @__PURE__ */ new Date()).toISOString()}
198
+ `,
199
+ "utf8"
200
+ );
201
+ await handle.sync();
202
+ } catch (error) {
203
+ await handle.close().catch(() => void 0);
204
+ await (0, import_promises.rm)(this.lockPath, { force: true }).catch(() => void 0);
205
+ throw error;
206
+ }
207
+ return handle;
208
+ } catch (error) {
209
+ if (!isErrno(error, "EEXIST")) {
210
+ if (signal?.aborted) {
211
+ throw new ConfigStoreError(
212
+ "config_aborted",
213
+ `Config transaction aborted: ${this.path}`,
214
+ this.path,
215
+ { lockPath: this.lockPath, cause: error }
216
+ );
217
+ }
218
+ throw new ConfigStoreError(
219
+ "config_write_failed",
220
+ `Unable to acquire config lock: ${this.lockPath}`,
221
+ this.path,
222
+ { lockPath: this.lockPath, cause: error }
223
+ );
224
+ }
225
+ if (Date.now() >= deadline) {
226
+ throw new ConfigStoreError(
227
+ "config_busy",
228
+ `Config lock is held: ${this.lockPath}; stop the owning process or remove a confirmed stale lock`,
229
+ this.path,
230
+ { lockPath: this.lockPath }
231
+ );
232
+ }
233
+ await waitForRetry(this.lockRetryMs, signal, this.path, this.lockPath);
234
+ }
235
+ }
236
+ }
237
+ async releaseLock(handle) {
238
+ await handle.close().catch(() => void 0);
239
+ await (0, import_promises.rm)(this.lockPath, { force: true }).catch(() => void 0);
240
+ }
241
+ };
242
+
243
+ // ../packages/shared/src/connection/mobile-config.ts
244
+ var MOBILE_BRIDGE_CONFIG = {
245
+ defaultBridgePort: 3333,
246
+ daemonHost: "0.0.0.0",
247
+ defaultTerminalCacheLines: 1e3
248
+ };
249
+ var DEFAULT_BRIDGE_PORT = MOBILE_BRIDGE_CONFIG.defaultBridgePort;
250
+ var DEFAULT_DAEMON_HOST = MOBILE_BRIDGE_CONFIG.daemonHost;
251
+ var DEFAULT_DAEMON_PORT = MOBILE_BRIDGE_CONFIG.defaultBridgePort;
252
+ var DEFAULT_TERMINAL_CACHE_LINES = MOBILE_BRIDGE_CONFIG.defaultTerminalCacheLines;
253
+ function buildDaemonSessionName(port = DEFAULT_DAEMON_PORT) {
254
+ return `zterm-daemon-${port}`;
255
+ }
256
+ var DEFAULT_DAEMON_SESSION_NAME = buildDaemonSessionName();
257
+ var BRIDGE_URL_PLACEHOLDER = `ws://host:${DEFAULT_BRIDGE_PORT}`;
258
+
259
+ // ../packages/shared/src/node/daemon-config-projection.ts
260
+ var DEFAULT_DAEMON_CACHE_LINES = 3e3;
261
+ function isJsonObject2(value) {
262
+ return value !== null && typeof value === "object" && !Array.isArray(value);
263
+ }
264
+ function asString(value) {
265
+ return typeof value === "string" ? value.trim() : "";
266
+ }
267
+ function asPositiveInteger(value) {
268
+ if (typeof value === "number" && Number.isFinite(value)) {
269
+ return Math.max(1, Math.floor(value));
270
+ }
271
+ if (typeof value === "string" && value.trim()) {
272
+ const parsed = Number.parseInt(value.trim(), 10);
273
+ if (Number.isFinite(parsed)) {
274
+ return Math.max(1, parsed);
275
+ }
276
+ }
277
+ return void 0;
278
+ }
279
+ function nestedObject(value, keys) {
280
+ let current = value;
281
+ for (const key of keys) {
282
+ if (!isJsonObject2(current)) {
283
+ return {};
284
+ }
285
+ current = current[key];
286
+ }
287
+ return isJsonObject2(current) ? current : {};
288
+ }
289
+ function fromEnvironment(env, primaryName, fallbackName) {
290
+ const primary = asString(env[primaryName]);
291
+ if (primary) {
292
+ return { value: primary, source: "env", sourceName: primaryName };
293
+ }
294
+ if (fallbackName) {
295
+ const fallback = asString(env[fallbackName]);
296
+ if (fallback) {
297
+ return { value: fallback, source: "env", sourceName: fallbackName };
298
+ }
299
+ }
300
+ return void 0;
301
+ }
302
+ function positiveEnvironment(env, primaryName, fallbackName) {
303
+ const primary = asPositiveInteger(env[primaryName]);
304
+ if (primary !== void 0) {
305
+ return { value: primary, source: "env", sourceName: primaryName };
306
+ }
307
+ if (fallbackName) {
308
+ const fallback = asPositiveInteger(env[fallbackName]);
309
+ if (fallback !== void 0) {
310
+ return { value: fallback, source: "env", sourceName: fallbackName };
311
+ }
312
+ }
313
+ return void 0;
314
+ }
315
+ function fileString(ztermDaemon, mobileDaemon, key, ztermSourceName, mobileSourceName) {
316
+ const ztermValue = asString(ztermDaemon[key]);
317
+ if (ztermValue) {
318
+ return { value: ztermValue, source: "file", sourceName: ztermSourceName };
319
+ }
320
+ const mobileValue = asString(mobileDaemon[key]);
321
+ if (mobileValue) {
322
+ return { value: mobileValue, source: "file", sourceName: mobileSourceName };
323
+ }
324
+ return void 0;
325
+ }
326
+ function filePositiveInteger(ztermDaemon, mobileDaemon, key, ztermSourceName, mobileSourceName) {
327
+ const ztermValue = asPositiveInteger(ztermDaemon[key]);
328
+ if (ztermValue !== void 0) {
329
+ return { value: ztermValue, source: "file", sourceName: ztermSourceName };
330
+ }
331
+ const mobileValue = asPositiveInteger(mobileDaemon[key]);
332
+ if (mobileValue !== void 0) {
333
+ return { value: mobileValue, source: "file", sourceName: mobileSourceName };
334
+ }
335
+ return void 0;
336
+ }
337
+ function projectDaemonConfig(snapshot, env = process.env) {
338
+ const zterm = nestedObject(snapshot.config, ["zterm"]);
339
+ const android = nestedObject(zterm, ["android"]);
340
+ const ztermDaemon = nestedObject(android, ["daemon"]);
341
+ const mobile = nestedObject(snapshot.config, ["mobile"]);
342
+ const mobileDaemon = nestedObject(mobile, ["daemon"]);
343
+ const host = fromEnvironment(env, "ZTERM_HOST", "HOST") ?? fileString(
344
+ ztermDaemon,
345
+ mobileDaemon,
346
+ "host",
347
+ "zterm.android.daemon.host",
348
+ "mobile.daemon.host"
349
+ ) ?? {
350
+ value: DEFAULT_DAEMON_HOST,
351
+ source: "default",
352
+ sourceName: "default"
353
+ };
354
+ const port = positiveEnvironment(env, "ZTERM_PORT", "PORT") ?? filePositiveInteger(
355
+ ztermDaemon,
356
+ mobileDaemon,
357
+ "port",
358
+ "zterm.android.daemon.port",
359
+ "mobile.daemon.port"
360
+ ) ?? {
361
+ value: DEFAULT_BRIDGE_PORT,
362
+ source: "default",
363
+ sourceName: "default"
364
+ };
365
+ const authTokenFromEnv = asString(env.ZTERM_AUTH_TOKEN);
366
+ const auth = authTokenFromEnv ? { configured: true, source: "env", sourceName: "ZTERM_AUTH_TOKEN" } : asString(ztermDaemon.authToken) ? {
367
+ configured: true,
368
+ source: "file",
369
+ sourceName: "zterm.android.daemon.authToken"
370
+ } : asString(mobileDaemon.authToken) ? {
371
+ configured: true,
372
+ source: "file",
373
+ sourceName: "mobile.daemon.authToken"
374
+ } : { configured: false, source: "default", sourceName: "default" };
375
+ const sessionName = fromEnvironment(env, "ZTERM_DAEMON_SESSION") ?? fileString(
376
+ ztermDaemon,
377
+ mobileDaemon,
378
+ "sessionName",
379
+ "zterm.android.daemon.sessionName",
380
+ "mobile.daemon.sessionName"
381
+ ) ?? {
382
+ value: buildDaemonSessionName(port.value),
383
+ source: "default",
384
+ sourceName: "default"
385
+ };
386
+ const cacheLines = positiveEnvironment(env, "ZTERM_TERMINAL_CACHE_LINES") ?? filePositiveInteger(
387
+ ztermDaemon,
388
+ mobileDaemon,
389
+ "terminalCacheLines",
390
+ "zterm.android.daemon.terminalCacheLines",
391
+ "mobile.daemon.terminalCacheLines"
392
+ ) ?? {
393
+ value: DEFAULT_DAEMON_CACHE_LINES,
394
+ source: "default",
395
+ sourceName: "default"
396
+ };
397
+ return {
398
+ configPath: snapshot.path,
399
+ configFound: snapshot.found,
400
+ runtimeLoaded: "unknown",
401
+ host,
402
+ port,
403
+ sessionName,
404
+ cacheLines,
405
+ auth
406
+ };
407
+ }
408
+ async function readDaemonConfigProjection(store, env = process.env) {
409
+ return projectDaemonConfig(await store.read(), env);
410
+ }
411
+
412
+ // src/server/terminal-config-command.ts
413
+ function isJsonObject3(value) {
414
+ return value !== null && typeof value === "object" && !Array.isArray(value);
415
+ }
416
+ function shellQuote(value) {
417
+ return `'${value.replaceAll("'", "'\\''")}'`;
418
+ }
419
+ function requiredOption(args, index, name) {
420
+ const value = args[index + 1];
421
+ if (!value || value.startsWith("--")) {
422
+ throw new Error(`${name} requires a value`);
423
+ }
424
+ return value;
425
+ }
426
+ async function readStdin() {
427
+ let content = "";
428
+ for await (const chunk of process.stdin) {
429
+ content += String(chunk);
430
+ }
431
+ return content.replace(/\r?\n$/, "");
432
+ }
433
+ async function parseRelayInput(args) {
434
+ let relayUrl = "";
435
+ let username = "";
436
+ let hostId = "";
437
+ let deviceId;
438
+ let deviceName;
439
+ let passwordStdin = false;
440
+ for (let index = 0; index < args.length; index += 1) {
441
+ const argument = args[index];
442
+ switch (argument) {
443
+ case "--relay-url":
444
+ relayUrl = requiredOption(args, index, argument);
445
+ index += 1;
446
+ break;
447
+ case "--username":
448
+ username = requiredOption(args, index, argument);
449
+ index += 1;
450
+ break;
451
+ case "--host-id":
452
+ hostId = requiredOption(args, index, argument);
453
+ index += 1;
454
+ break;
455
+ case "--device-id":
456
+ deviceId = requiredOption(args, index, argument);
457
+ index += 1;
458
+ break;
459
+ case "--device-name":
460
+ deviceName = requiredOption(args, index, argument);
461
+ index += 1;
462
+ break;
463
+ case "--password-stdin":
464
+ passwordStdin = true;
465
+ break;
466
+ case "--password":
467
+ case "--password-env":
468
+ throw new Error("relay password must be supplied on stdin with --password-stdin");
469
+ default:
470
+ throw new Error(`unknown configure-relay option: ${argument}`);
471
+ }
472
+ }
473
+ if (!passwordStdin) {
474
+ throw new Error("configure-relay requires --password-stdin");
475
+ }
476
+ const password = await readStdin();
477
+ if (!relayUrl || !username || !password || !hostId) {
478
+ throw new Error("configure-relay requires --relay-url, --username, --password-stdin, and --host-id");
479
+ }
480
+ return { relayUrl, username, password, hostId, deviceId, deviceName };
481
+ }
482
+ function writeHumanProjection(projection) {
483
+ process.stdout.write(`configPath=${projection.configPath}
484
+ `);
485
+ process.stdout.write(`configFound=${projection.configFound ? "yes" : "no"}
486
+ `);
487
+ for (const [name, value] of Object.entries({
488
+ host: projection.host,
489
+ port: projection.port,
490
+ sessionName: projection.sessionName,
491
+ cacheLines: projection.cacheLines
492
+ })) {
493
+ process.stdout.write(
494
+ `${name}=${String(value.value)} source=${value.sourceName}
495
+ `
496
+ );
497
+ }
498
+ process.stdout.write(
499
+ `auth=${projection.auth.configured ? "configured" : "not-configured"} source=${projection.auth.sourceName}
500
+ `
501
+ );
502
+ process.stdout.write("runtimeLoaded=unknown\n");
503
+ }
504
+ async function configureRelay(args) {
505
+ const input = await parseRelayInput(args);
506
+ const store = new SharedConfigStore();
507
+ await store.update((latest) => {
508
+ if (latest.mobile !== void 0 && !isJsonObject3(latest.mobile)) {
509
+ throw new ConfigStoreError("invalid_config", "mobile must be a JSON object", store.path);
510
+ }
511
+ const mobile = isJsonObject3(latest.mobile) ? latest.mobile : {};
512
+ latest.mobile = mobile;
513
+ if (mobile.relay !== void 0 && !isJsonObject3(mobile.relay)) {
514
+ throw new ConfigStoreError("invalid_config", "mobile.relay must be a JSON object", store.path);
515
+ }
516
+ const relay = isJsonObject3(mobile.relay) ? mobile.relay : {};
517
+ const next = {
518
+ ...relay,
519
+ relayUrl: input.relayUrl,
520
+ username: input.username,
521
+ password: input.password,
522
+ hostId: input.hostId,
523
+ deviceId: input.deviceId || input.hostId,
524
+ deviceName: input.deviceName || (0, import_node_os2.hostname)(),
525
+ platform: process.platform
526
+ };
527
+ const changed = !(0, import_node_util.isDeepStrictEqual)(relay, next);
528
+ mobile.relay = next;
529
+ return { value: void 0, changed };
530
+ }, void 0);
531
+ process.stdout.write(
532
+ `zterm relay configured: path=${store.path} relayUrl=${input.relayUrl} username=${input.username} hostId=${input.hostId} deviceName=${input.deviceName || (0, import_node_os2.hostname)()} passwordSet=true
533
+ `
534
+ );
535
+ }
536
+ async function runTerminalConfigCommand(args) {
537
+ const [command, ...rest] = args;
538
+ if (command === "daemon-config" && rest.length === 0) {
539
+ writeHumanProjection(await readDaemonConfigProjection(new SharedConfigStore()));
540
+ return;
541
+ }
542
+ if (command === "daemon-config" && rest.length === 1 && rest[0] === "--shell") {
543
+ const projection = await readDaemonConfigProjection(new SharedConfigStore());
544
+ process.stdout.write(`HOST=${shellQuote(projection.host.value)}
545
+ `);
546
+ process.stdout.write(`PORT=${shellQuote(String(projection.port.value))}
547
+ `);
548
+ process.stdout.write(`SESSION_NAME=${shellQuote(projection.sessionName.value)}
549
+ `);
550
+ process.stdout.write(`AUTH_SOURCE=${shellQuote(projection.auth.source === "file" ? "config" : projection.auth.source)}
551
+ `);
552
+ process.stdout.write(`CONFIG_FOUND=${shellQuote(projection.configFound ? "1" : "0")}
553
+ `);
554
+ process.stdout.write(`CONFIG_DISPLAY_PATH=${shellQuote(projection.configPath)}
555
+ `);
556
+ return;
557
+ }
558
+ if (command === "configure-relay") {
559
+ await configureRelay(rest);
560
+ return;
561
+ }
562
+ throw new Error("usage: terminal-config-command daemon-config [--shell]|configure-relay ...");
563
+ }
564
+ if (typeof require !== "undefined" && require.main === module) {
565
+ runTerminalConfigCommand(process.argv.slice(2)).catch((error) => {
566
+ if (error instanceof ConfigStoreError) {
567
+ process.stderr.write(`zterm config ${error.code}: ${error.message}
568
+ `);
569
+ } else {
570
+ process.stderr.write(`zterm config failed: ${error instanceof Error ? error.message : String(error)}
571
+ `);
572
+ }
573
+ process.exitCode = 1;
574
+ });
575
+ }
576
+ // Annotate the CommonJS export names for ESM import in node:
577
+ 0 && (module.exports = {
578
+ runTerminalConfigCommand
579
+ });
Binary file