@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.
- package/dist/public/assets/{AdaptiveButlerPage-BsgVNRAa.js → AdaptiveButlerPage-b7s6F_sd.js} +1 -1
- package/dist/public/assets/{App-tPcbyRdS.js → App-B0q8uDA-.js} +3 -3
- package/dist/public/assets/{BootstrapPage--MDOigQi.js → BootstrapPage-jFfl7KNK.js} +1 -1
- package/dist/public/assets/{ConversationPage-BBss5ED8.js → ConversationPage-sj_rn4q0.js} +1 -1
- package/dist/public/assets/{DesktopDetachPreviewPage-CB8DoqwU.js → DesktopDetachPreviewPage-C5c88SOX.js} +1 -1
- package/dist/public/assets/{DesktopWindowPage-GtIx5m8K.js → DesktopWindowPage-BdKUZrKG.js} +1 -1
- package/dist/public/assets/{FileContextPanel-BcM7AIT4.js → FileContextPanel-lM5mBcfn.js} +1 -1
- package/dist/public/assets/{GitSidebar-CMtkaxuI.js → GitSidebar-CmXAhyjo.js} +1 -1
- package/dist/public/assets/{MobileCreateSessionSheet-CrFY41_8.js → MobileCreateSessionSheet-CceV0-AH.js} +1 -1
- package/dist/public/assets/{MobileTopHeaderFrame-DGVOzXyg.js → MobileTopHeaderFrame-_I0t7cC_.js} +1 -1
- package/dist/public/assets/{MobileWorkspaceSwitcherHeader-DLkACTnQ.js → MobileWorkspaceSwitcherHeader-DhaM9fgx.js} +1 -1
- package/dist/public/assets/{RelayConnectEntryPage-0MPPjxtQ.js → RelayConnectEntryPage-CMtDWyGS.js} +1 -1
- package/dist/public/assets/{ServerSettingsModal-vgOhwus4.js → ServerSettingsModal-Rkgn3jft.js} +1 -1
- package/dist/public/assets/{SessionIndexPage-KK626Ra9.js → SessionIndexPage-BOumP3ij.js} +1 -1
- package/dist/public/assets/{SettingsPage-B3edBJIo.js → SettingsPage-vx_c-00-.js} +1 -1
- package/dist/public/assets/{TerminalManagerPanel-BxlhZp8c.js → TerminalManagerPanel-D9JHCS6d.js} +1 -1
- package/dist/public/assets/{TerminalPage-B6Rdhylx.js → TerminalPage-CBIKHI33.js} +1 -1
- package/dist/public/assets/{TerminalRuntimeFallbackModal-BVLfrpSa.js → TerminalRuntimeFallbackModal-W5NjqFEz.js} +1 -1
- package/dist/public/assets/{ToolFilesPage-N_gwwUjD.js → ToolFilesPage-DWtpaN_7.js} +1 -1
- package/dist/public/assets/{ToolGitPage-DOcuuWM1.js → ToolGitPage-MpGXsw4_.js} +1 -1
- package/dist/public/assets/{ToolProcessesPage-D-FfJ7Re.js → ToolProcessesPage-B1jHQKhZ.js} +1 -1
- package/dist/public/assets/{ToolsHomePage-CHfPxd20.js → ToolsHomePage-CJrn8ZFl.js} +1 -1
- package/dist/public/assets/{WorkbenchLandingPage-CTTnfovY.js → WorkbenchLandingPage-CJQ1V5U-.js} +1 -1
- package/dist/public/assets/{WorkbenchLayout-CbpJg0g1.js → WorkbenchLayout-D48i71PU.js} +3 -3
- package/dist/public/assets/{WorkbenchModal-Bt_1fYmM.js → WorkbenchModal-BYNuMIoV.js} +1 -1
- package/dist/public/assets/WorkbenchShellRoute-CGKjy4J-.js +1 -0
- package/dist/public/assets/{WorkspaceDebugDetailPage-s7yuDIxR.js → WorkspaceDebugDetailPage-DCAYgays.js} +1 -1
- package/dist/public/assets/{WorkspaceDetailPage-Cf-gVpqK.js → WorkspaceDetailPage-D5v-nUIi.js} +1 -1
- package/dist/public/assets/{WorkspaceHomePage-COf6I8sT.js → WorkspaceHomePage-I5G1p5SR.js} +1 -1
- package/dist/public/assets/{client-runtime-manager-DGdKvYzx.js → client-runtime-manager-CdJP7nUp.js} +1 -1
- package/dist/public/assets/{file-tree-icon-BeHqeru9.js → file-tree-icon-BFwaPxKs.js} +6 -6
- package/dist/public/assets/{index-CuzMc7q2.js → index-CjewzOUG.js} +3 -3
- package/dist/public/assets/{index-CcaQt50x.css → index-VVxfF0s5.css} +1 -1
- package/dist/public/assets/{login-direct-candidate-resolver-DEP_xCmR.js → login-direct-candidate-resolver-C-mo698r.js} +1 -1
- package/dist/public/assets/{model-switch-api-c6kcbBGm.js → model-switch-api-Br0ivfe5.js} +1 -1
- package/dist/public/assets/{preferences-service-CV6Ih0BG.js → preferences-service-CnaTvZq2.js} +1 -1
- package/dist/public/assets/{realtime-client-CRCx5xBt.js → realtime-client-BlQRqVmm.js} +1 -1
- package/dist/public/assets/{relay-entry-C751A-Sm.js → relay-entry-D7OgZZN-.js} +1 -1
- package/dist/public/assets/{terminal-runtime-meta-CRAVR-8G.js → terminal-runtime-meta-BCtAYB0E.js} +1 -1
- package/dist/public/assets/{useRegisteredDebugTemplates-D6YtNS0r.js → useRegisteredDebugTemplates-CXmxu69X.js} +1 -1
- package/dist/public/index.html +2 -2
- package/dist/server/main.js +2 -0
- package/dist/server/main.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +1 -0
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js +1 -0
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +1 -0
- package/dist/server/modules/assistant-capability/assistant-capability-service.js +1 -0
- package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
- package/dist/server/modules/browser-runtime/browser-runtime-controller.d.ts +2 -1
- package/dist/server/modules/browser-runtime/browser-runtime-controller.js +1 -0
- package/dist/server/modules/browser-runtime/browser-runtime-controller.js.map +1 -1
- package/dist/server/modules/browser-runtime/browser-runtime-service.d.ts +4 -1
- package/dist/server/modules/browser-runtime/browser-runtime-service.js +40 -0
- package/dist/server/modules/browser-runtime/browser-runtime-service.js.map +1 -1
- package/dist/server/modules/browser-runtime/browser-task-payload.d.ts +2 -0
- package/dist/server/modules/browser-runtime/browser-task-payload.js.map +1 -1
- package/dist/server/modules/git/git-command-helper-process.js +0 -18
- package/dist/server/modules/git/git-command-helper-process.js.map +1 -1
- package/dist/server/modules/git/git-command-runner.js +0 -18
- package/dist/server/modules/git/git-command-runner.js.map +1 -1
- package/dist/server/modules/sessions/session-live-runtime-service.js +46 -3
- package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.d.ts +1 -0
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.js +11 -2
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.js.map +1 -1
- package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/SKILL.md +2 -2
- package/dist/server/shared/http/error-handler.js +53 -19
- package/dist/server/shared/http/error-handler.js.map +1 -1
- package/dist/server/shared/utils/install-console-timestamp-prefix.d.ts +1 -0
- package/dist/server/shared/utils/install-console-timestamp-prefix.js +28 -0
- package/dist/server/shared/utils/install-console-timestamp-prefix.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.d.ts +42 -0
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js +346 -0
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js +80 -0
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/index.d.ts +18 -0
- package/node_modules/@codingns/session-sync-core/dist/index.js +19 -0
- package/node_modules/@codingns/session-sync-core/dist/index.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.d.ts +18 -0
- package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js +659 -0
- package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/kimi-shared.d.ts +11 -0
- package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js +72 -0
- package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +67 -0
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +752 -0
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +48 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +1184 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.d.ts +11 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js +105 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +84 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +2436 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.d.ts +47 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +1480 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.d.ts +33 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js +684 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.d.ts +9 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js +17 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js +8 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.d.ts +48 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js +373 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +61 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +1191 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.d.ts +27 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.js +415 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/registry.d.ts +7 -0
- package/node_modules/@codingns/session-sync-core/dist/registry.js +22 -0
- package/node_modules/@codingns/session-sync-core/dist/registry.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.d.ts +24 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js +329 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.d.ts +30 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +939 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js +16 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +70 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +2571 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.d.ts +21 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js +561 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.d.ts +38 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js +911 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.d.ts +15 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js +16 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.d.ts +38 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js +970 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.d.ts +21 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js +168 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +152 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.js +2 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/services.d.ts +28 -0
- package/node_modules/@codingns/session-sync-core/dist/services.js +148 -0
- package/node_modules/@codingns/session-sync-core/dist/services.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.d.ts +6 -0
- package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js +9 -0
- package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/types.d.ts +198 -0
- package/node_modules/@codingns/session-sync-core/dist/types.js +2 -0
- package/node_modules/@codingns/session-sync-core/dist/types.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/package.json +33 -0
- package/package.json +6 -4
- package/vendor/node-pty-fork/LICENSE +69 -0
- package/vendor/node-pty-fork/README.md +91 -0
- package/vendor/node-pty-fork/binding.gyp +117 -0
- package/vendor/node-pty-fork/deps/.editorconfig +2 -0
- package/vendor/node-pty-fork/deps/winpty/.drone.yml +17 -0
- package/vendor/node-pty-fork/deps/winpty/.gitattributes +19 -0
- package/vendor/node-pty-fork/deps/winpty/LICENSE +21 -0
- package/vendor/node-pty-fork/deps/winpty/Makefile +166 -0
- package/vendor/node-pty-fork/deps/winpty/README.md +151 -0
- package/vendor/node-pty-fork/deps/winpty/RELEASES.md +280 -0
- package/vendor/node-pty-fork/deps/winpty/VERSION.txt +1 -0
- package/vendor/node-pty-fork/deps/winpty/configure +167 -0
- package/vendor/node-pty-fork/deps/winpty/misc/BufferResizeTests.cc +90 -0
- package/vendor/node-pty-fork/deps/winpty/misc/ChangeScreenBuffer.cc +53 -0
- package/vendor/node-pty-fork/deps/winpty/misc/ClearConsole.cc +72 -0
- package/vendor/node-pty-fork/deps/winpty/misc/ConinMode.cc +117 -0
- package/vendor/node-pty-fork/deps/winpty/misc/ConinMode.ps1 +116 -0
- package/vendor/node-pty-fork/deps/winpty/misc/ConoutMode.cc +113 -0
- package/vendor/node-pty-fork/deps/winpty/misc/DebugClient.py +42 -0
- package/vendor/node-pty-fork/deps/winpty/misc/DebugServer.py +63 -0
- package/vendor/node-pty-fork/deps/winpty/misc/DumpLines.py +5 -0
- package/vendor/node-pty-fork/deps/winpty/misc/EnableExtendedFlags.txt +46 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +528 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +633 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP932.txt +630 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP936.txt +630 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP949.txt +630 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP950.txt +630 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +16 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/Results.txt +4 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +144 -0
- package/vendor/node-pty-fork/deps/winpty/misc/FontSurvey.cc +100 -0
- package/vendor/node-pty-fork/deps/winpty/misc/FormatChar.h +21 -0
- package/vendor/node-pty-fork/deps/winpty/misc/FreezePerfTest.cc +62 -0
- package/vendor/node-pty-fork/deps/winpty/misc/GetCh.cc +20 -0
- package/vendor/node-pty-fork/deps/winpty/misc/GetConsolePos.cc +41 -0
- package/vendor/node-pty-fork/deps/winpty/misc/GetFont.cc +261 -0
- package/vendor/node-pty-fork/deps/winpty/misc/IdentifyConsoleWindow.ps1 +51 -0
- package/vendor/node-pty-fork/deps/winpty/misc/IsNewConsole.cc +87 -0
- package/vendor/node-pty-fork/deps/winpty/misc/MouseInputNotes.txt +90 -0
- package/vendor/node-pty-fork/deps/winpty/misc/MoveConsoleWindow.cc +34 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Notes.txt +219 -0
- package/vendor/node-pty-fork/deps/winpty/misc/OSVersion.cc +27 -0
- package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferFreezeInactive.cc +101 -0
- package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferTest.cc +671 -0
- package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferTest2.cc +151 -0
- package/vendor/node-pty-fork/deps/winpty/misc/SelectAllTest.cc +45 -0
- package/vendor/node-pty-fork/deps/winpty/misc/SetBufferSize.cc +32 -0
- package/vendor/node-pty-fork/deps/winpty/misc/SetCursorPos.cc +10 -0
- package/vendor/node-pty-fork/deps/winpty/misc/SetFont.cc +145 -0
- package/vendor/node-pty-fork/deps/winpty/misc/SetWindowRect.cc +36 -0
- package/vendor/node-pty-fork/deps/winpty/misc/ShowArgv.cc +12 -0
- package/vendor/node-pty-fork/deps/winpty/misc/ShowConsoleInput.cc +40 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Spew.py +5 -0
- package/vendor/node-pty-fork/deps/winpty/misc/TestUtil.cc +172 -0
- package/vendor/node-pty-fork/deps/winpty/misc/UnicodeDoubleWidthTest.cc +102 -0
- package/vendor/node-pty-fork/deps/winpty/misc/UnicodeWideTest1.cc +246 -0
- package/vendor/node-pty-fork/deps/winpty/misc/UnicodeWideTest2.cc +130 -0
- package/vendor/node-pty-fork/deps/winpty/misc/UnixEcho.cc +89 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Utf16Echo.cc +46 -0
- package/vendor/node-pty-fork/deps/winpty/misc/VeryLargeRead.cc +122 -0
- package/vendor/node-pty-fork/deps/winpty/misc/VkEscapeTest.cc +56 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Win10ResizeWhileFrozen.cc +52 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Win10WrapTest1.cc +57 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Win10WrapTest2.cc +30 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Win32Echo1.cc +26 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Win32Echo2.cc +19 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Win32Test1.cc +46 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Win32Test2.cc +70 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Win32Test3.cc +78 -0
- package/vendor/node-pty-fork/deps/winpty/misc/Win32Write1.cc +44 -0
- package/vendor/node-pty-fork/deps/winpty/misc/WindowsBugCrashReader.cc +27 -0
- package/vendor/node-pty-fork/deps/winpty/misc/WriteConsole.cc +106 -0
- package/vendor/node-pty-fork/deps/winpty/misc/build32.sh +9 -0
- package/vendor/node-pty-fork/deps/winpty/misc/build64.sh +9 -0
- package/vendor/node-pty-fork/deps/winpty/misc/color-test.sh +212 -0
- package/vendor/node-pty-fork/deps/winpty/misc/font-notes.txt +300 -0
- package/vendor/node-pty-fork/deps/winpty/misc/winbug-15048.cc +201 -0
- package/vendor/node-pty-fork/deps/winpty/ship/build-pty4j-libpty.bat +36 -0
- package/vendor/node-pty-fork/deps/winpty/ship/common_ship.py +53 -0
- package/vendor/node-pty-fork/deps/winpty/ship/make_msvc_package.py +165 -0
- package/vendor/node-pty-fork/deps/winpty/ship/ship.py +108 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/Agent.cc +605 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/Agent.h +103 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/AgentCreateDesktop.cc +84 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/AgentCreateDesktop.h +28 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleFont.cc +632 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleFont.h +28 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInput.cc +852 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInput.h +109 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInputReencoding.cc +121 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInputReencoding.h +36 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleLine.cc +152 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleLine.h +41 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/Coord.h +87 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/DebugShowInput.cc +239 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/DebugShowInput.h +32 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/DefaultInputMap.cc +422 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/DefaultInputMap.h +28 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/DsrSender.h +30 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/EventLoop.cc +99 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/EventLoop.h +47 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/InputMap.cc +246 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/InputMap.h +114 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/LargeConsoleRead.cc +71 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/LargeConsoleRead.h +68 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/NamedPipe.cc +378 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/NamedPipe.h +125 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/Scraper.cc +699 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/Scraper.h +103 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/SimplePool.h +75 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/SmallRect.h +143 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/Terminal.cc +535 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/Terminal.h +69 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/UnicodeEncoding.h +157 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/UnicodeEncodingTest.cc +189 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/Win32Console.cc +107 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/Win32Console.h +67 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/Win32ConsoleBuffer.cc +193 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/Win32ConsoleBuffer.h +99 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/main.cc +114 -0
- package/vendor/node-pty-fork/deps/winpty/src/agent/subdir.mk +61 -0
- package/vendor/node-pty-fork/deps/winpty/src/configurations.gypi +60 -0
- package/vendor/node-pty-fork/deps/winpty/src/debugserver/DebugServer.cc +117 -0
- package/vendor/node-pty-fork/deps/winpty/src/debugserver/subdir.mk +41 -0
- package/vendor/node-pty-fork/deps/winpty/src/include/winpty.h +242 -0
- package/vendor/node-pty-fork/deps/winpty/src/include/winpty_constants.h +131 -0
- package/vendor/node-pty-fork/deps/winpty/src/libwinpty/AgentLocation.cc +75 -0
- package/vendor/node-pty-fork/deps/winpty/src/libwinpty/AgentLocation.h +28 -0
- package/vendor/node-pty-fork/deps/winpty/src/libwinpty/LibWinptyException.h +54 -0
- package/vendor/node-pty-fork/deps/winpty/src/libwinpty/WinptyInternal.h +72 -0
- package/vendor/node-pty-fork/deps/winpty/src/libwinpty/subdir.mk +46 -0
- package/vendor/node-pty-fork/deps/winpty/src/libwinpty/winpty.cc +970 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/AgentMsg.h +38 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/BackgroundDesktop.cc +122 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/BackgroundDesktop.h +73 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/Buffer.cc +103 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/Buffer.h +102 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/DebugClient.cc +187 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/DebugClient.h +38 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/GenRandom.cc +138 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/GenRandom.h +55 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/GetCommitHash.bat +13 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/Mutex.h +54 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/OsModule.h +63 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/OwnedHandle.cc +36 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/OwnedHandle.h +45 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/PrecompiledHeader.h +43 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/StringBuilder.h +227 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/StringBuilderTest.cc +114 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/StringUtil.cc +55 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/StringUtil.h +80 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/TimeMeasurement.h +63 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/UnixCtrlChars.h +45 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/UpdateGenVersion.bat +20 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsSecurity.cc +460 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsSecurity.h +104 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsVersion.cc +252 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsVersion.h +29 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyAssert.cc +55 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyAssert.h +64 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyException.cc +57 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyException.h +43 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyVersion.cc +42 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyVersion.h +27 -0
- package/vendor/node-pty-fork/deps/winpty/src/shared/winpty_snprintf.h +99 -0
- package/vendor/node-pty-fork/deps/winpty/src/subdir.mk +5 -0
- package/vendor/node-pty-fork/deps/winpty/src/tests/subdir.mk +28 -0
- package/vendor/node-pty-fork/deps/winpty/src/tests/trivial_test.cc +158 -0
- package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/InputHandler.cc +114 -0
- package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/InputHandler.h +56 -0
- package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/OutputHandler.cc +80 -0
- package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/OutputHandler.h +53 -0
- package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/Util.cc +86 -0
- package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/Util.h +31 -0
- package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/WakeupFd.cc +70 -0
- package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/WakeupFd.h +42 -0
- package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/main.cc +729 -0
- package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/subdir.mk +41 -0
- package/vendor/node-pty-fork/deps/winpty/src/winpty.gyp +206 -0
- package/vendor/node-pty-fork/deps/winpty/vcbuild.bat +83 -0
- package/vendor/node-pty-fork/lib/conpty_console_list_agent.js +20 -0
- package/vendor/node-pty-fork/lib/conpty_console_list_agent.js.map +1 -0
- package/vendor/node-pty-fork/lib/eventEmitter2.js +47 -0
- package/vendor/node-pty-fork/lib/eventEmitter2.js.map +1 -0
- package/vendor/node-pty-fork/lib/eventEmitter2.test.js +30 -0
- package/vendor/node-pty-fork/lib/eventEmitter2.test.js.map +1 -0
- package/vendor/node-pty-fork/lib/index.js +51 -0
- package/vendor/node-pty-fork/lib/index.js.map +1 -0
- package/vendor/node-pty-fork/lib/interfaces.js +7 -0
- package/vendor/node-pty-fork/lib/interfaces.js.map +1 -0
- package/vendor/node-pty-fork/lib/shared/conout.js +11 -0
- package/vendor/node-pty-fork/lib/shared/conout.js.map +1 -0
- package/vendor/node-pty-fork/lib/terminal.js +190 -0
- package/vendor/node-pty-fork/lib/terminal.js.map +1 -0
- package/vendor/node-pty-fork/lib/terminal.test.js +139 -0
- package/vendor/node-pty-fork/lib/terminal.test.js.map +1 -0
- package/vendor/node-pty-fork/lib/testUtils.test.js +28 -0
- package/vendor/node-pty-fork/lib/testUtils.test.js.map +1 -0
- package/vendor/node-pty-fork/lib/types.js +7 -0
- package/vendor/node-pty-fork/lib/types.js.map +1 -0
- package/vendor/node-pty-fork/lib/unixTerminal.js +304 -0
- package/vendor/node-pty-fork/lib/unixTerminal.js.map +1 -0
- package/vendor/node-pty-fork/lib/unixTerminal.test.js +330 -0
- package/vendor/node-pty-fork/lib/unixTerminal.test.js.map +1 -0
- package/vendor/node-pty-fork/lib/utils.js +17 -0
- package/vendor/node-pty-fork/lib/utils.js.map +1 -0
- package/vendor/node-pty-fork/lib/windowsConoutConnection.js +122 -0
- package/vendor/node-pty-fork/lib/windowsConoutConnection.js.map +1 -0
- package/vendor/node-pty-fork/lib/windowsPtyAgent.js +324 -0
- package/vendor/node-pty-fork/lib/windowsPtyAgent.js.map +1 -0
- package/vendor/node-pty-fork/lib/windowsPtyAgent.test.js +90 -0
- package/vendor/node-pty-fork/lib/windowsPtyAgent.test.js.map +1 -0
- package/vendor/node-pty-fork/lib/windowsTerminal.js +201 -0
- package/vendor/node-pty-fork/lib/windowsTerminal.js.map +1 -0
- package/vendor/node-pty-fork/lib/windowsTerminal.test.js +203 -0
- package/vendor/node-pty-fork/lib/windowsTerminal.test.js.map +1 -0
- package/vendor/node-pty-fork/lib/worker/conoutSocketWorker.js +22 -0
- package/vendor/node-pty-fork/lib/worker/conoutSocketWorker.js.map +1 -0
- package/vendor/node-pty-fork/package.json +35 -0
- package/vendor/node-pty-fork/scripts/apply-patches.mjs +341 -0
- package/vendor/node-pty-fork/scripts/fetch-upstream.mjs +41 -0
- package/vendor/node-pty-fork/scripts/install-smoke.cjs +59 -0
- package/vendor/node-pty-fork/scripts/smoke-load.cjs +10 -0
- package/vendor/node-pty-fork/scripts/sync-upstream.mjs +29 -0
- package/vendor/node-pty-fork/scripts/verify-runtime.cjs +54 -0
- package/vendor/node-pty-fork/scripts/verify-runtime.test.cjs +22 -0
- package/vendor/node-pty-fork/scripts/verify-tarball.cjs +80 -0
- package/vendor/node-pty-fork/src/conpty_console_list_agent.ts +19 -0
- package/vendor/node-pty-fork/src/eventEmitter2.test.ts +30 -0
- package/vendor/node-pty-fork/src/eventEmitter2.ts +48 -0
- package/vendor/node-pty-fork/src/index.ts +51 -0
- package/vendor/node-pty-fork/src/interfaces.ts +129 -0
- package/vendor/node-pty-fork/src/native.d.ts +56 -0
- package/vendor/node-pty-fork/src/shared/conout.ts +15 -0
- package/vendor/node-pty-fork/src/terminal.test.ts +119 -0
- package/vendor/node-pty-fork/src/terminal.ts +211 -0
- package/vendor/node-pty-fork/src/testUtils.test.ts +23 -0
- package/vendor/node-pty-fork/src/tsconfig.json +22 -0
- package/vendor/node-pty-fork/src/types.ts +15 -0
- package/vendor/node-pty-fork/src/unix/pty.cc +826 -0
- package/vendor/node-pty-fork/src/unix/spawn-helper.cc +23 -0
- package/vendor/node-pty-fork/src/unixTerminal.test.ts +335 -0
- package/vendor/node-pty-fork/src/unixTerminal.ts +320 -0
- package/vendor/node-pty-fork/src/utils.ts +9 -0
- package/vendor/node-pty-fork/src/win/conpty.cc +500 -0
- package/vendor/node-pty-fork/src/win/conpty_console_list.cc +43 -0
- package/vendor/node-pty-fork/src/win/path_util.cc +73 -0
- package/vendor/node-pty-fork/src/win/path_util.h +22 -0
- package/vendor/node-pty-fork/src/win/winpty.cc +322 -0
- package/vendor/node-pty-fork/src/windowsConoutConnection.ts +79 -0
- package/vendor/node-pty-fork/src/windowsPtyAgent.test.ts +94 -0
- package/vendor/node-pty-fork/src/windowsPtyAgent.ts +323 -0
- package/vendor/node-pty-fork/src/windowsTerminal.test.ts +214 -0
- package/vendor/node-pty-fork/src/windowsTerminal.ts +208 -0
- package/vendor/node-pty-fork/src/worker/conoutSocketWorker.ts +22 -0
- package/vendor/node-pty-fork/typings/node-pty.d.ts +203 -0
- package/dist/public/assets/WorkbenchShellRoute-DyaMnPfS.js +0 -1
- package/dist/server/modules/channels/wechat-claw-client.d.ts +0 -51
- package/dist/server/modules/channels/wechat-claw-client.js +0 -245
- package/dist/server/modules/channels/wechat-claw-client.js.map +0 -1
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
6
|
+
|
|
7
|
+
function detectEol(text) {
|
|
8
|
+
return text.includes("\r\n") ? "\r\n" : "\n";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function normalize(text) {
|
|
12
|
+
return text.replace(/\r\n/g, "\n");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function applyExactReplacements(filePath, replacements) {
|
|
16
|
+
const original = fs.readFileSync(filePath, "utf8");
|
|
17
|
+
const eol = detectEol(original);
|
|
18
|
+
let normalized = normalize(original);
|
|
19
|
+
|
|
20
|
+
for (const replacement of replacements) {
|
|
21
|
+
if (normalized.includes(replacement.to)) {
|
|
22
|
+
console.log(`[codingns-node-pty] 已是目标内容,跳过:${path.relative(packageRoot, filePath)} (${replacement.label})`);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (!normalized.includes(replacement.from)) {
|
|
26
|
+
throw new Error(`未找到预期片段:${filePath}${"\n"}${replacement.label}`);
|
|
27
|
+
}
|
|
28
|
+
normalized = normalized.replace(replacement.from, replacement.to);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
fs.writeFileSync(filePath, normalized.replace(/\n/g, eol), "utf8");
|
|
32
|
+
console.log(`[codingns-node-pty] 已写回 fork 覆盖:${path.relative(packageRoot, filePath)}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
applyExactReplacements(path.join(packageRoot, "src", "win", "conpty.cc"), [
|
|
36
|
+
{
|
|
37
|
+
label: "conpty typedef guard",
|
|
38
|
+
from: `// Taken from the RS5 Windows SDK, but redefined here in case we're targeting <= 17134
|
|
39
|
+
#ifndef PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE
|
|
40
|
+
#define PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE \\
|
|
41
|
+
ProcThreadAttributeValue(22, FALSE, TRUE, FALSE)
|
|
42
|
+
|
|
43
|
+
typedef VOID* HPCON;
|
|
44
|
+
typedef HRESULT (__stdcall *PFNCREATEPSEUDOCONSOLE)(COORD c, HANDLE hIn, HANDLE hOut, DWORD dwFlags, HPCON* phpcon);
|
|
45
|
+
typedef HRESULT (__stdcall *PFNRESIZEPSEUDOCONSOLE)(HPCON hpc, COORD newSize);
|
|
46
|
+
typedef HRESULT (__stdcall *PFNCLEARPSEUDOCONSOLE)(HPCON hpc);
|
|
47
|
+
typedef void (__stdcall *PFNCLOSEPSEUDOCONSOLE)(HPCON hpc);
|
|
48
|
+
|
|
49
|
+
#endif
|
|
50
|
+
`,
|
|
51
|
+
to: `// Taken from the RS5 Windows SDK, but redefined here in case we're targeting <= 17134.
|
|
52
|
+
#ifndef PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE
|
|
53
|
+
#define PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE \\
|
|
54
|
+
ProcThreadAttributeValue(22, FALSE, TRUE, FALSE)
|
|
55
|
+
#endif
|
|
56
|
+
|
|
57
|
+
#ifndef _HPCON_DEFINED
|
|
58
|
+
typedef VOID* HPCON;
|
|
59
|
+
#endif
|
|
60
|
+
|
|
61
|
+
typedef HRESULT (__stdcall *PFNCREATEPSEUDOCONSOLE)(COORD c, HANDLE hIn, HANDLE hOut, DWORD dwFlags, HPCON* phpcon);
|
|
62
|
+
typedef HRESULT (__stdcall *PFNRESIZEPSEUDOCONSOLE)(HPCON hpc, COORD newSize);
|
|
63
|
+
typedef HRESULT (__stdcall *PFNCLEARPSEUDOCONSOLE)(HPCON hpc);
|
|
64
|
+
typedef void (__stdcall *PFNCLOSEPSEUDOCONSOLE)(HPCON hpc);
|
|
65
|
+
`
|
|
66
|
+
}
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
applyExactReplacements(path.join(packageRoot, "src", "win", "winpty.cc"), [
|
|
70
|
+
{
|
|
71
|
+
label: "winpty PtyStartProcess full sync",
|
|
72
|
+
from: `static NAN_METHOD(PtyStartProcess) {
|
|
73
|
+
Nan::HandleScope scope;
|
|
74
|
+
|
|
75
|
+
if (info.Length() != 7 ||
|
|
76
|
+
!info[0]->IsString() ||
|
|
77
|
+
!info[1]->IsString() ||
|
|
78
|
+
!info[2]->IsArray() ||
|
|
79
|
+
!info[3]->IsString() ||
|
|
80
|
+
!info[4]->IsNumber() ||
|
|
81
|
+
!info[5]->IsNumber() ||
|
|
82
|
+
!info[6]->IsBoolean()) {
|
|
83
|
+
Nan::ThrowError("Usage: pty.startProcess(file, cmdline, env, cwd, cols, rows, debug)");
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
std::stringstream why;
|
|
88
|
+
|
|
89
|
+
const wchar_t *filename = path_util::to_wstring(Nan::Utf8String(info[0]));
|
|
90
|
+
const wchar_t *cmdline = path_util::to_wstring(Nan::Utf8String(info[1]));
|
|
91
|
+
const wchar_t *cwd = path_util::to_wstring(Nan::Utf8String(info[3]));
|
|
92
|
+
|
|
93
|
+
// create environment block
|
|
94
|
+
std::wstring env;
|
|
95
|
+
const v8::Local<v8::Array> envValues = v8::Local<v8::Array>::Cast(info[2]);
|
|
96
|
+
if (!envValues.IsEmpty()) {
|
|
97
|
+
|
|
98
|
+
std::wstringstream envBlock;
|
|
99
|
+
|
|
100
|
+
for(uint32_t i = 0; i < envValues->Length(); i++) {
|
|
101
|
+
std::wstring envValue(path_util::to_wstring(Nan::Utf8String(Nan::Get(envValues, i).ToLocalChecked())));
|
|
102
|
+
envBlock << envValue << L'\\0';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
env = envBlock.str();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// use environment 'Path' variable to determine location of
|
|
109
|
+
// the relative path that we have recieved (e.g cmd.exe)
|
|
110
|
+
std::wstring shellpath;
|
|
111
|
+
if (::PathIsRelativeW(filename)) {
|
|
112
|
+
shellpath = path_util::get_shell_path(filename);
|
|
113
|
+
} else {
|
|
114
|
+
shellpath = filename;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
std::string shellpath_(shellpath.begin(), shellpath.end());
|
|
118
|
+
|
|
119
|
+
if (shellpath.empty() || !path_util::file_exists(shellpath)) {
|
|
120
|
+
why << "File not found: " << shellpath_;
|
|
121
|
+
Nan::ThrowError(why.str().c_str());
|
|
122
|
+
goto cleanup;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
int cols = info[4]->Int32Value(Nan::GetCurrentContext()).FromJust();
|
|
126
|
+
int rows = info[5]->Int32Value(Nan::GetCurrentContext()).FromJust();
|
|
127
|
+
bool debug = Nan::To<bool>(info[6]).FromJust();
|
|
128
|
+
|
|
129
|
+
// Enable/disable debugging
|
|
130
|
+
SetEnvironmentVariable(WINPTY_DBG_VARIABLE, debug ? "1" : NULL); // NULL = deletes variable
|
|
131
|
+
|
|
132
|
+
// Create winpty config
|
|
133
|
+
winpty_error_ptr_t error_ptr = nullptr;
|
|
134
|
+
winpty_config_t* winpty_config = winpty_config_new(0, &error_ptr);
|
|
135
|
+
if (winpty_config == nullptr) {
|
|
136
|
+
throw_winpty_error("Error creating WinPTY config", error_ptr);
|
|
137
|
+
goto cleanup;
|
|
138
|
+
}
|
|
139
|
+
winpty_error_free(error_ptr);
|
|
140
|
+
|
|
141
|
+
// Set pty size on config
|
|
142
|
+
winpty_config_set_initial_size(winpty_config, cols, rows);
|
|
143
|
+
|
|
144
|
+
// Start the pty agent
|
|
145
|
+
winpty_t *pc = winpty_open(winpty_config, &error_ptr);
|
|
146
|
+
winpty_config_free(winpty_config);
|
|
147
|
+
if (pc == nullptr) {
|
|
148
|
+
throw_winpty_error("Error launching WinPTY agent", error_ptr);
|
|
149
|
+
goto cleanup;
|
|
150
|
+
}
|
|
151
|
+
winpty_error_free(error_ptr);
|
|
152
|
+
|
|
153
|
+
// Save pty struct for later use
|
|
154
|
+
ptyHandles.insert(ptyHandles.end(), pc);
|
|
155
|
+
|
|
156
|
+
// Create winpty spawn config
|
|
157
|
+
winpty_spawn_config_t* config = winpty_spawn_config_new(WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN, shellpath.c_str(), cmdline, cwd, env.c_str(), &error_ptr);
|
|
158
|
+
if (config == nullptr) {
|
|
159
|
+
throw_winpty_error("Error creating WinPTY spawn config", error_ptr);
|
|
160
|
+
goto cleanup;
|
|
161
|
+
}
|
|
162
|
+
winpty_error_free(error_ptr);
|
|
163
|
+
|
|
164
|
+
// Spawn the new process
|
|
165
|
+
HANDLE handle = nullptr;
|
|
166
|
+
BOOL spawnSuccess = winpty_spawn(pc, config, &handle, nullptr, nullptr, &error_ptr);
|
|
167
|
+
winpty_spawn_config_free(config);
|
|
168
|
+
if (!spawnSuccess) {
|
|
169
|
+
throw_winpty_error("Unable to start terminal process", error_ptr);
|
|
170
|
+
goto cleanup;
|
|
171
|
+
}
|
|
172
|
+
winpty_error_free(error_ptr);
|
|
173
|
+
|
|
174
|
+
// Set return values
|
|
175
|
+
v8::Local<v8::Object> marshal = Nan::New<v8::Object>();
|
|
176
|
+
Nan::Set(marshal, Nan::New<v8::String>("innerPid").ToLocalChecked(), Nan::New<v8::Number>((int)GetProcessId(handle)));
|
|
177
|
+
Nan::Set(marshal, Nan::New<v8::String>("innerPidHandle").ToLocalChecked(), Nan::New<v8::Number>((int)handle));
|
|
178
|
+
Nan::Set(marshal, Nan::New<v8::String>("pid").ToLocalChecked(), Nan::New<v8::Number>((int)winpty_agent_process(pc)));
|
|
179
|
+
Nan::Set(marshal, Nan::New<v8::String>("pty").ToLocalChecked(), Nan::New<v8::Number>(InterlockedIncrement(&ptyCounter)));
|
|
180
|
+
Nan::Set(marshal, Nan::New<v8::String>("fd").ToLocalChecked(), Nan::New<v8::Number>(-1));
|
|
181
|
+
{
|
|
182
|
+
LPCWSTR coninPipeName = winpty_conin_name(pc);
|
|
183
|
+
std::wstring coninPipeNameWStr(coninPipeName);
|
|
184
|
+
std::string coninPipeNameStr(coninPipeNameWStr.begin(), coninPipeNameWStr.end());
|
|
185
|
+
Nan::Set(marshal, Nan::New<v8::String>("conin").ToLocalChecked(), Nan::New<v8::String>(coninPipeNameStr).ToLocalChecked());
|
|
186
|
+
LPCWSTR conoutPipeName = winpty_conout_name(pc);
|
|
187
|
+
std::wstring conoutPipeNameWStr(conoutPipeName);
|
|
188
|
+
std::string conoutPipeNameStr(conoutPipeNameWStr.begin(), conoutPipeNameWStr.end());
|
|
189
|
+
Nan::Set(marshal, Nan::New<v8::String>("conout").ToLocalChecked(), Nan::New<v8::String>(conoutPipeNameStr).ToLocalChecked());
|
|
190
|
+
}
|
|
191
|
+
info.GetReturnValue().Set(marshal);
|
|
192
|
+
|
|
193
|
+
goto cleanup;
|
|
194
|
+
|
|
195
|
+
cleanup:
|
|
196
|
+
delete filename;
|
|
197
|
+
delete cmdline;
|
|
198
|
+
delete cwd;
|
|
199
|
+
}
|
|
200
|
+
`,
|
|
201
|
+
to: `static NAN_METHOD(PtyStartProcess) {
|
|
202
|
+
Nan::HandleScope scope;
|
|
203
|
+
|
|
204
|
+
std::stringstream why;
|
|
205
|
+
const wchar_t *filename = nullptr;
|
|
206
|
+
const wchar_t *cmdline = nullptr;
|
|
207
|
+
const wchar_t *cwd = nullptr;
|
|
208
|
+
std::wstring env;
|
|
209
|
+
int cols = 0;
|
|
210
|
+
int rows = 0;
|
|
211
|
+
bool debug = false;
|
|
212
|
+
winpty_error_ptr_t error_ptr = nullptr;
|
|
213
|
+
winpty_config_t* winpty_config = nullptr;
|
|
214
|
+
winpty_t *pc = nullptr;
|
|
215
|
+
winpty_spawn_config_t* config = nullptr;
|
|
216
|
+
HANDLE handle = nullptr;
|
|
217
|
+
BOOL spawnSuccess = FALSE;
|
|
218
|
+
v8::Local<v8::Object> marshal = Nan::New<v8::Object>();
|
|
219
|
+
|
|
220
|
+
if (info.Length() != 7 ||
|
|
221
|
+
!info[0]->IsString() ||
|
|
222
|
+
!info[1]->IsString() ||
|
|
223
|
+
!info[2]->IsArray() ||
|
|
224
|
+
!info[3]->IsString() ||
|
|
225
|
+
!info[4]->IsNumber() ||
|
|
226
|
+
!info[5]->IsNumber() ||
|
|
227
|
+
!info[6]->IsBoolean()) {
|
|
228
|
+
Nan::ThrowError("Usage: pty.startProcess(file, cmdline, env, cwd, cols, rows, debug)");
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
filename = path_util::to_wstring(Nan::Utf8String(info[0]));
|
|
233
|
+
cmdline = path_util::to_wstring(Nan::Utf8String(info[1]));
|
|
234
|
+
cwd = path_util::to_wstring(Nan::Utf8String(info[3]));
|
|
235
|
+
|
|
236
|
+
// create environment block
|
|
237
|
+
const v8::Local<v8::Array> envValues = v8::Local<v8::Array>::Cast(info[2]);
|
|
238
|
+
if (!envValues.IsEmpty()) {
|
|
239
|
+
|
|
240
|
+
std::wstringstream envBlock;
|
|
241
|
+
|
|
242
|
+
for(uint32_t i = 0; i < envValues->Length(); i++) {
|
|
243
|
+
std::wstring envValue(path_util::to_wstring(Nan::Utf8String(Nan::Get(envValues, i).ToLocalChecked())));
|
|
244
|
+
envBlock << envValue << L'\\0';
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
env = envBlock.str();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// use environment 'Path' variable to determine location of
|
|
251
|
+
// the relative path that we have recieved (e.g cmd.exe)
|
|
252
|
+
std::wstring shellpath;
|
|
253
|
+
if (::PathIsRelativeW(filename)) {
|
|
254
|
+
shellpath = path_util::get_shell_path(filename);
|
|
255
|
+
} else {
|
|
256
|
+
shellpath = filename;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
std::string shellpath_(shellpath.begin(), shellpath.end());
|
|
260
|
+
|
|
261
|
+
if (shellpath.empty() || !path_util::file_exists(shellpath)) {
|
|
262
|
+
why << "File not found: " << shellpath_;
|
|
263
|
+
Nan::ThrowError(why.str().c_str());
|
|
264
|
+
goto cleanup;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
cols = info[4]->Int32Value(Nan::GetCurrentContext()).FromJust();
|
|
268
|
+
rows = info[5]->Int32Value(Nan::GetCurrentContext()).FromJust();
|
|
269
|
+
debug = Nan::To<bool>(info[6]).FromJust();
|
|
270
|
+
|
|
271
|
+
// Enable/disable debugging
|
|
272
|
+
SetEnvironmentVariable(WINPTY_DBG_VARIABLE, debug ? "1" : NULL); // NULL = deletes variable
|
|
273
|
+
|
|
274
|
+
// Create winpty config
|
|
275
|
+
winpty_config = winpty_config_new(0, &error_ptr);
|
|
276
|
+
if (winpty_config == nullptr) {
|
|
277
|
+
throw_winpty_error("Error creating WinPTY config", error_ptr);
|
|
278
|
+
goto cleanup;
|
|
279
|
+
}
|
|
280
|
+
winpty_error_free(error_ptr);
|
|
281
|
+
|
|
282
|
+
// Set pty size on config
|
|
283
|
+
winpty_config_set_initial_size(winpty_config, cols, rows);
|
|
284
|
+
|
|
285
|
+
// Start the pty agent
|
|
286
|
+
pc = winpty_open(winpty_config, &error_ptr);
|
|
287
|
+
winpty_config_free(winpty_config);
|
|
288
|
+
if (pc == nullptr) {
|
|
289
|
+
throw_winpty_error("Error launching WinPTY agent", error_ptr);
|
|
290
|
+
goto cleanup;
|
|
291
|
+
}
|
|
292
|
+
winpty_error_free(error_ptr);
|
|
293
|
+
|
|
294
|
+
// Save pty struct for later use
|
|
295
|
+
ptyHandles.insert(ptyHandles.end(), pc);
|
|
296
|
+
|
|
297
|
+
// Create winpty spawn config
|
|
298
|
+
config = winpty_spawn_config_new(WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN, shellpath.c_str(), cmdline, cwd, env.c_str(), &error_ptr);
|
|
299
|
+
if (config == nullptr) {
|
|
300
|
+
throw_winpty_error("Error creating WinPTY spawn config", error_ptr);
|
|
301
|
+
goto cleanup;
|
|
302
|
+
}
|
|
303
|
+
winpty_error_free(error_ptr);
|
|
304
|
+
|
|
305
|
+
// Spawn the new process
|
|
306
|
+
spawnSuccess = winpty_spawn(pc, config, &handle, nullptr, nullptr, &error_ptr);
|
|
307
|
+
winpty_spawn_config_free(config);
|
|
308
|
+
if (!spawnSuccess) {
|
|
309
|
+
throw_winpty_error("Unable to start terminal process", error_ptr);
|
|
310
|
+
goto cleanup;
|
|
311
|
+
}
|
|
312
|
+
winpty_error_free(error_ptr);
|
|
313
|
+
|
|
314
|
+
// Set return values
|
|
315
|
+
Nan::Set(marshal, Nan::New<v8::String>("innerPid").ToLocalChecked(), Nan::New<v8::Number>((int)GetProcessId(handle)));
|
|
316
|
+
Nan::Set(marshal, Nan::New<v8::String>("innerPidHandle").ToLocalChecked(), Nan::New<v8::Number>((int)handle));
|
|
317
|
+
Nan::Set(marshal, Nan::New<v8::String>("pid").ToLocalChecked(), Nan::New<v8::Number>((int)winpty_agent_process(pc)));
|
|
318
|
+
Nan::Set(marshal, Nan::New<v8::String>("pty").ToLocalChecked(), Nan::New<v8::Number>(InterlockedIncrement(&ptyCounter)));
|
|
319
|
+
Nan::Set(marshal, Nan::New<v8::String>("fd").ToLocalChecked(), Nan::New<v8::Number>(-1));
|
|
320
|
+
{
|
|
321
|
+
LPCWSTR coninPipeName = winpty_conin_name(pc);
|
|
322
|
+
std::wstring coninPipeNameWStr(coninPipeName);
|
|
323
|
+
std::string coninPipeNameStr(coninPipeNameWStr.begin(), coninPipeNameWStr.end());
|
|
324
|
+
Nan::Set(marshal, Nan::New<v8::String>("conin").ToLocalChecked(), Nan::New<v8::String>(coninPipeNameStr).ToLocalChecked());
|
|
325
|
+
LPCWSTR conoutPipeName = winpty_conout_name(pc);
|
|
326
|
+
std::wstring conoutPipeNameWStr(conoutPipeName);
|
|
327
|
+
std::string conoutPipeNameStr(conoutPipeNameWStr.begin(), conoutPipeNameWStr.end());
|
|
328
|
+
Nan::Set(marshal, Nan::New<v8::String>("conout").ToLocalChecked(), Nan::New<v8::String>(conoutPipeNameStr).ToLocalChecked());
|
|
329
|
+
}
|
|
330
|
+
info.GetReturnValue().Set(marshal);
|
|
331
|
+
|
|
332
|
+
goto cleanup;
|
|
333
|
+
|
|
334
|
+
cleanup:
|
|
335
|
+
delete filename;
|
|
336
|
+
delete cmdline;
|
|
337
|
+
delete cwd;
|
|
338
|
+
}
|
|
339
|
+
`
|
|
340
|
+
}
|
|
341
|
+
]);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { pipeline } from "node:stream/promises";
|
|
5
|
+
import { createWriteStream } from "node:fs";
|
|
6
|
+
import { spawnSync } from "node:child_process";
|
|
7
|
+
|
|
8
|
+
const upstreamTarballUrl =
|
|
9
|
+
process.env.CODINGNS_NODE_PTY_UPSTREAM_TARBALL ??
|
|
10
|
+
"https://registry.npmjs.org/node-pty/-/node-pty-1.0.0.tgz";
|
|
11
|
+
|
|
12
|
+
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
13
|
+
const vendorDir = path.join(packageRoot, "vendor");
|
|
14
|
+
const downloadDir = path.join(vendorDir, "downloads");
|
|
15
|
+
const extractDir = path.join(vendorDir, "upstream");
|
|
16
|
+
const archivePath = path.join(downloadDir, "node-pty-1.0.0.tgz");
|
|
17
|
+
|
|
18
|
+
fs.mkdirSync(downloadDir, { recursive: true });
|
|
19
|
+
|
|
20
|
+
if (!fs.existsSync(archivePath)) {
|
|
21
|
+
const response = await fetch(upstreamTarballUrl);
|
|
22
|
+
if (!response.ok || !response.body) {
|
|
23
|
+
throw new Error(`下载上游 tarball 失败:${upstreamTarballUrl} -> ${response.status} ${response.statusText}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
await pipeline(response.body, createWriteStream(archivePath));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
fs.rmSync(extractDir, { recursive: true, force: true });
|
|
30
|
+
fs.mkdirSync(extractDir, { recursive: true });
|
|
31
|
+
|
|
32
|
+
const tarResult = spawnSync("tar", ["-xzf", archivePath, "-C", extractDir], {
|
|
33
|
+
stdio: "inherit",
|
|
34
|
+
shell: process.platform === "win32"
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
if (tarResult.status !== 0) {
|
|
38
|
+
process.exit(tarResult.status ?? 1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
console.log(`[codingns-node-pty] 已准备上游源码:${extractDir}`);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const os = require("node:os");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const { spawnSync } = require("node:child_process");
|
|
7
|
+
|
|
8
|
+
const packageRoot = path.resolve(__dirname, "..");
|
|
9
|
+
const tarballs = fs.readdirSync(packageRoot).filter((fileName) => fileName.endsWith(".tgz")).sort();
|
|
10
|
+
|
|
11
|
+
if (tarballs.length === 0) {
|
|
12
|
+
console.error("[codingns-node-pty] 安装验证失败:当前目录没有 npm pack 产物。");
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const tarballPath = path.join(packageRoot, tarballs[tarballs.length - 1]);
|
|
17
|
+
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "codingns-node-pty-smoke-"));
|
|
18
|
+
const installLogPath = path.join(tempRoot, "npm-install.log");
|
|
19
|
+
|
|
20
|
+
fs.writeFileSync(path.join(tempRoot, "package.json"), JSON.stringify({
|
|
21
|
+
name: "codingns-node-pty-smoke",
|
|
22
|
+
private: true
|
|
23
|
+
}, null, 2));
|
|
24
|
+
|
|
25
|
+
const installResult = spawnSync("npm", ["install", tarballPath, "--ignore-scripts=false"], {
|
|
26
|
+
cwd: tempRoot,
|
|
27
|
+
encoding: "utf8",
|
|
28
|
+
shell: process.platform === "win32"
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const combinedOutput = `${installResult.stdout || ""}${installResult.stderr || ""}`;
|
|
32
|
+
fs.writeFileSync(installLogPath, combinedOutput, "utf8");
|
|
33
|
+
|
|
34
|
+
if (installResult.status !== 0) {
|
|
35
|
+
process.stderr.write(combinedOutput);
|
|
36
|
+
console.error(`[codingns-node-pty] 安装验证失败:npm install 返回非 0,日志:${installLogPath}`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (/node-gyp rebuild/i.test(combinedOutput)) {
|
|
41
|
+
console.error(`[codingns-node-pty] 安装验证失败:npm install 过程中触发了 node-gyp rebuild,日志:${installLogPath}`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const moduleRoot = path.join(tempRoot, "node_modules", "@codingns", "node-pty");
|
|
46
|
+
const smokeResult = spawnSync("node", [path.join(moduleRoot, "scripts", "smoke-load.cjs")], {
|
|
47
|
+
cwd: tempRoot,
|
|
48
|
+
encoding: "utf8",
|
|
49
|
+
shell: process.platform === "win32"
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (smokeResult.status !== 0) {
|
|
53
|
+
process.stderr.write(`${smokeResult.stdout || ""}${smokeResult.stderr || ""}`);
|
|
54
|
+
console.error("[codingns-node-pty] 安装验证失败:tarball 安装后无法完成最小加载检查。");
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
process.stdout.write(smokeResult.stdout || "");
|
|
59
|
+
console.log("[codingns-node-pty] tarball 安装验证通过。");
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
6
|
+
const upstreamRoot = path.join(packageRoot, "vendor", "upstream", "package");
|
|
7
|
+
|
|
8
|
+
const copyTargets = [
|
|
9
|
+
"binding.gyp",
|
|
10
|
+
"LICENSE",
|
|
11
|
+
"lib",
|
|
12
|
+
"src",
|
|
13
|
+
"typings",
|
|
14
|
+
"deps"
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
for (const target of copyTargets) {
|
|
18
|
+
const sourcePath = path.join(upstreamRoot, target);
|
|
19
|
+
const targetPath = path.join(packageRoot, target);
|
|
20
|
+
|
|
21
|
+
if (!fs.existsSync(sourcePath)) {
|
|
22
|
+
throw new Error(`缺少上游路径:${sourcePath}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
fs.rmSync(targetPath, { recursive: true, force: true });
|
|
26
|
+
fs.cpSync(sourcePath, targetPath, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
console.log("[codingns-node-pty] 已同步上游源码骨架。");
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
|
|
6
|
+
const packageRoot = path.resolve(__dirname, "..");
|
|
7
|
+
const releaseDir = path.join(packageRoot, "build", "Release");
|
|
8
|
+
|
|
9
|
+
const requiredFiles = [
|
|
10
|
+
path.join(packageRoot, "lib", "index.js"),
|
|
11
|
+
path.join(packageRoot, "typings", "node-pty.d.ts"),
|
|
12
|
+
path.join(packageRoot, "binding.gyp")
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const runtimeRequired = [
|
|
16
|
+
"conpty.node",
|
|
17
|
+
"conpty_console_list.node",
|
|
18
|
+
"pty.node",
|
|
19
|
+
"winpty-agent.exe",
|
|
20
|
+
"winpty.dll"
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
if (process.platform !== "win32") {
|
|
24
|
+
console.log("[codingns-node-pty] 非 win32 环境,跳过运行时校验。");
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (process.arch !== "x64") {
|
|
29
|
+
console.error("[codingns-node-pty] 当前仅支持 x64。");
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const nodeMajor = Number((process.versions.node || "").split(".")[0]);
|
|
34
|
+
if (nodeMajor !== 22) {
|
|
35
|
+
console.error(`[codingns-node-pty] 当前仅支持 Node 22,检测到 ${process.versions.node || "unknown"}。`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
for (const filePath of requiredFiles) {
|
|
40
|
+
if (!fs.existsSync(filePath)) {
|
|
41
|
+
console.error(`[codingns-node-pty] 缺少关键文件:${filePath}`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const fileName of runtimeRequired) {
|
|
47
|
+
const filePath = path.join(releaseDir, fileName);
|
|
48
|
+
if (!fs.existsSync(filePath)) {
|
|
49
|
+
console.error(`[codingns-node-pty] 缺少预编译产物:${filePath}`);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
console.log("[codingns-node-pty] 运行时校验通过。");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const assert = require("node:assert/strict");
|
|
4
|
+
const { spawnSync } = require("node:child_process");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const test = require("node:test");
|
|
7
|
+
|
|
8
|
+
const scriptPath = path.join(__dirname, "verify-runtime.cjs");
|
|
9
|
+
|
|
10
|
+
test("非 Windows 环境会跳过 node-pty 运行时校验", () => {
|
|
11
|
+
const result = spawnSync(process.execPath, [scriptPath], {
|
|
12
|
+
encoding: "utf8"
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
if (process.platform === "win32") {
|
|
16
|
+
assert.notEqual(result.status, 0);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
assert.equal(result.status, 0);
|
|
21
|
+
assert.match(result.stdout, /非 win32 环境,跳过运行时校验/);
|
|
22
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const os = require("node:os");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const { spawnSync } = require("node:child_process");
|
|
7
|
+
|
|
8
|
+
const packageRoot = path.resolve(__dirname, "..");
|
|
9
|
+
const tarballs = fs.readdirSync(packageRoot).filter((fileName) => fileName.endsWith(".tgz")).sort();
|
|
10
|
+
|
|
11
|
+
if (tarballs.length === 0) {
|
|
12
|
+
console.error("[codingns-node-pty] tarball 校验失败:当前目录没有 npm pack 产物。");
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const tarballPath = path.join(packageRoot, tarballs[tarballs.length - 1]);
|
|
17
|
+
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "codingns-node-pty-pack-"));
|
|
18
|
+
|
|
19
|
+
const extractResult = spawnSync("tar", ["-xzf", tarballPath, "-C", tempRoot], {
|
|
20
|
+
cwd: packageRoot,
|
|
21
|
+
encoding: "utf8",
|
|
22
|
+
shell: process.platform === "win32"
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if (extractResult.status !== 0) {
|
|
26
|
+
process.stderr.write(`${extractResult.stdout || ""}${extractResult.stderr || ""}`);
|
|
27
|
+
console.error(`[codingns-node-pty] tarball 校验失败:无法解包 ${tarballPath}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const unpackedRoot = path.join(tempRoot, "package");
|
|
32
|
+
const packageJsonPath = path.join(unpackedRoot, "package.json");
|
|
33
|
+
|
|
34
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
35
|
+
console.error("[codingns-node-pty] tarball 校验失败:解包后缺少 package/package.json。");
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
40
|
+
|
|
41
|
+
if (packageJson.name !== "@codingns/node-pty") {
|
|
42
|
+
console.error(`[codingns-node-pty] tarball 校验失败:包名不对,检测到 ${packageJson.name || "unknown"}。`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (packageJson.version !== "1.0.0-cns.1") {
|
|
47
|
+
console.error(`[codingns-node-pty] tarball 校验失败:版本不对,检测到 ${packageJson.version || "unknown"}。`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (packageJson.types !== "./typings/node-pty.d.ts") {
|
|
52
|
+
console.error(`[codingns-node-pty] tarball 校验失败:types 入口不对,检测到 ${packageJson.types || "unknown"}。`);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const requiredPaths = [
|
|
57
|
+
path.join(unpackedRoot, "README.md"),
|
|
58
|
+
path.join(unpackedRoot, "LICENSE"),
|
|
59
|
+
path.join(unpackedRoot, "lib", "index.js"),
|
|
60
|
+
path.join(unpackedRoot, "typings", "node-pty.d.ts"),
|
|
61
|
+
path.join(unpackedRoot, "binding.gyp"),
|
|
62
|
+
path.join(unpackedRoot, "scripts", "verify-runtime.cjs"),
|
|
63
|
+
path.join(unpackedRoot, "scripts", "verify-tarball.cjs"),
|
|
64
|
+
path.join(unpackedRoot, "scripts", "smoke-load.cjs"),
|
|
65
|
+
path.join(unpackedRoot, "scripts", "install-smoke.cjs"),
|
|
66
|
+
path.join(unpackedRoot, "build", "Release", "conpty.node"),
|
|
67
|
+
path.join(unpackedRoot, "build", "Release", "conpty_console_list.node"),
|
|
68
|
+
path.join(unpackedRoot, "build", "Release", "pty.node"),
|
|
69
|
+
path.join(unpackedRoot, "build", "Release", "winpty-agent.exe"),
|
|
70
|
+
path.join(unpackedRoot, "build", "Release", "winpty.dll")
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
for (const filePath of requiredPaths) {
|
|
74
|
+
if (!fs.existsSync(filePath)) {
|
|
75
|
+
console.error(`[codingns-node-pty] tarball 校验失败:缺少关键文件 ${filePath}`);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
console.log(`[codingns-node-pty] tarball 校验通过:${path.basename(tarballPath)}`);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2019, Microsoft Corporation (MIT License).
|
|
3
|
+
*
|
|
4
|
+
* This module fetches the console process list for a particular PID. It must be
|
|
5
|
+
* called from a different process (child_process.fork) as there can only be a
|
|
6
|
+
* single console attached to a process.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
let getConsoleProcessList: any;
|
|
10
|
+
try {
|
|
11
|
+
getConsoleProcessList = require('../build/Release/conpty_console_list.node').getConsoleProcessList;
|
|
12
|
+
} catch (err) {
|
|
13
|
+
getConsoleProcessList = require('../build/Debug/conpty_console_list.node').getConsoleProcessList;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const shellPid = parseInt(process.argv[2], 10);
|
|
17
|
+
const consoleProcessList = getConsoleProcessList(shellPid);
|
|
18
|
+
process.send!({ consoleProcessList });
|
|
19
|
+
process.exit(0);
|