@jingyi0605/codingns4dsh 0.1.0
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 +1114 -0
- package/assets/provider-icons/claude-code.png +0 -0
- package/assets/provider-icons/codex.png +0 -0
- package/assets/provider-icons/command-code.svg +5 -0
- package/assets/provider-icons/deepseek-harness.svg +9 -0
- package/assets/provider-icons/gemini.png +0 -0
- package/assets/provider-icons/grok.png +0 -0
- package/assets/provider-icons/kimi.png +0 -0
- package/assets/provider-icons/opencode.png +0 -0
- package/assets/provider-icons/pi.svg +7 -0
- package/data/build/dist/bootstrap/dsh-connection-adapter.d.ts +97 -0
- package/data/build/dist/bootstrap/dsh-connection-adapter.js +169 -0
- package/data/build/dist/bootstrap/index.d.ts +38 -0
- package/data/build/dist/bootstrap/index.js +44 -0
- package/data/build/dist/client/account-bar.d.ts +9 -0
- package/data/build/dist/client/account-bar.js +398 -0
- package/data/build/dist/client/bundle.js +26167 -0
- package/data/build/dist/client/cli-catalog.d.ts +24 -0
- package/data/build/dist/client/cli-catalog.js +108 -0
- package/data/build/dist/client/cli-slots.d.ts +38 -0
- package/data/build/dist/client/cli-slots.js +297 -0
- package/data/build/dist/client/debug/ui.d.ts +12 -0
- package/data/build/dist/client/debug/ui.js +451 -0
- package/data/build/dist/client/dsh-h5-bootstrap.d.ts +64 -0
- package/data/build/dist/client/dsh-h5-bootstrap.js +293 -0
- package/data/build/dist/client/dsh-runtime-version.d.ts +3 -0
- package/data/build/dist/client/dsh-runtime-version.js +11 -0
- package/data/build/dist/client/external-tool-stream.d.ts +24 -0
- package/data/build/dist/client/external-tool-stream.js +114 -0
- package/data/build/dist/client/features/cli-adapters.d.ts +7 -0
- package/data/build/dist/client/features/cli-adapters.js +215 -0
- package/data/build/dist/client/features/debug.d.ts +4 -0
- package/data/build/dist/client/features/debug.js +24 -0
- package/data/build/dist/client/features/index.d.ts +33 -0
- package/data/build/dist/client/features/index.js +44 -0
- package/data/build/dist/client/features/lan-access-panel.d.ts +5 -0
- package/data/build/dist/client/features/lan-access-panel.js +146 -0
- package/data/build/dist/client/features/lan-access.d.ts +9 -0
- package/data/build/dist/client/features/lan-access.js +30 -0
- package/data/build/dist/client/features/login-protection-panel.d.ts +5 -0
- package/data/build/dist/client/features/login-protection-panel.js +91 -0
- package/data/build/dist/client/features/login-protection-session.d.ts +6 -0
- package/data/build/dist/client/features/login-protection-session.js +25 -0
- package/data/build/dist/client/features/login-protection.d.ts +4 -0
- package/data/build/dist/client/features/login-protection.js +23 -0
- package/data/build/dist/client/features/reverse-proxy-panel.d.ts +9 -0
- package/data/build/dist/client/features/reverse-proxy-panel.js +159 -0
- package/data/build/dist/client/features/reverse-proxy.d.ts +12 -0
- package/data/build/dist/client/features/reverse-proxy.js +112 -0
- package/data/build/dist/client/features/terminal-enhancement-panel.d.ts +5 -0
- package/data/build/dist/client/features/terminal-enhancement-panel.js +160 -0
- package/data/build/dist/client/features/terminal-enhancement.d.ts +4 -0
- package/data/build/dist/client/features/terminal-enhancement.js +24 -0
- package/data/build/dist/client/features/types.d.ts +58 -0
- package/data/build/dist/client/features/types.js +2 -0
- package/data/build/dist/client/features/workspace-session-enhancement-panel.d.ts +5 -0
- package/data/build/dist/client/features/workspace-session-enhancement-panel.js +66 -0
- package/data/build/dist/client/features/workspace-session-enhancement.d.ts +4 -0
- package/data/build/dist/client/features/workspace-session-enhancement.js +101 -0
- package/data/build/dist/client/h5-bootstrap-entry.d.ts +2 -0
- package/data/build/dist/client/h5-bootstrap-entry.js +17 -0
- package/data/build/dist/client/index.d.ts +31 -0
- package/data/build/dist/client/index.js +98 -0
- package/data/build/dist/client/lan-access.d.ts +28 -0
- package/data/build/dist/client/lan-access.js +68 -0
- package/data/build/dist/client/locale.d.ts +20 -0
- package/data/build/dist/client/locale.js +393 -0
- package/data/build/dist/client/provider-icon-assets.d.ts +2 -0
- package/data/build/dist/client/provider-icon-assets.js +23 -0
- package/data/build/dist/client/provider-icons.d.ts +19 -0
- package/data/build/dist/client/provider-icons.js +39 -0
- package/data/build/dist/client/remote-web-context.d.ts +57 -0
- package/data/build/dist/client/remote-web-context.js +939 -0
- package/data/build/dist/client/session-adapter-cache.d.ts +18 -0
- package/data/build/dist/client/session-adapter-cache.js +84 -0
- package/data/build/dist/client/settings-bridge.d.ts +32 -0
- package/data/build/dist/client/settings-bridge.js +126 -0
- package/data/build/dist/client/settings-section.d.ts +30 -0
- package/data/build/dist/client/settings-section.js +93 -0
- package/data/build/dist/client/subscription-slot.d.ts +18 -0
- package/data/build/dist/client/subscription-slot.js +223 -0
- package/data/build/dist/client/terminal/index.d.ts +4 -0
- package/data/build/dist/client/terminal/index.js +3 -0
- package/data/build/dist/client/terminal/model.d.ts +116 -0
- package/data/build/dist/client/terminal/model.js +435 -0
- package/data/build/dist/client/terminal/styles.d.ts +21 -0
- package/data/build/dist/client/terminal/styles.js +51 -0
- package/data/build/dist/client/terminal/ui.d.ts +19 -0
- package/data/build/dist/client/terminal/ui.js +257 -0
- package/data/build/dist/client/terminal/xterm-view.d.ts +13 -0
- package/data/build/dist/client/terminal/xterm-view.js +213 -0
- package/data/build/dist/client/theme.d.ts +56 -0
- package/data/build/dist/client/theme.js +186 -0
- package/data/build/dist/client/workspace-session-archive-dom.d.ts +29 -0
- package/data/build/dist/client/workspace-session-archive-dom.js +525 -0
- package/data/build/dist/client/workspace-session-fiber.d.ts +3 -0
- package/data/build/dist/client/workspace-session-fiber.js +33 -0
- package/data/build/dist/client/workspace-session-logo-dom.d.ts +26 -0
- package/data/build/dist/client/workspace-session-logo-dom.js +128 -0
- package/data/build/dist/features/index.d.ts +3 -0
- package/data/build/dist/features/index.js +2 -0
- package/data/build/dist/features/registry.d.ts +74 -0
- package/data/build/dist/features/registry.js +382 -0
- package/data/build/dist/features/resource-scope/index.d.ts +39 -0
- package/data/build/dist/features/resource-scope/index.js +161 -0
- package/data/build/dist/host/auth-session.d.ts +42 -0
- package/data/build/dist/host/auth-session.js +186 -0
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts +14 -0
- package/data/build/dist/host/cli-adapters/claude-driver.js +103 -0
- package/data/build/dist/host/cli-adapters/codex-driver.d.ts +45 -0
- package/data/build/dist/host/cli-adapters/codex-driver.js +534 -0
- package/data/build/dist/host/cli-adapters/command-code-driver.d.ts +38 -0
- package/data/build/dist/host/cli-adapters/command-code-driver.js +394 -0
- package/data/build/dist/host/cli-adapters/command-code-subscription.d.ts +19 -0
- package/data/build/dist/host/cli-adapters/command-code-subscription.js +126 -0
- package/data/build/dist/host/cli-adapters/driver.d.ts +41 -0
- package/data/build/dist/host/cli-adapters/driver.js +2 -0
- package/data/build/dist/host/cli-adapters/dsh-message-projector.d.ts +37 -0
- package/data/build/dist/host/cli-adapters/dsh-message-projector.js +180 -0
- package/data/build/dist/host/cli-adapters/dsh-tool-history.d.ts +48 -0
- package/data/build/dist/host/cli-adapters/dsh-tool-history.js +373 -0
- package/data/build/dist/host/cli-adapters/feature.d.ts +7 -0
- package/data/build/dist/host/cli-adapters/feature.js +335 -0
- package/data/build/dist/host/cli-adapters/gemini-driver.d.ts +24 -0
- package/data/build/dist/host/cli-adapters/gemini-driver.js +427 -0
- package/data/build/dist/host/cli-adapters/grok-driver.d.ts +38 -0
- package/data/build/dist/host/cli-adapters/grok-driver.js +372 -0
- package/data/build/dist/host/cli-adapters/http-sse-client.d.ts +22 -0
- package/data/build/dist/host/cli-adapters/http-sse-client.js +99 -0
- package/data/build/dist/host/cli-adapters/interaction-events.d.ts +11 -0
- package/data/build/dist/host/cli-adapters/interaction-events.js +80 -0
- package/data/build/dist/host/cli-adapters/json-rpc-process.d.ts +65 -0
- package/data/build/dist/host/cli-adapters/json-rpc-process.js +256 -0
- package/data/build/dist/host/cli-adapters/kimi-driver.d.ts +21 -0
- package/data/build/dist/host/cli-adapters/kimi-driver.js +382 -0
- package/data/build/dist/host/cli-adapters/model-catalog.d.ts +22 -0
- package/data/build/dist/host/cli-adapters/model-catalog.js +89 -0
- package/data/build/dist/host/cli-adapters/opencode-driver.d.ts +55 -0
- package/data/build/dist/host/cli-adapters/opencode-driver.js +728 -0
- package/data/build/dist/host/cli-adapters/pi-driver.d.ts +43 -0
- package/data/build/dist/host/cli-adapters/pi-driver.js +312 -0
- package/data/build/dist/host/cli-adapters/process-utils.d.ts +16 -0
- package/data/build/dist/host/cli-adapters/process-utils.js +27 -0
- package/data/build/dist/host/cli-adapters/provider-subscription.d.ts +82 -0
- package/data/build/dist/host/cli-adapters/provider-subscription.js +610 -0
- package/data/build/dist/host/cli-adapters/registry.d.ts +95 -0
- package/data/build/dist/host/cli-adapters/registry.js +659 -0
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.d.ts +24 -0
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.js +119 -0
- package/data/build/dist/host/cli-adapters/session-probe.d.ts +20 -0
- package/data/build/dist/host/cli-adapters/session-probe.js +139 -0
- package/data/build/dist/host/cli-adapters/session-store.d.ts +68 -0
- package/data/build/dist/host/cli-adapters/session-store.js +180 -0
- package/data/build/dist/host/cli-adapters/standard-stream-driver.d.ts +45 -0
- package/data/build/dist/host/cli-adapters/standard-stream-driver.js +205 -0
- package/data/build/dist/host/cli-adapters/stream-normalizer.d.ts +25 -0
- package/data/build/dist/host/cli-adapters/stream-normalizer.js +83 -0
- package/data/build/dist/host/cli-adapters/tool-observation.d.ts +9 -0
- package/data/build/dist/host/cli-adapters/tool-observation.js +39 -0
- package/data/build/dist/host/control-api-client.d.ts +84 -0
- package/data/build/dist/host/control-api-client.js +130 -0
- package/data/build/dist/host/credential-store.d.ts +54 -0
- package/data/build/dist/host/credential-store.js +114 -0
- package/data/build/dist/host/debug.d.ts +79 -0
- package/data/build/dist/host/debug.js +295 -0
- package/data/build/dist/host/dsh-device-runtime.d.ts +39 -0
- package/data/build/dist/host/dsh-device-runtime.js +118 -0
- package/data/build/dist/host/dsh-gateway-feature.d.ts +5 -0
- package/data/build/dist/host/dsh-gateway-feature.js +55 -0
- package/data/build/dist/host/dsh-runtime-version.d.ts +12 -0
- package/data/build/dist/host/dsh-runtime-version.js +69 -0
- package/data/build/dist/host/features/auth.d.ts +11 -0
- package/data/build/dist/host/features/auth.js +273 -0
- package/data/build/dist/host/features/debug.d.ts +5 -0
- package/data/build/dist/host/features/debug.js +90 -0
- package/data/build/dist/host/features/host-status.d.ts +12 -0
- package/data/build/dist/host/features/host-status.js +54 -0
- package/data/build/dist/host/features/index.d.ts +19 -0
- package/data/build/dist/host/features/index.js +29 -0
- package/data/build/dist/host/features/lan-access-dsh.d.ts +8 -0
- package/data/build/dist/host/features/lan-access-dsh.js +45 -0
- package/data/build/dist/host/features/terminal-process.d.ts +5 -0
- package/data/build/dist/host/features/terminal-process.js +110 -0
- package/data/build/dist/host/features/terminal-status.d.ts +18 -0
- package/data/build/dist/host/features/terminal-status.js +56 -0
- package/data/build/dist/host/features/types.d.ts +41 -0
- package/data/build/dist/host/features/types.js +2 -0
- package/data/build/dist/host/index.d.ts +43 -0
- package/data/build/dist/host/index.js +135 -0
- package/data/build/dist/host/lan-access-dsh.d.ts +83 -0
- package/data/build/dist/host/lan-access-dsh.js +831 -0
- package/data/build/dist/host/native-session-bridge.d.ts +130 -0
- package/data/build/dist/host/native-session-bridge.js +317 -0
- package/data/build/dist/host/relay-tunnel-runtime.d.ts +97 -0
- package/data/build/dist/host/relay-tunnel-runtime.js +361 -0
- package/data/build/dist/host/remote-web-runtime.d.ts +78 -0
- package/data/build/dist/host/remote-web-runtime.js +559 -0
- package/data/build/dist/host/rpc-table.d.ts +32 -0
- package/data/build/dist/host/rpc-table.js +47 -0
- package/data/build/dist/host/rpc.d.ts +18 -0
- package/data/build/dist/host/rpc.js +248 -0
- package/data/build/dist/host/settings.d.ts +19 -0
- package/data/build/dist/host/settings.js +80 -0
- package/data/build/dist/host/terminal/attachment-registry.d.ts +17 -0
- package/data/build/dist/host/terminal/attachment-registry.js +49 -0
- package/data/build/dist/host/terminal/backends/conpty-backend.d.ts +39 -0
- package/data/build/dist/host/terminal/backends/conpty-backend.js +160 -0
- package/data/build/dist/host/terminal/backends/local-pty-backend.d.ts +36 -0
- package/data/build/dist/host/terminal/backends/local-pty-backend.js +178 -0
- package/data/build/dist/host/terminal/backends/tmux-backend.d.ts +40 -0
- package/data/build/dist/host/terminal/backends/tmux-backend.js +191 -0
- package/data/build/dist/host/terminal/broker/conpty-broker-client.d.ts +27 -0
- package/data/build/dist/host/terminal/broker/conpty-broker-client.js +154 -0
- package/data/build/dist/host/terminal/broker/conpty-broker-process.d.ts +10 -0
- package/data/build/dist/host/terminal/broker/conpty-broker-process.js +147 -0
- package/data/build/dist/host/terminal/broker/conpty-broker-protocol.d.ts +92 -0
- package/data/build/dist/host/terminal/broker/conpty-broker-protocol.js +134 -0
- package/data/build/dist/host/terminal/controller-factory.d.ts +37 -0
- package/data/build/dist/host/terminal/controller-factory.js +82 -0
- package/data/build/dist/host/terminal/index.d.ts +17 -0
- package/data/build/dist/host/terminal/index.js +17 -0
- package/data/build/dist/host/terminal/runtime-adapter.d.ts +77 -0
- package/data/build/dist/host/terminal/runtime-adapter.js +18 -0
- package/data/build/dist/host/terminal/runtime-manager.d.ts +41 -0
- package/data/build/dist/host/terminal/runtime-manager.js +179 -0
- package/data/build/dist/host/terminal/shell-detection.d.ts +23 -0
- package/data/build/dist/host/terminal/shell-detection.js +105 -0
- package/data/build/dist/host/terminal/startup.d.ts +33 -0
- package/data/build/dist/host/terminal/startup.js +100 -0
- package/data/build/dist/host/terminal/terminal-controller.d.ts +78 -0
- package/data/build/dist/host/terminal/terminal-controller.js +324 -0
- package/data/build/dist/host/terminal/terminal-process-service.d.ts +30 -0
- package/data/build/dist/host/terminal/terminal-process-service.js +194 -0
- package/data/build/dist/host/terminal/terminal-process-store.d.ts +45 -0
- package/data/build/dist/host/terminal/terminal-process-store.js +183 -0
- package/data/build/dist/host/terminal/terminal-service.d.ts +87 -0
- package/data/build/dist/host/terminal/terminal-service.js +528 -0
- package/data/build/dist/host/terminal/terminal-store.d.ts +49 -0
- package/data/build/dist/host/terminal/terminal-store.js +242 -0
- package/data/build/dist/index.d.ts +37 -0
- package/data/build/dist/index.js +26 -0
- package/data/build/dist/shared/contracts/auth.d.ts +122 -0
- package/data/build/dist/shared/contracts/auth.js +8 -0
- package/data/build/dist/shared/contracts/cli-adapter.d.ts +192 -0
- package/data/build/dist/shared/contracts/cli-adapter.js +2 -0
- package/data/build/dist/shared/contracts/command-code.d.ts +5 -0
- package/data/build/dist/shared/contracts/command-code.js +2 -0
- package/data/build/dist/shared/contracts/config.d.ts +113 -0
- package/data/build/dist/shared/contracts/config.js +86 -0
- package/data/build/dist/shared/contracts/debug-config.d.ts +28 -0
- package/data/build/dist/shared/contracts/debug-config.js +78 -0
- package/data/build/dist/shared/contracts/debug.d.ts +75 -0
- package/data/build/dist/shared/contracts/debug.js +121 -0
- package/data/build/dist/shared/contracts/dsh-device.d.ts +72 -0
- package/data/build/dist/shared/contracts/dsh-device.js +2 -0
- package/data/build/dist/shared/contracts/errors.d.ts +33 -0
- package/data/build/dist/shared/contracts/errors.js +41 -0
- package/data/build/dist/shared/contracts/feature.d.ts +71 -0
- package/data/build/dist/shared/contracts/feature.js +2 -0
- package/data/build/dist/shared/contracts/host-status.d.ts +14 -0
- package/data/build/dist/shared/contracts/host-status.js +2 -0
- package/data/build/dist/shared/contracts/lan-access-dsh.d.ts +30 -0
- package/data/build/dist/shared/contracts/lan-access-dsh.js +2 -0
- package/data/build/dist/shared/contracts/peer-host.d.ts +37 -0
- package/data/build/dist/shared/contracts/peer-host.js +9 -0
- package/data/build/dist/shared/contracts/signaling.d.ts +67 -0
- package/data/build/dist/shared/contracts/signaling.js +2 -0
- package/data/build/dist/shared/contracts/subscription.d.ts +69 -0
- package/data/build/dist/shared/contracts/subscription.js +2 -0
- package/data/build/dist/shared/contracts/terminal-process.d.ts +65 -0
- package/data/build/dist/shared/contracts/terminal-process.js +2 -0
- package/data/build/dist/shared/contracts/terminal.d.ts +127 -0
- package/data/build/dist/shared/contracts/terminal.js +2 -0
- package/data/build/dist/shared/contracts/transport.d.ts +45 -0
- package/data/build/dist/shared/contracts/transport.js +3 -0
- package/data/build/dist/shared/contracts/version.d.ts +19 -0
- package/data/build/dist/shared/contracts/version.js +74 -0
- package/data/build/dist/shared/index.d.ts +22 -0
- package/data/build/dist/shared/index.js +9 -0
- package/data/build/dist/transport/carrier.d.ts +38 -0
- package/data/build/dist/transport/carrier.js +268 -0
- package/data/build/dist/transport/debug.d.ts +22 -0
- package/data/build/dist/transport/debug.js +57 -0
- package/data/build/dist/transport/dsh-envelope.d.ts +41 -0
- package/data/build/dist/transport/dsh-envelope.js +107 -0
- package/data/build/dist/transport/dsh-gateway.d.ts +64 -0
- package/data/build/dist/transport/dsh-gateway.js +254 -0
- package/data/build/dist/transport/dsh-session.d.ts +55 -0
- package/data/build/dist/transport/dsh-session.js +256 -0
- package/data/build/dist/transport/dsh-transport.d.ts +57 -0
- package/data/build/dist/transport/dsh-transport.js +125 -0
- package/data/build/dist/transport/frame.d.ts +132 -0
- package/data/build/dist/transport/frame.js +168 -0
- package/data/build/dist/transport/index.d.ts +11 -0
- package/data/build/dist/transport/index.js +11 -0
- package/data/build/dist/transport/multiplexer.d.ts +63 -0
- package/data/build/dist/transport/multiplexer.js +323 -0
- package/data/build/dist/transport/webrtc-client.d.ts +65 -0
- package/data/build/dist/transport/webrtc-client.js +255 -0
- package/data/build/dist/transport/webrtc-host.d.ts +58 -0
- package/data/build/dist/transport/webrtc-host.js +252 -0
- package/data/build/dist/typert.host.d.ts +25 -0
- package/data/build/dist/typert.host.js +150 -0
- package/dsh.bundle.patch +12 -0
- package/package.json +135 -0
- package/profile/README.md +27 -0
- package/profile/cordis.patch.yml +2 -0
- package/profile/package.json +20 -0
- package/profile/scripts/check-dsh-install.mjs +71 -0
- package/profile/version.json +5 -0
- package/scripts/check-dsh-install.mjs +88 -0
- package/version.json +6 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { RelayIceServer, RelaySignalingTicketRequest, RelaySignalingTicketResponse } from '../shared/contracts/signaling.js';
|
|
2
|
+
import type { CodingNsControlApiClient } from '../host/control-api-client.js';
|
|
3
|
+
import { type CodingNsCarrier, type DataChannelLike } from './carrier.js';
|
|
4
|
+
import { type PeerConnectionLike, type SignalingSocketLike } from './webrtc-client.js';
|
|
5
|
+
import { type DshTransportDebugLogger } from './debug.js';
|
|
6
|
+
/** Host 侧每个客户端会话使用一个独立的 PeerConnection。真实 Node WebRTC 实现由调用方注入。 */
|
|
7
|
+
export interface HostPeerConnectionLike extends Omit<PeerConnectionLike, 'createDataChannel' | 'createOffer'> {
|
|
8
|
+
readonly connectionState?: string;
|
|
9
|
+
readonly iceConnectionState?: string;
|
|
10
|
+
createAnswer(): Promise<{
|
|
11
|
+
type: 'answer';
|
|
12
|
+
sdp?: string;
|
|
13
|
+
}>;
|
|
14
|
+
ondatachannel: ((event: {
|
|
15
|
+
channel: DataChannelLike;
|
|
16
|
+
}) => void) | null;
|
|
17
|
+
}
|
|
18
|
+
export interface HostSignalingTicketRequest {
|
|
19
|
+
bindingId: string;
|
|
20
|
+
hostDtlsFingerprint: string;
|
|
21
|
+
credentialVersion?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface WebRtcHostAcceptorOptions {
|
|
24
|
+
signalingTicket: RelaySignalingTicketResponse;
|
|
25
|
+
signalingSocketFactory(url: string): Promise<SignalingSocketLike> | SignalingSocketLike;
|
|
26
|
+
peerConnectionFactory(options: {
|
|
27
|
+
iceServers: RelayIceServer[];
|
|
28
|
+
iceTransportPolicy: 'all' | 'relay';
|
|
29
|
+
}): HostPeerConnectionLike;
|
|
30
|
+
channelLabel?: string;
|
|
31
|
+
onConnection?: (connection: WebRtcHostSession) => void | Promise<void>;
|
|
32
|
+
onSessionClosed?: (sessionId: string) => void | Promise<void>;
|
|
33
|
+
debug?: DshTransportDebugLogger;
|
|
34
|
+
}
|
|
35
|
+
export interface WebRtcHostSession {
|
|
36
|
+
readonly sessionId: string;
|
|
37
|
+
readonly peerConnection: HostPeerConnectionLike;
|
|
38
|
+
readonly carrier: CodingNsCarrier | null;
|
|
39
|
+
close(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export interface WebRtcHostAcceptor {
|
|
42
|
+
readonly signaling: SignalingSocketLike;
|
|
43
|
+
readonly sessions: ReadonlyMap<string, WebRtcHostSession>;
|
|
44
|
+
close(): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 构造 Host 申请角色票据的请求 DTO,并在进入 Control API 前检查边界。
|
|
48
|
+
* 指纹只做非空和控制字符校验,具体格式由 Codingns4DSH 绑定记录比较逻辑决定。
|
|
49
|
+
*/
|
|
50
|
+
export declare function createHostSignalingTicketRequest(input: HostSignalingTicketRequest): RelaySignalingTicketRequest;
|
|
51
|
+
/** 通过已认证 Host 控制面会话申请 Host 角色信令票据。 */
|
|
52
|
+
export declare function requestHostSignalingTicket(controlClient: Pick<CodingNsControlApiClient, 'createSignalingTicket'>, accessToken: string, input: HostSignalingTicketRequest): Promise<RelaySignalingTicketResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* 接收客户端 offer 并回传 answer 的 Host 侧 WebRTC 骨架。
|
|
55
|
+
* 该函数只编排信令和可注入的 PeerConnection,不创建 Node WebRTC runtime 或网络服务。
|
|
56
|
+
*/
|
|
57
|
+
export declare function acceptWebRtcHost(options: WebRtcHostAcceptorOptions): Promise<WebRtcHostAcceptor>;
|
|
58
|
+
//# sourceMappingURL=webrtc-host.d.ts.map
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { createDataChannelCarrier, createRelayTunnelHostCarrier, TUNNEL_DATA_CHANNEL_LABEL } from './carrier.js';
|
|
2
|
+
import { createSignalingUrl, waitForSignalingRegistered, } from './webrtc-client.js';
|
|
3
|
+
import { createDshTransportDebugLogger } from './debug.js';
|
|
4
|
+
/**
|
|
5
|
+
* 构造 Host 申请角色票据的请求 DTO,并在进入 Control API 前检查边界。
|
|
6
|
+
* 指纹只做非空和控制字符校验,具体格式由 Codingns4DSH 绑定记录比较逻辑决定。
|
|
7
|
+
*/
|
|
8
|
+
export function createHostSignalingTicketRequest(input) {
|
|
9
|
+
if (/[\r\n]/u.test(input.hostDtlsFingerprint)) {
|
|
10
|
+
throw new TypeError('Host signaling ticket 的 DTLS fingerprint 无效');
|
|
11
|
+
}
|
|
12
|
+
const bindingId = input.bindingId.trim();
|
|
13
|
+
const hostDtlsFingerprint = input.hostDtlsFingerprint.trim();
|
|
14
|
+
if (!bindingId)
|
|
15
|
+
throw new TypeError('Host signaling ticket 的 bindingId 不能为空');
|
|
16
|
+
if (!hostDtlsFingerprint) {
|
|
17
|
+
throw new TypeError('Host signaling ticket 的 DTLS fingerprint 无效');
|
|
18
|
+
}
|
|
19
|
+
if (input.credentialVersion !== undefined
|
|
20
|
+
&& (!Number.isInteger(input.credentialVersion) || input.credentialVersion < 1)) {
|
|
21
|
+
throw new TypeError('Host signaling ticket 的 credentialVersion 必须是正整数');
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
bindingId,
|
|
25
|
+
hostDtlsFingerprint,
|
|
26
|
+
...(input.credentialVersion === undefined ? {} : { credentialVersion: input.credentialVersion }),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** 通过已认证 Host 控制面会话申请 Host 角色信令票据。 */
|
|
30
|
+
export function requestHostSignalingTicket(controlClient, accessToken, input) {
|
|
31
|
+
if (!accessToken.trim())
|
|
32
|
+
throw new TypeError('Host signaling ticket 的 accessToken 不能为空');
|
|
33
|
+
return controlClient.createSignalingTicket(accessToken, createHostSignalingTicketRequest(input));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 接收客户端 offer 并回传 answer 的 Host 侧 WebRTC 骨架。
|
|
37
|
+
* 该函数只编排信令和可注入的 PeerConnection,不创建 Node WebRTC runtime 或网络服务。
|
|
38
|
+
*/
|
|
39
|
+
export async function acceptWebRtcHost(options) {
|
|
40
|
+
validateHostTicket(options.signalingTicket);
|
|
41
|
+
const debug = options.debug ?? createDshTransportDebugLogger({ side: 'host', component: 'webrtc-host' });
|
|
42
|
+
const signaling = await options.signalingSocketFactory(createSignalingUrl(options.signalingTicket.signalingBaseUrl, options.signalingTicket.ticket));
|
|
43
|
+
if ('readyState' in signaling) {
|
|
44
|
+
await waitForSignalingRegistered(signaling, 15_000);
|
|
45
|
+
}
|
|
46
|
+
const heartbeat = 'readyState' in signaling
|
|
47
|
+
? setInterval(() => {
|
|
48
|
+
if (signaling.readyState === 1) {
|
|
49
|
+
try {
|
|
50
|
+
signaling.send(JSON.stringify({ type: 'ping', at: new Date().toISOString() }));
|
|
51
|
+
}
|
|
52
|
+
catch { /* 断线由 close 处理 */ }
|
|
53
|
+
}
|
|
54
|
+
}, 20_000)
|
|
55
|
+
: undefined;
|
|
56
|
+
const sessions = new Map();
|
|
57
|
+
const queuedCandidates = new Map();
|
|
58
|
+
let closed = false;
|
|
59
|
+
const onMessage = (event) => {
|
|
60
|
+
const raw = event.data;
|
|
61
|
+
if (typeof raw !== 'string')
|
|
62
|
+
return;
|
|
63
|
+
let message;
|
|
64
|
+
try {
|
|
65
|
+
message = JSON.parse(raw);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
debug.log('signaling.message', { type: message.type, sessionId: 'sessionId' in message ? message.sessionId : null });
|
|
71
|
+
if (message.type === 'offer') {
|
|
72
|
+
if (message.senderRole !== 'client' || !message.sessionId || !message.sdp)
|
|
73
|
+
return;
|
|
74
|
+
void handleOffer(message.sessionId, message.sdp);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (message.type === 'candidate') {
|
|
78
|
+
if (message.senderRole !== 'client' || !message.sessionId || !message.candidate)
|
|
79
|
+
return;
|
|
80
|
+
const session = sessions.get(message.sessionId);
|
|
81
|
+
if (session)
|
|
82
|
+
void session.addCandidate({ candidate: message.candidate, sdpMid: message.mid });
|
|
83
|
+
else
|
|
84
|
+
queuedCandidates.set(message.sessionId, [
|
|
85
|
+
...(queuedCandidates.get(message.sessionId) ?? []),
|
|
86
|
+
{ candidate: message.candidate, sdpMid: message.mid },
|
|
87
|
+
]);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (message.type === 'peer-left' && message.peerRole === 'client' && message.sessionId) {
|
|
91
|
+
void closeSession(message.sessionId);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const onClose = () => { void closeAllSessions(); };
|
|
95
|
+
signaling.addEventListener('message', onMessage);
|
|
96
|
+
signaling.addEventListener('close', onClose);
|
|
97
|
+
const closeSession = async (sessionId) => {
|
|
98
|
+
queuedCandidates.delete(sessionId);
|
|
99
|
+
const session = sessions.get(sessionId);
|
|
100
|
+
if (!session)
|
|
101
|
+
return;
|
|
102
|
+
sessions.delete(sessionId);
|
|
103
|
+
await session.close();
|
|
104
|
+
await options.onSessionClosed?.(sessionId);
|
|
105
|
+
};
|
|
106
|
+
const closeAllSessions = async () => {
|
|
107
|
+
const current = [...sessions.keys()];
|
|
108
|
+
await Promise.all(current.map((sessionId) => closeSession(sessionId)));
|
|
109
|
+
};
|
|
110
|
+
const handleOffer = async (sessionId, sdp) => {
|
|
111
|
+
if (closed)
|
|
112
|
+
return;
|
|
113
|
+
let session = sessions.get(sessionId);
|
|
114
|
+
if (!session) {
|
|
115
|
+
session = new HostSessionImpl(sessionId, options.peerConnectionFactory({
|
|
116
|
+
iceServers: options.signalingTicket.iceServers,
|
|
117
|
+
iceTransportPolicy: options.signalingTicket.iceTransportPolicy,
|
|
118
|
+
}), signaling, options.onConnection, () => { void closeSession(sessionId); }, TUNNEL_DATA_CHANNEL_LABEL, options.debug);
|
|
119
|
+
sessions.set(sessionId, session);
|
|
120
|
+
}
|
|
121
|
+
await session.answerOffer(sdp);
|
|
122
|
+
const candidates = queuedCandidates.get(sessionId) ?? [];
|
|
123
|
+
queuedCandidates.delete(sessionId);
|
|
124
|
+
for (const candidate of candidates)
|
|
125
|
+
await session.addCandidate(candidate);
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
signaling,
|
|
129
|
+
get sessions() { return sessions; },
|
|
130
|
+
async close() {
|
|
131
|
+
if (closed)
|
|
132
|
+
return;
|
|
133
|
+
closed = true;
|
|
134
|
+
if (heartbeat !== undefined)
|
|
135
|
+
clearInterval(heartbeat);
|
|
136
|
+
signaling.removeEventListener('message', onMessage);
|
|
137
|
+
signaling.removeEventListener('close', onClose);
|
|
138
|
+
await closeAllSessions();
|
|
139
|
+
signaling.close(1000, 'host closed');
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
class HostSessionImpl {
|
|
144
|
+
sessionId;
|
|
145
|
+
peerConnection;
|
|
146
|
+
signaling;
|
|
147
|
+
onConnection;
|
|
148
|
+
onTransportClosed;
|
|
149
|
+
debug;
|
|
150
|
+
_carrier = null;
|
|
151
|
+
closed = false;
|
|
152
|
+
offerPromise = null;
|
|
153
|
+
remoteDescriptionReady = false;
|
|
154
|
+
pendingCandidates = [];
|
|
155
|
+
constructor(sessionId, peerConnection, signaling, onConnection, onTransportClosed, channelLabel, debug) {
|
|
156
|
+
this.sessionId = sessionId;
|
|
157
|
+
this.peerConnection = peerConnection;
|
|
158
|
+
this.signaling = signaling;
|
|
159
|
+
this.onConnection = onConnection;
|
|
160
|
+
this.onTransportClosed = onTransportClosed;
|
|
161
|
+
this.debug = debug;
|
|
162
|
+
this.peerConnection.addEventListener?.('connectionstatechange', this.onPeerState);
|
|
163
|
+
this.peerConnection.addEventListener?.('iceconnectionstatechange', this.onPeerState);
|
|
164
|
+
this.peerConnection.onicecandidate = (event) => {
|
|
165
|
+
if (this.closed || !event.candidate)
|
|
166
|
+
return;
|
|
167
|
+
this.signaling.send(JSON.stringify({
|
|
168
|
+
type: 'candidate',
|
|
169
|
+
candidate: event.candidate.candidate,
|
|
170
|
+
mid: event.candidate.sdpMid,
|
|
171
|
+
sessionId: this.sessionId,
|
|
172
|
+
}));
|
|
173
|
+
};
|
|
174
|
+
this.peerConnection.ondatachannel = (event) => {
|
|
175
|
+
if (this.closed)
|
|
176
|
+
return;
|
|
177
|
+
const channel = event.channel;
|
|
178
|
+
if (channelLabel && 'label' in channel && typeof channel.label === 'string'
|
|
179
|
+
&& channel.label !== channelLabel) {
|
|
180
|
+
channel.close();
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (this._carrier)
|
|
184
|
+
void this._carrier.close();
|
|
185
|
+
this.debug?.log('data-channel.accepted', { sessionId: this.sessionId, label: channel.label ?? null });
|
|
186
|
+
this._carrier = createRelayTunnelHostCarrier(createDataChannelCarrier(channel, { ...(this.debug ? { debug: this.debug } : {}) }), this.debug);
|
|
187
|
+
this._carrier.onClosed?.(() => { void this.onTransportClosed(); });
|
|
188
|
+
void this.onConnection?.(this);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
get carrier() { return this._carrier; }
|
|
192
|
+
answerOffer(sdp) {
|
|
193
|
+
if (this.offerPromise)
|
|
194
|
+
return this.offerPromise;
|
|
195
|
+
this.offerPromise = this.answerOfferOnce(sdp).finally(() => { this.offerPromise = null; });
|
|
196
|
+
return this.offerPromise;
|
|
197
|
+
}
|
|
198
|
+
async addCandidate(candidate) {
|
|
199
|
+
if (this.closed)
|
|
200
|
+
return;
|
|
201
|
+
if (!this.remoteDescriptionReady) {
|
|
202
|
+
this.pendingCandidates.push(candidate);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
await this.peerConnection.addIceCandidate(candidate);
|
|
206
|
+
}
|
|
207
|
+
async answerOfferOnce(sdp) {
|
|
208
|
+
if (this.closed)
|
|
209
|
+
return;
|
|
210
|
+
await this.peerConnection.setRemoteDescription({ type: 'offer', sdp });
|
|
211
|
+
this.remoteDescriptionReady = true;
|
|
212
|
+
const pendingCandidates = this.pendingCandidates.splice(0);
|
|
213
|
+
for (const candidate of pendingCandidates)
|
|
214
|
+
await this.peerConnection.addIceCandidate(candidate);
|
|
215
|
+
const answer = await this.peerConnection.createAnswer();
|
|
216
|
+
await this.peerConnection.setLocalDescription(answer);
|
|
217
|
+
if (!this.closed) {
|
|
218
|
+
this.signaling.send(JSON.stringify({ type: 'answer', sdp: answer.sdp ?? '', sessionId: this.sessionId }));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
async close() {
|
|
222
|
+
if (this.closed)
|
|
223
|
+
return;
|
|
224
|
+
this.closed = true;
|
|
225
|
+
this.peerConnection.onicecandidate = null;
|
|
226
|
+
this.peerConnection.ondatachannel = null;
|
|
227
|
+
this.peerConnection.removeEventListener?.('connectionstatechange', this.onPeerState);
|
|
228
|
+
this.peerConnection.removeEventListener?.('iceconnectionstatechange', this.onPeerState);
|
|
229
|
+
await this._carrier?.close();
|
|
230
|
+
this._carrier = null;
|
|
231
|
+
this.peerConnection.close();
|
|
232
|
+
}
|
|
233
|
+
onPeerState = () => {
|
|
234
|
+
const state = this.peerConnection;
|
|
235
|
+
const value = state.connectionState ?? state.iceConnectionState;
|
|
236
|
+
if (value === 'failed' || value === 'disconnected' || value === 'closed')
|
|
237
|
+
void this.onTransportClosed();
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function validateHostTicket(ticket) {
|
|
241
|
+
if (!ticket.ticket.trim() || !ticket.bindingId.trim() || !ticket.signalingBaseUrl.trim()) {
|
|
242
|
+
throw new TypeError('Host signaling ticket 缺少必需字段');
|
|
243
|
+
}
|
|
244
|
+
if (!ticket.hostDtlsFingerprint.trim() || /[\r\n]/u.test(ticket.hostDtlsFingerprint)) {
|
|
245
|
+
throw new TypeError('Host signaling ticket 的 DTLS fingerprint 无效');
|
|
246
|
+
}
|
|
247
|
+
if (ticket.credentialVersion !== undefined
|
|
248
|
+
&& (!Number.isInteger(ticket.credentialVersion) || ticket.credentialVersion < 1)) {
|
|
249
|
+
throw new TypeError('Host signaling ticket 的 credentialVersion 无效');
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=webrtc-host.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const TYPERT: {
|
|
2
|
+
readonly package: "codingns4dsh";
|
|
3
|
+
readonly face: "host";
|
|
4
|
+
readonly schemas: readonly [];
|
|
5
|
+
readonly invocations: readonly [Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>];
|
|
6
|
+
readonly model: {
|
|
7
|
+
readonly services: readonly [{
|
|
8
|
+
readonly description: "codingns4dsh Sidebar 终端 UI 使用的兼容 controller。";
|
|
9
|
+
readonly summary: "Codingns4DSH 终端 controller";
|
|
10
|
+
readonly tags: readonly [];
|
|
11
|
+
readonly jsDoc: "/** codingns4dsh Sidebar 终端 UI 使用的兼容 controller。 */";
|
|
12
|
+
readonly key: "terminalController";
|
|
13
|
+
readonly exportName: "CodingNsTerminalController";
|
|
14
|
+
readonly members: {
|
|
15
|
+
name: string;
|
|
16
|
+
signature: string;
|
|
17
|
+
kind: string;
|
|
18
|
+
}[];
|
|
19
|
+
readonly types: readonly [];
|
|
20
|
+
}];
|
|
21
|
+
readonly events: readonly [];
|
|
22
|
+
readonly objects: readonly [];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=typert.host.d.ts.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* codingns4dsh 自有的 Typert Host artifact。
|
|
3
|
+
*
|
|
4
|
+
* 这里不能重导出官方 terminal-controller 的 TYPERT:DSH loader 会校验
|
|
5
|
+
* manifest.package 必须属于实际导出它的 npm 包。下面的 endpoint、wire 字段和
|
|
6
|
+
* codec 与 DSH 0.1.6-alpha.2 对齐,但 package 与 invocation id 均归本包所有。
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
const sessionIdSchema = z.string();
|
|
10
|
+
const terminalIdSchema = z.string();
|
|
11
|
+
const attachmentIdSchema = z.string();
|
|
12
|
+
const shellSchema = z.object({
|
|
13
|
+
path: z.string().readonly(),
|
|
14
|
+
args: z.array(z.string()).readonly(),
|
|
15
|
+
name: z.string().readonly(),
|
|
16
|
+
});
|
|
17
|
+
const terminalInfoSchema = z.object({
|
|
18
|
+
id: terminalIdSchema.readonly(),
|
|
19
|
+
title: z.string().readonly(),
|
|
20
|
+
shell: shellSchema.readonly(),
|
|
21
|
+
cwd: z.string().readonly(),
|
|
22
|
+
cols: z.number().readonly(),
|
|
23
|
+
rows: z.number().readonly(),
|
|
24
|
+
state: z.union([z.literal('running'), z.literal('failed'), z.literal('exited')]).readonly(),
|
|
25
|
+
exitCode: z.union([z.literal(null), z.number()]).readonly(),
|
|
26
|
+
error: z.string().readonly().optional(),
|
|
27
|
+
controllerId: attachmentIdSchema.readonly().optional(),
|
|
28
|
+
});
|
|
29
|
+
const environmentSchema = z.object({
|
|
30
|
+
cwd: z.string().readonly(),
|
|
31
|
+
workspaceId: z.string().readonly().optional(),
|
|
32
|
+
maxInputBytes: z.number().readonly(),
|
|
33
|
+
maxCols: z.number().readonly(),
|
|
34
|
+
maxRows: z.number().readonly(),
|
|
35
|
+
scrollback: z.number().readonly(),
|
|
36
|
+
});
|
|
37
|
+
const createRequestSchema = z.object({
|
|
38
|
+
shellPath: z.string().readonly().optional(),
|
|
39
|
+
id: terminalIdSchema.readonly(),
|
|
40
|
+
cols: z.number().readonly(),
|
|
41
|
+
rows: z.number().readonly(),
|
|
42
|
+
});
|
|
43
|
+
const terminalFrameSchema = z.union([
|
|
44
|
+
z.object({
|
|
45
|
+
type: z.literal('snapshot').readonly(),
|
|
46
|
+
sequence: z.number().readonly(),
|
|
47
|
+
screen: z.string().readonly(),
|
|
48
|
+
info: terminalInfoSchema.readonly(),
|
|
49
|
+
}),
|
|
50
|
+
z.object({
|
|
51
|
+
type: z.literal('output').readonly(),
|
|
52
|
+
sequence: z.number().readonly(),
|
|
53
|
+
data: z.string().readonly(),
|
|
54
|
+
}),
|
|
55
|
+
z.object({
|
|
56
|
+
type: z.literal('state').readonly(),
|
|
57
|
+
info: terminalInfoSchema.readonly(),
|
|
58
|
+
}),
|
|
59
|
+
]);
|
|
60
|
+
function codec(typeSymbol, schema) {
|
|
61
|
+
return { mode: 'strict', typeSymbol, schema, create: () => schema };
|
|
62
|
+
}
|
|
63
|
+
function json(name, wire, typeSymbol, schema) {
|
|
64
|
+
return { name, wire, source: 'json', codec: codec(typeSymbol, schema) };
|
|
65
|
+
}
|
|
66
|
+
function agent() {
|
|
67
|
+
return {
|
|
68
|
+
name: 'agent',
|
|
69
|
+
wire: 'agentId',
|
|
70
|
+
source: 'lookup',
|
|
71
|
+
lookup: 'agent',
|
|
72
|
+
codec: codec('@deepseek-ai/dsh-session/types#SessionId', sessionIdSchema),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function invocation(method, parameters, result, options = {}) {
|
|
76
|
+
return {
|
|
77
|
+
id: `codingns4dsh#terminal/${method}`,
|
|
78
|
+
service: 'terminalController',
|
|
79
|
+
namespace: 'terminal',
|
|
80
|
+
method,
|
|
81
|
+
...(options.stream === true ? { mode: 'stream' } : {}),
|
|
82
|
+
invocation: { kind: 'direct' },
|
|
83
|
+
...(options.agentScoped === true ? { scope: { context: 'agent', wire: 'agentId' } } : {}),
|
|
84
|
+
parameters,
|
|
85
|
+
...(options.cancellable === true ? { cancellation: { parameter: 'signal' } } : {}),
|
|
86
|
+
result,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const voidResult = (method) => codec(`codingns4dsh#terminal/${method}:result`, z.void());
|
|
90
|
+
const idParameter = () => json('id', 'id', 'codingns4dsh/shared#WebTerminalId', terminalIdSchema);
|
|
91
|
+
const attachmentParameter = () => json('attachmentId', 'attachmentId', 'codingns4dsh/shared#TerminalAttachmentId', attachmentIdSchema);
|
|
92
|
+
export const TYPERT = {
|
|
93
|
+
package: 'codingns4dsh',
|
|
94
|
+
face: 'host',
|
|
95
|
+
schemas: [],
|
|
96
|
+
invocations: [
|
|
97
|
+
invocation('close', [agent(), idParameter()], voidResult('close'), { agentScoped: true }),
|
|
98
|
+
invocation('create', [
|
|
99
|
+
agent(),
|
|
100
|
+
json('request', 'request', 'codingns4dsh/shared#CodingNsTerminalCreateRequest', createRequestSchema),
|
|
101
|
+
], codec('codingns4dsh/shared#CodingNsWebTerminalInfo', terminalInfoSchema), {
|
|
102
|
+
agentScoped: true,
|
|
103
|
+
cancellable: true,
|
|
104
|
+
}),
|
|
105
|
+
invocation('environment', [agent()], codec('codingns4dsh/shared#CodingNsTerminalEnvironment', environmentSchema), { agentScoped: true, cancellable: true }),
|
|
106
|
+
invocation('follow', [agent(), idParameter(), attachmentParameter()], codec('codingns4dsh/shared#CodingNsTerminalFrame', terminalFrameSchema), { agentScoped: true, cancellable: true, stream: true }),
|
|
107
|
+
invocation('list', [json('sessionId', 'sessionId', '@deepseek-ai/dsh-session/types#SessionId', sessionIdSchema)], codec('codingns4dsh#terminal/list:result', z.array(terminalInfoSchema))),
|
|
108
|
+
invocation('rename', [
|
|
109
|
+
agent(),
|
|
110
|
+
idParameter(),
|
|
111
|
+
json('title', 'title', 'codingns4dsh#terminal/rename:title', z.string()),
|
|
112
|
+
], voidResult('rename'), { agentScoped: true }),
|
|
113
|
+
invocation('resize', [
|
|
114
|
+
agent(),
|
|
115
|
+
idParameter(),
|
|
116
|
+
attachmentParameter(),
|
|
117
|
+
json('cols', 'cols', 'codingns4dsh#terminal/resize:cols', z.number()),
|
|
118
|
+
json('rows', 'rows', 'codingns4dsh#terminal/resize:rows', z.number()),
|
|
119
|
+
], voidResult('resize'), { agentScoped: true }),
|
|
120
|
+
invocation('retain', [
|
|
121
|
+
json('sessionId', 'sessionId', '@deepseek-ai/dsh-session/types#SessionId', sessionIdSchema),
|
|
122
|
+
idParameter(),
|
|
123
|
+
], codec('codingns4dsh/shared#CodingNsTerminalRetentionFrame', z.object({ type: z.literal('retained').readonly() })), { cancellable: true, stream: true }),
|
|
124
|
+
invocation('shells', [agent()], codec('codingns4dsh#terminal/shells:result', z.array(shellSchema)), { agentScoped: true, cancellable: true }),
|
|
125
|
+
invocation('write', [
|
|
126
|
+
agent(),
|
|
127
|
+
idParameter(),
|
|
128
|
+
attachmentParameter(),
|
|
129
|
+
json('data', 'data', 'codingns4dsh#terminal/write:data', z.string()),
|
|
130
|
+
], voidResult('write'), { agentScoped: true }),
|
|
131
|
+
],
|
|
132
|
+
model: {
|
|
133
|
+
services: [{
|
|
134
|
+
description: 'codingns4dsh Sidebar 终端 UI 使用的兼容 controller。',
|
|
135
|
+
summary: 'Codingns4DSH 终端 controller',
|
|
136
|
+
tags: [],
|
|
137
|
+
jsDoc: '/** codingns4dsh Sidebar 终端 UI 使用的兼容 controller。 */',
|
|
138
|
+
key: 'terminalController',
|
|
139
|
+
exportName: 'CodingNsTerminalController',
|
|
140
|
+
members: [
|
|
141
|
+
'environment', 'shells', 'list', 'create', 'retain',
|
|
142
|
+
'follow', 'write', 'resize', 'rename', 'close',
|
|
143
|
+
].map((name) => ({ name, signature: `${name}(...)`, kind: 'method' })),
|
|
144
|
+
types: [],
|
|
145
|
+
}],
|
|
146
|
+
events: [],
|
|
147
|
+
objects: [],
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=typert.host.js.map
|
package/dsh.bundle.patch
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# 官方终端 Host 与 Client 行必须成对停用,避免重复 terminal namespace 和
|
|
2
|
+
# webTerminals service;codingns4dsh 在同一个 Bundle generation 中提供两者。
|
|
3
|
+
# rc3 没有这两个行,DSH 会按可选 patch 记录 warning 并继续启动;alpha2 则会正常命中。
|
|
4
|
+
- id: terminal-controller
|
|
5
|
+
name: '@deepseek-ai/dsh-api-terminal-controller'
|
|
6
|
+
disabled: true
|
|
7
|
+
- id: ui-sidebar-terminal
|
|
8
|
+
name: '@deepseek-ai/dsh-client-ui-sidebar-terminal'
|
|
9
|
+
disabled: true
|
|
10
|
+
- insert:
|
|
11
|
+
- id: codingns4dsh
|
|
12
|
+
name: '@jingyi0605/codingns4dsh'
|
package/package.json
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jingyi0605/codingns4dsh",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Codingns4DSH 的 DeepSeek Harness 插件骨架与连接契约",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./data/build/dist/index.js",
|
|
7
|
+
"types": "./data/build/dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./data/build/dist/index.d.ts",
|
|
11
|
+
"default": "./data/build/dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./host": {
|
|
14
|
+
"types": "./data/build/dist/host/index.d.ts",
|
|
15
|
+
"default": "./data/build/dist/host/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./typert": {
|
|
18
|
+
"types": "./data/build/dist/typert.host.d.ts",
|
|
19
|
+
"default": "./data/build/dist/typert.host.js"
|
|
20
|
+
},
|
|
21
|
+
"./client": {
|
|
22
|
+
"types": "./data/build/dist/client/index.d.ts",
|
|
23
|
+
"default": "./data/build/dist/client/bundle.js"
|
|
24
|
+
},
|
|
25
|
+
"./client/lan-access": {
|
|
26
|
+
"types": "./data/build/dist/client/lan-access.d.ts",
|
|
27
|
+
"default": "./data/build/dist/client/lan-access.js"
|
|
28
|
+
},
|
|
29
|
+
"./bootstrap": {
|
|
30
|
+
"types": "./data/build/dist/bootstrap/index.d.ts",
|
|
31
|
+
"default": "./data/build/dist/bootstrap/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./shared": {
|
|
34
|
+
"types": "./data/build/dist/shared/index.d.ts",
|
|
35
|
+
"default": "./data/build/dist/shared/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./features": {
|
|
38
|
+
"types": "./data/build/dist/features/index.d.ts",
|
|
39
|
+
"default": "./data/build/dist/features/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./transport": {
|
|
42
|
+
"types": "./data/build/dist/transport/index.d.ts",
|
|
43
|
+
"default": "./data/build/dist/transport/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"dsh": ">=0.1.5-rc.3 <0.1.7-0",
|
|
49
|
+
"node": ">=22.19.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@deepseek-ai/dsh": ">=0.1.5-rc.3 <0.1.7-0"
|
|
53
|
+
},
|
|
54
|
+
"dsh": {
|
|
55
|
+
"manifestVersion": 1,
|
|
56
|
+
"bundle": {
|
|
57
|
+
"patch": "./dsh.bundle.patch"
|
|
58
|
+
},
|
|
59
|
+
"client": {
|
|
60
|
+
"inject": [
|
|
61
|
+
"@deepseek-ai/dsh-api-remotes",
|
|
62
|
+
"@deepseek-ai/dsh-client-locale",
|
|
63
|
+
"@deepseek-ai/dsh-client-connection",
|
|
64
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
65
|
+
"@deepseek-ai/dsh-client-ui-layout",
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
68
|
+
"@deepseek-ai/dsh-client-ui-session",
|
|
69
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right",
|
|
70
|
+
"@deepseek-ai/dsh-client-ui-theme"
|
|
71
|
+
],
|
|
72
|
+
"platform": "web",
|
|
73
|
+
"immediately": true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"preinstall": "node scripts/check-dsh-install.mjs",
|
|
78
|
+
"version:check": "node scripts/check-version-sync.mjs",
|
|
79
|
+
"version:set-plugin": "node scripts/set-plugin-version.mjs",
|
|
80
|
+
"version:set-dsh": "node scripts/set-dsh-version.mjs",
|
|
81
|
+
"prebuild": "pnpm run version:check",
|
|
82
|
+
"build": "node scripts/clean-dist.mjs && tsc -p tsconfig.json && pnpm run bundle:client && pnpm run bundle:h5",
|
|
83
|
+
"prepack": "pnpm run build",
|
|
84
|
+
"publish:local": "bash scripts/publish-npm-package.sh",
|
|
85
|
+
"bundle:client": "tsdown",
|
|
86
|
+
"bundle:h5": "tsdown --config tsdown.h5.config.ts",
|
|
87
|
+
"dev:link": "node scripts/link-dsh-dev.mjs",
|
|
88
|
+
"dev:watch": "node scripts/dev-watch.mjs",
|
|
89
|
+
"watch:client": "tsdown --watch",
|
|
90
|
+
"test": "pnpm run build && node --test tests/*.spec.ts",
|
|
91
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
92
|
+
},
|
|
93
|
+
"files": [
|
|
94
|
+
"data/build/dist/**/*.js",
|
|
95
|
+
"data/build/dist/**/*.d.ts",
|
|
96
|
+
"assets/provider-icons/**",
|
|
97
|
+
"dsh.bundle.patch",
|
|
98
|
+
"profile/**",
|
|
99
|
+
"version.json",
|
|
100
|
+
"README.md",
|
|
101
|
+
"package.json",
|
|
102
|
+
"scripts/check-dsh-install.mjs"
|
|
103
|
+
],
|
|
104
|
+
"devDependencies": {
|
|
105
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
106
|
+
"@deepseek-ai/dsh-client-connection": "0.1.6-alpha.2",
|
|
107
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.1.6-alpha.2",
|
|
108
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.1.6-alpha.2",
|
|
109
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.6-alpha.2",
|
|
110
|
+
"@deepseek-ai/dsh-settings": "0.1.6-alpha.2",
|
|
111
|
+
"@types/react": "~18.3.1",
|
|
112
|
+
"@types/ws": "^8.18.1",
|
|
113
|
+
"react": "^18.2.0",
|
|
114
|
+
"tsdown": "^0.22.2",
|
|
115
|
+
"typescript": "^5.9.2"
|
|
116
|
+
},
|
|
117
|
+
"dependencies": {
|
|
118
|
+
"@deepseek-ai/dsh-api-remotes": "0.1.6-alpha.2",
|
|
119
|
+
"@deepseek-ai/dsh-client-locale": "0.1.6-alpha.2",
|
|
120
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.1.6-alpha.2",
|
|
121
|
+
"@deepseek-ai/dsh-client-ui-layout": "0.1.6-alpha.2",
|
|
122
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.1.6-alpha.2",
|
|
123
|
+
"@deepseek-ai/dsh-client-ui-session": "0.1.6-alpha.2",
|
|
124
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": "0.1.6-alpha.2",
|
|
125
|
+
"@deepseek-ai/dsh-client-ui-theme": "0.1.6-alpha.2",
|
|
126
|
+
"@deepseek-ai/dsh-typert-protocol": "0.1.6-alpha.2",
|
|
127
|
+
"@deepseek-ai/schemastery": "^3.18.2",
|
|
128
|
+
"@lydell/node-pty": "1.1.0",
|
|
129
|
+
"@xterm/addon-fit": "^0.11.0",
|
|
130
|
+
"@xterm/xterm": "^6.0.0",
|
|
131
|
+
"werift": "^0.24.4",
|
|
132
|
+
"ws": "^8.21.0",
|
|
133
|
+
"zod": "^4.4.3"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Codingns4DSH DSH Profile
|
|
2
|
+
|
|
3
|
+
这是独立的 Codingns4DSH Profile,插件版本为 `0.1.0`,兼容 DSH `>=0.1.5-rc.3 <0.1.7-0`,当前测试版本为 `0.1.6-alpha.2`。
|
|
4
|
+
|
|
5
|
+
Profile 只选择 `@jingyi0605/codingns4dsh` Bundle。`cordis.patch.yml` 保持 `[]`,因为启动期
|
|
6
|
+
Transport 必须由外部 pre-Cordis 启动胶水在 DSH Client/Cordis 创建前登记,不能由
|
|
7
|
+
普通动态插件覆盖默认 `connection`。
|
|
8
|
+
|
|
9
|
+
发布后,在 DSH 的 Profile 中安装精确版本的插件 Bundle:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
dsh plugin --profile codingns4dsh add @jingyi0605/codingns4dsh@0.1.0
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Profile 安装完成后,使用 DSH 官方启动器启动:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
dsh --profile codingns4dsh --dump-config
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Profile 和插件安装前都会读取当前 `dsh --version`;版本不在 Profile 的 `engines.dsh`
|
|
22
|
+
范围内时,安装直接失败。启动时 Host、Client 和 Bootstrap 还会再次校验实际 DSH 版本,
|
|
23
|
+
不兼容版本不会启用插件。
|
|
24
|
+
|
|
25
|
+
真实 Transport 工厂完成后,桌面壳或页面应先调用 `codingns4dsh/bootstrap` 的
|
|
26
|
+
`bootWithPreCordisTransport()`,再启动 DSH Client。DSH 升级后必须先发布匹配的新
|
|
27
|
+
Profile 和启动胶水版本。
|