@jingyi0605/codingns4dsh 0.2.0-beta.2 → 0.2.0-rc3

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 (604) hide show
  1. package/README.en.md +4 -4
  2. package/README.md +18 -7
  3. package/assets/provider-icons/antigravity.svg +39 -0
  4. package/assets/provider-icons/codebuddy.svg +37 -0
  5. package/assets/provider-icons/cursor-cli.svg +1 -0
  6. package/assets/provider-icons/kiro-cli.svg +11 -0
  7. package/assets/provider-icons/minimax-code.svg +4 -0
  8. package/assets/provider-icons/qoder-cn.svg +5 -0
  9. package/assets/provider-icons/qoder.svg +5 -0
  10. package/assets/provider-icons/workbuddy.svg +29 -0
  11. package/assets/provider-icons/zcode.svg +14 -0
  12. package/data/build/dist/bootstrap/dsh-peer-host-preboot-shim.d.ts.map +1 -1
  13. package/data/build/dist/bootstrap/dsh-peer-host-preboot-shim.js +78 -1
  14. package/data/build/dist/bootstrap/dsh-peer-host-preboot-shim.js.map +1 -1
  15. package/data/build/dist/client/account-bar.d.ts +2 -1
  16. package/data/build/dist/client/account-bar.d.ts.map +1 -1
  17. package/data/build/dist/client/account-bar.js +21 -16
  18. package/data/build/dist/client/account-bar.js.map +1 -1
  19. package/data/build/dist/client/bundle.js +8147 -2158
  20. package/data/build/dist/client/bundle.js.map +1 -1
  21. package/data/build/dist/client/cli-catalog.d.ts +1 -1
  22. package/data/build/dist/client/cli-catalog.d.ts.map +1 -1
  23. package/data/build/dist/client/cli-catalog.js +11 -5
  24. package/data/build/dist/client/cli-catalog.js.map +1 -1
  25. package/data/build/dist/client/cli-slots.d.ts.map +1 -1
  26. package/data/build/dist/client/cli-slots.js +127 -21
  27. package/data/build/dist/client/cli-slots.js.map +1 -1
  28. package/data/build/dist/client/debug/ui.d.ts +2 -1
  29. package/data/build/dist/client/debug/ui.d.ts.map +1 -1
  30. package/data/build/dist/client/debug/ui.js +41 -34
  31. package/data/build/dist/client/debug/ui.js.map +1 -1
  32. package/data/build/dist/client/delegate-command.d.ts +17 -0
  33. package/data/build/dist/client/delegate-command.d.ts.map +1 -0
  34. package/data/build/dist/client/delegate-command.js +597 -0
  35. package/data/build/dist/client/delegate-command.js.map +1 -0
  36. package/data/build/dist/client/delegate-plan.d.ts +40 -0
  37. package/data/build/dist/client/delegate-plan.d.ts.map +1 -0
  38. package/data/build/dist/client/delegate-plan.js +63 -0
  39. package/data/build/dist/client/delegate-plan.js.map +1 -0
  40. package/data/build/dist/client/delegate-ui-dom.d.ts +86 -0
  41. package/data/build/dist/client/delegate-ui-dom.d.ts.map +1 -0
  42. package/data/build/dist/client/delegate-ui-dom.js +647 -0
  43. package/data/build/dist/client/delegate-ui-dom.js.map +1 -0
  44. package/data/build/dist/client/external-tool-stream.d.ts.map +1 -1
  45. package/data/build/dist/client/external-tool-stream.js +44 -36
  46. package/data/build/dist/client/external-tool-stream.js.map +1 -1
  47. package/data/build/dist/client/features/cli-adapters.d.ts +7 -2
  48. package/data/build/dist/client/features/cli-adapters.d.ts.map +1 -1
  49. package/data/build/dist/client/features/cli-adapters.js +153 -95
  50. package/data/build/dist/client/features/cli-adapters.js.map +1 -1
  51. package/data/build/dist/client/features/debug.d.ts.map +1 -1
  52. package/data/build/dist/client/features/debug.js +5 -3
  53. package/data/build/dist/client/features/debug.js.map +1 -1
  54. package/data/build/dist/client/features/file-management.d.ts.map +1 -1
  55. package/data/build/dist/client/features/file-management.js +7 -4
  56. package/data/build/dist/client/features/file-management.js.map +1 -1
  57. package/data/build/dist/client/features/lan-access-panel.js +10 -10
  58. package/data/build/dist/client/features/lan-access-panel.js.map +1 -1
  59. package/data/build/dist/client/features/lan-access.d.ts.map +1 -1
  60. package/data/build/dist/client/features/lan-access.js +8 -3
  61. package/data/build/dist/client/features/lan-access.js.map +1 -1
  62. package/data/build/dist/client/features/login-protection-panel.d.ts.map +1 -1
  63. package/data/build/dist/client/features/login-protection-panel.js +9 -7
  64. package/data/build/dist/client/features/login-protection-panel.js.map +1 -1
  65. package/data/build/dist/client/features/login-protection.js +2 -2
  66. package/data/build/dist/client/features/login-protection.js.map +1 -1
  67. package/data/build/dist/client/features/mobile-access-panel.d.ts.map +1 -1
  68. package/data/build/dist/client/features/mobile-access-panel.js +8 -7
  69. package/data/build/dist/client/features/mobile-access-panel.js.map +1 -1
  70. package/data/build/dist/client/features/mobile-access.d.ts.map +1 -1
  71. package/data/build/dist/client/features/mobile-access.js +6 -2
  72. package/data/build/dist/client/features/mobile-access.js.map +1 -1
  73. package/data/build/dist/client/features/peer-host.d.ts +6 -4
  74. package/data/build/dist/client/features/peer-host.d.ts.map +1 -1
  75. package/data/build/dist/client/features/peer-host.js +459 -27
  76. package/data/build/dist/client/features/peer-host.js.map +1 -1
  77. package/data/build/dist/client/features/reverse-proxy.js +2 -2
  78. package/data/build/dist/client/features/reverse-proxy.js.map +1 -1
  79. package/data/build/dist/client/features/terminal-enhancement.js +2 -2
  80. package/data/build/dist/client/features/terminal-enhancement.js.map +1 -1
  81. package/data/build/dist/client/features/workspace-session-enhancement-panel.js +1 -1
  82. package/data/build/dist/client/features/workspace-session-enhancement-panel.js.map +1 -1
  83. package/data/build/dist/client/features/workspace-session-enhancement.d.ts.map +1 -1
  84. package/data/build/dist/client/features/workspace-session-enhancement.js +8 -3
  85. package/data/build/dist/client/features/workspace-session-enhancement.js.map +1 -1
  86. package/data/build/dist/client/file-management-dom.d.ts +3 -0
  87. package/data/build/dist/client/file-management-dom.d.ts.map +1 -1
  88. package/data/build/dist/client/file-management-dom.js +41 -30
  89. package/data/build/dist/client/file-management-dom.js.map +1 -1
  90. package/data/build/dist/client/git-history-graph.d.ts +2 -2
  91. package/data/build/dist/client/git-history-graph.d.ts.map +1 -1
  92. package/data/build/dist/client/git-history-graph.js +2 -2
  93. package/data/build/dist/client/git-history-graph.js.map +1 -1
  94. package/data/build/dist/client/git-management.d.ts +2 -0
  95. package/data/build/dist/client/git-management.d.ts.map +1 -1
  96. package/data/build/dist/client/git-management.js +103 -75
  97. package/data/build/dist/client/git-management.js.map +1 -1
  98. package/data/build/dist/client/git-workspace-events.d.ts +7 -0
  99. package/data/build/dist/client/git-workspace-events.d.ts.map +1 -0
  100. package/data/build/dist/client/git-workspace-events.js +32 -0
  101. package/data/build/dist/client/git-workspace-events.js.map +1 -0
  102. package/data/build/dist/client/index.d.ts +2 -0
  103. package/data/build/dist/client/index.d.ts.map +1 -1
  104. package/data/build/dist/client/index.js +6 -5
  105. package/data/build/dist/client/index.js.map +1 -1
  106. package/data/build/dist/client/locale.d.ts +7 -0
  107. package/data/build/dist/client/locale.d.ts.map +1 -1
  108. package/data/build/dist/client/locale.js +140 -42
  109. package/data/build/dist/client/locale.js.map +1 -1
  110. package/data/build/dist/client/locales/debug.d.ts +9 -0
  111. package/data/build/dist/client/locales/debug.d.ts.map +1 -0
  112. package/data/build/dist/client/locales/debug.js +163 -0
  113. package/data/build/dist/client/locales/debug.js.map +1 -0
  114. package/data/build/dist/client/locales/fileWorkspace.d.ts +9 -0
  115. package/data/build/dist/client/locales/fileWorkspace.d.ts.map +1 -0
  116. package/data/build/dist/client/locales/fileWorkspace.js +139 -0
  117. package/data/build/dist/client/locales/fileWorkspace.js.map +1 -0
  118. package/data/build/dist/client/locales/git.d.ts +9 -0
  119. package/data/build/dist/client/locales/git.d.ts.map +1 -0
  120. package/data/build/dist/client/locales/git.js +223 -0
  121. package/data/build/dist/client/locales/git.js.map +1 -0
  122. package/data/build/dist/client/locales/panels.d.ts +9 -0
  123. package/data/build/dist/client/locales/panels.d.ts.map +1 -0
  124. package/data/build/dist/client/locales/panels.js +33 -0
  125. package/data/build/dist/client/locales/panels.js.map +1 -0
  126. package/data/build/dist/client/locales/peerHost.d.ts +9 -0
  127. package/data/build/dist/client/locales/peerHost.d.ts.map +1 -0
  128. package/data/build/dist/client/locales/peerHost.js +153 -0
  129. package/data/build/dist/client/locales/peerHost.js.map +1 -0
  130. package/data/build/dist/client/locales/peerHostWorkspace.d.ts +9 -0
  131. package/data/build/dist/client/locales/peerHostWorkspace.d.ts.map +1 -0
  132. package/data/build/dist/client/locales/peerHostWorkspace.js +69 -0
  133. package/data/build/dist/client/locales/peerHostWorkspace.js.map +1 -0
  134. package/data/build/dist/client/locales/terminalAuth.d.ts +9 -0
  135. package/data/build/dist/client/locales/terminalAuth.d.ts.map +1 -0
  136. package/data/build/dist/client/locales/terminalAuth.js +71 -0
  137. package/data/build/dist/client/locales/terminalAuth.js.map +1 -0
  138. package/data/build/dist/client/locales/usage.d.ts +9 -0
  139. package/data/build/dist/client/locales/usage.d.ts.map +1 -0
  140. package/data/build/dist/client/locales/usage.js +215 -0
  141. package/data/build/dist/client/locales/usage.js.map +1 -0
  142. package/data/build/dist/client/mobile-session-interaction.d.ts +44 -0
  143. package/data/build/dist/client/mobile-session-interaction.d.ts.map +1 -0
  144. package/data/build/dist/client/mobile-session-interaction.js +308 -0
  145. package/data/build/dist/client/mobile-session-interaction.js.map +1 -0
  146. package/data/build/dist/client/mobile-sidebar-gestures.d.ts +55 -7
  147. package/data/build/dist/client/mobile-sidebar-gestures.d.ts.map +1 -1
  148. package/data/build/dist/client/mobile-sidebar-gestures.js +339 -40
  149. package/data/build/dist/client/mobile-sidebar-gestures.js.map +1 -1
  150. package/data/build/dist/client/mobile-sidebar-rail-dom.d.ts +10 -2
  151. package/data/build/dist/client/mobile-sidebar-rail-dom.d.ts.map +1 -1
  152. package/data/build/dist/client/mobile-sidebar-rail-dom.js +14 -6
  153. package/data/build/dist/client/mobile-sidebar-rail-dom.js.map +1 -1
  154. package/data/build/dist/client/model-catalog-cache.d.ts +5 -0
  155. package/data/build/dist/client/model-catalog-cache.d.ts.map +1 -0
  156. package/data/build/dist/client/model-catalog-cache.js +58 -0
  157. package/data/build/dist/client/model-catalog-cache.js.map +1 -0
  158. package/data/build/dist/client/peer-host-aggregate-refresh.d.ts +7 -0
  159. package/data/build/dist/client/peer-host-aggregate-refresh.d.ts.map +1 -1
  160. package/data/build/dist/client/peer-host-aggregate-refresh.js +13 -1
  161. package/data/build/dist/client/peer-host-aggregate-refresh.js.map +1 -1
  162. package/data/build/dist/client/peer-host-connection-button.d.ts +14 -1
  163. package/data/build/dist/client/peer-host-connection-button.d.ts.map +1 -1
  164. package/data/build/dist/client/peer-host-connection-button.js +12 -4
  165. package/data/build/dist/client/peer-host-connection-button.js.map +1 -1
  166. package/data/build/dist/client/peer-host-management-panel.d.ts +3 -0
  167. package/data/build/dist/client/peer-host-management-panel.d.ts.map +1 -1
  168. package/data/build/dist/client/peer-host-management-panel.js +83 -79
  169. package/data/build/dist/client/peer-host-management-panel.js.map +1 -1
  170. package/data/build/dist/client/peer-host-native-projection.d.ts +17 -1
  171. package/data/build/dist/client/peer-host-native-projection.d.ts.map +1 -1
  172. package/data/build/dist/client/peer-host-native-projection.js +54 -8
  173. package/data/build/dist/client/peer-host-native-projection.js.map +1 -1
  174. package/data/build/dist/client/peer-host-native-store-projection.d.ts +6 -2
  175. package/data/build/dist/client/peer-host-native-store-projection.d.ts.map +1 -1
  176. package/data/build/dist/client/peer-host-native-store-projection.js +308 -10
  177. package/data/build/dist/client/peer-host-native-store-projection.js.map +1 -1
  178. package/data/build/dist/client/peer-host-scoped-client.js +5 -5
  179. package/data/build/dist/client/peer-host-scoped-client.js.map +1 -1
  180. package/data/build/dist/client/peer-host-workspace-tab.d.ts +8 -0
  181. package/data/build/dist/client/peer-host-workspace-tab.d.ts.map +1 -1
  182. package/data/build/dist/client/peer-host-workspace-tab.js +48 -28
  183. package/data/build/dist/client/peer-host-workspace-tab.js.map +1 -1
  184. package/data/build/dist/client/provider-icon-assets.js +18 -0
  185. package/data/build/dist/client/provider-icon-assets.js.map +1 -1
  186. package/data/build/dist/client/provider-icons.d.ts +8 -2
  187. package/data/build/dist/client/provider-icons.d.ts.map +1 -1
  188. package/data/build/dist/client/provider-icons.js +28 -7
  189. package/data/build/dist/client/provider-icons.js.map +1 -1
  190. package/data/build/dist/client/pwa-install-prompt.d.ts +4 -1
  191. package/data/build/dist/client/pwa-install-prompt.d.ts.map +1 -1
  192. package/data/build/dist/client/pwa-install-prompt.js +8 -7
  193. package/data/build/dist/client/pwa-install-prompt.js.map +1 -1
  194. package/data/build/dist/client/quick-phrase-layout.d.ts +11 -0
  195. package/data/build/dist/client/quick-phrase-layout.d.ts.map +1 -1
  196. package/data/build/dist/client/quick-phrase-layout.js +20 -0
  197. package/data/build/dist/client/quick-phrase-layout.js.map +1 -1
  198. package/data/build/dist/client/quick-phrase-slot.d.ts.map +1 -1
  199. package/data/build/dist/client/quick-phrase-slot.js +20 -8
  200. package/data/build/dist/client/quick-phrase-slot.js.map +1 -1
  201. package/data/build/dist/client/remote-web-context.js +10 -6
  202. package/data/build/dist/client/remote-web-context.js.map +1 -1
  203. package/data/build/dist/client/service-tier.d.ts +54 -0
  204. package/data/build/dist/client/service-tier.d.ts.map +1 -0
  205. package/data/build/dist/client/service-tier.js +78 -0
  206. package/data/build/dist/client/service-tier.js.map +1 -0
  207. package/data/build/dist/client/session-changed-files-view.d.ts +8 -1
  208. package/data/build/dist/client/session-changed-files-view.d.ts.map +1 -1
  209. package/data/build/dist/client/session-changed-files-view.js +71 -28
  210. package/data/build/dist/client/session-changed-files-view.js.map +1 -1
  211. package/data/build/dist/client/settings-anchor.d.ts +9 -3
  212. package/data/build/dist/client/settings-anchor.d.ts.map +1 -1
  213. package/data/build/dist/client/settings-anchor.js +8 -2
  214. package/data/build/dist/client/settings-anchor.js.map +1 -1
  215. package/data/build/dist/client/settings-promo-styles.d.ts +28 -0
  216. package/data/build/dist/client/settings-promo-styles.d.ts.map +1 -0
  217. package/data/build/dist/client/settings-promo-styles.js +58 -0
  218. package/data/build/dist/client/settings-promo-styles.js.map +1 -0
  219. package/data/build/dist/client/settings-promo.d.ts +14 -0
  220. package/data/build/dist/client/settings-promo.d.ts.map +1 -0
  221. package/data/build/dist/client/settings-promo.js +68 -0
  222. package/data/build/dist/client/settings-promo.js.map +1 -0
  223. package/data/build/dist/client/settings-section.d.ts +2 -1
  224. package/data/build/dist/client/settings-section.d.ts.map +1 -1
  225. package/data/build/dist/client/settings-section.js +10 -7
  226. package/data/build/dist/client/settings-section.js.map +1 -1
  227. package/data/build/dist/client/subscription-slot.d.ts +4 -1
  228. package/data/build/dist/client/subscription-slot.d.ts.map +1 -1
  229. package/data/build/dist/client/subscription-slot.js +497 -56
  230. package/data/build/dist/client/subscription-slot.js.map +1 -1
  231. package/data/build/dist/client/terminal/model.d.ts +94 -4
  232. package/data/build/dist/client/terminal/model.d.ts.map +1 -1
  233. package/data/build/dist/client/terminal/model.js +392 -33
  234. package/data/build/dist/client/terminal/model.js.map +1 -1
  235. package/data/build/dist/client/terminal/recovery.d.ts +16 -1
  236. package/data/build/dist/client/terminal/recovery.d.ts.map +1 -1
  237. package/data/build/dist/client/terminal/recovery.js +101 -39
  238. package/data/build/dist/client/terminal/recovery.js.map +1 -1
  239. package/data/build/dist/client/terminal/styles.d.ts +10 -0
  240. package/data/build/dist/client/terminal/styles.d.ts.map +1 -1
  241. package/data/build/dist/client/terminal/styles.js +27 -3
  242. package/data/build/dist/client/terminal/styles.js.map +1 -1
  243. package/data/build/dist/client/terminal/ui.d.ts +3 -2
  244. package/data/build/dist/client/terminal/ui.d.ts.map +1 -1
  245. package/data/build/dist/client/terminal/ui.js +216 -103
  246. package/data/build/dist/client/terminal/ui.js.map +1 -1
  247. package/data/build/dist/client/terminal/xterm-view.d.ts +8 -1
  248. package/data/build/dist/client/terminal/xterm-view.d.ts.map +1 -1
  249. package/data/build/dist/client/terminal/xterm-view.js +394 -34
  250. package/data/build/dist/client/terminal/xterm-view.js.map +1 -1
  251. package/data/build/dist/client/workspace-session-archive-dom.d.ts +3 -0
  252. package/data/build/dist/client/workspace-session-archive-dom.d.ts.map +1 -1
  253. package/data/build/dist/client/workspace-session-archive-dom.js +131 -45
  254. package/data/build/dist/client/workspace-session-archive-dom.js.map +1 -1
  255. package/data/build/dist/client/workspace-session-logo-dom.d.ts +3 -0
  256. package/data/build/dist/client/workspace-session-logo-dom.d.ts.map +1 -1
  257. package/data/build/dist/client/workspace-session-logo-dom.js +3 -1
  258. package/data/build/dist/client/workspace-session-logo-dom.js.map +1 -1
  259. package/data/build/dist/client/workspace-session-visibility-dom.d.ts +3 -0
  260. package/data/build/dist/client/workspace-session-visibility-dom.d.ts.map +1 -1
  261. package/data/build/dist/client/workspace-session-visibility-dom.js +46 -17
  262. package/data/build/dist/client/workspace-session-visibility-dom.js.map +1 -1
  263. package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts +10 -0
  264. package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts.map +1 -1
  265. package/data/build/dist/dsh-capabilities/client/primitives-adapter.js +20 -0
  266. package/data/build/dist/dsh-capabilities/client/primitives-adapter.js.map +1 -1
  267. package/data/build/dist/host/browser-text.d.ts +30 -0
  268. package/data/build/dist/host/browser-text.d.ts.map +1 -0
  269. package/data/build/dist/host/browser-text.js +105 -0
  270. package/data/build/dist/host/browser-text.js.map +1 -0
  271. package/data/build/dist/host/cli-adapters/acp-cli-driver.d.ts +58 -0
  272. package/data/build/dist/host/cli-adapters/acp-cli-driver.d.ts.map +1 -0
  273. package/data/build/dist/host/cli-adapters/acp-cli-driver.js +271 -0
  274. package/data/build/dist/host/cli-adapters/acp-cli-driver.js.map +1 -0
  275. package/data/build/dist/host/cli-adapters/antigravity-driver.d.ts +30 -0
  276. package/data/build/dist/host/cli-adapters/antigravity-driver.d.ts.map +1 -0
  277. package/data/build/dist/host/cli-adapters/antigravity-driver.js +210 -0
  278. package/data/build/dist/host/cli-adapters/antigravity-driver.js.map +1 -0
  279. package/data/build/dist/host/cli-adapters/claude-driver.d.ts +28 -2
  280. package/data/build/dist/host/cli-adapters/claude-driver.d.ts.map +1 -1
  281. package/data/build/dist/host/cli-adapters/claude-driver.js +74 -4
  282. package/data/build/dist/host/cli-adapters/claude-driver.js.map +1 -1
  283. package/data/build/dist/host/cli-adapters/claude-model-options.d.ts.map +1 -1
  284. package/data/build/dist/host/cli-adapters/claude-model-options.js +22 -9
  285. package/data/build/dist/host/cli-adapters/claude-model-options.js.map +1 -1
  286. package/data/build/dist/host/cli-adapters/codebuddy-driver.d.ts +139 -0
  287. package/data/build/dist/host/cli-adapters/codebuddy-driver.d.ts.map +1 -0
  288. package/data/build/dist/host/cli-adapters/codebuddy-driver.js +1721 -0
  289. package/data/build/dist/host/cli-adapters/codebuddy-driver.js.map +1 -0
  290. package/data/build/dist/host/cli-adapters/codebuddy-subscription.d.ts +53 -0
  291. package/data/build/dist/host/cli-adapters/codebuddy-subscription.d.ts.map +1 -0
  292. package/data/build/dist/host/cli-adapters/codebuddy-subscription.js +778 -0
  293. package/data/build/dist/host/cli-adapters/codebuddy-subscription.js.map +1 -0
  294. package/data/build/dist/host/cli-adapters/codex-driver.d.ts +22 -0
  295. package/data/build/dist/host/cli-adapters/codex-driver.d.ts.map +1 -1
  296. package/data/build/dist/host/cli-adapters/codex-driver.js +254 -7
  297. package/data/build/dist/host/cli-adapters/codex-driver.js.map +1 -1
  298. package/data/build/dist/host/cli-adapters/command-code-driver.d.ts +43 -3
  299. package/data/build/dist/host/cli-adapters/command-code-driver.d.ts.map +1 -1
  300. package/data/build/dist/host/cli-adapters/command-code-driver.js +681 -74
  301. package/data/build/dist/host/cli-adapters/command-code-driver.js.map +1 -1
  302. package/data/build/dist/host/cli-adapters/command-code-history.d.ts +147 -0
  303. package/data/build/dist/host/cli-adapters/command-code-history.d.ts.map +1 -0
  304. package/data/build/dist/host/cli-adapters/command-code-history.js +659 -0
  305. package/data/build/dist/host/cli-adapters/command-code-history.js.map +1 -0
  306. package/data/build/dist/host/cli-adapters/cursor-driver.d.ts +12 -0
  307. package/data/build/dist/host/cli-adapters/cursor-driver.d.ts.map +1 -0
  308. package/data/build/dist/host/cli-adapters/cursor-driver.js +20 -0
  309. package/data/build/dist/host/cli-adapters/cursor-driver.js.map +1 -0
  310. package/data/build/dist/host/cli-adapters/custom-upstream-classifier.d.ts +67 -0
  311. package/data/build/dist/host/cli-adapters/custom-upstream-classifier.d.ts.map +1 -0
  312. package/data/build/dist/host/cli-adapters/custom-upstream-classifier.js +169 -0
  313. package/data/build/dist/host/cli-adapters/custom-upstream-classifier.js.map +1 -0
  314. package/data/build/dist/host/cli-adapters/delegate-dispatch.d.ts +48 -0
  315. package/data/build/dist/host/cli-adapters/delegate-dispatch.d.ts.map +1 -0
  316. package/data/build/dist/host/cli-adapters/delegate-dispatch.js +111 -0
  317. package/data/build/dist/host/cli-adapters/delegate-dispatch.js.map +1 -0
  318. package/data/build/dist/host/cli-adapters/delegation-authorization.d.ts +19 -0
  319. package/data/build/dist/host/cli-adapters/delegation-authorization.d.ts.map +1 -0
  320. package/data/build/dist/host/cli-adapters/delegation-authorization.js +49 -0
  321. package/data/build/dist/host/cli-adapters/delegation-authorization.js.map +1 -0
  322. package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.d.ts +34 -0
  323. package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.d.ts.map +1 -0
  324. package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.js +121 -0
  325. package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.js.map +1 -0
  326. package/data/build/dist/host/cli-adapters/desktop-app-runtime.d.ts +32 -0
  327. package/data/build/dist/host/cli-adapters/desktop-app-runtime.d.ts.map +1 -0
  328. package/data/build/dist/host/cli-adapters/desktop-app-runtime.js +121 -0
  329. package/data/build/dist/host/cli-adapters/desktop-app-runtime.js.map +1 -0
  330. package/data/build/dist/host/cli-adapters/driver.d.ts +6 -0
  331. package/data/build/dist/host/cli-adapters/driver.d.ts.map +1 -1
  332. package/data/build/dist/host/cli-adapters/dsh-message-projector.d.ts.map +1 -1
  333. package/data/build/dist/host/cli-adapters/dsh-message-projector.js +5 -4
  334. package/data/build/dist/host/cli-adapters/dsh-message-projector.js.map +1 -1
  335. package/data/build/dist/host/cli-adapters/dsh-virtual-providers.d.ts +16 -0
  336. package/data/build/dist/host/cli-adapters/dsh-virtual-providers.d.ts.map +1 -0
  337. package/data/build/dist/host/cli-adapters/dsh-virtual-providers.js +73 -0
  338. package/data/build/dist/host/cli-adapters/dsh-virtual-providers.js.map +1 -0
  339. package/data/build/dist/host/cli-adapters/feature.d.ts.map +1 -1
  340. package/data/build/dist/host/cli-adapters/feature.js +459 -26
  341. package/data/build/dist/host/cli-adapters/feature.js.map +1 -1
  342. package/data/build/dist/host/cli-adapters/gemini-driver.d.ts.map +1 -1
  343. package/data/build/dist/host/cli-adapters/gemini-driver.js +21 -5
  344. package/data/build/dist/host/cli-adapters/gemini-driver.js.map +1 -1
  345. package/data/build/dist/host/cli-adapters/grok-driver.d.ts.map +1 -1
  346. package/data/build/dist/host/cli-adapters/grok-driver.js +24 -7
  347. package/data/build/dist/host/cli-adapters/grok-driver.js.map +1 -1
  348. package/data/build/dist/host/cli-adapters/json-rpc-process.d.ts +22 -6
  349. package/data/build/dist/host/cli-adapters/json-rpc-process.d.ts.map +1 -1
  350. package/data/build/dist/host/cli-adapters/json-rpc-process.js +118 -21
  351. package/data/build/dist/host/cli-adapters/json-rpc-process.js.map +1 -1
  352. package/data/build/dist/host/cli-adapters/kimi-driver.d.ts.map +1 -1
  353. package/data/build/dist/host/cli-adapters/kimi-driver.js +25 -4
  354. package/data/build/dist/host/cli-adapters/kimi-driver.js.map +1 -1
  355. package/data/build/dist/host/cli-adapters/kiro-driver.d.ts +12 -0
  356. package/data/build/dist/host/cli-adapters/kiro-driver.d.ts.map +1 -0
  357. package/data/build/dist/host/cli-adapters/kiro-driver.js +18 -0
  358. package/data/build/dist/host/cli-adapters/kiro-driver.js.map +1 -0
  359. package/data/build/dist/host/cli-adapters/legacy-session-adapter.d.ts +11 -2
  360. package/data/build/dist/host/cli-adapters/legacy-session-adapter.d.ts.map +1 -1
  361. package/data/build/dist/host/cli-adapters/legacy-session-adapter.js +26 -6
  362. package/data/build/dist/host/cli-adapters/legacy-session-adapter.js.map +1 -1
  363. package/data/build/dist/host/cli-adapters/mcode-catalog.d.ts +23 -0
  364. package/data/build/dist/host/cli-adapters/mcode-catalog.d.ts.map +1 -0
  365. package/data/build/dist/host/cli-adapters/mcode-catalog.js +120 -0
  366. package/data/build/dist/host/cli-adapters/mcode-catalog.js.map +1 -0
  367. package/data/build/dist/host/cli-adapters/mcode-driver.d.ts +56 -0
  368. package/data/build/dist/host/cli-adapters/mcode-driver.d.ts.map +1 -0
  369. package/data/build/dist/host/cli-adapters/mcode-driver.js +544 -0
  370. package/data/build/dist/host/cli-adapters/mcode-driver.js.map +1 -0
  371. package/data/build/dist/host/cli-adapters/model-catalog.d.ts +35 -5
  372. package/data/build/dist/host/cli-adapters/model-catalog.d.ts.map +1 -1
  373. package/data/build/dist/host/cli-adapters/model-catalog.js +213 -8
  374. package/data/build/dist/host/cli-adapters/model-catalog.js.map +1 -1
  375. package/data/build/dist/host/cli-adapters/native-subagent-dispatch.d.ts +81 -0
  376. package/data/build/dist/host/cli-adapters/native-subagent-dispatch.d.ts.map +1 -0
  377. package/data/build/dist/host/cli-adapters/native-subagent-dispatch.js +299 -0
  378. package/data/build/dist/host/cli-adapters/native-subagent-dispatch.js.map +1 -0
  379. package/data/build/dist/host/cli-adapters/native-subagent-holder.d.ts +4 -0
  380. package/data/build/dist/host/cli-adapters/native-subagent-holder.d.ts.map +1 -0
  381. package/data/build/dist/host/cli-adapters/native-subagent-holder.js +4 -0
  382. package/data/build/dist/host/cli-adapters/native-subagent-holder.js.map +1 -0
  383. package/data/build/dist/host/cli-adapters/native-team-proxy.js +18 -15
  384. package/data/build/dist/host/cli-adapters/native-team-proxy.js.map +1 -1
  385. package/data/build/dist/host/cli-adapters/native-team-subagent.d.ts +57 -0
  386. package/data/build/dist/host/cli-adapters/native-team-subagent.d.ts.map +1 -0
  387. package/data/build/dist/host/cli-adapters/native-team-subagent.js +126 -0
  388. package/data/build/dist/host/cli-adapters/native-team-subagent.js.map +1 -0
  389. package/data/build/dist/host/cli-adapters/new-api-subscription.d.ts +75 -0
  390. package/data/build/dist/host/cli-adapters/new-api-subscription.d.ts.map +1 -0
  391. package/data/build/dist/host/cli-adapters/new-api-subscription.js +959 -0
  392. package/data/build/dist/host/cli-adapters/new-api-subscription.js.map +1 -0
  393. package/data/build/dist/host/cli-adapters/opencode-driver.d.ts.map +1 -1
  394. package/data/build/dist/host/cli-adapters/opencode-driver.js +22 -10
  395. package/data/build/dist/host/cli-adapters/opencode-driver.js.map +1 -1
  396. package/data/build/dist/host/cli-adapters/pi-driver.js +24 -7
  397. package/data/build/dist/host/cli-adapters/pi-driver.js.map +1 -1
  398. package/data/build/dist/host/cli-adapters/provider-subscription.d.ts +41 -4
  399. package/data/build/dist/host/cli-adapters/provider-subscription.d.ts.map +1 -1
  400. package/data/build/dist/host/cli-adapters/provider-subscription.js +254 -40
  401. package/data/build/dist/host/cli-adapters/provider-subscription.js.map +1 -1
  402. package/data/build/dist/host/cli-adapters/qoder-driver.d.ts +71 -0
  403. package/data/build/dist/host/cli-adapters/qoder-driver.d.ts.map +1 -0
  404. package/data/build/dist/host/cli-adapters/qoder-driver.js +553 -0
  405. package/data/build/dist/host/cli-adapters/qoder-driver.js.map +1 -0
  406. package/data/build/dist/host/cli-adapters/qoder-subscription.d.ts +31 -0
  407. package/data/build/dist/host/cli-adapters/qoder-subscription.d.ts.map +1 -0
  408. package/data/build/dist/host/cli-adapters/qoder-subscription.js +178 -0
  409. package/data/build/dist/host/cli-adapters/qoder-subscription.js.map +1 -0
  410. package/data/build/dist/host/cli-adapters/registry-holder.d.ts +4 -0
  411. package/data/build/dist/host/cli-adapters/registry-holder.d.ts.map +1 -0
  412. package/data/build/dist/host/cli-adapters/registry-holder.js +9 -0
  413. package/data/build/dist/host/cli-adapters/registry-holder.js.map +1 -0
  414. package/data/build/dist/host/cli-adapters/registry.d.ts +54 -2
  415. package/data/build/dist/host/cli-adapters/registry.d.ts.map +1 -1
  416. package/data/build/dist/host/cli-adapters/registry.js +224 -18
  417. package/data/build/dist/host/cli-adapters/registry.js.map +1 -1
  418. package/data/build/dist/host/cli-adapters/session-store.d.ts +10 -1
  419. package/data/build/dist/host/cli-adapters/session-store.d.ts.map +1 -1
  420. package/data/build/dist/host/cli-adapters/session-store.js +60 -6
  421. package/data/build/dist/host/cli-adapters/session-store.js.map +1 -1
  422. package/data/build/dist/host/cli-adapters/standard-stream-driver.d.ts +16 -1
  423. package/data/build/dist/host/cli-adapters/standard-stream-driver.d.ts.map +1 -1
  424. package/data/build/dist/host/cli-adapters/standard-stream-driver.js +150 -26
  425. package/data/build/dist/host/cli-adapters/standard-stream-driver.js.map +1 -1
  426. package/data/build/dist/host/cli-adapters/stream-normalizer.d.ts +10 -1
  427. package/data/build/dist/host/cli-adapters/stream-normalizer.d.ts.map +1 -1
  428. package/data/build/dist/host/cli-adapters/stream-normalizer.js +23 -0
  429. package/data/build/dist/host/cli-adapters/stream-normalizer.js.map +1 -1
  430. package/data/build/dist/host/cli-adapters/subagent-tool.d.ts +5 -0
  431. package/data/build/dist/host/cli-adapters/subagent-tool.d.ts.map +1 -0
  432. package/data/build/dist/host/cli-adapters/subagent-tool.js +112 -0
  433. package/data/build/dist/host/cli-adapters/subagent-tool.js.map +1 -0
  434. package/data/build/dist/host/cli-adapters/zcode-driver.d.ts +57 -0
  435. package/data/build/dist/host/cli-adapters/zcode-driver.d.ts.map +1 -0
  436. package/data/build/dist/host/cli-adapters/zcode-driver.js +843 -0
  437. package/data/build/dist/host/cli-adapters/zcode-driver.js.map +1 -0
  438. package/data/build/dist/host/cli-adapters/zcode-subscription.d.ts +28 -0
  439. package/data/build/dist/host/cli-adapters/zcode-subscription.d.ts.map +1 -0
  440. package/data/build/dist/host/cli-adapters/zcode-subscription.js +212 -0
  441. package/data/build/dist/host/cli-adapters/zcode-subscription.js.map +1 -0
  442. package/data/build/dist/host/cli-bridge/bridge-holder.d.ts +27 -0
  443. package/data/build/dist/host/cli-bridge/bridge-holder.d.ts.map +1 -0
  444. package/data/build/dist/host/cli-bridge/bridge-holder.js +51 -0
  445. package/data/build/dist/host/cli-bridge/bridge-holder.js.map +1 -0
  446. package/data/build/dist/host/cli-bridge/bridge-server.d.ts +39 -0
  447. package/data/build/dist/host/cli-bridge/bridge-server.d.ts.map +1 -0
  448. package/data/build/dist/host/cli-bridge/bridge-server.js +140 -0
  449. package/data/build/dist/host/cli-bridge/bridge-server.js.map +1 -0
  450. package/data/build/dist/host/cli-bridge/command-code-mod.d.ts +29 -0
  451. package/data/build/dist/host/cli-bridge/command-code-mod.d.ts.map +1 -0
  452. package/data/build/dist/host/cli-bridge/command-code-mod.js +91 -0
  453. package/data/build/dist/host/cli-bridge/command-code-mod.js.map +1 -0
  454. package/data/build/dist/host/cli-bridge/dispatch.d.ts +19 -0
  455. package/data/build/dist/host/cli-bridge/dispatch.d.ts.map +1 -0
  456. package/data/build/dist/host/cli-bridge/dispatch.js +128 -0
  457. package/data/build/dist/host/cli-bridge/dispatch.js.map +1 -0
  458. package/data/build/dist/host/cli-bridge/injections.d.ts +28 -0
  459. package/data/build/dist/host/cli-bridge/injections.d.ts.map +1 -0
  460. package/data/build/dist/host/cli-bridge/injections.js +131 -0
  461. package/data/build/dist/host/cli-bridge/injections.js.map +1 -0
  462. package/data/build/dist/host/cli-bridge/mcp-stdio-entry.d.ts +8 -0
  463. package/data/build/dist/host/cli-bridge/mcp-stdio-entry.d.ts.map +1 -0
  464. package/data/build/dist/host/cli-bridge/mcp-stdio-entry.js +170 -0
  465. package/data/build/dist/host/cli-bridge/mcp-stdio-entry.js.map +1 -0
  466. package/data/build/dist/host/features/lan-access-dsh.d.ts.map +1 -1
  467. package/data/build/dist/host/features/lan-access-dsh.js +6 -2
  468. package/data/build/dist/host/features/lan-access-dsh.js.map +1 -1
  469. package/data/build/dist/host/features/peer-host.d.ts +21 -1
  470. package/data/build/dist/host/features/peer-host.d.ts.map +1 -1
  471. package/data/build/dist/host/features/peer-host.js +176 -31
  472. package/data/build/dist/host/features/peer-host.js.map +1 -1
  473. package/data/build/dist/host/features/types.d.ts +2 -0
  474. package/data/build/dist/host/features/types.d.ts.map +1 -1
  475. package/data/build/dist/host/index.d.ts +15 -1
  476. package/data/build/dist/host/index.d.ts.map +1 -1
  477. package/data/build/dist/host/index.js +48 -2
  478. package/data/build/dist/host/index.js.map +1 -1
  479. package/data/build/dist/host/lan-access-dsh.d.ts +7 -1
  480. package/data/build/dist/host/lan-access-dsh.d.ts.map +1 -1
  481. package/data/build/dist/host/lan-access-dsh.js +95 -19
  482. package/data/build/dist/host/lan-access-dsh.js.map +1 -1
  483. package/data/build/dist/host/login-attempt-guard.d.ts +55 -0
  484. package/data/build/dist/host/login-attempt-guard.d.ts.map +1 -0
  485. package/data/build/dist/host/login-attempt-guard.js +201 -0
  486. package/data/build/dist/host/login-attempt-guard.js.map +1 -0
  487. package/data/build/dist/host/modules/peer-host/host-api-proxy-service.d.ts +3 -0
  488. package/data/build/dist/host/modules/peer-host/host-api-proxy-service.d.ts.map +1 -1
  489. package/data/build/dist/host/modules/peer-host/host-api-proxy-service.js +2 -0
  490. package/data/build/dist/host/modules/peer-host/host-api-proxy-service.js.map +1 -1
  491. package/data/build/dist/host/modules/peer-host/peer-host-aggregate-service.d.ts +1 -0
  492. package/data/build/dist/host/modules/peer-host/peer-host-aggregate-service.d.ts.map +1 -1
  493. package/data/build/dist/host/modules/peer-host/peer-host-aggregate-service.js +1 -0
  494. package/data/build/dist/host/modules/peer-host/peer-host-aggregate-service.js.map +1 -1
  495. package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.d.ts +1 -1
  496. package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.d.ts.map +1 -1
  497. package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.js +9 -1
  498. package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.js.map +1 -1
  499. package/data/build/dist/host/modules/peer-host/peer-host-native-transport.d.ts +8 -0
  500. package/data/build/dist/host/modules/peer-host/peer-host-native-transport.d.ts.map +1 -1
  501. package/data/build/dist/host/modules/peer-host/peer-host-native-transport.js +9 -0
  502. package/data/build/dist/host/modules/peer-host/peer-host-native-transport.js.map +1 -1
  503. package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.d.ts +7 -0
  504. package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.d.ts.map +1 -1
  505. package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.js +31 -3
  506. package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.js.map +1 -1
  507. package/data/build/dist/host/modules/peer-host/peer-host-virtual-registry.d.ts +2 -0
  508. package/data/build/dist/host/modules/peer-host/peer-host-virtual-registry.d.ts.map +1 -1
  509. package/data/build/dist/host/modules/peer-host/peer-host-virtual-registry.js +26 -7
  510. package/data/build/dist/host/modules/peer-host/peer-host-virtual-registry.js.map +1 -1
  511. package/data/build/dist/host/modules/pwa/pwa-assets.d.ts +6 -4
  512. package/data/build/dist/host/modules/pwa/pwa-assets.d.ts.map +1 -1
  513. package/data/build/dist/host/modules/pwa/pwa-assets.js +11 -9
  514. package/data/build/dist/host/modules/pwa/pwa-assets.js.map +1 -1
  515. package/data/build/dist/host/modules/pwa/pwa-session-notifications.d.ts +3 -0
  516. package/data/build/dist/host/modules/pwa/pwa-session-notifications.d.ts.map +1 -1
  517. package/data/build/dist/host/modules/pwa/pwa-session-notifications.js +6 -4
  518. package/data/build/dist/host/modules/pwa/pwa-session-notifications.js.map +1 -1
  519. package/data/build/dist/host/native-session-bridge.d.ts.map +1 -1
  520. package/data/build/dist/host/native-session-bridge.js +106 -59
  521. package/data/build/dist/host/native-session-bridge.js.map +1 -1
  522. package/data/build/dist/host/rpc.js +8 -2
  523. package/data/build/dist/host/rpc.js.map +1 -1
  524. package/data/build/dist/host/settings.d.ts.map +1 -1
  525. package/data/build/dist/host/settings.js +14 -4
  526. package/data/build/dist/host/settings.js.map +1 -1
  527. package/data/build/dist/host/terminal/backends/local-pty-backend.d.ts.map +1 -1
  528. package/data/build/dist/host/terminal/backends/local-pty-backend.js +14 -0
  529. package/data/build/dist/host/terminal/backends/local-pty-backend.js.map +1 -1
  530. package/data/build/dist/host/terminal/backends/tmux-backend.d.ts +40 -1
  531. package/data/build/dist/host/terminal/backends/tmux-backend.d.ts.map +1 -1
  532. package/data/build/dist/host/terminal/backends/tmux-backend.js +291 -18
  533. package/data/build/dist/host/terminal/backends/tmux-backend.js.map +1 -1
  534. package/data/build/dist/host/terminal/runtime-adapter.d.ts +32 -0
  535. package/data/build/dist/host/terminal/runtime-adapter.d.ts.map +1 -1
  536. package/data/build/dist/host/terminal/runtime-adapter.js +8 -0
  537. package/data/build/dist/host/terminal/runtime-adapter.js.map +1 -1
  538. package/data/build/dist/host/terminal/runtime-manager.d.ts +3 -0
  539. package/data/build/dist/host/terminal/runtime-manager.d.ts.map +1 -1
  540. package/data/build/dist/host/terminal/runtime-manager.js +92 -4
  541. package/data/build/dist/host/terminal/runtime-manager.js.map +1 -1
  542. package/data/build/dist/host/terminal/terminal-controller.d.ts.map +1 -1
  543. package/data/build/dist/host/terminal/terminal-controller.js +58 -6
  544. package/data/build/dist/host/terminal/terminal-controller.js.map +1 -1
  545. package/data/build/dist/host/terminal/terminal-process-service.d.ts.map +1 -1
  546. package/data/build/dist/host/terminal/terminal-process-service.js +12 -2
  547. package/data/build/dist/host/terminal/terminal-process-service.js.map +1 -1
  548. package/data/build/dist/host/terminal/terminal-service.d.ts +41 -4
  549. package/data/build/dist/host/terminal/terminal-service.d.ts.map +1 -1
  550. package/data/build/dist/host/terminal/terminal-service.js +551 -61
  551. package/data/build/dist/host/terminal/terminal-service.js.map +1 -1
  552. package/data/build/dist/index.d.ts +2 -2
  553. package/data/build/dist/index.d.ts.map +1 -1
  554. package/data/build/dist/index.js +2 -2
  555. package/data/build/dist/index.js.map +1 -1
  556. package/data/build/dist/shared/contracts/cli-adapter.d.ts +69 -2
  557. package/data/build/dist/shared/contracts/cli-adapter.d.ts.map +1 -1
  558. package/data/build/dist/shared/contracts/config.d.ts +63 -10
  559. package/data/build/dist/shared/contracts/config.d.ts.map +1 -1
  560. package/data/build/dist/shared/contracts/config.js +57 -5
  561. package/data/build/dist/shared/contracts/config.js.map +1 -1
  562. package/data/build/dist/shared/contracts/peer-host.d.ts +2 -0
  563. package/data/build/dist/shared/contracts/peer-host.d.ts.map +1 -1
  564. package/data/build/dist/shared/contracts/peer-host.js.map +1 -1
  565. package/data/build/dist/shared/contracts/subscription.d.ts +20 -1
  566. package/data/build/dist/shared/contracts/subscription.d.ts.map +1 -1
  567. package/data/build/dist/shared/contracts/subscription.js.map +1 -1
  568. package/data/build/dist/shared/contracts/terminal.d.ts +8 -1
  569. package/data/build/dist/shared/contracts/terminal.d.ts.map +1 -1
  570. package/data/build/dist/shared/contracts/version.d.ts +1 -1
  571. package/data/build/dist/shared/contracts/version.d.ts.map +1 -1
  572. package/data/build/dist/shared/contracts/version.js +1 -1
  573. package/data/build/dist/shared/contracts/version.js.map +1 -1
  574. package/data/build/dist/shared/debug.d.ts +8 -0
  575. package/data/build/dist/shared/debug.d.ts.map +1 -1
  576. package/data/build/dist/shared/debug.js +43 -7
  577. package/data/build/dist/shared/debug.js.map +1 -1
  578. package/data/build/dist/shared/delegation-carrier.d.ts +24 -0
  579. package/data/build/dist/shared/delegation-carrier.d.ts.map +1 -0
  580. package/data/build/dist/shared/delegation-carrier.js +111 -0
  581. package/data/build/dist/shared/delegation-carrier.js.map +1 -0
  582. package/data/build/dist/shared/index.d.ts +3 -3
  583. package/data/build/dist/shared/index.d.ts.map +1 -1
  584. package/data/build/dist/shared/index.js +2 -2
  585. package/data/build/dist/shared/index.js.map +1 -1
  586. package/data/build/dist/shared/terminal-input.d.ts +8 -0
  587. package/data/build/dist/shared/terminal-input.d.ts.map +1 -0
  588. package/data/build/dist/shared/terminal-input.js +10 -0
  589. package/data/build/dist/shared/terminal-input.js.map +1 -0
  590. package/data/build/dist/transport/debug.d.ts +7 -0
  591. package/data/build/dist/transport/debug.d.ts.map +1 -1
  592. package/data/build/dist/transport/debug.js +33 -5
  593. package/data/build/dist/transport/debug.js.map +1 -1
  594. package/data/build/dist/transport/index.d.ts +1 -1
  595. package/data/build/dist/transport/index.d.ts.map +1 -1
  596. package/data/build/dist/transport/index.js +1 -1
  597. package/data/build/dist/transport/index.js.map +1 -1
  598. package/data/build/dist/typert.host.js +1 -1
  599. package/data/build/dist/typert.host.js.map +1 -1
  600. package/package.json +3 -1
  601. package/profile/README.md +2 -2
  602. package/profile/package.json +2 -2
  603. package/profile/version.json +1 -1
  604. package/version.json +1 -1
@@ -1,5 +1,7 @@
1
1
  import { Service } from '@deepseek-ai/cordis';
2
2
  import { debugInfo, debugWarn } from '../../shared/debug.js';
3
+ import { resolveCodingNsTranslator } from '../locale.js';
4
+ import { stripTerminalDeviceAttributeResponses } from '../../shared/terminal-input.js';
3
5
  class ObservableValue {
4
6
  value;
5
7
  listeners = new Set();
@@ -17,16 +19,17 @@ class ObservableValue {
17
19
  listener();
18
20
  }
19
21
  }
20
- /** 一个 Sidebar 标签对应的终端模型;DOM 卸载只 detach,显式 close 才结束 Host 进程。 */
22
+ /** 一个 Sidebar 标签对应的终端模型;普通视图卸载只 detach,聚合视图可常驻 follow。 */
21
23
  export class CodingNsTerminalView {
22
24
  sessionId;
23
25
  remote;
24
26
  createWhenMissing;
25
27
  shellPath;
26
28
  onWorkspaceResolved;
29
+ t;
27
30
  state;
28
31
  id;
29
- store = new ObservableValue({ phase: 'idle', title: '终端', writable: false });
32
+ store;
30
33
  lifetime = new AbortController();
31
34
  followController;
32
35
  pendingRender;
@@ -37,26 +40,65 @@ export class CodingNsTerminalView {
37
40
  attachmentId;
38
41
  /** 最近一次已排队的尺寸;ResizeObserver 可能在同一布局周期内重复触发。 */
39
42
  lastResize;
40
- constructor(sessionId, id, remote, createWhenMissing, shellPath, onWorkspaceResolved) {
43
+ reconnectTimer;
44
+ reconnectAttempts = 0;
45
+ /**
46
+ * 聚合终端由工作区库存拥有生命周期。
47
+ *
48
+ * 聚合页在切换右栏页签时可能会卸载 DOM,但 Host 里的终端仍然运行;
49
+ * 这类视图不能因为一次 DOM 卸载就释放 follow,否则再次点开标签必然
50
+ * 重新经历 environment/list/follow。显式 close 和 dispose 仍会强制释放。
51
+ */
52
+ keepAlive;
53
+ initialState;
54
+ initialStateConsumed = false;
55
+ constructor(sessionId, id, remote, createWhenMissing, shellPath, onWorkspaceResolved,
56
+ // 追加在末尾:既有调用方与测试按位置传 shellPath / onWorkspaceResolved,不能前移。
57
+ t = resolveCodingNsTranslator(), keepAlive = false, initialState) {
41
58
  this.sessionId = sessionId;
42
59
  this.remote = remote;
43
60
  this.createWhenMissing = createWhenMissing;
44
61
  this.shellPath = shellPath;
45
62
  this.onWorkspaceResolved = onWorkspaceResolved;
63
+ this.t = t;
46
64
  this.id = id;
65
+ this.keepAlive = keepAlive;
66
+ this.initialState = initialState;
67
+ // 标签兜底标题必须走词典:字段初始化阶段还取不到构造参数,因此在构造函数里建 store。
68
+ this.store = new ObservableValue({
69
+ phase: initialState?.info === undefined ? 'idle' : 'disconnected',
70
+ ...(initialState?.environment === undefined ? {} : { environment: initialState.environment }),
71
+ ...(initialState?.info === undefined ? {} : { info: initialState.info }),
72
+ title: initialState?.info?.title ?? t('terminal.title'),
73
+ writable: false,
74
+ });
47
75
  this.state = this.store;
48
76
  }
49
77
  mount() {
50
78
  this.mounted += 1;
51
- if (this.mounted === 1)
52
- void this.refresh();
79
+ if (this.mounted === 1) {
80
+ const initial = this.initialState;
81
+ if (!this.initialStateConsumed && initial?.info !== undefined) {
82
+ this.initialStateConsumed = true;
83
+ // 库存快照已经证明终端仍在运行时,直接订阅 Host 常驻连接,
84
+ // 不再为切换会话重新读取 environment/list。环境快照尚未到达时也
85
+ // 可以 follow:environment 只影响输入上限和外观默认值,不能阻塞恢复。
86
+ if (initial.info.state === 'running')
87
+ this.connect();
88
+ else
89
+ void this.refresh();
90
+ }
91
+ else {
92
+ void this.refresh();
93
+ }
94
+ }
53
95
  let active = true;
54
96
  return () => {
55
97
  if (!active)
56
98
  return;
57
99
  active = false;
58
100
  this.mounted = Math.max(0, this.mounted - 1);
59
- if (this.mounted === 0)
101
+ if (this.mounted === 0 && !this.keepAlive)
60
102
  this.detach();
61
103
  };
62
104
  }
@@ -68,6 +110,44 @@ export class CodingNsTerminalView {
68
110
  this.loading = this.load().finally(() => { this.loading = undefined; });
69
111
  return this.loading;
70
112
  }
113
+ /**
114
+ * 运行时丢失后按当前绑定重建终端。
115
+ *
116
+ * 这是"进程已经不存在"时的显式恢复动作:沿用同一个 terminalId 与工作区绑定,
117
+ * 让 Sidebar 标签、标题和尺寸都保持不变,而不是让用户去点"新建终端"。
118
+ */
119
+ async rebuild() {
120
+ if (this.loading !== undefined)
121
+ return this.loading;
122
+ this.clearReconnect();
123
+ this.reconnectAttempts = 0;
124
+ this.patch({ phase: 'loading', writable: false });
125
+ const task = this.loadWithRebuild().finally(() => { this.loading = undefined; });
126
+ this.loading = task;
127
+ return task;
128
+ }
129
+ async loadWithRebuild() {
130
+ try {
131
+ const remote = resolveRemote(this.remote);
132
+ const environment = unwrap(await remote.environment(this.sessionId, this.lifetime.signal));
133
+ this.patch({ phase: 'creating', environment });
134
+ const info = unwrap(await remote.create(this.sessionId, {
135
+ id: this.id,
136
+ ...(this.shellPath === undefined ? {} : { shellPath: this.shellPath }),
137
+ cols: Math.min(80, environment.maxCols),
138
+ rows: Math.min(24, environment.maxRows),
139
+ }, this.lifetime.signal));
140
+ debugInfo('codingns4dsh: client terminal rebuilt', { sessionId: this.sessionId, terminalId: info.id });
141
+ const { error: _error, ...rest } = this.store.getSnapshot();
142
+ this.store.set({ ...rest, environment, info, title: info.title });
143
+ if (this.mounted > 0)
144
+ this.connect();
145
+ }
146
+ catch (error) {
147
+ if (!this.lifetime.signal.aborted)
148
+ this.fail(error);
149
+ }
150
+ }
71
151
  acknowledge(revision) {
72
152
  if (this.pendingRender?.revision !== revision)
73
153
  return;
@@ -75,6 +155,9 @@ export class CodingNsTerminalView {
75
155
  this.pendingRender = undefined;
76
156
  }
77
157
  write(data) {
158
+ data = stripTerminalDeviceAttributeResponses(data);
159
+ if (data === '')
160
+ return;
78
161
  const state = this.store.getSnapshot();
79
162
  const attachmentId = this.attachmentId;
80
163
  if (!state.writable || attachmentId === undefined || data === '')
@@ -149,7 +232,10 @@ export class CodingNsTerminalView {
149
232
  if (binding.id !== this.id)
150
233
  this.id = binding.id;
151
234
  // 工作区已有绑定时,恢复必须失败闭合,不能用新 ID 偷建替代终端。
152
- createWhenMissing = !binding.existing;
235
+ // 显式传入 terminalId 或读取到会话绑定时同样不能新建:工作区绑定
236
+ // 可能刚被另一个会话的关闭动作删除,此时旧标签仍在卸载途中,不能
237
+ // 把已经关闭的 ID 当成新终端重新 create。
238
+ createWhenMissing = createWhenMissing && !binding.existing;
153
239
  }
154
240
  }
155
241
  const listed = unwrap(await remote.list(this.sessionId));
@@ -179,6 +265,7 @@ export class CodingNsTerminalView {
179
265
  connect() {
180
266
  if (this.followController !== undefined || this.lifetime.signal.aborted || this.mounted === 0)
181
267
  return;
268
+ this.clearReconnect();
182
269
  const controller = new AbortController();
183
270
  this.followController = controller;
184
271
  this.attachmentId = crypto.randomUUID();
@@ -200,12 +287,22 @@ export class CodingNsTerminalView {
200
287
  }
201
288
  await this.deliver(frame);
202
289
  }
203
- if (!signal.aborted)
204
- this.patch({ phase: 'disconnected', writable: false });
290
+ if (!signal.aborted) {
291
+ // 流正常结束但终端仍在运行:这是连接层断开(Host 重连、服务器短暂不可达),
292
+ // 必须自动重连;只有真正结束的终端才停在终态。
293
+ if (this.isRunning())
294
+ this.scheduleReconnect();
295
+ else
296
+ this.patch({ phase: 'disconnected', writable: false });
297
+ }
205
298
  }
206
299
  catch (error) {
207
- if (!signal.aborted)
208
- this.fail(error);
300
+ if (!signal.aborted) {
301
+ if (this.isRunning())
302
+ this.scheduleReconnect();
303
+ else
304
+ this.fail(error);
305
+ }
209
306
  }
210
307
  finally {
211
308
  if (this.followController?.signal === signal) {
@@ -215,6 +312,9 @@ export class CodingNsTerminalView {
215
312
  }
216
313
  }
217
314
  async deliver(frame) {
315
+ // 真正收到画面才算连接成功,退避计数在这里归零。
316
+ this.reconnectAttempts = 0;
317
+ this.clearReconnect();
218
318
  this.pendingRender?.resolve();
219
319
  this.revision += 1;
220
320
  let resolveWaiting = () => { };
@@ -224,6 +324,7 @@ export class CodingNsTerminalView {
224
324
  await waiting;
225
325
  }
226
326
  detach() {
327
+ this.clearReconnect();
227
328
  this.pendingRender?.resolve();
228
329
  this.pendingRender = undefined;
229
330
  this.followController?.abort(new Error('终端视图已 detach'));
@@ -235,6 +336,54 @@ export class CodingNsTerminalView {
235
336
  this.store.set({ ...state, phase: 'disconnected', writable: false });
236
337
  }
237
338
  }
339
+ /** 终端是否仍被认为在运行;终态(exited/failed/closed)不参与自动重连。 */
340
+ isRunning() {
341
+ const state = this.store.getSnapshot();
342
+ if (state.phase === 'closed' || state.phase === 'failed')
343
+ return false;
344
+ if (state.info === undefined)
345
+ return true;
346
+ return state.info.state === 'running';
347
+ }
348
+ /**
349
+ * 恢复阶段 Host 列表为空时,判断当前标签是否仍有本地生命周期保护。
350
+ * 新建终端在 create 完成前不能被恢复流程关闭;已连接且 Host 报告 running
351
+ * 的终端也不能因为一次空列表响应被误判为残留。
352
+ */
353
+ isRecoveryProtected() {
354
+ const state = this.store.getSnapshot();
355
+ if (state.phase === 'closed' || state.phase === 'failed')
356
+ return false;
357
+ if (this.createWhenMissing && (state.phase === 'idle' || state.phase === 'loading' || state.phase === 'creating'))
358
+ return true;
359
+ return state.info?.id === this.id && state.info.state === 'running';
360
+ }
361
+ /**
362
+ * 连接层断开后的自动重连。
363
+ *
364
+ * 指数退避到 5 秒封顶:DSH 重启、中继抖动或 tmux 服务器短暂不可达时,用户
365
+ * 不需要手动点"重新连接",也不会看到刷屏式的重试。
366
+ */
367
+ scheduleReconnect() {
368
+ if (this.reconnectTimer !== undefined || this.lifetime.signal.aborted || this.mounted === 0)
369
+ return;
370
+ const delay = Math.min(500 * 2 ** this.reconnectAttempts, 5000);
371
+ this.reconnectAttempts += 1;
372
+ this.patch({ phase: 'disconnected', writable: false });
373
+ debugInfo('codingns4dsh: client terminal reconnect scheduled', { sessionId: this.sessionId, terminalId: this.id, delay, attempt: this.reconnectAttempts });
374
+ this.reconnectTimer = setTimeout(() => {
375
+ this.reconnectTimer = undefined;
376
+ if (this.lifetime.signal.aborted || this.mounted === 0)
377
+ return;
378
+ void this.refresh();
379
+ }, delay);
380
+ }
381
+ clearReconnect() {
382
+ if (this.reconnectTimer !== undefined) {
383
+ clearTimeout(this.reconnectTimer);
384
+ this.reconnectTimer = undefined;
385
+ }
386
+ }
238
387
  patch(patch) {
239
388
  this.store.set({ ...this.store.getSnapshot(), ...patch });
240
389
  }
@@ -248,6 +397,7 @@ const SHELL_KEY = 'dsh.codingns.terminal.shell.v1';
248
397
  /** Codingns4DSH 自有的浏览器终端服务,不依赖官方 terminal-controller Client 实现。 */
249
398
  export class CodingNsWebTerminals extends Service {
250
399
  remote;
400
+ t;
251
401
  views = new Map();
252
402
  workspaceIds = new Map();
253
403
  recoveries = new Map();
@@ -255,38 +405,87 @@ export class CodingNsWebTerminals extends Service {
255
405
  closeFailures = this.closeFailureStore;
256
406
  remoteReadyStore = new ObservableValue(false);
257
407
  remoteReadyState = this.remoteReadyStore;
408
+ inventoryRevisionStore = new ObservableValue(0);
409
+ /** 任一工作区库存变化都会递增;聚合页用它触发跨会话刷新。 */
410
+ inventoryRevision = this.inventoryRevisionStore;
411
+ inventories = new Map();
412
+ /** 已解析过的会话环境;切换回已有会话时无需再次请求 Host environment。 */
413
+ environments = new Map();
414
+ /** 每个会话最近一次库存请求的序号;旧请求返回时不得覆盖新建结果。 */
415
+ inventoryRequestIds = new Map();
416
+ /** 任意工作区刷新都会递增;尚未解析工作区的旧请求也必须随之失效。 */
417
+ inventoryEpoch = 0;
258
418
  closeRequests = new Map();
259
419
  /** Remote 注入前不能执行关闭请求;就绪后统一冲刷,避免把启动竞态显示成永久错误。 */
260
420
  cleanupQueued = false;
261
- constructor(ctx, remote) {
421
+ constructor(ctx, remote, t = resolveCodingNsTranslator()) {
262
422
  super(ctx, 'webTerminals');
263
423
  this.remote = remote;
424
+ this.t = t;
264
425
  for (const request of readCloseRequests())
265
426
  this.closeRequests.set(String(request.id), request);
266
427
  void this.flushCleanup();
267
428
  }
268
- view(sessionId, key, contentId, terminalId, shellPath) {
429
+ view(sessionId, key, contentId, terminalId, shellPath, createFresh = false, persistBinding = true, keepAlive = false, initialState) {
269
430
  const mapKey = JSON.stringify([sessionId, key]);
270
431
  const existing = this.views.get(mapKey);
271
432
  if (existing !== undefined)
272
433
  return existing.view;
273
434
  const workspaceId = this.workspaceIds.get(sessionId);
274
- const saved = terminalId
275
- ?? (workspaceId === undefined ? undefined : readWorkspaceBindingWithMigration(workspaceId, contentId))
276
- ?? readBinding(sessionId, contentId);
435
+ const sessionBinding = readBinding(sessionId, contentId);
436
+ // “新建”是一次性动作:首次消费标记时忽略工作区单终端绑定,生成新的身份;
437
+ // 标签重载后若已有会话绑定,则恢复刚创建的终端,避免再次创建重复进程。
438
+ const fresh = createFresh && sessionBinding === undefined;
439
+ const saved = fresh
440
+ ? terminalId
441
+ : terminalId
442
+ ?? sessionBinding
443
+ ?? (workspaceId === undefined ? undefined : readWorkspaceBindingWithMigration(workspaceId, contentId));
277
444
  const id = saved ?? crypto.randomUUID();
278
445
  debugInfo('codingns4dsh: client terminal view', { sessionId, key, contentId, workspaceId: workspaceId ?? null, savedId: saved ?? null, terminalId: id, bindingSource: terminalId !== undefined ? 'argument' : workspaceId !== undefined && readWorkspaceBindingWithMigration(workspaceId, contentId) !== undefined ? 'workspace-storage' : readBinding(sessionId, contentId) !== undefined ? 'session-storage' : 'new' });
279
- if (saved === undefined)
446
+ if (persistBinding && (fresh || saved === undefined))
280
447
  writeBinding(sessionId, contentId, id);
281
- const view = new CodingNsTerminalView(sessionId, id, this.remote, saved === undefined, shellPath, (resolvedWorkspaceId, currentId) => this.rememberWorkspace(sessionId, contentId, currentId, resolvedWorkspaceId));
448
+ const view = new CodingNsTerminalView(sessionId, id, this.remote, fresh || saved === undefined, shellPath, persistBinding
449
+ ? (resolvedWorkspaceId, currentId) => this.rememberWorkspace(sessionId, contentId, currentId, resolvedWorkspaceId, !fresh && terminalId === undefined)
450
+ : (resolvedWorkspaceId) => { this.workspaceIds.set(sessionId, resolvedWorkspaceId); return undefined; }, this.t, keepAlive, initialState);
282
451
  this.views.set(mapKey, { contentId, view });
283
452
  return view;
284
453
  }
454
+ /** 聚合页按 Host terminalId 获取内部视图,不再依赖 Sidebar 标签身份。 */
455
+ viewForTerminal(sessionId, terminalId, shellPath) {
456
+ const key = `aggregate:${terminalId}`;
457
+ const info = this.inventoryForSession(sessionId).find((item) => item.id === terminalId);
458
+ const environment = this.environmentForSession(sessionId);
459
+ const initialState = info === undefined && environment === undefined
460
+ ? undefined
461
+ : {
462
+ ...(info === undefined ? {} : { info }),
463
+ ...(environment === undefined ? {} : { environment }),
464
+ };
465
+ return this.view(sessionId, key, key, terminalId, shellPath, false, false, true, initialState);
466
+ }
285
467
  /** 返回某个 Sidebar 内容已经保存的 Host 终端身份,用于恢复时去重。 */
286
468
  boundTerminalId(sessionId, contentId) {
287
469
  const workspaceId = this.workspaceIds.get(sessionId);
288
- return (workspaceId === undefined ? undefined : readWorkspaceBindingWithMigration(workspaceId, contentId))
289
- ?? readBinding(sessionId, contentId);
470
+ return readBinding(sessionId, contentId)
471
+ ?? (workspaceId === undefined ? undefined : readWorkspaceBindingWithMigration(workspaceId, contentId));
472
+ }
473
+ /**
474
+ * 判断恢复阶段是否应保留某个标签。
475
+ *
476
+ * Host 列表为空有两种含义:新建终端的 create 还没有完成,或者 Host 已经
477
+ * 关闭终端而 Sidebar 只剩残留标签。只有当前 Client 视图明确处于创建中或
478
+ * 仍收到 Host 的 running 状态时,空列表才属于前一种情况。
479
+ */
480
+ isTerminalRecoveryProtected(sessionId, contentId, terminalId) {
481
+ for (const record of this.views.values()) {
482
+ if (record.view.sessionId !== sessionId || record.contentId !== contentId)
483
+ continue;
484
+ if (record.view.id !== terminalId)
485
+ continue;
486
+ return record.view.isRecoveryProtected();
487
+ }
488
+ return false;
290
489
  }
291
490
  async launchShells(sessionId, signal) {
292
491
  const shells = unwrap(await resolveRemote(this.remote).shells(sessionId, signal));
@@ -297,6 +496,32 @@ export class CodingNsWebTerminals extends Service {
297
496
  };
298
497
  }
299
498
  selectShell(path) { writeString(SHELL_KEY, path); }
499
+ /** 在聚合页内创建一个新的 Host 终端,并把它加入工作区库存。 */
500
+ async createTerminal(sessionId, shellPath) {
501
+ const terminalId = crypto.randomUUID();
502
+ const view = this.view(sessionId, `aggregate:${terminalId}`, `aggregate:${terminalId}`, terminalId, shellPath, true, false, true);
503
+ await view.refresh();
504
+ const info = view.state.getSnapshot().info;
505
+ if (info === undefined)
506
+ throw new Error(view.state.getSnapshot().error ?? '终端创建失败');
507
+ await this.refreshInventory(sessionId);
508
+ return info;
509
+ }
510
+ /** 只关闭指定 terminalId;其他会话中对应的 attach 视图只做 detach。 */
511
+ async closeTerminal(sessionId, terminalId) {
512
+ const records = [...this.views.entries()].filter(([, record]) => record.view.id === terminalId);
513
+ const primary = records.find(([, record]) => record.view.sessionId === sessionId)?.[1];
514
+ if (primary !== undefined)
515
+ await primary.view.close();
516
+ else
517
+ unwrap(await resolveRemote(this.remote).close(sessionId, terminalId));
518
+ for (const [mapKey, record] of records) {
519
+ this.views.delete(mapKey);
520
+ // close() 只结束 Host 终端,dispose() 负责释放聚合视图保留的 follow。
521
+ await record.view.dispose();
522
+ }
523
+ await this.refreshInventory(sessionId);
524
+ }
300
525
  close(sessionId, key, contentId, terminalId) {
301
526
  const mapKey = JSON.stringify([sessionId, key]);
302
527
  const record = this.views.get(mapKey);
@@ -304,13 +529,13 @@ export class CodingNsWebTerminals extends Service {
304
529
  if (id === undefined)
305
530
  return;
306
531
  debugInfo('codingns4dsh: client terminal close request', { sessionId, key, contentId, workspaceId: this.workspaceIds.get(sessionId) ?? null, terminalId: id, hasView: record !== undefined });
307
- const request = { sessionId, id, title: record?.view.state.getSnapshot().title ?? '终端' };
532
+ const request = { sessionId, id, title: record?.view.state.getSnapshot().title ?? this.t('terminal.title') };
308
533
  this.closeRequests.set(String(id), request);
309
534
  persistCloseRequests(this.closeRequests.values());
310
535
  deleteBinding(sessionId, contentId);
311
536
  const workspaceId = this.workspaceIds.get(sessionId);
312
537
  if (workspaceId !== undefined) {
313
- deleteWorkspaceBinding(workspaceId);
538
+ deleteWorkspaceBindingIfMatches(workspaceId, id);
314
539
  deleteLegacyWorkspaceBinding(workspaceId, contentId);
315
540
  }
316
541
  this.views.delete(mapKey);
@@ -320,15 +545,44 @@ export class CodingNsWebTerminals extends Service {
320
545
  const pending = this.recoveries.get(sessionId);
321
546
  if (pending !== undefined)
322
547
  return pending;
548
+ const requestId = (this.inventoryRequestIds.get(sessionId) ?? 0) + 1;
549
+ this.inventoryRequestIds.set(sessionId, requestId);
550
+ const inventoryEpoch = this.inventoryEpoch;
323
551
  // 官方 list wire 只有 sessionId;先用 agent-scoped environment 让 Host 解析工作区。
324
- const recovery = (async () => {
325
- const environment = unwrap(await resolveRemote(this.remote).environment(sessionId));
552
+ // 使用可选变量避免 TS 将闭包中的自引用判定为“赋值前使用”;
553
+ // Promise 创建后才会执行异步主体,因此运行时仍能安全比较身份。
554
+ let recovery;
555
+ recovery = (async () => {
556
+ const environment = await this.resolveEnvironment(sessionId);
326
557
  if (environment.workspaceId !== undefined)
327
558
  this.workspaceIds.set(sessionId, environment.workspaceId);
328
- const result = unwrap(await resolveRemote(this.remote).list(sessionId));
559
+ const result = dedupeInventory(unwrap(await resolveRemote(this.remote).list(sessionId)));
560
+ const currentRequestId = this.inventoryRequestIds.get(sessionId);
561
+ if (currentRequestId !== requestId || this.inventoryEpoch !== inventoryEpoch) {
562
+ // 工作区尚未解析时,刷新方无法提前把这个会话加入失效集合。
563
+ // 旧 list 结果不能交给 Sidebar,否则关闭后的终端会被重新投影出来;
564
+ // 让当前会话重新发起一轮查询,直到拿到刷新后的库存。
565
+ debugInfo('codingns4dsh: client terminal recover stale retry', {
566
+ sessionId,
567
+ terminalIds: result.map((entry) => entry.id),
568
+ requestId,
569
+ currentRequestId,
570
+ inventoryEpoch,
571
+ currentInventoryEpoch: this.inventoryEpoch,
572
+ });
573
+ // 当前请求尚未进入 finally;先移除自身,才能让 retry 创建新一代
574
+ // Promise,而不是再次命中这个仍在执行的旧请求。
575
+ if (recovery !== undefined && this.recoveries.get(sessionId) === recovery)
576
+ this.recoveries.delete(sessionId);
577
+ return this.recover(sessionId);
578
+ }
329
579
  debugInfo('codingns4dsh: client terminal recover', { sessionId, workspaceId: environment.workspaceId, terminalIds: result.map((entry) => entry.id) });
580
+ this.rememberInventory(sessionId, result);
330
581
  return result;
331
- })().finally(() => this.recoveries.delete(sessionId));
582
+ })().finally(() => {
583
+ if (recovery !== undefined && this.recoveries.get(sessionId) === recovery)
584
+ this.recoveries.delete(sessionId);
585
+ });
332
586
  this.recoveries.set(sessionId, recovery);
333
587
  return recovery;
334
588
  }
@@ -348,18 +602,80 @@ export class CodingNsWebTerminals extends Service {
348
602
  this.views.clear();
349
603
  this.workspaceIds.clear();
350
604
  this.recoveries.clear();
605
+ this.inventories.clear();
606
+ this.environments.clear();
607
+ this.inventoryRequestIds.clear();
608
+ this.inventoryEpoch = 0;
609
+ }
610
+ /** 强制刷新当前会话对应工作区的库存。 */
611
+ async refreshInventory(sessionId) {
612
+ this.inventoryEpoch += 1;
613
+ // 聚合页创建/关闭后必须绕过同一工作区所有会话的旧 list 请求;否则
614
+ // 另一个会话的迟到响应仍可能把关闭后的终端写回共享库存。
615
+ const workspaceId = this.workspaceIds.get(sessionId);
616
+ const invalidated = new Set();
617
+ for (const [knownSessionId, knownWorkspaceId] of this.workspaceIds) {
618
+ if (knownSessionId === sessionId || (workspaceId !== undefined && knownWorkspaceId === workspaceId)) {
619
+ invalidated.add(knownSessionId);
620
+ }
621
+ }
622
+ invalidated.add(sessionId);
623
+ for (const knownSessionId of invalidated)
624
+ this.invalidateRecovery(knownSessionId);
625
+ return this.recover(sessionId);
626
+ }
627
+ /** 令指定会话尚未完成的库存请求失效,并清掉可复用的旧 Promise。 */
628
+ invalidateRecovery(sessionId) {
629
+ this.inventoryRequestIds.set(sessionId, (this.inventoryRequestIds.get(sessionId) ?? 0) + 1);
630
+ this.recoveries.delete(sessionId);
631
+ }
632
+ async resolveEnvironment(sessionId) {
633
+ const cached = this.environments.get(`session:${sessionId}`);
634
+ if (cached !== undefined)
635
+ return cached;
636
+ const environment = unwrap(await resolveRemote(this.remote).environment(sessionId));
637
+ this.environments.set(`session:${sessionId}`, environment);
638
+ if (environment.workspaceId !== undefined)
639
+ this.environments.set(`workspace:${environment.workspaceId}`, environment);
640
+ return environment;
641
+ }
642
+ environmentForSession(sessionId) {
643
+ const session = this.environments.get(`session:${sessionId}`);
644
+ if (session !== undefined)
645
+ return session;
646
+ const workspaceId = this.workspaceIds.get(sessionId);
647
+ return workspaceId === undefined ? undefined : this.environments.get(`workspace:${workspaceId}`);
648
+ }
649
+ /** 返回当前会话最近一次拿到的工作区库存;首次加载时为空。 */
650
+ inventoryForSession(sessionId) {
651
+ const workspaceId = this.workspaceIds.get(sessionId) ?? `session:${sessionId}`;
652
+ return this.inventories.get(workspaceId)?.terminals ?? [];
351
653
  }
352
- rememberWorkspace(sessionId, contentId, id, workspaceId) {
654
+ rememberWorkspace(sessionId, contentId, id, workspaceId, useWorkspaceBinding) {
353
655
  this.workspaceIds.set(sessionId, workspaceId);
354
- const existing = readWorkspaceBindingWithMigration(workspaceId, contentId);
656
+ // 显式恢复和“新建”都必须保留自己的 terminalId;只有普通无参数入口
657
+ // 才使用旧的单终端工作区绑定兼容行为。
658
+ const existing = useWorkspaceBinding ? readWorkspaceBindingWithMigration(workspaceId, contentId) : undefined;
355
659
  const resolvedId = existing ?? id;
356
660
  // 修正首次渲染时已经写入的会话键,避免第二个会话继续携带临时 ID。
357
661
  writeBinding(sessionId, contentId, resolvedId);
358
- // 旧版本的工作区键带 contentId;统一重写成只含 Workspace ID 的新键。
359
- writeWorkspaceBinding(workspaceId, contentId, resolvedId);
360
- deleteLegacyWorkspaceBinding(workspaceId, contentId);
662
+ if (useWorkspaceBinding) {
663
+ // 旧版本的工作区键带 contentId;统一重写成只含 Workspace ID 的新键。
664
+ writeWorkspaceBinding(workspaceId, contentId, resolvedId);
665
+ deleteLegacyWorkspaceBinding(workspaceId, contentId);
666
+ }
361
667
  return { id: resolvedId, existing: existing !== undefined };
362
668
  }
669
+ rememberInventory(sessionId, terminals) {
670
+ const workspaceId = this.workspaceIds.get(sessionId) ?? `session:${sessionId}`;
671
+ const normalized = dedupeInventory(terminals);
672
+ const previous = this.inventories.get(workspaceId);
673
+ if (previous !== undefined && sameInventory(previous.terminals, normalized))
674
+ return;
675
+ const revision = this.inventoryRevisionStore.getSnapshot() + 1;
676
+ this.inventories.set(workspaceId, { workspaceId, terminals: normalized, revision });
677
+ this.inventoryRevisionStore.set(revision);
678
+ }
363
679
  async cleanup(request, view) {
364
680
  try {
365
681
  debugInfo('codingns4dsh: client terminal cleanup begin', { sessionId: request.sessionId, terminalId: request.id, hasView: view !== undefined });
@@ -371,6 +687,15 @@ export class CodingNsWebTerminals extends Service {
371
687
  this.closeRequests.delete(String(request.id));
372
688
  persistCloseRequests(this.closeRequests.values());
373
689
  this.closeFailureStore.set(this.closeFailureStore.getSnapshot().filter((item) => item.id !== request.id));
690
+ // 兼容旧 Sidebar 的显式关闭路径:关闭成功后也必须刷新工作区库存,
691
+ // 否则其他会话会继续看到已经关闭的终端记录。
692
+ void this.refreshInventory(request.sessionId).catch((error) => {
693
+ debugWarn('codingns4dsh: client terminal inventory refresh after close failed', {
694
+ sessionId: request.sessionId,
695
+ terminalId: request.id,
696
+ error: errorMessage(error),
697
+ });
698
+ });
374
699
  }
375
700
  catch (error) {
376
701
  if (isTerminalRemoteUnavailable(error)) {
@@ -413,10 +738,21 @@ function unwrap(result) {
413
738
  return result.value;
414
739
  throw result.error;
415
740
  }
741
+ /**
742
+ * 终端 Remote 尚未注入时的稳定错误。
743
+ *
744
+ * 调用方按类型判断可用性,不能比较本地化后的 message 文本。
745
+ */
746
+ export class TerminalRemoteUnavailableError extends Error {
747
+ constructor() {
748
+ super('终端服务尚未就绪,请稍后重试');
749
+ this.name = 'TerminalRemoteUnavailableError';
750
+ }
751
+ }
416
752
  function resolveRemote(source) {
417
753
  const remote = typeof source === 'function' ? source() : source;
418
754
  if (remote === undefined)
419
- throw new Error('终端服务尚未就绪,请稍后重试');
755
+ throw new TerminalRemoteUnavailableError();
420
756
  return remote;
421
757
  }
422
758
  function sameResize(left, right) {
@@ -426,7 +762,25 @@ function errorMessage(error) {
426
762
  return error instanceof Error ? error.message : String(error);
427
763
  }
428
764
  function isTerminalRemoteUnavailable(error) {
429
- return errorMessage(error) === '终端服务尚未就绪,请稍后重试';
765
+ return error instanceof TerminalRemoteUnavailableError;
766
+ }
767
+ function sameInventory(left, right) {
768
+ if (left.length !== right.length)
769
+ return false;
770
+ for (let index = 0; index < left.length; index += 1) {
771
+ const a = left[index];
772
+ const b = right[index];
773
+ if (a.id !== b.id || a.title !== b.title || a.cwd !== b.cwd || a.cols !== b.cols || a.rows !== b.rows || a.state !== b.state || a.exitCode !== b.exitCode || a.shell.path !== b.shell.path || a.shell.name !== b.shell.name)
774
+ return false;
775
+ }
776
+ return true;
777
+ }
778
+ /** Host 列表按 terminalId 去重,避免重复记录共享同一个关闭动作。 */
779
+ function dedupeInventory(terminals) {
780
+ const unique = new Map();
781
+ for (const terminal of terminals)
782
+ unique.set(terminal.id, terminal);
783
+ return [...unique.values()];
430
784
  }
431
785
  function bindingKey(sessionId, contentId) {
432
786
  return `${BINDING_PREFIX}${JSON.stringify([sessionId, contentId])}`;
@@ -467,6 +821,11 @@ function deleteWorkspaceBinding(workspaceId, _contentId) {
467
821
  }
468
822
  catch { /* 浏览器禁用存储时仅失去跨刷新绑定。 */ }
469
823
  }
824
+ function deleteWorkspaceBindingIfMatches(workspaceId, id) {
825
+ if (readWorkspaceBinding(workspaceId) !== id)
826
+ return;
827
+ deleteWorkspaceBinding(workspaceId);
828
+ }
470
829
  function deleteLegacyWorkspaceBinding(workspaceId, contentId) {
471
830
  try {
472
831
  localStorage.removeItem(legacyWorkspaceBindingKey(workspaceId, contentId));