@chatcode/cco-better-sidebar 0.18.0-alpha.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 (329) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +554 -0
  3. package/README_EN.md +563 -0
  4. package/assets/logo.svg +1 -0
  5. package/cordis.patch.yml +79 -0
  6. package/lib/client-editor.js +55744 -0
  7. package/lib/client-mermaid.js +208256 -0
  8. package/lib/client-registry.js +30378 -0
  9. package/lib/client-terminal.js +16894 -0
  10. package/lib/client.js +30378 -0
  11. package/lib/index.js +6897 -0
  12. package/lib/invariant.js +22 -0
  13. package/lib/types/agent-opens.d.ts +65 -0
  14. package/lib/types/agent-pty.d.ts +226 -0
  15. package/lib/types/browser-probe.d.ts +15 -0
  16. package/lib/types/bundle-route.d.ts +12 -0
  17. package/lib/types/chatcode-update.d.ts +47 -0
  18. package/lib/types/client/AccountMenu.d.ts +1 -0
  19. package/lib/types/client/AiRatioSection.d.ts +3 -0
  20. package/lib/types/client/BrowserView.d.ts +39 -0
  21. package/lib/types/client/ChatcodeGate.d.ts +6 -0
  22. package/lib/types/client/CodingPlanModelsSettings.d.ts +9 -0
  23. package/lib/types/client/DiffTab.d.ts +6 -0
  24. package/lib/types/client/DiffView.d.ts +51 -0
  25. package/lib/types/client/EditorHost.d.ts +13 -0
  26. package/lib/types/client/FenceErrorNotice.d.ts +5 -0
  27. package/lib/types/client/FileTree.d.ts +41 -0
  28. package/lib/types/client/FreeWindow.d.ts +29 -0
  29. package/lib/types/client/GitView.d.ts +12 -0
  30. package/lib/types/client/MarkdownHtml.d.ts +32 -0
  31. package/lib/types/client/OrphanedTab.d.ts +11 -0
  32. package/lib/types/client/PdfView.d.ts +6 -0
  33. package/lib/types/client/ReleaseNotesDialog.d.ts +11 -0
  34. package/lib/types/client/RenderBoundary.d.ts +32 -0
  35. package/lib/types/client/SandboxStatusBar.d.ts +10 -0
  36. package/lib/types/client/SideCardSection.d.ts +74 -0
  37. package/lib/types/client/Sidebar.d.ts +8 -0
  38. package/lib/types/client/TabBar.d.ts +54 -0
  39. package/lib/types/client/TerminalView.d.ts +24 -0
  40. package/lib/types/client/TextEditor.d.ts +10 -0
  41. package/lib/types/client/TreePanel.d.ts +27 -0
  42. package/lib/types/client/UpdateDialog.d.ts +10 -0
  43. package/lib/types/client/UpdateSettingsPanel.d.ts +1 -0
  44. package/lib/types/client/UpdateSettingsSection.d.ts +10 -0
  45. package/lib/types/client/UploadOverlay.d.ts +20 -0
  46. package/lib/types/client/UsageHeatmapSection.d.ts +4 -0
  47. package/lib/types/client/add-plugin-modal.d.ts +15 -0
  48. package/lib/types/client/api.d.ts +345 -0
  49. package/lib/types/client/binary-download.d.ts +12 -0
  50. package/lib/types/client/breakpoints.d.ts +17 -0
  51. package/lib/types/client/browser.d.ts +60 -0
  52. package/lib/types/client/builtins/index.d.ts +18 -0
  53. package/lib/types/client/builtins/tabs.d.ts +11 -0
  54. package/lib/types/client/builtins/viewers.d.ts +3 -0
  55. package/lib/types/client/chat-presentation.d.ts +13 -0
  56. package/lib/types/client/chunk-loader.d.ts +124 -0
  57. package/lib/types/client/chunks/editor.d.ts +9 -0
  58. package/lib/types/client/chunks/mermaid.d.ts +10 -0
  59. package/lib/types/client/chunks/terminal.d.ts +9 -0
  60. package/lib/types/client/cm-themes.d.ts +24 -0
  61. package/lib/types/client/conversation-draft.d.ts +14 -0
  62. package/lib/types/client/desktop-env.d.ts +35 -0
  63. package/lib/types/client/editor-load.d.ts +66 -0
  64. package/lib/types/client/frame-batcher.d.ts +24 -0
  65. package/lib/types/client/icons.d.ts +66 -0
  66. package/lib/types/client/image-types.d.ts +3 -0
  67. package/lib/types/client/ime-guard.d.ts +36 -0
  68. package/lib/types/client/index.d.ts +19 -0
  69. package/lib/types/client/intercept.d.ts +44 -0
  70. package/lib/types/client/lang.d.ts +14 -0
  71. package/lib/types/client/layout-push.d.ts +15 -0
  72. package/lib/types/client/lazy-chunk.d.ts +25 -0
  73. package/lib/types/client/link-intercept.d.ts +42 -0
  74. package/lib/types/client/locales-ar.d.ts +18 -0
  75. package/lib/types/client/locales-de.d.ts +4 -0
  76. package/lib/types/client/locales-fr.d.ts +10 -0
  77. package/lib/types/client/locales-hi.d.ts +17 -0
  78. package/lib/types/client/locales-id.d.ts +15 -0
  79. package/lib/types/client/locales-it.d.ts +8 -0
  80. package/lib/types/client/locales-ja.d.ts +17 -0
  81. package/lib/types/client/locales-ko.d.ts +9 -0
  82. package/lib/types/client/locales-nl.d.ts +16 -0
  83. package/lib/types/client/locales-pl.d.ts +19 -0
  84. package/lib/types/client/locales-pt.d.ts +1 -0
  85. package/lib/types/client/locales-ru.d.ts +13 -0
  86. package/lib/types/client/locales-sv.d.ts +1 -0
  87. package/lib/types/client/locales-th.d.ts +17 -0
  88. package/lib/types/client/locales-tr.d.ts +17 -0
  89. package/lib/types/client/locales-vi.d.ts +17 -0
  90. package/lib/types/client/locales-zh-HK.d.ts +32 -0
  91. package/lib/types/client/locales-zh-MO.d.ts +32 -0
  92. package/lib/types/client/locales-zh-TW.d.ts +32 -0
  93. package/lib/types/client/locales.d.ts +571 -0
  94. package/lib/types/client/markdown-html.d.ts +96 -0
  95. package/lib/types/client/markdown-images.d.ts +45 -0
  96. package/lib/types/client/markdown-labels.d.ts +21 -0
  97. package/lib/types/client/md-toc.d.ts +4 -0
  98. package/lib/types/client/mermaid-blocks.d.ts +47 -0
  99. package/lib/types/client/mermaid-sanitize.d.ts +2 -0
  100. package/lib/types/client/mermaid.d.ts +12 -0
  101. package/lib/types/client/open-when-sized.d.ts +20 -0
  102. package/lib/types/client/open-with-settings.d.ts +4 -0
  103. package/lib/types/client/open-with.d.ts +87 -0
  104. package/lib/types/client/openpath-intercept.d.ts +52 -0
  105. package/lib/types/client/paths.d.ts +43 -0
  106. package/lib/types/client/pdf-types.d.ts +2 -0
  107. package/lib/types/client/pinned.d.ts +86 -0
  108. package/lib/types/client/plugin-settings.d.ts +8 -0
  109. package/lib/types/client/plugins-shared.d.ts +27 -0
  110. package/lib/types/client/plugins-tabs.d.ts +3 -0
  111. package/lib/types/client/plugins-viewers.d.ts +3 -0
  112. package/lib/types/client/prefs.d.ts +41 -0
  113. package/lib/types/client/produced-files.d.ts +29 -0
  114. package/lib/types/client/selection-payload.d.ts +27 -0
  115. package/lib/types/client/service.d.ts +445 -0
  116. package/lib/types/client/session-pins.d.ts +14 -0
  117. package/lib/types/client/settings-nav-icon.d.ts +27 -0
  118. package/lib/types/client/shell-presets.d.ts +48 -0
  119. package/lib/types/client/split-pane.d.ts +38 -0
  120. package/lib/types/client/state.d.ts +480 -0
  121. package/lib/types/client/tab-content-memo.d.ts +40 -0
  122. package/lib/types/client/terminal-font.d.ts +78 -0
  123. package/lib/types/client/terminal-links.d.ts +119 -0
  124. package/lib/types/client/theme.d.ts +45 -0
  125. package/lib/types/client/titlebar-strip.d.ts +23 -0
  126. package/lib/types/client/ui-tweaks/appicons.d.ts +16 -0
  127. package/lib/types/client/ui-tweaks/archive.d.ts +42 -0
  128. package/lib/types/client/ui-tweaks/branding.d.ts +45 -0
  129. package/lib/types/client/ui-tweaks/cachehit.d.ts +41 -0
  130. package/lib/types/client/ui-tweaks/gitbar.d.ts +103 -0
  131. package/lib/types/client/ui-tweaks/index.d.ts +279 -0
  132. package/lib/types/client/ui-tweaks/mcp.d.ts +28 -0
  133. package/lib/types/client/ui-tweaks/notifier.d.ts +125 -0
  134. package/lib/types/client/ui-tweaks/whale.d.ts +55 -0
  135. package/lib/types/client/upload.d.ts +69 -0
  136. package/lib/types/client/useChatcodeAccount.d.ts +10 -0
  137. package/lib/types/client/wco.d.ts +47 -0
  138. package/lib/types/codingplan.d.ts +37 -0
  139. package/lib/types/config.d.ts +95 -0
  140. package/lib/types/context-types.d.ts +540 -0
  141. package/lib/types/fs-operations.d.ts +30 -0
  142. package/lib/types/fs-search.d.ts +24 -0
  143. package/lib/types/fs-tree.d.ts +51 -0
  144. package/lib/types/git.d.ts +124 -0
  145. package/lib/types/html-route.d.ts +59 -0
  146. package/lib/types/index.d.ts +47 -0
  147. package/lib/types/invariant.d.ts +15 -0
  148. package/lib/types/login-route.d.ts +2 -0
  149. package/lib/types/open-external.d.ts +24 -0
  150. package/lib/types/path-security.d.ts +26 -0
  151. package/lib/types/prefs-shared.d.ts +257 -0
  152. package/lib/types/pty-deps.d.ts +79 -0
  153. package/lib/types/pty-manager.d.ts +168 -0
  154. package/lib/types/tools.d.ts +34 -0
  155. package/lib/types/trust-fence.d.ts +24 -0
  156. package/lib/types/ui-tweaks/archive.d.ts +71 -0
  157. package/lib/types/ui-tweaks/config.d.ts +186 -0
  158. package/lib/types/ui-tweaks/git-web.d.ts +43 -0
  159. package/lib/types/ui-tweaks/git.d.ts +311 -0
  160. package/lib/types/ui-tweaks/index.d.ts +17 -0
  161. package/lib/types/ui-tweaks/mcp.d.ts +103 -0
  162. package/lib/types/ui-tweaks/turn-outcome.d.ts +57 -0
  163. package/lib/types/ui-tweaks/web.d.ts +55 -0
  164. package/lib/types/wire.d.ts +38 -0
  165. package/package.json +213 -0
  166. package/scripts/install.ps1 +310 -0
  167. package/scripts/install.sh +287 -0
  168. package/src/agent-opens.ts +265 -0
  169. package/src/agent-pty.ts +527 -0
  170. package/src/browser-probe.ts +26 -0
  171. package/src/bundle-route.ts +129 -0
  172. package/src/chatcode-update.ts +193 -0
  173. package/src/client/AccountMenu.tsx +177 -0
  174. package/src/client/AiRatioSection.module.css +329 -0
  175. package/src/client/AiRatioSection.tsx +292 -0
  176. package/src/client/BrowserView.tsx +289 -0
  177. package/src/client/ChatcodeGate.tsx +35 -0
  178. package/src/client/CodingPlanModelsSettings.module.css +118 -0
  179. package/src/client/CodingPlanModelsSettings.tsx +101 -0
  180. package/src/client/DiffTab.tsx +114 -0
  181. package/src/client/DiffView.tsx +305 -0
  182. package/src/client/EditorHost.tsx +563 -0
  183. package/src/client/FenceErrorNotice.tsx +40 -0
  184. package/src/client/FileTree.tsx +701 -0
  185. package/src/client/FreeWindow.tsx +337 -0
  186. package/src/client/GitView.tsx +722 -0
  187. package/src/client/MarkdownHtml.tsx +296 -0
  188. package/src/client/OrphanedTab.tsx +27 -0
  189. package/src/client/PdfView.tsx +110 -0
  190. package/src/client/ReleaseNotesDialog.tsx +91 -0
  191. package/src/client/RenderBoundary.tsx +49 -0
  192. package/src/client/SandboxStatusBar.tsx +60 -0
  193. package/src/client/SideCardSection.module.css +932 -0
  194. package/src/client/SideCardSection.tsx +1169 -0
  195. package/src/client/Sidebar.tsx +1857 -0
  196. package/src/client/TabBar.tsx +365 -0
  197. package/src/client/TerminalView.tsx +424 -0
  198. package/src/client/TextEditor.tsx +468 -0
  199. package/src/client/TreePanel.tsx +279 -0
  200. package/src/client/UpdateDialog.tsx +186 -0
  201. package/src/client/UpdateSettingsPanel.tsx +29 -0
  202. package/src/client/UpdateSettingsSection.tsx +22 -0
  203. package/src/client/UploadOverlay.tsx +62 -0
  204. package/src/client/UsageHeatmapSection.module.css +440 -0
  205. package/src/client/UsageHeatmapSection.tsx +301 -0
  206. package/src/client/add-plugin-modal.tsx +199 -0
  207. package/src/client/api.ts +433 -0
  208. package/src/client/binary-download.tsx +23 -0
  209. package/src/client/breakpoints.ts +61 -0
  210. package/src/client/browser.ts +167 -0
  211. package/src/client/builtins/index.ts +37 -0
  212. package/src/client/builtins/tabs.tsx +275 -0
  213. package/src/client/builtins/viewers.tsx +125 -0
  214. package/src/client/chat-presentation.ts +95 -0
  215. package/src/client/chunk-loader.ts +350 -0
  216. package/src/client/chunks/editor.tsx +9 -0
  217. package/src/client/chunks/mermaid.tsx +10 -0
  218. package/src/client/chunks/terminal.tsx +9 -0
  219. package/src/client/cm-themes.ts +129 -0
  220. package/src/client/conversation-draft.ts +29 -0
  221. package/src/client/css-modules.d.ts +5 -0
  222. package/src/client/desktop-env.ts +72 -0
  223. package/src/client/editor-load.ts +92 -0
  224. package/src/client/frame-batcher.ts +56 -0
  225. package/src/client/icons.tsx +170 -0
  226. package/src/client/image-types.ts +8 -0
  227. package/src/client/ime-guard.ts +47 -0
  228. package/src/client/index.tsx +501 -0
  229. package/src/client/intercept.tsx +172 -0
  230. package/src/client/lang.ts +225 -0
  231. package/src/client/layout-push.ts +37 -0
  232. package/src/client/layout.css +156 -0
  233. package/src/client/lazy-chunk.tsx +89 -0
  234. package/src/client/link-intercept.ts +73 -0
  235. package/src/client/locales-ar.ts +387 -0
  236. package/src/client/locales-de.ts +372 -0
  237. package/src/client/locales-fr.ts +379 -0
  238. package/src/client/locales-hi.ts +386 -0
  239. package/src/client/locales-id.ts +384 -0
  240. package/src/client/locales-it.ts +377 -0
  241. package/src/client/locales-ja.ts +486 -0
  242. package/src/client/locales-ko.ts +378 -0
  243. package/src/client/locales-nl.ts +384 -0
  244. package/src/client/locales-pl.ts +388 -0
  245. package/src/client/locales-pt.ts +369 -0
  246. package/src/client/locales-ru.ts +384 -0
  247. package/src/client/locales-sv.ts +369 -0
  248. package/src/client/locales-th.ts +386 -0
  249. package/src/client/locales-tr.ts +386 -0
  250. package/src/client/locales-vi.ts +386 -0
  251. package/src/client/locales-zh-HK.ts +401 -0
  252. package/src/client/locales-zh-MO.ts +401 -0
  253. package/src/client/locales-zh-TW.ts +401 -0
  254. package/src/client/locales.ts +1229 -0
  255. package/src/client/markdown-html.ts +331 -0
  256. package/src/client/markdown-images.ts +137 -0
  257. package/src/client/markdown-labels.tsx +31 -0
  258. package/src/client/md-toc.tsx +127 -0
  259. package/src/client/mermaid-blocks.ts +110 -0
  260. package/src/client/mermaid-sanitize.ts +93 -0
  261. package/src/client/mermaid.tsx +406 -0
  262. package/src/client/open-when-sized.ts +43 -0
  263. package/src/client/open-with-settings.tsx +135 -0
  264. package/src/client/open-with.ts +221 -0
  265. package/src/client/openpath-intercept.ts +79 -0
  266. package/src/client/paths.ts +63 -0
  267. package/src/client/pdf-types.ts +4 -0
  268. package/src/client/pinned.ts +184 -0
  269. package/src/client/plugin-settings.ts +43 -0
  270. package/src/client/plugins-shared.ts +29 -0
  271. package/src/client/plugins-tabs.ts +153 -0
  272. package/src/client/plugins-viewers.ts +44 -0
  273. package/src/client/prefs.ts +216 -0
  274. package/src/client/produced-files.ts +120 -0
  275. package/src/client/selection-payload.ts +86 -0
  276. package/src/client/service.ts +873 -0
  277. package/src/client/session-pins.tsx +334 -0
  278. package/src/client/settings-nav-icon.ts +55 -0
  279. package/src/client/shell-presets.ts +83 -0
  280. package/src/client/sidebar.module.css +3607 -0
  281. package/src/client/split-pane.tsx +333 -0
  282. package/src/client/state.ts +1646 -0
  283. package/src/client/tab-content-memo.ts +55 -0
  284. package/src/client/terminal-font.ts +224 -0
  285. package/src/client/terminal-links.ts +194 -0
  286. package/src/client/theme.ts +110 -0
  287. package/src/client/titlebar-strip.ts +37 -0
  288. package/src/client/ui-tweaks/appicons.ts +24 -0
  289. package/src/client/ui-tweaks/archive.tsx +281 -0
  290. package/src/client/ui-tweaks/branding.tsx +232 -0
  291. package/src/client/ui-tweaks/cachehit.tsx +122 -0
  292. package/src/client/ui-tweaks/gitbar.tsx +2559 -0
  293. package/src/client/ui-tweaks/index.tsx +1696 -0
  294. package/src/client/ui-tweaks/mcp.tsx +582 -0
  295. package/src/client/ui-tweaks/notifier.ts +514 -0
  296. package/src/client/ui-tweaks/whale.tsx +171 -0
  297. package/src/client/upload.ts +187 -0
  298. package/src/client/useChatcodeAccount.ts +103 -0
  299. package/src/client/wco.ts +120 -0
  300. package/src/codingplan.ts +146 -0
  301. package/src/config.ts +207 -0
  302. package/src/context-types.ts +559 -0
  303. package/src/fs-operations.ts +97 -0
  304. package/src/fs-search.ts +113 -0
  305. package/src/fs-tree.ts +158 -0
  306. package/src/git.ts +446 -0
  307. package/src/html-route.ts +106 -0
  308. package/src/index.ts +1524 -0
  309. package/src/invariant.ts +32 -0
  310. package/src/login-route.ts +26 -0
  311. package/src/open-external.ts +90 -0
  312. package/src/path-security.ts +81 -0
  313. package/src/prefs-shared.ts +303 -0
  314. package/src/pty-deps.ts +241 -0
  315. package/src/pty-manager.ts +376 -0
  316. package/src/tools.ts +482 -0
  317. package/src/trust-fence.ts +84 -0
  318. package/src/ui-tweaks/archive.ts +293 -0
  319. package/src/ui-tweaks/config.ts +257 -0
  320. package/src/ui-tweaks/git-web.ts +421 -0
  321. package/src/ui-tweaks/git.ts +1524 -0
  322. package/src/ui-tweaks/index.ts +61 -0
  323. package/src/ui-tweaks/mcp.ts +535 -0
  324. package/src/ui-tweaks/turn-outcome.ts +105 -0
  325. package/src/ui-tweaks/web.ts +225 -0
  326. package/src/wire.ts +110 -0
  327. package/vendor/addon-fit.js +2 -0
  328. package/vendor/xterm.css +218 -0
  329. package/vendor/xterm.js +5 -0
@@ -0,0 +1,37 @@
1
+ /**
2
+ * CodingPlan model-catalogue client. It deliberately runs only in the host
3
+ * half of the sidebar plugin: CodingPlan connection details and any API key
4
+ * present in its response must never cross the `/sidebar/api` boundary.
5
+ */
6
+ import type { ResolvedCodingPlanConfig } from './config.ts';
7
+ /** The safe, display-only subset of one CodingPlan model. */
8
+ export interface CodingPlanModel {
9
+ logicalModelId: string;
10
+ displayName: string;
11
+ description?: string;
12
+ accessType?: string;
13
+ maxToken?: number;
14
+ contextWindow?: number;
15
+ }
16
+ /** Browser-safe catalogue snapshot returned by the plugin route. */
17
+ export interface CodingPlanCatalogueSnapshot {
18
+ status: 'loading' | 'ready' | 'unavailable';
19
+ models: CodingPlanModel[];
20
+ fetchedAt?: string;
21
+ }
22
+ type FetchLike = typeof fetch;
23
+ /** Strip an untrusted server item down to fields safe to show in the UI. */
24
+ export declare function publicCodingPlanModel(value: unknown): CodingPlanModel | undefined;
25
+ /** Host-side, single-flight CodingPlan catalogue cache. */
26
+ export declare class CodingPlanCatalogue {
27
+ private readonly config;
28
+ private readonly request;
29
+ private snapshotValue;
30
+ private inFlight;
31
+ constructor(config: ResolvedCodingPlanConfig, request?: FetchLike);
32
+ snapshot(): CodingPlanCatalogueSnapshot;
33
+ /** Refresh once; concurrent callers share the same outgoing request. */
34
+ refresh(): Promise<CodingPlanCatalogueSnapshot>;
35
+ private load;
36
+ }
37
+ export {};
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Serializable configuration and defaults for the sidebar host half. Loader
3
+ * schema validation normally fills defaults; {@link resolveSidebarConfig}
4
+ * applies the same defaults for direct callers that bypass the Loader.
5
+ * @module dsh-better-sidebar/config
6
+ */
7
+ import z from 'schemastery';
8
+ import { type SidebarPrefs } from './prefs-shared.ts';
9
+ export { SIDEBAR_PREFS_DEFAULTS, SIDEBAR_PREFS_NS, TERMINAL_FONT_SIZE_DEFAULT, TERMINAL_FONT_SIZE_MAX, TERMINAL_FONT_SIZE_MIN, TITLE_BAR_STRIP_DEFAULT, TITLE_BAR_STRIP_MAX, TITLE_BAR_STRIP_MIN, WIDTH_PERCENT_DEFAULT, WIDTH_PERCENT_MAX, WIDTH_PERCENT_MIN, type SidebarPrefs, } from './prefs-shared.ts';
10
+ /** Tunable sidebar host limits (every field optional; defaults fill in). */
11
+ export interface SidebarConfig {
12
+ /** Read cap of one text file (bytes); larger files return truncated. */
13
+ readLimit?: number;
14
+ /** Media route cap (bytes); larger binaries are refused. */
15
+ mediaLimit?: number;
16
+ /** Upload route cap (bytes); larger files are refused without touching disk. */
17
+ uploadLimit?: number;
18
+ /** Explorer row bound of one level. */
19
+ listLimit?: number;
20
+ /** Terminals per session. */
21
+ terminalsPerSession?: number;
22
+ /** How long a disconnected terminal process survives awaiting a reconnect. */
23
+ reconnectGraceMs?: number;
24
+ /**
25
+ * Terminal shell (absolute path or bare executable name) for BOTH the UI
26
+ * terminal tabs and the model-facing `terminal_*` tools. Empty = auto:
27
+ * POSIX follows `$SHELL` then the account login shell; Windows follows
28
+ * `DSH_SIDEBAR_SHELL`, then probes for `pwsh.exe`, then falls back to the
29
+ * inbox `powershell.exe` (5.1). Set it from `cordis.patch.yml` / profile
30
+ * plugin config, e.g. `config: { shell: /bin/zsh }`.
31
+ */
32
+ shell?: string;
33
+ /**
34
+ * Optional arguments passed to the shell executable. When non-empty these
35
+ * REPLACE the automatic platform defaults (POSIX `-l` / Windows none), so
36
+ * the deployment has full control over how the shell starts. When omitted
37
+ * the existing default behavior is kept.
38
+ */
39
+ shellArgs?: string[];
40
+ /** Display name shown by the bottom-left account menu. Defaults to the host OS user. */
41
+ userName?: string;
42
+ /** Connection details for the CodingPlan model catalogue. This is host-only
43
+ * configuration: API keys returned by CodingPlan are never part of it and
44
+ * are never sent to the browser. */
45
+ codingPlan?: CodingPlanConfig;
46
+ }
47
+ /** Deployment-owned identity and endpoint used to read CodingPlan models. */
48
+ export interface CodingPlanConfig {
49
+ /** CodingPlan service origin. */
50
+ baseUrl?: string;
51
+ /** Identity query parameters required by the CodingPlan catalogue API. */
52
+ userId?: string;
53
+ accountUuid?: string;
54
+ userEmail?: string;
55
+ emailAddress?: string;
56
+ /** Catalogue request timeout in milliseconds. */
57
+ requestTimeoutMs?: number;
58
+ }
59
+ /** Schemastery schema for the plugin configuration. */
60
+ export declare const Config: z<SidebarConfig>;
61
+ /** Fully defaulted sidebar host settings. */
62
+ export interface ResolvedSidebarConfig {
63
+ readLimit: number;
64
+ mediaLimit: number;
65
+ uploadLimit: number;
66
+ listLimit: number;
67
+ terminalsPerSession: number;
68
+ reconnectGraceMs: number;
69
+ /** The configured terminal shell; empty means the host auto-resolves it. */
70
+ shell: string;
71
+ /** Explicit shell arguments; empty means use the platform defaults. */
72
+ shellArgs: string[];
73
+ /** Account-menu display name. */
74
+ userName: string;
75
+ /** Fully resolved CodingPlan catalogue connection settings. */
76
+ codingPlan: ResolvedCodingPlanConfig;
77
+ }
78
+ /** Fully defaulted CodingPlan configuration consumed by the host route. */
79
+ export interface ResolvedCodingPlanConfig {
80
+ baseUrl: string;
81
+ userId: string;
82
+ accountUuid: string;
83
+ userEmail: string;
84
+ emailAddress: string;
85
+ requestTimeoutMs: number;
86
+ }
87
+ /**
88
+ * Apply direct-call defaults after Loader schema validation has normally run.
89
+ *
90
+ * @param config - Deployment-provided sidebar host settings.
91
+ * @returns Complete settings consumed by the host half.
92
+ */
93
+ export declare function resolveSidebarConfig(config: SidebarConfig | undefined): ResolvedSidebarConfig;
94
+ /** Schemastery schema for the user-facing preferences (validated by the settings service). */
95
+ export declare const PrefsSchema: z<SidebarPrefs>;
@@ -0,0 +1,540 @@
1
+ /**
2
+ * Structural types for the cordis services this plugin consumes, plus the
3
+ * Context face both halves share.
4
+ *
5
+ * The type base is the vendored `@deepseek-ai/cordis` Context (the runtime
6
+ * DSH actually runs); the service members this plugin touches are restated
7
+ * below as structural mirrors and combined with the base by INTERSECTION.
8
+ * Intersection (not `declare module` augmentation) is deliberate: DSH's own
9
+ * packages already augment `@deepseek-ai/cordis`, and the host and client
10
+ * packages declare *different* types for the same member — host
11
+ * `sessions: SessionStore` vs client runtime `sessions: ISessions` — so a
12
+ * single program that re-declares them would fail interface merging
13
+ * (TS2717). Intersecting keeps every face available and lets each call site
14
+ * resolve against the member it needs without any module-level conflict.
15
+ *
16
+ * `effect`, `get`, `provide`, `inject`, `logger`, `emit`, `isolate` and the
17
+ * event helpers come from the vendored cordis base and are intentionally NOT
18
+ * restated here: their strict shapes are the runtime contract (e.g. an
19
+ * effect body must return a disposer). Only the string-keyed session-feed
20
+ * `on` overload is added, because the cordis `on` is keyed to its own
21
+ * typed `Events` map and the harness session feed is a plain string event.
22
+ *
23
+ * This file must stay FREE of Node.js types (`node:http`, `node:stream`,
24
+ * `Buffer`): it is part of the CLIENT-reachable declaration graph (the
25
+ * `Context` in `TabComponentProps` and the `betterSidebar` augmentation),
26
+ * so a Node import here would leak into browser-only consumer builds. The
27
+ * webServer faces below are therefore structural mirrors with plain
28
+ * interfaces (the host casts to real Node types at the few boundaries that
29
+ * need them — e.g. the `ws` upgrade hook in src/index.ts).
30
+ */
31
+ import type { Context as CordisContext } from '@deepseek-ai/cordis';
32
+ import type { BetterSidebarService } from './client/service.ts';
33
+ /** The request face route handlers see (structural subset of node's
34
+ * IncomingMessage: the URL/method/header reads and the async body
35
+ * iteration `readJsonBody` uses). */
36
+ export interface SidebarHttpRequest {
37
+ url?: string;
38
+ method?: string;
39
+ headers: Record<string, string | string[] | undefined>;
40
+ [Symbol.asyncIterator](): AsyncIterator<string | Uint8Array>;
41
+ }
42
+ /** The response face route handlers write to (structural subset of node's
43
+ * ServerResponse: the status/header/body writes the routes use). */
44
+ export interface SidebarHttpResponse {
45
+ statusCode: number;
46
+ writeHead(status: number, headers?: Record<string, string>): void;
47
+ end(body?: string | Uint8Array): void;
48
+ }
49
+ /** The upgrade socket face (structural subset: the destroy the fences use). */
50
+ export interface SidebarUpgradeSocket {
51
+ destroy(): void;
52
+ }
53
+ /** The upgrade head bytes (Buffer at runtime; typed as bytes so no Node
54
+ * global leaks into the declaration graph). */
55
+ export type SidebarUpgradeHead = Uint8Array;
56
+ /** One named webserver route (mirror of the host-webserver WebRoute). */
57
+ export interface SidebarWebRoute {
58
+ kind: 'exact' | 'prefix';
59
+ path: string;
60
+ handler: (req: SidebarHttpRequest, res: SidebarHttpResponse) => void | Promise<void>;
61
+ }
62
+ /** One exact-path HTTP upgrade registration (mirror of WebUpgradeRoute). */
63
+ export interface SidebarWebUpgradeRoute {
64
+ path: string;
65
+ handler: (req: SidebarHttpRequest, socket: SidebarUpgradeSocket, head: SidebarUpgradeHead) => void | Promise<void>;
66
+ }
67
+ /** The webServer service face this plugin uses. */
68
+ export interface SidebarWebServer {
69
+ register(route: SidebarWebRoute): () => void;
70
+ registerUpgrade(route: SidebarWebUpgradeRoute): () => void;
71
+ }
72
+ /** A published session's header slice the sidebar reads (authoritative cwd). */
73
+ export interface SidebarSessionHeader {
74
+ cwd?: string;
75
+ }
76
+ /** The host session store face (`ctx.sessions.get(id)` returns the live session). */
77
+ export interface SidebarSessionStore {
78
+ get(id: string): {
79
+ header: SidebarSessionHeader;
80
+ /**
81
+ * The live session's append-only event log (immutable snapshot; absent
82
+ * on sessions the runtime has not hydrated). Read-only access — the
83
+ * jobs.output route replays `job_output` tool/result rows from it.
84
+ */
85
+ events?: readonly SidebarSessionEvent[];
86
+ } | undefined;
87
+ }
88
+ /**
89
+ * The web runtime service face (mirror of @deepseek-ai/dsh-web-app's
90
+ * WebRuntimeValues): the bind-derived trust list the /api gateway's fence
91
+ * accepts — LAN IP literals sampled when the server binds all interfaces,
92
+ * plus explicit `--trusted-host` authorities.
93
+ */
94
+ export interface SidebarWebRuntime {
95
+ trustedHosts: readonly string[];
96
+ }
97
+ /** Registration options the sidebar passes to `ctx.slots.register` (subset of the real options). */
98
+ export interface SidebarSlotRegisterOptions {
99
+ name: string;
100
+ key?: string;
101
+ id?: string;
102
+ order?: number;
103
+ label?: string | (() => string);
104
+ /** Chain routing selector (returns the matched value, or null to pass on). */
105
+ select?: (owner: unknown) => unknown;
106
+ priority?: number;
107
+ locale?: string;
108
+ registrant?: string;
109
+ /** Business-face factory; args depend on the slot scope. */
110
+ inject?: (...args: any[]) => Record<string, unknown>;
111
+ children?: Record<string, unknown>;
112
+ }
113
+ /** The client slots service face (register returns the disposer). */
114
+ export interface SidebarSlotsService {
115
+ register(options: SidebarSlotRegisterOptions, component: unknown): () => void;
116
+ /**
117
+ * Run a callback for each declaration lifetime of a slot (the runtime
118
+ * SlotRegistry.inject): a no-op while the slot is undeclared, so the
119
+ * settings section registration waits for the settings shell.
120
+ */
121
+ inject(key: string, callback: () => () => void): () => void;
122
+ }
123
+ /** The client session list row the sidebar reads (cwd for the explorer). */
124
+ export interface SidebarSessionSummary {
125
+ id: string;
126
+ cwd?: string;
127
+ displayTitle: string;
128
+ /** Coarse durable origin for navigation filtering (subagent children). */
129
+ origin?: 'subagent';
130
+ /** Durable direct parent session id (present on subagent children). */
131
+ parentId?: string;
132
+ /** Whether the session's agent is currently running. */
133
+ running?: boolean;
134
+ }
135
+ /** One healthy subagent catalog child row (structural mirror of the runtime). */
136
+ export interface SidebarSubagentChildEntry {
137
+ kind: 'child';
138
+ id: string;
139
+ /** Whether the child Agent driver is running at the Host sampling boundary. */
140
+ activity: 'running' | 'inactive';
141
+ /** Whether a direct descendant has durable `origin: 'subagent'`. */
142
+ hasChildren: boolean;
143
+ mode: 'one-shot' | 'continuable';
144
+ label?: string;
145
+ }
146
+ /** One unreadable catalog row (corrupt / unsupported / unavailable). */
147
+ export interface SidebarSubagentDiagnosticEntry {
148
+ kind: 'diagnostic';
149
+ id: string;
150
+ reason: 'corrupt' | 'unsupported' | 'unavailable';
151
+ }
152
+ /** The per-parent lazy catalog delivered through the sessions list feed. */
153
+ export interface SidebarSubagentCatalog {
154
+ entries: Array<SidebarSubagentChildEntry | SidebarSubagentDiagnosticEntry>;
155
+ parentAvailable: boolean;
156
+ state: 'loading' | 'ready' | 'error';
157
+ error: {
158
+ code?: string;
159
+ message?: string;
160
+ } | null;
161
+ }
162
+ /** Durable parent/child address that selects subagent transport in the client. */
163
+ export interface SidebarSubagentAddress {
164
+ parentSessionId: string;
165
+ childSessionId: string;
166
+ mode: 'one-shot' | 'continuable';
167
+ }
168
+ /** Minimal structural mirror of one session event (the subagent history tail). */
169
+ export interface SidebarSessionEvent {
170
+ type: string;
171
+ seq: number;
172
+ time: number;
173
+ data: Record<string, unknown>;
174
+ }
175
+ /** One history row: the durable event plus an optional tool presentation view. */
176
+ export interface SidebarHistoryEntry {
177
+ event: SidebarSessionEvent;
178
+ view?: unknown;
179
+ }
180
+ /** Lifecycle status set of one background job (closed wire union). */
181
+ export type SidebarJobStatus = 'running' | 'stopping' | 'completed' | 'killed' | 'failed';
182
+ /**
183
+ * One background job as the client mirror sees it (wire `JobView` shape:
184
+ * id/kind/label/status/detail?/startedAt/finishedAt?).
185
+ */
186
+ export interface SidebarJobView {
187
+ /** Registry-issued `<kind>-N` identity, stable for the job's whole life. */
188
+ id: string;
189
+ /** Producer kind (`bash`, `pwsh`, `subagent`, …; open string by design). */
190
+ kind: string;
191
+ /** Producer-supplied one-line label: the command, or the delegation description. */
192
+ label: string;
193
+ /** Current lifecycle state. */
194
+ status: SidebarJobStatus;
195
+ /** Kind-specific status detail ('exit code: 3'), present once supplied. */
196
+ detail?: string;
197
+ /** Epoch ms when the job was registered. */
198
+ startedAt: number;
199
+ /** Epoch ms when the job settled; absent while live. */
200
+ finishedAt?: number;
201
+ }
202
+ /** The host jobs registry face the sidebar routes touch (structural mirror of `JobRegistry`). */
203
+ export interface SidebarJobsService {
204
+ /** Request cancellation; throws for an unknown or foreign job. */
205
+ kill(id: string, caller?: SidebarAgent, reason?: string): 'requested' | 'already-finished';
206
+ }
207
+ /** The host agent registry face (structural mirror of the runtime `ctx.agents`). */
208
+ export interface SidebarAgentsService {
209
+ /** The live agent registered under a session id, or undefined when not live. */
210
+ get(id: string): SidebarAgent | undefined;
211
+ /**
212
+ * Create a session + agent with a custom seed (mirror of the runtime
213
+ * AgentRegistry.create) — the Side Chat thread-creation seam: the SAME
214
+ * public seam api-proxy's session.fork and the subagent fork provider use.
215
+ */
216
+ create?(options: unknown): Promise<{
217
+ agent: SidebarAgent;
218
+ dispose(): Promise<void>;
219
+ }>;
220
+ /**
221
+ * Resume an agent on a persisted session (mirror of the runtime
222
+ * AgentRegistry.resume) — the Side Chat cold-continuation seam after a
223
+ * DSH restart or a closed thread.
224
+ */
225
+ resume?(options: unknown): Promise<{
226
+ agent: SidebarAgent;
227
+ dispose(): Promise<void>;
228
+ }>;
229
+ }
230
+ /** The host subagent runtime face (`ctx.subagents`; optional — the live
231
+ * batch route degrades to a 503 when the deployment lacks it). Only the
232
+ * read-only descendant enumeration this plugin needs is mirrored. */
233
+ export interface SidebarSubagentsService {
234
+ /**
235
+ * Enumerate the root's complete session-backed subagent tree in stable
236
+ * pre-order without loading or resuming an Agent (mirror of
237
+ * `SubagentRuntime.listDescendants`).
238
+ */
239
+ listDescendants(rootSessionId: string, signal?: AbortSignal): Promise<SidebarSubagentDescendantEntry[]>;
240
+ }
241
+ /** One descendant row of `ctx.subagents.listDescendants` (structural mirror). */
242
+ export type SidebarSubagentDescendantEntry = {
243
+ kind: 'child';
244
+ id: string;
245
+ activity: 'running' | 'inactive';
246
+ hasChildren: boolean;
247
+ mode: 'one-shot' | 'continuable';
248
+ label?: string;
249
+ parentId: string;
250
+ depth: number;
251
+ } | {
252
+ kind: 'diagnostic';
253
+ id: string;
254
+ reason: 'corrupt' | 'unsupported' | 'unavailable';
255
+ parentId: string;
256
+ depth: number;
257
+ };
258
+ /** The host agent-presets service face (mirror of the runtime agentPresets
259
+ * service): resolves and mounts the preset composition a session recorded,
260
+ * so a resumed or forked session rebuilds the same tool/prompt world its
261
+ * history was produced under. */
262
+ export interface SidebarAgentPresetsService {
263
+ /** Resolve a preset id; undefined resolves the deployment default. */
264
+ resolve(presetId?: string): Promise<{
265
+ id: string;
266
+ }>;
267
+ /** Mount a preset's composition into an agent scope before publication. */
268
+ mount(agentCtx: unknown, presetId: string): Promise<void>;
269
+ }
270
+ /** The host session-title service face (mirror of the sessionTitle service). */
271
+ export interface SidebarSessionTitleService {
272
+ /** Rename one live session's title (pins it against auto-regeneration). */
273
+ rename(session: unknown, title: string): {
274
+ title: string;
275
+ eventSeq: number;
276
+ };
277
+ }
278
+ /** The host session-persistence face (mirror of the sessionPersistence
279
+ * service): detached inspection of a persisted session, used to compose the
280
+ * recorded preset when a Side Chat thread cold-resumes. */
281
+ export interface SidebarSessionPersistenceService {
282
+ inspect(sessionId: string): Promise<{
283
+ meta: {
284
+ cwd?: string;
285
+ agentPreset?: string;
286
+ };
287
+ events: readonly SidebarSessionEvent[];
288
+ }>;
289
+ }
290
+ /** The client session list snapshot the sidebar subscribes to. */
291
+ export interface SidebarSessionList {
292
+ current: string | undefined;
293
+ byId: Record<string, SidebarSessionSummary>;
294
+ /** Direct durable catalogs keyed by their selected parent address. */
295
+ subagentsByParent?: Readonly<Record<string, SidebarSubagentCatalog>>;
296
+ /**
297
+ * Background jobs per session, last-wins from the harness's `session/jobs`
298
+ * push (a missing key is an empty set). Absent on runtime snapshots older
299
+ * than the jobs mirror — the sidebar simply shows no job rows.
300
+ */
301
+ jobsBySession?: Readonly<Record<string, readonly SidebarJobView[]>>;
302
+ }
303
+ /** The client sessions service face (only the list feed is needed). */
304
+ export interface SidebarSessionsService {
305
+ list: {
306
+ getSnapshot(): SidebarSessionList;
307
+ subscribe(fn: () => void): () => void;
308
+ };
309
+ /**
310
+ * Select a listed session as current (mirror of the runtime ISessions.open)
311
+ * — used to jump back to the main agent from the topology root node.
312
+ */
313
+ open?(id: string): void;
314
+ /**
315
+ * Fork a session from a completed-turn prefix of the source and resolve
316
+ * the child session id (mirror of the runtime ISessions.fork — throws on
317
+ * failure). The Side Chat "save as new session" action uses this to
318
+ * promote a hidden side thread into a top-level session.
319
+ */
320
+ fork?(opts: {
321
+ sessionId: string;
322
+ atSeq?: number;
323
+ increaseTitle?: boolean;
324
+ }): Promise<string>;
325
+ /**
326
+ * Resolve the stable session binding of one listed session (mirror of the
327
+ * runtime ISessions.binding); the saved-session rename uses the face's
328
+ * behavior verbs.
329
+ */
330
+ binding?(id: string): {
331
+ session: {
332
+ rename(title: string): Promise<unknown>;
333
+ };
334
+ } | undefined;
335
+ /**
336
+ * Resolve an Agent-scoped context view for one session (mirror of the
337
+ * runtime ISessions.scope) — the ticket `ctx.conversation.input.for`
338
+ * requires to reach that session's composer.
339
+ */
340
+ scope(id: string): Context | undefined;
341
+ /**
342
+ * Open a healthy catalog child through its exact direct-parent address
343
+ * (mirror of the runtime ISessions.openSubagent).
344
+ */
345
+ openSubagent?(address: SidebarSubagentAddress): void;
346
+ /**
347
+ * Resolve an already discovered direct-parent address without opening it.
348
+ */
349
+ subagentAddress?(id: string): SidebarSubagentAddress | undefined;
350
+ /**
351
+ * Mark whether a catalog surface is consuming live membership updates.
352
+ */
353
+ setSubagentCatalogOpen?(parentSessionId: string, open: boolean): void;
354
+ /**
355
+ * Refresh one direct-child catalog.
356
+ */
357
+ refreshSubagents?(parentSessionId: string): Promise<void>;
358
+ }
359
+ /**
360
+ * The client locale service face (mirror of @deepseek-ai/dsh-client-locale's
361
+ * LocaleRuntime — only the slices the sidebar touches). The sidebar follows
362
+ * the DSH i18n system: the active locale is the Host-backed preference
363
+ * (`locale.preference` in settings.yaml) rather than the raw browser
364
+ * language, and the sidebar's zh/en dictionaries register into the service's
365
+ * namespace registry under `betterSidebar`.
366
+ */
367
+ export interface SidebarLocaleService {
368
+ /** Current immutable locale snapshot (uSES-safe; `active` is 'zh' | 'en' today). */
369
+ getSnapshot(): {
370
+ active: string;
371
+ };
372
+ /** Subscribe to snapshot changes (locale switch or dictionary registration). */
373
+ subscribe(fn: () => void): () => void;
374
+ /** Register one locale's dictionary for a namespace; returns the disposer. */
375
+ register(ns: string, locale: string, dict: Record<string, string>): () => void;
376
+ }
377
+ /** The composer draft face the sidebar reaches through `ctx.conversation.input`. */
378
+ export interface SidebarSessionInput {
379
+ /** The live input store (draft read for append). */
380
+ state: {
381
+ getSnapshot(): {
382
+ draft: string;
383
+ };
384
+ };
385
+ /** Replace the draft text (the input machine's single public write path). */
386
+ setDraft(text: string): void;
387
+ }
388
+ /** The composer draft face the sidebar reaches through `ctx.get('conversation')`. */
389
+ export interface SidebarConversation {
390
+ input: {
391
+ for(actx: Context): SidebarSessionInput;
392
+ };
393
+ }
394
+ /**
395
+ * The client workspaces service face (mirror of the runtime IWorkspaces). Only
396
+ * the chat's file-open funnel is touched: `openPath` hands an absolute path
397
+ * to the Host OS's default application, and every chat-side file open
398
+ * (tool rows, produced-files, prose mentions) funnels through it.
399
+ */
400
+ export interface SidebarWorkspacesService {
401
+ /** Open a filesystem path with the Host operating system's default application. */
402
+ openPath(path: string): Promise<void>;
403
+ }
404
+ /**
405
+ * The invariant service face (mirror of @deepseek-ai/dsh-invariants'
406
+ * InvariantRegistry). The upstream augmentation does not reach this Context
407
+ * (dual-cordis-instance resolution), so the register signature is restated
408
+ * structurally, exactly like the other service faces above.
409
+ */
410
+ export interface SidebarInvariantsService {
411
+ /** Reserve one package's checks and install them in the service's child fiber. */
412
+ register(packageName: string, installer: (ctx: Context, fail: (message: string) => never) => void | Promise<void>): () => void;
413
+ }
414
+ /** The settings service face (mirror of @deepseek-ai/dsh-settings' SettingsProvider). */
415
+ export interface SidebarSettingsService {
416
+ /**
417
+ * Register one namespace schema (the resolved value layers schema defaults,
418
+ * then the composition base, then the user document).
419
+ */
420
+ register<T>(ns: string, schema: unknown, options?: {
421
+ base?: Partial<T>;
422
+ applies?: 'live' | 'restart';
423
+ }): {
424
+ get(): T;
425
+ watch(callback: (next: T, prev: T) => void | Promise<void>): () => void;
426
+ update(patch: object): Promise<void>;
427
+ replace(section: object): Promise<void>;
428
+ };
429
+ /** Redacted descriptors of every registered namespace (secrets stripped). */
430
+ describe(options?: {
431
+ redactSecrets?: boolean;
432
+ }): Array<{
433
+ ns: string;
434
+ value?: unknown;
435
+ base?: unknown;
436
+ user?: unknown;
437
+ applies: 'live' | 'restart';
438
+ revision: number;
439
+ }>;
440
+ /** Service-level merge write with the revision guard (a stale writer is refused). */
441
+ update(ns: string, patch: object, expectedRevision?: number): Promise<void>;
442
+ }
443
+ /**
444
+ * The tools service face (mirror of @deepseek-ai/dsh-tools' ToolRuntime).
445
+ * The host half registers model-facing tools here; the registry attaches the
446
+ * returned disposer to the contributing fiber so unloading unregisters them.
447
+ */
448
+ export interface SidebarToolsService {
449
+ /** Register one tool definition (raw JSON-Schema or defineTool-sugar form). */
450
+ register(tool: unknown): () => void;
451
+ }
452
+ /**
453
+ * The agent face a tool sees on `exec.agent` (mirror of @deepseek-ai/dsh-agent's
454
+ * Agent). Only the slices the terminal tools touch are restated: the live
455
+ * session identity and its header cwd, both readonly.
456
+ */
457
+ export interface SidebarAgent {
458
+ /** The live session identity shared with the session log. */
459
+ readonly id: string;
460
+ /** The live session this agent drives. */
461
+ readonly session: {
462
+ /** The session's header (validated cwd, lineage metadata). */
463
+ readonly header: {
464
+ readonly cwd?: string;
465
+ };
466
+ };
467
+ }
468
+ /**
469
+ * The shape this plugin actually consumes, intersected with the vendored
470
+ * cordis `Context` below (see the file header for why intersection is used
471
+ * instead of module augmentation).
472
+ */
473
+ export interface SidebarContextShape {
474
+ /** The webServer service face this plugin uses. */
475
+ webServer: SidebarWebServer;
476
+ /** The session store (host `.get`) and the client list feed (`.list`) faces. */
477
+ sessions: SidebarSessionStore & SidebarSessionsService;
478
+ /** The web runtime trust list (bind-derived). */
479
+ webRuntime: SidebarWebRuntime;
480
+ /** The client slot registry (register/inject). */
481
+ slots: SidebarSlotsService;
482
+ /** The client workspaces service face (file-open funnel). */
483
+ workspaces: SidebarWorkspacesService;
484
+ /** The settings service face (prefs persistence + namespace reads). */
485
+ settings: SidebarSettingsService;
486
+ /** The invariant registry face. */
487
+ invariants: SidebarInvariantsService;
488
+ /** The tool registry face. */
489
+ tools: SidebarToolsService;
490
+ /** The client locale service face. */
491
+ locale: SidebarLocaleService;
492
+ /** The client module system (rc.8+ chunk-loader externals). */
493
+ modules: {
494
+ import(specifier: string): Promise<unknown>;
495
+ };
496
+ /** The host background-job registry (optional; routes degrade to 503). */
497
+ jobs: SidebarJobsService;
498
+ /** The host live-agent registry (optional; side chat thread agents). */
499
+ agents: SidebarAgentsService;
500
+ /** The host subagent runtime (optional; live topology batch route). */
501
+ subagents: SidebarSubagentsService;
502
+ /** The host agent-presets service (optional; side chat cold resume). */
503
+ agentPresets: SidebarAgentPresetsService;
504
+ /** The host session-title service (optional; side chat thread label pin). */
505
+ sessionTitle: SidebarSessionTitleService;
506
+ /** The host session-persistence service (optional; side chat cold resume). */
507
+ sessionPersistence: SidebarSessionPersistenceService;
508
+ /** The composer draft face (client ui-conversation, lazy `ctx.get` probe). */
509
+ conversation: SidebarConversation;
510
+ /**
511
+ * The client-side sidebar registry: external plugins register tab types
512
+ * and file previewers here. Provided by the client half (see
513
+ * {@link ./client/index.tsx}); undefined on the host side.
514
+ */
515
+ betterSidebar: BetterSidebarService;
516
+ /**
517
+ * String-keyed session feed subscribe (the vendored cordis `on` is keyed
518
+ * to its typed Events map; the harness session feed is a plain string
519
+ * event). The listener receives every appended session event with the
520
+ * LIVE Session instance that appended it.
521
+ */
522
+ on(event: string, listener: (session: unknown, event: SidebarSessionEvent) => void): () => void;
523
+ }
524
+ /**
525
+ * The Context this plugin sees: the vendored cordis Context intersected with
526
+ * the structural service faces above. Re-exported from the package root so a
527
+ * consumer can `import type { Context } from 'dsh-better-sidebar'`.
528
+ */
529
+ export type Context = CordisContext & SidebarContextShape;
530
+ /**
531
+ * Consumer-facing augmentation (deliberately the only one kept): a plugin
532
+ * that imports `Context` from `@deepseek-ai/cordis` and does
533
+ * `import type {} from 'dsh-better-sidebar'` sees `ctx.betterSidebar`
534
+ * without importing this package's own Context type.
535
+ */
536
+ declare module '@deepseek-ai/cordis' {
537
+ interface Context {
538
+ betterSidebar: BetterSidebarService;
539
+ }
540
+ }