@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,211 @@
1
+ import SessionControllerPlugin from "@deepseek-ai/dsh-api-session-controller";
2
+ import FileReferenceServicePlugin from "@deepseek-ai/dsh-file-reference-local";
3
+ import { SessionStatusService } from "@deepseek-ai/dsh-client-ui-session-status";
4
+ import { Context, OnDispose, ProviderFeature, ProviderList } from "@morlay/zephyr";
5
+ import { i as FileReferenceService, o as SessionControllerService } from "./session-title.contract-C3tGUiK2.mjs";
6
+ import SessionReferenceResolver$1 from "@deepseek-ai/dsh-session-reference";
7
+ import * as HostOpenInAppPlugin from "@deepseek-ai/dsh-host-open-in-app";
8
+ import SessionToolResults, { SessionToolResultRequest, SessionToolResultValue as SessionToolResultValue$1 } from "@deepseek-ai/dsh-client-ui-trajectory";
9
+ import { t as ToolResultsEndpoint } from "./tool-results.group-BUjXDYDr.mjs";
10
+ import { i as WorkspaceChangesDefault, n as SessionTitleDefault, r as DeliverablesHostDefault, t as SessionTitleLlm } from "./first-prompt-llm.service-DVcR15W4.mjs";
11
+ declare const SessionStatusHost_base: import("@morlay/zephyr/compat").AdaptedClass<import("@morlay/zephyr").TokenClass<unknown>, typeof SessionStatusService>;
12
+ /** 会话已读状态的宿主行。 */
13
+ declare class SessionStatusHost extends SessionStatusHost_base {
14
+ private readonly remoteAccess;
15
+ private readonly sessions;
16
+ private readonly sessionPersistence;
17
+ private readonly typert;
18
+ onInit(ctx: Context): Promise<void>;
19
+ }
20
+ declare const ApiSessionControllerHost_base: import("@morlay/zephyr/compat").AdaptedClass<typeof SessionControllerService, typeof SessionControllerPlugin>;
21
+ /**
22
+ * 上游 `SessionController`(`session` 组的全部端点)。
23
+ *
24
+ * 上游 `apply` 里的 `ctx.plugin(...)`(`fileReferences` / `mediaReferences` / `skillCatalog` /
25
+ * `archivedSessionGate`)在行 ctx 的分层下自行装载,清单不再复制它们。
26
+ */
27
+ export declare class ApiSessionControllerHost extends ApiSessionControllerHost_base {
28
+ /** 默认模型:新建 agent 时读它。 */
29
+ private readonly depDefaultModel;
30
+ /** agent 注册表:会话与 agent 一起建。 */
31
+ private readonly depAgents;
32
+ /** 附件:prompt 里的图片块经它准入与读取。 */
33
+ private readonly depAttachments;
34
+ /** 上传:prompt 里引用的上传件经它解析。 */
35
+ private readonly depUploads;
36
+ /** 文件系统:工作区路径解析与文件读取。 */
37
+ private readonly depFs;
38
+ /** 模型运行时:模型目录与调用配置。 */
39
+ private readonly depLlm;
40
+ /**
41
+ * 准入:**可选**。上游 `@Remote` 方法在分派前按资源判定;只装数据面的装配(纯端点测试)
42
+ * 没有它也能起来——准入是"加一道门",不是这条行能否工作的前提。
43
+ */
44
+ private readonly depRemoteAccess;
45
+ /** 会话存储(上游 `SessionStore` 的适配实例)。 */
46
+ private readonly depSessions;
47
+ /** 投影注册表:会话状态(权限档位、模型选择…)在宿主侧算。 */
48
+ private readonly depProjections;
49
+ /** 会话查询:列表、观测与轨迹。 */
50
+ private readonly depQuery;
51
+ /** 类型化 Remote 注册表:本行把自己登记进去。 */
52
+ private readonly depTypert;
53
+ /** 类型化 Remote 分发者:`typertGateway` 服务(我们自己的 discovery 实现)。 */
54
+ private readonly depGateway;
55
+ /** 工作区注册表:会话按 cwd 归属工作区。 */
56
+ private readonly depWorkspaces;
57
+ /**
58
+ * 连接面:上游没写进 `static inject`,但代码里读 `ctx.connection.fetch` / `.rpc`(上传下载的路由)。
59
+ * 不给它,装上之后第一次用到就 `Cannot read properties of undefined (reading 'fetch')`。
60
+ */
61
+ private readonly depConnection;
62
+ /**
63
+ * 工作区归属:**可选**。上游 `create` 只写 `header.cwd`,不 attach 工作区——那是 workspace 域的职责,
64
+ * 而它自己没有可用的挂点(`api-session/added` 在上游只有类型声明、没有 emit)。
65
+ * 所以在这里包一层 `create`:建完会话按 cwd 归属(这一层是适配面,不改上游源码)。
66
+ */
67
+ private readonly depWorkspace;
68
+ onInit(ctx: Context): Promise<void>;
69
+ /**
70
+ * 给上游的 `fork` 包一层:派生出的子会话要跟源会话在**同一个工作区**。
71
+ *
72
+ * 上游 `session/fork` 自己会把子会话 attach 到源会话的工作区(`commands.fork` 的 `forkWorkspace` +
73
+ * `workspace.attachSession`;子会话 cwd 继承源会话,所以那头按 cwd 的校验通过),但 attach 之后
74
+ * **不推任何帧**——侧栏的分组读 `workspace/follow`,于是子会话落在「未分组」,直到用户重连才归位。
75
+ * 所以这一层在 fork 之后补一次归属公告(`SessionWorkspace.attachDerived`:attach 幂等 + 广播 upsert)。
76
+ *
77
+ * 失败只留痕、不抛:子会话已经派生好了,公告失败不该让用户看到「派生失败」。
78
+ */
79
+ private attachWorkspaceOnFork;
80
+ /**
81
+ * 给上游的 `create` 包一层:建完会话后按 `header.cwd` 把它挂到对应工作区。
82
+ *
83
+ * 上游 `ApiSessionController.createSession` 只做「建会话 + 起 agent」,工作区归属由 workspace 域负责;
84
+ * 而那个域没有可用的挂点(`api-session/added` 上游没有 emit)。所以在适配层补这一层:
85
+ * 调原方法 → 拿 `sessionId/cwd` → `SessionWorkspace.resolve({ cwd }).attach(sessionId)`。
86
+ *
87
+ * **请求指名了 `workspaceId` 就按它挂**(不能再按 cwd 推导,那会把用户选的工作区换成
88
+ * "cwd 碰巧对应的那个");没指名才按 `cwd` 解析。两条都必须走这里——上游
89
+ * `ApiSessionController` 的 `workspaceRegistry` 只出现在 `static inject` 里,它**从不**把会话挂到
90
+ * 工作区,早退的结果是会话永远不在任何 `sessionIds` 里(界面上表现为"选了工作区,输入区还是
91
+ * 「选择工作区」且整条禁用")。
92
+ *
93
+ * 失败只留痕、不抛:归属失败不该让"建会话"这个动作失败。
94
+ */
95
+ private attachWorkspaceOnCreate;
96
+ }
97
+ declare const FileReferenceServiceRow_base: import("@morlay/zephyr/compat").AdaptedClass<typeof FileReferenceService, typeof FileReferenceServicePlugin>;
98
+ /**
99
+ * 上游 `LocalFileReferenceService`(`fileReferences` 服务):`@` 引用的候选来源。
100
+ *
101
+ * 上游把契约(\`abstract class FileReferenceService\`)与本地实现分成两个包;我们**只引用实现**,
102
+ * 候选逻辑一行不写。端点由 \`SessionFileReferences\` 那一行提供。
103
+ */
104
+ export declare class FileReferenceServiceRow extends FileReferenceServiceRow_base {
105
+ private readonly depFs;
106
+ private readonly depAgents;
107
+ private readonly depWorkingDirectory;
108
+ onInit(ctx: Context): Promise<void>;
109
+ }
110
+ /**
111
+ * 上游会话端点面的装配清单。
112
+ *
113
+ * 两步:先装子插件要用的 `fileReferences` 服务(上游 `LocalFileReferenceService`,我们只引用实现),
114
+ * 再装会话组的端点行。见债:子插件的装配口径。
115
+ */
116
+ export declare const provideApiSession: (...features: import("@morlay/zephyr").ProviderFeature[]) => readonly [typeof FileReferenceServiceRow, typeof ApiSessionControllerHost, typeof SessionStatusHost, import("@morlay/zephyr-app").RemoteDescriptorEntry];
117
+ export declare const provideSessionReference: (...features: import("@morlay/zephyr").ProviderFeature[]) => ProviderList;
118
+ /**
119
+ * 契约:上游 `SessionReferenceResolver` 挂载后不向容器提供对外服务(对象/函数插件),面为空。
120
+ *
121
+ * 写出来是硬要求——`fromCordis(契约, 实现)` 必须先说清这个插件是什么面。
122
+ */
123
+ declare abstract class SessionReferenceDefaultContract {}
124
+ declare const SessionReferenceDefault_base: import("@morlay/zephyr/compat").AdaptedClass<typeof SessionReferenceDefaultContract, typeof SessionReferenceResolver$1>;
125
+ export declare class SessionReferenceDefault extends SessionReferenceDefault_base {
126
+ private readonly sessionQuery;
127
+ private readonly agents;
128
+ onInit(ctx: Context): Promise<void>;
129
+ }
130
+ /**
131
+ * \`openInAppHost\` 的契约:这一行只注册 HTTP 路由,**不提供任何服务**。
132
+ *
133
+ * 写出来是为了让 \`fromCordis(契约, 实现)\` 的双参形态保持统一(装任何上游实现前先说清它的面)。
134
+ */
135
+ export declare abstract class OpenInAppHost {}
136
+ declare const OpenInAppHostRow_base: import("@morlay/zephyr/compat").AdaptedClass<typeof OpenInAppHost, typeof HostOpenInAppPlugin>;
137
+ export declare class OpenInAppHostRow extends OpenInAppHostRow_base {
138
+ /**
139
+ * 上游 `Config` 三个字段都是 `required()`(没有 schema 默认值):不给就抛。
140
+ *
141
+ * 取值按「开发机上一条命令的容忍度」:探测目录 5s、抽图标 10s(要跑 `sips`/`plutil`)、
142
+ * 启动观察窗 1.5s(超过就算已启动,进程继续留着)。
143
+ */
144
+ static readonly defaultConfig: {
145
+ probeTimeoutMs: number;
146
+ iconTimeoutMs: number;
147
+ launchWatchMs: number;
148
+ };
149
+ private readonly webServer;
150
+ private readonly connection;
151
+ private readonly subprocess;
152
+ onInit(ctx: Context): Promise<void>;
153
+ }
154
+ /** 契约:上游 `SessionToolResults` 对外的面(本行只声明 `watch`,类型直接取上游成员,不手抄)。 */
155
+ declare abstract class SessionToolResultsContract {
156
+ /** 逐帧给出「可用性 + 当前值」(`watch(request, signal)`)。 */
157
+ abstract readonly watch: SessionToolResults["watch"];
158
+ }
159
+ declare const ToolResultsDefault_base: import("@morlay/zephyr/compat").AdaptedClass<typeof SessionToolResultsContract, typeof SessionToolResults>;
160
+ /**
161
+ * `remote.toolResults` 的上游宿主服务。
162
+ *
163
+ * 适配行**发布的是上游实例**:`inject(ToolResultsDefault)` 拿到的就是 `SessionToolResults`
164
+ * (它挂上来的那一面),wire 端点行因此直接调 `watch`。
165
+ */
166
+ export declare class ToolResultsDefault extends ToolResultsDefault_base {
167
+ private readonly sessions;
168
+ private readonly typert;
169
+ onInit(ctx: Context): Promise<void>;
170
+ }
171
+ /** `toolResults` 组的宿主实现。 */
172
+ export declare class ToolResultsEndpointRow extends ToolResultsEndpoint implements OnDispose {
173
+ private readonly handlers;
174
+ /** 上游 `SessionToolResults` 的适配行发布的就是它本身(那条 `watch` 流)。 */
175
+ private readonly results;
176
+ private readonly disposers;
177
+ onInit(): void;
178
+ /**
179
+ * 逐帧给出某条工具结果的「可用性 + 当前值」。
180
+ * @param request - wire 的 `request`(`{ sessionId, seq }`;上游生成面也可能发平铺的同名字段)。
181
+ * @param signal - wire 的取消信号。
182
+ * @returns 逐帧的工具结果。
183
+ */
184
+ watch(request: SessionToolResultRequest, signal: AbortSignal): AsyncIterable<SessionToolResultValue$1>;
185
+ onDispose(): void;
186
+ }
187
+ export declare const provideSessionRemote: (...features: import("@morlay/zephyr").ProviderFeature[]) => readonly [typeof import("@morlay/dsh-session").SessionStoreDefault, typeof import("@morlay/dsh-session").SessionProjectionStoreDefault, typeof import("@morlay/dsh-session/server").SessionStatsDefault, typeof import("@morlay/dsh-session").SessionQuerySqlite, typeof ToolResultsDefault, typeof ToolResultsEndpointRow, typeof OpenInAppHostRow];
188
+ /**
189
+ * 对话域的**宿主半**:一份清单装完本包的宿主面。
190
+ *
191
+ * 三段各自的归属与顺序(同一次调用的内部顺序):
192
+ * 1. 会话数据面(store / 投影 / 查询)+ `toolResults`(`provideSessionRemote`,**自带三份 root**);
193
+ * 2. 会话引用解析(`sessionReferenceResolver`);
194
+ * 3. 会话端点(上游 `SessionController` 一族,要 agent / 附件 / 上传 / 工作区 / working-directory)。
195
+ * 4. 本域两条品牌浏览器端行(`ui-chat` / `ui-settings-general`)的**宿主半**:注册它们的 `Config`
196
+ * 并给装配层默认值(`ClientRowSettingsDefaults`)。它只碰 `SettingSchema`(optional),
197
+ * 所以装不装设置机制都不影响别的行。
198
+ *
199
+ * **不要再并列装 `provideSession()`**:第 1 段已经带了真 store 行,重复注册会抛
200
+ * `service "sessions" has been registered`。
201
+ *
202
+ * @param sessionRemoteFeatures - 只作用于第 1 段的清单变换(应用里会 `without(SessionQuerySqlite)` 换成 RDB 查询)。
203
+ * @returns provider 清单。
204
+ */
205
+ export declare function provideConversationServer(...sessionRemoteFeatures: ProviderFeature[]): ProviderList;
206
+ export declare const provideDeliverables: (...features: import("@morlay/zephyr").ProviderFeature[]) => readonly [typeof WorkspaceChangesDefault, typeof DeliverablesHostDefault];
207
+ /** 标题服务:默认预算在实现类里,装配面可 `configure` 覆盖。 */
208
+ export declare const provideSessionTitle: (...features: import("@morlay/zephyr").ProviderFeature[]) => readonly [typeof SessionTitleDefault];
209
+ /** 首条提示的 LLM 标题行:默认配置在实现类里,装配面可 `configure` 覆盖。 */
210
+ export declare const provideSessionTitleLlm: (...features: import("@morlay/zephyr").ProviderFeature[]) => readonly [typeof SessionTitleLlm];
211
+ export {};
@@ -0,0 +1,372 @@
1
+ import SessionControllerPlugin from "@deepseek-ai/dsh-api-session-controller";
2
+ import FileReferenceServicePlugin from "@deepseek-ai/dsh-file-reference-local";
3
+ import { AgentDefaultModel, AgentDirectory, Llm, WorkingDirectory } from "@morlay/dsh-agent";
4
+ import { AttachmentStore } from "@morlay/dsh-attachment";
5
+ import { FileSystem } from "@morlay/dsh-fs";
6
+ import { SessionProjectionStore, SessionQuery, SessionStore, SessionWorkspace } from "@morlay/dsh-session";
7
+ import { SESSION_CONTROLLER_REMOTE, SessionId } from "@morlay/dsh-session/endpoint";
8
+ import { SessionStatusService } from "@deepseek-ai/dsh-client-ui-session-status";
9
+ import { Injectable, inject, provide } from "@morlay/zephyr";
10
+ import { fromCordis } from "@morlay/zephyr/compat";
11
+ import { Connection, RemoteAccess, RemoteHandlers, SettingSchema, Typert, TypertGateway, WebServer, remoteDescriptor } from "@morlay/zephyr-app";
12
+ import { SessionPersistence } from "@morlay/dsh-session-persistence";
13
+ import { t as __decorate } from "./decorate-g56z_1VW.mjs";
14
+ import { FileUploadStore } from "@morlay/dsh-upload";
15
+ import { WorkspaceRegistry } from "@morlay/dsh-workspace";
16
+ import { n as FileReferenceService, r as SessionControllerService } from "./session-title.contract-1UPlQFwN.mjs";
17
+ import SessionReferenceResolver from "@deepseek-ai/dsh-session-reference";
18
+ import { provideSession, provideSessionProjection, provideSessionQuerySqlite } from "@morlay/dsh-session/server";
19
+ import * as HostOpenInAppPlugin from "@deepseek-ai/dsh-host-open-in-app";
20
+ import { Subprocess } from "@morlay/dsh-shell";
21
+ import SessionToolResults from "@deepseek-ai/dsh-client-ui-trajectory";
22
+ import { RemoteGroup, registerRemoteGroup } from "@morlay/zephyr-app/remote";
23
+ import { t as ToolResultsEndpoint } from "./tool-results.group-BEGx5hXv.mjs";
24
+ import * as UiChatPlugin from "@deepseek-ai/dsh-client-ui-chat";
25
+ import * as UiSettingsGeneralPlugin from "@deepseek-ai/dsh-client-ui-settings-general";
26
+ import { i as WorkspaceChangesDefault, n as SessionTitleDefault, r as DeliverablesHostDefault, t as SessionTitleLlm } from "./first-prompt-llm.service-BYX1KK4Z.mjs";
27
+ // src/server/session-status.service.ts
28
+ let SessionStatusHost = class SessionStatusHost extends fromCordis(SessionStatusService) {
29
+ remoteAccess = inject(RemoteAccess);
30
+ sessions = inject(SessionStore);
31
+ sessionPersistence = inject(SessionPersistence);
32
+ typert = inject(TypertGateway);
33
+ async onInit(ctx) {
34
+ await this.mount(ctx, void 0, {
35
+ remoteAccess: this.remoteAccess,
36
+ sessions: this.sessions,
37
+ sessionPersistence: this.sessionPersistence,
38
+ typert: this.typert
39
+ });
40
+ }
41
+ };
42
+ SessionStatusHost = __decorate([Injectable()], SessionStatusHost);
43
+ // src/server/api-session.provide.ts
44
+ let ApiSessionControllerHost = class ApiSessionControllerHost extends fromCordis(SessionControllerService, SessionControllerPlugin) {
45
+ /** 默认模型:新建 agent 时读它。 */
46
+ depDefaultModel = inject(AgentDefaultModel);
47
+ /** agent 注册表:会话与 agent 一起建。 */
48
+ depAgents = inject(AgentDirectory);
49
+ /** 附件:prompt 里的图片块经它准入与读取。 */
50
+ depAttachments = inject(AttachmentStore);
51
+ /** 上传:prompt 里引用的上传件经它解析。 */
52
+ depUploads = inject(FileUploadStore);
53
+ /** 文件系统:工作区路径解析与文件读取。 */
54
+ depFs = inject(FileSystem);
55
+ /** 模型运行时:模型目录与调用配置。 */
56
+ depLlm = inject(Llm);
57
+ /**
58
+ * 准入:**可选**。上游 `@Remote` 方法在分派前按资源判定;只装数据面的装配(纯端点测试)
59
+ * 没有它也能起来——准入是"加一道门",不是这条行能否工作的前提。
60
+ */
61
+ depRemoteAccess = inject.optional(RemoteAccess);
62
+ /** 会话存储(上游 `SessionStore` 的适配实例)。 */
63
+ depSessions = inject(SessionStore);
64
+ /** 投影注册表:会话状态(权限档位、模型选择…)在宿主侧算。 */
65
+ depProjections = inject(SessionProjectionStore);
66
+ /** 会话查询:列表、观测与轨迹。 */
67
+ depQuery = inject(SessionQuery);
68
+ /** 类型化 Remote 注册表:本行把自己登记进去。 */
69
+ depTypert = inject(Typert);
70
+ /** 类型化 Remote 分发者:`typertGateway` 服务(我们自己的 discovery 实现)。 */
71
+ depGateway = inject(TypertGateway);
72
+ /** 工作区注册表:会话按 cwd 归属工作区。 */
73
+ depWorkspaces = inject(WorkspaceRegistry);
74
+ /**
75
+ * 连接面:上游没写进 `static inject`,但代码里读 `ctx.connection.fetch` / `.rpc`(上传下载的路由)。
76
+ * 不给它,装上之后第一次用到就 `Cannot read properties of undefined (reading 'fetch')`。
77
+ */
78
+ depConnection = inject(Connection);
79
+ /**
80
+ * 工作区归属:**可选**。上游 `create` 只写 `header.cwd`,不 attach 工作区——那是 workspace 域的职责,
81
+ * 而它自己没有可用的挂点(`api-session/added` 在上游只有类型声明、没有 emit)。
82
+ * 所以在这里包一层 `create`:建完会话按 cwd 归属(这一层是适配面,不改上游源码)。
83
+ */
84
+ depWorkspace = inject.optional(SessionWorkspace);
85
+ async onInit(ctx) {
86
+ this.depTypert.remotes.register(SESSION_CONTROLLER_REMOTE);
87
+ const mounted = await this.mount(ctx, void 0, {
88
+ agentDefaultModel: this.depDefaultModel,
89
+ agents: this.depAgents,
90
+ attachments: this.depAttachments,
91
+ fileUploads: this.depUploads,
92
+ fs: this.depFs,
93
+ llm: this.depLlm,
94
+ remoteAccess: this.depRemoteAccess,
95
+ sessions: this.depSessions,
96
+ sessionProjections: this.depProjections,
97
+ sessionQuery: this.depQuery,
98
+ typert: this.depTypert,
99
+ typertGateway: this.depGateway,
100
+ workspaceRegistry: this.depWorkspaces,
101
+ connection: this.depConnection
102
+ });
103
+ this.attachWorkspaceOnCreate(mounted);
104
+ this.attachWorkspaceOnFork(mounted);
105
+ }
106
+ /**
107
+ * 给上游的 `fork` 包一层:派生出的子会话要跟源会话在**同一个工作区**。
108
+ *
109
+ * 上游 `session/fork` 自己会把子会话 attach 到源会话的工作区(`commands.fork` 的 `forkWorkspace` +
110
+ * `workspace.attachSession`;子会话 cwd 继承源会话,所以那头按 cwd 的校验通过),但 attach 之后
111
+ * **不推任何帧**——侧栏的分组读 `workspace/follow`,于是子会话落在「未分组」,直到用户重连才归位。
112
+ * 所以这一层在 fork 之后补一次归属公告(`SessionWorkspace.attachDerived`:attach 幂等 + 广播 upsert)。
113
+ *
114
+ * 失败只留痕、不抛:子会话已经派生好了,公告失败不该让用户看到「派生失败」。
115
+ */
116
+ attachWorkspaceOnFork(mounted) {
117
+ const workspace = this.depWorkspace;
118
+ const upstream = mounted;
119
+ if (workspace === void 0 || upstream === void 0 || typeof upstream.fork !== "function") return;
120
+ const original = upstream.fork.bind(upstream);
121
+ upstream.fork = async (...args) => {
122
+ const forked = await original(...args);
123
+ const childId = forked?.sessionId;
124
+ const sourceId = args[0]?.sessionId;
125
+ if (typeof childId !== "string" || typeof sourceId !== "string") return forked;
126
+ try {
127
+ await workspace.attachDerived(SessionId(childId), SessionId(sourceId));
128
+ } catch (error) {
129
+ console.warn(`[session-api] 派生的会话归属工作区失败(子会话本身已派生好):${error instanceof Error ? error.message : String(error)}`);
130
+ }
131
+ return forked;
132
+ };
133
+ }
134
+ /**
135
+ * 给上游的 `create` 包一层:建完会话后按 `header.cwd` 把它挂到对应工作区。
136
+ *
137
+ * 上游 `ApiSessionController.createSession` 只做「建会话 + 起 agent」,工作区归属由 workspace 域负责;
138
+ * 而那个域没有可用的挂点(`api-session/added` 上游没有 emit)。所以在适配层补这一层:
139
+ * 调原方法 → 拿 `sessionId/cwd` → `SessionWorkspace.resolve({ cwd }).attach(sessionId)`。
140
+ *
141
+ * **请求指名了 `workspaceId` 就按它挂**(不能再按 cwd 推导,那会把用户选的工作区换成
142
+ * "cwd 碰巧对应的那个");没指名才按 `cwd` 解析。两条都必须走这里——上游
143
+ * `ApiSessionController` 的 `workspaceRegistry` 只出现在 `static inject` 里,它**从不**把会话挂到
144
+ * 工作区,早退的结果是会话永远不在任何 `sessionIds` 里(界面上表现为"选了工作区,输入区还是
145
+ * 「选择工作区」且整条禁用")。
146
+ *
147
+ * 失败只留痕、不抛:归属失败不该让"建会话"这个动作失败。
148
+ */
149
+ attachWorkspaceOnCreate(mounted) {
150
+ const workspace = this.depWorkspace;
151
+ const upstream = mounted;
152
+ if (workspace === void 0 || upstream === void 0 || typeof upstream.create !== "function") return;
153
+ const original = upstream.create.bind(upstream);
154
+ upstream.create = async (request) => {
155
+ const created = await original(request);
156
+ const sessionId = created?.sessionId;
157
+ if (sessionId === void 0) return created;
158
+ const asked = request;
159
+ const cwd = this.depSessions.get(SessionId(String(sessionId)))?.header.cwd ?? asked?.cwd;
160
+ try {
161
+ await (await workspace.resolve(asked?.workspaceId === void 0 ? cwd === void 0 ? {} : { cwd } : { workspaceId: asked.workspaceId })).attach(SessionId(sessionId));
162
+ } catch (error) {
163
+ console.warn(`[session-api] 会话归属工作区失败(会话本身已建好):${error instanceof Error ? error.message : String(error)}`);
164
+ }
165
+ return created;
166
+ };
167
+ }
168
+ };
169
+ ApiSessionControllerHost = __decorate([Injectable()], ApiSessionControllerHost);
170
+ let FileReferenceServiceRow = class FileReferenceServiceRow extends fromCordis(FileReferenceService, FileReferenceServicePlugin) {
171
+ depFs = inject(FileSystem);
172
+ depAgents = inject(AgentDirectory);
173
+ depWorkingDirectory = inject(WorkingDirectory);
174
+ async onInit(ctx) {
175
+ await this.mount(ctx, void 0, {
176
+ fs: this.depFs,
177
+ agents: this.depAgents,
178
+ workingDirectory: this.depWorkingDirectory
179
+ });
180
+ }
181
+ };
182
+ FileReferenceServiceRow = __decorate([Injectable()], FileReferenceServiceRow);
183
+ /**
184
+ * 上游会话端点面的装配清单。
185
+ *
186
+ * 两步:先装子插件要用的 `fileReferences` 服务(上游 `LocalFileReferenceService`,我们只引用实现),
187
+ * 再装会话组的端点行。见债:子插件的装配口径。
188
+ */
189
+ const provideApiSession = provide([
190
+ FileReferenceServiceRow,
191
+ ApiSessionControllerHost,
192
+ SessionStatusHost,
193
+ remoteDescriptor(() => import("@deepseek-ai/dsh-api-session-controller/remote"))
194
+ ]);
195
+ // src/server/session-reference.service.ts
196
+ /**
197
+ * 适配面拿到的上游实例是 `unknown`(上游没发布服务时 `undefined`):按运行时校验收窄。
198
+ * @param value - 适配行挂载后拿到的上游实例。
199
+ * @returns `remoteExportCandidates` 是函数时是真。
200
+ */
201
+ function isSessionReferenceFace(value) {
202
+ return value !== null && typeof value === "object" && "remoteExportCandidates" in value && typeof value.remoteExportCandidates === "function";
203
+ }
204
+ /**
205
+ * `maxReferenceBytes`:上游 schema 里是**必填**(`z.number().step(1).min(1)`,无默认),
206
+ * 由装配面给一个确定的部署值。8 MiB 与上游 web-app bundle 的会话引用上限同一量级:
207
+ * 引用进上下文的字节预算,超过就不再引用更多会话。
208
+ */
209
+ const MAX_REFERENCE_BYTES = 8388608;
210
+ /**
211
+ * 契约:上游 `SessionReferenceResolver` 挂载后不向容器提供对外服务(对象/函数插件),面为空。
212
+ *
213
+ * 写出来是硬要求——`fromCordis(契约, 实现)` 必须先说清这个插件是什么面。
214
+ */
215
+ let SessionReferenceDefaultContract = class SessionReferenceDefaultContract {};
216
+ SessionReferenceDefaultContract = __decorate([Injectable()], SessionReferenceDefaultContract);
217
+ let SessionReferenceDefault = class SessionReferenceDefault extends fromCordis(SessionReferenceDefaultContract, SessionReferenceResolver) {
218
+ sessionQuery = inject(SessionQuery);
219
+ agents = inject(AgentDirectory);
220
+ async onInit(ctx) {
221
+ const resolver = await this.mount(ctx, { maxReferenceBytes: MAX_REFERENCE_BYTES }, { sessionQuery: this.sessionQuery });
222
+ if (resolver === void 0 || !isSessionReferenceFace(resolver)) throw new Error("sessionReferenceResolver: 上游实例缺少 remoteExportCandidates");
223
+ }
224
+ };
225
+ SessionReferenceDefault = __decorate([Injectable()], SessionReferenceDefault);
226
+ // src/server/session-reference.provide.ts
227
+ const providers = () => [SessionReferenceDefault, remoteDescriptor(() => import("@deepseek-ai/dsh-session-reference/remote"))];
228
+ const provideSessionReference = provide(providers());
229
+ // src/server/open-in-app.service.ts
230
+ let OpenInAppHost = class OpenInAppHost {};
231
+ OpenInAppHost = __decorate([Injectable()], OpenInAppHost);
232
+ let OpenInAppHostRow = class OpenInAppHostRow extends fromCordis(OpenInAppHost, HostOpenInAppPlugin) {
233
+ /**
234
+ * 上游 `Config` 三个字段都是 `required()`(没有 schema 默认值):不给就抛。
235
+ *
236
+ * 取值按「开发机上一条命令的容忍度」:探测目录 5s、抽图标 10s(要跑 `sips`/`plutil`)、
237
+ * 启动观察窗 1.5s(超过就算已启动,进程继续留着)。
238
+ */
239
+ static defaultConfig = {
240
+ probeTimeoutMs: 5e3,
241
+ iconTimeoutMs: 1e4,
242
+ launchWatchMs: 1500
243
+ };
244
+ webServer = inject(WebServer);
245
+ connection = inject(Connection);
246
+ subprocess = inject(Subprocess);
247
+ async onInit(ctx) {
248
+ await this.mount(ctx, void 0, {
249
+ webServer: this.webServer,
250
+ connection: this.connection,
251
+ subprocess: this.subprocess
252
+ });
253
+ }
254
+ };
255
+ OpenInAppHostRow = __decorate([Injectable()], OpenInAppHostRow);
256
+ // src/server/tool-results.service.ts
257
+ /**
258
+ * 适配面拿到的上游实例是 `unknown`(上游没发布服务时 `undefined`):按运行时校验收窄。
259
+ * @param value - 适配行挂载后拿到的上游实例。
260
+ * @returns `watch` 是函数时是真。
261
+ */
262
+ function isToolResultsFace(value) {
263
+ return value !== null && typeof value === "object" && "watch" in value && typeof value.watch === "function";
264
+ }
265
+ /** 契约:上游 `SessionToolResults` 对外的面(本行只声明 `watch`,类型直接取上游成员,不手抄)。 */
266
+ let SessionToolResultsContract = class SessionToolResultsContract {};
267
+ SessionToolResultsContract = __decorate([Injectable()], SessionToolResultsContract);
268
+ let ToolResultsDefault = class ToolResultsDefault extends fromCordis(SessionToolResultsContract, SessionToolResults) {
269
+ sessions = inject(SessionStore);
270
+ typert = inject(Typert);
271
+ async onInit(ctx) {
272
+ await this.mount(ctx, void 0, {
273
+ sessions: this.sessions,
274
+ typert: this.typert
275
+ });
276
+ }
277
+ };
278
+ ToolResultsDefault = __decorate([Injectable()], ToolResultsDefault);
279
+ // src/server/tool-results-endpoint.service.ts
280
+ let ToolResultsEndpointRow = class ToolResultsEndpointRow extends ToolResultsEndpoint {
281
+ handlers = inject(RemoteHandlers);
282
+ /** 上游 `SessionToolResults` 的适配行发布的就是它本身(那条 `watch` 流)。 */
283
+ results = inject(ToolResultsDefault);
284
+ disposers = [];
285
+ onInit() {
286
+ if (!isToolResultsFace(this.results)) throw new Error("toolResults: 上游实例缺少 watch");
287
+ this.disposers.push(registerRemoteGroup(this.handlers, this));
288
+ }
289
+ /**
290
+ * 逐帧给出某条工具结果的「可用性 + 当前值」。
291
+ * @param request - wire 的 `request`(`{ sessionId, seq }`;上游生成面也可能发平铺的同名字段)。
292
+ * @param signal - wire 的取消信号。
293
+ * @returns 逐帧的工具结果。
294
+ */
295
+ watch(request, signal) {
296
+ return this.results.watch({
297
+ sessionId: SessionId(String(request.sessionId)),
298
+ seq: Number(request.seq)
299
+ }, signal);
300
+ }
301
+ onDispose() {
302
+ for (const dispose of this.disposers.splice(0)) dispose();
303
+ }
304
+ };
305
+ ToolResultsEndpointRow = __decorate([RemoteGroup(), Injectable()], ToolResultsEndpointRow);
306
+ // src/server/session-remote.provide.ts
307
+ const provideSessionRemote = provide([
308
+ ...provideSession(),
309
+ ...provideSessionProjection(),
310
+ ...provideSessionQuerySqlite(),
311
+ ToolResultsDefault,
312
+ ToolResultsEndpointRow,
313
+ OpenInAppHostRow
314
+ ]);
315
+ // ../../../vendor/deepseek-harness/packages/client/ui-settings-models/src/onboarding-copy.ts
316
+ /** Durable settings namespace for product-wide GUI onboarding facts. */
317
+ const WELCOME_NOTICE_SETTINGS_NAMESPACE = "ui-settings-general";
318
+ /**
319
+ * Bump only when the notice changes materially and every user should see it
320
+ * again. The acknowledgement is compared for exact equality.
321
+ */
322
+ const WELCOME_NOTICE_VERSION = "2026-09-28.1";
323
+ // src/server/client-settings-defaults.service.ts
324
+ let ClientRowSettingsDefaults = class ClientRowSettingsDefaults {
325
+ /**
326
+ * 配置 schema 注册表。
327
+ *
328
+ * optional:设置机制(`provideSetting()`)**不属于**本包的宿主面,装配里不装它时这一行没有读者
329
+ * (它注册的就是设置页要读的默认值)。装配器按 inject 声明拓扑排序,装了设置机制的装配必然排在本行之前。
330
+ */
331
+ schemas = inject.optional(SettingSchema);
332
+ onInit() {
333
+ this.schemas?.register(UiChatPlugin.CHAT_SETTINGS_NAMESPACE, UiChatPlugin.Config, { transcriptView: "verbose" });
334
+ this.schemas?.register(WELCOME_NOTICE_SETTINGS_NAMESPACE, UiSettingsGeneralPlugin.Config, { welcomeNoticeVersion: WELCOME_NOTICE_VERSION });
335
+ }
336
+ };
337
+ ClientRowSettingsDefaults = __decorate([Injectable()], ClientRowSettingsDefaults);
338
+ // src/server/conversation-server.provide.ts
339
+ /**
340
+ * 对话域的**宿主半**:一份清单装完本包的宿主面。
341
+ *
342
+ * 三段各自的归属与顺序(同一次调用的内部顺序):
343
+ * 1. 会话数据面(store / 投影 / 查询)+ `toolResults`(`provideSessionRemote`,**自带三份 root**);
344
+ * 2. 会话引用解析(`sessionReferenceResolver`);
345
+ * 3. 会话端点(上游 `SessionController` 一族,要 agent / 附件 / 上传 / 工作区 / working-directory)。
346
+ * 4. 本域两条品牌浏览器端行(`ui-chat` / `ui-settings-general`)的**宿主半**:注册它们的 `Config`
347
+ * 并给装配层默认值(`ClientRowSettingsDefaults`)。它只碰 `SettingSchema`(optional),
348
+ * 所以装不装设置机制都不影响别的行。
349
+ *
350
+ * **不要再并列装 `provideSession()`**:第 1 段已经带了真 store 行,重复注册会抛
351
+ * `service "sessions" has been registered`。
352
+ *
353
+ * @param sessionRemoteFeatures - 只作用于第 1 段的清单变换(应用里会 `without(SessionQuerySqlite)` 换成 RDB 查询)。
354
+ * @returns provider 清单。
355
+ */
356
+ function provideConversationServer(...sessionRemoteFeatures) {
357
+ return [
358
+ ...provideSessionRemote(...sessionRemoteFeatures),
359
+ ...provideSessionReference(),
360
+ ...provideApiSession(),
361
+ ClientRowSettingsDefaults
362
+ ];
363
+ }
364
+ // src/server/deliverable.provide.ts
365
+ const provideDeliverables = provide([WorkspaceChangesDefault, DeliverablesHostDefault]);
366
+ // src/server/session-title.provide.ts
367
+ /** 标题服务:默认预算在实现类里,装配面可 `configure` 覆盖。 */
368
+ const provideSessionTitle = provide([SessionTitleDefault]);
369
+ // src/server/first-prompt-llm.provide.ts
370
+ /** 首条提示的 LLM 标题行:默认配置在实现类里,装配面可 `configure` 覆盖。 */
371
+ const provideSessionTitleLlm = provide([SessionTitleLlm]);
372
+ export { ApiSessionControllerHost, FileReferenceServiceRow, OpenInAppHost, OpenInAppHostRow, SessionReferenceDefault, ToolResultsDefault, ToolResultsEndpointRow, provideApiSession, provideConversationServer, provideDeliverables, provideSessionReference, provideSessionRemote, provideSessionTitle, provideSessionTitleLlm };
@@ -0,0 +1,17 @@
1
+ import { t as __decorate } from "./decorate-g56z_1VW.mjs";
2
+ import { Injectable } from "@morlay/zephyr";
3
+ // src/contract/api-session.contract.ts
4
+ let SessionControllerService = class SessionControllerService {};
5
+ SessionControllerService = __decorate([Injectable({ name: "sessionController" })], SessionControllerService);
6
+ let FileReferenceService = class FileReferenceService {};
7
+ FileReferenceService = __decorate([Injectable({ name: "fileReferences" })], FileReferenceService);
8
+ let SessionFileReferencesService = class SessionFileReferencesService {};
9
+ SessionFileReferencesService = __decorate([Injectable({ name: "sessionFileReferences" })], SessionFileReferencesService);
10
+ let SessionSkillCatalogService = class SessionSkillCatalogService {};
11
+ SessionSkillCatalogService = __decorate([Injectable({ name: "sessionSkillCatalog" })], SessionSkillCatalogService);
12
+ let SessionMediaReferencesService = class SessionMediaReferencesService {};
13
+ SessionMediaReferencesService = __decorate([Injectable()], SessionMediaReferencesService);
14
+ // src/contract/session-title.contract.ts
15
+ let SessionTitle = class SessionTitle {};
16
+ SessionTitle = __decorate([Injectable({ name: "sessionTitle" })], SessionTitle);
17
+ export { SessionMediaReferencesService as a, SessionFileReferencesService as i, FileReferenceService as n, SessionSkillCatalogService as o, SessionControllerService as r, SessionTitle as t };