@walkhi/code-relax 0.1.0-beta.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/README.md +83 -0
- package/dist/bin/codex-remote.mjs +262 -0
- package/dist/bin/self-relay-demo.mjs +33 -0
- package/dist/bin/self-relay-server.mjs +50 -0
- package/dist/get-lan-networks.ps1 +40 -0
- package/dist/get-shared-service-url.ps1 +6 -0
- package/dist/shared/app-server-events.cjs +266 -0
- package/dist/shared/p2p-diagnostics.cjs +28 -0
- package/dist/shared/server-requests.cjs +67 -0
- package/dist/shared/timeline-sync.cjs +67 -0
- package/dist/skills/code-relax/SKILL.md +17 -0
- package/dist/src/app-server-client.mjs +468 -0
- package/dist/src/app-server-tasks.mjs +355 -0
- package/dist/src/background-process.mjs +18 -0
- package/dist/src/debug-ui.mjs +131 -0
- package/dist/src/desktop-launcher.mjs +51 -0
- package/dist/src/execution-health.mjs +26 -0
- package/dist/src/lan-socket-server.mjs +103 -0
- package/dist/src/managed-app-server.mjs +207 -0
- package/dist/src/message-images.mjs +27 -0
- package/dist/src/onboarding.mjs +31 -0
- package/dist/src/platform/README.md +12 -0
- package/dist/src/platform/linux/README.md +3 -0
- package/dist/src/platform/macos/README.md +3 -0
- package/dist/src/platform/windows/IsolatedProcess.cs +75 -0
- package/dist/src/platform/windows/background-process.mjs +25 -0
- package/dist/src/platform/windows/credential-store.mjs +27 -0
- package/dist/src/platform/windows/credential-store.ps1 +49 -0
- package/dist/src/platform/windows/desktop-host.mjs +38 -0
- package/dist/src/platform/windows/desktop-info.ps1 +16 -0
- package/dist/src/platform/windows/desktop-monitor.mjs +34 -0
- package/dist/src/platform/windows/desktop-shortcut-run.ps1 +5 -0
- package/dist/src/platform/windows/desktop-shortcuts.ps1 +28 -0
- package/dist/src/platform/windows/desktop-tools.mjs +48 -0
- package/dist/src/platform/windows/launch-worker.ps1 +13 -0
- package/dist/src/platform/windows/network-info.mjs +34 -0
- package/dist/src/platform/windows/resident-start.ps1 +7 -0
- package/dist/src/platform/windows/resident-startup.ps1 +27 -0
- package/dist/src/platform/windows/resolve-state-root.ps1 +14 -0
- package/dist/src/platform/windows/runtime-paths.mjs +20 -0
- package/dist/src/platform/windows/service-host.mjs +43 -0
- package/dist/src/platform/windows/start-hidden-console.ps1 +39 -0
- package/dist/src/platform/windows/stop-desktop.ps1 +19 -0
- package/dist/src/platform/windows/user-environment.mjs +50 -0
- package/dist/src/platform/windows/user-environment.ps1 +41 -0
- package/dist/src/self-relay/client.mjs +59 -0
- package/dist/src/self-relay/connector.mjs +147 -0
- package/dist/src/self-relay/debug-allowlist.mjs +33 -0
- package/dist/src/self-relay/demo.mjs +38 -0
- package/dist/src/self-relay/device-store.mjs +84 -0
- package/dist/src/self-relay/lan-authorizations.mjs +29 -0
- package/dist/src/self-relay/lifecycle.mjs +281 -0
- package/dist/src/self-relay/p2p-probe.mjs +83 -0
- package/dist/src/self-relay/server.mjs +340 -0
- package/dist/src/self-relay/windows-route-helper.mjs +75 -0
- package/dist/src/self-relay/wire.mjs +36 -0
- package/dist/src/server.mjs +2086 -0
- package/dist/src/service-control.mjs +72 -0
- package/dist/src/service-doctor.mjs +63 -0
- package/dist/src/service-health.mjs +33 -0
- package/dist/src/service-install.mjs +91 -0
- package/dist/src/service-lifecycle.mjs +130 -0
- package/dist/src/service-restart.mjs +48 -0
- package/dist/src/shared-app-server.mjs +356 -0
- package/dist/src/shared-catalog.mjs +60 -0
- package/dist/src/shared-recovery.mjs +142 -0
- package/dist/src/shared-thread-stream.mjs +80 -0
- package/dist/src/skill-install.mjs +64 -0
- package/dist/src/thread-catalog.mjs +42 -0
- package/dist/src/thread-title-generation.mjs +150 -0
- package/dist/tools/find-desktop-pipe.mjs +10 -0
- package/dist/tools/rtc-route-helper.ps1 +99 -0
- package/dist/tools/start-rtc-route-helper.ps1 +15 -0
- package/dist/web/approval-ui.js +188 -0
- package/dist/web/capabilities.js +57 -0
- package/dist/web/chat-transport.js +196 -0
- package/dist/web/chat.css +736 -0
- package/dist/web/chat.js +5149 -0
- package/dist/web/client-platform.js +11 -0
- package/dist/web/harmony-platform.js +51 -0
- package/dist/web/highlight-powershell.min.js +39 -0
- package/dist/web/highlight.min.js +1262 -0
- package/dist/web/history-cache.js +146 -0
- package/dist/web/index.html +222 -0
- package/dist/web/lan-session.js +122 -0
- package/dist/web/p2p-diagnostics.js +28 -0
- package/dist/web/p2p-probe.js +83 -0
- package/dist/web/resources.json +1 -0
- package/dist/web/self-relay-session.js +119 -0
- package/dist/web/server-requests.js +67 -0
- package/dist/web/timeline-sync.js +67 -0
- package/dist/web/vendor/README.md +14 -0
- package/dist/web/vendor/highlight-powershell.min.js +39 -0
- package/dist/web/vendor/highlight.LICENSE.txt +29 -0
- package/dist/web/vendor/highlight.min.js +1262 -0
- package/dist/web/vendor/markdown-it.LICENSE.txt +22 -0
- package/dist/web/vendor/markdown-it.umd.min.js +14 -0
- package/node_modules/@img/colour/LICENSE.md +82 -0
- package/node_modules/@img/colour/README.md +15 -0
- package/node_modules/@img/colour/color.cjs +1596 -0
- package/node_modules/@img/colour/index.cjs +1 -0
- package/node_modules/@img/colour/index.d.ts +929 -0
- package/node_modules/@img/colour/package.json +58 -0
- package/node_modules/@img/sharp-win32-x64/LICENSE +191 -0
- package/node_modules/@img/sharp-win32-x64/README.md +59 -0
- package/node_modules/@img/sharp-win32-x64/index.cjs +1 -0
- package/node_modules/@img/sharp-win32-x64/lib/libvips-42.dll +0 -0
- package/node_modules/@img/sharp-win32-x64/lib/libvips-cpp-8.18.6.dll +0 -0
- package/node_modules/@img/sharp-win32-x64/lib/sharp-win32-x64-0.35.4.node +0 -0
- package/node_modules/@img/sharp-win32-x64/package.json +40 -0
- package/node_modules/@img/sharp-win32-x64/versions.json +30 -0
- package/node_modules/@node-datachannel/win32-x64-msvc/node_datachannel.node +0 -0
- package/node_modules/@node-datachannel/win32-x64-msvc/package.json +20 -0
- package/node_modules/ansi-regex/index.d.ts +37 -0
- package/node_modules/ansi-regex/index.js +10 -0
- package/node_modules/ansi-regex/license +9 -0
- package/node_modules/ansi-regex/package.json +55 -0
- package/node_modules/ansi-regex/readme.md +78 -0
- package/node_modules/ansi-styles/index.d.ts +345 -0
- package/node_modules/ansi-styles/index.js +163 -0
- package/node_modules/ansi-styles/license +9 -0
- package/node_modules/ansi-styles/package.json +56 -0
- package/node_modules/ansi-styles/readme.md +152 -0
- package/node_modules/camelcase/index.d.ts +63 -0
- package/node_modules/camelcase/index.js +76 -0
- package/node_modules/camelcase/license +9 -0
- package/node_modules/camelcase/package.json +43 -0
- package/node_modules/camelcase/readme.md +99 -0
- package/node_modules/cliui/CHANGELOG.md +76 -0
- package/node_modules/cliui/LICENSE.txt +14 -0
- package/node_modules/cliui/README.md +115 -0
- package/node_modules/cliui/index.js +354 -0
- package/node_modules/cliui/package.json +65 -0
- package/node_modules/color-convert/CHANGELOG.md +54 -0
- package/node_modules/color-convert/LICENSE +21 -0
- package/node_modules/color-convert/README.md +68 -0
- package/node_modules/color-convert/conversions.js +839 -0
- package/node_modules/color-convert/index.js +81 -0
- package/node_modules/color-convert/package.json +48 -0
- package/node_modules/color-convert/route.js +97 -0
- package/node_modules/color-name/LICENSE +8 -0
- package/node_modules/color-name/README.md +11 -0
- package/node_modules/color-name/index.js +152 -0
- package/node_modules/color-name/package.json +28 -0
- package/node_modules/decamelize/index.js +13 -0
- package/node_modules/decamelize/license +21 -0
- package/node_modules/decamelize/package.json +38 -0
- package/node_modules/decamelize/readme.md +48 -0
- package/node_modules/detect-libc/LICENSE +201 -0
- package/node_modules/detect-libc/README.md +163 -0
- package/node_modules/detect-libc/index.d.ts +14 -0
- package/node_modules/detect-libc/lib/detect-libc.js +313 -0
- package/node_modules/detect-libc/lib/elf.js +39 -0
- package/node_modules/detect-libc/lib/filesystem.js +51 -0
- package/node_modules/detect-libc/lib/process.js +24 -0
- package/node_modules/detect-libc/package.json +44 -0
- package/node_modules/dijkstrajs/.travis.yml +4 -0
- package/node_modules/dijkstrajs/CONTRIBUTING.md +8 -0
- package/node_modules/dijkstrajs/LICENSE.md +19 -0
- package/node_modules/dijkstrajs/README.md +18 -0
- package/node_modules/dijkstrajs/dijkstra.js +165 -0
- package/node_modules/dijkstrajs/package.json +60 -0
- package/node_modules/dijkstrajs/test/dijkstra.test.js +96 -0
- package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/emoji-regex/README.md +73 -0
- package/node_modules/emoji-regex/es2015/index.js +6 -0
- package/node_modules/emoji-regex/es2015/text.js +6 -0
- package/node_modules/emoji-regex/index.d.ts +23 -0
- package/node_modules/emoji-regex/index.js +6 -0
- package/node_modules/emoji-regex/package.json +50 -0
- package/node_modules/emoji-regex/text.js +6 -0
- package/node_modules/find-up/index.d.ts +137 -0
- package/node_modules/find-up/index.js +89 -0
- package/node_modules/find-up/license +9 -0
- package/node_modules/find-up/package.json +53 -0
- package/node_modules/find-up/readme.md +156 -0
- package/node_modules/get-caller-file/LICENSE.md +6 -0
- package/node_modules/get-caller-file/README.md +41 -0
- package/node_modules/get-caller-file/index.d.ts +2 -0
- package/node_modules/get-caller-file/index.js +22 -0
- package/node_modules/get-caller-file/index.js.map +1 -0
- package/node_modules/get-caller-file/package.json +42 -0
- package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/node_modules/is-fullwidth-code-point/index.js +50 -0
- package/node_modules/is-fullwidth-code-point/license +9 -0
- package/node_modules/is-fullwidth-code-point/package.json +42 -0
- package/node_modules/is-fullwidth-code-point/readme.md +39 -0
- package/node_modules/locate-path/index.d.ts +83 -0
- package/node_modules/locate-path/index.js +65 -0
- package/node_modules/locate-path/license +9 -0
- package/node_modules/locate-path/package.json +45 -0
- package/node_modules/locate-path/readme.md +122 -0
- package/node_modules/node-datachannel/.clang-format +17 -0
- package/node_modules/node-datachannel/.editorconfig +12 -0
- package/node_modules/node-datachannel/.eslintignore +8 -0
- package/node_modules/node-datachannel/.eslintrc.json +27 -0
- package/node_modules/node-datachannel/.gitmodules +3 -0
- package/node_modules/node-datachannel/.prettierignore +7 -0
- package/node_modules/node-datachannel/.prettierrc +13 -0
- package/node_modules/node-datachannel/API.md +247 -0
- package/node_modules/node-datachannel/BULDING.md +26 -0
- package/node_modules/node-datachannel/CMakeLists.txt +153 -0
- package/node_modules/node-datachannel/LICENSE +373 -0
- package/node_modules/node-datachannel/README.md +129 -0
- package/node_modules/node-datachannel/dist/cjs/index.cjs +11 -0
- package/node_modules/node-datachannel/dist/cjs/index.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/lib/datachannel-stream.cjs +101 -0
- package/node_modules/node-datachannel/dist/cjs/lib/datachannel-stream.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/lib/index.cjs +91 -0
- package/node_modules/node-datachannel/dist/cjs/lib/index.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/lib/node-datachannel.cjs +94 -0
- package/node_modules/node-datachannel/dist/cjs/lib/node-datachannel.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/lib/websocket-server.cjs +45 -0
- package/node_modules/node-datachannel/dist/cjs/lib/websocket-server.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/lib/websocket.cjs +8 -0
- package/node_modules/node-datachannel/dist/cjs/lib/websocket.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/Events.cjs +86 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/Events.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/Exception.cjs +34 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/Exception.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCCertificate.cjs +34 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCCertificate.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCDataChannel.cjs +214 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCDataChannel.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCDtlsTransport.cjs +53 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCDtlsTransport.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCError.cjs +83 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCError.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCIceCandidate.cjs +132 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCIceCandidate.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCIceTransport.cjs +94 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCIceTransport.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCPeerConnection.cjs +434 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCPeerConnection.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCSctpTransport.cjs +59 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCSctpTransport.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCSessionDescription.cjs +45 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/RTCSessionDescription.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/index.cjs +42 -0
- package/node_modules/node-datachannel/dist/cjs/polyfill/index.cjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/index.mjs +8 -0
- package/node_modules/node-datachannel/dist/esm/index.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/lib/datachannel-stream.mjs +78 -0
- package/node_modules/node-datachannel/dist/esm/lib/datachannel-stream.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/lib/index.mjs +64 -0
- package/node_modules/node-datachannel/dist/esm/lib/index.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/lib/node-datachannel.mjs +78 -0
- package/node_modules/node-datachannel/dist/esm/lib/node-datachannel.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/lib/websocket-server.mjs +43 -0
- package/node_modules/node-datachannel/dist/esm/lib/websocket-server.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/lib/websocket.mjs +6 -0
- package/node_modules/node-datachannel/dist/esm/lib/websocket.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/Events.mjs +82 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/Events.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/Exception.mjs +28 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/Exception.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCCertificate.mjs +30 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCCertificate.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCDataChannel.mjs +210 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCDataChannel.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCDtlsTransport.mjs +49 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCDtlsTransport.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCError.mjs +79 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCError.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCIceCandidate.mjs +128 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCIceCandidate.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCIceTransport.mjs +89 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCIceTransport.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCPeerConnection.mjs +430 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCPeerConnection.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCSctpTransport.mjs +55 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCSctpTransport.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCSessionDescription.mjs +41 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/RTCSessionDescription.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/index.mjs +27 -0
- package/node_modules/node-datachannel/dist/esm/polyfill/index.mjs.map +1 -0
- package/node_modules/node-datachannel/dist/types/lib/datachannel-stream.d.ts +24 -0
- package/node_modules/node-datachannel/dist/types/lib/index.d.ts +241 -0
- package/node_modules/node-datachannel/dist/types/lib/types.d.ts +119 -0
- package/node_modules/node-datachannel/dist/types/lib/websocket-server.d.ts +13 -0
- package/node_modules/node-datachannel/dist/types/lib/websocket.d.ts +25 -0
- package/node_modules/node-datachannel/dist/types/polyfill/Events.d.ts +15 -0
- package/node_modules/node-datachannel/dist/types/polyfill/RTCCertificate.d.ts +9 -0
- package/node_modules/node-datachannel/dist/types/polyfill/RTCDataChannel.d.ts +29 -0
- package/node_modules/node-datachannel/dist/types/polyfill/RTCDtlsTransport.d.ts +15 -0
- package/node_modules/node-datachannel/dist/types/polyfill/RTCError.d.ts +17 -0
- package/node_modules/node-datachannel/dist/types/polyfill/RTCIceCandidate.d.ts +21 -0
- package/node_modules/node-datachannel/dist/types/polyfill/RTCIceTransport.d.ts +30 -0
- package/node_modules/node-datachannel/dist/types/polyfill/RTCPeerConnection.d.ts +64 -0
- package/node_modules/node-datachannel/dist/types/polyfill/RTCSctpTransport.d.ts +15 -0
- package/node_modules/node-datachannel/dist/types/polyfill/RTCSessionDescription.d.ts +10 -0
- package/node_modules/node-datachannel/dist/types/polyfill/index.d.ts +26 -0
- package/node_modules/node-datachannel/jest.config.ts +14 -0
- package/node_modules/node-datachannel/package.json +133 -0
- package/node_modules/node-datachannel/rollup.config.mjs +67 -0
- package/node_modules/node-datachannel/src/cpp/data-channel-wrapper.cpp +530 -0
- package/node_modules/node-datachannel/src/cpp/data-channel-wrapper.h +63 -0
- package/node_modules/node-datachannel/src/cpp/ice-udp-mux-listener-wrapper.cpp +172 -0
- package/node_modules/node-datachannel/src/cpp/ice-udp-mux-listener-wrapper.h +43 -0
- package/node_modules/node-datachannel/src/cpp/main.cpp +58 -0
- package/node_modules/node-datachannel/src/cpp/media-audio-wrapper.cpp +457 -0
- package/node_modules/node-datachannel/src/cpp/media-audio-wrapper.h +52 -0
- package/node_modules/node-datachannel/src/cpp/media-av1packetization.cpp +24 -0
- package/node_modules/node-datachannel/src/cpp/media-av1packetization.h +11 -0
- package/node_modules/node-datachannel/src/cpp/media-av1rtppacketizer-wrapper.cpp +126 -0
- package/node_modules/node-datachannel/src/cpp/media-av1rtppacketizer-wrapper.h +29 -0
- package/node_modules/node-datachannel/src/cpp/media-direction.cpp +43 -0
- package/node_modules/node-datachannel/src/cpp/media-direction.h +10 -0
- package/node_modules/node-datachannel/src/cpp/media-h264rtppacketizer-wrapper.cpp +126 -0
- package/node_modules/node-datachannel/src/cpp/media-h264rtppacketizer-wrapper.h +30 -0
- package/node_modules/node-datachannel/src/cpp/media-h265rtppacketizer-wrapper.cpp +126 -0
- package/node_modules/node-datachannel/src/cpp/media-h265rtppacketizer-wrapper.h +30 -0
- package/node_modules/node-datachannel/src/cpp/media-h26xseparator.cpp +32 -0
- package/node_modules/node-datachannel/src/cpp/media-h26xseparator.h +11 -0
- package/node_modules/node-datachannel/src/cpp/media-mediahandler-helper.cpp +31 -0
- package/node_modules/node-datachannel/src/cpp/media-mediahandler-helper.h +11 -0
- package/node_modules/node-datachannel/src/cpp/media-pacinghandler-wrapper.cpp +79 -0
- package/node_modules/node-datachannel/src/cpp/media-pacinghandler-wrapper.h +28 -0
- package/node_modules/node-datachannel/src/cpp/media-rtcpnackresponder-wrapper.cpp +68 -0
- package/node_modules/node-datachannel/src/cpp/media-rtcpnackresponder-wrapper.h +28 -0
- package/node_modules/node-datachannel/src/cpp/media-rtcpreceivingsession-wrapper.cpp +57 -0
- package/node_modules/node-datachannel/src/cpp/media-rtcpreceivingsession-wrapper.h +28 -0
- package/node_modules/node-datachannel/src/cpp/media-rtcpsrreporter-wrapper.cpp +93 -0
- package/node_modules/node-datachannel/src/cpp/media-rtcpsrreporter-wrapper.h +30 -0
- package/node_modules/node-datachannel/src/cpp/media-rtppacketizationconfig-wrapper.cpp +167 -0
- package/node_modules/node-datachannel/src/cpp/media-rtppacketizationconfig-wrapper.h +35 -0
- package/node_modules/node-datachannel/src/cpp/media-rtppacketizer-wrapper.cpp +95 -0
- package/node_modules/node-datachannel/src/cpp/media-rtppacketizer-wrapper.h +30 -0
- package/node_modules/node-datachannel/src/cpp/media-track-wrapper.cpp +458 -0
- package/node_modules/node-datachannel/src/cpp/media-track-wrapper.h +61 -0
- package/node_modules/node-datachannel/src/cpp/media-video-wrapper.cpp +526 -0
- package/node_modules/node-datachannel/src/cpp/media-video-wrapper.h +56 -0
- package/node_modules/node-datachannel/src/cpp/peer-connection-wrapper.cpp +1298 -0
- package/node_modules/node-datachannel/src/cpp/peer-connection-wrapper.h +89 -0
- package/node_modules/node-datachannel/src/cpp/rtc-wrapper.cpp +205 -0
- package/node_modules/node-datachannel/src/cpp/rtc-wrapper.h +24 -0
- package/node_modules/node-datachannel/src/cpp/thread-safe-callback.cpp +57 -0
- package/node_modules/node-datachannel/src/cpp/thread-safe-callback.h +47 -0
- package/node_modules/node-datachannel/src/cpp/web-socket-server-wrapper.cpp +275 -0
- package/node_modules/node-datachannel/src/cpp/web-socket-server-wrapper.h +41 -0
- package/node_modules/node-datachannel/src/cpp/web-socket-wrapper.cpp +796 -0
- package/node_modules/node-datachannel/src/cpp/web-socket-wrapper.h +63 -0
- package/node_modules/node-datachannel/src/index.ts +9 -0
- package/node_modules/node-datachannel/src/lib/datachannel-stream.ts +100 -0
- package/node_modules/node-datachannel/src/lib/index.ts +290 -0
- package/node_modules/node-datachannel/src/lib/node-datachannel.ts +84 -0
- package/node_modules/node-datachannel/src/lib/types.ts +169 -0
- package/node_modules/node-datachannel/src/lib/websocket-server.ts +37 -0
- package/node_modules/node-datachannel/src/lib/websocket.ts +26 -0
- package/node_modules/node-datachannel/src/polyfill/Events.ts +82 -0
- package/node_modules/node-datachannel/src/polyfill/Exception.ts +37 -0
- package/node_modules/node-datachannel/src/polyfill/README.md +41 -0
- package/node_modules/node-datachannel/src/polyfill/RTCCertificate.ts +21 -0
- package/node_modules/node-datachannel/src/polyfill/RTCDataChannel.ts +225 -0
- package/node_modules/node-datachannel/src/polyfill/RTCDtlsTransport.ts +46 -0
- package/node_modules/node-datachannel/src/polyfill/RTCError.ts +78 -0
- package/node_modules/node-datachannel/src/polyfill/RTCIceCandidate.ts +128 -0
- package/node_modules/node-datachannel/src/polyfill/RTCIceTransport.ts +90 -0
- package/node_modules/node-datachannel/src/polyfill/RTCPeerConnection.ts +527 -0
- package/node_modules/node-datachannel/src/polyfill/RTCSctpTransport.ts +51 -0
- package/node_modules/node-datachannel/src/polyfill/RTCSessionDescription.ts +41 -0
- package/node_modules/node-datachannel/src/polyfill/index.ts +38 -0
- package/node_modules/node-datachannel/tsconfig.json +21 -0
- package/node_modules/p-limit/index.d.ts +38 -0
- package/node_modules/p-limit/index.js +57 -0
- package/node_modules/p-limit/license +9 -0
- package/node_modules/p-limit/package.json +52 -0
- package/node_modules/p-limit/readme.md +101 -0
- package/node_modules/p-locate/index.d.ts +64 -0
- package/node_modules/p-locate/index.js +52 -0
- package/node_modules/p-locate/license +9 -0
- package/node_modules/p-locate/package.json +53 -0
- package/node_modules/p-locate/readme.md +90 -0
- package/node_modules/p-try/index.d.ts +39 -0
- package/node_modules/p-try/index.js +9 -0
- package/node_modules/p-try/license +9 -0
- package/node_modules/p-try/package.json +42 -0
- package/node_modules/p-try/readme.md +58 -0
- package/node_modules/path-exists/index.d.ts +28 -0
- package/node_modules/path-exists/index.js +23 -0
- package/node_modules/path-exists/license +9 -0
- package/node_modules/path-exists/package.json +39 -0
- package/node_modules/path-exists/readme.md +52 -0
- package/node_modules/pngjs/.eslintignore +2 -0
- package/node_modules/pngjs/.eslintrc.json +19 -0
- package/node_modules/pngjs/.prettierignore +3 -0
- package/node_modules/pngjs/LICENSE +20 -0
- package/node_modules/pngjs/README.md +429 -0
- package/node_modules/pngjs/browser.js +16096 -0
- package/node_modules/pngjs/coverage/lcov-report/base.css +354 -0
- package/node_modules/pngjs/coverage/lcov-report/bitmapper.js.html +881 -0
- package/node_modules/pngjs/coverage/lcov-report/bitpacker.js.html +554 -0
- package/node_modules/pngjs/coverage/lcov-report/block-navigation.js +77 -0
- package/node_modules/pngjs/coverage/lcov-report/chunkstream.js.html +647 -0
- package/node_modules/pngjs/coverage/lcov-report/constants.js.html +176 -0
- package/node_modules/pngjs/coverage/lcov-report/crc.js.html +200 -0
- package/node_modules/pngjs/coverage/lcov-report/favicon.png +0 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-pack.js.html +593 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse-async.js.html +152 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse-sync.js.html +143 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse.js.html +611 -0
- package/node_modules/pngjs/coverage/lcov-report/format-normaliser.js.html +359 -0
- package/node_modules/pngjs/coverage/lcov-report/index.html +426 -0
- package/node_modules/pngjs/coverage/lcov-report/interlace.js.html +365 -0
- package/node_modules/pngjs/coverage/lcov-report/packer-async.js.html +230 -0
- package/node_modules/pngjs/coverage/lcov-report/packer-sync.js.html +248 -0
- package/node_modules/pngjs/coverage/lcov-report/packer.js.html +467 -0
- package/node_modules/pngjs/coverage/lcov-report/paeth-predictor.js.html +128 -0
- package/node_modules/pngjs/coverage/lcov-report/parser-async.js.html +575 -0
- package/node_modules/pngjs/coverage/lcov-report/parser-sync.js.html +404 -0
- package/node_modules/pngjs/coverage/lcov-report/parser.js.html +950 -0
- package/node_modules/pngjs/coverage/lcov-report/png-sync.js.html +116 -0
- package/node_modules/pngjs/coverage/lcov-report/png.js.html +662 -0
- package/node_modules/pngjs/coverage/lcov-report/prettify.css +101 -0
- package/node_modules/pngjs/coverage/lcov-report/prettify.js +1007 -0
- package/node_modules/pngjs/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/node_modules/pngjs/coverage/lcov-report/sorter.js +169 -0
- package/node_modules/pngjs/coverage/lcov-report/sync-inflate.js.html +584 -0
- package/node_modules/pngjs/coverage/lcov-report/sync-reader.js.html +215 -0
- package/node_modules/pngjs/coverage/lcov.info +2177 -0
- package/node_modules/pngjs/lib/bitmapper.js +267 -0
- package/node_modules/pngjs/lib/bitpacker.js +158 -0
- package/node_modules/pngjs/lib/chunkstream.js +189 -0
- package/node_modules/pngjs/lib/constants.js +32 -0
- package/node_modules/pngjs/lib/crc.js +40 -0
- package/node_modules/pngjs/lib/filter-pack.js +171 -0
- package/node_modules/pngjs/lib/filter-parse-async.js +24 -0
- package/node_modules/pngjs/lib/filter-parse-sync.js +21 -0
- package/node_modules/pngjs/lib/filter-parse.js +177 -0
- package/node_modules/pngjs/lib/format-normaliser.js +93 -0
- package/node_modules/pngjs/lib/interlace.js +95 -0
- package/node_modules/pngjs/lib/packer-async.js +50 -0
- package/node_modules/pngjs/lib/packer-sync.js +56 -0
- package/node_modules/pngjs/lib/packer.js +129 -0
- package/node_modules/pngjs/lib/paeth-predictor.js +16 -0
- package/node_modules/pngjs/lib/parser-async.js +165 -0
- package/node_modules/pngjs/lib/parser-sync.js +108 -0
- package/node_modules/pngjs/lib/parser.js +290 -0
- package/node_modules/pngjs/lib/png-sync.js +12 -0
- package/node_modules/pngjs/lib/png.js +194 -0
- package/node_modules/pngjs/lib/sync-inflate.js +168 -0
- package/node_modules/pngjs/lib/sync-reader.js +45 -0
- package/node_modules/pngjs/package.json +73 -0
- package/node_modules/qrcode/README.md +770 -0
- package/node_modules/qrcode/bin/qrcode +159 -0
- package/node_modules/qrcode/helper/to-sjis-browser.js +2 -0
- package/node_modules/qrcode/helper/to-sjis.js +105 -0
- package/node_modules/qrcode/lib/browser.js +76 -0
- package/node_modules/qrcode/lib/can-promise.js +7 -0
- package/node_modules/qrcode/lib/core/alignment-pattern.js +83 -0
- package/node_modules/qrcode/lib/core/alphanumeric-data.js +59 -0
- package/node_modules/qrcode/lib/core/bit-buffer.js +37 -0
- package/node_modules/qrcode/lib/core/bit-matrix.js +65 -0
- package/node_modules/qrcode/lib/core/byte-data.js +30 -0
- package/node_modules/qrcode/lib/core/error-correction-code.js +135 -0
- package/node_modules/qrcode/lib/core/error-correction-level.js +50 -0
- package/node_modules/qrcode/lib/core/finder-pattern.js +22 -0
- package/node_modules/qrcode/lib/core/format-info.js +29 -0
- package/node_modules/qrcode/lib/core/galois-field.js +69 -0
- package/node_modules/qrcode/lib/core/kanji-data.js +54 -0
- package/node_modules/qrcode/lib/core/mask-pattern.js +234 -0
- package/node_modules/qrcode/lib/core/mode.js +167 -0
- package/node_modules/qrcode/lib/core/numeric-data.js +43 -0
- package/node_modules/qrcode/lib/core/polynomial.js +62 -0
- package/node_modules/qrcode/lib/core/qrcode.js +495 -0
- package/node_modules/qrcode/lib/core/reed-solomon-encoder.js +56 -0
- package/node_modules/qrcode/lib/core/regex.js +31 -0
- package/node_modules/qrcode/lib/core/segments.js +330 -0
- package/node_modules/qrcode/lib/core/utils.js +63 -0
- package/node_modules/qrcode/lib/core/version-check.js +9 -0
- package/node_modules/qrcode/lib/core/version.js +163 -0
- package/node_modules/qrcode/lib/index.js +12 -0
- package/node_modules/qrcode/lib/renderer/canvas.js +63 -0
- package/node_modules/qrcode/lib/renderer/png.js +78 -0
- package/node_modules/qrcode/lib/renderer/svg-tag.js +81 -0
- package/node_modules/qrcode/lib/renderer/svg.js +19 -0
- package/node_modules/qrcode/lib/renderer/terminal/terminal-small.js +85 -0
- package/node_modules/qrcode/lib/renderer/terminal/terminal.js +49 -0
- package/node_modules/qrcode/lib/renderer/terminal.js +9 -0
- package/node_modules/qrcode/lib/renderer/utf8.js +71 -0
- package/node_modules/qrcode/lib/renderer/utils.js +99 -0
- package/node_modules/qrcode/lib/server.js +138 -0
- package/node_modules/qrcode/license +10 -0
- package/node_modules/qrcode/package.json +77 -0
- package/node_modules/require-directory/.jshintrc +67 -0
- package/node_modules/require-directory/.npmignore +1 -0
- package/node_modules/require-directory/.travis.yml +3 -0
- package/node_modules/require-directory/LICENSE +22 -0
- package/node_modules/require-directory/README.markdown +184 -0
- package/node_modules/require-directory/index.js +86 -0
- package/node_modules/require-directory/package.json +40 -0
- package/node_modules/require-main-filename/CHANGELOG.md +26 -0
- package/node_modules/require-main-filename/LICENSE.txt +14 -0
- package/node_modules/require-main-filename/README.md +26 -0
- package/node_modules/require-main-filename/index.js +18 -0
- package/node_modules/require-main-filename/package.json +35 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +680 -0
- package/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +577 -0
- package/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +93 -0
- package/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +17 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/set-blocking/CHANGELOG.md +26 -0
- package/node_modules/set-blocking/LICENSE.txt +14 -0
- package/node_modules/set-blocking/README.md +31 -0
- package/node_modules/set-blocking/index.js +7 -0
- package/node_modules/set-blocking/package.json +42 -0
- package/node_modules/sharp/LICENSE +191 -0
- package/node_modules/sharp/README.md +112 -0
- package/node_modules/sharp/dist/channel.cjs +177 -0
- package/node_modules/sharp/dist/channel.mjs +177 -0
- package/node_modules/sharp/dist/colour.cjs +199 -0
- package/node_modules/sharp/dist/colour.mjs +199 -0
- package/node_modules/sharp/dist/composite.cjs +213 -0
- package/node_modules/sharp/dist/composite.mjs +213 -0
- package/node_modules/sharp/dist/constructor.cjs +511 -0
- package/node_modules/sharp/dist/constructor.mjs +511 -0
- package/node_modules/sharp/dist/index.cjs +25 -0
- package/node_modules/sharp/dist/index.d.cts +1999 -0
- package/node_modules/sharp/dist/index.d.mts +2046 -0
- package/node_modules/sharp/dist/index.mjs +25 -0
- package/node_modules/sharp/dist/input.cjs +819 -0
- package/node_modules/sharp/dist/input.mjs +819 -0
- package/node_modules/sharp/dist/is.cjs +143 -0
- package/node_modules/sharp/dist/is.mjs +143 -0
- package/node_modules/sharp/dist/libvips.cjs +212 -0
- package/node_modules/sharp/dist/libvips.mjs +212 -0
- package/node_modules/sharp/dist/operation.cjs +1002 -0
- package/node_modules/sharp/dist/operation.mjs +1002 -0
- package/node_modules/sharp/dist/output.cjs +1785 -0
- package/node_modules/sharp/dist/output.mjs +1785 -0
- package/node_modules/sharp/dist/resize.cjs +617 -0
- package/node_modules/sharp/dist/resize.mjs +617 -0
- package/node_modules/sharp/dist/sharp.cjs +174 -0
- package/node_modules/sharp/dist/sharp.mjs +174 -0
- package/node_modules/sharp/dist/utility.cjs +301 -0
- package/node_modules/sharp/dist/utility.mjs +301 -0
- package/node_modules/sharp/install/build.js +38 -0
- package/node_modules/sharp/lib/index.d.ts +1999 -0
- package/node_modules/sharp/package.json +227 -0
- package/node_modules/sharp/src/binding.gyp +303 -0
- package/node_modules/sharp/src/common.cc +1186 -0
- package/node_modules/sharp/src/common.h +421 -0
- package/node_modules/sharp/src/metadata.cc +404 -0
- package/node_modules/sharp/src/metadata.h +95 -0
- package/node_modules/sharp/src/operations.cc +516 -0
- package/node_modules/sharp/src/operations.h +137 -0
- package/node_modules/sharp/src/pipeline.cc +1948 -0
- package/node_modules/sharp/src/pipeline.h +422 -0
- package/node_modules/sharp/src/sharp.cc +43 -0
- package/node_modules/sharp/src/stats.cc +186 -0
- package/node_modules/sharp/src/stats.h +62 -0
- package/node_modules/sharp/src/utilities.cc +289 -0
- package/node_modules/sharp/src/utilities.h +22 -0
- package/node_modules/string-width/index.d.ts +29 -0
- package/node_modules/string-width/index.js +47 -0
- package/node_modules/string-width/license +9 -0
- package/node_modules/string-width/package.json +56 -0
- package/node_modules/string-width/readme.md +50 -0
- package/node_modules/strip-ansi/index.d.ts +17 -0
- package/node_modules/strip-ansi/index.js +4 -0
- package/node_modules/strip-ansi/license +9 -0
- package/node_modules/strip-ansi/package.json +54 -0
- package/node_modules/strip-ansi/readme.md +46 -0
- package/node_modules/which-module/LICENSE +13 -0
- package/node_modules/which-module/README.md +58 -0
- package/node_modules/which-module/index.js +9 -0
- package/node_modules/which-module/package.json +41 -0
- package/node_modules/wrap-ansi/index.js +186 -0
- package/node_modules/wrap-ansi/license +9 -0
- package/node_modules/wrap-ansi/package.json +61 -0
- package/node_modules/wrap-ansi/readme.md +97 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +743 -0
- package/node_modules/ws/lib/sender.js +607 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1407 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/node_modules/y18n/CHANGELOG.md +35 -0
- package/node_modules/y18n/LICENSE +13 -0
- package/node_modules/y18n/README.md +109 -0
- package/node_modules/y18n/index.js +188 -0
- package/node_modules/y18n/package.json +39 -0
- package/node_modules/yargs/CHANGELOG.md +420 -0
- package/node_modules/yargs/LICENSE +21 -0
- package/node_modules/yargs/README.md +140 -0
- package/node_modules/yargs/build/lib/apply-extends.d.ts +2 -0
- package/node_modules/yargs/build/lib/apply-extends.js +65 -0
- package/node_modules/yargs/build/lib/argsert.d.ts +2 -0
- package/node_modules/yargs/build/lib/argsert.js +65 -0
- package/node_modules/yargs/build/lib/command.d.ts +64 -0
- package/node_modules/yargs/build/lib/command.js +416 -0
- package/node_modules/yargs/build/lib/common-types.d.ts +36 -0
- package/node_modules/yargs/build/lib/common-types.js +25 -0
- package/node_modules/yargs/build/lib/completion-templates.d.ts +2 -0
- package/node_modules/yargs/build/lib/completion-templates.js +50 -0
- package/node_modules/yargs/build/lib/completion.d.ts +21 -0
- package/node_modules/yargs/build/lib/completion.js +135 -0
- package/node_modules/yargs/build/lib/is-promise.d.ts +1 -0
- package/node_modules/yargs/build/lib/is-promise.js +9 -0
- package/node_modules/yargs/build/lib/levenshtein.d.ts +1 -0
- package/node_modules/yargs/build/lib/levenshtein.js +58 -0
- package/node_modules/yargs/build/lib/middleware.d.ts +10 -0
- package/node_modules/yargs/build/lib/middleware.js +57 -0
- package/node_modules/yargs/build/lib/obj-filter.d.ts +1 -0
- package/node_modules/yargs/build/lib/obj-filter.js +14 -0
- package/node_modules/yargs/build/lib/parse-command.d.ts +11 -0
- package/node_modules/yargs/build/lib/parse-command.js +36 -0
- package/node_modules/yargs/build/lib/process-argv.d.ts +2 -0
- package/node_modules/yargs/build/lib/process-argv.js +31 -0
- package/node_modules/yargs/build/lib/usage.d.ts +49 -0
- package/node_modules/yargs/build/lib/usage.js +540 -0
- package/node_modules/yargs/build/lib/validation.d.ts +34 -0
- package/node_modules/yargs/build/lib/validation.js +330 -0
- package/node_modules/yargs/build/lib/yargs.d.ts +274 -0
- package/node_modules/yargs/build/lib/yargs.js +1190 -0
- package/node_modules/yargs/build/lib/yerror.d.ts +4 -0
- package/node_modules/yargs/build/lib/yerror.js +11 -0
- package/node_modules/yargs/index.js +40 -0
- package/node_modules/yargs/locales/be.json +46 -0
- package/node_modules/yargs/locales/de.json +46 -0
- package/node_modules/yargs/locales/en.json +51 -0
- package/node_modules/yargs/locales/es.json +46 -0
- package/node_modules/yargs/locales/fi.json +49 -0
- package/node_modules/yargs/locales/fr.json +53 -0
- package/node_modules/yargs/locales/hi.json +49 -0
- package/node_modules/yargs/locales/hu.json +46 -0
- package/node_modules/yargs/locales/id.json +50 -0
- package/node_modules/yargs/locales/it.json +46 -0
- package/node_modules/yargs/locales/ja.json +51 -0
- package/node_modules/yargs/locales/ko.json +49 -0
- package/node_modules/yargs/locales/nb.json +44 -0
- package/node_modules/yargs/locales/nl.json +49 -0
- package/node_modules/yargs/locales/nn.json +44 -0
- package/node_modules/yargs/locales/pirate.json +13 -0
- package/node_modules/yargs/locales/pl.json +49 -0
- package/node_modules/yargs/locales/pt.json +45 -0
- package/node_modules/yargs/locales/pt_BR.json +48 -0
- package/node_modules/yargs/locales/ru.json +46 -0
- package/node_modules/yargs/locales/th.json +46 -0
- package/node_modules/yargs/locales/tr.json +48 -0
- package/node_modules/yargs/locales/zh_CN.json +48 -0
- package/node_modules/yargs/locales/zh_TW.json +47 -0
- package/node_modules/yargs/package.json +92 -0
- package/node_modules/yargs/yargs.js +14 -0
- package/node_modules/yargs-parser/CHANGELOG.md +601 -0
- package/node_modules/yargs-parser/LICENSE.txt +14 -0
- package/node_modules/yargs-parser/README.md +449 -0
- package/node_modules/yargs-parser/index.js +1032 -0
- package/node_modules/yargs-parser/lib/tokenize-arg-string.js +40 -0
- package/node_modules/yargs-parser/package.json +46 -0
- package/package.json +50 -0
- package/tools/postinstall.mjs +9 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import crypto from 'node:crypto';
|
|
3
|
+
import { WebSocketServer, WebSocket } from 'ws';
|
|
4
|
+
|
|
5
|
+
// One authenticated connection carries requests and explicitly owned subscriptions.
|
|
6
|
+
// The dispatcher is shared business routing, not an HTTP loopback proxy.
|
|
7
|
+
export function attachLanSocket(server, { token, dispatch, authorizeDevice = () => false }) {
|
|
8
|
+
// Allow four individually valid images to reach the aggregate-size validator,
|
|
9
|
+
// so an oversized composition returns an error instead of dropping the connection.
|
|
10
|
+
const wss = new WebSocketServer({ noServer: true, maxPayload: 48 * 1024 * 1024, perMessageDeflate: false });
|
|
11
|
+
server.on('upgrade', (request, socket, head) => {
|
|
12
|
+
const origin = request.headers.origin;
|
|
13
|
+
let allowed = request.url === '/api/socket';
|
|
14
|
+
// Packaged ArkWeb pages have an opaque ("null") origin; device authentication remains required.
|
|
15
|
+
if (origin && origin !== 'null') {
|
|
16
|
+
try { allowed &&= new URL(origin).host === request.headers.host && ['http:', 'https:'].includes(new URL(origin).protocol); }
|
|
17
|
+
catch { allowed = false; }
|
|
18
|
+
}
|
|
19
|
+
if (!allowed) { socket.end('HTTP/1.1 403 Forbidden\r\nConnection: close\r\n\r\n'); return; }
|
|
20
|
+
wss.handleUpgrade(request, socket, head, ws => wss.emit('connection', ws));
|
|
21
|
+
});
|
|
22
|
+
wss.on('connection', ws => {
|
|
23
|
+
let authenticated = false, alive = true;
|
|
24
|
+
const active = new Map();
|
|
25
|
+
const send = value => {
|
|
26
|
+
if (ws.readyState !== WebSocket.OPEN) return;
|
|
27
|
+
if (ws.bufferedAmount > 64 * 1024 * 1024) { ws.close(1013, 'Client too slow'); return; }
|
|
28
|
+
ws.send(JSON.stringify(value));
|
|
29
|
+
};
|
|
30
|
+
const authTimer = setTimeout(() => ws.close(1008, 'Authentication required'), 5000);
|
|
31
|
+
const heartbeat = setInterval(() => {
|
|
32
|
+
if (!alive) { ws.terminate(); return; }
|
|
33
|
+
alive = false; ws.ping();
|
|
34
|
+
}, 30000);
|
|
35
|
+
ws.on('pong', () => { alive = true; });
|
|
36
|
+
ws.on('error', () => {}); // close rejects requests and releases every subscription.
|
|
37
|
+
ws.on('close', () => {
|
|
38
|
+
clearTimeout(authTimer); clearInterval(heartbeat);
|
|
39
|
+
for (const reply of active.values()) reply.end();
|
|
40
|
+
active.clear();
|
|
41
|
+
});
|
|
42
|
+
ws.on('message', async (bytes, binary) => {
|
|
43
|
+
let message;
|
|
44
|
+
try { if (binary) throw new Error(); message = JSON.parse(bytes.toString()); }
|
|
45
|
+
catch { ws.close(1008, 'Invalid JSON'); return; }
|
|
46
|
+
if (!message || typeof message !== 'object') { ws.close(1008, 'Invalid message'); return; }
|
|
47
|
+
if (!authenticated) {
|
|
48
|
+
let accepted = false;
|
|
49
|
+
if (message.type === 'device-auth') {
|
|
50
|
+
accepted = authorizeDevice(message.clientId, message.credential) === true;
|
|
51
|
+
} else if (message.type === 'auth') {
|
|
52
|
+
const supplied = Buffer.from(typeof message.token === 'string' ? message.token : '');
|
|
53
|
+
const expected = Buffer.from(token || '');
|
|
54
|
+
accepted = supplied.length === expected.length && crypto.timingSafeEqual(supplied, expected);
|
|
55
|
+
}
|
|
56
|
+
if (!accepted) {
|
|
57
|
+
ws.close(1008, 'Authentication failed'); return;
|
|
58
|
+
}
|
|
59
|
+
authenticated = true; clearTimeout(authTimer); send({ type: 'ready', version: 1 }); return;
|
|
60
|
+
}
|
|
61
|
+
const { id, type } = message;
|
|
62
|
+
if (!Number.isSafeInteger(id) || id < 1) { ws.close(1008, 'Invalid request id'); return; }
|
|
63
|
+
if (type === 'unsubscribe') { const reply = active.get(id); if (reply?.subscription) reply.end(); return; }
|
|
64
|
+
if (!['request', 'subscribe'].includes(type) || active.has(id)) { ws.close(1008, 'Invalid request'); return; }
|
|
65
|
+
const subscription = type === 'subscribe';
|
|
66
|
+
const path = message.path;
|
|
67
|
+
const isStream = typeof path === 'string' && /^\/api\/(?:usage-events|shared-recovery\/events|threads\/[^/?]+\/events)(?:\?|$)/.test(path);
|
|
68
|
+
if (active.size >= 32 || (subscription && [...active.values()].filter(r => r.subscription).length >= 4)) {
|
|
69
|
+
send({ type: 'response', id, status: 429, body: { error: '同时进行的请求过多' } }); return;
|
|
70
|
+
}
|
|
71
|
+
if (typeof path !== 'string' || !path.startsWith('/api/') || path.includes('#') ||
|
|
72
|
+
path.startsWith('/api/attachments/') || path === '/api/socket' || path === '/api/uploads' ||
|
|
73
|
+
subscription !== isStream || !['GET', 'POST', 'DELETE'].includes(message.method || 'GET') ||
|
|
74
|
+
(subscription && message.method && message.method !== 'GET') ||
|
|
75
|
+
(message.body !== undefined && (!message.body || typeof message.body !== 'object' || Array.isArray(message.body)))) {
|
|
76
|
+
send({ type: 'response', id, status: 400, body: { error: '无效的连接请求' } }); return;
|
|
77
|
+
}
|
|
78
|
+
const reply = new EventEmitter();
|
|
79
|
+
Object.assign(reply, {
|
|
80
|
+
subscription, headersSent: false, writableEnded: false, destroyed: false,
|
|
81
|
+
json(status, body) {
|
|
82
|
+
if (this.writableEnded) return;
|
|
83
|
+
send({ type: 'response', id, status, body }); this.end();
|
|
84
|
+
},
|
|
85
|
+
startEvents() {
|
|
86
|
+
if (this.writableEnded) return;
|
|
87
|
+
this.headersSent = true; send({ type: 'subscribed', id });
|
|
88
|
+
},
|
|
89
|
+
event(event, data) { if (!this.writableEnded) send({ type: 'event', id, event, data }); },
|
|
90
|
+
end() {
|
|
91
|
+
if (this.writableEnded) return;
|
|
92
|
+
this.writableEnded = this.destroyed = true; active.delete(id);
|
|
93
|
+
if (subscription) send({ type: 'end', id });
|
|
94
|
+
this.emit('close');
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
active.set(id, reply);
|
|
98
|
+
try { await dispatch({ method: message.method || 'GET', url: path, body: message.body || {}, headers: {}, socketRequest: true }, reply); }
|
|
99
|
+
catch (error) { reply.json(500, { error: error.message }); }
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
return { close() { for (const ws of wss.clients) ws.terminate(); wss.close(); } };
|
|
103
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import net from 'node:net';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { EventEmitter } from 'node:events';
|
|
5
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
6
|
+
import { readRecord, writeRecord } from './service-lifecycle.mjs';
|
|
7
|
+
import { SharedAppServer } from './shared-app-server.mjs';
|
|
8
|
+
|
|
9
|
+
export const managedAppServerUrl = 'ws://127.0.0.1:45839';
|
|
10
|
+
export const managedAppServerReadyUrl = 'http://127.0.0.1:45839/readyz';
|
|
11
|
+
const retryDelays = [1_000, 2_000, 5_000, 10_000, 20_000];
|
|
12
|
+
|
|
13
|
+
export function managedPortAvailable() {
|
|
14
|
+
return new Promise(resolve => {
|
|
15
|
+
const server = net.createServer();
|
|
16
|
+
server.once('error', () => resolve(false));
|
|
17
|
+
server.listen(45839, '127.0.0.1', () => server.close(() => resolve(true)));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class ManagedAppServer extends EventEmitter {
|
|
22
|
+
constructor({ stateRoot, host, environment = process.env, available = managedPortAvailable,
|
|
23
|
+
wait = delay, timeout = 30_000, now = Date.now, client = new SharedAppServer(managedAppServerUrl) }) {
|
|
24
|
+
super();
|
|
25
|
+
this.stateRoot = stateRoot;
|
|
26
|
+
this.host = host;
|
|
27
|
+
this.environment = environment;
|
|
28
|
+
this.available = available;
|
|
29
|
+
this.wait = wait;
|
|
30
|
+
this.timeout = timeout;
|
|
31
|
+
this.now = now;
|
|
32
|
+
this.recordPath = path.join(stateRoot, 'managed-app-server.json');
|
|
33
|
+
this.legacyRecordPath = path.join(stateRoot, 'shared-desktop.json');
|
|
34
|
+
this.client = client;
|
|
35
|
+
this.state = { state: 'absent', ready: false, error: null };
|
|
36
|
+
this.restartStatus = null;
|
|
37
|
+
this.stopped = true;
|
|
38
|
+
this.restarting = false;
|
|
39
|
+
this.retryAttempt = 0;
|
|
40
|
+
this.retryAfter = 0;
|
|
41
|
+
this.client.on('disconnected', () => {
|
|
42
|
+
if (!this.stopped && !this.restarting) this.failed('Codex 内核连接断开。');
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
snapshot() { return { ...this.state, ...(this.restartStatus ? { restart: { ...this.restartStatus } } : {}) }; }
|
|
47
|
+
|
|
48
|
+
async start() {
|
|
49
|
+
this.stopped = false;
|
|
50
|
+
return this.ensure();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async ensure() {
|
|
54
|
+
if (this.stopped) return false;
|
|
55
|
+
if (this.restarting) return false;
|
|
56
|
+
if (this.work) return this.work;
|
|
57
|
+
if (this.now() < this.retryAfter) return false;
|
|
58
|
+
this.work = this.ensureNow().finally(() => { this.work = null; });
|
|
59
|
+
return this.work;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async ensureNow() {
|
|
63
|
+
// Keep an already verified instance available while the periodic identity
|
|
64
|
+
// check runs; publishing "starting" every three seconds makes health flicker.
|
|
65
|
+
if (!this.state.ready) this.publish({ state: 'starting', ready: false, error: null });
|
|
66
|
+
try {
|
|
67
|
+
fs.mkdirSync(this.stateRoot, { recursive: true });
|
|
68
|
+
const info = await this.host.inspect();
|
|
69
|
+
if (!info.cli) throw new Error('未找到 Desktop 管理的 codex.exe,请先安装并登录 Codex Desktop。');
|
|
70
|
+
let record = null, actual = null;
|
|
71
|
+
for (const candidate of [readRecord(this.recordPath), readRecord(this.legacyRecordPath)].filter(Boolean)) {
|
|
72
|
+
const process = candidate.pid ? await this.host.process(candidate.pid) : null;
|
|
73
|
+
if (sameManagedProcess(candidate, process)) { record = candidate; actual = process; break; }
|
|
74
|
+
}
|
|
75
|
+
if (!actual) {
|
|
76
|
+
if (!await this.available()) throw new Error('45839 被未识别进程占用,未启动或结束任何进程。');
|
|
77
|
+
const childEnvironment = { ...this.environment };
|
|
78
|
+
for (const key of ['CODEX_APP_SERVER_WS_URL', 'CODEX_APP_SERVER_FORCE_CLI', 'CODEX_APP_TOOLS_PIPE_PATH']) delete childEnvironment[key];
|
|
79
|
+
const pid = await this.host.start(info.cli, ['app-server', '--listen', managedAppServerUrl], childEnvironment,
|
|
80
|
+
[path.join(this.stateRoot, 'managed-app-server.stdout.log'), path.join(this.stateRoot, 'managed-app-server.stderr.log')]);
|
|
81
|
+
const started = await this.host.process(pid);
|
|
82
|
+
if (!sameManagedProcess(started, started)) throw new Error('Codex 内核启动后进程身份无法确认。');
|
|
83
|
+
record = actual = started;
|
|
84
|
+
writeRecord(this.recordPath, record);
|
|
85
|
+
} else if (!readRecord(this.recordPath)) {
|
|
86
|
+
writeRecord(this.recordPath, actual);
|
|
87
|
+
}
|
|
88
|
+
await this.waitUntilReady(actual);
|
|
89
|
+
await this.client.connect();
|
|
90
|
+
if (!this.client.ready) throw new Error('Codex 内核协议初始化未完成。');
|
|
91
|
+
const preferredExecutable = path.resolve(info.cli);
|
|
92
|
+
const updatePending = path.resolve(actual.executable).toLowerCase() !== preferredExecutable.toLowerCase();
|
|
93
|
+
this.retryAttempt = 0;
|
|
94
|
+
this.retryAfter = 0;
|
|
95
|
+
this.publish({ state: 'ready', ready: true, error: null, pid: actual.pid,
|
|
96
|
+
created: actual.created, executable: actual.executable, preferredExecutable,
|
|
97
|
+
updatePending, url: managedAppServerUrl });
|
|
98
|
+
return true;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
this.failed(error instanceof Error ? error.message : String(error));
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async waitUntilReady(expected) {
|
|
106
|
+
const deadline = this.now() + this.timeout;
|
|
107
|
+
while (true) {
|
|
108
|
+
const actual = await this.host.process(expected.pid);
|
|
109
|
+
if (!sameManagedProcess(expected, actual)) throw new Error('Codex 内核在就绪前退出。');
|
|
110
|
+
if (await this.host.ready(managedAppServerReadyUrl)) return;
|
|
111
|
+
if (this.now() >= deadline) throw new Error('Codex 内核未在 30 秒内就绪,请查看工作站诊断日志。');
|
|
112
|
+
await this.wait(250);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
restart(operationId) {
|
|
117
|
+
if (this.stopped) throw new Error('工作站服务正在停止,不能重启 Codex 内核。');
|
|
118
|
+
if (this.restartWork) {
|
|
119
|
+
if (this.restartStatus?.operationId === operationId) return this.snapshot();
|
|
120
|
+
const error = new Error('Codex 内核已经在重启,请等待当前操作完成。');
|
|
121
|
+
error.code = 'managed_app_server_restarting';
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
this.restartStatus = { operationId, status: 'running', stage: 'checking', error: null,
|
|
125
|
+
startedAt: new Date(this.now()).toISOString() };
|
|
126
|
+
this.emit('state', this.snapshot());
|
|
127
|
+
this.restartWork = this.restartNow().finally(() => { this.restartWork = null; });
|
|
128
|
+
return this.snapshot();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async restartNow() {
|
|
132
|
+
this.restarting = true;
|
|
133
|
+
const previous = this.state;
|
|
134
|
+
this.publish({ ...previous, state: 'restarting', ready: false, error: null });
|
|
135
|
+
try {
|
|
136
|
+
const record = readRecord(this.recordPath) || readRecord(this.legacyRecordPath);
|
|
137
|
+
const actual = record?.pid ? await this.host.process(record.pid) : null;
|
|
138
|
+
if (actual && !sameManagedProcess(record, actual)) {
|
|
139
|
+
throw new Error('Codex 内核进程身份已经变化,未结束任何进程。');
|
|
140
|
+
}
|
|
141
|
+
this.restartStage('stopping');
|
|
142
|
+
this.client.close();
|
|
143
|
+
if (actual) {
|
|
144
|
+
await this.host.stop(actual.pid);
|
|
145
|
+
await this.waitUntilStopped(actual);
|
|
146
|
+
} else if (!await this.available()) {
|
|
147
|
+
throw new Error('45839 被未识别进程占用,未结束任何进程。');
|
|
148
|
+
}
|
|
149
|
+
fs.rmSync(this.recordPath, { force: true });
|
|
150
|
+
this.retryAttempt = 0;
|
|
151
|
+
this.retryAfter = 0;
|
|
152
|
+
this.restartStage('starting');
|
|
153
|
+
const ready = await this.ensureNow();
|
|
154
|
+
if (!ready) throw new Error(this.state.error || 'Codex 内核未能重新启动。');
|
|
155
|
+
this.restartStatus = { ...this.restartStatus, status: 'completed', stage: 'ready',
|
|
156
|
+
completedAt: new Date(this.now()).toISOString() };
|
|
157
|
+
this.emit('state', this.snapshot());
|
|
158
|
+
} catch (error) {
|
|
159
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
160
|
+
if (this.state.state === 'restarting') this.failed(message);
|
|
161
|
+
this.restartStatus = { ...this.restartStatus, status: 'failed', stage: 'failed', error: message,
|
|
162
|
+
completedAt: new Date(this.now()).toISOString() };
|
|
163
|
+
this.emit('state', this.snapshot());
|
|
164
|
+
} finally {
|
|
165
|
+
this.restarting = false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
restartStage(stage) {
|
|
170
|
+
this.restartStatus = { ...this.restartStatus, stage };
|
|
171
|
+
this.emit('state', this.snapshot());
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async waitUntilStopped(expected) {
|
|
175
|
+
const deadline = this.now() + 10_000;
|
|
176
|
+
while (true) {
|
|
177
|
+
const actual = await this.host.process(expected.pid);
|
|
178
|
+
if (!sameManagedProcess(expected, actual) && await this.available()) return;
|
|
179
|
+
if (this.now() >= deadline) throw new Error('Codex 内核未在 10 秒内退出;不会启动第二个实例。');
|
|
180
|
+
await this.wait(100);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
failed(message) {
|
|
185
|
+
const retryMs = retryDelays[Math.min(this.retryAttempt++, retryDelays.length - 1)];
|
|
186
|
+
this.retryAfter = this.now() + retryMs;
|
|
187
|
+
this.publish({ state: 'failed', ready: false, error: message, retryAt: new Date(this.retryAfter).toISOString() });
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
publish(value) {
|
|
191
|
+
const changed = JSON.stringify(value) !== JSON.stringify(this.state);
|
|
192
|
+
this.state = value;
|
|
193
|
+
if (changed) this.emit('state', this.snapshot());
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
close() {
|
|
197
|
+
this.stopped = true;
|
|
198
|
+
this.client.close();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function sameManagedProcess(record, actual) {
|
|
203
|
+
if (!record || !actual || record.pid !== actual.pid || record.created !== actual.created) return false;
|
|
204
|
+
if (String(record.executable || '').toLowerCase() !== String(actual.executable || '').toLowerCase()) return false;
|
|
205
|
+
const command = String(actual.command || '').toLowerCase();
|
|
206
|
+
return command.includes('app-server') && command.includes(managedAppServerUrl);
|
|
207
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import crypto from 'node:crypto';
|
|
4
|
+
import sharp from 'sharp';
|
|
5
|
+
|
|
6
|
+
export function validateInlineImage(value) {
|
|
7
|
+
const data = typeof value === 'string' ? value.slice(value.indexOf(',') + 1) : '';
|
|
8
|
+
if (typeof value !== 'string' || value.length > Math.ceil(8 * 1024 * 1024 / 3) * 4 + 64 ||
|
|
9
|
+
!/^data:image\/(?:jpeg|png|webp);base64,/.test(value) || !data || data.length % 4 !== 0 ||
|
|
10
|
+
!/^[A-Za-z0-9+/]*={0,2}$/.test(data) || Buffer.byteLength(data, 'base64') > 8 * 1024 * 1024) {
|
|
11
|
+
throw new Error('图片必须是 JPEG、PNG 或 WebP 数据,且不超过 8 MiB。');
|
|
12
|
+
}
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Only the Desktop tool compatibility path needs a file visible to the host.
|
|
17
|
+
export async function persistLegacyImage(value, directory) {
|
|
18
|
+
validateInlineImage(value);
|
|
19
|
+
const input = Buffer.from(value.slice(value.indexOf(',') + 1), 'base64');
|
|
20
|
+
const buffer = await sharp(input, { limitInputPixels: 40_000_000 }).rotate()
|
|
21
|
+
.resize({ width: 2560, height: 2560, fit: 'inside', withoutEnlargement: true }).webp({ quality: 88 }).toBuffer();
|
|
22
|
+
const id = crypto.createHash('sha256').update(buffer).digest('hex');
|
|
23
|
+
await fs.mkdir(directory, { recursive: true });
|
|
24
|
+
const file = path.join(directory, `${id}.webp`);
|
|
25
|
+
await fs.writeFile(file, buffer);
|
|
26
|
+
return file;
|
|
27
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const connectionModesText = [
|
|
2
|
+
'可选连接模式:',
|
|
3
|
+
'• 局域网:启动时会把当前 Wi-Fi/有线网络候选临时发给已配对设备;App 验证后保存,也可手动输入 IP。',
|
|
4
|
+
'• 私有中继:同一设备授权可跨网络长期重连;基础控制/完整控制能力由电脑当前 Bridge 状态决定。',
|
|
5
|
+
'• OpenAI 官方中继:在已配对电脑内使用官方账号和设备授权;认证仍直连 OpenAI。',
|
|
6
|
+
].join('\n');
|
|
7
|
+
|
|
8
|
+
export function phonePairingSteps(transportMode, paired = false) {
|
|
9
|
+
const mode = transportMode === 'lan-shared' ? '局域网 · 完整控制' : transportMode === 'lan-legacy' ? '局域网 · 基础控制' : '局域网(按电脑实际控制方式选择)';
|
|
10
|
+
return paired ? [
|
|
11
|
+
`已有移动设备授权。手机可继续使用私有中继;${mode} 会显示验证成功的当前网络和历史记录。`,
|
|
12
|
+
'添加另一台设备时执行 relax pair;每台设备只需扫码配对一次。',
|
|
13
|
+
] : [
|
|
14
|
+
'手机先安装 Code Relax。当前为鸿蒙 HarmonyOS 7 私测版,调试 HAP 需通过 DevEco/调试设备安装,尚无商店下载入口。',
|
|
15
|
+
'使用 App 扫描配对二维码;每台移动设备只需配对一次。',
|
|
16
|
+
`配对后可直接使用私有中继;${mode} 会接收并验证当前网络候选,也可手动输入 IP。`,
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
export const desktopSetupSteps = [
|
|
20
|
+
'Code Relax Skill 已随 npm 包自动安装。',
|
|
21
|
+
'安装完成后 Bridge 和受管 app-server 已启动,并默认在当前用户登录时启动。',
|
|
22
|
+
'如果安装时 Codex 仍在运行,手机完整控制仍可使用;可选择立即或稍后重启,让 Desktop 也接入同一受管服务。',
|
|
23
|
+
'基础控制首次聊天需要在 Codex 对话启动一次 Code Relax 绑定上下文;完整控制不需要。',
|
|
24
|
+
'尚无设备授权时执行 relax pair,打开并扫描配对二维码。',
|
|
25
|
+
'若工作站提示 Desktop 尚未接入受管服务,可在手机确认重新打开 Desktop,无需电脑脚本或快捷方式。',
|
|
26
|
+
'统一配对先建立电脑记录;进入该电脑后可另行完成 OpenAI 官方 Remote 配对。',
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export function pairingDisplayText(nextSteps, notice) {
|
|
30
|
+
return ['Bridge 已就绪,请在手机上完成连接。', connectionModesText, ...nextSteps.map((step, index) => `${index + 1}. ${step}`), notice].join('\n\n');
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# 被控主机平台适配
|
|
2
|
+
|
|
3
|
+
当前只实现 Windows Codex:
|
|
4
|
+
|
|
5
|
+
- `windows/runtime-paths.mjs`:固定服务、用户状态、Codex 数据、附件和长期凭据路径。
|
|
6
|
+
- `windows/service-host.mjs`、`desktop-tools.mjs`:网卡、Desktop 工具管道、共享连接检测和旧状态迁移。
|
|
7
|
+
- `windows/desktop-host.mjs`、PowerShell 脚本:普通/共享 Desktop、快捷方式和隐藏控制台启动。
|
|
8
|
+
- `windows/credential-store.mjs/.ps1`:私有中继电脑凭据的 DPAPI 与 ACL。
|
|
9
|
+
|
|
10
|
+
Windows 专有脚本兼容系统自带 PowerShell 5.1。通用生命周期使用 Node 接口;系统检测和凭据保护不扩散到业务代码。
|
|
11
|
+
|
|
12
|
+
macOS、Linux 目录仅保留规划说明,尚无路径、IPC、进程或安装实现。接入排在控制端扩展之后,并需分别验证 Codex Desktop/app-server 的可用连接方式;只有独立 app-server 时不能宣称接管 Desktop 当前任务。
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.ComponentModel;
|
|
3
|
+
using System.Runtime.InteropServices;
|
|
4
|
+
using System.Text;
|
|
5
|
+
|
|
6
|
+
// Only the three explicitly opened standard handles cross the process boundary.
|
|
7
|
+
// In particular, inherited app-server sockets must not reach background workers.
|
|
8
|
+
public static class IsolatedProcess {
|
|
9
|
+
[StructLayout(LayoutKind.Sequential)] struct Security { public int length; public IntPtr descriptor; public int inherit; }
|
|
10
|
+
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] struct Startup {
|
|
11
|
+
public int cb; public string reserved, desktop, title;
|
|
12
|
+
public int x,y,xSize,ySize,xCount,yCount,fill,flags; public short show,reservedSize;
|
|
13
|
+
public IntPtr reservedBytes,input,output,error;
|
|
14
|
+
}
|
|
15
|
+
[StructLayout(LayoutKind.Sequential)] struct StartupEx { public Startup startup; public IntPtr attributes; }
|
|
16
|
+
[StructLayout(LayoutKind.Sequential)] struct ProcessInfo { public IntPtr process,thread; public int pid,tid; }
|
|
17
|
+
[DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] static extern IntPtr CreateFileW(string name,uint access,uint share,ref Security security,uint disposition,uint flags,IntPtr template);
|
|
18
|
+
[DllImport("kernel32.dll", SetLastError=true)] static extern bool InitializeProcThreadAttributeList(IntPtr list,int count,int flags,ref IntPtr size);
|
|
19
|
+
[DllImport("kernel32.dll", SetLastError=true)] static extern bool UpdateProcThreadAttribute(IntPtr list,uint flags,IntPtr attribute,IntPtr value,IntPtr size,IntPtr previous,IntPtr returned);
|
|
20
|
+
[DllImport("kernel32.dll")] static extern void DeleteProcThreadAttributeList(IntPtr list);
|
|
21
|
+
[DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)] static extern bool CreateProcessW(string application,StringBuilder command,IntPtr processSecurity,IntPtr threadSecurity,bool inherit,uint flags,IntPtr environment,string cwd,ref StartupEx startup,out ProcessInfo info);
|
|
22
|
+
[DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr handle);
|
|
23
|
+
[DllImport("kernel32.dll",CharSet=CharSet.Unicode,SetLastError=true)] static extern uint GetFinalPathNameByHandleW(IntPtr handle,StringBuilder path,uint length,uint flags);
|
|
24
|
+
public static string ResolvePath(string path) {
|
|
25
|
+
var security=new Security {length=Marshal.SizeOf(typeof(Security))};
|
|
26
|
+
var handle=CreateFileW(path,0,7,ref security,3,0x02000000,IntPtr.Zero);
|
|
27
|
+
if(handle==new IntPtr(-1)) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
28
|
+
try {
|
|
29
|
+
var result=new StringBuilder(32768);
|
|
30
|
+
uint length=GetFinalPathNameByHandleW(handle,result,(uint)result.Capacity,0);
|
|
31
|
+
if(length==0 || length>=result.Capacity) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
32
|
+
var value=result.ToString();
|
|
33
|
+
return value.StartsWith(@"\\?\UNC\") ? @"\\"+value.Substring(8) : value.StartsWith(@"\\?\") ? value.Substring(4) : value;
|
|
34
|
+
} finally { CloseHandle(handle); }
|
|
35
|
+
}
|
|
36
|
+
static string Quote(string value) {
|
|
37
|
+
var result=new StringBuilder("\""); int slashes=0;
|
|
38
|
+
foreach(char c in value) {
|
|
39
|
+
if(c=='\\') { slashes++; continue; }
|
|
40
|
+
result.Append('\\', c=='"' ? slashes*2+1 : slashes); slashes=0; result.Append(c);
|
|
41
|
+
}
|
|
42
|
+
result.Append('\\',slashes*2); return result.Append('"').ToString();
|
|
43
|
+
}
|
|
44
|
+
static IntPtr File(string file,bool input) {
|
|
45
|
+
var sa=new Security { length=Marshal.SizeOf(typeof(Security)), inherit=1 };
|
|
46
|
+
// FILE_APPEND_DATA avoids truncating diagnostic history on recovery.
|
|
47
|
+
var handle=CreateFileW(file,input?0x80000000u:4u,7,ref sa,input?3u:4u,0x80,IntPtr.Zero);
|
|
48
|
+
if(handle==new IntPtr(-1)) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
49
|
+
return handle;
|
|
50
|
+
}
|
|
51
|
+
public static int Start(string executable,string[] arguments,string stdout,string stderr) {
|
|
52
|
+
IntPtr input=IntPtr.Zero,output=IntPtr.Zero,error=IntPtr.Zero,list=IntPtr.Zero,handles=IntPtr.Zero;
|
|
53
|
+
bool initialized=false;
|
|
54
|
+
try {
|
|
55
|
+
input=File("NUL",true); output=File(String.IsNullOrEmpty(stdout)?"NUL":stdout,false); error=File(String.IsNullOrEmpty(stderr)?"NUL":stderr,false);
|
|
56
|
+
IntPtr size=IntPtr.Zero; InitializeProcThreadAttributeList(IntPtr.Zero,1,0,ref size);
|
|
57
|
+
list=Marshal.AllocHGlobal(size);
|
|
58
|
+
if(!InitializeProcThreadAttributeList(list,1,0,ref size)) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
59
|
+
initialized=true; handles=Marshal.AllocHGlobal(IntPtr.Size*3);
|
|
60
|
+
Marshal.Copy(new IntPtr[]{input,output,error},0,handles,3);
|
|
61
|
+
if(!UpdateProcThreadAttribute(list,0,new IntPtr(0x20002),handles,new IntPtr(IntPtr.Size*3),IntPtr.Zero,IntPtr.Zero)) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
62
|
+
var startup=new StartupEx(); startup.startup.cb=Marshal.SizeOf(typeof(StartupEx));
|
|
63
|
+
startup.startup.flags=0x101; startup.startup.show=0;
|
|
64
|
+
startup.startup.input=input; startup.startup.output=output; startup.startup.error=error; startup.attributes=list;
|
|
65
|
+
var command=new StringBuilder(Quote(executable)); foreach(var argument in arguments) command.Append(' ').Append(Quote(argument));
|
|
66
|
+
ProcessInfo info;
|
|
67
|
+
if(!CreateProcessW(executable,command,IntPtr.Zero,IntPtr.Zero,true,0x80010,IntPtr.Zero,null,ref startup,out info)) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
68
|
+
CloseHandle(info.thread); CloseHandle(info.process); return info.pid;
|
|
69
|
+
} finally {
|
|
70
|
+
if(initialized) DeleteProcThreadAttributeList(list);
|
|
71
|
+
if(list!=IntPtr.Zero) Marshal.FreeHGlobal(list); if(handles!=IntPtr.Zero) Marshal.FreeHGlobal(handles);
|
|
72
|
+
if(input!=IntPtr.Zero) CloseHandle(input); if(output!=IntPtr.Zero) CloseHandle(output); if(error!=IntPtr.Zero) CloseHandle(error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
export function startWindowsProcess(executable, args, environment, logs = []) {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
const powershell = path.join(process.env.SystemRoot || 'C:\\Windows', 'System32/WindowsPowerShell/v1.0/powershell.exe');
|
|
8
|
+
const helper = spawn(powershell, ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-File',
|
|
9
|
+
fileURLToPath(new URL('./start-hidden-console.ps1', import.meta.url))], {
|
|
10
|
+
windowsHide: true, env: environment, stdio: ['pipe', 'pipe', 'pipe'],
|
|
11
|
+
});
|
|
12
|
+
let output = '', error = '';
|
|
13
|
+
helper.stdout.setEncoding('utf8').on('data', chunk => { output += chunk; });
|
|
14
|
+
helper.stderr.setEncoding('utf8').on('data', chunk => { error += chunk; });
|
|
15
|
+
helper.once('error', reject); helper.stdin.on('error', reject);
|
|
16
|
+
helper.once('exit', code => {
|
|
17
|
+
helper.stdout.destroy(); helper.stderr.destroy(); helper.stdin.destroy();
|
|
18
|
+
if (code !== 0) return reject(new Error(error.trim() || `后台启动失败 (${code})`));
|
|
19
|
+
const pid = Number(output.trim());
|
|
20
|
+
if (!Number.isSafeInteger(pid) || pid <= 0) return reject(new Error('后台启动未返回有效 PID'));
|
|
21
|
+
resolve(pid);
|
|
22
|
+
});
|
|
23
|
+
helper.stdin.end(JSON.stringify({ executable, args, logs }));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { runtimePaths } from './runtime-paths.mjs';
|
|
5
|
+
|
|
6
|
+
// Secrets travel over stdin/stdout only; never PowerShell arguments or errors.
|
|
7
|
+
export function credentialStore(action, record, root = runtimePaths().credentialsRoot) {
|
|
8
|
+
if (process.platform !== 'win32') throw new Error('Credential platform adapter unavailable');
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const child = spawn(path.join(process.env.SystemRoot, 'System32/WindowsPowerShell/v1.0/powershell.exe'),
|
|
11
|
+
['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-File',
|
|
12
|
+
fileURLToPath(new URL('./credential-store.ps1', import.meta.url))],
|
|
13
|
+
{ windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] });
|
|
14
|
+
let output = '', diagnostic = '';
|
|
15
|
+
const timer = setTimeout(() => child.kill(), 15000);
|
|
16
|
+
child.stdout.setEncoding('utf8'); child.stdout.on('data', data => { output += data; });
|
|
17
|
+
child.stderr.setEncoding('utf8'); child.stderr.on('data', data => { diagnostic += data; }); child.stdin.on('error', () => {});
|
|
18
|
+
child.once('error', () => { clearTimeout(timer); reject(new Error('无法启动 Windows 凭据保护组件')); });
|
|
19
|
+
child.once('close', code => {
|
|
20
|
+
clearTimeout(timer);
|
|
21
|
+
if (code !== 0) return reject(new Error('Windows 凭据保护失败,未使用明文替代;请检查目录权限或 Windows 用户是否一致;' + diagnostic.trim()));
|
|
22
|
+
try { resolve(JSON.parse(output.replace(/^\uFEFF/, ''))); }
|
|
23
|
+
catch { reject(new Error('Windows 凭据保护返回无效结果')); }
|
|
24
|
+
});
|
|
25
|
+
child.stdin.end(JSON.stringify({ action, root, record }));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
$ErrorActionPreference = 'Stop'
|
|
2
|
+
[Console]::InputEncoding = New-Object System.Text.UTF8Encoding($false)
|
|
3
|
+
[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false)
|
|
4
|
+
try {
|
|
5
|
+
Add-Type -AssemblyName System.Security
|
|
6
|
+
$request = [Console]::In.ReadToEnd() | ConvertFrom-Json
|
|
7
|
+
$sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User
|
|
8
|
+
$directory = Join-Path ([System.IO.Path]::GetFullPath($request.root)) $sid.Value
|
|
9
|
+
if (!(Test-Path -LiteralPath $directory)) { New-Item -ItemType Directory -Path $directory -Force | Out-Null }
|
|
10
|
+
if ((Get-Item -LiteralPath $directory).Attributes -band [System.IO.FileAttributes]::ReparsePoint) { throw 'Invalid credential directory' }
|
|
11
|
+
$acl = New-Object System.Security.AccessControl.DirectorySecurity
|
|
12
|
+
$acl.SetAccessRuleProtection($true, $false)
|
|
13
|
+
foreach ($principal in @($sid.Value, 'S-1-5-18', 'S-1-5-32-544')) {
|
|
14
|
+
$identity = New-Object System.Security.Principal.SecurityIdentifier($principal)
|
|
15
|
+
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule($identity, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
|
|
16
|
+
$acl.AddAccessRule($rule)
|
|
17
|
+
}
|
|
18
|
+
[System.IO.Directory]::SetAccessControl($directory, $acl)
|
|
19
|
+
$file = Join-Path $directory 'self-relay.json'
|
|
20
|
+
if (Test-Path -LiteralPath $file) {
|
|
21
|
+
if ((Get-Item -LiteralPath $file).Attributes -band [System.IO.FileAttributes]::ReparsePoint) { throw 'Invalid credential file' }
|
|
22
|
+
}
|
|
23
|
+
if ($request.action -eq 'save') {
|
|
24
|
+
$plain = [System.Text.Encoding]::UTF8.GetBytes(($request.record | ConvertTo-Json -Depth 12 -Compress))
|
|
25
|
+
$encrypted = [System.Security.Cryptography.ProtectedData]::Protect($plain, $null, [System.Security.Cryptography.DataProtectionScope]::CurrentUser)
|
|
26
|
+
$json = @{ version = 1; protection = 'DPAPI-CurrentUser'; data = [Convert]::ToBase64String($encrypted) } | ConvertTo-Json -Compress
|
|
27
|
+
$temporary = Join-Path $directory ([Guid]::NewGuid().ToString() + '.tmp')
|
|
28
|
+
$backup = $temporary + '.bak'
|
|
29
|
+
try {
|
|
30
|
+
$stream = [System.IO.File]::Open($temporary, [System.IO.FileMode]::CreateNew, [System.IO.FileAccess]::Write)
|
|
31
|
+
try { $bytes = [System.Text.Encoding]::UTF8.GetBytes($json); $stream.Write($bytes, 0, $bytes.Length); $stream.Flush($true) } finally { $stream.Dispose() }
|
|
32
|
+
if (Test-Path -LiteralPath $file) { [System.IO.File]::Replace($temporary, $file, $backup) } else { [System.IO.File]::Move($temporary, $file) }
|
|
33
|
+
} finally {
|
|
34
|
+
if (Test-Path -LiteralPath $temporary) { Remove-Item -LiteralPath $temporary -Force }
|
|
35
|
+
if (Test-Path -LiteralPath $backup) { Remove-Item -LiteralPath $backup -Force }
|
|
36
|
+
}
|
|
37
|
+
} elseif ($request.action -ne 'load') { throw 'Invalid operation' }
|
|
38
|
+
$record = $null
|
|
39
|
+
if (Test-Path -LiteralPath $file) {
|
|
40
|
+
$envelope = [System.IO.File]::ReadAllText($file, [System.Text.Encoding]::UTF8) | ConvertFrom-Json
|
|
41
|
+
if ($envelope.version -ne 1 -or $envelope.protection -ne 'DPAPI-CurrentUser') { throw 'Invalid credential envelope' }
|
|
42
|
+
$plain = [System.Security.Cryptography.ProtectedData]::Unprotect([Convert]::FromBase64String($envelope.data), $null, [System.Security.Cryptography.DataProtectionScope]::CurrentUser)
|
|
43
|
+
$record = [System.Text.Encoding]::UTF8.GetString($plain) | ConvertFrom-Json
|
|
44
|
+
}
|
|
45
|
+
[Console]::Write((@{ path = $file; record = $record } | ConvertTo-Json -Depth 12 -Compress))
|
|
46
|
+
} catch {
|
|
47
|
+
[Console]::Error.WriteLine('Credential protection failed: ' + $_.Exception.GetType().Name + ' at line ' + $_.InvocationInfo.ScriptLineNumber)
|
|
48
|
+
exit 1
|
|
49
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { startWindowsProcess } from './background-process.mjs';
|
|
2
|
+
import { execFile } from 'node:child_process';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { sharedServiceUrl } from './service-host.mjs';
|
|
7
|
+
const exec = promisify(execFile);
|
|
8
|
+
const directory = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
export const powershell = path.join(process.env.SystemRoot || 'C:\\Windows', 'System32/WindowsPowerShell/v1.0/powershell.exe');
|
|
10
|
+
export async function runScript(name, args = []) {
|
|
11
|
+
const { stdout } = await exec(powershell, ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-File', path.join(directory, name), ...args], { windowsHide: true, encoding: 'utf8', timeout: 30000 });
|
|
12
|
+
return stdout.trim();
|
|
13
|
+
}
|
|
14
|
+
export const desktopHost = {
|
|
15
|
+
inspect: async () => JSON.parse(await runScript('desktop-info.ps1')),
|
|
16
|
+
process: async pid => JSON.parse(await runScript('desktop-info.ps1', ['-ProcessId', String(pid)])),
|
|
17
|
+
sharedServiceUrl,
|
|
18
|
+
start: startWindowsProcess,
|
|
19
|
+
closeDesktop: executable => runScript('stop-desktop.ps1', ['-Executable', executable]),
|
|
20
|
+
stop: pid => process.kill(pid),
|
|
21
|
+
ready: async url => { try { return (await fetch(url, { signal: AbortSignal.timeout(1000) })).ok; } catch { return false; } },
|
|
22
|
+
};
|
|
23
|
+
export const resolveStateRoot = stateRoot => runScript('resolve-state-root.ps1', ['-StateRoot', stateRoot]);
|
|
24
|
+
|
|
25
|
+
export async function desktopShortcuts({ serviceRoot, nodeExecutable }, remove = false, destination) {
|
|
26
|
+
const entry = path.join(serviceRoot, 'dist/bin/codex-remote.mjs');
|
|
27
|
+
const args = ['-NodePath', nodeExecutable, '-Entry', entry];
|
|
28
|
+
if (remove) args.push('-Remove');
|
|
29
|
+
if (destination) args.push('-Destination', destination);
|
|
30
|
+
return JSON.parse(await runScript('desktop-shortcuts.ps1', args));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function residentStartup({ serviceRoot, nodeExecutable }, action = 'status') {
|
|
34
|
+
const { stdout } = await exec(powershell, ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-File',
|
|
35
|
+
path.join(serviceRoot, 'dist/src/platform/windows/resident-startup.ps1'), '-NodePath', nodeExecutable,
|
|
36
|
+
'-Entry', path.join(serviceRoot, 'dist/bin/codex-remote.mjs'), '-Action', action], { windowsHide: true, encoding: 'utf8' });
|
|
37
|
+
return JSON.parse(stdout.trim());
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
param([int]$ProcessId = 0)
|
|
2
|
+
$ErrorActionPreference = 'Stop'
|
|
3
|
+
[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false)
|
|
4
|
+
if ($ProcessId -gt 0) {
|
|
5
|
+
$item = Get-CimInstance Win32_Process -Filter "ProcessId=$ProcessId"
|
|
6
|
+
if ($item) { @{ pid=$item.ProcessId; executable=$item.ExecutablePath; command=$item.CommandLine; created=$item.CreationDate.ToUniversalTime().ToString('o') } | ConvertTo-Json -Compress }
|
|
7
|
+
else { 'null' }
|
|
8
|
+
exit
|
|
9
|
+
}
|
|
10
|
+
$package = Get-AppxPackage OpenAI.Codex | Select-Object -First 1
|
|
11
|
+
if (-not $package) { throw '未找到 Codex Desktop,请先安装并登录。' }
|
|
12
|
+
$desktop = Join-Path $package.InstallLocation 'app/ChatGPT.exe'
|
|
13
|
+
$running = @(Get-Process ChatGPT -ErrorAction SilentlyContinue | Where-Object { $_.Path -eq $desktop })
|
|
14
|
+
$binaryRoot = Join-Path $env:LOCALAPPDATA 'OpenAI/Codex/bin'
|
|
15
|
+
$cli = Get-ChildItem -LiteralPath $binaryRoot -Filter codex.exe -Recurse -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
|
16
|
+
@{ desktop=$desktop; cli=$cli.FullName; running=($running.Count -gt 0) } | ConvertTo-Json -Compress
|