@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,356 @@
|
|
|
1
|
+
import WebSocket from 'ws';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
4
|
+
import events from '../shared/app-server-events.cjs';
|
|
5
|
+
import serverRequests from '../shared/server-requests.cjs';
|
|
6
|
+
|
|
7
|
+
const syncTokenTtlMs = 30_000;
|
|
8
|
+
const syncBufferMaxBytes = 8 * 1024 * 1024;
|
|
9
|
+
const writerConflictMessages = ['already has an active writer', 'already has a live local writer'];
|
|
10
|
+
|
|
11
|
+
export class ThreadWriterConflictError extends Error {
|
|
12
|
+
constructor(threadId, message) {
|
|
13
|
+
super('该对话正在另一个 Codex 实例中使用。');
|
|
14
|
+
this.name = 'ThreadWriterConflictError';
|
|
15
|
+
this.code = 'thread_writer_owned_elsewhere';
|
|
16
|
+
this.threadId = threadId;
|
|
17
|
+
this.readOnly = true;
|
|
18
|
+
this.details = message;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function isThreadWriterConflict(error) {
|
|
23
|
+
const message = String(error?.message || error).toLowerCase();
|
|
24
|
+
return error instanceof ThreadWriterConflictError || writerConflictMessages.some(text => message.includes(text));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Connect to the Desktop's existing execution service; never spawn or adopt a task.
|
|
28
|
+
export class SharedAppServer extends EventEmitter {
|
|
29
|
+
constructor(url) {
|
|
30
|
+
super();
|
|
31
|
+
const address = new URL(url);
|
|
32
|
+
if (address.protocol !== 'ws:' || address.hostname !== '127.0.0.1') throw new Error('完整控制必须使用本机回环 WebSocket。');
|
|
33
|
+
this.url = url;
|
|
34
|
+
this.epoch = randomUUID();
|
|
35
|
+
this.sequence = 0;
|
|
36
|
+
this.pending = new Map();
|
|
37
|
+
this.serverRequests = new serverRequests.Store(randomUUID(), id => this.emit('requests-changed', id));
|
|
38
|
+
this.threads = new Map();
|
|
39
|
+
this.contexts = new Map();
|
|
40
|
+
this.settingsNotifications = new Map();
|
|
41
|
+
this.permissionOptions = new events.PermissionOptionsCache();
|
|
42
|
+
this.subscriptions = new Map();
|
|
43
|
+
this.usageCache = new events.UsageCache(value => this.emit('usage', value));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async connect() {
|
|
47
|
+
if (this.socket?.readyState === WebSocket.OPEN && this.ready) return;
|
|
48
|
+
if (this.connecting) return this.connecting;
|
|
49
|
+
this.connecting = this.open().finally(() => { this.connecting = null; });
|
|
50
|
+
return this.connecting;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async open() {
|
|
54
|
+
const socket = new WebSocket(this.url, { handshakeTimeout: 5000 });
|
|
55
|
+
this.socket = socket;
|
|
56
|
+
this.ready = false;
|
|
57
|
+
this.serverRequests.reset(randomUUID());
|
|
58
|
+
socket.on('message', bytes => {
|
|
59
|
+
let message;
|
|
60
|
+
try { message = JSON.parse(bytes.toString()); } catch { socket.close(); return; }
|
|
61
|
+
if (message.method && message.id !== undefined) { this.serverRequests.receive(message); return; }
|
|
62
|
+
if (message.method) { this.notification(message.method, message.params || {}); return; }
|
|
63
|
+
const pending = this.pending.get(message.id);
|
|
64
|
+
if (!pending) return;
|
|
65
|
+
this.pending.delete(message.id);
|
|
66
|
+
clearTimeout(pending.timer);
|
|
67
|
+
if (message.error) {
|
|
68
|
+
const text = String(message.error.message || 'app-server 请求失败');
|
|
69
|
+
pending.reject(writerConflictMessages.some(value => text.toLowerCase().includes(value))
|
|
70
|
+
? new ThreadWriterConflictError(pending.threadId, text)
|
|
71
|
+
: Object.assign(new Error(text), { rpcCode: message.error.code, details: message.error.data }));
|
|
72
|
+
}
|
|
73
|
+
else pending.resolve(message.result);
|
|
74
|
+
});
|
|
75
|
+
socket.on('close', () => {
|
|
76
|
+
this.ready = false;
|
|
77
|
+
for (const pending of this.pending.values()) {
|
|
78
|
+
clearTimeout(pending.timer);
|
|
79
|
+
pending.reject(new Error('完整控制连接断开;发送结果可能未确认,请检查对话后再操作。'));
|
|
80
|
+
}
|
|
81
|
+
this.pending.clear();
|
|
82
|
+
this.serverRequests.reset(randomUUID());
|
|
83
|
+
this.threads.clear();
|
|
84
|
+
for (const slot of this.subscriptions.values()) clearTimeout(slot.expiry);
|
|
85
|
+
this.subscriptions.clear();
|
|
86
|
+
this.contexts.clear();
|
|
87
|
+
this.settingsNotifications.clear();
|
|
88
|
+
this.permissionOptions.clear();
|
|
89
|
+
this.usageCache.reset();
|
|
90
|
+
this.emit('disconnected');
|
|
91
|
+
});
|
|
92
|
+
socket.on('error', () => {}); // open/request reports the connection error to the caller.
|
|
93
|
+
await new Promise((resolve, reject) => { socket.once('open', resolve); socket.once('error', reject); });
|
|
94
|
+
try {
|
|
95
|
+
await this.request('initialize', { clientInfo: { name: 'codex_remote_shared', version: '1.0.0' }, capabilities: { experimentalApi: true } });
|
|
96
|
+
socket.send(JSON.stringify({ method: 'initialized' }));
|
|
97
|
+
this.ready = true;
|
|
98
|
+
this.usageCache.read(() => this.request('account/rateLimits/read')).catch(error => this.emit('usage-error', error));
|
|
99
|
+
} catch (error) { socket.close(); throw error; }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
request(method, params) {
|
|
103
|
+
const id = ++this.sequence;
|
|
104
|
+
return new Promise((resolve, reject) => {
|
|
105
|
+
const timer = setTimeout(() => {
|
|
106
|
+
this.pending.delete(id);
|
|
107
|
+
reject(new Error(`${method} 超时;不会自动重发,请先检查对话。`));
|
|
108
|
+
}, 30000);
|
|
109
|
+
this.pending.set(id, { resolve, reject, timer, threadId: params?.threadId });
|
|
110
|
+
this.socket.send(JSON.stringify({ id, method, params }), error => {
|
|
111
|
+
if (!error || !this.pending.delete(id)) return;
|
|
112
|
+
clearTimeout(timer); reject(error);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async projects() {
|
|
118
|
+
await this.connect();
|
|
119
|
+
return events.readProjects((method, params) => this.request(method, params));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async send(args) {
|
|
123
|
+
await this.connect();
|
|
124
|
+
this.requireWritable(args.threadId);
|
|
125
|
+
// Reading the live thread checks this service owns it without resume changing settings.
|
|
126
|
+
const { thread } = await this.request('thread/read', { threadId: args.threadId, includeTurns: false });
|
|
127
|
+
const status = typeof thread.status === 'string' ? thread.status : thread.status?.type;
|
|
128
|
+
if (status === 'active') {
|
|
129
|
+
const live = await this.request('thread/read', { threadId: args.threadId, includeTurns: true });
|
|
130
|
+
const active = live.thread.turns?.findLast(turn => turn.status === 'inProgress');
|
|
131
|
+
if (!active) throw new Error('活动轮次已变化,请刷新后再发送。');
|
|
132
|
+
return this.request('turn/steer', { threadId: args.threadId, expectedTurnId: active.id, input: args.input, ...(args.clientUserMessageId ? { clientUserMessageId: args.clientUserMessageId } : {}) });
|
|
133
|
+
}
|
|
134
|
+
return this.request('turn/start', args);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
respondApproval(threadId, body) {
|
|
138
|
+
if (!this.ready || this.socket?.readyState !== WebSocket.OPEN) throw new Error('完整控制未连接');
|
|
139
|
+
this.requireWritable(threadId);
|
|
140
|
+
return this.serverRequests.respond(threadId, body, message => new Promise((resolve, reject) => {
|
|
141
|
+
this.socket.send(JSON.stringify(message), error => error ? reject(error) : resolve());
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
notification(method, params) {
|
|
146
|
+
this.serverRequests.notification(method, params);
|
|
147
|
+
this.emit('notification', { method, params });
|
|
148
|
+
if (method === 'thread/queue/changed') { this.emit('queue-changed', params.threadId); return; }
|
|
149
|
+
if (method === 'account/rateLimits/updated') { this.usageCache.update(params); return; }
|
|
150
|
+
const id = params.threadId;
|
|
151
|
+
if (method === 'thread/settings/updated') {
|
|
152
|
+
const settings = params.threadSettings;
|
|
153
|
+
this.contexts.set(id, { ...this.contexts.get(id), model: settings.model, thinking: settings.effort, serviceTier: settings.serviceTier ?? null,
|
|
154
|
+
cwd: settings.cwd, ...events.permissionState(settings) });
|
|
155
|
+
this.settingsNotifications.set(id, settings);
|
|
156
|
+
this.emit('settings', id);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (method === 'thread/tokenUsage/updated') {
|
|
160
|
+
this.contexts.set(id, { ...this.contexts.get(id), tokenUsage: params.tokenUsage });
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const record = this.threads.get(id);
|
|
164
|
+
if (!record) return;
|
|
165
|
+
const turn = events.applyNotification(record.thread, method, params);
|
|
166
|
+
if (turn) {
|
|
167
|
+
const sequence = ++record.sequence;
|
|
168
|
+
record.changes.set(turn.id, { sequence, turn });
|
|
169
|
+
record.changeBytes += Buffer.byteLength(JSON.stringify({ method, params }));
|
|
170
|
+
if (record.changeBytes > syncBufferMaxBytes) {
|
|
171
|
+
record.recoverAfter = sequence;
|
|
172
|
+
record.changes.clear(); record.changeBytes = 0;
|
|
173
|
+
}
|
|
174
|
+
this.emit('turn', { thread: record.thread, turn, sequence,
|
|
175
|
+
immediate: ['turn/completed', 'item/completed'].includes(method) });
|
|
176
|
+
}
|
|
177
|
+
if (method === 'turn/completed') record.thread.turns = record.thread.turns.slice(-10);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async timeline(threadId) {
|
|
181
|
+
await this.connect();
|
|
182
|
+
const slot = this.slot(threadId);
|
|
183
|
+
const task = slot.tail.then(async () => {
|
|
184
|
+
let record = this.threads.get(threadId);
|
|
185
|
+
if (record?.readOnly) {
|
|
186
|
+
this.threads.delete(threadId);
|
|
187
|
+
this.contexts.delete(threadId);
|
|
188
|
+
record = null;
|
|
189
|
+
}
|
|
190
|
+
if (!record) {
|
|
191
|
+
let result;
|
|
192
|
+
try {
|
|
193
|
+
result = await this.request('thread/resume', { threadId, excludeTurns: true,
|
|
194
|
+
initialTurnsPage: { limit: 10, sortDirection: 'desc', itemsView: 'full' } });
|
|
195
|
+
} catch (error) {
|
|
196
|
+
if (!isThreadWriterConflict(error)) throw error;
|
|
197
|
+
const read = await this.request('thread/read', { threadId, includeTurns: true });
|
|
198
|
+
const turns = Array.isArray(read.thread?.turns) ? read.thread.turns.slice(-10) : [];
|
|
199
|
+
const thread = { ...read.thread, turns, readOnly: true,
|
|
200
|
+
readOnlyReason: '该对话正在另一个 Codex 实例中使用。' };
|
|
201
|
+
record = { thread, nextCursor: null, sequence: 0, recoverAfter: 0,
|
|
202
|
+
changes: new Map(), changeBytes: 0, tokens: new Map(), readOnly: true };
|
|
203
|
+
this.threads.set(threadId, record);
|
|
204
|
+
result = null;
|
|
205
|
+
}
|
|
206
|
+
if (result) {
|
|
207
|
+
if (!Array.isArray(result.initialTurnsPage?.data)) throw new Error('完整控制未返回分页历史。');
|
|
208
|
+
const thread = { ...result.thread, turns: [...result.initialTurnsPage.data].reverse() };
|
|
209
|
+
record = { thread, nextCursor: result.initialTurnsPage.nextCursor ?? null, sequence: 0,
|
|
210
|
+
recoverAfter: 0, changes: new Map(), changeBytes: 0, tokens: new Map() };
|
|
211
|
+
this.threads.set(threadId, record);
|
|
212
|
+
this.contexts.set(threadId, { ...this.contexts.get(threadId), model: result.model, thinking: result.reasoningEffort, serviceTier: result.serviceTier ?? null,
|
|
213
|
+
cwd: result.cwd, ...events.permissionState(result) });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const id = randomUUID(), expires = Date.now() + syncTokenTtlMs;
|
|
217
|
+
record.tokens.set(id, { sequence: record.sequence, expires });
|
|
218
|
+
this.scheduleCleanup(threadId, slot);
|
|
219
|
+
return { thread: record.thread, nextCursor: record.nextCursor,
|
|
220
|
+
sync: { id, epoch: this.epoch, seq: record.sequence } };
|
|
221
|
+
});
|
|
222
|
+
slot.tail = task.catch(() => {});
|
|
223
|
+
task.catch(() => {
|
|
224
|
+
if (!slot.users && !this.threads.has(threadId) && this.subscriptions.get(threadId) === slot) {
|
|
225
|
+
clearTimeout(slot.expiry);
|
|
226
|
+
this.subscriptions.delete(threadId);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
return task;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
slot(threadId) {
|
|
233
|
+
let slot = this.subscriptions.get(threadId);
|
|
234
|
+
if (!slot) { slot = { users: 0, tail: Promise.resolve(), expiry: null }; this.subscriptions.set(threadId, slot); }
|
|
235
|
+
return slot;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
scheduleCleanup(threadId, slot) {
|
|
239
|
+
clearTimeout(slot.expiry);
|
|
240
|
+
const record = this.threads.get(threadId);
|
|
241
|
+
const expiries = record ? [...record.tokens.values()].map(token => token.expires) : [];
|
|
242
|
+
const next = expiries.length ? Math.max(1, Math.min(...expiries) - Date.now()) : 1;
|
|
243
|
+
slot.expiry = setTimeout(() => this.cleanup(threadId, slot), next);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
cleanup(threadId, slot) {
|
|
247
|
+
const record = this.threads.get(threadId), now = Date.now();
|
|
248
|
+
if (record) for (const [id, token] of record.tokens) if (token.expires <= now) record.tokens.delete(id);
|
|
249
|
+
if (slot.users) { clearTimeout(slot.expiry); slot.expiry = null; return; }
|
|
250
|
+
if (record?.tokens.size) { this.scheduleCleanup(threadId, slot); return; }
|
|
251
|
+
slot.tail = slot.tail.then(async () => {
|
|
252
|
+
if (slot.users || this.threads.get(threadId)?.tokens.size) return;
|
|
253
|
+
this.threads.delete(threadId); this.contexts.delete(threadId); this.permissionOptions.delete(threadId);
|
|
254
|
+
this.subscriptions.delete(threadId); clearTimeout(slot.expiry);
|
|
255
|
+
if (this.ready && !record?.readOnly) await this.request('thread/unsubscribe', { threadId });
|
|
256
|
+
this.serverRequests.forget(threadId);
|
|
257
|
+
}).catch(error => this.emit('subscription-error', error));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async acquire(threadId, requested) {
|
|
261
|
+
const slot = this.slot(threadId);
|
|
262
|
+
let record = this.threads.get(threadId), token;
|
|
263
|
+
if (record && requested?.epoch === this.epoch && requested.id && Number.isSafeInteger(requested.after)) {
|
|
264
|
+
token = record.tokens.get(requested.id);
|
|
265
|
+
if (!token || token.expires <= Date.now() || token.sequence !== requested.after) token = undefined;
|
|
266
|
+
}
|
|
267
|
+
let snapshot = false, catchup;
|
|
268
|
+
if (!record || !token) {
|
|
269
|
+
const fresh = await this.timeline(threadId);
|
|
270
|
+
record = this.threads.get(threadId); token = record.tokens.get(fresh.sync.id);
|
|
271
|
+
requested = { id: fresh.sync.id, epoch: fresh.sync.epoch, after: fresh.sync.seq };
|
|
272
|
+
snapshot = true;
|
|
273
|
+
}
|
|
274
|
+
slot.users++; record.tokens.delete(requested.id); clearTimeout(slot.expiry);
|
|
275
|
+
const current = record.sequence;
|
|
276
|
+
if (!snapshot && requested.after < record.recoverAfter) snapshot = true;
|
|
277
|
+
if (!snapshot && current > requested.after) {
|
|
278
|
+
const turns = [...record.changes.values()].filter(change => change.sequence > requested.after)
|
|
279
|
+
.sort((left, right) => record.thread.turns.findIndex(turn => turn.id === left.turn.id)
|
|
280
|
+
- record.thread.turns.findIndex(turn => turn.id === right.turn.id)).map(change => change.turn);
|
|
281
|
+
catchup = { thread: { ...record.thread, turns },
|
|
282
|
+
sync: { id: requested.id, epoch: this.epoch, fromSeq: requested.after + 1, toSeq: current } };
|
|
283
|
+
}
|
|
284
|
+
const release = () => {
|
|
285
|
+
slot.users--;
|
|
286
|
+
this.cleanup(threadId, slot);
|
|
287
|
+
return slot.tail;
|
|
288
|
+
};
|
|
289
|
+
return { record: { thread: record.thread, nextCursor: record.nextCursor,
|
|
290
|
+
sync: { id: requested.id, epoch: this.epoch, seq: current, ...(snapshot ? { reset: true } : {}) } },
|
|
291
|
+
snapshot, catchup, release };
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async history(threadId, cursor) {
|
|
295
|
+
await this.connect();
|
|
296
|
+
if (!cursor) throw new Error('缺少历史分页游标。');
|
|
297
|
+
const result = await this.request('thread/turns/list', { threadId, cursor, limit: 10, sortDirection: 'desc', itemsView: 'full' });
|
|
298
|
+
return { thread: { id: threadId, turns: [...result.data].reverse() }, nextCursor: result.nextCursor ?? null };
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
async interrupt(threadId, turnId) {
|
|
302
|
+
await this.connect();
|
|
303
|
+
this.requireWritable(threadId);
|
|
304
|
+
return this.request('turn/interrupt', { threadId, turnId });
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
async models() {
|
|
308
|
+
await this.connect();
|
|
309
|
+
const models = []; let cursor;
|
|
310
|
+
do {
|
|
311
|
+
const result = await this.request('model/list', { limit: 100, ...(cursor ? { cursor } : {}) });
|
|
312
|
+
models.push(...result.data); cursor = result.nextCursor;
|
|
313
|
+
} while (cursor);
|
|
314
|
+
const config = await this.request('config/read', { includeLayers: false });
|
|
315
|
+
return { models: models.filter(model => !model.hidden), enabledReasoningEfforts: config.config?.desktop?.['enabled-reasoning-efforts'] ?? null };
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
async usage() {
|
|
319
|
+
await this.connect();
|
|
320
|
+
return this.usageCache.read(() => this.request('account/rateLimits/read'));
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
async settings(threadId, model, effort, serviceTier) {
|
|
324
|
+
await this.connect();
|
|
325
|
+
this.requireWritable(threadId);
|
|
326
|
+
await events.updateSettings((method, params) => this.request(method, params), this.contexts, this.settingsNotifications, threadId, model, effort, serviceTier);
|
|
327
|
+
return this.context(threadId);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
async permissions(threadId, mode) {
|
|
331
|
+
await this.connect();
|
|
332
|
+
this.requireWritable(threadId);
|
|
333
|
+
await events.updatePermissions((method, params) => this.request(method, params), this.contexts, this.settingsNotifications, this.permissionOptions, threadId, mode);
|
|
334
|
+
return this.context(threadId);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
async readContext(threadId) {
|
|
338
|
+
const context = this.contexts.get(threadId);
|
|
339
|
+
if (context) await this.permissionOptions.read((method, params) => this.request(method, params), threadId, context);
|
|
340
|
+
return this.context(threadId);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
context(threadId) {
|
|
344
|
+
const context = this.permissionOptions.context(threadId, this.contexts.get(threadId) || {}), usage = context.tokenUsage;
|
|
345
|
+
const usedTokens = usage?.last?.totalTokens, contextWindow = usage?.modelContextWindow;
|
|
346
|
+
return { ...context, available: Boolean(contextWindow), usedTokens, contextWindow,
|
|
347
|
+
usedPercent: contextWindow ? 100 * usedTokens / contextWindow : 0 };
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
requireWritable(threadId) {
|
|
351
|
+
const record = this.threads.get(threadId);
|
|
352
|
+
if (record?.readOnly) throw new ThreadWriterConflictError(threadId, record.thread.readOnlyReason);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
close() { this.socket?.close(); }
|
|
356
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import events from '../shared/app-server-events.cjs';
|
|
2
|
+
|
|
3
|
+
export function sharedThreadProjectId(thread, projects) {
|
|
4
|
+
if (thread.projectId) return thread.projectId;
|
|
5
|
+
const local = thread.environments?.find(environment => environment.environmentId === 'local');
|
|
6
|
+
if (local && Array.isArray(local.runtimeWorkspaceRoots)) {
|
|
7
|
+
for (const root of local.runtimeWorkspaceRoots) {
|
|
8
|
+
const projectId = events.threadProjectId({ cwd: root }, projects);
|
|
9
|
+
if (projectId) return projectId;
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
// Unloaded Desktop history omits environments and often has no persisted project ID.
|
|
14
|
+
return events.threadProjectId({ cwd: thread.cwd }, projects);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Native IDs remain stable when optional Desktop presentation data arrives.
|
|
18
|
+
export class SharedCatalog {
|
|
19
|
+
constructor(server, desktop) { this.server = server; this.desktop = desktop; }
|
|
20
|
+
|
|
21
|
+
async projects() {
|
|
22
|
+
const native = await this.server.projects();
|
|
23
|
+
const projects = native.map(project => ({ projectId: project.id, name: project.name,
|
|
24
|
+
label: project.name, path: project.roots[0]?.path || '', cwd: project.roots[0]?.path || '', hostId: 'local' }));
|
|
25
|
+
const ordered = this.desktop.snapshot?.projects || [];
|
|
26
|
+
const key = value => value.replace(/^\\\\\?\\/, '').replaceAll('\\', '/').replace(/\/+$/, '').toLowerCase();
|
|
27
|
+
const ranks = new Map(ordered.filter(p => p.hostId === 'local').map((p, i) => [key(p.path || ''), i]));
|
|
28
|
+
projects.sort((a, b) => (ranks.get(key(a.path)) ?? Infinity) - (ranks.get(key(b.path)) ?? Infinity));
|
|
29
|
+
return { projects, native };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async threads(limit, archived = false) {
|
|
33
|
+
const { projects, native } = await this.projects();
|
|
34
|
+
const threads = []; let cursor;
|
|
35
|
+
do {
|
|
36
|
+
const page = await this.server.request('thread/list', { limit: Math.min(100, limit - threads.length),
|
|
37
|
+
sortKey: 'recency_at', sortDirection: 'desc', archived, ...(cursor ? { cursor } : {}) });
|
|
38
|
+
threads.push(...page.data); cursor = page.nextCursor;
|
|
39
|
+
} while (cursor && threads.length < limit);
|
|
40
|
+
const summaries = threads.map(thread => ({ id: thread.id, kind: 'codex', hostId: 'local',
|
|
41
|
+
title: thread.name || thread.preview || '', cwd: thread.cwd,
|
|
42
|
+
projectId: sharedThreadProjectId(thread, native), updatedAt: thread.updatedAt,
|
|
43
|
+
status: typeof thread.status === 'string' ? thread.status : thread.status?.type || 'unknown',
|
|
44
|
+
activeFlags: threadActiveFlags(thread.status) }));
|
|
45
|
+
const listing = this.desktop.snapshot?.listing;
|
|
46
|
+
const byId = new Map(summaries.map(thread => [thread.id, thread]));
|
|
47
|
+
const pinnedThreads = (listing?.pinnedThreads || []).filter(t => t.hostId === 'local' && byId.has(t.id)).map(t => byId.get(t.id));
|
|
48
|
+
const pinned = new Set(pinnedThreads.map(t => t.id));
|
|
49
|
+
const ranks = new Map((listing?.threads || []).filter(t => t.hostId === 'local').map((t, i) => [t.id, i]));
|
|
50
|
+
const rest = summaries.filter(t => !pinned.has(t.id));
|
|
51
|
+
rest.sort((a, b) => (ranks.get(a.id) ?? Infinity) - (ranks.get(b.id) ?? Infinity));
|
|
52
|
+
return { projects, pinnedThreads, threads: rest };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function threadActiveFlags(status) {
|
|
57
|
+
return status && typeof status === 'object' && Array.isArray(status.activeFlags)
|
|
58
|
+
? status.activeFlags.filter(flag => typeof flag === 'string')
|
|
59
|
+
: [];
|
|
60
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { randomUUID } from 'node:crypto';
|
|
4
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { readRecord, writeRecord, lifecycle } from './service-lifecycle.mjs';
|
|
7
|
+
import { startBackground } from './background-process.mjs';
|
|
8
|
+
import { desktopHost } from './platform/windows/desktop-host.mjs';
|
|
9
|
+
import * as serviceHost from './platform/windows/service-host.mjs';
|
|
10
|
+
import { launchDesktop, portAvailable } from './desktop-launcher.mjs';
|
|
11
|
+
|
|
12
|
+
const script = fileURLToPath(import.meta.url);
|
|
13
|
+
const recordPath = root => path.join(root, 'shared-recovery.json');
|
|
14
|
+
const lockPath = root => path.join(root, 'shared-recovery.lock');
|
|
15
|
+
const sameProcess = (a, b) => a && b && a.pid === b.pid && a.created === b.created && a.executable === b.executable;
|
|
16
|
+
const active = value => value && ['scheduled', 'running'].includes(value.status);
|
|
17
|
+
const recoverySteps = () => [
|
|
18
|
+
['checking', '检查启动条件'], ['stopping-desktop', '关闭当前 Codex'],
|
|
19
|
+
['starting-app-server', '确认 Codex 内核'], ['starting-desktop', '重新打开 Codex'],
|
|
20
|
+
['checking-execution', '确认手机控制就绪'],
|
|
21
|
+
].map(([id, label]) => ({ id, label, status: 'pending' }));
|
|
22
|
+
export const recoveryWarning = 'Codex Desktop 需要重新打开,才能接入同一个 Codex 内核。手机完整控制和 Codex 内核会保持运行;旧 Desktop 实例中的任务可能中断,未发送内容请先保存。切换不会清空项目、对话历史、设置或设备授权。';
|
|
23
|
+
|
|
24
|
+
export async function recoveryStatus(stateRoot, host = desktopHost) {
|
|
25
|
+
const record = readRecord(recordPath(stateRoot));
|
|
26
|
+
if (!record) return { status: 'none', message: '尚未执行 Desktop 接入流程。' };
|
|
27
|
+
const lostWorker = active(record) && (record.worker
|
|
28
|
+
? !sameProcess(record.worker, await host.process(record.worker.pid))
|
|
29
|
+
: Date.now() - Date.parse(record.startedAt) > 30000);
|
|
30
|
+
if (lostWorker) {
|
|
31
|
+
record.status = 'failed'; record.error = '独立恢复进程已退出,恢复未完成。';
|
|
32
|
+
record.steps = record.steps?.map(step => ({ ...step, status: step.status === 'running' ? 'failed' : step.status }));
|
|
33
|
+
writeRecord(recordPath(stateRoot), record);
|
|
34
|
+
if (readRecord(lockPath(stateRoot))?.operationId === record.operationId) fs.rmSync(lockPath(stateRoot));
|
|
35
|
+
}
|
|
36
|
+
const { worker, oldService, desktop, ...publicRecord } = record;
|
|
37
|
+
return publicRecord;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function planRecovery(stateRoot, host, available = portAvailable) {
|
|
41
|
+
const info = await host.inspect();
|
|
42
|
+
const action = await host.sharedServiceUrl() ? 'restart' : 'switch';
|
|
43
|
+
if (!info.desktop || !info.cli) throw new Error('未找到 Codex Desktop 或执行程序,请先在电脑完成安装和登录。');
|
|
44
|
+
const record = readRecord(path.join(stateRoot, 'managed-app-server.json')) || readRecord(path.join(stateRoot, 'shared-desktop.json'));
|
|
45
|
+
const actual = record ? await host.process(record.pid) : null;
|
|
46
|
+
if (actual && (!sameProcess(record, actual) || !actual.command?.includes('app-server') || !actual.command.includes('ws://127.0.0.1:45839'))) {
|
|
47
|
+
throw new Error('完整控制进程身份与记录不符,未结束任何进程。');
|
|
48
|
+
}
|
|
49
|
+
if (!actual && !await available()) throw new Error('45839 被未识别进程占用,未关闭 Desktop 或结束任何进程。');
|
|
50
|
+
return { desktop: info.desktop, action };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export async function requestRecovery(stateRoot, { confirmed, operationId = randomUUID() } = {}, host = desktopHost) {
|
|
54
|
+
if (confirmed !== true) throw new Error(recoveryWarning + ' 请明确确认后再执行。');
|
|
55
|
+
if (!/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(operationId)) throw new Error('无效的恢复操作编号。');
|
|
56
|
+
fs.mkdirSync(stateRoot, { recursive: true });
|
|
57
|
+
const previous = await recoveryStatus(stateRoot, host);
|
|
58
|
+
if (previous.operationId === operationId) return previous;
|
|
59
|
+
if (active(previous)) throw new Error('已有恢复操作正在执行,请查看恢复状态。');
|
|
60
|
+
const planned = await planRecovery(stateRoot, host);
|
|
61
|
+
let lock;
|
|
62
|
+
try { lock = fs.openSync(lockPath(stateRoot), 'wx'); }
|
|
63
|
+
catch (error) { if (error.code === 'EEXIST') throw new Error('已有恢复操作,请先查看恢复状态。'); throw error; }
|
|
64
|
+
fs.writeFileSync(lock, JSON.stringify({ operationId })); fs.closeSync(lock);
|
|
65
|
+
const record = { operationId, status: 'scheduled', stage: 'prepared', startedAt: new Date().toISOString(),
|
|
66
|
+
message: '完整控制请求已接受,电脑管理连接保持运行。', steps: recoverySteps(), ...planned };
|
|
67
|
+
try {
|
|
68
|
+
writeRecord(recordPath(stateRoot), record);
|
|
69
|
+
const log = path.join(stateRoot, 'shared-recovery.log');
|
|
70
|
+
const pid = await startBackground(process.execPath, [script, '--worker', stateRoot, operationId], process.env, [log, log]);
|
|
71
|
+
const worker = await host.process(pid);
|
|
72
|
+
if (!worker) throw new Error('独立恢复进程未启动,请查看 shared-recovery.log。');
|
|
73
|
+
// Publish the process identity before allowing the worker to begin disruption.
|
|
74
|
+
writeRecord(recordPath(stateRoot), { ...record, worker });
|
|
75
|
+
return { operationId, status: record.status, message: record.message };
|
|
76
|
+
} catch (error) {
|
|
77
|
+
writeRecord(recordPath(stateRoot), { ...record, status: 'failed', error: error.message });
|
|
78
|
+
fs.rmSync(lockPath(stateRoot), { force: true }); throw error;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export async function runRecovery(stateRoot, operationId, dependencies = {}) {
|
|
83
|
+
const host = dependencies.host || desktopHost;
|
|
84
|
+
const service = dependencies.service || lifecycle({ stateRoot, host: serviceHost });
|
|
85
|
+
const available = dependencies.available || portAvailable;
|
|
86
|
+
const start = dependencies.launch || (options => launchDesktop('shared', options));
|
|
87
|
+
let record = readRecord(recordPath(stateRoot));
|
|
88
|
+
if (record?.operationId !== operationId || readRecord(lockPath(stateRoot))?.operationId !== operationId) throw new Error('恢复实例已失效。');
|
|
89
|
+
record.steps ||= recoverySteps();
|
|
90
|
+
const stage = name => {
|
|
91
|
+
record = { ...record, status: 'running', stage: name, steps: record.steps.map(step => ({ ...step,
|
|
92
|
+
status: step.id === name ? 'running' : step.status === 'running' ? 'completed' : step.status })) };
|
|
93
|
+
writeRecord(recordPath(stateRoot), record);
|
|
94
|
+
};
|
|
95
|
+
const waitFor = async (check, message) => {
|
|
96
|
+
const deadline = Date.now() + (dependencies.timeout ?? 10000);
|
|
97
|
+
while (!await check()) { if (Date.now() >= deadline) throw new Error(message); await delay(100); }
|
|
98
|
+
};
|
|
99
|
+
try {
|
|
100
|
+
stage('checking');
|
|
101
|
+
const planned = await planRecovery(stateRoot, host, available);
|
|
102
|
+
record = { ...record, ...planned };
|
|
103
|
+
if (fs.existsSync(path.join(stateRoot, 'desktop-launch.lock'))) throw new Error('Desktop 正在启动,未与启动操作并行恢复。');
|
|
104
|
+
stage('stopping-desktop'); await host.closeDesktop(record.desktop);
|
|
105
|
+
await waitFor(async () => !(await host.inspect()).running, '当前 Codex Desktop 未退出,未继续接入 Codex 内核。');
|
|
106
|
+
stage('starting-app-server'); await start({ stateRoot, host, recoveryId: operationId, progress: stage });
|
|
107
|
+
stage('checking-execution');
|
|
108
|
+
await service.start(); // Refresh the execution adapter; resident Bridge retains its PID and sockets.
|
|
109
|
+
await waitFor(async () => {
|
|
110
|
+
const health = await service.status();
|
|
111
|
+
return health.running && health.mode === 'lan-shared' && health.execution?.ready === true;
|
|
112
|
+
}, '完整控制未就绪;Bridge 和中继管理连接仍保留。');
|
|
113
|
+
record = { ...record, status: 'completed', stage: 'ready', steps: record.steps.map(step => ({ ...step, status: 'completed' })),
|
|
114
|
+
message: 'Codex Desktop 已接入 Codex 内核;手机完整控制保持就绪,原任务未自动重发。' };
|
|
115
|
+
} catch (error) { record = { ...record, status: 'failed', error: error.message,
|
|
116
|
+
steps: record.steps.map(step => ({ ...step, status: step.status === 'running' ? 'failed' : step.status })),
|
|
117
|
+
message: 'Codex Desktop 未完成接入,已停止后续步骤。' }; }
|
|
118
|
+
finally {
|
|
119
|
+
record.finishedAt = new Date().toISOString(); writeRecord(recordPath(stateRoot), record);
|
|
120
|
+
if (readRecord(lockPath(stateRoot))?.operationId === operationId) fs.rmSync(lockPath(stateRoot));
|
|
121
|
+
}
|
|
122
|
+
return record;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (process.argv[1] && path.resolve(process.argv[1]) === script && process.argv[2] === '--worker') {
|
|
126
|
+
const [stateRoot, operationId] = process.argv.slice(3);
|
|
127
|
+
(async () => {
|
|
128
|
+
const deadline = Date.now() + 15000;
|
|
129
|
+
while (true) {
|
|
130
|
+
const record = readRecord(recordPath(stateRoot));
|
|
131
|
+
if (record?.operationId !== operationId || record.status !== 'scheduled') throw new Error('恢复调度已失效。');
|
|
132
|
+
if (record.worker?.pid === process.pid) break;
|
|
133
|
+
if (Date.now() >= deadline) throw new Error('恢复启动交接超时。');
|
|
134
|
+
await delay(100);
|
|
135
|
+
}
|
|
136
|
+
// A deliberate handoff window lets the caller display the accepted operation ID.
|
|
137
|
+
await delay(3000);
|
|
138
|
+
const result = await runRecovery(stateRoot, operationId);
|
|
139
|
+
console.log(JSON.stringify({ operationId, status: result.status, stage: result.stage, error: result.error }));
|
|
140
|
+
process.exit(result.status === 'completed' ? 0 : 1);
|
|
141
|
+
})().catch(error => { console.error(error.message); process.exit(1); });
|
|
142
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Event-driven subscription adapter. Normal desktop-tool polling remains in its own adapter.
|
|
2
|
+
import timelineSync from '../shared/timeline-sync.cjs';
|
|
3
|
+
const threadListNotificationMethods = new Set([
|
|
4
|
+
'thread/started', 'thread/status/changed', 'thread/name/updated',
|
|
5
|
+
'thread/archived', 'thread/unarchived', 'thread/deleted',
|
|
6
|
+
'thread/project/updated', 'project/changed', 'turn/started', 'turn/completed',
|
|
7
|
+
]);
|
|
8
|
+
export async function streamSharedThread(response, threadId, client, normalize, requestedSync, known) {
|
|
9
|
+
response.startEvents();
|
|
10
|
+
let closed = false, timer, subscription, streamReady = false;
|
|
11
|
+
const pending = new Map(), sentTurns = new Map();
|
|
12
|
+
let fromSeq, toSeq, syncId = requestedSync?.id, epoch = requestedSync?.epoch;
|
|
13
|
+
let finish;
|
|
14
|
+
const done = new Promise(resolve => { finish = resolve; });
|
|
15
|
+
const emit = (name, value) => { if (!closed) response.event(name, value); };
|
|
16
|
+
const flush = () => {
|
|
17
|
+
clearTimeout(timer); timer = null;
|
|
18
|
+
const record = client.threads.get(threadId);
|
|
19
|
+
if (!streamReady || !record || !pending.size) return;
|
|
20
|
+
const base = normalize({ thread: { ...record.thread, turns: [] }, sync: { id: syncId, epoch, fromSeq, toSeq } });
|
|
21
|
+
const turns = [], turnPatches = [];
|
|
22
|
+
for (const turn of pending.values()) {
|
|
23
|
+
const normalized = normalize({ thread: { ...record.thread, turns: [turn] } }).turns[0];
|
|
24
|
+
const patch = timelineSync.diffTurn(sentTurns.get(turn.id), normalized);
|
|
25
|
+
if (patch) turnPatches.push(patch); else turns.push(normalized);
|
|
26
|
+
sentTurns.set(turn.id, normalized);
|
|
27
|
+
}
|
|
28
|
+
emit('update', { ...base, turns, ...(turnPatches.length ? { turnPatches } : {}) });
|
|
29
|
+
pending.clear();
|
|
30
|
+
fromSeq = toSeq = undefined;
|
|
31
|
+
};
|
|
32
|
+
const onTurn = ({ thread, turn, sequence, immediate }) => {
|
|
33
|
+
if (thread.id !== threadId) return;
|
|
34
|
+
if (!fromSeq) fromSeq = sequence;
|
|
35
|
+
toSeq = sequence;
|
|
36
|
+
pending.set(turn.id, turn);
|
|
37
|
+
if (immediate) flush(); else if (!timer) timer = setTimeout(flush, 50);
|
|
38
|
+
};
|
|
39
|
+
const onSettings = id => { if (id === threadId) emit('settings', client.context(id)); };
|
|
40
|
+
const onRequests = id => { if (id === threadId) emit('approvals', { requests: client.serverRequests.list(threadId) }); };
|
|
41
|
+
const onQueue = id => { if (id === threadId) emit('queue-changed', {}); };
|
|
42
|
+
const onNotification = ({ method, params }) => {
|
|
43
|
+
if (!threadListNotificationMethods.has(method)) return;
|
|
44
|
+
emit('thread-list-changed', { method, threadId: params.threadId || params.thread?.id || '' });
|
|
45
|
+
};
|
|
46
|
+
const onDisconnected = () => { emit('bridge-error', { error: '完整控制已断开,请重新连接。' }); response.end(); finish(); };
|
|
47
|
+
response.once('close', () => { closed = true; finish(); });
|
|
48
|
+
client.on('turn', onTurn); client.on('settings', onSettings); client.on('disconnected', onDisconnected);
|
|
49
|
+
client.on('queue-changed', onQueue);
|
|
50
|
+
client.on('requests-changed', onRequests);
|
|
51
|
+
client.on('notification', onNotification);
|
|
52
|
+
try {
|
|
53
|
+
subscription = await client.acquire(threadId, requestedSync);
|
|
54
|
+
syncId = subscription.record.sync.id; epoch = subscription.record.sync.epoch;
|
|
55
|
+
streamReady = true;
|
|
56
|
+
if (!closed) {
|
|
57
|
+
const normalized = normalize(subscription.record);
|
|
58
|
+
const latest = normalized.turns.at(-1);
|
|
59
|
+
const unchanged = subscription.snapshot && known?.turnId && known.turnId === latest?.id
|
|
60
|
+
&& known.updatedAt > 0 && known.updatedAt === Number(normalized.thread.updatedAt)
|
|
61
|
+
&& normalized.thread.status === 'idle' && latest?.status !== 'inProgress'
|
|
62
|
+
&& known.turnStatus && known.turnStatus !== 'inProgress';
|
|
63
|
+
if (subscription.snapshot) emit('update', unchanged ? { ...normalized, turns: [], notModified: true } : normalized);
|
|
64
|
+
else if (subscription.catchup) emit('update', normalize(subscription.catchup));
|
|
65
|
+
for (const turn of normalized.turns) sentTurns.set(turn.id, turn);
|
|
66
|
+
emit('queue-changed', {});
|
|
67
|
+
onRequests(threadId);
|
|
68
|
+
flush();
|
|
69
|
+
}
|
|
70
|
+
await done;
|
|
71
|
+
} catch (error) { emit('bridge-error', { error: error.message }); response.end(); }
|
|
72
|
+
finally {
|
|
73
|
+
clearTimeout(timer);
|
|
74
|
+
client.off('turn', onTurn); client.off('settings', onSettings); client.off('disconnected', onDisconnected);
|
|
75
|
+
client.off('queue-changed', onQueue);
|
|
76
|
+
client.off('requests-changed', onRequests);
|
|
77
|
+
client.off('notification', onNotification);
|
|
78
|
+
if (subscription) await subscription.release();
|
|
79
|
+
}
|
|
80
|
+
}
|