@deepseek-harness-tui/dsh-tui 0.10.2 → 0.11.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 (277) hide show
  1. package/README.md +171 -124
  2. package/bin/dsh-tui.js +748 -22
  3. package/cordis.patch.yml +38 -10
  4. package/cordis.yml +2 -0
  5. package/lib/types/adapter/channel/session-projection.d.ts.map +1 -1
  6. package/lib/types/adapter/channel/session-projection.js +2 -0
  7. package/lib/types/adapter/channel/ui-policy.d.ts +4 -1
  8. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  9. package/lib/types/adapter/channel/ui-policy.js +5 -1
  10. package/lib/types/adapter/kernel/host-facade.d.ts.map +1 -1
  11. package/lib/types/adapter/kernel/host-facade.js +1 -0
  12. package/lib/types/adapter/kernel/replay.d.ts.map +1 -1
  13. package/lib/types/adapter/kernel/replay.js +3 -0
  14. package/lib/types/adapter/kernel/runtime.d.ts.map +1 -1
  15. package/lib/types/adapter/kernel/runtime.js +2 -0
  16. package/lib/types/adapter/kernel/slices/workspace.d.ts.map +1 -1
  17. package/lib/types/adapter/kernel/slices/workspace.js +1 -0
  18. package/lib/types/adapter/ports/channel-ui.d.ts +22 -2
  19. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  20. package/lib/types/adapter/ports/channel-view.d.ts +66 -0
  21. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  22. package/lib/types/adapter/ports/channel-workspace.d.ts +23 -0
  23. package/lib/types/adapter/ports/channel-workspace.d.ts.map +1 -1
  24. package/lib/types/adapter/ports/workspace.d.ts +2 -0
  25. package/lib/types/adapter/ports/workspace.d.ts.map +1 -1
  26. package/lib/types/adapter/upstream/workspace-driver.d.ts.map +1 -1
  27. package/lib/types/adapter/upstream/workspace-driver.js +10 -2
  28. package/lib/types/commands.d.ts.map +1 -1
  29. package/lib/types/commands.js +1 -0
  30. package/lib/types/components/ContextBarView.d.ts +15 -7
  31. package/lib/types/components/ContextBarView.d.ts.map +1 -1
  32. package/lib/types/components/ContextBarView.js +26 -22
  33. package/lib/types/components/ImagePreviewOverlay.d.ts.map +1 -1
  34. package/lib/types/components/ImagePreviewOverlay.js +11 -5
  35. package/lib/types/components/Markdown.d.ts +11 -1
  36. package/lib/types/components/Markdown.d.ts.map +1 -1
  37. package/lib/types/components/Markdown.js +20 -2
  38. package/lib/types/components/MermaidDiagram.d.ts +13 -0
  39. package/lib/types/components/MermaidDiagram.d.ts.map +1 -0
  40. package/lib/types/components/MermaidDiagram.js +61 -0
  41. package/lib/types/components/MessageList.d.ts +26 -1
  42. package/lib/types/components/MessageList.d.ts.map +1 -1
  43. package/lib/types/components/MessageList.js +72 -7
  44. package/lib/types/components/PageMargin.d.ts +1 -1
  45. package/lib/types/components/PromptInput.d.ts +37 -1
  46. package/lib/types/components/PromptInput.d.ts.map +1 -1
  47. package/lib/types/components/PromptInput.js +243 -28
  48. package/lib/types/components/ScrollbarGutter.d.ts +20 -5
  49. package/lib/types/components/ScrollbarGutter.d.ts.map +1 -1
  50. package/lib/types/components/ScrollbarGutter.js +88 -10
  51. package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
  52. package/lib/types/components/StreamingMarkdown.js +30 -28
  53. package/lib/types/components/Tooltip.d.ts.map +1 -1
  54. package/lib/types/components/Tooltip.js +45 -7
  55. package/lib/types/components/messages/UserPromptMessage.d.ts.map +1 -1
  56. package/lib/types/components/messages/UserPromptMessage.js +5 -7
  57. package/lib/types/components/messages/useImageInspection.d.ts.map +1 -1
  58. package/lib/types/components/messages/useImageInspection.js +19 -9
  59. package/lib/types/components/promptDraftCache.d.ts +102 -0
  60. package/lib/types/components/promptDraftCache.d.ts.map +1 -0
  61. package/lib/types/components/promptDraftCache.js +76 -0
  62. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +17 -1
  63. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  64. package/lib/types/components/questions/AskUserQuestionPanel.js +40 -7
  65. package/lib/types/components/questions/QuestionMinimizedBar.d.ts +12 -0
  66. package/lib/types/components/questions/QuestionMinimizedBar.d.ts.map +1 -0
  67. package/lib/types/components/questions/QuestionMinimizedBar.js +43 -0
  68. package/lib/types/components/sessions/SessionListRow.d.ts +23 -1
  69. package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
  70. package/lib/types/components/sessions/SessionListRow.js +52 -5
  71. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts +49 -0
  72. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -0
  73. package/lib/types/components/workspaces/HomeWorkspaceRow.js +50 -0
  74. package/lib/types/dsh-adapter/bundled-presets.d.ts +10 -0
  75. package/lib/types/dsh-adapter/bundled-presets.d.ts.map +1 -0
  76. package/lib/types/dsh-adapter/bundled-presets.js +80 -0
  77. package/lib/types/dsh-adapter/channel/action-readiness.d.ts +1 -1
  78. package/lib/types/dsh-adapter/channel/action-readiness.d.ts.map +1 -1
  79. package/lib/types/dsh-adapter/channel/action-readiness.js +3 -0
  80. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts +1 -1
  81. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts.map +1 -1
  82. package/lib/types/dsh-adapter/channel/agent-view-projection.js +19 -2
  83. package/lib/types/dsh-adapter/channel/background-action.d.ts.map +1 -1
  84. package/lib/types/dsh-adapter/channel/background-action.js +52 -29
  85. package/lib/types/dsh-adapter/channel/binding.d.ts +19 -2
  86. package/lib/types/dsh-adapter/channel/binding.d.ts.map +1 -1
  87. package/lib/types/dsh-adapter/channel/binding.js +78 -18
  88. package/lib/types/dsh-adapter/channel/composer-images.d.ts +5 -0
  89. package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
  90. package/lib/types/dsh-adapter/channel/composer-images.js +105 -6
  91. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +8 -0
  92. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
  93. package/lib/types/dsh-adapter/channel/context-bookkeeping.js +3 -2
  94. package/lib/types/dsh-adapter/channel/ide-selection.d.ts +58 -0
  95. package/lib/types/dsh-adapter/channel/ide-selection.d.ts.map +1 -0
  96. package/lib/types/dsh-adapter/channel/ide-selection.js +226 -0
  97. package/lib/types/dsh-adapter/channel/input-delivery.d.ts +6 -1
  98. package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
  99. package/lib/types/dsh-adapter/channel/input-delivery.js +9 -1
  100. package/lib/types/dsh-adapter/channel/local-actions.d.ts +3 -19
  101. package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
  102. package/lib/types/dsh-adapter/channel/local-actions.js +2 -1
  103. package/lib/types/dsh-adapter/channel/model-actions.d.ts +4 -1
  104. package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
  105. package/lib/types/dsh-adapter/channel/model-actions.js +82 -6
  106. package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
  107. package/lib/types/dsh-adapter/channel/model-switch.js +49 -31
  108. package/lib/types/dsh-adapter/channel/projection.d.ts +4 -0
  109. package/lib/types/dsh-adapter/channel/projection.d.ts.map +1 -1
  110. package/lib/types/dsh-adapter/channel/projection.js +29 -19
  111. package/lib/types/dsh-adapter/channel/reports.d.ts.map +1 -1
  112. package/lib/types/dsh-adapter/channel/reports.js +4 -12
  113. package/lib/types/dsh-adapter/channel/session-fork.d.ts.map +1 -1
  114. package/lib/types/dsh-adapter/channel/session-fork.js +26 -2
  115. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +3 -0
  116. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
  117. package/lib/types/dsh-adapter/channel/session-live-adoption.js +1 -0
  118. package/lib/types/dsh-adapter/channel/session-metadata.d.ts +10 -0
  119. package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
  120. package/lib/types/dsh-adapter/channel/session-metadata.js +2 -2
  121. package/lib/types/dsh-adapter/channel/session-resume.d.ts +11 -2
  122. package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
  123. package/lib/types/dsh-adapter/channel/session-resume.js +291 -94
  124. package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
  125. package/lib/types/dsh-adapter/channel/session-rewind.js +34 -16
  126. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
  127. package/lib/types/dsh-adapter/channel/session-tree-actions.js +19 -3
  128. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  129. package/lib/types/dsh-adapter/channel/settings-host.js +4 -3
  130. package/lib/types/dsh-adapter/channel/state.d.ts +1 -1
  131. package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
  132. package/lib/types/dsh-adapter/channel/state.js +1 -1
  133. package/lib/types/dsh-adapter/channel/transcript.d.ts.map +1 -1
  134. package/lib/types/dsh-adapter/channel/transcript.js +6 -12
  135. package/lib/types/dsh-adapter/channel/types.d.ts +6 -1
  136. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  137. package/lib/types/dsh-adapter/channel/workspace-actions.d.ts +4 -1
  138. package/lib/types/dsh-adapter/channel/workspace-actions.d.ts.map +1 -1
  139. package/lib/types/dsh-adapter/channel/workspace-actions.js +41 -1
  140. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  141. package/lib/types/dsh-adapter/channel.js +67 -6
  142. package/lib/types/dsh-adapter/compat/messages.d.ts +15 -0
  143. package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -0
  144. package/lib/types/dsh-adapter/compat/messages.js +15 -0
  145. package/lib/types/dsh-adapter/compat/settings.d.ts +33 -0
  146. package/lib/types/dsh-adapter/compat/settings.d.ts.map +1 -0
  147. package/lib/types/dsh-adapter/compat/settings.js +43 -0
  148. package/lib/types/dsh-adapter/compat/shell.d.ts +25 -0
  149. package/lib/types/dsh-adapter/compat/shell.d.ts.map +1 -0
  150. package/lib/types/dsh-adapter/compat/shell.js +11 -0
  151. package/lib/types/dsh-adapter/contract.d.ts +4 -4
  152. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  153. package/lib/types/dsh-adapter/contract.js +15 -6
  154. package/lib/types/dsh-adapter/ide-channel.d.ts +224 -0
  155. package/lib/types/dsh-adapter/ide-channel.d.ts.map +1 -0
  156. package/lib/types/dsh-adapter/ide-channel.js +556 -0
  157. package/lib/types/dsh-adapter/index.d.ts +18 -3
  158. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  159. package/lib/types/dsh-adapter/index.js +32 -5
  160. package/lib/types/dsh-adapter/plugin.d.ts +5 -2
  161. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  162. package/lib/types/dsh-adapter/plugin.js +173 -42
  163. package/lib/types/dsh-adapter/preset-resolution.d.ts +8 -0
  164. package/lib/types/dsh-adapter/preset-resolution.d.ts.map +1 -1
  165. package/lib/types/dsh-adapter/preset-resolution.js +10 -0
  166. package/lib/types/dsh-adapter/session-mount-heartbeat.d.ts +53 -0
  167. package/lib/types/dsh-adapter/session-mount-heartbeat.d.ts.map +1 -0
  168. package/lib/types/dsh-adapter/session-mount-heartbeat.js +100 -0
  169. package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -1
  170. package/lib/types/dsh-adapter/sessionTree.js +3 -2
  171. package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
  172. package/lib/types/dsh-adapter/subagents.js +6 -5
  173. package/lib/types/dsh-adapter/workspaces.d.ts +46 -3
  174. package/lib/types/dsh-adapter/workspaces.d.ts.map +1 -1
  175. package/lib/types/dsh-adapter/workspaces.js +116 -0
  176. package/lib/types/effortPrefs.d.ts +15 -3
  177. package/lib/types/effortPrefs.d.ts.map +1 -1
  178. package/lib/types/effortPrefs.js +37 -3
  179. package/lib/types/homePrefs.d.ts +15 -0
  180. package/lib/types/homePrefs.d.ts.map +1 -0
  181. package/lib/types/homePrefs.js +53 -0
  182. package/lib/types/i18n.d.ts +257 -296
  183. package/lib/types/i18n.d.ts.map +1 -1
  184. package/lib/types/i18n.js +78 -84
  185. package/lib/types/ink/colorize.d.ts +10 -0
  186. package/lib/types/ink/colorize.d.ts.map +1 -1
  187. package/lib/types/ink/colorize.js +21 -0
  188. package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
  189. package/lib/types/ink/components/ScrollBox.js +12 -1
  190. package/lib/types/ink/dom.d.ts +1 -0
  191. package/lib/types/ink/dom.d.ts.map +1 -1
  192. package/lib/types/ink/hooks/use-copy-on-select.d.ts +5 -1
  193. package/lib/types/ink/hooks/use-copy-on-select.d.ts.map +1 -1
  194. package/lib/types/ink/hooks/use-copy-on-select.js +15 -1
  195. package/lib/types/ink/ink.d.ts.map +1 -1
  196. package/lib/types/ink/ink.js +36 -1
  197. package/lib/types/ink/output.d.ts +10 -1
  198. package/lib/types/ink/output.d.ts.map +1 -1
  199. package/lib/types/ink/output.js +109 -17
  200. package/lib/types/ink/render-border.d.ts +6 -1
  201. package/lib/types/ink/render-border.d.ts.map +1 -1
  202. package/lib/types/ink/render-border.js +25 -9
  203. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  204. package/lib/types/ink/render-node-to-output.js +48 -6
  205. package/lib/types/ink/renderer.d.ts +6 -0
  206. package/lib/types/ink/renderer.d.ts.map +1 -1
  207. package/lib/types/ink/renderer.js +2 -1
  208. package/lib/types/ink/selection.d.ts +60 -0
  209. package/lib/types/ink/selection.d.ts.map +1 -1
  210. package/lib/types/ink/selection.js +129 -0
  211. package/lib/types/ink/sixel-graphics.d.ts +19 -1
  212. package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
  213. package/lib/types/ink/sixel-graphics.js +124 -12
  214. package/lib/types/ink/terminal-image.d.ts +18 -1
  215. package/lib/types/ink/terminal-image.d.ts.map +1 -1
  216. package/lib/types/ink/terminal.d.ts +17 -0
  217. package/lib/types/ink/terminal.d.ts.map +1 -1
  218. package/lib/types/ink/terminal.js +20 -1
  219. package/lib/types/screens/Chat.d.ts +17 -1
  220. package/lib/types/screens/Chat.d.ts.map +1 -1
  221. package/lib/types/screens/Chat.js +284 -72
  222. package/lib/types/screens/SessionSupervisor.d.ts +84 -0
  223. package/lib/types/screens/SessionSupervisor.d.ts.map +1 -0
  224. package/lib/types/screens/SessionSupervisor.js +350 -0
  225. package/lib/types/screens/SessionTree.js +2 -2
  226. package/lib/types/screens/Settings.d.ts.map +1 -1
  227. package/lib/types/screens/Settings.js +32 -9
  228. package/lib/types/screens/StatusLine.d.ts +13 -0
  229. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  230. package/lib/types/screens/StatusLine.js +36 -17
  231. package/lib/types/screens/StatusMetrics.d.ts +79 -22
  232. package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
  233. package/lib/types/screens/StatusMetrics.js +153 -88
  234. package/lib/types/screens/sessionSupervisor/model.d.ts +83 -0
  235. package/lib/types/screens/sessionSupervisor/model.d.ts.map +1 -0
  236. package/lib/types/screens/sessionSupervisor/model.js +69 -0
  237. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +120 -0
  238. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -0
  239. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +593 -0
  240. package/lib/types/sessionMounts.d.ts +272 -0
  241. package/lib/types/sessionMounts.d.ts.map +1 -0
  242. package/lib/types/sessionMounts.js +706 -0
  243. package/lib/types/sessions/format.d.ts.map +1 -1
  244. package/lib/types/sessions/format.js +4 -1
  245. package/lib/types/sessions/resumeFailure.d.ts +38 -0
  246. package/lib/types/sessions/resumeFailure.d.ts.map +1 -0
  247. package/lib/types/sessions/resumeFailure.js +58 -0
  248. package/lib/types/terminal-utils/mermaid.d.ts +44 -0
  249. package/lib/types/terminal-utils/mermaid.d.ts.map +1 -0
  250. package/lib/types/terminal-utils/mermaid.js +83 -0
  251. package/lib/types/tips.d.ts.map +1 -1
  252. package/lib/types/tips.js +175 -19
  253. package/lib/types/tuiDisplayPrefs.d.ts +7 -9
  254. package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
  255. package/lib/types/tuiDisplayPrefs.js +31 -28
  256. package/lib/types/update.d.ts +61 -0
  257. package/lib/types/update.d.ts.map +1 -1
  258. package/lib/types/update.js +194 -0
  259. package/lib/types/utils/imageResize.d.ts +90 -0
  260. package/lib/types/utils/imageResize.d.ts.map +1 -0
  261. package/lib/types/utils/imageResize.js +272 -0
  262. package/lib/types/utils/keymap.d.ts +5 -1
  263. package/lib/types/utils/keymap.d.ts.map +1 -1
  264. package/lib/types/utils/keymap.js +23 -0
  265. package/lib/types/workspaces.d.ts +2 -1
  266. package/lib/types/workspaces.d.ts.map +1 -1
  267. package/lib/types/workspaces.js +1 -1
  268. package/node_modules/@deepseek-harness-tui/dsh-auth/package.json +10 -10
  269. package/package.json +120 -103
  270. package/presets/liangshen/.dsh-tui-managed.json +1 -1
  271. package/presets/liangshen/agent.cordis.yml +15 -0
  272. package/lib/types/screens/AgentView.d.ts +0 -23
  273. package/lib/types/screens/AgentView.d.ts.map +0 -1
  274. package/lib/types/screens/AgentView.js +0 -546
  275. package/lib/types/screens/SessionBrowser.d.ts +0 -42
  276. package/lib/types/screens/SessionBrowser.d.ts.map +0 -1
  277. package/lib/types/screens/SessionBrowser.js +0 -911
@@ -0,0 +1,25 @@
1
+ /** Foreground shell seam across the legacy run() and 0.1.7 execute() APIs. */
2
+ export interface ShellRequest {
3
+ command: string;
4
+ workdir?: string;
5
+ timeoutMs: number;
6
+ }
7
+ export interface ShellResult {
8
+ stdout: {
9
+ text: string;
10
+ };
11
+ stderr: {
12
+ text: string;
13
+ };
14
+ timedOut: boolean;
15
+ }
16
+ export interface ForegroundShell {
17
+ resolve(request: ShellRequest): unknown;
18
+ run?(spec: unknown): Promise<ShellResult>;
19
+ execute?(spec: unknown): Promise<{
20
+ result(): Promise<ShellResult>;
21
+ }>;
22
+ }
23
+ /** Resolve through the host so workspace, timeout and sandbox policy survive. */
24
+ export declare function runForegroundShell(shell: ForegroundShell, request: ShellRequest): Promise<ShellResult>;
25
+ //# sourceMappingURL=shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/compat/shell.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACxB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACxB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAA;IACvC,GAAG,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IACzC,OAAO,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC,CAAA;CACrE;AAED,iFAAiF;AACjF,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAQ5G"}
@@ -0,0 +1,11 @@
1
+ /** Resolve through the host so workspace, timeout and sandbox policy survive. */
2
+ export async function runForegroundShell(shell, request) {
3
+ const spec = shell.resolve(request);
4
+ if (typeof shell.execute === 'function') {
5
+ const execution = await shell.execute(spec);
6
+ return execution.result();
7
+ }
8
+ if (typeof shell.run === 'function')
9
+ return shell.run(spec);
10
+ throw new Error('dsh-tui: shell provides neither execute() nor run()');
11
+ }
@@ -1,9 +1,9 @@
1
1
  /** Primary validated upstream line (newest). */
2
- export declare const UPSTREAM_VALIDATED_VERSION = "0.1.5-rc.1";
2
+ export declare const UPSTREAM_VALIDATED_VERSION = "0.1.7-rc.1";
3
3
  /**
4
4
  * Explicitly supported upstream prerelease lines, oldest first.
5
5
  *
6
- * 0.1.5-rc.1 = primary continuous-CI line; 0.1.5-alpha.2/alpha.1 = mapped
6
+ * 0.1.7-rc.1 = primary continuous-CI line; 0.1.5-rc.1/alpha.2/alpha.1 = mapped
7
7
  * compatibility lines (source-checked when the primary line moves);
8
8
  * 0.1.3-alpha.2 = compatibility line (the only 0.1.3 build on npm);
9
9
  * 0.1.2-rc.1 = previous family (full CI coverage); 0.1.2-alpha.3–alpha.5 =
@@ -15,14 +15,14 @@ export declare const UPSTREAM_VALIDATED_VERSION = "0.1.5-rc.1";
15
15
  * The peer range in package.json is deliberately wider than this list: an
16
16
  * install on an older or newer line is allowed but reports drift at boot.
17
17
  */
18
- export declare const UPSTREAM_VALIDATED_VERSIONS: readonly ["0.1.0-rc.6", "0.1.0-rc.7", "0.1.0-rc.8", "0.1.1-rc.1", "0.1.1-rc.2", "0.1.2-alpha.3", "0.1.2-alpha.4", "0.1.2-alpha.5", "0.1.2-rc.1", "0.1.3-alpha.2", "0.1.5-alpha.1", "0.1.5-alpha.2", "0.1.5-rc.1"];
18
+ export declare const UPSTREAM_VALIDATED_VERSIONS: readonly ["0.1.0-rc.6", "0.1.0-rc.7", "0.1.0-rc.8", "0.1.1-rc.1", "0.1.1-rc.2", "0.1.2-alpha.3", "0.1.2-alpha.4", "0.1.2-alpha.5", "0.1.2-rc.1", "0.1.3-alpha.2", "0.1.5-alpha.1", "0.1.5-alpha.2", "0.1.5-rc.1", "0.1.7-rc.1"];
19
19
  /**
20
20
  * Framework packages version on their own lines; the contract validates
21
21
  * their MAJOR (breaking surface), not the harness prerelease number.
22
22
  */
23
23
  export declare const UPSTREAM_FRAMEWORK_MAJORS: Record<string, number>;
24
24
  /** Official packages the adapter consumes at runtime or as types. */
25
- export declare const UPSTREAM_BLESSED_PACKAGES: readonly ["@deepseek-ai/cordis", "@deepseek-ai/schemastery", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-presets", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-code-runtime-worker-thread", "@deepseek-ai/dsh-commands", "@deepseek-ai/dsh-cordis-host-runner", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-llm-pi-ai", "@deepseek-ai/dsh-persona", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-settings", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-storage", "@deepseek-ai/dsh-storage-domain", "@deepseek-ai/dsh-storage-json", "@deepseek-ai/dsh-workspace", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-terminal", "@deepseek-ai/dsh-terminal-bash", "@deepseek-ai/dsh-tool-ask-user", "@deepseek-ai/dsh-tool-bash-persistent", "@deepseek-ai/dsh-tool-cordis", "@deepseek-ai/dsh-tool-subagent", "@deepseek-ai/dsh-user-approval", "@deepseek-ai/dsh-user-questions"];
25
+ export declare const UPSTREAM_BLESSED_PACKAGES: readonly ["@deepseek-ai/cordis", "@deepseek-ai/schemastery", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-preset-registry", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-ptc-runtime-node", "@deepseek-ai/dsh-commands", "@deepseek-ai/dsh-cordis-host-runner", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-llm-pi-ai", "@deepseek-ai/dsh-persona", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-settings", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-storage", "@deepseek-ai/dsh-storage-domain", "@deepseek-ai/dsh-storage-json", "@deepseek-ai/dsh-workspace", "@deepseek-ai/dsh-web-app", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-terminal", "@deepseek-ai/dsh-terminal-bash", "@deepseek-ai/dsh-tool-ask-user", "@deepseek-ai/dsh-tool-bash-persistent", "@deepseek-ai/dsh-tool-cordis", "@deepseek-ai/dsh-tool-subagent", "@deepseek-ai/dsh-user-approval", "@deepseek-ai/dsh-user-questions"];
26
26
  export interface UpstreamDriftEntry {
27
27
  package: string;
28
28
  installed: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/contract.ts"],"names":[],"mappings":"AAkBA,gDAAgD;AAChD,eAAO,MAAM,0BAA0B,eAAe,CAAA;AAEtD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,2BAA2B,mNAc9B,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG5D,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,yBAAyB,06BA8B5B,CAAA;AAEV,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,4EAA4E;AAC5E,MAAM,MAAM,yBAAyB,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,CAAA;AAE/D,4FAA4F;AAC5F,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,yBAAyB,EAAE,MAAM,CAAC,CAAA;AAEvG,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,oBAAoB,GAAG,SAAS,CAKlG;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,CAAC,EAAE,oBAAoB,EAAE,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAQxF;AAkBD,sEAAsE;AACtE,eAAO,MAAM,wBAAwB,QAA6D,CAAA;AAYlG,wBAAgB,yBAAyB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM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kBAAkB,EAAE,CAuBtB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEtE,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,iBAAiB,CAAA;IACvB,sFAAsF;IACtF,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,iBAAiB,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAA+B,GAC5F,oBAAoB,GAAG,SAAS,CA0BlC"}
@@ -2,7 +2,7 @@
2
2
  * Upstream compatibility contract.
3
3
  *
4
4
  * The TUI is validated against a set of upstream prerelease lines — the
5
- * current primary (0.1.5-rc.1) plus older lines kept in backward
5
+ * current primary (0.1.7-rc.1) plus older lines kept in backward
6
6
  * compatibility across the 0.1.5, 0.1.3, 0.1.2, 0.1.1 and 0.1.0 release
7
7
  * families.
8
8
  * Every official package this adapter touches is blessed here; anything
@@ -16,11 +16,11 @@
16
16
  import { readFileSync } from 'node:fs';
17
17
  import { fileURLToPath } from 'node:url';
18
18
  /** Primary validated upstream line (newest). */
19
- export const UPSTREAM_VALIDATED_VERSION = '0.1.5-rc.1';
19
+ export const UPSTREAM_VALIDATED_VERSION = '0.1.7-rc.1';
20
20
  /**
21
21
  * Explicitly supported upstream prerelease lines, oldest first.
22
22
  *
23
- * 0.1.5-rc.1 = primary continuous-CI line; 0.1.5-alpha.2/alpha.1 = mapped
23
+ * 0.1.7-rc.1 = primary continuous-CI line; 0.1.5-rc.1/alpha.2/alpha.1 = mapped
24
24
  * compatibility lines (source-checked when the primary line moves);
25
25
  * 0.1.3-alpha.2 = compatibility line (the only 0.1.3 build on npm);
26
26
  * 0.1.2-rc.1 = previous family (full CI coverage); 0.1.2-alpha.3–alpha.5 =
@@ -46,6 +46,7 @@ export const UPSTREAM_VALIDATED_VERSIONS = [
46
46
  '0.1.5-alpha.1',
47
47
  '0.1.5-alpha.2',
48
48
  '0.1.5-rc.1',
49
+ '0.1.7-rc.1',
49
50
  ];
50
51
  /**
51
52
  * Framework packages version on their own lines; the contract validates
@@ -62,9 +63,9 @@ export const UPSTREAM_BLESSED_PACKAGES = [
62
63
  '@deepseek-ai/dsh-invariants',
63
64
  '@deepseek-ai/dsh-agent',
64
65
  '@deepseek-ai/dsh-agent-instructions',
65
- '@deepseek-ai/dsh-agent-presets',
66
+ '@deepseek-ai/dsh-agent-preset-registry',
66
67
  '@deepseek-ai/dsh-atomic-write',
67
- '@deepseek-ai/dsh-code-runtime-worker-thread',
68
+ '@deepseek-ai/dsh-ptc-runtime-node',
68
69
  '@deepseek-ai/dsh-commands',
69
70
  '@deepseek-ai/dsh-cordis-host-runner',
70
71
  '@deepseek-ai/dsh-llm',
@@ -77,6 +78,7 @@ export const UPSTREAM_BLESSED_PACKAGES = [
77
78
  '@deepseek-ai/dsh-storage-domain',
78
79
  '@deepseek-ai/dsh-storage-json',
79
80
  '@deepseek-ai/dsh-workspace',
81
+ '@deepseek-ai/dsh-web-app',
80
82
  '@deepseek-ai/dsh-system-prompt',
81
83
  '@deepseek-ai/dsh-terminal',
82
84
  '@deepseek-ai/dsh-terminal-bash',
@@ -87,6 +89,13 @@ export const UPSTREAM_BLESSED_PACKAGES = [
87
89
  '@deepseek-ai/dsh-user-approval',
88
90
  '@deepseek-ai/dsh-user-questions',
89
91
  ];
92
+ // These capabilities are loaded dynamically and did not exist on every
93
+ // supported host line. Their absence is valid at runtime, not in the CI tree.
94
+ const OPTIONAL_RUNTIME_PACKAGES = new Set([
95
+ '@deepseek-ai/dsh-agent-preset-registry',
96
+ '@deepseek-ai/dsh-ptc-runtime-node',
97
+ '@deepseek-ai/dsh-web-app',
98
+ ]);
90
99
  /** Parse an upstream prerelease version; undefined when unparseable. */
91
100
  export function parseUpstreamVersion(version) {
92
101
  const match = /^(\d+)\.(\d+)\.(\d+)-(alpha|beta|rc)\.(\d+)$/u.exec(version ?? '');
@@ -237,7 +246,7 @@ export function upstreamDriftSummary(installedVersions = installedUpstreamVersio
237
246
  const installedLines = installedUpstreamLines(installedVersions);
238
247
  if (installedLines.length > 1)
239
248
  return { kind: 'mixed', versions: installedLines };
240
- const drift = upstreamDrift(installedVersions);
249
+ const drift = upstreamDrift(installedVersions).filter(entry => entry.installed !== undefined || !OPTIONAL_RUNTIME_PACKAGES.has(entry.package));
241
250
  if (drift.length === 0)
242
251
  return undefined;
243
252
  const harness = drift.filter(entry => UPSTREAM_FRAMEWORK_MAJORS[entry.package] === undefined);
@@ -0,0 +1,224 @@
1
+ /**
2
+ * IDE selection channel (PR-B groundwork): the dsh-tui side of a loopback
3
+ * WebSocket link with a companion IDE extension (dsh-tui-vscode). The
4
+ * extension broadcasts caret-selection changes; the TUI consumes them to
5
+ * attach `<attached-file …>` blocks at submit time (ADR-001).
6
+ *
7
+ * Discovery has two paths (DESIGN D4):
8
+ * 1. env direct — DSH_TUI_IDE_PORT + DSH_TUI_IDE_TOKEN, injected when the
9
+ * extension spawns this TUI itself;
10
+ * 2. lock scan — `~/.dsh-tui/ide/*.lock` files written by the extension
11
+ * ({port, token, workspaceFolders, pid}); locks whose workspaceFolders
12
+ * match the session cwd connect first.
13
+ *
14
+ * Both paths fail → silent degradation (AC-4): no error, no retry,
15
+ * connected=false, every other TUI feature unaffected. The client is Node's
16
+ * native WebSocket global (engines ^22.19 || >=24, D5) — zero dependencies
17
+ * and no auto-reconnect (degrade-on-drop is the design).
18
+ *
19
+ * Protocol constants here are a cross-repo contract (the extension's server
20
+ * side implements the mirror); changing them requires updating both ends
21
+ * plus ADR-001 (DESIGN §9.5). Protocol version 2:
22
+ * - Handshake: the client's first frame is
23
+ * `{"method":"ide/hello","params":{"token","protocolVersion"}}`; the
24
+ * server validates the token and answers
25
+ * `{"method":"ide/hello_ack","params":{"protocolVersion",
26
+ * "workspaceFolders"}}`. The client is connected only after a valid ack —
27
+ * a wrong token closes the socket and the client tries its next
28
+ * candidate.
29
+ * - Notifications: `{"method":"selection_changed","params":{path,
30
+ * startLine, endLine, isEmpty, text, documentVersion}}` — coordinates are
31
+ * 0-based, and `text` carries the editor buffer's own selection text
32
+ * (unsaved edits included); the TUI attaches that text verbatim and only
33
+ * falls back to reading the file from disk for protocol-1 pushes.
34
+ */
35
+ /** Env var carrying the extension's loopback WS port (spawn-injected). */
36
+ export declare const IDE_PORT_ENV = "DSH_TUI_IDE_PORT";
37
+ /** Env var carrying the extension's handshake token (spawn-injected). */
38
+ export declare const IDE_TOKEN_ENV = "DSH_TUI_IDE_TOKEN";
39
+ /** Wire protocol this client speaks; hello_ack carries the server's value. */
40
+ export declare const IDE_PROTOCOL_VERSION = 2;
41
+ /** Where the extension advertises its loopback server (`~/.dsh-tui/ide`). */
42
+ export declare function ideLockDir(dataDir?: string): string;
43
+ /** Connection target resolved from the spawn environment. */
44
+ export type IdeChannelConfig = {
45
+ port: number;
46
+ token: string;
47
+ };
48
+ /**
49
+ * Parse the direct-connect environment. Returns undefined when the pair is
50
+ * absent or malformed — port must be an integer within 1..65535 and the
51
+ * token non-empty — so a bad env degrades to lock discovery instead of
52
+ * throwing.
53
+ */
54
+ export declare function envDirect(env: NodeJS.ProcessEnv): IdeChannelConfig | undefined;
55
+ /**
56
+ * A parsed `*.lock` file: the extension's advertisement of its loopback
57
+ * server. workspaceFolders holds the absolute paths of its open workspace
58
+ * roots.
59
+ */
60
+ export type LockEntry = {
61
+ port: number;
62
+ token: string;
63
+ workspaceFolders: string[];
64
+ pid: number;
65
+ };
66
+ /** Snapshot carried by a `selection_changed` notification. */
67
+ export type SelectionSnapshot = {
68
+ /** Workspace-relative or absolute file path, as the extension reports it. */
69
+ path: string;
70
+ /** First selected line, 0-based. */
71
+ startLine: number;
72
+ /** Last selected line, 0-based inclusive. */
73
+ endLine: number;
74
+ /** True when the editor selection collapsed to nothing. */
75
+ isEmpty: boolean;
76
+ /**
77
+ * Protocol 2: the editor buffer's OWN text for the selection (unsaved
78
+ * edits included), exactly what the user saw when selecting. Always
79
+ * present from a v2 extension (the handshake gates on a v2 ack, so an
80
+ * older extension never gets connected); a missing/empty value only
81
+ * occurs on a degenerate push and falls back to reading the file from
82
+ * disk, which can differ from the editor for unsaved buffers.
83
+ */
84
+ text?: string;
85
+ /** Protocol 2: the editor document version the text came from. */
86
+ documentVersion?: number;
87
+ };
88
+ /**
89
+ * Validate an inbound `ide/hello_ack` frame. Returns the server's protocol
90
+ * version and workspace folders, or undefined for anything else — wrong
91
+ * method, malformed envelope, or a version this client does not speak (both
92
+ * ends ship together, so a mismatch is a foreign server and must not be
93
+ * treated as connected).
94
+ */
95
+ export declare function parseHelloAck(message: unknown): {
96
+ protocolVersion: number;
97
+ workspaceFolders: string[];
98
+ } | undefined;
99
+ /**
100
+ * Normalize a path for comparison: backslashes folded to forward slashes,
101
+ * trailing slashes stripped, case folded when the platform's filesystem is
102
+ * case-insensitive (same semantics as channel.ts normalizeCwd — sessions.ts
103
+ * precedent). Exported so verifiers can pin the Windows behavior.
104
+ */
105
+ export declare function normalizeIdePath(path: string, caseInsensitive: boolean): string;
106
+ /**
107
+ * Read and parse one lock file. Returns undefined for unreadable or
108
+ * malformed content (broken JSON, wrong field types) — a single bad lock
109
+ * must never break the whole scan.
110
+ */
111
+ export declare function readLockEntry(file: string): LockEntry | undefined;
112
+ /**
113
+ * Scan a lock directory and return the candidates whose workspaceFolders
114
+ * actually CONTAIN the session cwd, most-specific root first; ties keep
115
+ * directory order (stable sort). Malformed and stale locks are skipped, and
116
+ * an unmatched lock is NOT a candidate at all — dialing another workspace's
117
+ * IDE would attach that project's selections here (maintainer review round 3:
118
+ * "unmatched trails every match" used to make start() connect to an
119
+ * unrelated window when nothing matched). Never throws — an unreadable
120
+ * directory degrades to an empty list.
121
+ *
122
+ * `pid` is part of the lock contract and reserved for future disambiguation
123
+ * (DESIGN R5); matching currently relies on workspaceFolders only.
124
+ */
125
+ export declare function pickLockCandidates(lockDir: string, cwd: string, pid?: number): LockEntry[];
126
+ /**
127
+ * Validate one inbound notification as a `selection_changed` frame. Returns
128
+ * undefined for anything else — wrong method, malformed envelope, missing or
129
+ * out-of-range coordinates (endLine >= startLine >= 0, non-empty path).
130
+ */
131
+ export declare function parseSelectionChanged(message: unknown): SelectionSnapshot | undefined;
132
+ type SelectionListener = (snapshot: SelectionSnapshot) => void;
133
+ /**
134
+ * What one consumed selection contributed to a submitted message, recorded
135
+ * next to the user row so the transcript can render a "Selected N lines
136
+ * from <file>" indicator (T06). `lines` is the number of lines actually
137
+ * attached after clamping — the truth the model received, not the request.
138
+ */
139
+ export type SelectionAttachedInfo = {
140
+ lines: number;
141
+ path: string;
142
+ };
143
+ /**
144
+ * Connection lifecycle (DESIGN §3): idle → connecting (env first, then lock
145
+ * candidates under one shared budget) → connected, or silently disconnected.
146
+ * Once connected, an error or drop degrades to disconnected — no retry.
147
+ * The latest non-empty selection stays available after consumption so
148
+ * consecutive submits can reuse it; an isEmpty notification clears it.
149
+ */
150
+ export declare class IdeChannel {
151
+ private socket;
152
+ private pendingSocket;
153
+ private state;
154
+ private current;
155
+ /** Bumped on every connect attempt and on stop(): in-flight dials check it
156
+ * in `finish` and the discovery loop checks it before every next dial, so
157
+ * a stopped channel can neither be revived by a late onopen/ack nor keep
158
+ * dialing further candidates (maintainer review rounds 2–3). */
159
+ private generation;
160
+ /** Env/lockDir of the last start(), reused by rebind() so a cwd change
161
+ * rediscovers against the same environment it originally connected in. */
162
+ private startEnv;
163
+ private startLockDir;
164
+ /** Workspace folders the connected server reported in hello_ack. */
165
+ private ackedWorkspaceFolders;
166
+ private readonly listeners;
167
+ /** True only while the loopback link is up. */
168
+ get connected(): boolean;
169
+ /** Workspace folders the connected server acked with, or undefined while
170
+ * not connected (test/introspection seam for the cwd-coverage rule). */
171
+ get workspaceFolders(): string[] | undefined;
172
+ /** Latest non-empty selection, or undefined (never consumed-clearing). */
173
+ get selection(): SelectionSnapshot | undefined;
174
+ /**
175
+ * Subscribe to every selection notification, including empty ones.
176
+ * @returns An unsubscribe handle.
177
+ */
178
+ onSelection(listener: SelectionListener): () => void;
179
+ /**
180
+ * Discover and connect. All arguments are injectable so callers (and
181
+ * verifiers) can pin the environment, lock directory and session cwd;
182
+ * defaults read the live process values. Resolves without throwing in
183
+ * every outcome — check `connected` afterwards.
184
+ */
185
+ start(env?: NodeJS.ProcessEnv, lockDir?: string, cwd?: string): Promise<void>;
186
+ /** Drop the link (if any) and mark the channel disconnected. Cancels any
187
+ * dial still pending: the generation bump invalidates its finish, and the
188
+ * pending socket is aborted so a late onopen/ack can never re-connect.
189
+ * Cached selection state goes with the link — a stopped channel must not
190
+ * keep serving the old window's snapshot to anyone who reads `selection` /
191
+ * `workspaceFolders` (degradeToDisconnected already does this; stop() used
192
+ * to leave both behind, contradicting rebind()'s own contract). */
193
+ stop(): void;
194
+ /**
195
+ * Re-target the channel after the session cwd changed (/workspace, /resume
196
+ * adopting another session, ...). The old link belongs to the old
197
+ * workspace — a selection pushed there must never attach into the new one
198
+ * — so drop it (stop() clears the cached selection and the acked folders)
199
+ * and rediscover against the new cwd with the env/lockDir start() was last
200
+ * given (maintainer review
201
+ * round 3: clearing the cached selection used to keep the stale link, and
202
+ * the terminal-on-disconnect design meant a plain stop() could never
203
+ * reconnect; rebind() is the one sanctioned way back to idle).
204
+ */
205
+ rebind(cwd: string): Promise<void>;
206
+ private teardown;
207
+ private detach;
208
+ /** Close without waiting; closing a CONNECTING socket cancels the dial. */
209
+ private abort;
210
+ /**
211
+ * Dial one candidate and complete the token handshake. Resolves true only
212
+ * when the server answered `ide/hello_ack` with a matching protocol
213
+ * version — an OPEN socket alone proves nothing: a wrong-token server
214
+ * accepts the WS upgrade and then closes, and treating open as connected
215
+ * used to strand the client on a rejected candidate (maintainer review
216
+ * round 3). Anything slower than `timeoutMs`, any error, or any first
217
+ * frame that is not a valid v2 ack resolves false and cleans up.
218
+ */
219
+ private tryConnect;
220
+ private attachMessageHandler;
221
+ private degradeToDisconnected;
222
+ }
223
+ export {};
224
+ //# sourceMappingURL=ide-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ide-channel.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/ide-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAMH,0EAA0E;AAC1E,eAAO,MAAM,YAAY,qBAAqB,CAAA;AAC9C,yEAAyE;AACzE,eAAO,MAAM,aAAa,sBAAsB,CAAA;AAYhD,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,IAAI,CAAA;AAMrC,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,OAAO,GAAE,MAAiB,GAAG,MAAM,CAE7D;AAED,6DAA6D;AAC7D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,gBAAgB,GAAG,SAAS,CAS9E;AAED;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,8DAA8D;AAC9D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAA;IACZ,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAA;IACf,2DAA2D;IAC3D,OAAO,EAAE,OAAO,CAAA;IAChB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kEAAkE;IAClE,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED;;;;;;GAMG;AACH,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