@deepseek-harness-tui/dsh-tui 0.18.0 → 0.19.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 (209) hide show
  1. package/README.md +35 -10
  2. package/bin/dsh-tui.js +46 -3
  3. package/guide/dsh-tui-guide/codex-backend.en.md +2 -2
  4. package/guide/dsh-tui-guide/codex-backend.md +2 -2
  5. package/guide/dsh-tui-guide/configuration.en.md +7 -2
  6. package/guide/dsh-tui-guide/configuration.md +7 -2
  7. package/guide/dsh-tui-guide/getting-started.en.md +168 -4
  8. package/guide/dsh-tui-guide/getting-started.md +121 -14
  9. package/guide/dsh-tui-guide/interaction.en.md +11 -10
  10. package/guide/dsh-tui-guide/interaction.md +5 -4
  11. package/guide/dsh-tui-guide/user-guide.en.md +6 -5
  12. package/guide/dsh-tui-guide/user-guide.md +6 -5
  13. package/lib/settings.json +1 -1
  14. package/lib/types/adapter/ports/channel-ui.d.ts +10 -7
  15. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  16. package/lib/types/adapter/ports/channel-view.d.ts +28 -5
  17. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  18. package/lib/types/agent/events.d.ts +12 -5
  19. package/lib/types/agent/events.d.ts.map +1 -1
  20. package/lib/types/agent/session.d.ts +5 -0
  21. package/lib/types/agent/session.d.ts.map +1 -1
  22. package/lib/types/backends/claude/translate/core.d.ts +2 -2
  23. package/lib/types/backends/claude/translate/core.d.ts.map +1 -1
  24. package/lib/types/backends/claude/translate/core.js +10 -6
  25. package/lib/types/backends/codex/session/commands.d.ts +2 -0
  26. package/lib/types/backends/codex/session/commands.d.ts.map +1 -1
  27. package/lib/types/backends/codex/session/commands.js +8 -4
  28. package/lib/types/backends/codex/session/input.d.ts +11 -7
  29. package/lib/types/backends/codex/session/input.d.ts.map +1 -1
  30. package/lib/types/backends/codex/session/input.js +68 -15
  31. package/lib/types/backends/codex/session/session.d.ts.map +1 -1
  32. package/lib/types/backends/codex/session/session.js +2 -3
  33. package/lib/types/channel/projection.d.ts.map +1 -1
  34. package/lib/types/channel/projection.js +78 -10
  35. package/lib/types/channel/questions.d.ts +19 -3
  36. package/lib/types/channel/questions.d.ts.map +1 -1
  37. package/lib/types/channel/sanitize.d.ts.map +1 -1
  38. package/lib/types/channel/sanitize.js +8 -4
  39. package/lib/types/channel/subagent-failure.d.ts +49 -0
  40. package/lib/types/channel/subagent-failure.d.ts.map +1 -0
  41. package/lib/types/channel/subagent-failure.js +59 -0
  42. package/lib/types/channel/transcript.d.ts +17 -0
  43. package/lib/types/channel/transcript.d.ts.map +1 -1
  44. package/lib/types/channel/transcript.js +35 -0
  45. package/lib/types/commands.js +1 -1
  46. package/lib/types/components/MessageList.d.ts.map +1 -1
  47. package/lib/types/components/MessageList.js +11 -7
  48. package/lib/types/components/PromptInput.d.ts.map +1 -1
  49. package/lib/types/components/PromptInput.js +61 -6
  50. package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
  51. package/lib/types/components/SubagentDashboard.js +7 -1
  52. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  53. package/lib/types/components/messages/AssistantToolUseMessage.js +5 -2
  54. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +5 -8
  55. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  56. package/lib/types/components/questions/AskUserQuestionPanel.js +7 -4
  57. package/lib/types/components/questions/PlanReviewPanel.d.ts +3 -6
  58. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  59. package/lib/types/components/revealScope.d.ts +15 -0
  60. package/lib/types/components/revealScope.d.ts.map +1 -0
  61. package/lib/types/components/revealScope.js +17 -0
  62. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +34 -1
  63. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
  64. package/lib/types/components/sidePanel/btw/BtwComposer.js +108 -7
  65. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
  66. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +1 -1
  67. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
  68. package/lib/types/components/sidePanel/btw/BtwThreadScene.js +1 -1
  69. package/lib/types/components/smoothReveal.d.ts +36 -6
  70. package/lib/types/components/smoothReveal.d.ts.map +1 -1
  71. package/lib/types/components/smoothReveal.js +92 -21
  72. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts +4 -14
  73. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
  74. package/lib/types/components/workspaces/HomeWorkspaceRow.js +26 -17
  75. package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
  76. package/lib/types/dsh-adapter/backend/session.js +12 -0
  77. package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
  78. package/lib/types/dsh-adapter/backend/translate.js +6 -1
  79. package/lib/types/dsh-adapter/channel/attached-context.d.ts +15 -2
  80. package/lib/types/dsh-adapter/channel/attached-context.d.ts.map +1 -1
  81. package/lib/types/dsh-adapter/channel/attached-context.js +26 -3
  82. package/lib/types/dsh-adapter/channel/binding-events.d.ts +3 -0
  83. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  84. package/lib/types/dsh-adapter/channel/binding-events.js +43 -2
  85. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +2 -6
  86. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
  87. package/lib/types/dsh-adapter/channel/context-bookkeeping.js +7 -1
  88. package/lib/types/dsh-adapter/channel/core/compose.d.ts +2 -6
  89. package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
  90. package/lib/types/dsh-adapter/channel/core/compose.js +1 -1
  91. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
  92. package/lib/types/dsh-adapter/channel/core/local-actions.js +3 -26
  93. package/lib/types/dsh-adapter/channel/emitter.js +1 -1
  94. package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
  95. package/lib/types/dsh-adapter/channel/extensions.js +8 -0
  96. package/lib/types/dsh-adapter/channel/input-actions.d.ts +2 -2
  97. package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
  98. package/lib/types/dsh-adapter/channel/input-actions.js +34 -10
  99. package/lib/types/dsh-adapter/channel/input-delivery.d.ts +3 -7
  100. package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
  101. package/lib/types/dsh-adapter/channel/input-delivery.js +14 -5
  102. package/lib/types/dsh-adapter/channel/model-actions.d.ts +4 -1
  103. package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
  104. package/lib/types/dsh-adapter/channel/model-actions.js +26 -9
  105. package/lib/types/dsh-adapter/channel/model-selection.d.ts +27 -2
  106. package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
  107. package/lib/types/dsh-adapter/channel/model-selection.js +81 -37
  108. package/lib/types/dsh-adapter/channel/model-switch.d.ts +1 -1
  109. package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
  110. package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
  111. package/lib/types/dsh-adapter/channel/session-rewind.js +6 -2
  112. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
  113. package/lib/types/dsh-adapter/channel/session-tree-actions.js +8 -4
  114. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  115. package/lib/types/dsh-adapter/channel/settings-host.js +6 -3
  116. package/lib/types/dsh-adapter/channel/transcript.d.ts +3 -2
  117. package/lib/types/dsh-adapter/channel/transcript.d.ts.map +1 -1
  118. package/lib/types/dsh-adapter/channel/transcript.js +13 -4
  119. package/lib/types/dsh-adapter/channel/types.d.ts +11 -2
  120. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  121. package/lib/types/dsh-adapter/contract.d.ts +26 -3
  122. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  123. package/lib/types/dsh-adapter/contract.js +44 -5
  124. package/lib/types/dsh-adapter/fresh-agent.d.ts +1 -1
  125. package/lib/types/dsh-adapter/fresh-agent.d.ts.map +1 -1
  126. package/lib/types/dsh-adapter/fresh-agent.js +60 -11
  127. package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
  128. package/lib/types/dsh-adapter/host-access.js +60 -11
  129. package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
  130. package/lib/types/dsh-adapter/host-contract.d.ts.map +1 -1
  131. package/lib/types/dsh-adapter/host-contract.js +4 -2
  132. package/lib/types/dsh-adapter/host-dsh.d.ts +0 -8
  133. package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
  134. package/lib/types/dsh-adapter/host-dsh.js +27 -6
  135. package/lib/types/dsh-adapter/host-entry.js +4 -0
  136. package/lib/types/dsh-adapter/oauth/profiles.d.ts.map +1 -1
  137. package/lib/types/dsh-adapter/oauth/profiles.js +14 -1
  138. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  139. package/lib/types/dsh-adapter/plugin.js +143 -44
  140. package/lib/types/dsh-adapter/presets.d.ts +38 -11
  141. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  142. package/lib/types/dsh-adapter/presets.js +46 -17
  143. package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
  144. package/lib/types/dsh-adapter/process-exit.js +1 -1
  145. package/lib/types/dsh-adapter/questions.d.ts +3 -4
  146. package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
  147. package/lib/types/dsh-adapter/questions.js +1 -1
  148. package/lib/types/dsh-adapter/session-list-metadata.js +2 -2
  149. package/lib/types/dsh-adapter/subagents.d.ts +5 -0
  150. package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
  151. package/lib/types/dsh-adapter/subagents.js +22 -1
  152. package/lib/types/dsh-adapter/team-mode.d.ts +17 -10
  153. package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
  154. package/lib/types/dsh-adapter/team-mode.js +19 -12
  155. package/lib/types/dsh-adapter/tool-scope.d.ts +24 -0
  156. package/lib/types/dsh-adapter/tool-scope.d.ts.map +1 -0
  157. package/lib/types/dsh-adapter/tool-scope.js +127 -0
  158. package/lib/types/dsh-adapter/types.d.ts +2 -1
  159. package/lib/types/dsh-adapter/types.d.ts.map +1 -1
  160. package/lib/types/heldInputs.d.ts +55 -16
  161. package/lib/types/heldInputs.d.ts.map +1 -1
  162. package/lib/types/heldInputs.js +277 -41
  163. package/lib/types/i18n.d.ts +227 -11
  164. package/lib/types/i18n.d.ts.map +1 -1
  165. package/lib/types/i18n.js +60 -5
  166. package/lib/types/ink/components/App.d.ts +2 -0
  167. package/lib/types/ink/components/App.d.ts.map +1 -1
  168. package/lib/types/ink/components/App.js +8 -0
  169. package/lib/types/ink/events/input-event.d.ts.map +1 -1
  170. package/lib/types/ink/events/input-event.js +7 -6
  171. package/lib/types/ink/hit-test.d.ts +2 -0
  172. package/lib/types/ink/hit-test.d.ts.map +1 -1
  173. package/lib/types/ink/hit-test.js +10 -0
  174. package/lib/types/ink/hooks/use-program-status.d.ts +1 -1
  175. package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -1
  176. package/lib/types/ink/hooks/use-program-status.js +3 -2
  177. package/lib/types/ink/ink.d.ts +1 -0
  178. package/lib/types/ink/ink.d.ts.map +1 -1
  179. package/lib/types/ink/ink.js +5 -2
  180. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  181. package/lib/types/ink/parse-keypress.js +25 -0
  182. package/lib/types/ink/terminal.d.ts +13 -2
  183. package/lib/types/ink/terminal.d.ts.map +1 -1
  184. package/lib/types/ink/terminal.js +29 -5
  185. package/lib/types/screens/Chat.d.ts.map +1 -1
  186. package/lib/types/screens/Chat.js +43 -2
  187. package/lib/types/screens/SessionSupervisor.d.ts +3 -6
  188. package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
  189. package/lib/types/screens/SessionSupervisor.js +5 -8
  190. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts +1 -2
  191. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
  192. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +2 -2
  193. package/lib/types/screens/sessionSupervisor/model.d.ts +1 -1
  194. package/lib/types/screens/sessionSupervisor/model.js +1 -1
  195. package/lib/types/sessionMounts.d.ts +12 -5
  196. package/lib/types/sessionMounts.d.ts.map +1 -1
  197. package/lib/types/sessionMounts.js +33 -6
  198. package/lib/types/update.d.ts +412 -20
  199. package/lib/types/update.d.ts.map +1 -1
  200. package/lib/types/update.js +2094 -193
  201. package/lib/types/updateHost.d.ts +198 -0
  202. package/lib/types/updateHost.d.ts.map +1 -0
  203. package/lib/types/updateHost.js +608 -0
  204. package/lib/types/utils/processName.d.ts +16 -0
  205. package/lib/types/utils/processName.d.ts.map +1 -0
  206. package/lib/types/utils/processName.js +27 -0
  207. package/package.json +111 -108
  208. package/tui-profile/feed/README.md +1 -1
  209. package/tui-profile/feed/first-party.json +1 -1
@@ -1,9 +1,23 @@
1
1
  /** Primary validated upstream line (newest). */
2
- export declare const UPSTREAM_VALIDATED_VERSION = "0.2.1-rc.5";
2
+ export declare const UPSTREAM_VALIDATED_VERSION = "0.2.2-rc.1";
3
+ /**
4
+ * The host CLI package whose installation `/update` aligns with the TUI.
5
+ * Re-exported here (the literal stays in host-contract.ts) so engine planning
6
+ * can name it without importing the host-only module.
7
+ */
8
+ export declare const UPSTREAM_HOST_PACKAGE = "@deepseek-ai/dsh";
9
+ /**
10
+ * The host-side peer whose enumerated range defines the engine line a TUI
11
+ * release validates (`@deepseek-ai/dsh-app-boot`, lockstep with the CLI).
12
+ * Derived from the host contract: the literal lives only in host-contract.ts.
13
+ */
14
+ export declare const UPSTREAM_HOST_PEER_PACKAGE: "@deepseek-ai/dsh-app-boot";
3
15
  /**
4
16
  * Explicitly supported upstream prerelease lines, oldest first.
5
17
  *
6
- * 0.2.1-rc.5 = primary continuous-CI line; 0.2.1-rc.4/rc.3/rc.2 = earlier
18
+ * 0.2.2-rc.1 = primary continuous-CI line (the model-selection projection,
19
+ * Agent.model seam and PromptPresentation split land here); 0.2.1-rc.5 =
20
+ * previous family still source-checked where CI covers it; 0.2.1-rc.4/rc.3/rc.2 = earlier
7
21
  * prereleases of the same family (published code compared with the primary);
8
22
  * 0.2.0-rc.2/rc.1 = previous family (mapped compatibility);
9
23
  * 0.1.7-rc.2/rc.1 = previous family (mapped compatibility);
@@ -19,7 +33,7 @@ export declare const UPSTREAM_VALIDATED_VERSION = "0.2.1-rc.5";
19
33
  * The peer range in package.json is deliberately wider than this list: an
20
34
  * install on an older or newer line is allowed but reports drift at boot.
21
35
  */
22
- 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", "0.1.7-rc.2", "0.2.0-rc.1", "0.2.0-rc.2", "0.2.1-rc.2", "0.2.1-rc.3", "0.2.1-rc.4", "0.2.1-rc.5"];
36
+ 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", "0.1.7-rc.2", "0.2.0-rc.1", "0.2.0-rc.2", "0.2.1-rc.2", "0.2.1-rc.3", "0.2.1-rc.4", "0.2.1-rc.5", "0.2.2-rc.1"];
23
37
  /**
24
38
  * Framework packages version on their own lines; the contract validates
25
39
  * their MAJOR (breaking surface), not the harness prerelease number.
@@ -65,6 +79,15 @@ export declare function installedUpstreamVersion(packageName: string): UpstreamV
65
79
  * 两级都读不到 → undefined(调用方只画 TUI 版本,不编造)。
66
80
  */
67
81
  export declare function installedKernelVersion(): string | undefined;
82
+ /**
83
+ * 已装宿主(`@deepseek-ai/dsh`)包的真实目录;源码 checkout(宿主不是本包
84
+ * 依赖)下为 undefined。
85
+ *
86
+ * `/update` 用它定位「这次该往哪个全局前缀里装引擎」:profile 副本的
87
+ * `node_modules/@deepseek-ai/dsh` 是指向全局安装的模块回退链接,realpath 后
88
+ * 就是布局判定的输入(`src/updateHost.ts` 的 `detectHostInstall`)。
89
+ */
90
+ export declare function installedKernelPackageDir(): string | undefined;
68
91
  /**
69
92
  * Whether the installed version of `packageName` is at or beyond `minimum`
70
93
  * (a literal like `'0.1.0-rc.8'`). Unparseable or older installs return
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/contract.ts"],"names":[],"mappings":"AAmBA,gDAAgD;AAChD,eAAO,MAAM,0BAA0B,eAAe,CAAA;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,2BAA2B,mUAsB9B,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG5D,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,yBAAyB,wsCAuC5B,CAAA;AAEV,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,SAAS,EAAE,MAAM,CAAA;CAClB;AAoBD,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;A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AAM,GAAG,SAAS,CAAC,CAqB9E;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAE9F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,SAAS,CAQ3D;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,SAAS,CAM9D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAKnF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,iBAAiB,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAA+B,GAC5F,MAAM,EAAE,CAQV;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,iBAAiB,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAA+B,GAC5F,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.2.1-rc.5) plus older lines kept in backward
5
+ * current primary (0.2.2-rc.1) plus older lines kept in backward
6
6
  * compatibility across the 0.2.0, 0.1.7, 0.1.5, 0.1.3, 0.1.2, 0.1.1 and 0.1.0
7
7
  * release families.
8
8
  * Every official package this adapter touches is blessed here; anything
@@ -13,15 +13,37 @@
13
13
  * `upstreamDriftSummary()` collapses the per-package entries into the
14
14
  * single natural-language boot notice the logo header shows (see LogoV2).
15
15
  */
16
- import { readFileSync } from 'node:fs';
16
+ import { readFileSync, realpathSync } from 'node:fs';
17
+ import { dirname } from 'node:path';
17
18
  import { fileURLToPath } from 'node:url';
18
- import { ADAPTER_TYPE_PACKAGES, HOST_TYPE_PACKAGES } from './host-contract.js';
19
+ import { ADAPTER_TYPE_PACKAGES, HOST_MODULES, HOST_PACKAGE, HOST_TYPE_PACKAGES } from './host-contract.js';
19
20
  /** Primary validated upstream line (newest). */
20
- export const UPSTREAM_VALIDATED_VERSION = '0.2.1-rc.5';
21
+ export const UPSTREAM_VALIDATED_VERSION = '0.2.2-rc.1';
22
+ /**
23
+ * The host CLI package whose installation `/update` aligns with the TUI.
24
+ * Re-exported here (the literal stays in host-contract.ts) so engine planning
25
+ * can name it without importing the host-only module.
26
+ */
27
+ export const UPSTREAM_HOST_PACKAGE = HOST_PACKAGE;
28
+ const APP_BOOT_MODULE = HOST_MODULES.find(module => module.key === 'appBoot');
29
+ if (APP_BOOT_MODULE === undefined) {
30
+ // A broken host contract is a build-time fault, not a runtime state: the
31
+ // gate (verify:contract) fails on the same edit. Name it instead of letting
32
+ // a bare TypeError crash every boot.
33
+ throw new Error('host contract: HOST_MODULES has no appBoot entry (run pnpm verify:contract)');
34
+ }
35
+ /**
36
+ * The host-side peer whose enumerated range defines the engine line a TUI
37
+ * release validates (`@deepseek-ai/dsh-app-boot`, lockstep with the CLI).
38
+ * Derived from the host contract: the literal lives only in host-contract.ts.
39
+ */
40
+ export const UPSTREAM_HOST_PEER_PACKAGE = APP_BOOT_MODULE.specifier;
21
41
  /**
22
42
  * Explicitly supported upstream prerelease lines, oldest first.
23
43
  *
24
- * 0.2.1-rc.5 = primary continuous-CI line; 0.2.1-rc.4/rc.3/rc.2 = earlier
44
+ * 0.2.2-rc.1 = primary continuous-CI line (the model-selection projection,
45
+ * Agent.model seam and PromptPresentation split land here); 0.2.1-rc.5 =
46
+ * previous family still source-checked where CI covers it; 0.2.1-rc.4/rc.3/rc.2 = earlier
25
47
  * prereleases of the same family (published code compared with the primary);
26
48
  * 0.2.0-rc.2/rc.1 = previous family (mapped compatibility);
27
49
  * 0.1.7-rc.2/rc.1 = previous family (mapped compatibility);
@@ -59,6 +81,7 @@ export const UPSTREAM_VALIDATED_VERSIONS = [
59
81
  '0.2.1-rc.3',
60
82
  '0.2.1-rc.4',
61
83
  '0.2.1-rc.5',
84
+ '0.2.2-rc.1',
62
85
  ];
63
86
  /**
64
87
  * Framework packages version on their own lines; the contract validates
@@ -230,6 +253,22 @@ export function installedKernelVersion() {
230
253
  }
231
254
  return installedUpstreamVersions()['@deepseek-ai/dsh-agent'];
232
255
  }
256
+ /**
257
+ * 已装宿主(`@deepseek-ai/dsh`)包的真实目录;源码 checkout(宿主不是本包
258
+ * 依赖)下为 undefined。
259
+ *
260
+ * `/update` 用它定位「这次该往哪个全局前缀里装引擎」:profile 副本的
261
+ * `node_modules/@deepseek-ai/dsh` 是指向全局安装的模块回退链接,realpath 后
262
+ * 就是布局判定的输入(`src/updateHost.ts` 的 `detectHostInstall`)。
263
+ */
264
+ export function installedKernelPackageDir() {
265
+ try {
266
+ return realpathSync(dirname(fileURLToPath(import.meta.resolve('@deepseek-ai/dsh/package.json'))));
267
+ }
268
+ catch {
269
+ return undefined;
270
+ }
271
+ }
233
272
  /**
234
273
  * Whether the installed version of `packageName` is at or beyond `minimum`
235
274
  * (a literal like `'0.1.0-rc.8'`). Unparseable or older installs return
@@ -4,7 +4,7 @@ import type { Session, SessionEvent } from '@deepseek-ai/dsh-session';
4
4
  type AgentCreator = {
5
5
  create(options: CreateAgentOptions): Promise<AgentHandle>;
6
6
  };
7
- /** Policy facts held in memory until the session has further activity. */
7
+ /** Policy and model-route facts held until the session has further activity. */
8
8
  export declare const INITIAL_POLICY_EVENTS: ReadonlySet<string>;
9
9
  /** Source-less legacy messages and explicit user messages count as human input. */
10
10
  export declare function isHumanSource(source: unknown): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"fresh-agent.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/fresh-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAc,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AACzF,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAiB,MAAM,0BAA0B,CAAA;AAkBpF,KAAK,YAAY,GAAG;IAAE,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAAE,CAAA;AAyCjF,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAkF,CAAA;AAKxI,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAItD;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAWlE;AAID,2EAA2E;AAC3E,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAE5E;AA4FD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAsB5H"}
1
+ {"version":3,"file":"fresh-agent.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/fresh-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAc,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AACzF,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAiB,MAAM,0BAA0B,CAAA;AAkBpF,KAAK,YAAY,GAAG;IAAE,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAAE,CAAA;AAmFjF,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAqG,CAAA;AAK3J,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAItD;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAWlE;AAID,2EAA2E;AAC3E,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAE5E;AA4FD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CA8B5H"}
@@ -38,8 +38,44 @@ function captureWriter(source, id, receive) {
38
38
  capture.restore();
39
39
  };
40
40
  }
41
- /** Policy facts held in memory until the session has further activity. */
42
- export const INITIAL_POLICY_EVENTS = new Set(['permission/preset', 'sandbox/mode', 'approval/policy', 'plan/mode']);
41
+ const entryCaptures = new WeakMap();
42
+ /** Install the filter before newer stores snapshot it into their event carrier. */
43
+ function captureSessionEntry(store, id, receive) {
44
+ let capture = entryCaptures.get(store);
45
+ if (capture === undefined) {
46
+ const descriptor = Object.getOwnPropertyDescriptor(store, 'enter');
47
+ const enter = store.enter;
48
+ const receivers = new Map();
49
+ const tapped = function (session) {
50
+ receivers.get(String(session.id))?.(this.ctx, session);
51
+ return enter.call(this, session);
52
+ };
53
+ store.enter = tapped;
54
+ capture = {
55
+ receivers,
56
+ restore() {
57
+ if (store.enter === tapped) {
58
+ if (descriptor === undefined)
59
+ delete store.enter;
60
+ else
61
+ Object.defineProperty(store, 'enter', descriptor);
62
+ }
63
+ entryCaptures.delete(store);
64
+ },
65
+ };
66
+ entryCaptures.set(store, capture);
67
+ }
68
+ if (capture.receivers.has(id))
69
+ throw new Error(`dsh-tui: fresh session "${id}" is already entering the store`);
70
+ capture.receivers.set(id, receive);
71
+ return () => {
72
+ capture.receivers.delete(id);
73
+ if (capture.receivers.size === 0)
74
+ capture.restore();
75
+ };
76
+ }
77
+ /** Policy and model-route facts held until the session has further activity. */
78
+ export const INITIAL_POLICY_EVENTS = new Set(['permission/preset', 'sandbox/mode', 'approval/policy', 'plan/mode', 'model/selection']);
43
79
  /** The command envelope a session-policy switch runs through. */
44
80
  const POLICY_ACTIVITY_EVENTS = new Set(['command/run', 'command/done']);
45
81
  /** Source-less legacy messages and explicit user messages count as human input. */
@@ -202,25 +238,38 @@ export async function createFreshAgent(ctx, agents, options) {
202
238
  return agents.create(options);
203
239
  const source = concreteService(service);
204
240
  let writer;
241
+ let deferred = false;
242
+ const defer = (owner, session) => {
243
+ if (deferred || writer === undefined || session.seq !== 0)
244
+ return;
245
+ deferInitialPolicy(owner, session, writer, source);
246
+ deferred = true;
247
+ };
205
248
  const stopCapture = captureWriter(source, String(options.sessionId), value => { writer = value; });
249
+ let stopEntry = () => { };
206
250
  const setup = async (agentCtx, agent) => {
207
251
  const commit = await options.setup?.(agentCtx, agent);
208
- const defer = () => {
209
- if (writer !== undefined)
210
- deferInitialPolicy(agentCtx, agent.session, writer, source);
211
- };
212
252
  if (commit === undefined) {
213
- defer();
253
+ defer(agentCtx, agent.session);
214
254
  return;
215
255
  }
216
- // Setup history belongs to the factory's pre-publication append. Install
217
- // the gate only after the original commit has finished composing it.
218
- return { commit() { commit.commit(); defer(); } };
256
+ // Older stores do not capture a carrier at entry; retain their original
257
+ // post-commit fallback. New stores already own the gate before setup.
258
+ return { commit() { commit.commit(); defer(agentCtx, agent.session); } };
219
259
  };
220
260
  try {
261
+ const sessions = ctx.get('sessions');
262
+ if (typeof sessions?.enter === 'function') {
263
+ stopEntry = captureSessionEntry(concreteService(sessions), String(options.sessionId), defer);
264
+ }
221
265
  return await agents.create({ ...options, setup });
222
266
  }
223
267
  finally {
224
- stopCapture();
268
+ try {
269
+ stopEntry();
270
+ }
271
+ finally {
272
+ stopCapture();
273
+ }
225
274
  }
226
275
  }
@@ -1 +1 @@
1
- {"version":3,"file":"host-access.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/host-access.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAS,MAAM,qBAAqB,CAAA;AAmLpD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,IAAI,CAKlE;AAWD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE1D;AAkID;;uEAEuE;AACvE,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAE9D;AAED;;8EAE8E;AAC9E,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAEzD;AAmOD,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAe/D;AAED;0EAC0E;AAC1E,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,MAAM,OAAO,EACvB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,OAAO,KAAK,IAAI,GAC9C,OAAO,CA2BT;AAED,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAMhE;AAED;+EAC+E;AAC/E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAInE;AAED;;;6EAG6E;AAC7E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ED,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAMhE;AAED;+EAC+E;AAC/E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAInE;AAED;;;6EAG6E;AAC7E,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIrD;AAiHD;;;4EAG4E;AAC5E,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAO3E;AAED;;;iEAGiE;AACjE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAehH;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAmBlG"}
@@ -468,9 +468,9 @@ const projectionRegistryRoots = new WeakSet();
468
468
  const guardedProjectionRegistries = new WeakSet();
469
469
  /**
470
470
  * `sessionProjections.register` hangs its disposer on the receiver's context
471
- * (the registry's documented ownership: the calling fiber). DSH's agent-team
472
- * service reaches it through `ctx.root`, which lands that effect on the root
473
- * fiber and the guard above refuses it. Admit that one call with host
471
+ * (the registry's documented ownership: the calling fiber). Legacy DSH's
472
+ * agent-team service reaches it through `ctx.root`, which lands that effect on
473
+ * the root fiber and the guard above refuses it. Admit that one call with host
474
474
  * capability, so the registration sits where it would without the guard and
475
475
  * the caller's disposer releases it in the caller's own order; the plugin's
476
476
  * unload releases one it leaves behind ({@link releaseAfterUnload}). The
@@ -514,8 +514,8 @@ function admitRootProjectionRegistrations(root) {
514
514
  // disposer itself (DSH's TeamService unregisters after its async
515
515
  // runtime teardown, which still reads the key). On the caller's fiber
516
516
  // it would be a sibling effect, and Cordis unloads siblings at once.
517
- const dispose = withHostRootCapability(() => Reflect.apply(original, this, args));
518
- return releaseAfterUnload(root, token.fiber, dispose);
517
+ const registration = withHostRootCapability(() => Reflect.apply(original, this, args));
518
+ return releaseAfterUnload(root, token.fiber, registration);
519
519
  },
520
520
  });
521
521
  });
@@ -536,27 +536,76 @@ function admitRootProjectionRegistrations(root) {
536
536
  * still dies with that plugin: if the plugin never disposes it, it goes once
537
537
  * the plugin's fiber has finished unloading (every effect settled, async
538
538
  * teardown included), whether the fiber reloads or not.
539
- * @returns the disposer handed to the plugin; calling it also drops the watch.
539
+ * Preserve the registration's await result too: old Cordis effects yield an
540
+ * async disposer, while 0.2.2 projections yield a retained reader handle.
541
+ * @returns the callable registration; every disposal face drops the watch.
540
542
  */
541
543
  function releaseAfterUnload(root, fiber, dispose) {
542
544
  let unwatch;
545
+ let released = false;
546
+ let disposal;
543
547
  const release = () => {
544
- unwatch?.();
545
- unwatch = undefined;
546
- dispose();
548
+ if (released)
549
+ return disposal;
550
+ released = true;
551
+ return disposal = withHostRootCapability(() => {
552
+ unwatch?.();
553
+ unwatch = undefined;
554
+ return dispose();
555
+ });
547
556
  };
548
557
  try {
549
558
  unwatch = withHostRootCapability(() => root.on('internal/status', (changed, oldState) => {
550
559
  // Cordis uses 5 for UNLOADING (see rememberFiber). The event carries
551
560
  // either the activation's fiber or the wrapper normalized to it.
552
- if (oldState === 5 && (changed === fiber || rememberFiber(changed, root) === fiber))
561
+ const subject = changed === fiber || rememberFiber(changed, root) === fiber
562
+ ? changed
563
+ : undefined;
564
+ if (subject === undefined)
565
+ return;
566
+ // Up to Cordis 4.0.5 the settle transition (5 → disposed/loading) reached
567
+ // root listeners, so the state alone timed the release.
568
+ if (oldState === 5) {
553
569
  release();
570
+ return;
571
+ }
572
+ // 4.1 drops that emission once the fiber's context is gone; entering
573
+ // UNLOADING still arrives, so follow the transition promise it publishes
574
+ // instead — releasing after the plugin's async teardown, never before.
575
+ if (oldState === 2 && subject.state === 5) {
576
+ const inertia = subject.inertia;
577
+ if (inertia === undefined)
578
+ release();
579
+ else
580
+ void inertia.then(release, release);
581
+ }
554
582
  }, { global: true }));
555
583
  }
556
584
  catch {
557
585
  // Without the event helper only the plugin's own disposer releases it.
558
586
  }
559
- return release;
587
+ if (typeof dispose.then !== 'function')
588
+ return release;
589
+ // Observe lazily so callers that keep the deprecated synchronous disposer
590
+ // retain the registry's own unobserved-readiness error reporting.
591
+ let ready;
592
+ const whenReady = () => ready ??= Promise.resolve(dispose).then(value => {
593
+ if (typeof value === 'function')
594
+ return async () => { await release(); };
595
+ if (value !== null && typeof value === 'object' && typeof Reflect.get(value, 'dispose') === 'function') {
596
+ return { ...value, dispose: async () => { await release(); } };
597
+ }
598
+ return value;
599
+ }, error => {
600
+ release();
601
+ throw error;
602
+ });
603
+ return Object.assign(release, {
604
+ then: (resolve, reject) => whenReady().then(resolve, reject),
605
+ catch: (reject) => whenReady().catch(reject),
606
+ finally: (done) => whenReady().finally(done),
607
+ [Symbol.toStringTag]: 'Promise',
608
+ });
560
609
  }
561
610
  function guardFiberMethod(target, method, root, capability) {
562
611
  const descriptor = Reflect.getOwnPropertyDescriptor(target, method);
@@ -7,7 +7,7 @@
7
7
  /** The host CLI package whose installation the entry loads. */
8
8
  export declare const HOST_PACKAGE = "@deepseek-ai/dsh";
9
9
  /** The host line the reproduced pieces were checked against (host-replica.snapshot.json). */
10
- export declare const HOST_REPLICA_VERSION = "0.2.1-rc.5";
10
+ export declare const HOST_REPLICA_VERSION = "0.2.2-rc.1";
11
11
  /** Where the entry resolves a host module from. */
12
12
  export type HostModuleVia =
13
13
  /** The host package's own `createRequire` (its nested node_modules). */
@@ -1 +1 @@
1
- {"version":3,"file":"host-contract.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/host-contract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,YAAY,qBAAqB,CAAA;AAE9C,6FAA6F;AAC7F,eAAO,MAAM,oB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The host CLI package whose installation the entry loads. */
8
8
  export const HOST_PACKAGE = '@deepseek-ai/dsh';
9
9
  /** The host line the reproduced pieces were checked against (host-replica.snapshot.json). */
10
- export const HOST_REPLICA_VERSION = '0.2.1-rc.5';
10
+ export const HOST_REPLICA_VERSION = '0.2.2-rc.1';
11
11
  /** The host modules the entry loads, all from one installation, in load order. */
12
12
  export const HOST_MODULES = [
13
13
  { key: 'cordis', specifier: '@deepseek-ai/cordis', via: 'host', exports: ['Context'] },
@@ -58,7 +58,7 @@ export const HOST_REPLICAS = [
58
58
  { id: 'app-ready', package: HOST_PACKAGE, symbol: 'createAppReady', kind: 'function', local: 'createAppReady' },
59
59
  { id: 'compose-profile', package: HOST_PACKAGE, symbol: 'composeProfile', kind: 'function', local: 'prepareHostRoot steps 1–2 (no overlays, no resolvedProfile)' },
60
60
  { id: 'run-profile', package: HOST_PACKAGE, symbol: 'runProfile', kind: 'function', local: 'prepareHostRoot (PluginPackages), HostRoot.selectKernel (proxy, fail-loud, profileContext, launch environment, provideCmdline) and HostRoot.compose\'s appReady.commit' },
61
- { id: 'boot', package: '@deepseek-ai/dsh-app-boot', symbol: 'boot', kind: 'function', local: 'prepareHostRoot step 4 (baseUrl, dshHomePath, internal/update, Loader) and HostRoot.compose (startup-log exporter, mountRootInclude, loader.await, auditStartupEntries, StartupError.startup)' },
61
+ { id: 'boot', package: '@deepseek-ai/dsh-app-boot', symbol: 'boot', kind: 'function', local: 'prepareHostRoot step 4 (baseUrl, dshHomePath, Loader — the pre-0.2.2 internal/update hook is version-gated) and HostRoot.compose (startup-log exporter, mountRootInclude, loader.await, auditStartupEntries, StartupError.startup)' },
62
62
  { id: 'startup-report', package: HOST_PACKAGE, symbol: 'reportStartupFailure', kind: 'function', local: 'writeStartupReport: the file half' },
63
63
  { id: 'run-cli', package: HOST_PACKAGE, symbol: 'runCli', kind: 'function', local: 'prepareHostRoot\'s loadLayeredEnv call before the profile; the StartupError-only report' },
64
64
  ];
@@ -67,11 +67,13 @@ export const HOST_DEVIATIONS = [
67
67
  { id: 'no-interrupt', what: 'runProfile\'s SIGTERM/SIGINT handlers and createProcessShutdown().interrupt are not reproduced: the entry owns SIGTERM/SIGHUP/SIGINT (process-exit.ts installEntrySignals) and ends by the signal after the TUI\'s exit funnel, where interrupt exits 0 (TERM) / 130 (INT) — the launcher reads a numeric 130 as a crash (verify-entry-process-exit)' },
68
68
  { id: 'exit-seam', what: 'ctx.appExit (provideCmdline exit) goes to the TUI\'s exit funnel through ProcessExitSeam first, and to the reproduced shutdown only when the funnel refuses (prepareHostRoot exitSeam)' },
69
69
  { id: 'fail-loud-removable', what: 'installFailLoud\'s uninstaller is kept and called once apply() returned and processGuardActive() (host-entry.ts): from then on the TUI\'s process guard is the single owner of a fatal error; DSH_TUI_NO_185_PROCESS_GUARD=1 keeps fail-loud (verify-entry-process-exit)' },
70
+ { id: 'no-startup-composition', what: 'boot\'s 0.2.2 captureStartupComposition (StartupError.composition) is not reproduced: the capture is not exported and runs before teardown, which only boot owns. The entry composes the profile itself and writes its own startup report instead (verify-host-contract pins the fingerprint; re-check this deviation when the symbol changes)' },
70
71
  { id: 'startup-report-always', what: 'bin.js saves a report for a StartupError only and lets other startup errors crash; the entry saves one for every composition failure (HostComposeError carries the path) because the screen stays up' },
71
72
  { id: 'startup-report-no-terminal', what: 'reportStartupFailure\'s terminal half is not reproduced: the screen is up, the failure row names the report' },
72
73
  { id: 'no-overlays', what: '--patch overlays, --from-default-profile and resolvedProfile are not reproduced (the launcher passes none)' },
73
74
  { id: 'defer-root-guard', what: 'deferRootCapabilityGuard(root) (host-access.ts) keeps the TUI\'s root-capability guard off from the entry\'s binding of the root through the screen\'s mount; armRootCapabilityGuard then lets the first TUI row activation install it, as on the profile path, and the composition\'s settling installs it if no TUI row activated. Installing the guard also materializes the root-owned `invocation` accessor dsh-typert-protocol otherwise registers from the first Remote service, so a dsh-base row that resumes after the first TUI row (issue #1616) still activates; the guard itself is unchanged (verify-plugin-lifecycle)' },
74
75
  { id: 'report-exclude-network', what: 'host-entry.ts sets process.report.excludeNetwork = true for the process: DSH\'s flock libc probe (process.report.getReport) otherwise blocked ~10s on reverse lookups of sockets the mounted screen already opened' },
76
+ { id: 'process-name', what: 'host-entry.ts names the process dsh-tui right after start (#1831) by writing /proc/self/comm on Linux: Node leaves the thread group leader as "MainThread", which is what ps -o comm, top and desktop process monitors show, while `dsh --profile` keeps the inherited name; argv is left alone, so cmdline still names the entry script (verify-entry-process-exit)' },
75
77
  { id: 'hijack-before-tui', what: 'the host\'s PluginPackages resolution is installed before any TUI module loads, for both kernels; runProfile installs it inside boot()\'s prepare' },
76
78
  { id: 'kernel-after-discovery', what: 'prepareHostRoot first supplies only the neutral Loader/resolution root; after backend assembly, HostRoot.selectKernel prepares DSH-only proxy, failure handlers and services from the same final kernel the entry uses for its slot and composition' },
77
79
  ];
@@ -93,14 +93,6 @@ export interface PrepareHostRootOptions {
93
93
  /** Routes `ctx.appExit(code)` to the TUI's exit funnel; the bounded `shutdown` when unfilled or refused. */
94
94
  readonly exitSeam?: ProcessExitSeam;
95
95
  }
96
- /**
97
- * Build the entry's root from the host's `cordis` and install the host's
98
- * module resolution on it before any TUI module is imported, so the TUI and
99
- * the DSH plugins resolve shared packages (react, schemastery, the
100
- * `@deepseek-ai/*` peers) the same way. Both kernels: otherwise the peers
101
- * resolve only through `$DSH_HOME/profiles/node_modules`, which a fresh
102
- * install may not have. The DSH kernel also gets the rest of `runProfile`'s prepare.
103
- */
104
96
  export declare function prepareHostRoot(host: HostDsh, options: PrepareHostRootOptions): Promise<HostRoot>;
105
97
  /** A composition failure, with the startup report saved for it. */
106
98
  export declare class HostComposeError extends Error {
@@ -1 +1 @@
1
- {"version":3,"file":"host-dsh.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/host-dsh.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,KAAK,OAAO,MAAM,2BAA2B,CAA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,QAAQ;IACvB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;IACrB;;;;OAIG;IACH,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACzC;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5D;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,EAAE,MAAM,IAAI,CAAA;IACtC,uEAAuE;IACvE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,4GAA4G;IAC5G,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;CACpC;AAuBD,wBAAsB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkJvG;AAED,mEAAmE;AACnE,qBAAa,gBAAiB,SAAQ,KAAK;IAE7B,QAAQ,CAAC,QAAQ,EAAE,OAAO;IADtC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;gBACf,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS;CAKpE"}
@@ -12,6 +12,7 @@ import { createRequire } from 'node:module';
12
12
  import { basename, delimiter, dirname, join, posix, win32 } from 'node:path';
13
13
  import { pathToFileURL } from 'node:url';
14
14
  import { inspect } from 'node:util';
15
+ import { compareVersions, parseUpstreamVersion } from './contract.js';
15
16
  import { HOST_MODULES, HOST_PACKAGE } from './host-contract.js';
16
17
  import { LITE_PROFILE_EXCLUDED_BUNDLES, liteProfilePlan } from './lite-profile.js';
17
18
  import { PROCESS_SHUTDOWN_TIMEOUT_MS } from './process-exit.js';
@@ -221,6 +222,19 @@ export async function loadHostDsh(packageDir = undefined) {
221
222
  * resolve only through `$DSH_HOME/profiles/node_modules`, which a fresh
222
223
  * install may not have. The DSH kernel also gets the rest of `runProfile`'s prepare.
223
224
  */
225
+ /** Whether the loaded kernel predates `minimum` (unparseable counts as current). */
226
+ function kernelBefore(host, minimum) {
227
+ let version;
228
+ try {
229
+ version = host.appBoot.getDshRuntimeVersion();
230
+ }
231
+ catch {
232
+ version = undefined;
233
+ }
234
+ const installed = parseUpstreamVersion(version);
235
+ const floor = parseUpstreamVersion(minimum);
236
+ return installed !== undefined && floor !== undefined && compareVersions(installed, floor) < 0;
237
+ }
224
238
  export async function prepareHostRoot(host, options) {
225
239
  const { appBoot, profileBoot } = host;
226
240
  // bin.js: the `.env` layers fill unset variables before anything reads them
@@ -235,9 +249,16 @@ export async function prepareHostRoot(host, options) {
235
249
  const ctx = new host.Context();
236
250
  ctx.baseUrl = pathToFileURL(dirname(rootConfig)).href + '/';
237
251
  ctx.provide('dshHomePath', host.homePaths.dshHomePath);
238
- ctx.on('internal/update', ((_config, _noSave, next) => {
239
- Promise.resolve(next()).catch((error) => { ctx.logger.error(error); });
240
- }), { global: true, prepend: true });
252
+ // `boot` registered this hook until 0.2.1: a live profile reload's failures
253
+ // were swallowed instead of escaping into the TUI. 0.2.2 dropped it when the
254
+ // waterfall became `(resolvedConfig, next)` and started awaiting the restart
255
+ // itself; registering the old three-argument handler there would pass `next`
256
+ // as `noSave` and leave the restart unawaited.
257
+ if (kernelBefore(host, '0.2.2-rc.1')) {
258
+ ctx.on('internal/update', ((_config, _noSave, next) => {
259
+ Promise.resolve(next()).catch((error) => { ctx.logger.error(error); });
260
+ }), { global: true, prepend: true });
261
+ }
241
262
  await ctx.plugin(host.Loader, undefined);
242
263
  const shutdown = createProcessShutdown(() => ctx.fiber.dispose());
243
264
  const appReady = createAppReady();
@@ -391,7 +412,7 @@ function hostVersion(host) {
391
412
  }
392
413
  }
393
414
  /**
394
- * dsh `bin.js` reportStartupFailure (0.2.1-rc.5), the file half only: the
415
+ * dsh `bin.js` reportStartupFailure (0.2.2-rc.1), the file half only: the
395
416
  * screen is up, so never stderr. Undefined when it could not be written.
396
417
  */
397
418
  async function writeStartupReport(error, context) {
@@ -425,7 +446,7 @@ async function writeStartupReport(error, context) {
425
446
  }
426
447
  return logPath;
427
448
  }
428
- /** dsh `profile-boot` createAppReady (0.2.1-rc.5). */
449
+ /** dsh `profile-boot` createAppReady (0.2.2-rc.1). */
429
450
  function createAppReady() {
430
451
  let ready = false;
431
452
  const listeners = new Set();
@@ -450,7 +471,7 @@ function createAppReady() {
450
471
  },
451
472
  };
452
473
  }
453
- /** dsh `process-shutdown` createProcessShutdown (0.2.1-rc.5), the `shutdown` half only. */
474
+ /** dsh `process-shutdown` createProcessShutdown (0.2.2-rc.1), the `shutdown` half only. */
454
475
  function createProcessShutdown(dispose, timeoutMs = PROCESS_SHUTDOWN_TIMEOUT_MS) {
455
476
  let pending;
456
477
  let settled = false;
@@ -12,12 +12,16 @@ import { configuredBackend, delegatesToProfile, entryKernel, hostProfile } from
12
12
  import { HANDOFF_ACK_FD_ENV } from '../handoffAck.js';
13
13
  import { HOST_NOTICE_ENV } from '../kernelPrefs.js';
14
14
  import { logForDebugging } from '../utils/debug.js';
15
+ import { setProcessName } from '../utils/processName.js';
15
16
  import { cmdEscapeArgument } from '../utils/shellQuote.js';
16
17
  import { ENTRY_ROW_DEFAULTS } from './lite-profile.js';
17
18
  import { HostComposeError, loadHostDsh, NO_DSH_ON_PATH, prepareHostRoot } from './host-dsh.js';
18
19
  import { installEntrySignals } from './process-exit.js';
19
20
  import { disposeRootSettled, trackComposition } from './root-dispose.js';
20
21
  markBoot('entry-start');
22
+ // #1831: process listings show the inherited main-thread name ("MainThread");
23
+ // the process that becomes the screen names itself as early as it can.
24
+ setProcessName('dsh-tui');
21
25
  // DSH's native flock loader reads `process.report.getReport()`; with sockets
22
26
  // already open, the network section's reverse lookups block the event loop.
23
27
  if (process.report !== undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/oauth/profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AAEvE,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,iEAAkE,CAAA;AAEjG,gCAAgC;AAChC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjE,yEAAyE;AACzE,wBAAgB,yBAAyB,IAAI,eAAe,EAAE,CAG7D;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAuBD,oFAAoF;AACpF,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAMvF;AAmCD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,GACvD,2BAA2B,CA6B7B"}
1
+ {"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/oauth/profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AAEvE,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,iEAAkE,CAAA;AAEjG,gCAAgC;AAChC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjE,yEAAyE;AACzE,wBAAgB,yBAAyB,IAAI,eAAe,EAAE,CAG7D;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AA+BD,oFAAoF;AACpF,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAMvF;AAmCD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,GACvD,2BAA2B,CAkC7B"}
@@ -29,6 +29,14 @@ const MAX_REQUEST_IMAGE_BYTES = 20 * 1024 * 1024;
29
29
  const REQUEST_IMAGE_PIXEL_BUDGET = 2048 * 2048;
30
30
  /** llm-pi-ai `DEFAULT_REQUEST_IMAGE_MAX_BYTES` (1 MiB per image). */
31
31
  const REQUEST_IMAGE_MAX_BYTES = 1024 * 1024;
32
+ /**
33
+ * llm-pi-ai `DEFAULT_MAX_REQUEST_IMAGES` (50 retained images per request) and
34
+ * `DEFAULT_IMAGE_OFFLOAD_COUNT_QUANTUM` (10 offloaded per overflow). Required
35
+ * since 0.2.2, where the adapter bounds a request's image prefix; older
36
+ * adapters never read them, so carrying them is harmless on a pre-0.2.2 host.
37
+ */
38
+ const MAX_REQUEST_IMAGES = 50;
39
+ const IMAGE_OFFLOAD_COUNT_QUANTUM = 10;
32
40
  /** llm-pi-ai `DEFAULT_STREAM_IDLE_TIMEOUT_MS` (5 minutes). */
33
41
  const STREAM_IDLE_TIMEOUT_MS = 300_000;
34
42
  /** The installed pi-ai catalog provider for one route, whose OAuth flow we mount. */
@@ -95,7 +103,9 @@ export function buildOAuthProfile(id, modelOverrides) {
95
103
  // An older pi-ai catalog can know the route but not its newer OAuth flow
96
104
  // (notably `openai`). Explicit requests must fail at boot, not at /auth.
97
105
  oauthOf(catalog);
98
- return {
106
+ // Infer the extended shape before returning: older host declarations omit
107
+ // the 0.2.2 image-count fields, but accept the same provider profile.
108
+ const profile = {
99
109
  provider: id,
100
110
  displayName: catalog.name,
101
111
  streamIdleTimeoutMs: STREAM_IDLE_TIMEOUT_MS,
@@ -110,7 +120,10 @@ export function buildOAuthProfile(id, modelOverrides) {
110
120
  // harmless on a pre-0.1.5 host.
111
121
  modelErrors: new Map(),
112
122
  maxRequestImageBytes: MAX_REQUEST_IMAGE_BYTES,
123
+ maxRequestImages: MAX_REQUEST_IMAGES,
124
+ imageOffloadCountQuantum: IMAGE_OFFLOAD_COUNT_QUANTUM,
113
125
  requestImagePixelBudget: REQUEST_IMAGE_PIXEL_BUDGET,
114
126
  requestImageMaxBytes: REQUEST_IMAGE_MAX_BYTES,
115
127
  };
128
+ return profile;
116
129
  }