@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,66 @@
|
|
|
1
|
+
import { createElement, useState } from 'react';
|
|
2
|
+
import { CODINGNS_WORKSPACE_SESSION_ENHANCEMENT_FIELD, DEFAULT_WORKSPACE_SESSION_ENHANCEMENT_SETTINGS, } from '../../shared/contracts/config.js';
|
|
3
|
+
import { dshFormRootStyle, dshSettingsHelpStyle, dshSettingsListRowStyle, dshThemeColor, } from '../theme.js';
|
|
4
|
+
import { useCodingNsTranslator } from '../locale.js';
|
|
5
|
+
/** 工作区会话增强的单列设置面板。 */
|
|
6
|
+
export function WorkspaceSessionEnhancementPanel({ services, enabled, snapshot }) {
|
|
7
|
+
const t = useCodingNsTranslator(services.locale);
|
|
8
|
+
const [writeError, setWriteError] = useState(null);
|
|
9
|
+
const value = snapshot.value?.workspaceSessionEnhancement
|
|
10
|
+
?? DEFAULT_WORKSPACE_SESSION_ENHANCEMENT_SETTINGS;
|
|
11
|
+
const disabled = !enabled || snapshot.status === 'loading' || !snapshot.writable;
|
|
12
|
+
const updateSetting = (field, nextValue) => {
|
|
13
|
+
setWriteError(null);
|
|
14
|
+
void services.settings.mutate([{
|
|
15
|
+
op: 'set',
|
|
16
|
+
path: [CODINGNS_WORKSPACE_SESSION_ENHANCEMENT_FIELD, field],
|
|
17
|
+
value: nextValue,
|
|
18
|
+
}]).catch((cause) => {
|
|
19
|
+
setWriteError(cause instanceof Error ? cause.message : String(cause));
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
return createElement('div', {
|
|
23
|
+
'aria-disabled': disabled,
|
|
24
|
+
style: {
|
|
25
|
+
...dshFormRootStyle,
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'column',
|
|
28
|
+
gap: 12,
|
|
29
|
+
opacity: disabled ? 0.5 : 1,
|
|
30
|
+
pointerEvents: disabled ? 'none' : 'auto',
|
|
31
|
+
},
|
|
32
|
+
}, createElement('label', {
|
|
33
|
+
style: dshSettingsListRowStyle,
|
|
34
|
+
}, createElement('span', { style: { minWidth: 0 } }, createElement('strong', { style: { display: 'block', fontSize: 13, lineHeight: 1.4 } }, t('workspace.showLogo')), createElement('span', { style: { display: 'block', marginTop: 3, ...dshSettingsHelpStyle } }, t('workspace.logoDescription'))), createElement('input', {
|
|
35
|
+
type: 'checkbox',
|
|
36
|
+
role: 'switch',
|
|
37
|
+
'aria-label': t('workspace.showLogo'),
|
|
38
|
+
checked: value.showAdapterLogo,
|
|
39
|
+
disabled,
|
|
40
|
+
onChange: (event) => updateSetting('showAdapterLogo', event.currentTarget.checked),
|
|
41
|
+
style: { flex: '0 0 auto', accentColor: dshThemeColor.accent },
|
|
42
|
+
})), createElement('label', {
|
|
43
|
+
style: dshSettingsListRowStyle,
|
|
44
|
+
}, createElement('span', { style: { minWidth: 0 } }, createElement('strong', { style: { display: 'block', fontSize: 13, lineHeight: 1.4 } }, t('workspace.showSubscriptionUsage')), createElement('span', { style: { display: 'block', marginTop: 3, ...dshSettingsHelpStyle } }, t('workspace.subscriptionUsageDescription'))), createElement('input', {
|
|
45
|
+
type: 'checkbox',
|
|
46
|
+
role: 'switch',
|
|
47
|
+
'aria-label': t('workspace.showSubscriptionUsage'),
|
|
48
|
+
checked: value.showSubscriptionUsage,
|
|
49
|
+
disabled,
|
|
50
|
+
onChange: (event) => updateSetting('showSubscriptionUsage', event.currentTarget.checked),
|
|
51
|
+
style: { flex: '0 0 auto', accentColor: dshThemeColor.accent },
|
|
52
|
+
})), createElement('label', {
|
|
53
|
+
style: dshSettingsListRowStyle,
|
|
54
|
+
}, createElement('span', { style: { minWidth: 0 } }, createElement('strong', { style: { display: 'block', fontSize: 13, lineHeight: 1.4 } }, t('workspace.showArchivedSessions')), createElement('span', { style: { display: 'block', marginTop: 3, ...dshSettingsHelpStyle } }, t('workspace.archivedSessionsDescription'))), createElement('input', {
|
|
55
|
+
type: 'checkbox',
|
|
56
|
+
role: 'switch',
|
|
57
|
+
'aria-label': t('workspace.showArchivedSessions'),
|
|
58
|
+
checked: value.showArchivedSessions,
|
|
59
|
+
disabled,
|
|
60
|
+
onChange: (event) => updateSetting('showArchivedSessions', event.currentTarget.checked),
|
|
61
|
+
style: { flex: '0 0 auto', accentColor: dshThemeColor.accent },
|
|
62
|
+
})), writeError === null
|
|
63
|
+
? null
|
|
64
|
+
: createElement('div', { role: 'alert', style: { color: dshThemeColor.error, fontSize: 12 } }, writeError));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=workspace-session-enhancement-panel.js.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { DEFAULT_WORKSPACE_SESSION_ENHANCEMENT_SETTINGS } from '../../shared/contracts/config.js';
|
|
2
|
+
import { clearSessionAdapters, fetchSessionAdapters, replaceSessionAdapters, } from '../session-adapter-cache.js';
|
|
3
|
+
import { startWorkspaceSessionLogoDom } from '../workspace-session-logo-dom.js';
|
|
4
|
+
import { startWorkspaceSessionArchiveDom } from '../workspace-session-archive-dom.js';
|
|
5
|
+
import { WorkspaceSessionEnhancementPanel } from './workspace-session-enhancement-panel.js';
|
|
6
|
+
import { registerSubscriptionSlot } from '../subscription-slot.js';
|
|
7
|
+
/** DSH 0.1.6 原生会话行增强:Logo 与归档会话入口共用同一生命周期。 */
|
|
8
|
+
export const workspaceSessionEnhancementFeature = {
|
|
9
|
+
descriptor: {
|
|
10
|
+
name: 'workspaceSessionEnhancement',
|
|
11
|
+
version: '0.1.0',
|
|
12
|
+
enabledByDefault: false,
|
|
13
|
+
dependencies: ['cliAdapters'],
|
|
14
|
+
runtime: 'client',
|
|
15
|
+
ui: {
|
|
16
|
+
label: '工作区会话增强',
|
|
17
|
+
description: '在原生工作区会话行显示 Agent Logo、归档入口和订阅/用量信息。',
|
|
18
|
+
labelKey: 'feature.workspaceSession.label',
|
|
19
|
+
descriptionKey: 'feature.workspaceSession.description',
|
|
20
|
+
order: 35,
|
|
21
|
+
defaultOpen: true,
|
|
22
|
+
legacyFallback: true,
|
|
23
|
+
legacyFallbackKey: 'feature.workspaceSession.legacyFallback',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
start(context) {
|
|
27
|
+
let generation = 0;
|
|
28
|
+
let logoDom;
|
|
29
|
+
let archiveDom;
|
|
30
|
+
let disposeSubscription;
|
|
31
|
+
const disableLogo = () => {
|
|
32
|
+
generation += 1;
|
|
33
|
+
logoDom?.dispose();
|
|
34
|
+
logoDom = undefined;
|
|
35
|
+
clearSessionAdapters();
|
|
36
|
+
};
|
|
37
|
+
const enableArchive = () => {
|
|
38
|
+
if (archiveDom === undefined)
|
|
39
|
+
archiveDom = startWorkspaceSessionArchiveDom({ remote: context.services.remote });
|
|
40
|
+
};
|
|
41
|
+
const enableSubscription = () => {
|
|
42
|
+
if (disposeSubscription !== undefined || context.services.slots === undefined)
|
|
43
|
+
return;
|
|
44
|
+
disposeSubscription = registerSubscriptionSlot(context.services.slots, context.services.rpc);
|
|
45
|
+
};
|
|
46
|
+
const disableSubscription = () => {
|
|
47
|
+
disposeSubscription?.();
|
|
48
|
+
disposeSubscription = undefined;
|
|
49
|
+
};
|
|
50
|
+
const disposeAll = () => {
|
|
51
|
+
disableLogo();
|
|
52
|
+
archiveDom?.dispose();
|
|
53
|
+
archiveDom = undefined;
|
|
54
|
+
disableSubscription();
|
|
55
|
+
};
|
|
56
|
+
const enableLogo = () => {
|
|
57
|
+
if (logoDom !== undefined)
|
|
58
|
+
return;
|
|
59
|
+
const currentGeneration = ++generation;
|
|
60
|
+
logoDom = startWorkspaceSessionLogoDom();
|
|
61
|
+
void fetchSessionAdapters(context.services.rpc)
|
|
62
|
+
.then((bindings) => {
|
|
63
|
+
if (generation !== currentGeneration || logoDom === undefined)
|
|
64
|
+
return;
|
|
65
|
+
replaceSessionAdapters(bindings);
|
|
66
|
+
logoDom.refresh();
|
|
67
|
+
archiveDom?.refresh();
|
|
68
|
+
})
|
|
69
|
+
.catch(() => undefined);
|
|
70
|
+
};
|
|
71
|
+
const sync = () => {
|
|
72
|
+
const workspaceSettings = context.services.settings.getSnapshot().value?.workspaceSessionEnhancement;
|
|
73
|
+
const showArchivedSessions = workspaceSettings?.showArchivedSessions
|
|
74
|
+
?? DEFAULT_WORKSPACE_SESSION_ENHANCEMENT_SETTINGS.showArchivedSessions;
|
|
75
|
+
if (showArchivedSessions)
|
|
76
|
+
enableArchive();
|
|
77
|
+
else {
|
|
78
|
+
archiveDom?.dispose();
|
|
79
|
+
archiveDom = undefined;
|
|
80
|
+
}
|
|
81
|
+
const showAdapterLogo = workspaceSettings?.showAdapterLogo
|
|
82
|
+
?? DEFAULT_WORKSPACE_SESSION_ENHANCEMENT_SETTINGS.showAdapterLogo;
|
|
83
|
+
if (showAdapterLogo)
|
|
84
|
+
enableLogo();
|
|
85
|
+
else
|
|
86
|
+
disableLogo();
|
|
87
|
+
const showSubscriptionUsage = workspaceSettings?.showSubscriptionUsage
|
|
88
|
+
?? DEFAULT_WORKSPACE_SESSION_ENHANCEMENT_SETTINGS.showSubscriptionUsage;
|
|
89
|
+
if (showSubscriptionUsage)
|
|
90
|
+
enableSubscription();
|
|
91
|
+
else
|
|
92
|
+
disableSubscription();
|
|
93
|
+
};
|
|
94
|
+
sync();
|
|
95
|
+
const unsubscribe = context.services.settings.subscribe(sync);
|
|
96
|
+
context.resources.add(unsubscribe);
|
|
97
|
+
context.resources.add(disposeAll);
|
|
98
|
+
},
|
|
99
|
+
settingsPanel: WorkspaceSessionEnhancementPanel,
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=workspace-session-enhancement.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createHttpDshH5ControlApi, startDshH5BrowserBootstrap } from './dsh-h5-bootstrap.js';
|
|
2
|
+
/**
|
|
3
|
+
* 独立 H5 静态项目使用的浏览器入口。
|
|
4
|
+
* 这里故意只暴露无凭据的工厂和启动函数;Cookie 由浏览器自动管理,
|
|
5
|
+
* 页面脚本永远拿不到 Control API 的 HttpOnly 会话内容。
|
|
6
|
+
*/
|
|
7
|
+
const runtime = {
|
|
8
|
+
createHttpDshH5ControlApi,
|
|
9
|
+
startDshH5BrowserBootstrap,
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(globalThis, 'DshCodingNsH5', {
|
|
12
|
+
configurable: true,
|
|
13
|
+
enumerable: false,
|
|
14
|
+
value: runtime,
|
|
15
|
+
writable: false,
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=h5-bootstrap-entry.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DSH Client 入口。
|
|
3
|
+
*
|
|
4
|
+
* 该文件只使用浏览器安全的 TypeScript/JavaScript。Client 侧能力全部以功能模块
|
|
5
|
+
* 形式交给 FeatureRegistry 管理:设置页遍历注册表渲染卡片,设置里的启用开关
|
|
6
|
+
* 驱动模块 start/disable 与资源清理。入口只负责装配与依赖声明。
|
|
7
|
+
*/
|
|
8
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
9
|
+
import './provider-icon-assets.js';
|
|
10
|
+
export { ensureCryptoRandomUUID } from './lan-access.js';
|
|
11
|
+
export type { CryptoRandomUUIDInstallResult, LanAccessCrypto, LanAccessGlobal, } from './lan-access.js';
|
|
12
|
+
export { CLIENT_FEATURES, settingsModules, startBrowserRelayConnection } from './features/index.js';
|
|
13
|
+
export { chooseDshDevice, createHttpDshH5ControlApi, startDshH5Bootstrap, startDshH5BrowserBootstrap } from './dsh-h5-bootstrap.js';
|
|
14
|
+
export type { DshH5BootstrapOptions, DshH5BootstrapResult, DshH5BrowserBootstrapOptions, DshH5BrowserBootstrapResult, DshH5BrowserControlApi, } from './dsh-h5-bootstrap.js';
|
|
15
|
+
export { RemoteDshWebContext } from './remote-web-context.js';
|
|
16
|
+
export type { RemoteDshWebBoot, RemoteDshWebContextOptions } from './remote-web-context.js';
|
|
17
|
+
export type { CodingNsClientFeatureModule, CodingNsClientServices, CodingNsRpcClient, CodingNsRpcResult, FeaturePanelProps, } from './features/index.js';
|
|
18
|
+
export { CodingNsSettingsSection } from './settings-section.js';
|
|
19
|
+
export { startWorkspaceSessionArchiveDom, WORKSPACE_SESSION_ARCHIVE_ATTRIBUTE, WORKSPACE_SESSION_ARCHIVE_MODAL_ATTRIBUTE, } from './workspace-session-archive-dom.js';
|
|
20
|
+
export { CodingNsTerminalView, CodingNsWebTerminals, registerCodingNsTerminalUi } from './terminal/index.js';
|
|
21
|
+
export { registerSubscriptionSlot, registerCommandCodeSubscriptionSlot, CommandCodeSubscriptionSlot } from './subscription-slot.js';
|
|
22
|
+
/** Client Runner 用于等待服务就绪的 Cordis 依赖声明。 */
|
|
23
|
+
export declare const inject: readonly ["slots", "settingsScope", "connection", "remote", "remote.workspace", "remote.session", "remote.terminal", "sidebarRight", "sidebarRightTabs", "theme", "locale", "uiConversation"];
|
|
24
|
+
/**
|
|
25
|
+
* 把 Codingns4DSH 设置页挂载到 DSH 设置左侧导航,并让模块开关驱动启停。
|
|
26
|
+
*
|
|
27
|
+
* 设置页与启停同步共享同一个注册表实例,所以界面上的模块清单就是运行时实际
|
|
28
|
+
* 管理的模块清单,两者不会漂移。
|
|
29
|
+
*/
|
|
30
|
+
export declare function apply(ctx?: Context): void;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import './provider-icon-assets.js';
|
|
2
|
+
import { FeatureRegistry } from '../features/registry.js';
|
|
3
|
+
import { registerCodingNsLocale } from './locale.js';
|
|
4
|
+
import { CODINGNS_SETTINGS_NAMESPACE, captureRestartFeatureStates, enabledFeatureNames, } from '../shared/contracts/config.js';
|
|
5
|
+
import { CLIENT_FEATURES } from './features/index.js';
|
|
6
|
+
import { ensureCryptoRandomUUID } from './lan-access.js';
|
|
7
|
+
import { CodingNsSettingsSection } from './settings-section.js';
|
|
8
|
+
import { createCodingNsSettingsBridge } from './settings-bridge.js';
|
|
9
|
+
import { CodingNsWebTerminals, registerCodingNsTerminalUi } from './terminal/index.js';
|
|
10
|
+
import { startCodingNsAccountBar } from './account-bar.js';
|
|
11
|
+
import { assertInjectedDshVersion } from './dsh-runtime-version.js';
|
|
12
|
+
export { ensureCryptoRandomUUID } from './lan-access.js';
|
|
13
|
+
export { CLIENT_FEATURES, settingsModules, startBrowserRelayConnection } from './features/index.js';
|
|
14
|
+
export { chooseDshDevice, createHttpDshH5ControlApi, startDshH5Bootstrap, startDshH5BrowserBootstrap } from './dsh-h5-bootstrap.js';
|
|
15
|
+
export { RemoteDshWebContext } from './remote-web-context.js';
|
|
16
|
+
export { CodingNsSettingsSection } from './settings-section.js';
|
|
17
|
+
export { startWorkspaceSessionArchiveDom, WORKSPACE_SESSION_ARCHIVE_ATTRIBUTE, WORKSPACE_SESSION_ARCHIVE_MODAL_ATTRIBUTE, } from './workspace-session-archive-dom.js';
|
|
18
|
+
export { CodingNsTerminalView, CodingNsWebTerminals, registerCodingNsTerminalUi } from './terminal/index.js';
|
|
19
|
+
export { registerSubscriptionSlot, registerCommandCodeSubscriptionSlot, CommandCodeSubscriptionSlot } from './subscription-slot.js';
|
|
20
|
+
/** Client Runner 用于等待服务就绪的 Cordis 依赖声明。 */
|
|
21
|
+
export const inject = ['slots', 'settingsScope', 'connection', 'remote', 'remote.workspace', 'remote.session', 'remote.terminal', 'sidebarRight', 'sidebarRightTabs', 'theme', 'locale', 'uiConversation'];
|
|
22
|
+
/**
|
|
23
|
+
* 把 Codingns4DSH 设置页挂载到 DSH 设置左侧导航,并让模块开关驱动启停。
|
|
24
|
+
*
|
|
25
|
+
* 设置页与启停同步共享同一个注册表实例,所以界面上的模块清单就是运行时实际
|
|
26
|
+
* 管理的模块清单,两者不会漂移。
|
|
27
|
+
*/
|
|
28
|
+
export function apply(ctx) {
|
|
29
|
+
if (ctx === undefined)
|
|
30
|
+
return;
|
|
31
|
+
const dshVersion = assertInjectedDshVersion();
|
|
32
|
+
// 版本门禁通过后才修改浏览器全局,避免不兼容 Client 留下半初始化状态。
|
|
33
|
+
ensureCryptoRandomUUID();
|
|
34
|
+
ctx.effect(() => registerCodingNsLocale(ctx), 'codingns4dsh: Client 词典');
|
|
35
|
+
ctx.inject(['slots', 'settingsScope', 'connection', 'remote', 'remote.workspace', 'remote.session', 'remote.terminal', 'sidebarRight', 'sidebarRightTabs', 'theme', 'locale', 'uiConversation'], (settingsCtx) => {
|
|
36
|
+
const localSettings = settingsCtx.settingsScope.bind({
|
|
37
|
+
namespace: CODINGNS_SETTINGS_NAMESPACE,
|
|
38
|
+
});
|
|
39
|
+
// Host 与 Client 共用同一个 cordis Context 类型,而 DSH 的 Host 侧声明会把
|
|
40
|
+
// connection 收窄成 Host 句柄;浏览器侧按 ConnectionHandle 收窄回真实形状。
|
|
41
|
+
const connection = settingsCtx.connection;
|
|
42
|
+
const settings = createCodingNsSettingsBridge(localSettings, connection.rpc);
|
|
43
|
+
// Typert manifest 可能晚于立即加载的 Client 入口完成登记,必须在每次调用时取 Remote。
|
|
44
|
+
const terminalRemote = () => settingsCtx.remote.terminal;
|
|
45
|
+
const webTerminals = new CodingNsWebTerminals(settingsCtx, terminalRemote);
|
|
46
|
+
const disposeTerminalUi = registerCodingNsTerminalUi(settingsCtx, webTerminals, settings);
|
|
47
|
+
const services = {
|
|
48
|
+
dshVersion,
|
|
49
|
+
settings,
|
|
50
|
+
rpc: connection.rpc,
|
|
51
|
+
remote: settingsCtx.remote,
|
|
52
|
+
slots: settingsCtx.slots,
|
|
53
|
+
locale: settingsCtx.locale,
|
|
54
|
+
uiConversation: settingsCtx.uiConversation,
|
|
55
|
+
uiContext: settingsCtx,
|
|
56
|
+
};
|
|
57
|
+
const disposeAccountBar = startCodingNsAccountBar(connection.rpc, undefined, settings);
|
|
58
|
+
const registry = new FeatureRegistry(services);
|
|
59
|
+
registry.registerMany(CLIENT_FEATURES);
|
|
60
|
+
registry.validate();
|
|
61
|
+
const restartStates = {};
|
|
62
|
+
let restartStatesCaptured = false;
|
|
63
|
+
settingsCtx.effect(() => {
|
|
64
|
+
const sync = () => {
|
|
65
|
+
const snapshot = settings.getSnapshot();
|
|
66
|
+
if (!restartStatesCaptured && snapshot.status === 'ready') {
|
|
67
|
+
Object.assign(restartStates, captureRestartFeatureStates(registry.descriptors(), snapshot.value, dshVersion));
|
|
68
|
+
restartStatesCaptured = true;
|
|
69
|
+
}
|
|
70
|
+
void registry
|
|
71
|
+
.reconcile(enabledFeatureNames(registry.descriptors(), snapshot.value, restartStates, dshVersion))
|
|
72
|
+
.catch((error) => {
|
|
73
|
+
console.error('codingns4dsh: 功能模块状态同步失败', error);
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
sync();
|
|
77
|
+
void settings.load().catch((error) => {
|
|
78
|
+
console.error('codingns4dsh: 远程设置读取失败', error);
|
|
79
|
+
});
|
|
80
|
+
const unsubscribe = settings.subscribe(sync);
|
|
81
|
+
return () => {
|
|
82
|
+
unsubscribe();
|
|
83
|
+
disposeTerminalUi();
|
|
84
|
+
disposeAccountBar.dispose();
|
|
85
|
+
void webTerminals.dispose();
|
|
86
|
+
settings.dispose();
|
|
87
|
+
};
|
|
88
|
+
}, 'codingns4dsh: 功能模块启停同步');
|
|
89
|
+
settingsCtx.slots.inject('settings.section', () => settingsCtx.slots.register({
|
|
90
|
+
name: 'settings.section',
|
|
91
|
+
id: 'codingns',
|
|
92
|
+
order: 30,
|
|
93
|
+
label: 'Codingns4DSH',
|
|
94
|
+
inject: () => ({ settings, registry, services, restartStates }),
|
|
95
|
+
}, CodingNsSettingsSection));
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 局域网访问兼容模块。
|
|
3
|
+
*
|
|
4
|
+
* 非 HTTPS 页面通常仍然暴露 `crypto.getRandomValues`,但部分浏览器不会
|
|
5
|
+
* 暴露只在安全上下文提供的 `crypto.randomUUID`。DSH 页面依赖后者生成会话
|
|
6
|
+
* 标识,因此在 Client 入口加载时补齐一个 RFC 4122 v4 实现。
|
|
7
|
+
*/
|
|
8
|
+
export interface LanAccessCrypto {
|
|
9
|
+
randomUUID?: () => string;
|
|
10
|
+
getRandomValues?: (array: Uint8Array) => Uint8Array;
|
|
11
|
+
}
|
|
12
|
+
export interface LanAccessGlobal {
|
|
13
|
+
crypto?: LanAccessCrypto;
|
|
14
|
+
}
|
|
15
|
+
export interface CryptoRandomUUIDInstallResult {
|
|
16
|
+
/** 安装调用结束后,目标是否拥有可调用的 randomUUID。 */
|
|
17
|
+
readonly available: boolean;
|
|
18
|
+
/** 本次调用是否新增了 randomUUID 实现。 */
|
|
19
|
+
readonly installed: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 确保目标页面拥有 `crypto.randomUUID`。
|
|
23
|
+
*
|
|
24
|
+
* 该函数幂等且可注入目标对象,便于在浏览器和测试环境中复用。无法修改
|
|
25
|
+
* 浏览器原生 crypto 时返回 available=false,不会阻止 DSH 继续启动。
|
|
26
|
+
*/
|
|
27
|
+
export declare function ensureCryptoRandomUUID(target?: LanAccessGlobal): CryptoRandomUUIDInstallResult;
|
|
28
|
+
//# sourceMappingURL=lan-access.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 局域网访问兼容模块。
|
|
3
|
+
*
|
|
4
|
+
* 非 HTTPS 页面通常仍然暴露 `crypto.getRandomValues`,但部分浏览器不会
|
|
5
|
+
* 暴露只在安全上下文提供的 `crypto.randomUUID`。DSH 页面依赖后者生成会话
|
|
6
|
+
* 标识,因此在 Client 入口加载时补齐一个 RFC 4122 v4 实现。
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 确保目标页面拥有 `crypto.randomUUID`。
|
|
10
|
+
*
|
|
11
|
+
* 该函数幂等且可注入目标对象,便于在浏览器和测试环境中复用。无法修改
|
|
12
|
+
* 浏览器原生 crypto 时返回 available=false,不会阻止 DSH 继续启动。
|
|
13
|
+
*/
|
|
14
|
+
export function ensureCryptoRandomUUID(target = globalThis) {
|
|
15
|
+
const cryptoObject = target.crypto;
|
|
16
|
+
if (cryptoObject === undefined)
|
|
17
|
+
return { available: false, installed: false };
|
|
18
|
+
if (typeof cryptoObject.randomUUID === 'function')
|
|
19
|
+
return { available: true, installed: false };
|
|
20
|
+
const getRandomValues = typeof cryptoObject.getRandomValues === 'function'
|
|
21
|
+
? cryptoObject.getRandomValues.bind(cryptoObject)
|
|
22
|
+
: undefined;
|
|
23
|
+
const randomUUID = () => createUuidV4(getRandomValues);
|
|
24
|
+
try {
|
|
25
|
+
Object.defineProperty(cryptoObject, 'randomUUID', {
|
|
26
|
+
configurable: true,
|
|
27
|
+
enumerable: false,
|
|
28
|
+
value: randomUUID,
|
|
29
|
+
writable: true,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
try {
|
|
34
|
+
cryptoObject.randomUUID = randomUUID;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return { available: false, installed: false };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return typeof cryptoObject.randomUUID === 'function'
|
|
41
|
+
? { available: true, installed: true }
|
|
42
|
+
: { available: false, installed: false };
|
|
43
|
+
}
|
|
44
|
+
function createUuidV4(getRandomValues) {
|
|
45
|
+
const bytes = new Uint8Array(16);
|
|
46
|
+
if (getRandomValues !== undefined) {
|
|
47
|
+
try {
|
|
48
|
+
getRandomValues(bytes);
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
fillWithMathRandom(bytes);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
fillWithMathRandom(bytes);
|
|
56
|
+
}
|
|
57
|
+
// RFC 4122: version 4 and the variant used by the standard UUID string form.
|
|
58
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
59
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
60
|
+
const hex = Array.from(bytes, (value) => value.toString(16).padStart(2, '0')).join('');
|
|
61
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
62
|
+
}
|
|
63
|
+
function fillWithMathRandom(bytes) {
|
|
64
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
65
|
+
bytes[index] = Math.floor(Math.random() * 256);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=lan-access.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client';
|
|
3
|
+
import type { Translate } from '@deepseek-ai/dsh-client-ui-slots';
|
|
4
|
+
/** Codingns4DSH 自有词典命名空间。词典缺少的语言由 DSH 自动回退到英文。 */
|
|
5
|
+
export declare const CODINGNS_LOCALE_NS: "codingns";
|
|
6
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
7
|
+
interface LocaleNamespaceMap {
|
|
8
|
+
codingns: string;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** Client 侧服务中实际使用的 DSH 语言运行时最小接口。 */
|
|
12
|
+
export type CodingNsLocale = Pick<LocaleRuntime, 'bind' | 'getSnapshot' | 'subscribe' | 'register'>;
|
|
13
|
+
export type CodingNsTranslator = Translate<string>;
|
|
14
|
+
/** 在当前 Client Cordis 作用域注册中英文词典。 */
|
|
15
|
+
export declare function registerCodingNsLocale(ctx: Context): () => void;
|
|
16
|
+
/** 订阅 DSH 语言修订,并返回当前 Codingns4DSH 命名空间翻译函数。 */
|
|
17
|
+
export declare function useCodingNsTranslator(locale: CodingNsLocale): CodingNsTranslator;
|
|
18
|
+
/** 非 React 注册回调使用的翻译函数。 */
|
|
19
|
+
export declare function codingNsTranslator(locale: CodingNsLocale): CodingNsTranslator;
|
|
20
|
+
//# sourceMappingURL=locale.d.ts.map
|