@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.
Files changed (312) hide show
  1. package/README.md +1114 -0
  2. package/assets/provider-icons/claude-code.png +0 -0
  3. package/assets/provider-icons/codex.png +0 -0
  4. package/assets/provider-icons/command-code.svg +5 -0
  5. package/assets/provider-icons/deepseek-harness.svg +9 -0
  6. package/assets/provider-icons/gemini.png +0 -0
  7. package/assets/provider-icons/grok.png +0 -0
  8. package/assets/provider-icons/kimi.png +0 -0
  9. package/assets/provider-icons/opencode.png +0 -0
  10. package/assets/provider-icons/pi.svg +7 -0
  11. package/data/build/dist/bootstrap/dsh-connection-adapter.d.ts +97 -0
  12. package/data/build/dist/bootstrap/dsh-connection-adapter.js +169 -0
  13. package/data/build/dist/bootstrap/index.d.ts +38 -0
  14. package/data/build/dist/bootstrap/index.js +44 -0
  15. package/data/build/dist/client/account-bar.d.ts +9 -0
  16. package/data/build/dist/client/account-bar.js +398 -0
  17. package/data/build/dist/client/bundle.js +26167 -0
  18. package/data/build/dist/client/cli-catalog.d.ts +24 -0
  19. package/data/build/dist/client/cli-catalog.js +108 -0
  20. package/data/build/dist/client/cli-slots.d.ts +38 -0
  21. package/data/build/dist/client/cli-slots.js +297 -0
  22. package/data/build/dist/client/debug/ui.d.ts +12 -0
  23. package/data/build/dist/client/debug/ui.js +451 -0
  24. package/data/build/dist/client/dsh-h5-bootstrap.d.ts +64 -0
  25. package/data/build/dist/client/dsh-h5-bootstrap.js +293 -0
  26. package/data/build/dist/client/dsh-runtime-version.d.ts +3 -0
  27. package/data/build/dist/client/dsh-runtime-version.js +11 -0
  28. package/data/build/dist/client/external-tool-stream.d.ts +24 -0
  29. package/data/build/dist/client/external-tool-stream.js +114 -0
  30. package/data/build/dist/client/features/cli-adapters.d.ts +7 -0
  31. package/data/build/dist/client/features/cli-adapters.js +215 -0
  32. package/data/build/dist/client/features/debug.d.ts +4 -0
  33. package/data/build/dist/client/features/debug.js +24 -0
  34. package/data/build/dist/client/features/index.d.ts +33 -0
  35. package/data/build/dist/client/features/index.js +44 -0
  36. package/data/build/dist/client/features/lan-access-panel.d.ts +5 -0
  37. package/data/build/dist/client/features/lan-access-panel.js +146 -0
  38. package/data/build/dist/client/features/lan-access.d.ts +9 -0
  39. package/data/build/dist/client/features/lan-access.js +30 -0
  40. package/data/build/dist/client/features/login-protection-panel.d.ts +5 -0
  41. package/data/build/dist/client/features/login-protection-panel.js +91 -0
  42. package/data/build/dist/client/features/login-protection-session.d.ts +6 -0
  43. package/data/build/dist/client/features/login-protection-session.js +25 -0
  44. package/data/build/dist/client/features/login-protection.d.ts +4 -0
  45. package/data/build/dist/client/features/login-protection.js +23 -0
  46. package/data/build/dist/client/features/reverse-proxy-panel.d.ts +9 -0
  47. package/data/build/dist/client/features/reverse-proxy-panel.js +159 -0
  48. package/data/build/dist/client/features/reverse-proxy.d.ts +12 -0
  49. package/data/build/dist/client/features/reverse-proxy.js +112 -0
  50. package/data/build/dist/client/features/terminal-enhancement-panel.d.ts +5 -0
  51. package/data/build/dist/client/features/terminal-enhancement-panel.js +160 -0
  52. package/data/build/dist/client/features/terminal-enhancement.d.ts +4 -0
  53. package/data/build/dist/client/features/terminal-enhancement.js +24 -0
  54. package/data/build/dist/client/features/types.d.ts +58 -0
  55. package/data/build/dist/client/features/types.js +2 -0
  56. package/data/build/dist/client/features/workspace-session-enhancement-panel.d.ts +5 -0
  57. package/data/build/dist/client/features/workspace-session-enhancement-panel.js +66 -0
  58. package/data/build/dist/client/features/workspace-session-enhancement.d.ts +4 -0
  59. package/data/build/dist/client/features/workspace-session-enhancement.js +101 -0
  60. package/data/build/dist/client/h5-bootstrap-entry.d.ts +2 -0
  61. package/data/build/dist/client/h5-bootstrap-entry.js +17 -0
  62. package/data/build/dist/client/index.d.ts +31 -0
  63. package/data/build/dist/client/index.js +98 -0
  64. package/data/build/dist/client/lan-access.d.ts +28 -0
  65. package/data/build/dist/client/lan-access.js +68 -0
  66. package/data/build/dist/client/locale.d.ts +20 -0
  67. package/data/build/dist/client/locale.js +393 -0
  68. package/data/build/dist/client/provider-icon-assets.d.ts +2 -0
  69. package/data/build/dist/client/provider-icon-assets.js +23 -0
  70. package/data/build/dist/client/provider-icons.d.ts +19 -0
  71. package/data/build/dist/client/provider-icons.js +39 -0
  72. package/data/build/dist/client/remote-web-context.d.ts +57 -0
  73. package/data/build/dist/client/remote-web-context.js +939 -0
  74. package/data/build/dist/client/session-adapter-cache.d.ts +18 -0
  75. package/data/build/dist/client/session-adapter-cache.js +84 -0
  76. package/data/build/dist/client/settings-bridge.d.ts +32 -0
  77. package/data/build/dist/client/settings-bridge.js +126 -0
  78. package/data/build/dist/client/settings-section.d.ts +30 -0
  79. package/data/build/dist/client/settings-section.js +93 -0
  80. package/data/build/dist/client/subscription-slot.d.ts +18 -0
  81. package/data/build/dist/client/subscription-slot.js +223 -0
  82. package/data/build/dist/client/terminal/index.d.ts +4 -0
  83. package/data/build/dist/client/terminal/index.js +3 -0
  84. package/data/build/dist/client/terminal/model.d.ts +116 -0
  85. package/data/build/dist/client/terminal/model.js +435 -0
  86. package/data/build/dist/client/terminal/styles.d.ts +21 -0
  87. package/data/build/dist/client/terminal/styles.js +51 -0
  88. package/data/build/dist/client/terminal/ui.d.ts +19 -0
  89. package/data/build/dist/client/terminal/ui.js +257 -0
  90. package/data/build/dist/client/terminal/xterm-view.d.ts +13 -0
  91. package/data/build/dist/client/terminal/xterm-view.js +213 -0
  92. package/data/build/dist/client/theme.d.ts +56 -0
  93. package/data/build/dist/client/theme.js +186 -0
  94. package/data/build/dist/client/workspace-session-archive-dom.d.ts +29 -0
  95. package/data/build/dist/client/workspace-session-archive-dom.js +525 -0
  96. package/data/build/dist/client/workspace-session-fiber.d.ts +3 -0
  97. package/data/build/dist/client/workspace-session-fiber.js +33 -0
  98. package/data/build/dist/client/workspace-session-logo-dom.d.ts +26 -0
  99. package/data/build/dist/client/workspace-session-logo-dom.js +128 -0
  100. package/data/build/dist/features/index.d.ts +3 -0
  101. package/data/build/dist/features/index.js +2 -0
  102. package/data/build/dist/features/registry.d.ts +74 -0
  103. package/data/build/dist/features/registry.js +382 -0
  104. package/data/build/dist/features/resource-scope/index.d.ts +39 -0
  105. package/data/build/dist/features/resource-scope/index.js +161 -0
  106. package/data/build/dist/host/auth-session.d.ts +42 -0
  107. package/data/build/dist/host/auth-session.js +186 -0
  108. package/data/build/dist/host/cli-adapters/claude-driver.d.ts +14 -0
  109. package/data/build/dist/host/cli-adapters/claude-driver.js +103 -0
  110. package/data/build/dist/host/cli-adapters/codex-driver.d.ts +45 -0
  111. package/data/build/dist/host/cli-adapters/codex-driver.js +534 -0
  112. package/data/build/dist/host/cli-adapters/command-code-driver.d.ts +38 -0
  113. package/data/build/dist/host/cli-adapters/command-code-driver.js +394 -0
  114. package/data/build/dist/host/cli-adapters/command-code-subscription.d.ts +19 -0
  115. package/data/build/dist/host/cli-adapters/command-code-subscription.js +126 -0
  116. package/data/build/dist/host/cli-adapters/driver.d.ts +41 -0
  117. package/data/build/dist/host/cli-adapters/driver.js +2 -0
  118. package/data/build/dist/host/cli-adapters/dsh-message-projector.d.ts +37 -0
  119. package/data/build/dist/host/cli-adapters/dsh-message-projector.js +180 -0
  120. package/data/build/dist/host/cli-adapters/dsh-tool-history.d.ts +48 -0
  121. package/data/build/dist/host/cli-adapters/dsh-tool-history.js +373 -0
  122. package/data/build/dist/host/cli-adapters/feature.d.ts +7 -0
  123. package/data/build/dist/host/cli-adapters/feature.js +335 -0
  124. package/data/build/dist/host/cli-adapters/gemini-driver.d.ts +24 -0
  125. package/data/build/dist/host/cli-adapters/gemini-driver.js +427 -0
  126. package/data/build/dist/host/cli-adapters/grok-driver.d.ts +38 -0
  127. package/data/build/dist/host/cli-adapters/grok-driver.js +372 -0
  128. package/data/build/dist/host/cli-adapters/http-sse-client.d.ts +22 -0
  129. package/data/build/dist/host/cli-adapters/http-sse-client.js +99 -0
  130. package/data/build/dist/host/cli-adapters/interaction-events.d.ts +11 -0
  131. package/data/build/dist/host/cli-adapters/interaction-events.js +80 -0
  132. package/data/build/dist/host/cli-adapters/json-rpc-process.d.ts +65 -0
  133. package/data/build/dist/host/cli-adapters/json-rpc-process.js +256 -0
  134. package/data/build/dist/host/cli-adapters/kimi-driver.d.ts +21 -0
  135. package/data/build/dist/host/cli-adapters/kimi-driver.js +382 -0
  136. package/data/build/dist/host/cli-adapters/model-catalog.d.ts +22 -0
  137. package/data/build/dist/host/cli-adapters/model-catalog.js +89 -0
  138. package/data/build/dist/host/cli-adapters/opencode-driver.d.ts +55 -0
  139. package/data/build/dist/host/cli-adapters/opencode-driver.js +728 -0
  140. package/data/build/dist/host/cli-adapters/pi-driver.d.ts +43 -0
  141. package/data/build/dist/host/cli-adapters/pi-driver.js +312 -0
  142. package/data/build/dist/host/cli-adapters/process-utils.d.ts +16 -0
  143. package/data/build/dist/host/cli-adapters/process-utils.js +27 -0
  144. package/data/build/dist/host/cli-adapters/provider-subscription.d.ts +82 -0
  145. package/data/build/dist/host/cli-adapters/provider-subscription.js +610 -0
  146. package/data/build/dist/host/cli-adapters/registry.d.ts +95 -0
  147. package/data/build/dist/host/cli-adapters/registry.js +659 -0
  148. package/data/build/dist/host/cli-adapters/rpc-driver-utils.d.ts +24 -0
  149. package/data/build/dist/host/cli-adapters/rpc-driver-utils.js +119 -0
  150. package/data/build/dist/host/cli-adapters/session-probe.d.ts +20 -0
  151. package/data/build/dist/host/cli-adapters/session-probe.js +139 -0
  152. package/data/build/dist/host/cli-adapters/session-store.d.ts +68 -0
  153. package/data/build/dist/host/cli-adapters/session-store.js +180 -0
  154. package/data/build/dist/host/cli-adapters/standard-stream-driver.d.ts +45 -0
  155. package/data/build/dist/host/cli-adapters/standard-stream-driver.js +205 -0
  156. package/data/build/dist/host/cli-adapters/stream-normalizer.d.ts +25 -0
  157. package/data/build/dist/host/cli-adapters/stream-normalizer.js +83 -0
  158. package/data/build/dist/host/cli-adapters/tool-observation.d.ts +9 -0
  159. package/data/build/dist/host/cli-adapters/tool-observation.js +39 -0
  160. package/data/build/dist/host/control-api-client.d.ts +84 -0
  161. package/data/build/dist/host/control-api-client.js +130 -0
  162. package/data/build/dist/host/credential-store.d.ts +54 -0
  163. package/data/build/dist/host/credential-store.js +114 -0
  164. package/data/build/dist/host/debug.d.ts +79 -0
  165. package/data/build/dist/host/debug.js +295 -0
  166. package/data/build/dist/host/dsh-device-runtime.d.ts +39 -0
  167. package/data/build/dist/host/dsh-device-runtime.js +118 -0
  168. package/data/build/dist/host/dsh-gateway-feature.d.ts +5 -0
  169. package/data/build/dist/host/dsh-gateway-feature.js +55 -0
  170. package/data/build/dist/host/dsh-runtime-version.d.ts +12 -0
  171. package/data/build/dist/host/dsh-runtime-version.js +69 -0
  172. package/data/build/dist/host/features/auth.d.ts +11 -0
  173. package/data/build/dist/host/features/auth.js +273 -0
  174. package/data/build/dist/host/features/debug.d.ts +5 -0
  175. package/data/build/dist/host/features/debug.js +90 -0
  176. package/data/build/dist/host/features/host-status.d.ts +12 -0
  177. package/data/build/dist/host/features/host-status.js +54 -0
  178. package/data/build/dist/host/features/index.d.ts +19 -0
  179. package/data/build/dist/host/features/index.js +29 -0
  180. package/data/build/dist/host/features/lan-access-dsh.d.ts +8 -0
  181. package/data/build/dist/host/features/lan-access-dsh.js +45 -0
  182. package/data/build/dist/host/features/terminal-process.d.ts +5 -0
  183. package/data/build/dist/host/features/terminal-process.js +110 -0
  184. package/data/build/dist/host/features/terminal-status.d.ts +18 -0
  185. package/data/build/dist/host/features/terminal-status.js +56 -0
  186. package/data/build/dist/host/features/types.d.ts +41 -0
  187. package/data/build/dist/host/features/types.js +2 -0
  188. package/data/build/dist/host/index.d.ts +43 -0
  189. package/data/build/dist/host/index.js +135 -0
  190. package/data/build/dist/host/lan-access-dsh.d.ts +83 -0
  191. package/data/build/dist/host/lan-access-dsh.js +831 -0
  192. package/data/build/dist/host/native-session-bridge.d.ts +130 -0
  193. package/data/build/dist/host/native-session-bridge.js +317 -0
  194. package/data/build/dist/host/relay-tunnel-runtime.d.ts +97 -0
  195. package/data/build/dist/host/relay-tunnel-runtime.js +361 -0
  196. package/data/build/dist/host/remote-web-runtime.d.ts +78 -0
  197. package/data/build/dist/host/remote-web-runtime.js +559 -0
  198. package/data/build/dist/host/rpc-table.d.ts +32 -0
  199. package/data/build/dist/host/rpc-table.js +47 -0
  200. package/data/build/dist/host/rpc.d.ts +18 -0
  201. package/data/build/dist/host/rpc.js +248 -0
  202. package/data/build/dist/host/settings.d.ts +19 -0
  203. package/data/build/dist/host/settings.js +80 -0
  204. package/data/build/dist/host/terminal/attachment-registry.d.ts +17 -0
  205. package/data/build/dist/host/terminal/attachment-registry.js +49 -0
  206. package/data/build/dist/host/terminal/backends/conpty-backend.d.ts +39 -0
  207. package/data/build/dist/host/terminal/backends/conpty-backend.js +160 -0
  208. package/data/build/dist/host/terminal/backends/local-pty-backend.d.ts +36 -0
  209. package/data/build/dist/host/terminal/backends/local-pty-backend.js +178 -0
  210. package/data/build/dist/host/terminal/backends/tmux-backend.d.ts +40 -0
  211. package/data/build/dist/host/terminal/backends/tmux-backend.js +191 -0
  212. package/data/build/dist/host/terminal/broker/conpty-broker-client.d.ts +27 -0
  213. package/data/build/dist/host/terminal/broker/conpty-broker-client.js +154 -0
  214. package/data/build/dist/host/terminal/broker/conpty-broker-process.d.ts +10 -0
  215. package/data/build/dist/host/terminal/broker/conpty-broker-process.js +147 -0
  216. package/data/build/dist/host/terminal/broker/conpty-broker-protocol.d.ts +92 -0
  217. package/data/build/dist/host/terminal/broker/conpty-broker-protocol.js +134 -0
  218. package/data/build/dist/host/terminal/controller-factory.d.ts +37 -0
  219. package/data/build/dist/host/terminal/controller-factory.js +82 -0
  220. package/data/build/dist/host/terminal/index.d.ts +17 -0
  221. package/data/build/dist/host/terminal/index.js +17 -0
  222. package/data/build/dist/host/terminal/runtime-adapter.d.ts +77 -0
  223. package/data/build/dist/host/terminal/runtime-adapter.js +18 -0
  224. package/data/build/dist/host/terminal/runtime-manager.d.ts +41 -0
  225. package/data/build/dist/host/terminal/runtime-manager.js +179 -0
  226. package/data/build/dist/host/terminal/shell-detection.d.ts +23 -0
  227. package/data/build/dist/host/terminal/shell-detection.js +105 -0
  228. package/data/build/dist/host/terminal/startup.d.ts +33 -0
  229. package/data/build/dist/host/terminal/startup.js +100 -0
  230. package/data/build/dist/host/terminal/terminal-controller.d.ts +78 -0
  231. package/data/build/dist/host/terminal/terminal-controller.js +324 -0
  232. package/data/build/dist/host/terminal/terminal-process-service.d.ts +30 -0
  233. package/data/build/dist/host/terminal/terminal-process-service.js +194 -0
  234. package/data/build/dist/host/terminal/terminal-process-store.d.ts +45 -0
  235. package/data/build/dist/host/terminal/terminal-process-store.js +183 -0
  236. package/data/build/dist/host/terminal/terminal-service.d.ts +87 -0
  237. package/data/build/dist/host/terminal/terminal-service.js +528 -0
  238. package/data/build/dist/host/terminal/terminal-store.d.ts +49 -0
  239. package/data/build/dist/host/terminal/terminal-store.js +242 -0
  240. package/data/build/dist/index.d.ts +37 -0
  241. package/data/build/dist/index.js +26 -0
  242. package/data/build/dist/shared/contracts/auth.d.ts +122 -0
  243. package/data/build/dist/shared/contracts/auth.js +8 -0
  244. package/data/build/dist/shared/contracts/cli-adapter.d.ts +192 -0
  245. package/data/build/dist/shared/contracts/cli-adapter.js +2 -0
  246. package/data/build/dist/shared/contracts/command-code.d.ts +5 -0
  247. package/data/build/dist/shared/contracts/command-code.js +2 -0
  248. package/data/build/dist/shared/contracts/config.d.ts +113 -0
  249. package/data/build/dist/shared/contracts/config.js +86 -0
  250. package/data/build/dist/shared/contracts/debug-config.d.ts +28 -0
  251. package/data/build/dist/shared/contracts/debug-config.js +78 -0
  252. package/data/build/dist/shared/contracts/debug.d.ts +75 -0
  253. package/data/build/dist/shared/contracts/debug.js +121 -0
  254. package/data/build/dist/shared/contracts/dsh-device.d.ts +72 -0
  255. package/data/build/dist/shared/contracts/dsh-device.js +2 -0
  256. package/data/build/dist/shared/contracts/errors.d.ts +33 -0
  257. package/data/build/dist/shared/contracts/errors.js +41 -0
  258. package/data/build/dist/shared/contracts/feature.d.ts +71 -0
  259. package/data/build/dist/shared/contracts/feature.js +2 -0
  260. package/data/build/dist/shared/contracts/host-status.d.ts +14 -0
  261. package/data/build/dist/shared/contracts/host-status.js +2 -0
  262. package/data/build/dist/shared/contracts/lan-access-dsh.d.ts +30 -0
  263. package/data/build/dist/shared/contracts/lan-access-dsh.js +2 -0
  264. package/data/build/dist/shared/contracts/peer-host.d.ts +37 -0
  265. package/data/build/dist/shared/contracts/peer-host.js +9 -0
  266. package/data/build/dist/shared/contracts/signaling.d.ts +67 -0
  267. package/data/build/dist/shared/contracts/signaling.js +2 -0
  268. package/data/build/dist/shared/contracts/subscription.d.ts +69 -0
  269. package/data/build/dist/shared/contracts/subscription.js +2 -0
  270. package/data/build/dist/shared/contracts/terminal-process.d.ts +65 -0
  271. package/data/build/dist/shared/contracts/terminal-process.js +2 -0
  272. package/data/build/dist/shared/contracts/terminal.d.ts +127 -0
  273. package/data/build/dist/shared/contracts/terminal.js +2 -0
  274. package/data/build/dist/shared/contracts/transport.d.ts +45 -0
  275. package/data/build/dist/shared/contracts/transport.js +3 -0
  276. package/data/build/dist/shared/contracts/version.d.ts +19 -0
  277. package/data/build/dist/shared/contracts/version.js +74 -0
  278. package/data/build/dist/shared/index.d.ts +22 -0
  279. package/data/build/dist/shared/index.js +9 -0
  280. package/data/build/dist/transport/carrier.d.ts +38 -0
  281. package/data/build/dist/transport/carrier.js +268 -0
  282. package/data/build/dist/transport/debug.d.ts +22 -0
  283. package/data/build/dist/transport/debug.js +57 -0
  284. package/data/build/dist/transport/dsh-envelope.d.ts +41 -0
  285. package/data/build/dist/transport/dsh-envelope.js +107 -0
  286. package/data/build/dist/transport/dsh-gateway.d.ts +64 -0
  287. package/data/build/dist/transport/dsh-gateway.js +254 -0
  288. package/data/build/dist/transport/dsh-session.d.ts +55 -0
  289. package/data/build/dist/transport/dsh-session.js +256 -0
  290. package/data/build/dist/transport/dsh-transport.d.ts +57 -0
  291. package/data/build/dist/transport/dsh-transport.js +125 -0
  292. package/data/build/dist/transport/frame.d.ts +132 -0
  293. package/data/build/dist/transport/frame.js +168 -0
  294. package/data/build/dist/transport/index.d.ts +11 -0
  295. package/data/build/dist/transport/index.js +11 -0
  296. package/data/build/dist/transport/multiplexer.d.ts +63 -0
  297. package/data/build/dist/transport/multiplexer.js +323 -0
  298. package/data/build/dist/transport/webrtc-client.d.ts +65 -0
  299. package/data/build/dist/transport/webrtc-client.js +255 -0
  300. package/data/build/dist/transport/webrtc-host.d.ts +58 -0
  301. package/data/build/dist/transport/webrtc-host.js +252 -0
  302. package/data/build/dist/typert.host.d.ts +25 -0
  303. package/data/build/dist/typert.host.js +150 -0
  304. package/dsh.bundle.patch +12 -0
  305. package/package.json +135 -0
  306. package/profile/README.md +27 -0
  307. package/profile/cordis.patch.yml +2 -0
  308. package/profile/package.json +20 -0
  309. package/profile/scripts/check-dsh-install.mjs +71 -0
  310. package/profile/version.json +5 -0
  311. package/scripts/check-dsh-install.mjs +88 -0
  312. package/version.json +6 -0
@@ -0,0 +1,116 @@
1
+ import { Service, type Context } from '@deepseek-ai/cordis';
2
+ import type { CodingNsTerminalCreateRequest, CodingNsTerminalEnvironment, CodingNsTerminalFrame, CodingNsTerminalShellOption, CodingNsWebTerminalInfo, TerminalAttachmentId, WebTerminalId } from '../../shared/contracts/terminal.js';
3
+ import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol';
4
+ export type { TerminalAttachmentId, WebTerminalId } from '../../shared/contracts/terminal.js';
5
+ export type TerminalEnvironment = CodingNsTerminalEnvironment;
6
+ export type TerminalFrame = CodingNsTerminalFrame;
7
+ export type TerminalShell = CodingNsTerminalShellOption;
8
+ export type WebTerminalInfo = CodingNsWebTerminalInfo;
9
+ /** 只描述自有 Client 实际调用的公开 terminal wire 接口。 */
10
+ export interface TerminalRemote {
11
+ close(sessionId: string, id: WebTerminalId): Promise<RemoteResult<void>>;
12
+ create(sessionId: string, request: CodingNsTerminalCreateRequest, signal?: AbortSignal): Promise<RemoteResult<WebTerminalInfo>>;
13
+ environment(sessionId: string, signal?: AbortSignal): Promise<RemoteResult<TerminalEnvironment>>;
14
+ follow(sessionId: string, id: WebTerminalId, attachmentId: TerminalAttachmentId, signal?: AbortSignal): AsyncIterable<TerminalFrame>;
15
+ list(sessionId: string): Promise<RemoteResult<WebTerminalInfo[]>>;
16
+ rename(sessionId: string, id: WebTerminalId, title: string): Promise<RemoteResult<void>>;
17
+ resize(sessionId: string, id: WebTerminalId, attachmentId: TerminalAttachmentId, cols: number, rows: number): Promise<RemoteResult<void>>;
18
+ shells(sessionId: string, signal?: AbortSignal): Promise<RemoteResult<TerminalShell[]>>;
19
+ write(sessionId: string, id: WebTerminalId, attachmentId: TerminalAttachmentId, data: string): Promise<RemoteResult<void>>;
20
+ }
21
+ export type TerminalRemoteSource = TerminalRemote | (() => TerminalRemote | undefined);
22
+ export interface TerminalRenderFrame {
23
+ readonly revision: number;
24
+ readonly frame: Extract<TerminalFrame, {
25
+ readonly type: 'snapshot' | 'output';
26
+ }>;
27
+ }
28
+ export interface TerminalViewState {
29
+ readonly phase: 'idle' | 'loading' | 'creating' | 'connecting' | 'connected' | 'disconnected' | 'closing' | 'closed' | 'failed';
30
+ readonly environment?: TerminalEnvironment;
31
+ readonly info?: WebTerminalInfo;
32
+ readonly title: string;
33
+ readonly writable: boolean;
34
+ readonly render?: TerminalRenderFrame;
35
+ readonly error?: string;
36
+ }
37
+ export interface TerminalLaunchShells {
38
+ readonly shells: readonly TerminalShell[];
39
+ readonly selectedShell?: string;
40
+ }
41
+ export interface TerminalCloseFailure {
42
+ readonly sessionId: string;
43
+ readonly id: WebTerminalId;
44
+ readonly title: string;
45
+ readonly message: string;
46
+ }
47
+ export interface TerminalObservable<T> {
48
+ getSnapshot(): T;
49
+ subscribe(listener: () => void): () => void;
50
+ }
51
+ /** 一个 Sidebar 标签对应的终端模型;DOM 卸载只 detach,显式 close 才结束 Host 进程。 */
52
+ export declare class CodingNsTerminalView {
53
+ readonly sessionId: string;
54
+ readonly id: WebTerminalId;
55
+ private readonly remote;
56
+ private readonly createWhenMissing;
57
+ private readonly shellPath?;
58
+ private readonly onWorkspaceResolved?;
59
+ readonly state: TerminalObservable<TerminalViewState>;
60
+ private readonly store;
61
+ private readonly lifetime;
62
+ private followController;
63
+ private pendingRender;
64
+ private mounted;
65
+ private revision;
66
+ private loading;
67
+ private writes;
68
+ private attachmentId;
69
+ /** 最近一次已排队的尺寸;ResizeObserver 可能在同一布局周期内重复触发。 */
70
+ private lastResize;
71
+ constructor(sessionId: string, id: WebTerminalId, remote: TerminalRemoteSource, createWhenMissing: boolean, shellPath?: string | undefined, onWorkspaceResolved?: ((workspaceId: string) => void) | undefined);
72
+ mount(): () => void;
73
+ refresh(): Promise<void>;
74
+ acknowledge(revision: number): void;
75
+ write(data: string): void;
76
+ resize(cols: number, rows: number): void;
77
+ rename(title: string): Promise<void>;
78
+ close(): Promise<void>;
79
+ dispose(): Promise<void>;
80
+ private load;
81
+ private connect;
82
+ private consume;
83
+ private deliver;
84
+ private detach;
85
+ private patch;
86
+ private fail;
87
+ }
88
+ /** Codingns4DSH 自有的浏览器终端服务,不依赖官方 terminal-controller Client 实现。 */
89
+ export declare class CodingNsWebTerminals extends Service {
90
+ private readonly remote;
91
+ private readonly views;
92
+ private readonly workspaceIds;
93
+ private readonly recoveries;
94
+ private readonly closeFailureStore;
95
+ readonly closeFailures: TerminalObservable<readonly TerminalCloseFailure[]>;
96
+ private readonly closeRequests;
97
+ constructor(ctx: Context, remote: TerminalRemoteSource);
98
+ view(sessionId: string, key: string, contentId: string, terminalId?: WebTerminalId, shellPath?: string): CodingNsTerminalView;
99
+ /** 返回某个 Sidebar 内容已经保存的 Host 终端身份,用于恢复时去重。 */
100
+ boundTerminalId(sessionId: string, contentId: string): WebTerminalId | undefined;
101
+ launchShells(sessionId: string, signal: AbortSignal): Promise<TerminalLaunchShells>;
102
+ selectShell(path: string): void;
103
+ close(sessionId: string, key: string, contentId: string, terminalId?: WebTerminalId): void;
104
+ recover(sessionId: string): Promise<readonly WebTerminalInfo[]>;
105
+ retryClose(id: WebTerminalId): void;
106
+ dispose(): Promise<void>;
107
+ private rememberWorkspace;
108
+ private cleanup;
109
+ }
110
+ declare module '@deepseek-ai/cordis' {
111
+ interface Context {
112
+ /** Codingns4DSH 自有的浏览器终端模型服务。 */
113
+ webTerminals: CodingNsWebTerminals;
114
+ }
115
+ }
116
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1,435 @@
1
+ import { Service } from '@deepseek-ai/cordis';
2
+ class ObservableValue {
3
+ value;
4
+ listeners = new Set();
5
+ constructor(value) {
6
+ this.value = value;
7
+ }
8
+ getSnapshot() { return this.value; }
9
+ subscribe(listener) {
10
+ this.listeners.add(listener);
11
+ return () => this.listeners.delete(listener);
12
+ }
13
+ set(value) {
14
+ this.value = value;
15
+ for (const listener of [...this.listeners])
16
+ listener();
17
+ }
18
+ }
19
+ /** 一个 Sidebar 标签对应的终端模型;DOM 卸载只 detach,显式 close 才结束 Host 进程。 */
20
+ export class CodingNsTerminalView {
21
+ sessionId;
22
+ id;
23
+ remote;
24
+ createWhenMissing;
25
+ shellPath;
26
+ onWorkspaceResolved;
27
+ state;
28
+ store = new ObservableValue({ phase: 'idle', title: '终端', writable: false });
29
+ lifetime = new AbortController();
30
+ followController;
31
+ pendingRender;
32
+ mounted = 0;
33
+ revision = 0;
34
+ loading;
35
+ writes = Promise.resolve();
36
+ attachmentId;
37
+ /** 最近一次已排队的尺寸;ResizeObserver 可能在同一布局周期内重复触发。 */
38
+ lastResize;
39
+ constructor(sessionId, id, remote, createWhenMissing, shellPath, onWorkspaceResolved) {
40
+ this.sessionId = sessionId;
41
+ this.id = id;
42
+ this.remote = remote;
43
+ this.createWhenMissing = createWhenMissing;
44
+ this.shellPath = shellPath;
45
+ this.onWorkspaceResolved = onWorkspaceResolved;
46
+ this.state = this.store;
47
+ }
48
+ mount() {
49
+ this.mounted += 1;
50
+ if (this.mounted === 1)
51
+ void this.refresh();
52
+ let active = true;
53
+ return () => {
54
+ if (!active)
55
+ return;
56
+ active = false;
57
+ this.mounted = Math.max(0, this.mounted - 1);
58
+ if (this.mounted === 0)
59
+ this.detach();
60
+ };
61
+ }
62
+ async refresh() {
63
+ if (this.loading !== undefined)
64
+ return this.loading;
65
+ if (this.lifetime.signal.aborted)
66
+ return;
67
+ this.loading = this.load().finally(() => { this.loading = undefined; });
68
+ return this.loading;
69
+ }
70
+ acknowledge(revision) {
71
+ if (this.pendingRender?.revision !== revision)
72
+ return;
73
+ this.pendingRender.resolve();
74
+ this.pendingRender = undefined;
75
+ }
76
+ write(data) {
77
+ const state = this.store.getSnapshot();
78
+ const attachmentId = this.attachmentId;
79
+ if (!state.writable || attachmentId === undefined || data === '')
80
+ return;
81
+ const max = state.environment?.maxInputBytes ?? 64 * 1024;
82
+ if (new TextEncoder().encode(data).byteLength > max) {
83
+ this.patch({ error: '终端输入超过允许上限' });
84
+ return;
85
+ }
86
+ this.writes = this.writes
87
+ .then(async () => { unwrap(await resolveRemote(this.remote).write(this.sessionId, this.id, attachmentId, data)); })
88
+ .catch((error) => this.fail(error));
89
+ }
90
+ resize(cols, rows) {
91
+ const state = this.store.getSnapshot();
92
+ const attachmentId = this.attachmentId;
93
+ if (!state.writable || attachmentId === undefined)
94
+ return;
95
+ const nextCols = Math.max(1, Math.min(Math.floor(cols), state.environment?.maxCols ?? 500));
96
+ const nextRows = Math.max(1, Math.min(Math.floor(rows), state.environment?.maxRows ?? 200));
97
+ const request = { attachmentId, cols: nextCols, rows: nextRows };
98
+ if (sameResize(this.lastResize, request))
99
+ return;
100
+ this.lastResize = request;
101
+ this.writes = this.writes
102
+ .then(async () => { unwrap(await resolveRemote(this.remote).resize(this.sessionId, this.id, attachmentId, nextCols, nextRows)); })
103
+ .catch((error) => {
104
+ if (sameResize(this.lastResize, request))
105
+ this.lastResize = undefined;
106
+ this.fail(error);
107
+ });
108
+ }
109
+ async rename(title) {
110
+ const normalized = title.trim();
111
+ if (normalized === '' || normalized === this.store.getSnapshot().title)
112
+ return;
113
+ try {
114
+ unwrap(await resolveRemote(this.remote).rename(this.sessionId, this.id, normalized));
115
+ const info = this.store.getSnapshot().info;
116
+ this.patch({ title: normalized, ...(info === undefined ? {} : { info: { ...info, title: normalized } }) });
117
+ }
118
+ catch (error) {
119
+ this.fail(error);
120
+ }
121
+ }
122
+ async close() {
123
+ if (this.store.getSnapshot().phase === 'closed')
124
+ return;
125
+ this.patch({ phase: 'closing', writable: false });
126
+ this.detach();
127
+ unwrap(await resolveRemote(this.remote).close(this.sessionId, this.id));
128
+ this.patch({ phase: 'closed', writable: false });
129
+ }
130
+ async dispose() {
131
+ this.lifetime.abort(new Error('终端 Client 已卸载'));
132
+ this.detach();
133
+ await this.writes.catch(() => undefined);
134
+ }
135
+ async load() {
136
+ this.patch({ phase: 'loading', writable: false });
137
+ try {
138
+ const remote = resolveRemote(this.remote);
139
+ const environment = unwrap(await remote.environment(this.sessionId, this.lifetime.signal));
140
+ if (environment.workspaceId !== undefined)
141
+ this.onWorkspaceResolved?.(environment.workspaceId);
142
+ const listed = unwrap(await remote.list(this.sessionId));
143
+ let info = listed.find((entry) => entry.id === this.id);
144
+ if (info === undefined && this.createWhenMissing) {
145
+ this.patch({ phase: 'creating', environment });
146
+ info = unwrap(await remote.create(this.sessionId, {
147
+ id: this.id,
148
+ ...(this.shellPath === undefined ? {} : { shellPath: this.shellPath }),
149
+ cols: Math.min(80, environment.maxCols),
150
+ rows: Math.min(24, environment.maxRows),
151
+ }, this.lifetime.signal));
152
+ }
153
+ if (info === undefined)
154
+ throw new Error('Host 中不存在该终端,且恢复流程禁止自动创建替代进程');
155
+ this.patch({ environment, info, title: info.title });
156
+ if (this.mounted > 0)
157
+ this.connect();
158
+ }
159
+ catch (error) {
160
+ if (!this.lifetime.signal.aborted)
161
+ this.fail(error);
162
+ }
163
+ }
164
+ connect() {
165
+ if (this.followController !== undefined || this.lifetime.signal.aborted || this.mounted === 0)
166
+ return;
167
+ const controller = new AbortController();
168
+ this.followController = controller;
169
+ this.attachmentId = crypto.randomUUID();
170
+ this.lastResize = undefined;
171
+ this.patch({ phase: 'connecting', writable: false });
172
+ void this.consume(controller.signal);
173
+ }
174
+ async consume(signal) {
175
+ try {
176
+ const attachmentId = this.attachmentId;
177
+ if (attachmentId === undefined)
178
+ return;
179
+ for await (const frame of resolveRemote(this.remote).follow(this.sessionId, this.id, attachmentId, signal)) {
180
+ if (signal.aborted)
181
+ break;
182
+ if (frame.type === 'state') {
183
+ this.patch({ info: frame.info, title: frame.info.title });
184
+ continue;
185
+ }
186
+ await this.deliver(frame);
187
+ }
188
+ if (!signal.aborted)
189
+ this.patch({ phase: 'disconnected', writable: false });
190
+ }
191
+ catch (error) {
192
+ if (!signal.aborted)
193
+ this.fail(error);
194
+ }
195
+ finally {
196
+ if (this.followController?.signal === signal) {
197
+ this.followController = undefined;
198
+ this.attachmentId = undefined;
199
+ }
200
+ }
201
+ }
202
+ async deliver(frame) {
203
+ this.pendingRender?.resolve();
204
+ this.revision += 1;
205
+ let resolveWaiting = () => { };
206
+ const waiting = new Promise((resolve) => { resolveWaiting = resolve; });
207
+ this.pendingRender = { revision: this.revision, resolve: resolveWaiting };
208
+ this.patch({ phase: 'connected', writable: true, render: { revision: this.revision, frame } });
209
+ await waiting;
210
+ }
211
+ detach() {
212
+ this.pendingRender?.resolve();
213
+ this.pendingRender = undefined;
214
+ this.followController?.abort(new Error('终端视图已 detach'));
215
+ this.followController = undefined;
216
+ this.attachmentId = undefined;
217
+ this.lastResize = undefined;
218
+ if (!this.lifetime.signal.aborted && this.store.getSnapshot().phase !== 'closed') {
219
+ const { render: _render, ...state } = this.store.getSnapshot();
220
+ this.store.set({ ...state, phase: 'disconnected', writable: false });
221
+ }
222
+ }
223
+ patch(patch) {
224
+ this.store.set({ ...this.store.getSnapshot(), ...patch });
225
+ }
226
+ fail(error) {
227
+ this.patch({ phase: 'failed', writable: false, error: errorMessage(error) });
228
+ }
229
+ }
230
+ const BINDING_PREFIX = 'dsh.codingns.terminal.binding.v1.';
231
+ const CLOSE_REQUEST_KEY = 'dsh.codingns.terminal.close.v1';
232
+ const SHELL_KEY = 'dsh.codingns.terminal.shell.v1';
233
+ /** Codingns4DSH 自有的浏览器终端服务,不依赖官方 terminal-controller Client 实现。 */
234
+ export class CodingNsWebTerminals extends Service {
235
+ remote;
236
+ views = new Map();
237
+ workspaceIds = new Map();
238
+ recoveries = new Map();
239
+ closeFailureStore = new ObservableValue([]);
240
+ closeFailures = this.closeFailureStore;
241
+ closeRequests = new Map();
242
+ constructor(ctx, remote) {
243
+ super(ctx, 'webTerminals');
244
+ this.remote = remote;
245
+ for (const request of readCloseRequests())
246
+ this.closeRequests.set(String(request.id), request);
247
+ for (const request of this.closeRequests.values())
248
+ void this.cleanup(request);
249
+ }
250
+ view(sessionId, key, contentId, terminalId, shellPath) {
251
+ const mapKey = JSON.stringify([sessionId, key]);
252
+ const existing = this.views.get(mapKey);
253
+ if (existing !== undefined)
254
+ return existing.view;
255
+ const workspaceId = this.workspaceIds.get(sessionId);
256
+ const saved = terminalId
257
+ ?? (workspaceId === undefined ? undefined : readWorkspaceBinding(workspaceId, contentId))
258
+ ?? readBinding(sessionId, contentId);
259
+ const id = saved ?? crypto.randomUUID();
260
+ if (saved === undefined)
261
+ writeBinding(sessionId, contentId, id);
262
+ const view = new CodingNsTerminalView(sessionId, id, this.remote, saved === undefined, shellPath, (resolvedWorkspaceId) => this.rememberWorkspace(sessionId, contentId, id, resolvedWorkspaceId));
263
+ this.views.set(mapKey, { contentId, view });
264
+ return view;
265
+ }
266
+ /** 返回某个 Sidebar 内容已经保存的 Host 终端身份,用于恢复时去重。 */
267
+ boundTerminalId(sessionId, contentId) {
268
+ const workspaceId = this.workspaceIds.get(sessionId);
269
+ return (workspaceId === undefined ? undefined : readWorkspaceBinding(workspaceId, contentId))
270
+ ?? readBinding(sessionId, contentId);
271
+ }
272
+ async launchShells(sessionId, signal) {
273
+ const shells = unwrap(await resolveRemote(this.remote).shells(sessionId, signal));
274
+ const preferred = readString(SHELL_KEY);
275
+ return {
276
+ shells,
277
+ ...(preferred !== null && shells.some((shell) => shell.path === preferred) ? { selectedShell: preferred } : {}),
278
+ };
279
+ }
280
+ selectShell(path) { writeString(SHELL_KEY, path); }
281
+ close(sessionId, key, contentId, terminalId) {
282
+ const mapKey = JSON.stringify([sessionId, key]);
283
+ const record = this.views.get(mapKey);
284
+ const id = terminalId ?? record?.view.id ?? this.boundTerminalId(sessionId, contentId);
285
+ if (id === undefined)
286
+ return;
287
+ const request = { sessionId, id, title: record?.view.state.getSnapshot().title ?? '终端' };
288
+ this.closeRequests.set(String(id), request);
289
+ persistCloseRequests(this.closeRequests.values());
290
+ deleteBinding(sessionId, contentId);
291
+ const workspaceId = this.workspaceIds.get(sessionId);
292
+ if (workspaceId !== undefined)
293
+ deleteWorkspaceBinding(workspaceId, contentId);
294
+ this.views.delete(mapKey);
295
+ void this.cleanup(request, record?.view);
296
+ }
297
+ async recover(sessionId) {
298
+ const pending = this.recoveries.get(sessionId);
299
+ if (pending !== undefined)
300
+ return pending;
301
+ // 官方 list wire 只有 sessionId;先用 agent-scoped environment 让 Host 解析工作区。
302
+ const recovery = (async () => {
303
+ const environment = unwrap(await resolveRemote(this.remote).environment(sessionId));
304
+ if (environment.workspaceId !== undefined)
305
+ this.workspaceIds.set(sessionId, environment.workspaceId);
306
+ return unwrap(await resolveRemote(this.remote).list(sessionId));
307
+ })().finally(() => this.recoveries.delete(sessionId));
308
+ this.recoveries.set(sessionId, recovery);
309
+ return recovery;
310
+ }
311
+ retryClose(id) {
312
+ const request = this.closeRequests.get(String(id));
313
+ if (request !== undefined)
314
+ void this.cleanup(request);
315
+ }
316
+ async dispose() {
317
+ await Promise.all([...this.views.values()].map((record) => record.view.dispose()));
318
+ this.views.clear();
319
+ this.workspaceIds.clear();
320
+ this.recoveries.clear();
321
+ }
322
+ rememberWorkspace(sessionId, contentId, id, workspaceId) {
323
+ this.workspaceIds.set(sessionId, workspaceId);
324
+ writeWorkspaceBinding(workspaceId, contentId, id);
325
+ }
326
+ async cleanup(request, view) {
327
+ try {
328
+ if (view === undefined)
329
+ unwrap(await resolveRemote(this.remote).close(request.sessionId, request.id));
330
+ else
331
+ await view.close();
332
+ this.closeRequests.delete(String(request.id));
333
+ persistCloseRequests(this.closeRequests.values());
334
+ this.closeFailureStore.set(this.closeFailureStore.getSnapshot().filter((item) => item.id !== request.id));
335
+ }
336
+ catch (error) {
337
+ const failure = { ...request, message: errorMessage(error) };
338
+ this.closeFailureStore.set([...this.closeFailureStore.getSnapshot().filter((item) => item.id !== request.id), failure]);
339
+ }
340
+ }
341
+ }
342
+ function unwrap(result) {
343
+ if (typeof result !== 'object' || result === null || !('ok' in result)) {
344
+ throw new Error('终端服务返回了无效响应');
345
+ }
346
+ if (result.ok)
347
+ return result.value;
348
+ throw result.error;
349
+ }
350
+ function resolveRemote(source) {
351
+ const remote = typeof source === 'function' ? source() : source;
352
+ if (remote === undefined)
353
+ throw new Error('终端服务尚未就绪,请稍后重试');
354
+ return remote;
355
+ }
356
+ function sameResize(left, right) {
357
+ return left?.attachmentId === right.attachmentId && left.cols === right.cols && left.rows === right.rows;
358
+ }
359
+ function errorMessage(error) {
360
+ return error instanceof Error ? error.message : String(error);
361
+ }
362
+ function bindingKey(sessionId, contentId) {
363
+ return `${BINDING_PREFIX}${JSON.stringify([sessionId, contentId])}`;
364
+ }
365
+ function workspaceBindingKey(workspaceId, contentId) {
366
+ return `${BINDING_PREFIX}${JSON.stringify(['workspace', workspaceId, contentId])}`;
367
+ }
368
+ function readBinding(sessionId, contentId) {
369
+ const value = readString(bindingKey(sessionId, contentId));
370
+ return value !== null && /^[\w-]{1,128}$/u.test(value) ? value : undefined;
371
+ }
372
+ function writeBinding(sessionId, contentId, id) {
373
+ writeString(bindingKey(sessionId, contentId), String(id));
374
+ }
375
+ function readWorkspaceBinding(workspaceId, contentId) {
376
+ const value = readString(workspaceBindingKey(workspaceId, contentId));
377
+ return value !== null && /^[\w-]{1,128}$/u.test(value) ? value : undefined;
378
+ }
379
+ function writeWorkspaceBinding(workspaceId, contentId, id) {
380
+ writeString(workspaceBindingKey(workspaceId, contentId), String(id));
381
+ }
382
+ function deleteWorkspaceBinding(workspaceId, contentId) {
383
+ try {
384
+ localStorage.removeItem(workspaceBindingKey(workspaceId, contentId));
385
+ }
386
+ catch { /* 浏览器禁用存储时仅失去跨刷新绑定。 */ }
387
+ }
388
+ function deleteBinding(sessionId, contentId) {
389
+ try {
390
+ localStorage.removeItem(bindingKey(sessionId, contentId));
391
+ }
392
+ catch { /* 浏览器禁用存储时仅失去跨刷新绑定。 */ }
393
+ }
394
+ function readCloseRequests() {
395
+ const raw = readString(CLOSE_REQUEST_KEY);
396
+ if (raw === null)
397
+ return [];
398
+ try {
399
+ const values = JSON.parse(raw);
400
+ if (!Array.isArray(values))
401
+ return [];
402
+ return values.filter(isCloseRequest);
403
+ }
404
+ catch {
405
+ return [];
406
+ }
407
+ }
408
+ function isCloseRequest(value) {
409
+ if (typeof value !== 'object' || value === null)
410
+ return false;
411
+ const record = value;
412
+ return typeof record.sessionId === 'string' && typeof record.id === 'string' && typeof record.title === 'string';
413
+ }
414
+ function persistCloseRequests(requests) {
415
+ writeString(CLOSE_REQUEST_KEY, JSON.stringify([...requests]));
416
+ }
417
+ function readString(key) {
418
+ if (typeof localStorage === 'undefined')
419
+ return null;
420
+ try {
421
+ return localStorage.getItem(key);
422
+ }
423
+ catch {
424
+ return null;
425
+ }
426
+ }
427
+ function writeString(key, value) {
428
+ if (typeof localStorage === 'undefined')
429
+ return;
430
+ try {
431
+ localStorage.setItem(key, value);
432
+ }
433
+ catch { /* 无痕或受限环境继续使用内存状态。 */ }
434
+ }
435
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1,21 @@
1
+ export declare const terminalClass: {
2
+ readonly guideEntry: "codingns4dsh-terminal-guide-entry";
3
+ readonly guideMain: "codingns4dsh-terminal-guide-main";
4
+ readonly guideIcon: "codingns4dsh-terminal-guide-icon";
5
+ readonly guideText: "codingns4dsh-terminal-guide-text";
6
+ readonly guideTitle: "codingns4dsh-terminal-guide-title";
7
+ readonly guideDescription: "codingns4dsh-terminal-guide-description";
8
+ readonly guideTrigger: "codingns4dsh-terminal-guide-trigger";
9
+ readonly guideMenu: "codingns4dsh-terminal-guide-menu";
10
+ readonly title: "codingns4dsh-terminal-title";
11
+ readonly titleInput: "codingns4dsh-terminal-title-input";
12
+ readonly root: "codingns4dsh-terminal-root";
13
+ readonly screen: "codingns4dsh-terminal-screen";
14
+ readonly status: "codingns4dsh-terminal-status";
15
+ readonly error: "codingns4dsh-terminal-error";
16
+ readonly cleanupStack: "codingns4dsh-terminal-cleanup-stack";
17
+ readonly cleanupNotice: "codingns4dsh-terminal-cleanup-notice";
18
+ };
19
+ /** 安装与 DSH 0.1.6 内置终端相同的布局和主题令牌。 */
20
+ export declare function installTerminalStyles(): () => void;
21
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1,51 @@
1
+ const STYLE_ID = 'codingns4dsh-terminal-ui';
2
+ export const terminalClass = {
3
+ guideEntry: 'codingns4dsh-terminal-guide-entry',
4
+ guideMain: 'codingns4dsh-terminal-guide-main',
5
+ guideIcon: 'codingns4dsh-terminal-guide-icon',
6
+ guideText: 'codingns4dsh-terminal-guide-text',
7
+ guideTitle: 'codingns4dsh-terminal-guide-title',
8
+ guideDescription: 'codingns4dsh-terminal-guide-description',
9
+ guideTrigger: 'codingns4dsh-terminal-guide-trigger',
10
+ guideMenu: 'codingns4dsh-terminal-guide-menu',
11
+ title: 'codingns4dsh-terminal-title',
12
+ titleInput: 'codingns4dsh-terminal-title-input',
13
+ root: 'codingns4dsh-terminal-root',
14
+ screen: 'codingns4dsh-terminal-screen',
15
+ status: 'codingns4dsh-terminal-status',
16
+ error: 'codingns4dsh-terminal-error',
17
+ cleanupStack: 'codingns4dsh-terminal-cleanup-stack',
18
+ cleanupNotice: 'codingns4dsh-terminal-cleanup-notice',
19
+ };
20
+ /** 安装与 DSH 0.1.6 内置终端相同的布局和主题令牌。 */
21
+ export function installTerminalStyles() {
22
+ const existing = document.querySelector(`style[data-plugin-css="${STYLE_ID}"]`);
23
+ if (existing !== null)
24
+ return () => undefined;
25
+ const style = document.createElement('style');
26
+ style.dataset.plugin = 'codingns4dsh';
27
+ style.dataset.pluginCss = STYLE_ID;
28
+ style.textContent = terminalCss;
29
+ document.head.appendChild(style);
30
+ return () => style.remove();
31
+ }
32
+ const terminalCss = `
33
+ .${terminalClass.guideEntry}{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-1);border-radius:24px;align-items:stretch;width:100%;display:flex;overflow:hidden}
34
+ .${terminalClass.guideMain}{text-align:left;border-radius:24px 0 0 24px;flex:1;justify-content:flex-start;gap:14px;min-width:0;height:auto;min-height:56px;padding:14px 20px}
35
+ .${terminalClass.guideIcon}{flex:none}
36
+ .${terminalClass.guideText}{flex-direction:column;gap:3px;min-width:0;display:flex}
37
+ .${terminalClass.guideTitle}{color:var(--dsw-alias-label-primary);white-space:nowrap;text-overflow:ellipsis;font-size:15px;line-height:1.4;overflow:hidden}
38
+ .${terminalClass.guideDescription}{color:var(--dsw-alias-label-caption);white-space:nowrap;text-overflow:ellipsis;font-size:13px;line-height:1.4;overflow:hidden}
39
+ .${terminalClass.guideTrigger}{border-radius:0 24px 24px 0;flex:none;align-self:stretch;width:44px;height:auto;padding:0}
40
+ .${terminalClass.guideMenu}{flex:none;align-self:stretch;display:flex}
41
+ .${terminalClass.title}{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}
42
+ .${terminalClass.titleInput}{width:120px;min-width:48px;max-width:100%;color:inherit;font:inherit;background:var(--dsw-alias-bg-l1);border:.5px solid var(--dsw-alias-border-l3);border-radius:4px;outline:none;padding:0 4px}
43
+ .${terminalClass.root}{box-sizing:border-box;height:100%;min-height:0;color:var(--dsw-alias-label-primary);flex-direction:column;flex:1;padding-top:8px;font-size:13px;display:flex}
44
+ .${terminalClass.screen}{min-width:0;min-height:0;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);flex:1;padding:8px;overflow:hidden}
45
+ .${terminalClass.status}{background:var(--dsw-alias-bg-l2);flex-wrap:wrap;align-items:center;gap:8px;padding:5px 12px;display:flex}
46
+ .${terminalClass.error}{overflow-wrap:anywhere;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-l2);margin:0;padding:10px 12px}
47
+ .${terminalClass.cleanupStack}{pointer-events:auto;gap:8px;max-width:min(440px,calc(100vw - 40px));display:grid;position:fixed;bottom:20px;right:20px}
48
+ .${terminalClass.cleanupNotice}{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-l1);overflow-wrap:anywhere;border-radius:8px;align-items:center;gap:12px;padding:12px 16px;font-size:13px;display:flex;box-shadow:0 4px 20px #0002}
49
+ .${terminalClass.cleanupNotice} button{border:.5px solid var(--dsw-alias-border-l3);color:inherit;cursor:pointer;background:transparent;border-radius:4px;flex-shrink:0;padding:4px 8px}
50
+ `;
51
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,19 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { SettingsScope } from '@deepseek-ai/dsh-client-ui-settings/client';
3
+ import type { CodingNsSettings } from '../../shared/contracts/config.js';
4
+ import { CodingNsWebTerminals, type WebTerminalId } from './model.js';
5
+ export declare const TERMINAL_PROVIDER_ID = "codingns4dsh/terminal";
6
+ export declare const TERMINAL_KIND = "terminal";
7
+ interface TerminalParams {
8
+ readonly terminalId?: WebTerminalId;
9
+ readonly shellPath?: string;
10
+ }
11
+ /** 注册终端类型及其所有公开 Sidebar Slot。 */
12
+ export declare function registerCodingNsTerminalUi(ctx: Context, webTerminals: CodingNsWebTerminals, settings: SettingsScope<CodingNsSettings>): () => void;
13
+ declare module '@deepseek-ai/dsh-client-ui-sidebar-right/client' {
14
+ interface SidebarRightTabParamsMap {
15
+ terminal: TerminalParams;
16
+ }
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=ui.d.ts.map