@jingyi0605/codingns 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (425) hide show
  1. package/dist/public/assets/{AdaptiveButlerPage-BsgVNRAa.js → AdaptiveButlerPage-b7s6F_sd.js} +1 -1
  2. package/dist/public/assets/{App-tPcbyRdS.js → App-B0q8uDA-.js} +3 -3
  3. package/dist/public/assets/{BootstrapPage--MDOigQi.js → BootstrapPage-jFfl7KNK.js} +1 -1
  4. package/dist/public/assets/{ConversationPage-BBss5ED8.js → ConversationPage-sj_rn4q0.js} +1 -1
  5. package/dist/public/assets/{DesktopDetachPreviewPage-CB8DoqwU.js → DesktopDetachPreviewPage-C5c88SOX.js} +1 -1
  6. package/dist/public/assets/{DesktopWindowPage-GtIx5m8K.js → DesktopWindowPage-BdKUZrKG.js} +1 -1
  7. package/dist/public/assets/{FileContextPanel-BcM7AIT4.js → FileContextPanel-lM5mBcfn.js} +1 -1
  8. package/dist/public/assets/{GitSidebar-CMtkaxuI.js → GitSidebar-CmXAhyjo.js} +1 -1
  9. package/dist/public/assets/{MobileCreateSessionSheet-CrFY41_8.js → MobileCreateSessionSheet-CceV0-AH.js} +1 -1
  10. package/dist/public/assets/{MobileTopHeaderFrame-DGVOzXyg.js → MobileTopHeaderFrame-_I0t7cC_.js} +1 -1
  11. package/dist/public/assets/{MobileWorkspaceSwitcherHeader-DLkACTnQ.js → MobileWorkspaceSwitcherHeader-DhaM9fgx.js} +1 -1
  12. package/dist/public/assets/{RelayConnectEntryPage-0MPPjxtQ.js → RelayConnectEntryPage-CMtDWyGS.js} +1 -1
  13. package/dist/public/assets/{ServerSettingsModal-vgOhwus4.js → ServerSettingsModal-Rkgn3jft.js} +1 -1
  14. package/dist/public/assets/{SessionIndexPage-KK626Ra9.js → SessionIndexPage-BOumP3ij.js} +1 -1
  15. package/dist/public/assets/{SettingsPage-B3edBJIo.js → SettingsPage-vx_c-00-.js} +1 -1
  16. package/dist/public/assets/{TerminalManagerPanel-BxlhZp8c.js → TerminalManagerPanel-D9JHCS6d.js} +1 -1
  17. package/dist/public/assets/{TerminalPage-B6Rdhylx.js → TerminalPage-CBIKHI33.js} +1 -1
  18. package/dist/public/assets/{TerminalRuntimeFallbackModal-BVLfrpSa.js → TerminalRuntimeFallbackModal-W5NjqFEz.js} +1 -1
  19. package/dist/public/assets/{ToolFilesPage-N_gwwUjD.js → ToolFilesPage-DWtpaN_7.js} +1 -1
  20. package/dist/public/assets/{ToolGitPage-DOcuuWM1.js → ToolGitPage-MpGXsw4_.js} +1 -1
  21. package/dist/public/assets/{ToolProcessesPage-D-FfJ7Re.js → ToolProcessesPage-B1jHQKhZ.js} +1 -1
  22. package/dist/public/assets/{ToolsHomePage-CHfPxd20.js → ToolsHomePage-CJrn8ZFl.js} +1 -1
  23. package/dist/public/assets/{WorkbenchLandingPage-CTTnfovY.js → WorkbenchLandingPage-CJQ1V5U-.js} +1 -1
  24. package/dist/public/assets/{WorkbenchLayout-CbpJg0g1.js → WorkbenchLayout-D48i71PU.js} +3 -3
  25. package/dist/public/assets/{WorkbenchModal-Bt_1fYmM.js → WorkbenchModal-BYNuMIoV.js} +1 -1
  26. package/dist/public/assets/WorkbenchShellRoute-CGKjy4J-.js +1 -0
  27. package/dist/public/assets/{WorkspaceDebugDetailPage-s7yuDIxR.js → WorkspaceDebugDetailPage-DCAYgays.js} +1 -1
  28. package/dist/public/assets/{WorkspaceDetailPage-Cf-gVpqK.js → WorkspaceDetailPage-D5v-nUIi.js} +1 -1
  29. package/dist/public/assets/{WorkspaceHomePage-COf6I8sT.js → WorkspaceHomePage-I5G1p5SR.js} +1 -1
  30. package/dist/public/assets/{client-runtime-manager-DGdKvYzx.js → client-runtime-manager-CdJP7nUp.js} +1 -1
  31. package/dist/public/assets/{file-tree-icon-BeHqeru9.js → file-tree-icon-BFwaPxKs.js} +6 -6
  32. package/dist/public/assets/{index-CuzMc7q2.js → index-CjewzOUG.js} +3 -3
  33. package/dist/public/assets/{index-CcaQt50x.css → index-VVxfF0s5.css} +1 -1
  34. package/dist/public/assets/{login-direct-candidate-resolver-DEP_xCmR.js → login-direct-candidate-resolver-C-mo698r.js} +1 -1
  35. package/dist/public/assets/{model-switch-api-c6kcbBGm.js → model-switch-api-Br0ivfe5.js} +1 -1
  36. package/dist/public/assets/{preferences-service-CV6Ih0BG.js → preferences-service-CnaTvZq2.js} +1 -1
  37. package/dist/public/assets/{realtime-client-CRCx5xBt.js → realtime-client-BlQRqVmm.js} +1 -1
  38. package/dist/public/assets/{relay-entry-C751A-Sm.js → relay-entry-D7OgZZN-.js} +1 -1
  39. package/dist/public/assets/{terminal-runtime-meta-CRAVR-8G.js → terminal-runtime-meta-BCtAYB0E.js} +1 -1
  40. package/dist/public/assets/{useRegisteredDebugTemplates-D6YtNS0r.js → useRegisteredDebugTemplates-CXmxu69X.js} +1 -1
  41. package/dist/public/index.html +2 -2
  42. package/dist/server/main.js +2 -0
  43. package/dist/server/main.js.map +1 -1
  44. package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +1 -0
  45. package/dist/server/modules/assistant-capability/assistant-capability-controller.js +1 -0
  46. package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
  47. package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +1 -0
  48. package/dist/server/modules/assistant-capability/assistant-capability-service.js +1 -0
  49. package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
  50. package/dist/server/modules/browser-runtime/browser-runtime-controller.d.ts +2 -1
  51. package/dist/server/modules/browser-runtime/browser-runtime-controller.js +1 -0
  52. package/dist/server/modules/browser-runtime/browser-runtime-controller.js.map +1 -1
  53. package/dist/server/modules/browser-runtime/browser-runtime-service.d.ts +4 -1
  54. package/dist/server/modules/browser-runtime/browser-runtime-service.js +40 -0
  55. package/dist/server/modules/browser-runtime/browser-runtime-service.js.map +1 -1
  56. package/dist/server/modules/browser-runtime/browser-task-payload.d.ts +2 -0
  57. package/dist/server/modules/browser-runtime/browser-task-payload.js.map +1 -1
  58. package/dist/server/modules/git/git-command-helper-process.js +0 -18
  59. package/dist/server/modules/git/git-command-helper-process.js.map +1 -1
  60. package/dist/server/modules/git/git-command-runner.js +0 -18
  61. package/dist/server/modules/git/git-command-runner.js.map +1 -1
  62. package/dist/server/modules/sessions/session-live-runtime-service.js +46 -3
  63. package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
  64. package/dist/server/modules/sessions/workspace-session-runtime-context-service.d.ts +1 -0
  65. package/dist/server/modules/sessions/workspace-session-runtime-context-service.js +11 -2
  66. package/dist/server/modules/sessions/workspace-session-runtime-context-service.js.map +1 -1
  67. package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/SKILL.md +2 -2
  68. package/dist/server/shared/http/error-handler.js +53 -19
  69. package/dist/server/shared/http/error-handler.js.map +1 -1
  70. package/dist/server/shared/utils/install-console-timestamp-prefix.d.ts +1 -0
  71. package/dist/server/shared/utils/install-console-timestamp-prefix.js +28 -0
  72. package/dist/server/shared/utils/install-console-timestamp-prefix.js.map +1 -0
  73. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.d.ts +42 -0
  74. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js +346 -0
  75. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js.map +1 -0
  76. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.d.ts +1 -0
  77. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js +80 -0
  78. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js.map +1 -0
  79. package/node_modules/@codingns/session-sync-core/dist/index.d.ts +18 -0
  80. package/node_modules/@codingns/session-sync-core/dist/index.js +19 -0
  81. package/node_modules/@codingns/session-sync-core/dist/index.js.map +1 -0
  82. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.d.ts +18 -0
  83. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js +659 -0
  84. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js.map +1 -0
  85. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.d.ts +11 -0
  86. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js +72 -0
  87. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js.map +1 -0
  88. package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +67 -0
  89. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +752 -0
  90. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +1 -0
  91. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +48 -0
  92. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +1184 -0
  93. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -0
  94. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.d.ts +11 -0
  95. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js +105 -0
  96. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js.map +1 -0
  97. package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +84 -0
  98. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +2436 -0
  99. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -0
  100. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.d.ts +47 -0
  101. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +1480 -0
  102. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +1 -0
  103. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.d.ts +33 -0
  104. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js +684 -0
  105. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js.map +1 -0
  106. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.d.ts +9 -0
  107. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js +17 -0
  108. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js.map +1 -0
  109. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.d.ts +1 -0
  110. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js +8 -0
  111. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js.map +1 -0
  112. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.d.ts +48 -0
  113. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js +373 -0
  114. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js.map +1 -0
  115. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +61 -0
  116. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +1191 -0
  117. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -0
  118. package/node_modules/@codingns/session-sync-core/dist/providers/utils.d.ts +27 -0
  119. package/node_modules/@codingns/session-sync-core/dist/providers/utils.js +415 -0
  120. package/node_modules/@codingns/session-sync-core/dist/providers/utils.js.map +1 -0
  121. package/node_modules/@codingns/session-sync-core/dist/registry.d.ts +7 -0
  122. package/node_modules/@codingns/session-sync-core/dist/registry.js +22 -0
  123. package/node_modules/@codingns/session-sync-core/dist/registry.js.map +1 -0
  124. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.d.ts +24 -0
  125. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js +329 -0
  126. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js.map +1 -0
  127. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.d.ts +30 -0
  128. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +939 -0
  129. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +1 -0
  130. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.d.ts +1 -0
  131. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js +16 -0
  132. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js.map +1 -0
  133. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +70 -0
  134. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +2571 -0
  135. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -0
  136. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.d.ts +21 -0
  137. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js +561 -0
  138. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js.map +1 -0
  139. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.d.ts +38 -0
  140. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js +911 -0
  141. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js.map +1 -0
  142. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.d.ts +15 -0
  143. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js +16 -0
  144. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js.map +1 -0
  145. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.d.ts +38 -0
  146. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js +970 -0
  147. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js.map +1 -0
  148. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.d.ts +21 -0
  149. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js +168 -0
  150. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js.map +1 -0
  151. package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +152 -0
  152. package/node_modules/@codingns/session-sync-core/dist/runtime/types.js +2 -0
  153. package/node_modules/@codingns/session-sync-core/dist/runtime/types.js.map +1 -0
  154. package/node_modules/@codingns/session-sync-core/dist/services.d.ts +28 -0
  155. package/node_modules/@codingns/session-sync-core/dist/services.js +148 -0
  156. package/node_modules/@codingns/session-sync-core/dist/services.js.map +1 -0
  157. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.d.ts +6 -0
  158. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js +9 -0
  159. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js.map +1 -0
  160. package/node_modules/@codingns/session-sync-core/dist/types.d.ts +198 -0
  161. package/node_modules/@codingns/session-sync-core/dist/types.js +2 -0
  162. package/node_modules/@codingns/session-sync-core/dist/types.js.map +1 -0
  163. package/node_modules/@codingns/session-sync-core/package.json +33 -0
  164. package/package.json +6 -4
  165. package/vendor/node-pty-fork/LICENSE +69 -0
  166. package/vendor/node-pty-fork/README.md +91 -0
  167. package/vendor/node-pty-fork/binding.gyp +117 -0
  168. package/vendor/node-pty-fork/deps/.editorconfig +2 -0
  169. package/vendor/node-pty-fork/deps/winpty/.drone.yml +17 -0
  170. package/vendor/node-pty-fork/deps/winpty/.gitattributes +19 -0
  171. package/vendor/node-pty-fork/deps/winpty/LICENSE +21 -0
  172. package/vendor/node-pty-fork/deps/winpty/Makefile +166 -0
  173. package/vendor/node-pty-fork/deps/winpty/README.md +151 -0
  174. package/vendor/node-pty-fork/deps/winpty/RELEASES.md +280 -0
  175. package/vendor/node-pty-fork/deps/winpty/VERSION.txt +1 -0
  176. package/vendor/node-pty-fork/deps/winpty/configure +167 -0
  177. package/vendor/node-pty-fork/deps/winpty/misc/BufferResizeTests.cc +90 -0
  178. package/vendor/node-pty-fork/deps/winpty/misc/ChangeScreenBuffer.cc +53 -0
  179. package/vendor/node-pty-fork/deps/winpty/misc/ClearConsole.cc +72 -0
  180. package/vendor/node-pty-fork/deps/winpty/misc/ConinMode.cc +117 -0
  181. package/vendor/node-pty-fork/deps/winpty/misc/ConinMode.ps1 +116 -0
  182. package/vendor/node-pty-fork/deps/winpty/misc/ConoutMode.cc +113 -0
  183. package/vendor/node-pty-fork/deps/winpty/misc/DebugClient.py +42 -0
  184. package/vendor/node-pty-fork/deps/winpty/misc/DebugServer.py +63 -0
  185. package/vendor/node-pty-fork/deps/winpty/misc/DumpLines.py +5 -0
  186. package/vendor/node-pty-fork/deps/winpty/misc/EnableExtendedFlags.txt +46 -0
  187. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +528 -0
  188. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +633 -0
  189. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP932.txt +630 -0
  190. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP936.txt +630 -0
  191. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP949.txt +630 -0
  192. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP950.txt +630 -0
  193. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +16 -0
  194. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/Results.txt +4 -0
  195. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +144 -0
  196. package/vendor/node-pty-fork/deps/winpty/misc/FontSurvey.cc +100 -0
  197. package/vendor/node-pty-fork/deps/winpty/misc/FormatChar.h +21 -0
  198. package/vendor/node-pty-fork/deps/winpty/misc/FreezePerfTest.cc +62 -0
  199. package/vendor/node-pty-fork/deps/winpty/misc/GetCh.cc +20 -0
  200. package/vendor/node-pty-fork/deps/winpty/misc/GetConsolePos.cc +41 -0
  201. package/vendor/node-pty-fork/deps/winpty/misc/GetFont.cc +261 -0
  202. package/vendor/node-pty-fork/deps/winpty/misc/IdentifyConsoleWindow.ps1 +51 -0
  203. package/vendor/node-pty-fork/deps/winpty/misc/IsNewConsole.cc +87 -0
  204. package/vendor/node-pty-fork/deps/winpty/misc/MouseInputNotes.txt +90 -0
  205. package/vendor/node-pty-fork/deps/winpty/misc/MoveConsoleWindow.cc +34 -0
  206. package/vendor/node-pty-fork/deps/winpty/misc/Notes.txt +219 -0
  207. package/vendor/node-pty-fork/deps/winpty/misc/OSVersion.cc +27 -0
  208. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferFreezeInactive.cc +101 -0
  209. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferTest.cc +671 -0
  210. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferTest2.cc +151 -0
  211. package/vendor/node-pty-fork/deps/winpty/misc/SelectAllTest.cc +45 -0
  212. package/vendor/node-pty-fork/deps/winpty/misc/SetBufferSize.cc +32 -0
  213. package/vendor/node-pty-fork/deps/winpty/misc/SetCursorPos.cc +10 -0
  214. package/vendor/node-pty-fork/deps/winpty/misc/SetFont.cc +145 -0
  215. package/vendor/node-pty-fork/deps/winpty/misc/SetWindowRect.cc +36 -0
  216. package/vendor/node-pty-fork/deps/winpty/misc/ShowArgv.cc +12 -0
  217. package/vendor/node-pty-fork/deps/winpty/misc/ShowConsoleInput.cc +40 -0
  218. package/vendor/node-pty-fork/deps/winpty/misc/Spew.py +5 -0
  219. package/vendor/node-pty-fork/deps/winpty/misc/TestUtil.cc +172 -0
  220. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeDoubleWidthTest.cc +102 -0
  221. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeWideTest1.cc +246 -0
  222. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeWideTest2.cc +130 -0
  223. package/vendor/node-pty-fork/deps/winpty/misc/UnixEcho.cc +89 -0
  224. package/vendor/node-pty-fork/deps/winpty/misc/Utf16Echo.cc +46 -0
  225. package/vendor/node-pty-fork/deps/winpty/misc/VeryLargeRead.cc +122 -0
  226. package/vendor/node-pty-fork/deps/winpty/misc/VkEscapeTest.cc +56 -0
  227. package/vendor/node-pty-fork/deps/winpty/misc/Win10ResizeWhileFrozen.cc +52 -0
  228. package/vendor/node-pty-fork/deps/winpty/misc/Win10WrapTest1.cc +57 -0
  229. package/vendor/node-pty-fork/deps/winpty/misc/Win10WrapTest2.cc +30 -0
  230. package/vendor/node-pty-fork/deps/winpty/misc/Win32Echo1.cc +26 -0
  231. package/vendor/node-pty-fork/deps/winpty/misc/Win32Echo2.cc +19 -0
  232. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test1.cc +46 -0
  233. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test2.cc +70 -0
  234. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test3.cc +78 -0
  235. package/vendor/node-pty-fork/deps/winpty/misc/Win32Write1.cc +44 -0
  236. package/vendor/node-pty-fork/deps/winpty/misc/WindowsBugCrashReader.cc +27 -0
  237. package/vendor/node-pty-fork/deps/winpty/misc/WriteConsole.cc +106 -0
  238. package/vendor/node-pty-fork/deps/winpty/misc/build32.sh +9 -0
  239. package/vendor/node-pty-fork/deps/winpty/misc/build64.sh +9 -0
  240. package/vendor/node-pty-fork/deps/winpty/misc/color-test.sh +212 -0
  241. package/vendor/node-pty-fork/deps/winpty/misc/font-notes.txt +300 -0
  242. package/vendor/node-pty-fork/deps/winpty/misc/winbug-15048.cc +201 -0
  243. package/vendor/node-pty-fork/deps/winpty/ship/build-pty4j-libpty.bat +36 -0
  244. package/vendor/node-pty-fork/deps/winpty/ship/common_ship.py +53 -0
  245. package/vendor/node-pty-fork/deps/winpty/ship/make_msvc_package.py +165 -0
  246. package/vendor/node-pty-fork/deps/winpty/ship/ship.py +108 -0
  247. package/vendor/node-pty-fork/deps/winpty/src/agent/Agent.cc +605 -0
  248. package/vendor/node-pty-fork/deps/winpty/src/agent/Agent.h +103 -0
  249. package/vendor/node-pty-fork/deps/winpty/src/agent/AgentCreateDesktop.cc +84 -0
  250. package/vendor/node-pty-fork/deps/winpty/src/agent/AgentCreateDesktop.h +28 -0
  251. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleFont.cc +632 -0
  252. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleFont.h +28 -0
  253. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInput.cc +852 -0
  254. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInput.h +109 -0
  255. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInputReencoding.cc +121 -0
  256. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInputReencoding.h +36 -0
  257. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleLine.cc +152 -0
  258. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleLine.h +41 -0
  259. package/vendor/node-pty-fork/deps/winpty/src/agent/Coord.h +87 -0
  260. package/vendor/node-pty-fork/deps/winpty/src/agent/DebugShowInput.cc +239 -0
  261. package/vendor/node-pty-fork/deps/winpty/src/agent/DebugShowInput.h +32 -0
  262. package/vendor/node-pty-fork/deps/winpty/src/agent/DefaultInputMap.cc +422 -0
  263. package/vendor/node-pty-fork/deps/winpty/src/agent/DefaultInputMap.h +28 -0
  264. package/vendor/node-pty-fork/deps/winpty/src/agent/DsrSender.h +30 -0
  265. package/vendor/node-pty-fork/deps/winpty/src/agent/EventLoop.cc +99 -0
  266. package/vendor/node-pty-fork/deps/winpty/src/agent/EventLoop.h +47 -0
  267. package/vendor/node-pty-fork/deps/winpty/src/agent/InputMap.cc +246 -0
  268. package/vendor/node-pty-fork/deps/winpty/src/agent/InputMap.h +114 -0
  269. package/vendor/node-pty-fork/deps/winpty/src/agent/LargeConsoleRead.cc +71 -0
  270. package/vendor/node-pty-fork/deps/winpty/src/agent/LargeConsoleRead.h +68 -0
  271. package/vendor/node-pty-fork/deps/winpty/src/agent/NamedPipe.cc +378 -0
  272. package/vendor/node-pty-fork/deps/winpty/src/agent/NamedPipe.h +125 -0
  273. package/vendor/node-pty-fork/deps/winpty/src/agent/Scraper.cc +699 -0
  274. package/vendor/node-pty-fork/deps/winpty/src/agent/Scraper.h +103 -0
  275. package/vendor/node-pty-fork/deps/winpty/src/agent/SimplePool.h +75 -0
  276. package/vendor/node-pty-fork/deps/winpty/src/agent/SmallRect.h +143 -0
  277. package/vendor/node-pty-fork/deps/winpty/src/agent/Terminal.cc +535 -0
  278. package/vendor/node-pty-fork/deps/winpty/src/agent/Terminal.h +69 -0
  279. package/vendor/node-pty-fork/deps/winpty/src/agent/UnicodeEncoding.h +157 -0
  280. package/vendor/node-pty-fork/deps/winpty/src/agent/UnicodeEncodingTest.cc +189 -0
  281. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32Console.cc +107 -0
  282. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32Console.h +67 -0
  283. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32ConsoleBuffer.cc +193 -0
  284. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32ConsoleBuffer.h +99 -0
  285. package/vendor/node-pty-fork/deps/winpty/src/agent/main.cc +114 -0
  286. package/vendor/node-pty-fork/deps/winpty/src/agent/subdir.mk +61 -0
  287. package/vendor/node-pty-fork/deps/winpty/src/configurations.gypi +60 -0
  288. package/vendor/node-pty-fork/deps/winpty/src/debugserver/DebugServer.cc +117 -0
  289. package/vendor/node-pty-fork/deps/winpty/src/debugserver/subdir.mk +41 -0
  290. package/vendor/node-pty-fork/deps/winpty/src/include/winpty.h +242 -0
  291. package/vendor/node-pty-fork/deps/winpty/src/include/winpty_constants.h +131 -0
  292. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/AgentLocation.cc +75 -0
  293. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/AgentLocation.h +28 -0
  294. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/LibWinptyException.h +54 -0
  295. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/WinptyInternal.h +72 -0
  296. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/subdir.mk +46 -0
  297. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/winpty.cc +970 -0
  298. package/vendor/node-pty-fork/deps/winpty/src/shared/AgentMsg.h +38 -0
  299. package/vendor/node-pty-fork/deps/winpty/src/shared/BackgroundDesktop.cc +122 -0
  300. package/vendor/node-pty-fork/deps/winpty/src/shared/BackgroundDesktop.h +73 -0
  301. package/vendor/node-pty-fork/deps/winpty/src/shared/Buffer.cc +103 -0
  302. package/vendor/node-pty-fork/deps/winpty/src/shared/Buffer.h +102 -0
  303. package/vendor/node-pty-fork/deps/winpty/src/shared/DebugClient.cc +187 -0
  304. package/vendor/node-pty-fork/deps/winpty/src/shared/DebugClient.h +38 -0
  305. package/vendor/node-pty-fork/deps/winpty/src/shared/GenRandom.cc +138 -0
  306. package/vendor/node-pty-fork/deps/winpty/src/shared/GenRandom.h +55 -0
  307. package/vendor/node-pty-fork/deps/winpty/src/shared/GetCommitHash.bat +13 -0
  308. package/vendor/node-pty-fork/deps/winpty/src/shared/Mutex.h +54 -0
  309. package/vendor/node-pty-fork/deps/winpty/src/shared/OsModule.h +63 -0
  310. package/vendor/node-pty-fork/deps/winpty/src/shared/OwnedHandle.cc +36 -0
  311. package/vendor/node-pty-fork/deps/winpty/src/shared/OwnedHandle.h +45 -0
  312. package/vendor/node-pty-fork/deps/winpty/src/shared/PrecompiledHeader.h +43 -0
  313. package/vendor/node-pty-fork/deps/winpty/src/shared/StringBuilder.h +227 -0
  314. package/vendor/node-pty-fork/deps/winpty/src/shared/StringBuilderTest.cc +114 -0
  315. package/vendor/node-pty-fork/deps/winpty/src/shared/StringUtil.cc +55 -0
  316. package/vendor/node-pty-fork/deps/winpty/src/shared/StringUtil.h +80 -0
  317. package/vendor/node-pty-fork/deps/winpty/src/shared/TimeMeasurement.h +63 -0
  318. package/vendor/node-pty-fork/deps/winpty/src/shared/UnixCtrlChars.h +45 -0
  319. package/vendor/node-pty-fork/deps/winpty/src/shared/UpdateGenVersion.bat +20 -0
  320. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsSecurity.cc +460 -0
  321. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsSecurity.h +104 -0
  322. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsVersion.cc +252 -0
  323. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsVersion.h +29 -0
  324. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyAssert.cc +55 -0
  325. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyAssert.h +64 -0
  326. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyException.cc +57 -0
  327. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyException.h +43 -0
  328. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyVersion.cc +42 -0
  329. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyVersion.h +27 -0
  330. package/vendor/node-pty-fork/deps/winpty/src/shared/winpty_snprintf.h +99 -0
  331. package/vendor/node-pty-fork/deps/winpty/src/subdir.mk +5 -0
  332. package/vendor/node-pty-fork/deps/winpty/src/tests/subdir.mk +28 -0
  333. package/vendor/node-pty-fork/deps/winpty/src/tests/trivial_test.cc +158 -0
  334. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/InputHandler.cc +114 -0
  335. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/InputHandler.h +56 -0
  336. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/OutputHandler.cc +80 -0
  337. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/OutputHandler.h +53 -0
  338. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/Util.cc +86 -0
  339. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/Util.h +31 -0
  340. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/WakeupFd.cc +70 -0
  341. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/WakeupFd.h +42 -0
  342. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/main.cc +729 -0
  343. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/subdir.mk +41 -0
  344. package/vendor/node-pty-fork/deps/winpty/src/winpty.gyp +206 -0
  345. package/vendor/node-pty-fork/deps/winpty/vcbuild.bat +83 -0
  346. package/vendor/node-pty-fork/lib/conpty_console_list_agent.js +20 -0
  347. package/vendor/node-pty-fork/lib/conpty_console_list_agent.js.map +1 -0
  348. package/vendor/node-pty-fork/lib/eventEmitter2.js +47 -0
  349. package/vendor/node-pty-fork/lib/eventEmitter2.js.map +1 -0
  350. package/vendor/node-pty-fork/lib/eventEmitter2.test.js +30 -0
  351. package/vendor/node-pty-fork/lib/eventEmitter2.test.js.map +1 -0
  352. package/vendor/node-pty-fork/lib/index.js +51 -0
  353. package/vendor/node-pty-fork/lib/index.js.map +1 -0
  354. package/vendor/node-pty-fork/lib/interfaces.js +7 -0
  355. package/vendor/node-pty-fork/lib/interfaces.js.map +1 -0
  356. package/vendor/node-pty-fork/lib/shared/conout.js +11 -0
  357. package/vendor/node-pty-fork/lib/shared/conout.js.map +1 -0
  358. package/vendor/node-pty-fork/lib/terminal.js +190 -0
  359. package/vendor/node-pty-fork/lib/terminal.js.map +1 -0
  360. package/vendor/node-pty-fork/lib/terminal.test.js +139 -0
  361. package/vendor/node-pty-fork/lib/terminal.test.js.map +1 -0
  362. package/vendor/node-pty-fork/lib/testUtils.test.js +28 -0
  363. package/vendor/node-pty-fork/lib/testUtils.test.js.map +1 -0
  364. package/vendor/node-pty-fork/lib/types.js +7 -0
  365. package/vendor/node-pty-fork/lib/types.js.map +1 -0
  366. package/vendor/node-pty-fork/lib/unixTerminal.js +304 -0
  367. package/vendor/node-pty-fork/lib/unixTerminal.js.map +1 -0
  368. package/vendor/node-pty-fork/lib/unixTerminal.test.js +330 -0
  369. package/vendor/node-pty-fork/lib/unixTerminal.test.js.map +1 -0
  370. package/vendor/node-pty-fork/lib/utils.js +17 -0
  371. package/vendor/node-pty-fork/lib/utils.js.map +1 -0
  372. package/vendor/node-pty-fork/lib/windowsConoutConnection.js +122 -0
  373. package/vendor/node-pty-fork/lib/windowsConoutConnection.js.map +1 -0
  374. package/vendor/node-pty-fork/lib/windowsPtyAgent.js +324 -0
  375. package/vendor/node-pty-fork/lib/windowsPtyAgent.js.map +1 -0
  376. package/vendor/node-pty-fork/lib/windowsPtyAgent.test.js +90 -0
  377. package/vendor/node-pty-fork/lib/windowsPtyAgent.test.js.map +1 -0
  378. package/vendor/node-pty-fork/lib/windowsTerminal.js +201 -0
  379. package/vendor/node-pty-fork/lib/windowsTerminal.js.map +1 -0
  380. package/vendor/node-pty-fork/lib/windowsTerminal.test.js +203 -0
  381. package/vendor/node-pty-fork/lib/windowsTerminal.test.js.map +1 -0
  382. package/vendor/node-pty-fork/lib/worker/conoutSocketWorker.js +22 -0
  383. package/vendor/node-pty-fork/lib/worker/conoutSocketWorker.js.map +1 -0
  384. package/vendor/node-pty-fork/package.json +35 -0
  385. package/vendor/node-pty-fork/scripts/apply-patches.mjs +341 -0
  386. package/vendor/node-pty-fork/scripts/fetch-upstream.mjs +41 -0
  387. package/vendor/node-pty-fork/scripts/install-smoke.cjs +59 -0
  388. package/vendor/node-pty-fork/scripts/smoke-load.cjs +10 -0
  389. package/vendor/node-pty-fork/scripts/sync-upstream.mjs +29 -0
  390. package/vendor/node-pty-fork/scripts/verify-runtime.cjs +54 -0
  391. package/vendor/node-pty-fork/scripts/verify-runtime.test.cjs +22 -0
  392. package/vendor/node-pty-fork/scripts/verify-tarball.cjs +80 -0
  393. package/vendor/node-pty-fork/src/conpty_console_list_agent.ts +19 -0
  394. package/vendor/node-pty-fork/src/eventEmitter2.test.ts +30 -0
  395. package/vendor/node-pty-fork/src/eventEmitter2.ts +48 -0
  396. package/vendor/node-pty-fork/src/index.ts +51 -0
  397. package/vendor/node-pty-fork/src/interfaces.ts +129 -0
  398. package/vendor/node-pty-fork/src/native.d.ts +56 -0
  399. package/vendor/node-pty-fork/src/shared/conout.ts +15 -0
  400. package/vendor/node-pty-fork/src/terminal.test.ts +119 -0
  401. package/vendor/node-pty-fork/src/terminal.ts +211 -0
  402. package/vendor/node-pty-fork/src/testUtils.test.ts +23 -0
  403. package/vendor/node-pty-fork/src/tsconfig.json +22 -0
  404. package/vendor/node-pty-fork/src/types.ts +15 -0
  405. package/vendor/node-pty-fork/src/unix/pty.cc +826 -0
  406. package/vendor/node-pty-fork/src/unix/spawn-helper.cc +23 -0
  407. package/vendor/node-pty-fork/src/unixTerminal.test.ts +335 -0
  408. package/vendor/node-pty-fork/src/unixTerminal.ts +320 -0
  409. package/vendor/node-pty-fork/src/utils.ts +9 -0
  410. package/vendor/node-pty-fork/src/win/conpty.cc +500 -0
  411. package/vendor/node-pty-fork/src/win/conpty_console_list.cc +43 -0
  412. package/vendor/node-pty-fork/src/win/path_util.cc +73 -0
  413. package/vendor/node-pty-fork/src/win/path_util.h +22 -0
  414. package/vendor/node-pty-fork/src/win/winpty.cc +322 -0
  415. package/vendor/node-pty-fork/src/windowsConoutConnection.ts +79 -0
  416. package/vendor/node-pty-fork/src/windowsPtyAgent.test.ts +94 -0
  417. package/vendor/node-pty-fork/src/windowsPtyAgent.ts +323 -0
  418. package/vendor/node-pty-fork/src/windowsTerminal.test.ts +214 -0
  419. package/vendor/node-pty-fork/src/windowsTerminal.ts +208 -0
  420. package/vendor/node-pty-fork/src/worker/conoutSocketWorker.ts +22 -0
  421. package/vendor/node-pty-fork/typings/node-pty.d.ts +203 -0
  422. package/dist/public/assets/WorkbenchShellRoute-DyaMnPfS.js +0 -1
  423. package/dist/server/modules/channels/wechat-claw-client.d.ts +0 -51
  424. package/dist/server/modules/channels/wechat-claw-client.js +0 -245
  425. package/dist/server/modules/channels/wechat-claw-client.js.map +0 -1
@@ -0,0 +1,500 @@
1
+ /**
2
+ * Copyright (c) 2013-2015, Christopher Jeffrey, Peter Sunde (MIT License)
3
+ * Copyright (c) 2016, Daniel Imms (MIT License).
4
+ * Copyright (c) 2018, Microsoft Corporation (MIT License).
5
+ *
6
+ * pty.cc:
7
+ * This file is responsible for starting processes
8
+ * with pseudo-terminal file descriptors.
9
+ */
10
+
11
+ // node versions lower than 10 define this as 0x502 which disables many of the definitions needed to compile
12
+ #include <node_version.h>
13
+ #if NODE_MODULE_VERSION <= 57
14
+ #define _WIN32_WINNT 0x600
15
+ #endif
16
+
17
+ #include <iostream>
18
+ #include <nan.h>
19
+ #include <Shlwapi.h> // PathCombine, PathIsRelative
20
+ #include <sstream>
21
+ #include <string>
22
+ #include <vector>
23
+ #include <Windows.h>
24
+ #include <strsafe.h>
25
+ #include "path_util.h"
26
+
27
+ extern "C" void init(v8::Local<v8::Object>);
28
+
29
+ // Taken from the RS5 Windows SDK, but redefined here in case we're targeting <= 17134.
30
+ #ifndef PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE
31
+ #define PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE \
32
+ ProcThreadAttributeValue(22, FALSE, TRUE, FALSE)
33
+ #endif
34
+
35
+ #ifndef _HPCON_DEFINED
36
+ typedef VOID* HPCON;
37
+ #endif
38
+
39
+ typedef HRESULT (__stdcall *PFNCREATEPSEUDOCONSOLE)(COORD c, HANDLE hIn, HANDLE hOut, DWORD dwFlags, HPCON* phpcon);
40
+ typedef HRESULT (__stdcall *PFNRESIZEPSEUDOCONSOLE)(HPCON hpc, COORD newSize);
41
+ typedef HRESULT (__stdcall *PFNCLEARPSEUDOCONSOLE)(HPCON hpc);
42
+ typedef void (__stdcall *PFNCLOSEPSEUDOCONSOLE)(HPCON hpc);
43
+
44
+ struct pty_baton {
45
+ int id;
46
+ HANDLE hIn;
47
+ HANDLE hOut;
48
+ HPCON hpc;
49
+
50
+ HANDLE hShell;
51
+ HANDLE hWait;
52
+ Nan::Callback cb;
53
+ uv_async_t async;
54
+ uv_thread_t tid;
55
+
56
+ pty_baton(int _id, HANDLE _hIn, HANDLE _hOut, HPCON _hpc) : id(_id), hIn(_hIn), hOut(_hOut), hpc(_hpc) {};
57
+ };
58
+
59
+ static std::vector<pty_baton*> ptyHandles;
60
+ static volatile LONG ptyCounter;
61
+
62
+ static pty_baton* get_pty_baton(int id) {
63
+ for (size_t i = 0; i < ptyHandles.size(); ++i) {
64
+ pty_baton* ptyHandle = ptyHandles[i];
65
+ if (ptyHandle->id == id) {
66
+ return ptyHandle;
67
+ }
68
+ }
69
+ return nullptr;
70
+ }
71
+
72
+ template <typename T>
73
+ std::vector<T> vectorFromString(const std::basic_string<T> &str) {
74
+ return std::vector<T>(str.begin(), str.end());
75
+ }
76
+
77
+ void throwNanError(const Nan::FunctionCallbackInfo<v8::Value>* info, const char* text, const bool getLastError) {
78
+ std::stringstream errorText;
79
+ errorText << text;
80
+ if (getLastError) {
81
+ errorText << ", error code: " << GetLastError();
82
+ }
83
+ Nan::ThrowError(errorText.str().c_str());
84
+ (*info).GetReturnValue().SetUndefined();
85
+ }
86
+
87
+ // Returns a new server named pipe. It has not yet been connected.
88
+ bool createDataServerPipe(bool write,
89
+ std::wstring kind,
90
+ HANDLE* hServer,
91
+ std::wstring &name,
92
+ const std::wstring &pipeName)
93
+ {
94
+ *hServer = INVALID_HANDLE_VALUE;
95
+
96
+ name = L"\\\\.\\pipe\\" + pipeName + L"-" + kind;
97
+
98
+ const DWORD winOpenMode = PIPE_ACCESS_INBOUND | PIPE_ACCESS_OUTBOUND | FILE_FLAG_FIRST_PIPE_INSTANCE/* | FILE_FLAG_OVERLAPPED */;
99
+
100
+ SECURITY_ATTRIBUTES sa = {};
101
+ sa.nLength = sizeof(sa);
102
+
103
+ *hServer = CreateNamedPipeW(
104
+ name.c_str(),
105
+ /*dwOpenMode=*/winOpenMode,
106
+ /*dwPipeMode=*/PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
107
+ /*nMaxInstances=*/1,
108
+ /*nOutBufferSize=*/0,
109
+ /*nInBufferSize=*/0,
110
+ /*nDefaultTimeOut=*/30000,
111
+ &sa);
112
+
113
+ return *hServer != INVALID_HANDLE_VALUE;
114
+ }
115
+
116
+ HRESULT CreateNamedPipesAndPseudoConsole(COORD size,
117
+ DWORD dwFlags,
118
+ HANDLE *phInput,
119
+ HANDLE *phOutput,
120
+ HPCON* phPC,
121
+ std::wstring& inName,
122
+ std::wstring& outName,
123
+ const std::wstring& pipeName)
124
+ {
125
+ HANDLE hLibrary = LoadLibraryExW(L"kernel32.dll", 0, 0);
126
+ bool fLoadedDll = hLibrary != nullptr;
127
+ if (fLoadedDll)
128
+ {
129
+ PFNCREATEPSEUDOCONSOLE const pfnCreate = (PFNCREATEPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "CreatePseudoConsole");
130
+ if (pfnCreate)
131
+ {
132
+ if (phPC == NULL || phInput == NULL || phOutput == NULL)
133
+ {
134
+ return E_INVALIDARG;
135
+ }
136
+
137
+ bool success = createDataServerPipe(true, L"in", phInput, inName, pipeName);
138
+ if (!success)
139
+ {
140
+ return HRESULT_FROM_WIN32(GetLastError());
141
+ }
142
+ success = createDataServerPipe(false, L"out", phOutput, outName, pipeName);
143
+ if (!success)
144
+ {
145
+ return HRESULT_FROM_WIN32(GetLastError());
146
+ }
147
+ return pfnCreate(size, *phInput, *phOutput, dwFlags, phPC);
148
+ }
149
+ else
150
+ {
151
+ // Failed to find CreatePseudoConsole in kernel32. This is likely because
152
+ // the user is not running a build of Windows that supports that API.
153
+ // We should fall back to winpty in this case.
154
+ return HRESULT_FROM_WIN32(GetLastError());
155
+ }
156
+ }
157
+
158
+ // Failed to find kernel32. This is realy unlikely - honestly no idea how
159
+ // this is even possible to hit. But if it does happen, fall back to winpty.
160
+ return HRESULT_FROM_WIN32(GetLastError());
161
+ }
162
+
163
+ static NAN_METHOD(PtyStartProcess) {
164
+ Nan::HandleScope scope;
165
+
166
+ v8::Local<v8::Object> marshal;
167
+ std::wstring inName, outName;
168
+ BOOL fSuccess = FALSE;
169
+ std::unique_ptr<wchar_t[]> mutableCommandline;
170
+ PROCESS_INFORMATION _piClient{};
171
+
172
+ if (info.Length() != 6 ||
173
+ !info[0]->IsString() ||
174
+ !info[1]->IsNumber() ||
175
+ !info[2]->IsNumber() ||
176
+ !info[3]->IsBoolean() ||
177
+ !info[4]->IsString() ||
178
+ !info[5]->IsBoolean()) {
179
+ Nan::ThrowError("Usage: pty.startProcess(file, cols, rows, debug, pipeName, inheritCursor)");
180
+ return;
181
+ }
182
+
183
+ const std::wstring filename(path_util::to_wstring(Nan::Utf8String(info[0])));
184
+ const SHORT cols = info[1]->Uint32Value(Nan::GetCurrentContext()).FromJust();
185
+ const SHORT rows = info[2]->Uint32Value(Nan::GetCurrentContext()).FromJust();
186
+ const bool debug = Nan::To<bool>(info[3]).FromJust();
187
+ const std::wstring pipeName(path_util::to_wstring(Nan::Utf8String(info[4])));
188
+ const bool inheritCursor = Nan::To<bool>(info[5]).FromJust();
189
+
190
+ // use environment 'Path' variable to determine location of
191
+ // the relative path that we have recieved (e.g cmd.exe)
192
+ std::wstring shellpath;
193
+ if (::PathIsRelativeW(filename.c_str())) {
194
+ shellpath = path_util::get_shell_path(filename.c_str());
195
+ } else {
196
+ shellpath = filename;
197
+ }
198
+
199
+ std::string shellpath_(shellpath.begin(), shellpath.end());
200
+
201
+ if (shellpath.empty() || !path_util::file_exists(shellpath)) {
202
+ std::stringstream why;
203
+ why << "File not found: " << shellpath_;
204
+ Nan::ThrowError(why.str().c_str());
205
+ return;
206
+ }
207
+
208
+ HANDLE hIn, hOut;
209
+ HPCON hpc;
210
+ HRESULT hr = CreateNamedPipesAndPseudoConsole({cols, rows}, inheritCursor ? 1/*PSEUDOCONSOLE_INHERIT_CURSOR*/ : 0, &hIn, &hOut, &hpc, inName, outName, pipeName);
211
+
212
+ // Restore default handling of ctrl+c
213
+ SetConsoleCtrlHandler(NULL, FALSE);
214
+
215
+ // Set return values
216
+ marshal = Nan::New<v8::Object>();
217
+
218
+ if (SUCCEEDED(hr)) {
219
+ // We were able to instantiate a conpty
220
+ const int ptyId = InterlockedIncrement(&ptyCounter);
221
+ Nan::Set(marshal, Nan::New<v8::String>("pty").ToLocalChecked(), Nan::New<v8::Number>(ptyId));
222
+ ptyHandles.insert(ptyHandles.end(), new pty_baton(ptyId, hIn, hOut, hpc));
223
+ } else {
224
+ Nan::ThrowError("Cannot launch conpty");
225
+ return;
226
+ }
227
+
228
+ Nan::Set(marshal, Nan::New<v8::String>("fd").ToLocalChecked(), Nan::New<v8::Number>(-1));
229
+ {
230
+ std::string coninPipeNameStr(inName.begin(), inName.end());
231
+ Nan::Set(marshal, Nan::New<v8::String>("conin").ToLocalChecked(), Nan::New<v8::String>(coninPipeNameStr).ToLocalChecked());
232
+
233
+ std::string conoutPipeNameStr(outName.begin(), outName.end());
234
+ Nan::Set(marshal, Nan::New<v8::String>("conout").ToLocalChecked(), Nan::New<v8::String>(conoutPipeNameStr).ToLocalChecked());
235
+ }
236
+ info.GetReturnValue().Set(marshal);
237
+ }
238
+
239
+ VOID CALLBACK OnProcessExitWinEvent(
240
+ _In_ PVOID context,
241
+ _In_ BOOLEAN TimerOrWaitFired) {
242
+ pty_baton *baton = static_cast<pty_baton*>(context);
243
+
244
+ // Fire OnProcessExit
245
+ uv_async_send(&baton->async);
246
+ }
247
+
248
+ static void OnProcessExit(uv_async_t *async) {
249
+ Nan::HandleScope scope;
250
+ pty_baton *baton = static_cast<pty_baton*>(async->data);
251
+
252
+ UnregisterWait(baton->hWait);
253
+
254
+ // Get exit code
255
+ DWORD exitCode = 0;
256
+ GetExitCodeProcess(baton->hShell, &exitCode);
257
+
258
+ // Call function
259
+ v8::Local<v8::Value> args[1] = {
260
+ Nan::New<v8::Number>(exitCode)
261
+ };
262
+
263
+ Nan::AsyncResource asyncResource("node-pty.callback");
264
+ baton->cb.Call(1, args, &asyncResource);
265
+ // Clean up
266
+ baton->cb.Reset();
267
+ }
268
+
269
+ static NAN_METHOD(PtyConnect) {
270
+ Nan::HandleScope scope;
271
+
272
+ // If we're working with conpty's we need to call ConnectNamedPipe here AFTER
273
+ // the Socket has attempted to connect to the other end, then actually
274
+ // spawn the process here.
275
+
276
+ std::stringstream errorText;
277
+ BOOL fSuccess = FALSE;
278
+
279
+ if (info.Length() != 5 ||
280
+ !info[0]->IsNumber() ||
281
+ !info[1]->IsString() ||
282
+ !info[2]->IsString() ||
283
+ !info[3]->IsArray() ||
284
+ !info[4]->IsFunction()) {
285
+ Nan::ThrowError("Usage: pty.connect(id, cmdline, cwd, env, exitCallback)");
286
+ return;
287
+ }
288
+
289
+ const int id = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust();
290
+ const std::wstring cmdline(path_util::to_wstring(Nan::Utf8String(info[1])));
291
+ const std::wstring cwd(path_util::to_wstring(Nan::Utf8String(info[2])));
292
+ const v8::Local<v8::Array> envValues = info[3].As<v8::Array>();
293
+ const v8::Local<v8::Function> exitCallback = v8::Local<v8::Function>::Cast(info[4]);
294
+
295
+ // Fetch pty handle from ID and start process
296
+ pty_baton* handle = get_pty_baton(id);
297
+ if (!handle) {
298
+ Nan::ThrowError("Invalid pty handle");
299
+ return;
300
+ }
301
+
302
+ // Prepare command line
303
+ std::unique_ptr<wchar_t[]> mutableCommandline = std::make_unique<wchar_t[]>(cmdline.length() + 1);
304
+ HRESULT hr = StringCchCopyW(mutableCommandline.get(), cmdline.length() + 1, cmdline.c_str());
305
+
306
+ // Prepare cwd
307
+ std::unique_ptr<wchar_t[]> mutableCwd = std::make_unique<wchar_t[]>(cwd.length() + 1);
308
+ hr = StringCchCopyW(mutableCwd.get(), cwd.length() + 1, cwd.c_str());
309
+
310
+ // Prepare environment
311
+ std::wstring env;
312
+ if (!envValues.IsEmpty()) {
313
+ std::wstringstream envBlock;
314
+ for(uint32_t i = 0; i < envValues->Length(); i++) {
315
+ std::wstring envValue(path_util::to_wstring(Nan::Utf8String(Nan::Get(envValues, i).ToLocalChecked())));
316
+ envBlock << envValue << L'\0';
317
+ }
318
+ envBlock << L'\0';
319
+ env = envBlock.str();
320
+ }
321
+ auto envV = vectorFromString(env);
322
+ LPWSTR envArg = envV.empty() ? nullptr : envV.data();
323
+
324
+ ConnectNamedPipe(handle->hIn, nullptr);
325
+ ConnectNamedPipe(handle->hOut, nullptr);
326
+
327
+ // Attach the pseudoconsole to the client application we're creating
328
+ STARTUPINFOEXW siEx{0};
329
+ siEx.StartupInfo.cb = sizeof(STARTUPINFOEXW);
330
+ siEx.StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
331
+ siEx.StartupInfo.hStdError = nullptr;
332
+ siEx.StartupInfo.hStdInput = nullptr;
333
+ siEx.StartupInfo.hStdOutput = nullptr;
334
+
335
+ SIZE_T size = 0;
336
+ InitializeProcThreadAttributeList(NULL, 1, 0, &size);
337
+ BYTE *attrList = new BYTE[size];
338
+ siEx.lpAttributeList = reinterpret_cast<PPROC_THREAD_ATTRIBUTE_LIST>(attrList);
339
+
340
+ fSuccess = InitializeProcThreadAttributeList(siEx.lpAttributeList, 1, 0, &size);
341
+ if (!fSuccess) {
342
+ return throwNanError(&info, "InitializeProcThreadAttributeList failed", true);
343
+ }
344
+ fSuccess = UpdateProcThreadAttribute(siEx.lpAttributeList,
345
+ 0,
346
+ PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE,
347
+ handle->hpc,
348
+ sizeof(HPCON),
349
+ NULL,
350
+ NULL);
351
+ if (!fSuccess) {
352
+ return throwNanError(&info, "UpdateProcThreadAttribute failed", true);
353
+ }
354
+
355
+ PROCESS_INFORMATION piClient{};
356
+ fSuccess = !!CreateProcessW(
357
+ nullptr,
358
+ mutableCommandline.get(),
359
+ nullptr, // lpProcessAttributes
360
+ nullptr, // lpThreadAttributes
361
+ false, // bInheritHandles VERY IMPORTANT that this is false
362
+ EXTENDED_STARTUPINFO_PRESENT | CREATE_UNICODE_ENVIRONMENT, // dwCreationFlags
363
+ envArg, // lpEnvironment
364
+ mutableCwd.get(), // lpCurrentDirectory
365
+ &siEx.StartupInfo, // lpStartupInfo
366
+ &piClient // lpProcessInformation
367
+ );
368
+ if (!fSuccess) {
369
+ return throwNanError(&info, "Cannot create process", true);
370
+ }
371
+
372
+ // Update handle
373
+ handle->hShell = piClient.hProcess;
374
+ handle->cb.Reset(exitCallback);
375
+ handle->async.data = handle;
376
+
377
+ // Setup OnProcessExit callback
378
+ uv_async_init(uv_default_loop(), &handle->async, OnProcessExit);
379
+
380
+ // Setup Windows wait for process exit event
381
+ RegisterWaitForSingleObject(&handle->hWait, piClient.hProcess, OnProcessExitWinEvent, (PVOID)handle, INFINITE, WT_EXECUTEONLYONCE);
382
+
383
+ // Return
384
+ v8::Local<v8::Object> marshal = Nan::New<v8::Object>();
385
+ Nan::Set(marshal, Nan::New<v8::String>("pid").ToLocalChecked(), Nan::New<v8::Number>(piClient.dwProcessId));
386
+ info.GetReturnValue().Set(marshal);
387
+ }
388
+
389
+ static NAN_METHOD(PtyResize) {
390
+ Nan::HandleScope scope;
391
+
392
+ if (info.Length() != 3 ||
393
+ !info[0]->IsNumber() ||
394
+ !info[1]->IsNumber() ||
395
+ !info[2]->IsNumber()) {
396
+ Nan::ThrowError("Usage: pty.resize(id, cols, rows)");
397
+ return;
398
+ }
399
+
400
+ int id = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust();
401
+ SHORT cols = info[1]->Uint32Value(Nan::GetCurrentContext()).FromJust();
402
+ SHORT rows = info[2]->Uint32Value(Nan::GetCurrentContext()).FromJust();
403
+
404
+ const pty_baton* handle = get_pty_baton(id);
405
+
406
+ if (handle != nullptr) {
407
+ HANDLE hLibrary = LoadLibraryExW(L"kernel32.dll", 0, 0);
408
+ bool fLoadedDll = hLibrary != nullptr;
409
+ if (fLoadedDll)
410
+ {
411
+ PFNRESIZEPSEUDOCONSOLE const pfnResizePseudoConsole = (PFNRESIZEPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "ResizePseudoConsole");
412
+ if (pfnResizePseudoConsole)
413
+ {
414
+ COORD size = {cols, rows};
415
+ pfnResizePseudoConsole(handle->hpc, size);
416
+ }
417
+ }
418
+ }
419
+
420
+ return info.GetReturnValue().SetUndefined();
421
+ }
422
+
423
+ static NAN_METHOD(PtyClear) {
424
+ Nan::HandleScope scope;
425
+
426
+ if (info.Length() != 1 ||
427
+ !info[0]->IsNumber()) {
428
+ Nan::ThrowError("Usage: pty.clear(id)");
429
+ return;
430
+ }
431
+
432
+ int id = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust();
433
+
434
+ const pty_baton* handle = get_pty_baton(id);
435
+
436
+ if (handle != nullptr) {
437
+ HANDLE hLibrary = LoadLibraryExW(L"kernel32.dll", 0, 0);
438
+ bool fLoadedDll = hLibrary != nullptr;
439
+ if (fLoadedDll)
440
+ {
441
+ PFNCLEARPSEUDOCONSOLE const pfnClearPseudoConsole = (PFNCLEARPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "ClearPseudoConsole");
442
+ if (pfnClearPseudoConsole)
443
+ {
444
+ pfnClearPseudoConsole(handle->hpc);
445
+ }
446
+ }
447
+ }
448
+
449
+ return info.GetReturnValue().SetUndefined();
450
+ }
451
+
452
+ static NAN_METHOD(PtyKill) {
453
+ Nan::HandleScope scope;
454
+
455
+ if (info.Length() != 1 ||
456
+ !info[0]->IsNumber()) {
457
+ Nan::ThrowError("Usage: pty.kill(id)");
458
+ return;
459
+ }
460
+
461
+ int id = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust();
462
+
463
+ const pty_baton* handle = get_pty_baton(id);
464
+
465
+ if (handle != nullptr) {
466
+ HANDLE hLibrary = LoadLibraryExW(L"kernel32.dll", 0, 0);
467
+ bool fLoadedDll = hLibrary != nullptr;
468
+ if (fLoadedDll)
469
+ {
470
+ PFNCLOSEPSEUDOCONSOLE const pfnClosePseudoConsole = (PFNCLOSEPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "ClosePseudoConsole");
471
+ if (pfnClosePseudoConsole)
472
+ {
473
+ pfnClosePseudoConsole(handle->hpc);
474
+ }
475
+ }
476
+
477
+ DisconnectNamedPipe(handle->hIn);
478
+ DisconnectNamedPipe(handle->hOut);
479
+ CloseHandle(handle->hIn);
480
+ CloseHandle(handle->hOut);
481
+ CloseHandle(handle->hShell);
482
+ }
483
+
484
+ return info.GetReturnValue().SetUndefined();
485
+ }
486
+
487
+ /**
488
+ * Init
489
+ */
490
+
491
+ extern "C" void init(v8::Local<v8::Object> target) {
492
+ Nan::HandleScope scope;
493
+ Nan::SetMethod(target, "startProcess", PtyStartProcess);
494
+ Nan::SetMethod(target, "connect", PtyConnect);
495
+ Nan::SetMethod(target, "resize", PtyResize);
496
+ Nan::SetMethod(target, "clear", PtyClear);
497
+ Nan::SetMethod(target, "kill", PtyKill);
498
+ };
499
+
500
+ NODE_MODULE(pty, init);
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright (c) 2019, Microsoft Corporation (MIT License).
3
+ */
4
+
5
+ #include <nan.h>
6
+ #include <windows.h>
7
+
8
+ static NAN_METHOD(ApiConsoleProcessList) {
9
+ if (info.Length() != 1 ||
10
+ !info[0]->IsNumber()) {
11
+ Nan::ThrowError("Usage: getConsoleProcessList(shellPid)");
12
+ return;
13
+ }
14
+
15
+ const SHORT pid = info[0]->Uint32Value(Nan::GetCurrentContext()).FromJust();
16
+
17
+ if (!FreeConsole()) {
18
+ Nan::ThrowError("FreeConsole failed");
19
+ }
20
+ if (!AttachConsole(pid)) {
21
+ Nan::ThrowError("AttachConsole failed");
22
+ }
23
+ auto processList = std::vector<DWORD>(64);
24
+ auto processCount = GetConsoleProcessList(&processList[0], processList.size());
25
+ if (processList.size() < processCount) {
26
+ processList.resize(processCount);
27
+ processCount = GetConsoleProcessList(&processList[0], processList.size());
28
+ }
29
+ FreeConsole();
30
+
31
+ v8::Local<v8::Array> result = Nan::New<v8::Array>();
32
+ for (DWORD i = 0; i < processCount; i++) {
33
+ Nan::Set(result, i, Nan::New<v8::Number>(processList[i]));
34
+ }
35
+ info.GetReturnValue().Set(result);
36
+ }
37
+
38
+ extern "C" void init(v8::Local<v8::Object> target) {
39
+ Nan::HandleScope scope;
40
+ Nan::SetMethod(target, "getConsoleProcessList", ApiConsoleProcessList);
41
+ };
42
+
43
+ NODE_MODULE(pty, init);
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Copyright (c) 2013-2015, Christopher Jeffrey, Peter Sunde (MIT License)
3
+ * Copyright (c) 2016, Daniel Imms (MIT License).
4
+ * Copyright (c) 2018, Microsoft Corporation (MIT License).
5
+ */
6
+
7
+ #include <nan.h>
8
+ #include <Shlwapi.h> // PathCombine
9
+
10
+ #include "path_util.h"
11
+
12
+ namespace path_util {
13
+
14
+ const wchar_t* to_wstring(const Nan::Utf8String& str) {
15
+ const char *bytes = *str;
16
+ unsigned int sizeOfStr = MultiByteToWideChar(CP_UTF8, 0, bytes, -1, NULL, 0);
17
+ wchar_t *output = new wchar_t[sizeOfStr];
18
+ MultiByteToWideChar(CP_UTF8, 0, bytes, -1, output, sizeOfStr);
19
+ return output;
20
+ }
21
+
22
+ bool file_exists(std::wstring filename) {
23
+ DWORD attr = ::GetFileAttributesW(filename.c_str());
24
+ if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) {
25
+ return false;
26
+ }
27
+ return true;
28
+ }
29
+
30
+ // cmd.exe -> C:\Windows\system32\cmd.exe
31
+ std::wstring get_shell_path(std::wstring filename) {
32
+ std::wstring shellpath;
33
+
34
+ if (file_exists(filename)) {
35
+ return shellpath;
36
+ }
37
+
38
+ wchar_t buffer_[MAX_ENV];
39
+ int read = ::GetEnvironmentVariableW(L"Path", buffer_, MAX_ENV);
40
+ if (!read) {
41
+ return shellpath;
42
+ }
43
+
44
+ std::wstring delimiter = L";";
45
+ size_t pos = 0;
46
+ std::vector<std::wstring> paths;
47
+ std::wstring buffer(buffer_);
48
+ while ((pos = buffer.find(delimiter)) != std::wstring::npos) {
49
+ paths.push_back(buffer.substr(0, pos));
50
+ buffer.erase(0, pos + delimiter.length());
51
+ }
52
+
53
+ const wchar_t *filename_ = filename.c_str();
54
+
55
+ for (size_t i = 0; i < paths.size(); ++i) {
56
+ std::wstring path = paths[i];
57
+ wchar_t searchPath[MAX_PATH];
58
+ ::PathCombineW(searchPath, const_cast<wchar_t*>(path.c_str()), filename_);
59
+
60
+ if (searchPath == NULL) {
61
+ continue;
62
+ }
63
+
64
+ if (file_exists(searchPath)) {
65
+ shellpath = searchPath;
66
+ break;
67
+ }
68
+ }
69
+
70
+ return shellpath;
71
+ }
72
+
73
+ } // namespace path_util
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (c) 2013-2015, Christopher Jeffrey, Peter Sunde (MIT License)
3
+ * Copyright (c) 2016, Daniel Imms (MIT License).
4
+ * Copyright (c) 2018, Microsoft Corporation (MIT License).
5
+ */
6
+
7
+ #ifndef NODE_PTY_PATH_UTIL_H_
8
+ #define NODE_PTY_PATH_UTIL_H_
9
+
10
+ #include <nan.h>
11
+
12
+ #define MAX_ENV 65536
13
+
14
+ namespace path_util {
15
+
16
+ const wchar_t* to_wstring(const Nan::Utf8String& str);
17
+ bool file_exists(std::wstring filename);
18
+ std::wstring get_shell_path(std::wstring filename);
19
+
20
+ } // namespace path_util
21
+
22
+ #endif // NODE_PTY_PATH_UTIL_H_