@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.
- package/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/contract-DgH7vjO7.mjs +20 -0
- package/dist/contract.d.mts +3 -0
- package/dist/contract.mjs +3 -0
- package/dist/decorate-g56z_1VW.mjs +8 -0
- package/dist/endpoint.d.mts +42 -0
- package/dist/endpoint.mjs +50 -0
- package/dist/first-prompt-llm.service-BYX1KK4Z.mjs +100 -0
- package/dist/first-prompt-llm.service-DVcR15W4.d.mts +55 -0
- package/dist/index-BOtIdC0T.d.mts +45 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +6 -0
- package/dist/server.d.mts +211 -0
- package/dist/server.mjs +372 -0
- package/dist/session-title.contract-1UPlQFwN.mjs +17 -0
- package/dist/session-title.contract-C3tGUiK2.d.mts +132 -0
- package/dist/testing.d.mts +14 -0
- package/dist/testing.mjs +24 -0
- package/dist/tool-results.group-BEGx5hXv.mjs +17 -0
- package/dist/tool-results.group-BUjXDYDr.d.mts +16 -0
- package/dist/ui.d.mts +531 -0
- package/dist/ui.mjs +6678 -0
- package/package.json +120 -3
- package/src/contract/api-session.contract.ts +182 -0
- package/src/contract/conversation-client.contract.ts +13 -0
- package/src/contract/index.ts +26 -0
- package/src/contract/input-triggers.contract.ts +15 -0
- package/src/contract/session-controller.contract.ts +11 -0
- package/src/contract/session-title.contract.ts +30 -0
- package/src/contract/ui-conversation.contract.ts +15 -0
- package/src/contract/ui-session-status.contract.ts +15 -0
- package/src/contract/ui-session.contract.ts +16 -0
- package/src/contract/ui-workspace.contract.ts +83 -0
- package/src/deliverable.service.ts +74 -0
- package/src/endpoint/file-references.group.ts +43 -0
- package/src/endpoint/index.ts +8 -0
- package/src/endpoint/session-reference.group.ts +43 -0
- package/src/endpoint/tool-results.group.ts +35 -0
- package/src/first-prompt-llm.service.ts +38 -0
- package/src/index.ts +16 -0
- package/src/server/api-session.provide.ts +232 -0
- package/src/server/client-settings-defaults.service.ts +39 -0
- package/src/server/conversation-server.provide.ts +33 -0
- package/src/server/deliverable.provide.ts +5 -0
- package/src/server/first-prompt-llm.provide.ts +5 -0
- package/src/server/index.ts +24 -0
- package/src/server/open-in-app.service.ts +52 -0
- package/src/server/session-controller.remote.ts +11 -0
- package/src/server/session-reference.provide.ts +15 -0
- package/src/server/session-reference.service.ts +58 -0
- package/src/server/session-remote.provide.ts +31 -0
- package/src/server/session-status.service.ts +36 -0
- package/src/server/session-title.provide.ts +5 -0
- package/src/server/tool-results-endpoint.service.ts +56 -0
- package/src/server/tool-results.service.ts +59 -0
- package/src/session-title.service.ts +38 -0
- package/src/testing/index.ts +35 -0
- package/src/ui/agent-scopes.service.ts +20 -0
- package/src/ui/approval-slot.ts +33 -0
- package/src/ui/approval.provide.ts +5 -0
- package/src/ui/approval.service.ts +12 -0
- package/src/ui/conversation/attachment-slots.ts +23 -0
- package/src/ui/conversation/chat-slots.ts +67 -0
- package/src/ui/conversation/conversation-slots.ts +90 -0
- package/src/ui/conversation/conversation.token.ts +6 -0
- package/src/ui/conversation/file-actions-slots.ts +40 -0
- package/src/ui/conversation/index.ts +13 -0
- package/src/ui/conversation/message-quotes-slot.ts +34 -0
- package/src/ui/conversation/open-in-app-slots.ts +64 -0
- package/src/ui/conversation/secret-mask-slot.ts +23 -0
- package/src/ui/conversation/subagent-slots.ts +31 -0
- package/src/ui/conversation/tool-slots.ts +27 -0
- package/src/ui/conversation/trajectory-slot.ts +49 -0
- package/src/ui/conversation/workflow-run-slot.ts +31 -0
- package/src/ui/conversation-ui.provide.ts +32 -0
- package/src/ui/deliverable.provide.ts +14 -0
- package/src/ui/deliverable.slot.ts +46 -0
- package/src/ui/index.ts +64 -0
- package/src/ui/input/command-ui-slot.ts +45 -0
- package/src/ui/input/index.ts +5 -0
- package/src/ui/input/input-trigger-slot.ts +27 -0
- package/src/ui/input/input.token.ts +2 -0
- package/src/ui/input/reference-slot.ts +42 -0
- package/src/ui/model-selection-slots.ts +50 -0
- package/src/ui/permission-slots.provide.ts +10 -0
- package/src/ui/permission-ui.provide.ts +5 -0
- package/src/ui/ports.ts +3 -0
- package/src/ui/projections/projections.service.ts +220 -0
- package/src/ui/projections/provide.ts +11 -0
- package/src/ui/remote-namespace.ts +24 -0
- package/src/ui/remote-session.ts +220 -0
- package/src/ui/session-controller.service.ts +335 -0
- package/src/ui/session-layout.ts +44 -0
- package/src/ui/session-reference-endpoint.client.ts +37 -0
- package/src/ui/session-scope.contribution.ts +81 -0
- package/src/ui/session-status-slots.ts +45 -0
- package/src/ui/session-submission.ts +108 -0
- package/src/ui/session-ui.provide.ts +51 -0
- package/src/ui/sessions.provide.ts +48 -0
- package/src/ui/setting-ui.provide.ts +35 -0
- package/src/ui/settings-general-slots.ts +66 -0
- package/src/ui/settings-host.ts +28 -0
- package/src/ui/settings-models-slots.ts +43 -0
- package/src/ui/shell/directory-picker-native-slots.ts +83 -0
- package/src/ui/shell/index.ts +74 -0
- package/src/ui/shell/rightbar-seats.ts +321 -0
- package/src/ui/shell/session-panel-slots.ts +33 -0
- package/src/ui/shell/sidebar-document-preview-slots.ts +62 -0
- package/src/ui/shell/sidebar-slots.ts +33 -0
- package/src/ui/shell/workspace-slots.ts +75 -0
- package/src/ui/ui-permission.service.ts +78 -0
- package/src/ui/ui-session.token.ts +5 -0
- package/src/ui/ui-settings.token.ts +9 -0
- package/src/ui/upstream-context.ts +27 -0
- package/src/ui/user-questions-slots.ts +39 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { AssertCoveredStrict, AssertTrue } from "@morlay/zephyr-app/client";
|
|
2
|
+
import FileReferenceServicePlugin from "@deepseek-ai/dsh-file-reference-local";
|
|
3
|
+
import SessionControllerPlugin from "@deepseek-ai/dsh-api-session-controller";
|
|
4
|
+
import SessionFileReferencesPlugin from "@deepseek-ai/dsh-api-session-controller/src/file-references.ts";
|
|
5
|
+
import SessionSkillCatalogPlugin from "@deepseek-ai/dsh-api-session-controller/src/skill-catalog.ts";
|
|
6
|
+
import SessionTitleService from "@deepseek-ai/dsh-session-title";
|
|
7
|
+
/** 上游 `SessionController` 的实例面(成员类型都从这里取,避免手抄走样)。 */
|
|
8
|
+
type SessionControllerUpstream = InstanceType<typeof SessionControllerPlugin>;
|
|
9
|
+
/**
|
|
10
|
+
* `sessionController`:`session` 组的全部端点(上游 `SessionController`)。
|
|
11
|
+
*
|
|
12
|
+
* 27 个成员逐个列;`typertRemote` 是 `TypertRemoteService` 基类挂的绑定(gateway 靠它发现端点)。
|
|
13
|
+
*/
|
|
14
|
+
declare abstract class SessionControllerService {
|
|
15
|
+
/** 上游基类挂的 remote 绑定(`{ service, serviceKey, namespace }`):gateway 的发现依据。 */
|
|
16
|
+
abstract readonly typertRemote: SessionControllerUpstream["typertRemote"];
|
|
17
|
+
/** 解析一个会话的活 agent 或冷会话(`prompt` / `rename` 这类端点的公共前置)。 */
|
|
18
|
+
abstract readonly resolveAgent: SessionControllerUpstream["resolveAgent"];
|
|
19
|
+
/** 列会话目录(读查询索引,不读 live store)。 */
|
|
20
|
+
abstract readonly list: SessionControllerUpstream["list"];
|
|
21
|
+
/** 搜索会话。 */
|
|
22
|
+
abstract readonly search: SessionControllerUpstream["search"];
|
|
23
|
+
/** 新建会话(会话与 agent 一起建)。 */
|
|
24
|
+
abstract readonly create: SessionControllerUpstream["create"];
|
|
25
|
+
/** 切某个会话的模型。 */
|
|
26
|
+
abstract readonly selectModel: SessionControllerUpstream["selectModel"];
|
|
27
|
+
/** 把默认模型写入会话。 */
|
|
28
|
+
abstract readonly initializeDefaultModel: SessionControllerUpstream["initializeDefaultModel"];
|
|
29
|
+
/** 模型目录(provider 分组 + 默认选择 + 失败面)。 */
|
|
30
|
+
abstract readonly modelCatalog: SessionControllerUpstream["modelCatalog"];
|
|
31
|
+
/** 本机能否用原生方式打开路径。 */
|
|
32
|
+
abstract readonly canOpenWorkspacePath: SessionControllerUpstream["canOpenWorkspacePath"];
|
|
33
|
+
/** 当前桌面信息(文件管理器类型等)。 */
|
|
34
|
+
abstract readonly workspaceDesktop: SessionControllerUpstream["workspaceDesktop"];
|
|
35
|
+
/** 用原生方式打开一个工作区路径。 */
|
|
36
|
+
abstract readonly openWorkspacePath: SessionControllerUpstream["openWorkspacePath"];
|
|
37
|
+
/** 某个路径可用的「用什么打开」列表。 */
|
|
38
|
+
abstract readonly workspacePathApplications: SessionControllerUpstream["workspacePathApplications"];
|
|
39
|
+
/** 改会话标题。 */
|
|
40
|
+
abstract readonly rename: SessionControllerUpstream["rename"];
|
|
41
|
+
/** 从某个会话 fork。 */
|
|
42
|
+
abstract readonly fork: SessionControllerUpstream["fork"];
|
|
43
|
+
/** 发一条 prompt(`(request, signal)`:signal 无条件 `throwIfAborted`)。 */
|
|
44
|
+
abstract readonly prompt: SessionControllerUpstream["prompt"];
|
|
45
|
+
/** 读一个附件(durable 引用 + base64 字节)。 */
|
|
46
|
+
abstract readonly attachment: SessionControllerUpstream["attachment"];
|
|
47
|
+
/** 改待发队列。 */
|
|
48
|
+
abstract readonly updateQueue: SessionControllerUpstream["updateQueue"];
|
|
49
|
+
/** 取消当前轮次。 */
|
|
50
|
+
abstract readonly cancel: SessionControllerUpstream["cancel"];
|
|
51
|
+
/** 读一页事件(冷读)。 */
|
|
52
|
+
abstract readonly page: SessionControllerUpstream["page"];
|
|
53
|
+
/** 读一页事件(同一实现的别名端点)。 */
|
|
54
|
+
abstract readonly events: SessionControllerUpstream["events"];
|
|
55
|
+
/** 订阅事件(无快照)。 */
|
|
56
|
+
abstract readonly observeEvent: SessionControllerUpstream["observeEvent"];
|
|
57
|
+
/** 订阅投影增量(无基线)。 */
|
|
58
|
+
abstract readonly observeProjections: SessionControllerUpstream["observeProjections"];
|
|
59
|
+
/** 读被动状态。 */
|
|
60
|
+
abstract readonly state: SessionControllerUpstream["state"];
|
|
61
|
+
/** 订阅被动状态的整份替换。 */
|
|
62
|
+
abstract readonly observeState: SessionControllerUpstream["observeState"];
|
|
63
|
+
/** 等会话静默或待输入。 */
|
|
64
|
+
abstract readonly wait: SessionControllerUpstream["wait"];
|
|
65
|
+
/** 跟一条会话日志(opening 快照 + 逐帧事件)。 */
|
|
66
|
+
abstract readonly follow: SessionControllerUpstream["follow"];
|
|
67
|
+
/** 读一份精确的投影值(cached 只在需要迁移时给)。 */
|
|
68
|
+
abstract readonly projections: SessionControllerUpstream["projections"];
|
|
69
|
+
/** Host 级控制流:一帧完整基线 + 之后的替换帧。 */
|
|
70
|
+
abstract readonly control: SessionControllerUpstream["control"];
|
|
71
|
+
}
|
|
72
|
+
/** 覆盖守卫:上游有而契约没列的成员,编译期必须为空。 */
|
|
73
|
+
type SessionControllerCovered = AssertTrue<AssertCoveredStrict<SessionControllerUpstream, SessionControllerService>>;
|
|
74
|
+
/** 上游 `LocalFileReferenceService` 的实例面。 */
|
|
75
|
+
type FileReferenceUpstream = InstanceType<typeof FileReferenceServicePlugin>;
|
|
76
|
+
/**
|
|
77
|
+
* `fileReferences`:`@` 引用的候选来源。
|
|
78
|
+
*
|
|
79
|
+
* 上游把契约(`abstract class FileReferenceService`)与本地实现分成两个包,我们只引用实现;
|
|
80
|
+
* 候选逻辑一行不写,所以这里只有它对外的一个方法。
|
|
81
|
+
*/
|
|
82
|
+
declare abstract class FileReferenceService {
|
|
83
|
+
/** 按前缀列出候选路径(`list(prefix, cwd, signal)`)。 */
|
|
84
|
+
abstract readonly list: FileReferenceUpstream["list"];
|
|
85
|
+
}
|
|
86
|
+
/** 覆盖守卫:上游有而契约没列的成员,编译期必须为空。 */
|
|
87
|
+
type FileReferenceCovered = AssertTrue<AssertCoveredStrict<FileReferenceUpstream, FileReferenceService>>;
|
|
88
|
+
/** 上游 `SessionFileReferences` 的实例面。 */
|
|
89
|
+
type SessionFileReferencesUpstream = InstanceType<typeof SessionFileReferencesPlugin>;
|
|
90
|
+
/** `sessionFileReferences`:`fileReferences/list` 端点(wire 命名空间 `fileReferences`)。 */
|
|
91
|
+
declare abstract class SessionFileReferencesService {
|
|
92
|
+
/** 上游基类挂的 remote 绑定:gateway 靠它发现端点。 */
|
|
93
|
+
abstract readonly typertRemote: SessionFileReferencesUpstream["typertRemote"];
|
|
94
|
+
/** 列候选(`list(request, signal)`)。 */
|
|
95
|
+
abstract readonly list: SessionFileReferencesUpstream["list"];
|
|
96
|
+
}
|
|
97
|
+
/** 覆盖守卫:上游有而契约没列的成员,编译期必须为空。 */
|
|
98
|
+
type SessionFileReferencesCovered = AssertTrue<AssertCoveredStrict<SessionFileReferencesUpstream, SessionFileReferencesService>>;
|
|
99
|
+
/** 上游 `SessionSkillCatalog` 的实例面。 */
|
|
100
|
+
type SessionSkillCatalogUpstream = InstanceType<typeof SessionSkillCatalogPlugin>;
|
|
101
|
+
/** `sessionSkillCatalog`:技能目录(wire 命名空间 `skills`)。 */
|
|
102
|
+
declare abstract class SessionSkillCatalogService {
|
|
103
|
+
/** 上游基类挂的 remote 绑定:gateway 靠它发现端点。 */
|
|
104
|
+
abstract readonly typertRemote: SessionSkillCatalogUpstream["typertRemote"];
|
|
105
|
+
/** 列某个会话可见的用户可调用技能(`list(request, signal)`)。 */
|
|
106
|
+
abstract readonly list: SessionSkillCatalogUpstream["list"];
|
|
107
|
+
}
|
|
108
|
+
/** 覆盖守卫:上游有而契约没列的成员,编译期必须为空。 */
|
|
109
|
+
type SessionSkillCatalogCovered = AssertTrue<AssertCoveredStrict<SessionSkillCatalogUpstream, SessionSkillCatalogService>>;
|
|
110
|
+
/**
|
|
111
|
+
* `sessionMediaReferences`:prompt 里图片块的准入(上游 `SessionMediaReferences`)。
|
|
112
|
+
*
|
|
113
|
+
* 它是**对象插件**(`{ inject, apply }`),挂载后只注册一条 `/api/file` 路由,**不提供任何服务**,
|
|
114
|
+
* 所以契约是空的。写出来是为了让 `fromCordis(契约, 实现)` 的双参形态保持统一:
|
|
115
|
+
* 装任何上游实现之前,都要先说出它的面(哪怕这个面是"没有")。
|
|
116
|
+
*/
|
|
117
|
+
declare abstract class SessionMediaReferencesService {}
|
|
118
|
+
declare abstract class SessionTitle {
|
|
119
|
+
abstract readonly get: SessionTitleService["get"];
|
|
120
|
+
abstract readonly rename: SessionTitleService["rename"];
|
|
121
|
+
abstract readonly refresh: SessionTitleService["refresh"];
|
|
122
|
+
abstract readonly register: SessionTitleService["register"];
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 覆盖守卫(严格):上游 `SessionTitleService` 的每个成员都要有同名、同签名的对应项。
|
|
126
|
+
*
|
|
127
|
+
* 为什么不是 `implements`:上游那份是 cordis `Service` **类**(带私有成员),`implements` 会报
|
|
128
|
+
* TS2720("Did you mean to extend … and inherit its members as a subclass?")。签名守卫在这里等价:
|
|
129
|
+
* 漏成员或签名对不上,编译期都会报出成员名(诊断的第二行)。
|
|
130
|
+
*/
|
|
131
|
+
type SessionTitleCovered = AssertTrue<AssertCoveredStrict<SessionTitleService, SessionTitle>>;
|
|
132
|
+
export { SessionControllerCovered as a, SessionFileReferencesService as c, SessionSkillCatalogService as d, FileReferenceService as i, SessionMediaReferencesService as l, SessionTitleCovered as n, SessionControllerService as o, FileReferenceCovered as r, SessionFileReferencesCovered as s, SessionTitle as t, SessionSkillCatalogCovered as u };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { describe, expect } from "@morlay/zephyr/testing";
|
|
2
|
+
import { AppEnvFixture, AppEnvFixtures, TestingAppEnv } from "@morlay/zephyr-app/testing";
|
|
3
|
+
/**
|
|
4
|
+
* 挂了本包 `test` 的 spec 自动得到:
|
|
5
|
+
*
|
|
6
|
+
* - `rtlCleanup`:卸载本轮渲染的 DOM(`@testing-library/react` 的 `cleanup`);
|
|
7
|
+
* - `stubRestore`:还原 `vi.stubEnv` / `vi.stubGlobal` / `vi.spyOn`(不靠 vitest 的隐式全局开关)。
|
|
8
|
+
*/
|
|
9
|
+
export declare const test: import("vitest").TestAPI<{
|
|
10
|
+
appEnv: import("@morlay/zephyr-app/testing").AppEnvFixture;
|
|
11
|
+
rtlCleanup: unknown;
|
|
12
|
+
stubRestore: unknown;
|
|
13
|
+
}>;
|
|
14
|
+
export { type AppEnvFixture, type AppEnvFixtures, type TestingAppEnv, describe, expect };
|
package/dist/testing.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cleanup } from "@testing-library/react";
|
|
2
|
+
import { test as test$1 } from "@morlay/zephyr-app/testing";
|
|
3
|
+
import { vi } from "vitest";
|
|
4
|
+
import { describe, expect } from "@morlay/zephyr/testing";
|
|
5
|
+
// src/testing/index.ts
|
|
6
|
+
/**
|
|
7
|
+
* 挂了本包 `test` 的 spec 自动得到:
|
|
8
|
+
*
|
|
9
|
+
* - `rtlCleanup`:卸载本轮渲染的 DOM(`@testing-library/react` 的 `cleanup`);
|
|
10
|
+
* - `stubRestore`:还原 `vi.stubEnv` / `vi.stubGlobal` / `vi.spyOn`(不靠 vitest 的隐式全局开关)。
|
|
11
|
+
*/
|
|
12
|
+
const test = test$1.extend({
|
|
13
|
+
rtlCleanup: [async ({}, use) => {
|
|
14
|
+
await use(void 0);
|
|
15
|
+
cleanup();
|
|
16
|
+
}, { auto: true }],
|
|
17
|
+
stubRestore: [async ({}, use) => {
|
|
18
|
+
await use(void 0);
|
|
19
|
+
vi.unstubAllEnvs();
|
|
20
|
+
vi.unstubAllGlobals();
|
|
21
|
+
vi.restoreAllMocks();
|
|
22
|
+
}, { auto: true }]
|
|
23
|
+
});
|
|
24
|
+
export { describe, expect, test };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RemoteGroup, RemoteMethod } from "@morlay/zephyr-app/remote";
|
|
2
|
+
import { t as __decorate } from "./decorate-g56z_1VW.mjs";
|
|
3
|
+
// src/endpoint/tool-results.group.ts
|
|
4
|
+
let ToolResultsEndpoint = class ToolResultsEndpoint {
|
|
5
|
+
/**
|
|
6
|
+
* 逐帧给出某条工具结果的「可用性 + 当前值」。
|
|
7
|
+
* @param _request - 会话身份与那一条工具结果的序号(descriptor 的 `request` 参数)。
|
|
8
|
+
* @param _signal - wire 的取消信号(流承载关闭时 abort)。
|
|
9
|
+
* @returns 逐帧的工具结果。
|
|
10
|
+
*/
|
|
11
|
+
watch(_request, _signal) {
|
|
12
|
+
throw new Error("toolResults/watch:契约类未实现(宿主侧要在子类里实现它)");
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
__decorate([RemoteMethod({ mode: "stream" })], ToolResultsEndpoint.prototype, "watch", null);
|
|
16
|
+
ToolResultsEndpoint = __decorate([RemoteGroup({ name: "toolResults" })], ToolResultsEndpoint);
|
|
17
|
+
export { ToolResultsEndpoint as t };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SessionToolResultRequest, SessionToolResultValue } from "@deepseek-ai/dsh-client-ui-trajectory";
|
|
2
|
+
/**
|
|
3
|
+
* `toolResults` 组:一条工具结果流。
|
|
4
|
+
*
|
|
5
|
+
* 帧**不**包 `RemoteResult`(流式方法与 `workspace/follow` 同口径:帧本身即业务值)。
|
|
6
|
+
*/
|
|
7
|
+
declare class ToolResultsEndpoint {
|
|
8
|
+
/**
|
|
9
|
+
* 逐帧给出某条工具结果的「可用性 + 当前值」。
|
|
10
|
+
* @param _request - 会话身份与那一条工具结果的序号(descriptor 的 `request` 参数)。
|
|
11
|
+
* @param _signal - wire 的取消信号(流承载关闭时 abort)。
|
|
12
|
+
* @returns 逐帧的工具结果。
|
|
13
|
+
*/
|
|
14
|
+
watch(_request: SessionToolResultRequest, _signal: AbortSignal): AsyncIterable<SessionToolResultValue>;
|
|
15
|
+
}
|
|
16
|
+
export { ToolResultsEndpoint as t };
|