@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,355 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { AppServerRpcError } from './app-server-client.mjs';
|
|
6
|
+
|
|
7
|
+
const STORE_SCHEMA_VERSION = 1;
|
|
8
|
+
|
|
9
|
+
export class AppServerTaskStore {
|
|
10
|
+
constructor(filePath) {
|
|
11
|
+
this.filePath = path.resolve(filePath);
|
|
12
|
+
this.records = new Map();
|
|
13
|
+
this.loadError = null;
|
|
14
|
+
this.load();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
load() {
|
|
18
|
+
if (!fs.existsSync(this.filePath)) return;
|
|
19
|
+
try {
|
|
20
|
+
const value = JSON.parse(fs.readFileSync(this.filePath, 'utf8'));
|
|
21
|
+
if (value?.schemaVersion !== STORE_SCHEMA_VERSION || !Array.isArray(value.tasks)) {
|
|
22
|
+
throw new Error('任务归属文件格式不受支持。');
|
|
23
|
+
}
|
|
24
|
+
for (const task of value.tasks) {
|
|
25
|
+
if (!validTaskRecord(task)) continue;
|
|
26
|
+
this.records.set(task.id, { ...task, transport: 'app-server' });
|
|
27
|
+
}
|
|
28
|
+
} catch (error) {
|
|
29
|
+
this.loadError = error instanceof Error ? error : new Error(String(error));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
ensureUsable() {
|
|
34
|
+
if (this.loadError) {
|
|
35
|
+
throw new Error(`无法读取 app-server 任务归属:${this.loadError.message}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
has(threadId) {
|
|
40
|
+
return this.records.has(threadId);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get(threadId) {
|
|
44
|
+
return this.records.get(threadId) || null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
list() {
|
|
48
|
+
return [...this.records.values()].sort((left, right) => Number(right.updatedAt) - Number(left.updatedAt));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
upsert(task) {
|
|
52
|
+
this.ensureUsable();
|
|
53
|
+
if (!validTaskRecord(task)) throw new Error('app-server 任务归属记录无效。');
|
|
54
|
+
const record = { ...task, transport: 'app-server' };
|
|
55
|
+
const existing = this.records.get(record.id);
|
|
56
|
+
if (existing && JSON.stringify(existing) === JSON.stringify(record)) return existing;
|
|
57
|
+
this.records.set(record.id, record);
|
|
58
|
+
this.save();
|
|
59
|
+
return record;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
remove(threadId) {
|
|
63
|
+
this.ensureUsable();
|
|
64
|
+
if (!this.records.delete(threadId)) return false;
|
|
65
|
+
this.save();
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
save() {
|
|
70
|
+
this.ensureUsable();
|
|
71
|
+
fs.mkdirSync(path.dirname(this.filePath), { recursive: true });
|
|
72
|
+
const temporaryPath = `${this.filePath}.${process.pid}.${crypto.randomUUID()}.tmp`;
|
|
73
|
+
const payload = `${JSON.stringify({
|
|
74
|
+
schemaVersion: STORE_SCHEMA_VERSION,
|
|
75
|
+
tasks: this.list(),
|
|
76
|
+
}, null, 2)}\n`;
|
|
77
|
+
try {
|
|
78
|
+
fs.writeFileSync(temporaryPath, payload, { encoding: 'utf8', flag: 'wx' });
|
|
79
|
+
fs.renameSync(temporaryPath, this.filePath);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
try { fs.unlinkSync(temporaryPath); } catch {}
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export class AppServerTaskTransport extends EventEmitter {
|
|
88
|
+
constructor({ client, store }) {
|
|
89
|
+
super();
|
|
90
|
+
this.client = client;
|
|
91
|
+
this.store = store;
|
|
92
|
+
this.hydratedGeneration = 0;
|
|
93
|
+
this.loadedGenerations = new Map();
|
|
94
|
+
this.client.on('notification', record => this.handleNotification(record));
|
|
95
|
+
this.client.on('server-request', request => {
|
|
96
|
+
const threadId = request.params?.threadId || request.params?.conversationId || '';
|
|
97
|
+
if (threadId && this.owns(threadId)) this.emit('thread-event', { threadId, record: request });
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
owns(threadId) {
|
|
102
|
+
return this.store.has(threadId);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
record(threadId) {
|
|
106
|
+
const record = this.store.get(threadId);
|
|
107
|
+
if (!record) throw new Error('该任务不属于独立 app-server 通道。');
|
|
108
|
+
return record;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async createTask({ cwd, projectId, title, input, model, effort }) {
|
|
112
|
+
if (!path.isAbsolute(cwd)) throw new Error('app-server 任务 cwd 必须是绝对路径。');
|
|
113
|
+
if (!Array.isArray(input) || !input.length) throw new Error('app-server 任务输入不能为空。');
|
|
114
|
+
this.store.ensureUsable();
|
|
115
|
+
await this.client.start();
|
|
116
|
+
const startParams = { cwd, ephemeral: false, projectId: projectId || null };
|
|
117
|
+
if (!projectId) startParams.runtimeWorkspaceRoots = [];
|
|
118
|
+
if (model) startParams.model = model;
|
|
119
|
+
const started = await this.client.request('thread/start', startParams, 60_000);
|
|
120
|
+
this.loadedGenerations.set(started.thread.id, this.client.generation);
|
|
121
|
+
const now = Math.floor(Date.now() / 1000);
|
|
122
|
+
const record = this.store.upsert({
|
|
123
|
+
id: started.thread.id,
|
|
124
|
+
title: title || started.thread.name || '新对话',
|
|
125
|
+
cwd,
|
|
126
|
+
projectId: projectId || null,
|
|
127
|
+
createdAt: Number(started.thread.createdAt) || now,
|
|
128
|
+
updatedAt: Number(started.thread.updatedAt) || now,
|
|
129
|
+
status: threadStatus(started.thread.status),
|
|
130
|
+
activeFlags: threadActiveFlags(started.thread.status),
|
|
131
|
+
model: model || started.model || started.thread.model || '',
|
|
132
|
+
effort: effort || started.reasoningEffort || started.thread.reasoningEffort || '',
|
|
133
|
+
transport: 'app-server',
|
|
134
|
+
});
|
|
135
|
+
if (title) try {
|
|
136
|
+
await this.client.request('thread/name/set', { threadId: record.id, name: title }, 15_000);
|
|
137
|
+
} catch {
|
|
138
|
+
// The persisted local title still keeps the task identifiable.
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const turnParams = { threadId: record.id, input };
|
|
142
|
+
if (model) turnParams.model = model;
|
|
143
|
+
if (effort) turnParams.effort = effort;
|
|
144
|
+
const turn = await this.client.request('turn/start', turnParams, 60_000);
|
|
145
|
+
this.store.upsert({ ...record, status: 'active', activeFlags: [], updatedAt: Math.floor(Date.now() / 1000) });
|
|
146
|
+
return { thread: started.thread, turn: turn.turn, record: this.store.get(record.id) };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async listTasks() {
|
|
150
|
+
const records = this.store.list();
|
|
151
|
+
if (!records.length) return [];
|
|
152
|
+
await this.client.start();
|
|
153
|
+
if (this.hydratedGeneration === this.client.generation) {
|
|
154
|
+
return records.map(record => summaryFromRecord(record));
|
|
155
|
+
}
|
|
156
|
+
const results = await Promise.allSettled(records.map(record => this.readTask(record.id, { includeTurns: false })));
|
|
157
|
+
const summaries = results.map((result, index) => {
|
|
158
|
+
const record = records[index];
|
|
159
|
+
if (result.status === 'rejected') return summaryFromRecord(record, 'unknown');
|
|
160
|
+
const thread = result.value;
|
|
161
|
+
const updated = this.store.upsert({
|
|
162
|
+
...record,
|
|
163
|
+
title: thread.name || record.title,
|
|
164
|
+
cwd: thread.cwd || record.cwd,
|
|
165
|
+
updatedAt: Number(thread.updatedAt) || record.updatedAt,
|
|
166
|
+
status: threadStatus(thread.status),
|
|
167
|
+
activeFlags: threadActiveFlags(thread.status),
|
|
168
|
+
model: thread.model || record.model,
|
|
169
|
+
effort: thread.reasoningEffort || record.effort,
|
|
170
|
+
});
|
|
171
|
+
return summaryFromThread(thread, updated);
|
|
172
|
+
});
|
|
173
|
+
if (results.every(result => result.status === 'fulfilled')) {
|
|
174
|
+
this.hydratedGeneration = this.client.generation;
|
|
175
|
+
}
|
|
176
|
+
return summaries;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async readTask(threadId, { includeTurns = true, turnLimit = 10 } = {}) {
|
|
180
|
+
this.record(threadId);
|
|
181
|
+
await this.client.start();
|
|
182
|
+
try {
|
|
183
|
+
const result = await this.readInitializedThread({ threadId, includeTurns });
|
|
184
|
+
if (includeTurns && Array.isArray(result.thread?.turns)) {
|
|
185
|
+
result.thread.turns = result.thread.turns.slice(-turnLimit);
|
|
186
|
+
}
|
|
187
|
+
return result.thread;
|
|
188
|
+
} catch (error) {
|
|
189
|
+
if (!includeTurns || !(error instanceof AppServerRpcError) || error.code !== -32601) throw error;
|
|
190
|
+
const [threadResult, turnsResult] = await Promise.all([
|
|
191
|
+
this.readInitializedThread({ threadId, includeTurns: false }),
|
|
192
|
+
this.client.request('thread/turns/list', {
|
|
193
|
+
threadId,
|
|
194
|
+
limit: turnLimit,
|
|
195
|
+
sortDirection: 'desc',
|
|
196
|
+
}, 30_000),
|
|
197
|
+
]);
|
|
198
|
+
return { ...threadResult.thread, turns: [...(turnsResult.data || [])].reverse() };
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
async readInitializedThread(params) {
|
|
203
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
204
|
+
try {
|
|
205
|
+
return await this.client.request('thread/read', params, 30_000);
|
|
206
|
+
} catch (error) {
|
|
207
|
+
const initializing = error instanceof AppServerRpcError
|
|
208
|
+
&& error.method === 'thread/read'
|
|
209
|
+
&& /rollout at .* is empty/i.test(error.message);
|
|
210
|
+
if (!initializing || attempt >= 3) throw error;
|
|
211
|
+
await delay(100 * (attempt + 1));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async startTurn(threadId, { input, model, effort }) {
|
|
217
|
+
const record = this.record(threadId);
|
|
218
|
+
await this.client.start();
|
|
219
|
+
await this.ensureResumed(threadId);
|
|
220
|
+
const params = { threadId, input };
|
|
221
|
+
if (model) params.model = model;
|
|
222
|
+
if (effort) params.effort = effort;
|
|
223
|
+
const result = await this.client.request('turn/start', params, 60_000);
|
|
224
|
+
this.store.upsert({
|
|
225
|
+
...record,
|
|
226
|
+
status: 'active',
|
|
227
|
+
activeFlags: [],
|
|
228
|
+
updatedAt: Math.floor(Date.now() / 1000),
|
|
229
|
+
model: model || record.model,
|
|
230
|
+
effort: effort || record.effort,
|
|
231
|
+
});
|
|
232
|
+
return result;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
async adoptTask(thread) {
|
|
236
|
+
this.store.ensureUsable();
|
|
237
|
+
await this.client.start();
|
|
238
|
+
let result;
|
|
239
|
+
try {
|
|
240
|
+
result = await this.client.request('thread/resume', { threadId: thread.id }, 60000);
|
|
241
|
+
} catch (error) {
|
|
242
|
+
if (error instanceof AppServerRpcError && /already has an active writer/.test(error.message)) {
|
|
243
|
+
throw new Error('Desktop 仍持有此聊天的写入权限,空闲不代表已释放。当前无法直接接管;此聊天仍由 Desktop 执行。');
|
|
244
|
+
}
|
|
245
|
+
throw error;
|
|
246
|
+
}
|
|
247
|
+
if (result.thread.id !== thread.id) throw new Error('恢复后的聊天 ID 不一致。');
|
|
248
|
+
const now = Math.floor(Date.now() / 1000);
|
|
249
|
+
const record = this.store.upsert({
|
|
250
|
+
id: thread.id, title: thread.title || result.thread.name || thread.id,
|
|
251
|
+
cwd: result.thread.cwd, projectId: thread.projectId || null,
|
|
252
|
+
createdAt: result.thread.createdAt || now, updatedAt: now,
|
|
253
|
+
status: threadStatus(result.thread.status), activeFlags: threadActiveFlags(result.thread.status),
|
|
254
|
+
origin: 'desktop', transport: 'app-server',
|
|
255
|
+
});
|
|
256
|
+
this.loadedGenerations.set(thread.id, this.client.generation);
|
|
257
|
+
return summaryFromRecord(record);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async ensureResumed(threadId) {
|
|
261
|
+
if (this.loadedGenerations.get(threadId) === this.client.generation) return;
|
|
262
|
+
await this.client.request('thread/resume', { threadId }, 60000);
|
|
263
|
+
this.loadedGenerations.set(threadId, this.client.generation);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
async steerTurn(threadId, expectedTurnId, input) {
|
|
267
|
+
this.record(threadId);
|
|
268
|
+
await this.client.start();
|
|
269
|
+
return this.client.request('turn/steer', { threadId, expectedTurnId, input }, 60_000);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
async interruptTurn(threadId, turnId) {
|
|
273
|
+
this.record(threadId);
|
|
274
|
+
await this.client.start();
|
|
275
|
+
return this.client.request('turn/interrupt', { threadId, turnId }, 60_000);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async deleteTask(threadId) {
|
|
279
|
+
this.record(threadId);
|
|
280
|
+
if (this.record(threadId).origin === 'desktop') throw new Error('接管的 Desktop 历史不允许通过此接口删除。');
|
|
281
|
+
await this.client.start();
|
|
282
|
+
await this.client.request('thread/delete', { threadId }, 30_000);
|
|
283
|
+
this.store.remove(threadId);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
handleNotification(record) {
|
|
287
|
+
const threadId = notificationThreadId(record);
|
|
288
|
+
if (!threadId || !this.owns(threadId)) return;
|
|
289
|
+
const current = this.store.get(threadId);
|
|
290
|
+
if (current && ['thread/status/changed', 'turn/started', 'turn/completed', 'thread/name/updated'].includes(record.method)) {
|
|
291
|
+
const next = { ...current, updatedAt: Math.floor(Date.now() / 1000) };
|
|
292
|
+
if (record.method === 'thread/status/changed') {
|
|
293
|
+
next.status = threadStatus(record.params?.status);
|
|
294
|
+
next.activeFlags = threadActiveFlags(record.params?.status);
|
|
295
|
+
}
|
|
296
|
+
if (record.method === 'turn/started') { next.status = 'active'; next.activeFlags = []; }
|
|
297
|
+
if (record.method === 'turn/completed') { next.status = 'idle'; next.activeFlags = []; }
|
|
298
|
+
if (record.method === 'thread/name/updated' && record.params?.threadName) next.title = record.params.threadName;
|
|
299
|
+
this.store.upsert(next);
|
|
300
|
+
}
|
|
301
|
+
this.emit('thread-event', { threadId, record });
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export function summaryFromRecord(record, status = record.status || 'unknown') {
|
|
306
|
+
return {
|
|
307
|
+
id: record.id,
|
|
308
|
+
kind: 'codex',
|
|
309
|
+
hostId: 'app-server',
|
|
310
|
+
title: record.title,
|
|
311
|
+
cwd: record.cwd,
|
|
312
|
+
projectId: record.projectId,
|
|
313
|
+
updatedAt: record.updatedAt,
|
|
314
|
+
status,
|
|
315
|
+
activeFlags: Array.isArray(record.activeFlags) ? record.activeFlags : [],
|
|
316
|
+
transport: 'app-server',
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function summaryFromThread(thread, record) {
|
|
321
|
+
return {
|
|
322
|
+
...summaryFromRecord(record, threadStatus(thread.status)),
|
|
323
|
+
activeFlags: threadActiveFlags(thread.status),
|
|
324
|
+
title: thread.name || record.title || thread.preview || thread.id,
|
|
325
|
+
cwd: thread.cwd || record.cwd,
|
|
326
|
+
updatedAt: Number(thread.updatedAt) || record.updatedAt,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function validTaskRecord(task) {
|
|
331
|
+
return task && typeof task.id === 'string' && task.id.length > 10
|
|
332
|
+
&& typeof task.title === 'string' && typeof task.cwd === 'string' && path.isAbsolute(task.cwd)
|
|
333
|
+
&& Number.isFinite(Number(task.createdAt)) && Number.isFinite(Number(task.updatedAt));
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function delay(milliseconds) {
|
|
337
|
+
return new Promise(resolve => setTimeout(resolve, milliseconds));
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function threadStatus(value) {
|
|
341
|
+
if (typeof value === 'string') return value;
|
|
342
|
+
if (value && typeof value === 'object') return value.type || value.status || 'unknown';
|
|
343
|
+
return 'unknown';
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function threadActiveFlags(value) {
|
|
347
|
+
return value && typeof value === 'object' && Array.isArray(value.activeFlags)
|
|
348
|
+
? value.activeFlags.filter(flag => typeof flag === 'string')
|
|
349
|
+
: [];
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function notificationThreadId(record) {
|
|
353
|
+
const params = record?.params || {};
|
|
354
|
+
return params.threadId || params.conversationId || params.thread?.id || '';
|
|
355
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { startWindowsProcess } from './platform/windows/background-process.mjs';
|
|
4
|
+
|
|
5
|
+
export const processAlive = pid => {
|
|
6
|
+
try { process.kill(pid, 0); return true; }
|
|
7
|
+
catch (error) { if (error.code === 'ESRCH') return false; throw error; }
|
|
8
|
+
};
|
|
9
|
+
export async function startBackground(executable, args, environment, logs = []) {
|
|
10
|
+
if (process.platform === 'win32') return startWindowsProcess(executable, args, environment, logs);
|
|
11
|
+
const descriptors = logs.map(file => fs.openSync(file, 'a'));
|
|
12
|
+
try {
|
|
13
|
+
const child = spawn(executable, args, { detached: true, env: environment,
|
|
14
|
+
stdio: ['ignore', descriptors[0] ?? 'ignore', descriptors[1] ?? 'ignore'] });
|
|
15
|
+
await new Promise((resolve, reject) => { child.once('spawn', resolve); child.once('error', reject); });
|
|
16
|
+
child.unref(); return child.pid;
|
|
17
|
+
} finally { descriptors.forEach(fd => fs.closeSync(fd)); }
|
|
18
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import http from 'node:http';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { readRecord, writeRecord } from './service-lifecycle.mjs';
|
|
6
|
+
import { controlRequest } from './service-control.mjs';
|
|
7
|
+
|
|
8
|
+
const script = fileURLToPath(import.meta.url);
|
|
9
|
+
const bridgeRoot = path.resolve(path.dirname(script), '..');
|
|
10
|
+
export const debugRecord = stateRoot => path.join(stateRoot, 'debug-ui-session.json');
|
|
11
|
+
|
|
12
|
+
function enabledRecord(stateRoot) {
|
|
13
|
+
const record = readRecord(debugRecord(stateRoot));
|
|
14
|
+
return record?.enabled === true && Number.isInteger(record.port) && record.port > 0 && record.port < 65536
|
|
15
|
+
&& typeof record.sourceRoot === 'string' ? record : null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function debugPort(stateRoot) {
|
|
19
|
+
return enabledRecord(stateRoot)?.port || null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function activeDebugPort(stateRoot, expectedPort) {
|
|
23
|
+
const port = debugPort(stateRoot);
|
|
24
|
+
return expectedPort === undefined || port === expectedPort ? port : null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function assetsFor(root) {
|
|
28
|
+
const web = path.join(root, 'web');
|
|
29
|
+
const packaged = path.join(web, 'resources.json');
|
|
30
|
+
const manifest = fs.existsSync(packaged)
|
|
31
|
+
? JSON.parse(fs.readFileSync(packaged, 'utf8')).map(name => ({ name, source: path.join(web, name) }))
|
|
32
|
+
: JSON.parse(fs.readFileSync(path.join(root, '../packages/web-resources.json'), 'utf8')).common
|
|
33
|
+
.map(item => ({ name: item.name, source: path.resolve(root, '..', item.source) }));
|
|
34
|
+
const assets = new Map(manifest.map(item => ['/' + item.name, item.source]));
|
|
35
|
+
assets.set('/vendor/markdown-it.umd.min.js', path.join(web, 'vendor/markdown-it.umd.min.js'));
|
|
36
|
+
return { web, assets };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function send(response, status, mime, bytes) {
|
|
40
|
+
response.writeHead(status, {
|
|
41
|
+
...(mime ? { 'Content-Type': mime } : {}),
|
|
42
|
+
'Cache-Control': 'no-store',
|
|
43
|
+
'X-Content-Type-Options': 'nosniff',
|
|
44
|
+
'Referrer-Policy': 'no-referrer',
|
|
45
|
+
'Content-Security-Policy': "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:",
|
|
46
|
+
});
|
|
47
|
+
response.end(bytes);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function serveDebugResource(request, response, stateRoot, bridgePort) {
|
|
51
|
+
const record = enabledRecord(stateRoot);
|
|
52
|
+
if (!record || record.port !== bridgePort) return false;
|
|
53
|
+
if (request.method !== 'GET' && request.method !== 'HEAD') return false;
|
|
54
|
+
const url = new URL(request.url, 'http://localhost');
|
|
55
|
+
if (url.pathname.startsWith('/api/')) return false;
|
|
56
|
+
try {
|
|
57
|
+
const { web, assets } = assetsFor(record.sourceRoot);
|
|
58
|
+
let bytes, mime;
|
|
59
|
+
if (url.pathname === '/' || url.pathname === '/index.html') {
|
|
60
|
+
bytes = fs.readFileSync(path.join(web, 'index.html'), 'utf8')
|
|
61
|
+
.replace('<body class="page-loading">', url.searchParams.get('client') === 'harmony'
|
|
62
|
+
? '<body class="page-loading silent-page-loading">' : '<body class="page-loading">')
|
|
63
|
+
.replace('<script', '<script src="debug-config.js"></script>\n<script');
|
|
64
|
+
mime = 'text/html; charset=utf-8';
|
|
65
|
+
} else if (url.pathname === '/debug-config.js') {
|
|
66
|
+
bytes = 'if(globalThis.codexNative){globalThis.codexLanConfig=JSON.parse(globalThis.codexNative.lanConnection());}else{globalThis.codexLanConfig={address:location.origin};}';
|
|
67
|
+
mime = 'text/javascript; charset=utf-8';
|
|
68
|
+
} else if (assets.has(url.pathname)) {
|
|
69
|
+
bytes = fs.readFileSync(assets.get(url.pathname));
|
|
70
|
+
mime = url.pathname.endsWith('.css') ? 'text/css; charset=utf-8' : 'text/javascript; charset=utf-8';
|
|
71
|
+
} else {
|
|
72
|
+
send(response, 404); return true;
|
|
73
|
+
}
|
|
74
|
+
send(response, 200, mime, request.method === 'HEAD' ? undefined : bytes);
|
|
75
|
+
} catch {
|
|
76
|
+
send(response, 500, 'text/plain; charset=utf-8', 'Debug resource unavailable');
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Small harness for the same request handler used by Bridge.
|
|
82
|
+
export function createDebugServer(root, bridgePort) {
|
|
83
|
+
const stateRoot = fs.mkdtempSync(path.join(path.dirname(root), '.debug-state-'));
|
|
84
|
+
writeRecord(debugRecord(stateRoot), { enabled: true, port: bridgePort, sourceRoot: root });
|
|
85
|
+
const server = http.createServer((request, response) => {
|
|
86
|
+
if (!serveDebugResource(request, response, stateRoot, bridgePort)) response.writeHead(404).end();
|
|
87
|
+
});
|
|
88
|
+
server.once('close', () => fs.rmSync(stateRoot, { recursive: true, force: true }));
|
|
89
|
+
return server;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function bridgeSession(stateRoot) {
|
|
93
|
+
const session = readRecord(path.join(stateRoot, 'bridge-session.json'));
|
|
94
|
+
if (!session?.port) throw new Error('Bridge 未运行,请先执行 relax start。');
|
|
95
|
+
try { await controlRequest(session); }
|
|
96
|
+
catch { throw new Error('Bridge 未运行,请先执行 relax start。'); }
|
|
97
|
+
return session;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async function stopLegacyWorker(record) {
|
|
101
|
+
if (!record?.controlPort || !record?.controlSecret || !record?.instanceId) return;
|
|
102
|
+
try { await controlRequest(record, 'POST'); }
|
|
103
|
+
catch (error) { if (error.code !== 'ECONNREFUSED') throw error; }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export async function debugUi(command, stateRoot) {
|
|
107
|
+
const recordPath = debugRecord(stateRoot);
|
|
108
|
+
const previous = readRecord(recordPath);
|
|
109
|
+
if (command === 'dev-stop') {
|
|
110
|
+
await stopLegacyWorker(previous);
|
|
111
|
+
fs.rmSync(recordPath, { force: true });
|
|
112
|
+
return { stopped: true, message: 'Bridge 调试页面已关闭;Bridge 继续运行。' };
|
|
113
|
+
}
|
|
114
|
+
let session;
|
|
115
|
+
try { session = await bridgeSession(stateRoot); }
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (command === 'dev-status') return { running: false, integrated: true, port: null, sourceRoot: null };
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
const current = enabledRecord(stateRoot);
|
|
121
|
+
if (command === 'dev-status') return {
|
|
122
|
+
running: Boolean(current && current.port === session.port),
|
|
123
|
+
integrated: true,
|
|
124
|
+
port: current?.port === session.port ? session.port : null,
|
|
125
|
+
sourceRoot: current?.port === session.port ? current.sourceRoot : null,
|
|
126
|
+
};
|
|
127
|
+
await stopLegacyWorker(previous);
|
|
128
|
+
const value = { enabled: true, integrated: true, port: session.port, sourceRoot: bridgeRoot };
|
|
129
|
+
writeRecord(recordPath, value);
|
|
130
|
+
return { running: true, ...value };
|
|
131
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
4
|
+
import { readRecord, writeRecord } from './service-lifecycle.mjs';
|
|
5
|
+
import { ManagedAppServer, managedAppServerUrl as sharedUrl, managedPortAvailable as portAvailable } from './managed-app-server.mjs';
|
|
6
|
+
export { portAvailable };
|
|
7
|
+
export async function launchDesktop(mode, { stateRoot, host, environment = process.env, available = portAvailable, wait = delay, timeout = 30000, recoveryId, progress = () => {} }) {
|
|
8
|
+
if (!['shared', 'ordinary'].includes(mode)) throw new Error('无效的 Desktop 启动模式。');
|
|
9
|
+
fs.mkdirSync(stateRoot, { recursive: true });
|
|
10
|
+
const recovery = readRecord(path.join(stateRoot, 'shared-recovery.lock'));
|
|
11
|
+
if (recovery && recovery.operationId !== recoveryId) throw new Error('完整控制正在启动,请先查看 shared-recovery-status。');
|
|
12
|
+
const lock = path.join(stateRoot, 'desktop-launch.lock');
|
|
13
|
+
let descriptor;
|
|
14
|
+
let managed;
|
|
15
|
+
try { descriptor = fs.openSync(lock, 'wx'); }
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (error.code === 'EEXIST') throw new Error('另一个 Desktop 启动操作正在进行;若上次异常退出,请确认没有启动器运行后移除 desktop-launch.lock。');
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const info = await host.inspect();
|
|
22
|
+
const connected = await host.sharedServiceUrl();
|
|
23
|
+
if (info.running) {
|
|
24
|
+
if ((mode === 'shared') === Boolean(connected)) {
|
|
25
|
+
writeRecord(path.join(stateRoot, 'execution-mode.json'), { mode });
|
|
26
|
+
return { reused: true, mode };
|
|
27
|
+
}
|
|
28
|
+
throw new Error('请先保存任务并完全退出 Codex Desktop,再切换模式;不会自动结束正在运行的任务。');
|
|
29
|
+
}
|
|
30
|
+
const childEnv = { ...environment };
|
|
31
|
+
for (const key of ['CODEX_APP_SERVER_WS_URL', 'CODEX_APP_SERVER_FORCE_CLI', 'CODEX_APP_TOOLS_PIPE_PATH']) delete childEnv[key];
|
|
32
|
+
if (mode === 'shared') {
|
|
33
|
+
progress('starting-app-server');
|
|
34
|
+
managed = new ManagedAppServer({ stateRoot, host, environment, available, wait, timeout });
|
|
35
|
+
if (!await managed.start()) throw new Error(managed.snapshot().error || '受管 app-server 未就绪。');
|
|
36
|
+
childEnv.CODEX_APP_SERVER_WS_URL = sharedUrl;
|
|
37
|
+
}
|
|
38
|
+
// Ordinary Desktop must not terminate a shared server that may still be executing tasks.
|
|
39
|
+
progress('starting-desktop');
|
|
40
|
+
await host.start(info.desktop, [], childEnv, []);
|
|
41
|
+
const deadline = Date.now() + timeout;
|
|
42
|
+
while (true) {
|
|
43
|
+
const ready = mode === 'shared' ? await host.sharedServiceUrl() : (await host.inspect()).running;
|
|
44
|
+
if (ready) break;
|
|
45
|
+
if (Date.now() >= deadline) throw new Error('Desktop 尚未按所选模式就绪,未启动 Bridge。请查看 Desktop 窗口后重试。');
|
|
46
|
+
await wait(500);
|
|
47
|
+
}
|
|
48
|
+
writeRecord(path.join(stateRoot, 'execution-mode.json'), { mode });
|
|
49
|
+
return { reused: false, mode };
|
|
50
|
+
} finally { managed?.close(); fs.closeSync(descriptor); fs.rmSync(lock, { force: true }); }
|
|
51
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Execution availability is sampled in the background. Health requests may
|
|
2
|
+
// join the current sample so a reconnect cannot cache an initial false state.
|
|
3
|
+
// Only connections are retried, not work.
|
|
4
|
+
export class ExecutionHealth {
|
|
5
|
+
constructor(read, interval = 3000) { this.read = read; this.interval = interval; this.state = { state: 'checking', ready: false }; }
|
|
6
|
+
start() { this.stopped = false; void this.tick(); }
|
|
7
|
+
stop() { this.stopped = true; clearTimeout(this.timer); }
|
|
8
|
+
refresh() {
|
|
9
|
+
if (this.work) return this.work;
|
|
10
|
+
this.work = this.sample().finally(() => { this.work = null; });
|
|
11
|
+
return this.work;
|
|
12
|
+
}
|
|
13
|
+
async sample() {
|
|
14
|
+
try {
|
|
15
|
+
const result = await this.read();
|
|
16
|
+
this.state = result && typeof result === 'object'
|
|
17
|
+
? { ...result, ready: Boolean(result.ready), checkedAt: new Date().toISOString() }
|
|
18
|
+
: { state: result ? 'ready' : 'unavailable', ready: Boolean(result), checkedAt: new Date().toISOString() };
|
|
19
|
+
} catch (error) { this.state = { state: 'unavailable', ready: false, error: error.message, checkedAt: new Date().toISOString() }; }
|
|
20
|
+
return this.state;
|
|
21
|
+
}
|
|
22
|
+
async tick() {
|
|
23
|
+
await this.refresh();
|
|
24
|
+
if (!this.stopped) { this.timer = setTimeout(() => this.tick(), this.interval); this.timer.unref?.(); }
|
|
25
|
+
}
|
|
26
|
+
}
|