@morlay/dsh-conversation 0.0.0-stage → 0.2.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 (116) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +49 -2
  3. package/dist/contract-DgH7vjO7.mjs +20 -0
  4. package/dist/contract.d.mts +3 -0
  5. package/dist/contract.mjs +3 -0
  6. package/dist/decorate-g56z_1VW.mjs +8 -0
  7. package/dist/endpoint.d.mts +42 -0
  8. package/dist/endpoint.mjs +50 -0
  9. package/dist/first-prompt-llm.service-BYX1KK4Z.mjs +100 -0
  10. package/dist/first-prompt-llm.service-DVcR15W4.d.mts +55 -0
  11. package/dist/index-BOtIdC0T.d.mts +45 -0
  12. package/dist/index.d.mts +6 -0
  13. package/dist/index.mjs +6 -0
  14. package/dist/server.d.mts +211 -0
  15. package/dist/server.mjs +372 -0
  16. package/dist/session-title.contract-1UPlQFwN.mjs +17 -0
  17. package/dist/session-title.contract-C3tGUiK2.d.mts +132 -0
  18. package/dist/testing.d.mts +14 -0
  19. package/dist/testing.mjs +24 -0
  20. package/dist/tool-results.group-BEGx5hXv.mjs +17 -0
  21. package/dist/tool-results.group-BUjXDYDr.d.mts +16 -0
  22. package/dist/ui.d.mts +531 -0
  23. package/dist/ui.mjs +6678 -0
  24. package/package.json +120 -3
  25. package/src/contract/api-session.contract.ts +182 -0
  26. package/src/contract/conversation-client.contract.ts +13 -0
  27. package/src/contract/index.ts +26 -0
  28. package/src/contract/input-triggers.contract.ts +15 -0
  29. package/src/contract/session-controller.contract.ts +11 -0
  30. package/src/contract/session-title.contract.ts +30 -0
  31. package/src/contract/ui-conversation.contract.ts +15 -0
  32. package/src/contract/ui-session-status.contract.ts +15 -0
  33. package/src/contract/ui-session.contract.ts +16 -0
  34. package/src/contract/ui-workspace.contract.ts +83 -0
  35. package/src/deliverable.service.ts +74 -0
  36. package/src/endpoint/file-references.group.ts +43 -0
  37. package/src/endpoint/index.ts +8 -0
  38. package/src/endpoint/session-reference.group.ts +43 -0
  39. package/src/endpoint/tool-results.group.ts +35 -0
  40. package/src/first-prompt-llm.service.ts +38 -0
  41. package/src/index.ts +16 -0
  42. package/src/server/api-session.provide.ts +232 -0
  43. package/src/server/client-settings-defaults.service.ts +39 -0
  44. package/src/server/conversation-server.provide.ts +33 -0
  45. package/src/server/deliverable.provide.ts +5 -0
  46. package/src/server/first-prompt-llm.provide.ts +5 -0
  47. package/src/server/index.ts +24 -0
  48. package/src/server/open-in-app.service.ts +52 -0
  49. package/src/server/session-controller.remote.ts +11 -0
  50. package/src/server/session-reference.provide.ts +15 -0
  51. package/src/server/session-reference.service.ts +58 -0
  52. package/src/server/session-remote.provide.ts +31 -0
  53. package/src/server/session-status.service.ts +36 -0
  54. package/src/server/session-title.provide.ts +5 -0
  55. package/src/server/tool-results-endpoint.service.ts +56 -0
  56. package/src/server/tool-results.service.ts +59 -0
  57. package/src/session-title.service.ts +38 -0
  58. package/src/testing/index.ts +35 -0
  59. package/src/ui/agent-scopes.service.ts +20 -0
  60. package/src/ui/approval-slot.ts +33 -0
  61. package/src/ui/approval.provide.ts +5 -0
  62. package/src/ui/approval.service.ts +12 -0
  63. package/src/ui/conversation/attachment-slots.ts +23 -0
  64. package/src/ui/conversation/chat-slots.ts +67 -0
  65. package/src/ui/conversation/conversation-slots.ts +90 -0
  66. package/src/ui/conversation/conversation.token.ts +6 -0
  67. package/src/ui/conversation/file-actions-slots.ts +40 -0
  68. package/src/ui/conversation/index.ts +13 -0
  69. package/src/ui/conversation/message-quotes-slot.ts +34 -0
  70. package/src/ui/conversation/open-in-app-slots.ts +64 -0
  71. package/src/ui/conversation/secret-mask-slot.ts +23 -0
  72. package/src/ui/conversation/subagent-slots.ts +31 -0
  73. package/src/ui/conversation/tool-slots.ts +27 -0
  74. package/src/ui/conversation/trajectory-slot.ts +49 -0
  75. package/src/ui/conversation/workflow-run-slot.ts +31 -0
  76. package/src/ui/conversation-ui.provide.ts +32 -0
  77. package/src/ui/deliverable.provide.ts +14 -0
  78. package/src/ui/deliverable.slot.ts +46 -0
  79. package/src/ui/index.ts +64 -0
  80. package/src/ui/input/command-ui-slot.ts +45 -0
  81. package/src/ui/input/index.ts +5 -0
  82. package/src/ui/input/input-trigger-slot.ts +27 -0
  83. package/src/ui/input/input.token.ts +2 -0
  84. package/src/ui/input/reference-slot.ts +42 -0
  85. package/src/ui/model-selection-slots.ts +50 -0
  86. package/src/ui/permission-slots.provide.ts +10 -0
  87. package/src/ui/permission-ui.provide.ts +5 -0
  88. package/src/ui/ports.ts +3 -0
  89. package/src/ui/projections/projections.service.ts +220 -0
  90. package/src/ui/projections/provide.ts +11 -0
  91. package/src/ui/remote-namespace.ts +24 -0
  92. package/src/ui/remote-session.ts +220 -0
  93. package/src/ui/session-controller.service.ts +335 -0
  94. package/src/ui/session-layout.ts +44 -0
  95. package/src/ui/session-reference-endpoint.client.ts +37 -0
  96. package/src/ui/session-scope.contribution.ts +81 -0
  97. package/src/ui/session-status-slots.ts +45 -0
  98. package/src/ui/session-submission.ts +108 -0
  99. package/src/ui/session-ui.provide.ts +51 -0
  100. package/src/ui/sessions.provide.ts +48 -0
  101. package/src/ui/setting-ui.provide.ts +35 -0
  102. package/src/ui/settings-general-slots.ts +66 -0
  103. package/src/ui/settings-host.ts +28 -0
  104. package/src/ui/settings-models-slots.ts +43 -0
  105. package/src/ui/shell/directory-picker-native-slots.ts +83 -0
  106. package/src/ui/shell/index.ts +74 -0
  107. package/src/ui/shell/rightbar-seats.ts +321 -0
  108. package/src/ui/shell/session-panel-slots.ts +33 -0
  109. package/src/ui/shell/sidebar-document-preview-slots.ts +62 -0
  110. package/src/ui/shell/sidebar-slots.ts +33 -0
  111. package/src/ui/shell/workspace-slots.ts +75 -0
  112. package/src/ui/ui-permission.service.ts +78 -0
  113. package/src/ui/ui-session.token.ts +5 -0
  114. package/src/ui/ui-settings.token.ts +9 -0
  115. package/src/ui/upstream-context.ts +27 -0
  116. package/src/ui/user-questions-slots.ts +39 -0
@@ -0,0 +1,321 @@
1
+ // 右栏座位(归会话域):**直接渲染上游组件** `RightbarRoot` / `RightbarSeat`,不再自己实现壳。
2
+ //
3
+ // 之前不敢用的原因是它们依赖 `sessions`;现在座位本来就在会话域(`inject(SessionController)`),那个阻塞消失。
4
+ // 我们只做装配:`SidebarSessionViews`(每会话 reference)、store(控制器 adopt 的那一份)、`SidebarRightInjected`、
5
+ // guide 的类型与正文/标题注册、角位 `ExpandButton`。壳内的一切(dockkit 的 pane、拆分布局、标签条)都是上游的。
6
+ import type { SidebarRightTabRegistry } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/tab-registry.ts";
7
+ import { inject, Injectable, type OnDispose, type OnInit } from "@morlay/zephyr";
8
+ import {
9
+ ContextMenus,
10
+ Layout,
11
+ Locale,
12
+ Shortcuts,
13
+ Slots,
14
+ SidebarRightRow,
15
+ SidebarRightTabs,
16
+ SidebarRightTabsHandle,
17
+ } from "@morlay/zephyr-app/client";
18
+ import { createSidebarRightStore } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/stores.ts";
19
+ import { defaultSeed } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/contract/seed.ts";
20
+ import {
21
+ RightbarSeat,
22
+ type SidebarRightInjected,
23
+ } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/shell/SidebarRight.tsx";
24
+ import { RightbarRoot } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/shell/RightbarRoot.tsx";
25
+ import { ExpandButton } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/shell/ExpandButton.tsx";
26
+ import {
27
+ GuideBody,
28
+ type GuideInjected,
29
+ } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/tabs/guide/GuideBody.tsx";
30
+ import { GuideTitle } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/tabs/guide/GuideTitle.tsx";
31
+ import {
32
+ GUIDE_ID,
33
+ guideDefinition,
34
+ } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/tabs/guide/definition.ts";
35
+ import { createGuidePins } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/tabs/guide/guide-pins.ts";
36
+ import {
37
+ guideTabInfoFactory,
38
+ tabInfoFactory,
39
+ } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/tab-info.ts";
40
+ import { SidebarSessionViews } from "@deepseek-ai/dsh-client-ui-sidebar-right/src/client/session-views.ts";
41
+ import { SessionController } from "../../contract/index.ts";
42
+
43
+ /** 上游右栏文案命名空间(组件内部的 `t` 都读它,字典由框架的 `SidebarRightDefault` 注册)。 */
44
+ const NS = "sidebarRight";
45
+
46
+ /** 右栏座位装配行:两个座位 + 角位按钮 + guide 的类型/正文/标题,全部是上游组件。 */
47
+ @Injectable()
48
+ export class RightbarSeats implements OnInit, OnDispose {
49
+ private readonly slots = inject(Slots);
50
+
51
+ private readonly row = inject(SidebarRightRow);
52
+
53
+ /** 类型注册面(上游投影):注册 / 清单 / 订阅 / `guide` / `get` 都从它读。 */
54
+ private readonly tabs = inject(SidebarRightTabs);
55
+
56
+ /**
57
+ * 内核句柄(`SidebarRightTabsHandle`,我们这层的独立契约,**不是** `SidebarRightTabs` 上的 `face`)。
58
+ *
59
+ * 为什么不读契约上的 `face`:那个契约与上游 `sidebarRightTabs` 同名,dsh 形态下 `inject` 拿到的是
60
+ * **上游注册表实例**,我们多加的成员在那里是 `undefined`——类型上看不出来,真机上是渲染期
61
+ * `Cannot read properties of undefined (reading 'guide')`(`registerDynamic` 同一形态)。
62
+ *
63
+ * **可选注入 + 装配期 fail loud**(不静默退化):本行的前置是装配里装了 `provideSidebarRight()`
64
+ * (它给出右栏内核与控制器)。缺它时每会话 store 没有「默认页」的来源,右栏会**空着且不报错**——
65
+ * 那正是右栏排查了八轮的那个坑。所以宁可在这里抛(文案直指漏装哪一条),也不返回空 store。
66
+ */
67
+ private readonly handle = inject.optional(SidebarRightTabsHandle);
68
+
69
+ private readonly sessions = inject(SessionController);
70
+
71
+ private readonly locale = inject(Locale);
72
+
73
+ private readonly shortcuts = inject(Shortcuts);
74
+
75
+ private readonly layout = inject(Layout);
76
+
77
+ private readonly contextMenus = inject(ContextMenus);
78
+
79
+ /** 每个会话一个独立视图(reference 的 retain/release 由它管)。 */
80
+ private views: SidebarSessionViews | undefined;
81
+
82
+ /** guide 卡片的钉住状态。 */
83
+ private readonly pins = createGuidePins();
84
+
85
+ /**
86
+ * 内核实例(句柄给的上游注册表)。**只在 `onInit` 之后读**:句柄缺失在校验处已经抛了。
87
+ *
88
+ * `defaultSeed` 的入参类型是上游**类**(带私有成员,契约结构上赋不过去),所以这一跳必须走句柄,
89
+ * 不能直接传 `this.tabs`。
90
+ */
91
+ private get kernel(): SidebarRightTabRegistry {
92
+ const handle = this.handle;
93
+ if (handle === undefined) {
94
+ throw new Error(
95
+ "rightbar 座位缺 SidebarRightTabsHandle:装配里漏了 provideSidebarRight()" +
96
+ "(每会话 store 的默认页要从右栏内核读,缺它右栏会空着且不报错)",
97
+ );
98
+ }
99
+ return handle.face;
100
+ }
101
+
102
+ /** 交给渲染器的 store:`create(key)` 用控制器 adopt 的那一份。 */
103
+ private readonly storeHandle = createSidebarRightStore(() => defaultSeed(this.kernel));
104
+
105
+ private readonly store = {
106
+ ...this.storeHandle,
107
+ create: (scopeKey?: string) => {
108
+ if (scopeKey === undefined) return this.storeHandle.create();
109
+ return this.row.surfaceOf(scopeKey) ?? this.storeHandle.create(scopeKey);
110
+ },
111
+ };
112
+
113
+ private readonly disposers: (() => void)[] = [];
114
+
115
+ onInit(): void {
116
+ // **装配期先核一次句柄**:store 的 seed 是 thunk,缺句柄要到「第一次开一格」才炸,而那时界面已经
117
+ // 空着、栈也指不到装配清单。这里提前抛,排查点就落在装上。
118
+ void this.kernel;
119
+ const views = new SidebarSessionViews(this.sessions);
120
+ this.views = views;
121
+ const t = this.locale.bind(NS);
122
+ const injected = this.injected();
123
+ const tabTypes = {
124
+ getSnapshot: () => this.tabs.entries(),
125
+ subscribe: (listener: () => void) => this.tabs.subscribe(listener),
126
+ };
127
+ this.disposers.push(
128
+ this.row.mounted.subscribe(() => {
129
+ views.select(this.row.mounted.getSnapshot() as never);
130
+ }),
131
+ );
132
+ views.select(this.row.mounted.getSnapshot() as never);
133
+ this.disposers.push(
134
+ this.slots.inject("rightbar", () => {
135
+ const undo: (() => void)[] = [];
136
+ undo.push(
137
+ this.slots.register(
138
+ {
139
+ name: "rightbar",
140
+ children: { "rightbar.session": { kind: "single", scope: "session" } },
141
+ inject: () => ({
142
+ hooks: { views: views.source },
143
+ mountView: (reference: never) => views.mount(reference),
144
+ }),
145
+ } as never,
146
+ RightbarRoot as never,
147
+ ),
148
+ );
149
+ undo.push(
150
+ this.slots.register(
151
+ {
152
+ name: "rightbar.session",
153
+ locale: NS,
154
+ store: this.store,
155
+ children: {
156
+ "sidebar.right.pane.tab": {
157
+ kind: "keyed",
158
+ scope: "session",
159
+ inject: { hooks: { tabInfo: tabInfoFactory } },
160
+ },
161
+ "sidebar.right.pane.tab.title": {
162
+ kind: "keyed",
163
+ scope: "session",
164
+ inject: { hooks: { tabInfo: tabInfoFactory } },
165
+ },
166
+ },
167
+ inject: (sessionId: string) => ({
168
+ ...injected,
169
+ // 照上游 `index.ts:250-262`:`measureRoom` 是**按会话**的——规则记进该会话的 rooms 表。
170
+ // 座位测完(`measureRoom(canSplitPane)`)后,控制器的 `canSplitPane` 就有了结论:
171
+ // 窄栏时「分栏」不再静默生效。
172
+ measureRoom: (canSplitPane: (paneId: string) => boolean) => {
173
+ this.row.measureRoom(sessionId, canSplitPane);
174
+ },
175
+ hooks: {
176
+ contextMenuTarget: this.contextMenus.active,
177
+ shortcuts: this.shortcuts.catalog,
178
+ tabTypes,
179
+ flash: this.row.flashOf(sessionId as never),
180
+ },
181
+ closeTab: (tabId: never) => {
182
+ this.row.close(tabId as never);
183
+ },
184
+ keyedHooks: {
185
+ tabNavigation: (key: string) =>
186
+ this.row.tabDomain.occurrence(sessionId as never, { id: key as never })
187
+ .navigation,
188
+ },
189
+ occurrence: (tab: { id: string }) =>
190
+ this.row.tabDomain.occurrence(sessionId as never, { id: tab.id as never }),
191
+ }),
192
+ } as never,
193
+ RightbarSeat as never,
194
+ ),
195
+ );
196
+ undo.push(
197
+ this.slots.inject("sidebar.right.pane.tab", () => {
198
+ const guideUndo: (() => void)[] = [];
199
+ guideUndo.push(
200
+ this.slots.register(
201
+ {
202
+ name: "sidebar.right.pane.tab",
203
+ key: GUIDE_ID,
204
+ locale: NS,
205
+ children: {
206
+ "sidebar.right.tab.guide.actions": { kind: "list", scope: "root" },
207
+ // guide 的子槽传的 `hookContext` 是 **`useTabInfo` 函数本身**(胶囊只要「点一下开那一页」),
208
+ // 所以这里要用上游的 `guideTabInfoFactory`(`(_standard, useTabInfo) => useTabInfo`);
209
+ // 用通用的 `tabInfoFactory` 会把函数当 `TabHookContext` 对象读 → `useStore is not a function`。
210
+ "sidebar.right.tab.guide.entry": {
211
+ kind: "keyed",
212
+ scope: "session",
213
+ inject: { hooks: { tabInfo: guideTabInfoFactory } },
214
+ },
215
+ "sidebar.right.tab.guide": {
216
+ kind: "chain",
217
+ scope: "session",
218
+ inject: { hooks: { tabInfo: guideTabInfoFactory } },
219
+ },
220
+ },
221
+ inject: (): GuideInjected => ({
222
+ hooks: {
223
+ shortcuts: this.shortcuts.catalog,
224
+ guideEntries: {
225
+ getSnapshot: () => this.tabs.guide(),
226
+ subscribe: (listener: () => void) => this.tabs.subscribe(listener),
227
+ },
228
+ entryPins: this.pins.unpinned,
229
+ entryActions: {
230
+ getSnapshot: () =>
231
+ this.slots.entriesOfSlot("sidebar.right.tab.guide.actions").length > 0,
232
+ subscribe: (listener: () => void) =>
233
+ this.slots.subscribe("sidebar.right.tab.guide.actions", listener),
234
+ },
235
+ },
236
+ setPinned: this.pins.setPinned,
237
+ }),
238
+ } as never,
239
+ GuideBody as never,
240
+ ),
241
+ );
242
+ guideUndo.push(
243
+ this.slots.register(
244
+ { name: "sidebar.right.pane.tab.title", key: GUIDE_ID, locale: NS } as never,
245
+ GuideTitle as never,
246
+ ),
247
+ );
248
+ return () => {
249
+ for (const dispose of guideUndo.splice(0).reverse()) dispose();
250
+ };
251
+ }),
252
+ );
253
+ undo.push(
254
+ this.slots.inject("conversation.session.header.corner", () =>
255
+ this.slots.register(
256
+ {
257
+ name: "conversation.session.header.corner",
258
+ locale: NS,
259
+ store: this.store,
260
+ inject: () => ({ hooks: { shortcuts: this.shortcuts.catalog } }),
261
+ } as never,
262
+ ExpandButton as never,
263
+ ),
264
+ ),
265
+ );
266
+ return () => {
267
+ for (const dispose of undo.splice(0).reverse()) dispose();
268
+ };
269
+ }),
270
+ );
271
+ // **HMR 容忍,不是允许重复注册**:dev 热更新会替换本模块,但旧实例的 `onDispose` 不会跑,
272
+ // registry(由 `SidebarRightTabsDefault` 持有)里上一次的 guide 还在 → 再注册就抛
273
+ // 「tab kind "guide" is already registered」。生产里 `onInit` 只跑一次,走不到这个分支。
274
+ // 只跳过「同一个 guide id」,其它重复仍然会抛(不掩盖真 bug)。
275
+ if (this.tabs.get(GUIDE_ID) === undefined) {
276
+ this.disposers.push(this.tabs.register(guideDefinition(t)));
277
+ }
278
+ }
279
+
280
+ /**
281
+ * 座位注入面里与「页面周边」有关的那几个(不含按会话的 hooks / occurrence)。
282
+ *
283
+ * `measureRoom` **不在**这里:它是按会话的(规则记进该会话的 rooms 表),由 `inject(sessionId)` 那层覆盖。
284
+ */
285
+ private injected(): Pick<
286
+ SidebarRightInjected,
287
+ "syncPresentation" | "reportAutoFullscreen" | "openTab" | "splitPane" | "toggleFullscreen"
288
+ > {
289
+ return {
290
+ // 三个参数都要转:漏了 `fullscreen`(写死 `false`)时「全屏」这个状态推不到布局层
291
+ // (上游 `index.ts:221-224` 是 `openRightbar(track, fullscreen)`)。
292
+ syncPresentation: ({ shown, track, fullscreen }) => {
293
+ if (shown) this.layout.openRightbar(track, fullscreen);
294
+ else this.layout.closeRightbar();
295
+ },
296
+ // 控制器真的读这个值:`toggleFullscreen` 判「是不是已经全屏」时走 `host.autoFullscreen()`
297
+ // (上游 `service.ts:777`)。写 no-op 就等于那条判定永远按 `false` 走。
298
+ reportAutoFullscreen: (value) => {
299
+ this.row.reportAutoFullscreen(value);
300
+ },
301
+ openTab: (kind, options) => {
302
+ this.row.openTab(kind, options);
303
+ },
304
+ // 照上游 `index.ts:226-227` 的两行:`splitPane` 直接转;`toggleFullscreen` **先取 target 再传**
305
+ // (它要判 `isTargetCurrent` / `host === 'float'` / `isExpanded`)。
306
+ splitPane: (paneId) => {
307
+ this.row.split(paneId);
308
+ },
309
+ toggleFullscreen: () => {
310
+ const target = this.row.commandTarget();
311
+ if (target !== undefined) this.row.toggleFullscreen(target);
312
+ },
313
+ };
314
+ }
315
+
316
+ onDispose(): void {
317
+ for (const dispose of this.disposers.splice(0)) dispose();
318
+ this.views?.dispose();
319
+ this.views = undefined;
320
+ }
321
+ }
@@ -0,0 +1,33 @@
1
+ // 会话面板(上游 `ui-session-panel` 的 client 行):会话头部的开关 + Chat View aside 里的浮动面板。
2
+ //
3
+ // 它是 0.2.3 起 `panel.section` / `panel.indicator` / `panel.fold` / `panel.details` 这些槽位的
4
+ // **声明方**——`job-list`(`background-jobs`)、`subagent-list`(`subagents`)以及它们运行中的
5
+ // 指示点都注册在这些位置下。不装它,那些注册无处挂:条目不会出现在界面上。
6
+ //
7
+ // 上游的 `export const inject` 是 `['slots', 'locale', 'remote', 'uiResponsive']`:`uiResponsive` 是 alpha.3
8
+ // 新增的响应式行(组件读的 `useMediaQuery` / `useMobile` 由它发布,这里只负责按序交出去)。
9
+ import * as UiSessionPanelPlugin from "@deepseek-ai/dsh-client-ui-session-panel/client";
10
+ import { inject, Injectable, type Context } from "@morlay/zephyr";
11
+ import { fromCordis } from "@morlay/zephyr/compat";
12
+ import { Locale, Remote, Slots, UiResponsive } from "@morlay/zephyr-app/client";
13
+
14
+ /** 会话面板行(浏览器半):声明会话面板区的槽位并渲染 Environment 一节。 */
15
+ @Injectable()
16
+ export class SessionPanelSlots extends fromCordis(UiSessionPanelPlugin) {
17
+ private readonly slots = inject(Slots);
18
+
19
+ private readonly locale = inject(Locale);
20
+
21
+ private readonly remote = inject(Remote);
22
+
23
+ private readonly uiResponsive = inject(UiResponsive);
24
+
25
+ override async onInit(ctx: Context): Promise<void> {
26
+ await this.mount(ctx, undefined, {
27
+ slots: this.slots,
28
+ locale: this.locale,
29
+ remote: this.remote,
30
+ uiResponsive: this.uiResponsive,
31
+ });
32
+ }
33
+ }
@@ -0,0 +1,62 @@
1
+ // 右栏的「文件预览」标签(上游 `ui-sidebar-documentpreview` 的 client 半)。
2
+ //
3
+ // 它 claim 的是 `dsh-resource://file/session/<sessionId>/<path>` 这类 tab 地址——没有它,
4
+ // 从文件树点开一个文件会抛 `sidebarRight: no registered tab type claims "dsh-resource://file/…"`。
5
+ import * as UiDocumentPreviewPlugin from "@deepseek-ai/dsh-client-ui-sidebar-documentpreview/client";
6
+ import { inject, Injectable, type Context } from "@morlay/zephyr";
7
+ import { fromCordis } from "@morlay/zephyr/compat";
8
+ import {
9
+ ConfigForms,
10
+ FileDragDefault,
11
+ fixedSyncedConfig,
12
+ Locale,
13
+ Remote,
14
+ Resources,
15
+ Slots,
16
+ } from "@morlay/zephyr-app/client";
17
+ import { workspaceFilesGroupName } from "@morlay/dsh-workspace/endpoint";
18
+ import { remoteNamespaceKey } from "@morlay/zephyr-app/client/remote";
19
+ import { SidebarRightTabs } from "../ports.ts";
20
+
21
+ @Injectable()
22
+ export class SidebarDocumentPreviewSlots extends fromCordis(UiDocumentPreviewPlugin) {
23
+ private readonly slots = inject(Slots);
24
+
25
+ private readonly locale = inject(Locale);
26
+
27
+ private readonly remote = inject(Remote);
28
+
29
+ private readonly configForms = inject(ConfigForms);
30
+
31
+ private readonly resources = inject(Resources);
32
+
33
+ /**
34
+ * tab 类型注册表:令牌带上游注册名 `sidebarRightTabs`,与 `ctx.get('sidebarRightTabs')` 同一份实例。
35
+ *
36
+ * **这条边靠行序**:注册表是 `SidebarRightSlots` 在 mount 里按名字发布的(值令牌没有实现类,
37
+ * 装配器在该行挂完之后才把它认进令牌表),所以 `provideSessionShellSlots()` 里发布方必须排在本行之前。
38
+ */
39
+ private readonly sidebarRightTabs = inject(SidebarRightTabs);
40
+
41
+ /**
42
+ * 拖拽面:本仓 `ui-file-drag` 那一行(`FileDragDefault`)的真身,上游按 `ctx.fileDrag` 读它。
43
+ *
44
+ * 这条边进依赖图(类令牌有提供者),所以**不靠行序**:那一行排在清单哪里都行。
45
+ */
46
+ private readonly fileDrag = inject(FileDragDefault);
47
+
48
+ override async onInit(ctx: Context): Promise<void> {
49
+ // 上游 0.2.3 起这份 client 的 `Config` 由 Host 同步(`office` / `excel` 两档上限):没通道时给"未配置"。
50
+ await this.mount(ctx, fixedSyncedConfig(["office", "excel"]), {
51
+ slots: this.slots,
52
+ locale: this.locale,
53
+ remote: this.remote,
54
+ configForms: this.configForms,
55
+ resources: this.resources,
56
+ sidebarRightTabs: this.sidebarRightTabs,
57
+ fileDrag: this.fileDrag,
58
+ // 带点的名字按字面键给。
59
+ [remoteNamespaceKey(workspaceFilesGroupName())]: this.remote,
60
+ });
61
+ }
62
+ }
@@ -0,0 +1,33 @@
1
+ // 上游侧栏骨架(client 行):品牌、新建会话、panellist、设置与折叠全部由 `ui-sidebar` 渲染。
2
+ //
3
+ // 骨架是 `sidebar` 那个 single 位置的声明方——`sidebar.workspaces` 里的上游 `WorkspaceBrowser`、
4
+ // `sidebar.settings`、`sidebar.footer.action` 这些条目都挂在它下面。
5
+ import * as UiSidebarPlugin from "@deepseek-ai/dsh-client-ui-sidebar/client";
6
+ import { inject, Injectable, type Context } from "@morlay/zephyr";
7
+ import { fromCordis } from "@morlay/zephyr/compat";
8
+ import { Layout, Locale, Shortcuts, Slots } from "@morlay/zephyr-app/client";
9
+ import { UiWorkspace } from "@morlay/dsh-conversation/contract";
10
+
11
+ @Injectable()
12
+ export class SidebarSlots extends fromCordis(UiSidebarPlugin) {
13
+ private readonly slots = inject(Slots);
14
+
15
+ private readonly layout = inject(Layout);
16
+
17
+ /** 「新建会话」按钮走 `uiWorkspace.startSession()`(它会先选当前/最近的 workspace)。 */
18
+ private readonly uiWorkspace = inject(UiWorkspace);
19
+
20
+ private readonly locale = inject(Locale);
21
+
22
+ private readonly shortcuts = inject(Shortcuts);
23
+
24
+ override async onInit(ctx: Context): Promise<void> {
25
+ await this.mount(ctx, undefined, {
26
+ slots: this.slots,
27
+ layout: this.layout,
28
+ uiWorkspace: this.uiWorkspace,
29
+ locale: this.locale,
30
+ shortcuts: this.shortcuts,
31
+ });
32
+ }
33
+ }
@@ -0,0 +1,75 @@
1
+ // 工作区域的行(上游 `ui-workspace` 的 client 半):工作区与会话树,对外面 `ctx.uiWorkspace`。
2
+ //
3
+ // **插槽注册在对话域、实现在 workspace 域**:上游 `ui-workspace` 的 `inject` 里有 `uiSession` 与
4
+ // `uiSession.sessionStatus`(未读标记)——这两个服务的 home 是会话界面契约面,而 workspace 域反过来
5
+ // 被对话域依赖,直接 import 就是包级环。所以这一行(只做「装上游 + 交 deps + 注册槽位」)住在会话域,
6
+ // 工作区的数据面(`WorkspaceController` / 远程绑定 / 文件资源)留在 `@morlay/dsh-workspace`。
7
+ import * as UiWorkspacePlugin from "@deepseek-ai/dsh-client-ui-workspace/client";
8
+ import { inject, Injectable, type Context } from "@morlay/zephyr";
9
+ import { fixedSyncedConfig } from "@morlay/zephyr-app/client";
10
+ import { fromCordis } from "@morlay/zephyr/compat";
11
+ import {
12
+ ContextMenus,
13
+ Layout,
14
+ Locale,
15
+ Remote,
16
+ RemoteAccess,
17
+ Shortcuts,
18
+ Slots,
19
+ } from "@morlay/zephyr-app/client";
20
+ import { remoteNamespaceKey } from "@morlay/zephyr-app/client/remote";
21
+ import { SessionController } from "@morlay/dsh-session/endpoint";
22
+ import { UiSession, UiSessionStatus } from "@morlay/dsh-conversation/contract";
23
+ import { WorkspaceController } from "@morlay/dsh-workspace/endpoint";
24
+ import { UiWorkspace } from "@morlay/dsh-conversation/contract";
25
+ import { directoryPickerGroupName } from "@morlay/dsh-workspace/endpoint";
26
+
27
+ @Injectable()
28
+ export class WorkspaceSlots extends fromCordis(UiWorkspace, UiWorkspacePlugin) {
29
+ private readonly slots = inject(Slots);
30
+
31
+ private readonly remote = inject(Remote);
32
+
33
+ private readonly locale = inject(Locale);
34
+
35
+ private readonly layout = inject(Layout);
36
+
37
+ private readonly shortcuts = inject(Shortcuts);
38
+
39
+ private readonly remoteAccess = inject(RemoteAccess);
40
+
41
+ private readonly workspaces = inject(WorkspaceController);
42
+
43
+ /** 行内右键菜单:上游在它自己的行 ctx 上发布,装配期由 `adoptNamedServices` 映射成同名令牌。 */
44
+ private readonly contextMenus = inject(ContextMenus);
45
+
46
+ /** 会话目录读面(`sessions`):合同在会话域的端点面,UI 只要读它。 */
47
+ private readonly sessions = inject(SessionController);
48
+
49
+ /** `uiSession`:上游 `ui-workspace` 的 `inject` 声明里有它,读的是未读标记(`uiSession.sessionStatus`)。 */
50
+ private readonly uiSession = inject(UiSession);
51
+
52
+ /** `uiSession.sessionStatus` 的子服务:`inject(令牌)` + deps **替换**上游那次按名读。 */
53
+ private readonly uiSessionStatus = inject(UiSessionStatus);
54
+
55
+ override async onInit(ctx: Context): Promise<void> {
56
+ // `ui-workspace` 的 inject 声明:`workspaces`(由 `workspace-controller` 行提供)、
57
+ // `locale` / `layout` / `shortcuts` / `remoteAccess`(我们的契约)、`remote.directoryPicker`(远程子面)。
58
+ // 上游 0.2.3 起这份 client 的 `Config` 由 Host 同步(`recentViewLimit`):没有同步通道时给「未配置」。
59
+ await this.mount(ctx, fixedSyncedConfig(["recentViewLimit"]), {
60
+ contextMenus: this.contextMenus,
61
+ sessions: this.sessions,
62
+ uiSession: this.uiSession,
63
+ // 带点的名字按字面键给出(`fromCordis` 的 deps 校验逐字匹配)。
64
+ "uiSession.sessionStatus": this.uiSessionStatus,
65
+ slots: this.slots,
66
+ remote: this.remote,
67
+ locale: this.locale,
68
+ layout: this.layout,
69
+ shortcuts: this.shortcuts,
70
+ remoteAccess: this.remoteAccess,
71
+ workspaces: this.workspaces,
72
+ [remoteNamespaceKey(directoryPickerGroupName())]: this.remote,
73
+ });
74
+ }
75
+ }
@@ -0,0 +1,78 @@
1
+ // 权限的浏览器半:上游 `ui-permission-presets` 的 **client 行**。
2
+ //
3
+ // 入口必须是 `./client`:包根的 `index.ts` 是 node 半(空 `apply`),装它不会注册任何东西
4
+ // (输入区的档位选择器与设置里的默认档位行都来自 client 行的 `apply`)。
5
+ import * as UiPermissionPlugin from "@deepseek-ai/dsh-client-ui-permission-presets/client";
6
+ import { CommandUi } from "@morlay/dsh-command/ui";
7
+ import { SessionController } from "@morlay/dsh-conversation/contract";
8
+ import { inject, Injectable, type Context } from "@morlay/zephyr";
9
+ import { fromCordis } from "@morlay/zephyr/compat";
10
+ import {
11
+ ConfigForms,
12
+ ClientConnection,
13
+ Locale,
14
+ Remote,
15
+ SettingsSchema,
16
+ Slots,
17
+ } from "@morlay/zephyr-app/client";
18
+ import { SETTINGS_REMOTE } from "@morlay/dsh-setting/endpoint";
19
+ // 远端身份只从 `./endpoint`(client-safe)取:包根带三个宿主 service,浏览器半引不得。
20
+ import { PERMISSION_PRESETS_REMOTE } from "@morlay/dsh-permission/endpoint";
21
+ import { permissionPresetsGroupName } from "@morlay/dsh-permission/endpoint";
22
+ import { settingsGroupName } from "@morlay/dsh-setting/endpoint";
23
+ import { remoteNamespaceKey } from "@morlay/zephyr-app/client/remote";
24
+ import { namespaceOf } from "./remote-namespace.ts";
25
+
26
+ @Injectable()
27
+ export class UiPermission extends fromCordis(UiPermissionPlugin) {
28
+ private readonly remote = inject(Remote);
29
+
30
+ private readonly connection = inject(ClientConnection);
31
+
32
+ private readonly sessions = inject(SessionController);
33
+
34
+ private readonly slots = inject(Slots);
35
+
36
+ private readonly locale = inject(Locale);
37
+
38
+ private readonly configForms = inject(ConfigForms);
39
+
40
+ private readonly settingsSchema = inject(SettingsSchema);
41
+
42
+ /** 上游这一行把 `/permission` 的弹层装饰挂到命令 UI 上(`/` 面板里因此有这一条)。 */
43
+ private readonly commandUi = inject(CommandUi);
44
+
45
+ override async onInit(ctx: Context): Promise<void> {
46
+ // 权限面板读 「权限预设组」(预设目录)与 「设置组」(默认档位的读写)。
47
+ await this.remote.$mount(PERMISSION_PRESETS_REMOTE);
48
+ await this.remote.$mount(SETTINGS_REMOTE);
49
+ // `remote` 交给上游时**摊平成普通对象**:`Remote` 的命名空间是 Proxy 回落出来的动态属性,
50
+ // 而 cordis 服务名视图给的是包装层,上面读不到这些属性(实测 `ctx.remote.permissionPresets`
51
+ // 是 undefined,报错点漂成 `reading 'catalog'`)。这里把两条 face 与四个方法显式给出。
52
+ const remote = this.remote;
53
+ // `Remote` 契约本身不列 namespace(见 `remote.contract.ts`),这里按名字取两条 face。
54
+ const remoteForUi = {
55
+ permissionPresets: namespaceOf(remote, "permissionPresets"),
56
+ settings: namespaceOf(remote, "settings"),
57
+ $on: (channel: string, listener: (...args: never[]) => unknown): (() => void) =>
58
+ remote.$on(channel, listener),
59
+ $mount: (contribution: unknown): Promise<() => Promise<void>> => remote.$mount(contribution),
60
+ $stream: (options: Parameters<typeof remote.$stream>[0]): unknown => remote.$stream(options),
61
+ whenMounted: (): Promise<void> => remote.whenMounted(),
62
+ whenNamespace: (namespace: string): Promise<void> => remote.whenNamespace(namespace),
63
+ };
64
+ // 上游 client 行声明了这些依赖(含两个点号名):`fromCordis` 的适配行按 dep 名逐条校验并放进行作用域。
65
+ await this.mount(ctx, undefined, {
66
+ commandUi: this.commandUi,
67
+ connection: this.connection,
68
+ sessions: this.sessions,
69
+ slots: this.slots,
70
+ locale: this.locale,
71
+ remote: remoteForUi,
72
+ [remoteNamespaceKey(permissionPresetsGroupName())]: remoteForUi.permissionPresets,
73
+ [remoteNamespaceKey(settingsGroupName())]: remoteForUi.settings,
74
+ configForms: this.configForms,
75
+ settingsSchema: this.settingsSchema,
76
+ });
77
+ }
78
+ }
@@ -0,0 +1,5 @@
1
+ // `ui-session` 的服务令牌:跨行注入 `ctx.uiSession`(右侧面板、工作区等行都要读它)。
2
+ //
3
+ // home 在对话域的契约面(`@morlay/dsh-conversation/contract`):行与令牌同一个 owner,
4
+ // 别的域按令牌注入,不重复拥有上游那个面。
5
+ export { UiSession } from "@morlay/dsh-conversation/contract";
@@ -0,0 +1,9 @@
1
+ // 设置相关的跨行服务令牌:`settingsSchema`(`ui-settings` 行提供)。
2
+ //
3
+ // 这里只做**再导出**:令牌的 home 在 `@morlay/zephyr-app/client`(谁定义谁给面),本域不另立一份。
4
+ // 命令 UI 的真契约在
5
+ // `@morlay/dsh-command/ui`(`CommandUi` 抽象类,实现是上游 `ui-commands` 那一行),这里那份是
6
+ // 同名不同身份的第二个令牌,且零消费者——两份令牌 = 两次注册,注入端拿到的会是空。
7
+
8
+ /** `ctx.settingsSchema`(设置 schema 服务:按命名空间取字段描述)。 */
9
+ export { SettingsSchema } from "@morlay/zephyr-app/client";
@@ -0,0 +1,27 @@
1
+ // 本仓 `Context` → 上游 cordis `Context`:**唯一**的转换点。
2
+ //
3
+ // 两边运行期是同一个对象(zephyr 的 `Context` 就是 cordis `Context` 的扩展面);类型上分家是因为本仓
4
+ // 这一层补了显式成员(`logger` / `root` / `reflect` / `get` …),在 `exactOptionalPropertyTypes` 下
5
+ // "补得更多"并不等于"可赋值"(同一个成员在两边一个可选、一个必有,就互不兼容)。
6
+ //
7
+ // 另一头是 **cordis 的 `Context`**(上游 `ClientSessions` 的构造与 `scopeOf` / `sessionOf` 的入参),
8
+ // 不是本包能改的形状:zephyr 的 `compat/to-cordis.ts` 与 `compat/from-cordis.ts` 对同一条边也各断言
9
+ // 一次。所以这是一处**边界桥**(白名单见 devkit 的 `audit/rules.ts`),不是"先断言让它过"。
10
+ import type { ClientSessions } from "@deepseek-ai/dsh-api-session-controller/src/client/sessions/service.ts";
11
+ import type { Context } from "@morlay/zephyr";
12
+
13
+ /** 上游要的那份 ctx 类型(`ClientSessions` 各方法入参的 cordis `Context`)。 */
14
+ export type UpstreamContext = Parameters<ClientSessions["scopeOf"]>[0];
15
+
16
+ /**
17
+ * 本仓的 ctx 面换成上游 cordis `Context`。
18
+ *
19
+ * 现在只有一处需要它:装配时的**行 ctx**(本仓 `Context`)。契约的 `scopeOf` / `sessionOf` 入参已经是
20
+ * 上游要的 cordis `Context`(签名照上游声明),不再过这座桥。运行期是同一个对象(zephyr 的 `Context`
21
+ * 就是 cordis `Context` 的扩展面),所以交出的必须是它本身(不复制、不包装)。
22
+ * @param ctx - 本仓的 ctx 面。
23
+ * @returns 上游看到的同一个 ctx。
24
+ */
25
+ export function asUpstreamContext(ctx: Context): UpstreamContext {
26
+ return ctx as unknown as UpstreamContext;
27
+ }