@roaming-ai/dsh-group-chat 0.2.2 → 0.3.1
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/README.md +91 -27
- package/lib/client.js +1254 -598
- package/lib/client.js.map +1 -1
- package/lib/index.js +573 -109
- package/lib/types/client/components/AsidePanel.d.ts +3 -19
- package/lib/types/client/components/Bubble.d.ts +6 -3
- package/lib/types/client/components/ChatPanel.d.ts +1 -0
- package/lib/types/client/components/ConstraintList.d.ts +11 -0
- package/lib/types/client/components/FailCard.d.ts +9 -0
- package/lib/types/client/components/Fold.d.ts +19 -0
- package/lib/types/client/components/HoverTip.d.ts +22 -0
- package/lib/types/client/components/MessageFlow.d.ts +1 -0
- package/lib/types/client/components/MsgActions.d.ts +14 -0
- package/lib/types/client/components/NavPanel.d.ts +9 -11
- package/lib/types/client/components/RoleDrawer.d.ts +3 -2
- package/lib/types/client/components/ToolRow.d.ts +2 -2
- package/lib/types/client/hooks/useComposer.d.ts +6 -1
- package/lib/types/client/hooks/useGroupChatState.d.ts +0 -16
- package/lib/types/client/lib/composer-draft.d.ts +17 -0
- package/lib/types/client/lib/model.d.ts +1 -7
- package/lib/types/client/utils/utils.d.ts +4 -4
- package/lib/types/core/constraints.d.ts +61 -0
- package/lib/types/core/errors.d.ts +54 -0
- package/lib/types/core/json.d.ts +6 -0
- package/lib/types/core/types.d.ts +76 -60
- package/lib/types/host/api/actions.d.ts +1 -1
- package/lib/types/host/engine/conversation.d.ts +5 -3
- package/lib/types/host/engine/defaults.d.ts +13 -0
- package/lib/types/host/engine/fold.d.ts +17 -0
- package/lib/types/host/engine/index.d.ts +1 -0
- package/lib/types/host/engine/retitle.d.ts +5 -5
- package/lib/types/host/service.d.ts +1 -1
- package/lib/types/host/state.d.ts +2 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/shared/file-mention-grammar.d.ts +3 -12
- package/package.json +1 -1
- package/src/client/GroupChatPanel.tsx +25 -59
- package/src/client/components/AsidePanel.tsx +50 -23
- package/src/client/components/Bubble.tsx +45 -18
- package/src/client/components/ChatPanel.tsx +17 -12
- package/src/client/components/Composer.tsx +26 -20
- package/src/client/components/ConstraintList.tsx +64 -0
- package/src/client/components/FailCard.tsx +49 -0
- package/src/client/components/Fold.tsx +72 -0
- package/src/client/components/HoverTip.tsx +134 -0
- package/src/client/components/MessageFlow.tsx +78 -54
- package/src/client/components/MsgActions.tsx +85 -0
- package/src/client/components/NavPanel.tsx +102 -79
- package/src/client/components/RoleDrawer.tsx +29 -7
- package/src/client/components/ThinkRow.tsx +7 -3
- package/src/client/components/ToolRow.tsx +9 -5
- package/src/client/hooks/useComposer.ts +54 -56
- package/src/client/hooks/useGroupChatState.ts +7 -17
- package/src/client/lib/composer-draft.ts +47 -0
- package/src/client/lib/model.ts +1 -14
- package/src/client/lib/styles.ts +73 -12
- package/src/client/react-dom-shim.d.ts +2 -0
- package/src/client/utils/utils.ts +6 -6
- package/src/core/constraints.ts +204 -0
- package/src/core/errors.ts +174 -0
- package/src/core/json.ts +18 -0
- package/src/core/types.ts +52 -19
- package/src/host/api/actions.ts +49 -14
- package/src/host/broadcast.ts +3 -3
- package/src/host/engine/conversation.ts +104 -40
- package/src/host/engine/defaults.ts +28 -0
- package/src/host/engine/fold.ts +99 -0
- package/src/host/engine/index.ts +1 -0
- package/src/host/engine/retitle.ts +24 -41
- package/src/host/materials/materials.ts +2 -0
- package/src/host/persistence/persistence.ts +18 -1
- package/src/host/service.ts +1 -1
- package/src/host/state.ts +5 -4
- package/src/host/tools/tools.ts +2 -2
- package/src/index.ts +2 -0
- package/src/shared/file-mention-grammar.test.ts +1 -38
- package/src/shared/file-mention-grammar.ts +7 -33
- package/lib/types/client/Bubble.d.ts +0 -10
- package/lib/types/client/Glyph.d.ts +0 -12
- package/lib/types/client/GroupChatPanel.old.d.ts +0 -10
- package/lib/types/client/GroupChatSettingsSection.d.ts +0 -15
- package/lib/types/client/PermissionSelect.d.ts +0 -13
- package/lib/types/client/RoleDrawer.d.ts +0 -17
- package/lib/types/client/ThinkRow.d.ts +0 -9
- package/lib/types/client/ToolRow.d.ts +0 -9
- package/lib/types/client/api.d.ts +0 -8
- package/lib/types/client/components.d.ts +0 -22
- package/lib/types/client/drawer.d.ts +0 -17
- package/lib/types/client/glyph.d.ts +0 -12
- package/lib/types/client/model.d.ts +0 -78
- package/lib/types/client/panel.d.ts +0 -10
- package/lib/types/client/settings.d.ts +0 -15
- package/lib/types/client/styles.d.ts +0 -10
- package/lib/types/client/ui.d.ts +0 -17
- package/lib/types/client/utils.d.ts +0 -22
- package/lib/types/host/actions.d.ts +0 -34
- package/lib/types/host/conversation.d.ts +0 -25
- package/lib/types/host/http.d.ts +0 -16
- package/lib/types/host/materials.d.ts +0 -32
- package/lib/types/host/persistence.d.ts +0 -31
- package/lib/types/host/routes.d.ts +0 -11
- package/lib/types/host/store.d.ts +0 -65
- package/lib/types/host/tools.d.ts +0 -28
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { describe, expect, it } from 'vitest'
|
|
7
|
-
import { activeAtToken
|
|
7
|
+
import { activeAtToken } from './file-mention-grammar.ts'
|
|
8
8
|
|
|
9
9
|
describe('activeAtToken', () => {
|
|
10
10
|
it('extracts plain @path at cursor', () => {
|
|
@@ -38,40 +38,3 @@ describe('activeAtToken', () => {
|
|
|
38
38
|
expect(activeAtToken('\t@"test', 7)).toEqual({ prefix: '@"test', query: 'test', quoted: true })
|
|
39
39
|
})
|
|
40
40
|
})
|
|
41
|
-
|
|
42
|
-
describe('formatFileMention', () => {
|
|
43
|
-
it('formats plain file without whitespace', () => {
|
|
44
|
-
expect(formatFileMention({ kind: 'file', path: 'README.md' }, false)).toBe('@README.md')
|
|
45
|
-
expect(formatFileMention({ kind: 'file', path: 'src/index.ts' }, false)).toBe('@src/index.ts')
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
it('formats plain directory with trailing slash', () => {
|
|
49
|
-
expect(formatFileMention({ kind: 'directory', path: 'src' }, false)).toBe('@src/')
|
|
50
|
-
expect(formatFileMention({ kind: 'directory', path: 'lib/utils' }, false)).toBe('@lib/utils/')
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
it('quotes file with whitespace and closes quote', () => {
|
|
54
|
-
expect(formatFileMention({ kind: 'file', path: 'My Document.txt' }, false)).toBe('@"My Document.txt"')
|
|
55
|
-
expect(formatFileMention({ kind: 'file', path: 'src/my file.ts' }, false)).toBe('@"src/my file.ts"')
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('quotes directory with whitespace but keeps quote open', () => {
|
|
59
|
-
expect(formatFileMention({ kind: 'directory', path: 'My Folder' }, false)).toBe('@"My Folder/')
|
|
60
|
-
expect(formatFileMention({ kind: 'directory', path: 'src/my lib' }, false)).toBe('@"src/my lib/')
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('preserves quote even when unnecessary', () => {
|
|
64
|
-
expect(formatFileMention({ kind: 'file', path: 'plain.txt' }, true)).toBe('@"plain.txt"')
|
|
65
|
-
expect(formatFileMention({ kind: 'directory', path: 'lib' }, true)).toBe('@"lib/')
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
it('rejects paths with control characters', () => {
|
|
69
|
-
expect(formatFileMention({ kind: 'file', path: 'file\x00.txt' }, false)).toBeUndefined()
|
|
70
|
-
expect(formatFileMention({ kind: 'file', path: 'file\n.txt' }, false)).toBeUndefined()
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('rejects paths with embedded quotes', () => {
|
|
74
|
-
expect(formatFileMention({ kind: 'file', path: 'file"name.txt' }, false)).toBeUndefined()
|
|
75
|
-
expect(formatFileMention({ kind: 'directory', path: 'dir"name' }, false)).toBeUndefined()
|
|
76
|
-
})
|
|
77
|
-
})
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Vendored @file token grammar from dsh-file-reference (browser-safe, zero Node API).
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Sourced from @deepseek-ai/dsh-file-reference/lib/types/grammar.js
|
|
5
5
|
* Cannot import directly due to client bundle purity gate (dsh-client-bundle-purity).
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* 只保留输入侧的 @token 识别(activeAtToken);候选的文本化(formatFileMention)
|
|
8
|
+
* 未被本插件采用——目录钻入走「插入整颗芯片」语义,见 docs/DESIGN.md Composer 契约。
|
|
9
|
+
*
|
|
7
10
|
* @module dsh-group-chat/shared
|
|
8
11
|
*/
|
|
9
12
|
|
|
@@ -16,22 +19,17 @@ export interface AtToken {
|
|
|
16
19
|
quoted: boolean
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
export interface FileCandidate {
|
|
20
|
-
kind: 'file' | 'directory'
|
|
21
|
-
path: string
|
|
22
|
-
}
|
|
23
|
-
|
|
24
22
|
/**
|
|
25
23
|
* Extract active @token at cursor position.
|
|
26
24
|
* Matches @ at word boundary (line start or after whitespace).
|
|
27
|
-
*
|
|
25
|
+
*
|
|
28
26
|
* @param line - Current line text
|
|
29
27
|
* @param cursor - Cursor offset in line
|
|
30
28
|
* @returns Token or undefined if no active @token at cursor
|
|
31
29
|
*/
|
|
32
30
|
export function activeAtToken(line: string, cursor: number): AtToken | undefined {
|
|
33
31
|
const before = line.slice(0, cursor)
|
|
34
|
-
|
|
32
|
+
|
|
35
33
|
// Try quoted @"... first (more specific)
|
|
36
34
|
const quotedMatch = /(?:^|\s)@"([^"]*)$/.exec(before)
|
|
37
35
|
if (quotedMatch) {
|
|
@@ -56,27 +54,3 @@ export function activeAtToken(line: string, cursor: number): AtToken | undefined
|
|
|
56
54
|
|
|
57
55
|
return undefined
|
|
58
56
|
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Format file/directory candidate as @mention text.
|
|
62
|
-
*
|
|
63
|
-
* @param candidate - File or directory to format
|
|
64
|
-
* @param preserveQuote - Keep quotes even when unnecessary (for drill-down continuity)
|
|
65
|
-
* @returns Formatted @path or undefined for invalid paths
|
|
66
|
-
*/
|
|
67
|
-
export function formatFileMention(candidate: FileCandidate, preserveQuote: boolean): string | undefined {
|
|
68
|
-
const { path } = candidate
|
|
69
|
-
|
|
70
|
-
// Reject control characters and embedded quotes
|
|
71
|
-
if (/[\x00-\x1F"]/.test(path)) return undefined
|
|
72
|
-
|
|
73
|
-
const needsQuote = /\s/.test(path)
|
|
74
|
-
const useQuote = needsQuote || preserveQuote
|
|
75
|
-
|
|
76
|
-
if (candidate.kind === 'file') {
|
|
77
|
-
return useQuote ? `@"${path}"` : `@${path}`
|
|
78
|
-
} else {
|
|
79
|
-
// Directory: trailing slash, quote stays open for drill-down
|
|
80
|
-
return useQuote ? `@"${path}/` : `@${path}/`
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 聊天消息气泡(user / system / 角色发言)。
|
|
3
|
-
* @module dsh-group-chat/client/Bubble
|
|
4
|
-
*/
|
|
5
|
-
import type { ReactNode } from 'react';
|
|
6
|
-
import { type ClientSnapshot } from './model.ts';
|
|
7
|
-
export declare function Bubble(props: {
|
|
8
|
-
snap: ClientSnapshot;
|
|
9
|
-
m: ClientSnapshot['messages'][number];
|
|
10
|
-
}): ReactNode;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 侧边栏入口图标。
|
|
3
|
-
*
|
|
4
|
-
* 整行命中层携带 “newSession” 类名:任务看板等 DOM 注入式面板用
|
|
5
|
-
* [class*="newSession"] 识别“侧边栏导航点击”并自动收起自己,与点击
|
|
6
|
-
* “新建会话”行为一致——类名不可哈希化。
|
|
7
|
-
* @module dsh-group-chat/client/glyph
|
|
8
|
-
*/
|
|
9
|
-
import type { ReactNode } from 'react';
|
|
10
|
-
export declare function Glyph(props: {
|
|
11
|
-
size?: number;
|
|
12
|
-
}): ReactNode;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 主面板:三区工作台——左导航栏(搜索 + 群组→会话目录树)、中央会话流
|
|
3
|
-
* (@成员 点名 + markdown 渲染 + 思考折叠)、右上下文栏(群成员角色卡 +
|
|
4
|
-
* 工作区目录),右栏可收起,角色编辑走右侧滑出抽屉。
|
|
5
|
-
*
|
|
6
|
-
* 面板数据走 /api/group-chat/*(fetch + SSE),Host 半持有全部状态。
|
|
7
|
-
* @module dsh-group-chat/client/panel
|
|
8
|
-
*/
|
|
9
|
-
import { type ReactNode } from 'react';
|
|
10
|
-
export declare function GroupChatPanel(): ReactNode;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 设置页:启停开关(settings.section 插槽)。写 host 的 group-chat 设置
|
|
3
|
-
* 命名空间(settings.yaml 持久化)。
|
|
4
|
-
* @module dsh-group-chat/client/settings
|
|
5
|
-
*/
|
|
6
|
-
import { type ReactNode } from 'react';
|
|
7
|
-
import type { SettingsScope } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
8
|
-
/** Host 侧注册的设置命名空间 shape。 */
|
|
9
|
-
interface GroupChatSettings {
|
|
10
|
-
enabled?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function GroupChatSettingsSection(props: {
|
|
13
|
-
settingsScope: SettingsScope<GroupChatSettings>;
|
|
14
|
-
}): ReactNode;
|
|
15
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 群组权限档位选择器(对齐主会话 composer 左下角的 /permission 选择器):
|
|
3
|
-
* 触发芯片(盾形图标 + 档位名 + chevron)+ Menu 上弹三档 + 完全权限风险
|
|
4
|
-
* 确认弹窗(与主会话同款 RiskConfirmation 原语与文案)。
|
|
5
|
-
* @module dsh-group-chat/client/permission-select
|
|
6
|
-
*/
|
|
7
|
-
import { type ReactNode } from 'react';
|
|
8
|
-
import type { PermissionTier } from '../core/types.ts';
|
|
9
|
-
export interface PermissionSelectProps {
|
|
10
|
-
tier: PermissionTier;
|
|
11
|
-
onSelect: (tier: PermissionTier) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare function PermissionSelect(props: PermissionSelectProps): ReactNode;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 角色编辑抽屉(右侧滑出,不遮挡会话流阅读)。
|
|
3
|
-
* @module dsh-group-chat/client/drawer
|
|
4
|
-
*/
|
|
5
|
-
import { type ReactNode } from 'react';
|
|
6
|
-
import { type ModelsResponse, type RoleDraft } from './model.ts';
|
|
7
|
-
export interface RoleDrawerProps {
|
|
8
|
-
draft: RoleDraft;
|
|
9
|
-
set: (draft: RoleDraft) => void;
|
|
10
|
-
models: ModelsResponse | null;
|
|
11
|
-
modelsError: string | null;
|
|
12
|
-
onRetryModels: () => void;
|
|
13
|
-
onSave: () => void;
|
|
14
|
-
onCancel: () => void;
|
|
15
|
-
formError: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function RoleDrawer(props: RoleDrawerProps): ReactNode;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 会话流内容组件:思考折叠行、工具调用折叠行、聊天气泡。
|
|
3
|
-
* 对标宿主同源渲染(MarkdownText 正文 + 思考折叠行 + CodeBlock 代码块)。
|
|
4
|
-
* @module dsh-group-chat/client/components
|
|
5
|
-
*/
|
|
6
|
-
import { type ReactNode } from 'react';
|
|
7
|
-
import { Icon } from './ui.ts';
|
|
8
|
-
import { type ClientSnapshot, type ToolCallView } from './model.ts';
|
|
9
|
-
/** 思考折叠行(对标宿主 ReasoningRow:折叠摘要 / 展开全文)。 */
|
|
10
|
-
export declare function ThinkRow(props: {
|
|
11
|
-
text: string;
|
|
12
|
-
running?: boolean;
|
|
13
|
-
}): ReactNode;
|
|
14
|
-
export declare function ToolRow(props: {
|
|
15
|
-
c: ToolCallView;
|
|
16
|
-
}): ReactNode;
|
|
17
|
-
/** 聊天消息(user / system / 角色发言)。 */
|
|
18
|
-
export declare function Bubble(props: {
|
|
19
|
-
snap: ClientSnapshot;
|
|
20
|
-
m: ClientSnapshot['messages'][number];
|
|
21
|
-
}): ReactNode;
|
|
22
|
-
export { Icon };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 角色编辑抽屉(右侧滑出,不遮挡会话流阅读)。
|
|
3
|
-
* @module dsh-group-chat/client/drawer
|
|
4
|
-
*/
|
|
5
|
-
import { type ReactNode } from 'react';
|
|
6
|
-
import { type ModelsResponse, type RoleDraft } from './model.ts';
|
|
7
|
-
export interface RoleDrawerProps {
|
|
8
|
-
draft: RoleDraft;
|
|
9
|
-
set: (draft: RoleDraft) => void;
|
|
10
|
-
models: ModelsResponse | null;
|
|
11
|
-
modelsError: string | null;
|
|
12
|
-
onRetryModels: () => void;
|
|
13
|
-
onSave: () => void;
|
|
14
|
-
onCancel: () => void;
|
|
15
|
-
formError: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function RoleDrawer(props: RoleDrawerProps): ReactNode;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 侧边栏入口图标。
|
|
3
|
-
*
|
|
4
|
-
* 整行命中层携带 “newSession” 类名:任务看板等 DOM 注入式面板用
|
|
5
|
-
* [class*="newSession"] 识别“侧边栏导航点击”并自动收起自己,与点击
|
|
6
|
-
* “新建会话”行为一致——类名不可哈希化。
|
|
7
|
-
* @module dsh-group-chat/client/glyph
|
|
8
|
-
*/
|
|
9
|
-
import type { ReactNode } from 'react';
|
|
10
|
-
export declare function Glyph(props: {
|
|
11
|
-
size?: number;
|
|
12
|
-
}): ReactNode;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 浏览器半共享常量与小工具(纯函数,无 React 依赖)。
|
|
3
|
-
* @module dsh-group-chat/client/model
|
|
4
|
-
*/
|
|
5
|
-
import type { RoleRecord, Snapshot, ToolCallRecord } from '../core/types.ts';
|
|
6
|
-
/** 角色标识色调色板(与宿主半一致)。 */
|
|
7
|
-
export declare const PALETTE: string[];
|
|
8
|
-
/** Host HTTP API 前缀。 */
|
|
9
|
-
export declare const API_PREFIX = "/api/group-chat";
|
|
10
|
-
/** MarkdownText 渲染文案。 */
|
|
11
|
-
export declare const MD_LABELS: Readonly<{
|
|
12
|
-
code: {
|
|
13
|
-
copyLabel: string;
|
|
14
|
-
copiedLabel: string;
|
|
15
|
-
};
|
|
16
|
-
footnotes: "脚注";
|
|
17
|
-
}>;
|
|
18
|
-
/** 快照的 wire 形态(响应里带 ok 标记)。 */
|
|
19
|
-
export type ClientSnapshot = Snapshot & {
|
|
20
|
-
ok: boolean;
|
|
21
|
-
};
|
|
22
|
-
/** models action 的响应形态。 */
|
|
23
|
-
export interface ModelsResponse {
|
|
24
|
-
ok: boolean;
|
|
25
|
-
providers?: {
|
|
26
|
-
id: string;
|
|
27
|
-
name?: string;
|
|
28
|
-
}[];
|
|
29
|
-
modelsByProvider?: Record<string, {
|
|
30
|
-
id: string;
|
|
31
|
-
name?: string;
|
|
32
|
-
}[]>;
|
|
33
|
-
error?: string;
|
|
34
|
-
}
|
|
35
|
-
/** efforts action 的响应形态。 */
|
|
36
|
-
export interface EffortsResponse {
|
|
37
|
-
ok: boolean;
|
|
38
|
-
efforts?: {
|
|
39
|
-
id: string;
|
|
40
|
-
name: string;
|
|
41
|
-
description?: string;
|
|
42
|
-
}[];
|
|
43
|
-
defaultEffort?: string;
|
|
44
|
-
error?: string;
|
|
45
|
-
}
|
|
46
|
-
/** 快照内的角色/会话/群组视图行。 */
|
|
47
|
-
export type SnapshotRole = Snapshot['roles'][number];
|
|
48
|
-
export type SnapshotSession = Snapshot['sessions'][number];
|
|
49
|
-
export type SnapshotGroup = Snapshot['groups'][number];
|
|
50
|
-
export type SnapshotMessage = Snapshot['messages'][number];
|
|
51
|
-
export declare function roleById(s: ClientSnapshot, id: string | null): SnapshotRole | null;
|
|
52
|
-
export declare function sessById(s: ClientSnapshot, id: string): SnapshotSession | null;
|
|
53
|
-
export declare function groupById(s: ClientSnapshot, id: string): SnapshotGroup | null;
|
|
54
|
-
export declare function escapeRegExp(v: string): string;
|
|
55
|
-
export declare function firstLine(text: string): string;
|
|
56
|
-
export declare function latestLine(text: string): string;
|
|
57
|
-
export declare function fmtTime(ts: number): string;
|
|
58
|
-
/** 角色编辑抽屉的草稿形态(编辑与新建共用)。 */
|
|
59
|
-
export interface RoleDraft {
|
|
60
|
-
id?: string;
|
|
61
|
-
name: string;
|
|
62
|
-
color: string | null;
|
|
63
|
-
persona: string;
|
|
64
|
-
provider: string;
|
|
65
|
-
model: string;
|
|
66
|
-
temperature?: number;
|
|
67
|
-
reasoningEffort: string;
|
|
68
|
-
enabled?: boolean;
|
|
69
|
-
thinking: boolean;
|
|
70
|
-
}
|
|
71
|
-
export declare function draftFromRole(role: SnapshotRole): RoleDraft;
|
|
72
|
-
export declare function blankDraft(): RoleDraft;
|
|
73
|
-
/** 工具调用行的展示参数。 */
|
|
74
|
-
export type ToolCallView = ToolCallRecord;
|
|
75
|
-
/** 草稿是否可作为角色落库(宿主侧再校验一次)。 */
|
|
76
|
-
export declare function draftMissing(draft: RoleDraft): string;
|
|
77
|
-
/** RoleRecord 兼容视图(快照角色行即其展示子集)。 */
|
|
78
|
-
export type RoleView = RoleRecord;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 主面板:三区工作台——左导航栏(搜索 + 群组→会话目录树)、中央会话流
|
|
3
|
-
* (@成员 点名 + markdown 渲染 + 思考折叠)、右上下文栏(群成员角色卡 +
|
|
4
|
-
* 工作区目录),右栏可收起,角色编辑走右侧滑出抽屉。
|
|
5
|
-
*
|
|
6
|
-
* 面板数据走 /api/group-chat/*(fetch + SSE),Host 半持有全部状态。
|
|
7
|
-
* @module dsh-group-chat/client/panel
|
|
8
|
-
*/
|
|
9
|
-
import { type ReactNode } from 'react';
|
|
10
|
-
export declare function GroupChatPanel(): ReactNode;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 设置页:启停开关(settings.section 插槽)。写 host 的 group-chat 设置
|
|
3
|
-
* 命名空间(settings.yaml 持久化)。
|
|
4
|
-
* @module dsh-group-chat/client/settings
|
|
5
|
-
*/
|
|
6
|
-
import { type ReactNode } from 'react';
|
|
7
|
-
import type { SettingsScope } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
8
|
-
/** Host 侧注册的设置命名空间 shape。 */
|
|
9
|
-
interface GroupChatSettings {
|
|
10
|
-
enabled?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function GroupChatSettingsSection(props: {
|
|
13
|
-
settingsScope: SettingsScope<GroupChatSettings>;
|
|
14
|
-
}): ReactNode;
|
|
15
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 浏览器半样式:CSS 以内联字符串承载(刻意不迁移 CSS Modules 管线——
|
|
3
|
-
* 类名需保持原样,侧栏入口的 “newSession” 类名是任务看板等 DOM 注入式
|
|
4
|
-
* 面板识别“侧边栏导航点击”的跨插件标记,哈希化会破坏该约定)。
|
|
5
|
-
* 工厂执行时幂等注入 <style>,loader 卸载时按 data-plugin 摘除标签。
|
|
6
|
-
* @module dsh-group-chat/client/styles
|
|
7
|
-
*/
|
|
8
|
-
export declare const CSS: string;
|
|
9
|
-
/** 工厂执行时幂等注入样式标签(loader 卸载时按 data-plugin 摘除)。 */
|
|
10
|
-
export declare function injectStyles(): void;
|
package/lib/types/client/ui.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 浏览器半 UI 基座:DSW 原语(shell 静态种子模块,loader 模块表 external)
|
|
3
|
-
* 与动态图标 / 命令式 createElement 辅助。组件主体已 JSX 化(.tsx);此处
|
|
4
|
-
* 仅保留 slot 注册回调与动态图标表需要的少量命令式辅助。
|
|
5
|
-
* @module dsh-group-chat/client/ui
|
|
6
|
-
*/
|
|
7
|
-
import { type ReactNode } from 'react';
|
|
8
|
-
import * as P from '@deepseek-ai/dsh-client-ui-primitives';
|
|
9
|
-
export { P };
|
|
10
|
-
/** 命令式 createElement(仅 slot 注册回调用)。 */
|
|
11
|
-
export declare const h: (type: unknown, props?: Record<string, unknown> | null, ...children: unknown[]) => ReactNode;
|
|
12
|
-
/** 图标组件的调用形态。 */
|
|
13
|
-
export type IconComponent = (props: Record<string, unknown>) => ReactNode;
|
|
14
|
-
/** 按名取 DSW 原语(图标表驱动)。 */
|
|
15
|
-
export declare function pickPrimitive(name: string): IconComponent;
|
|
16
|
-
/** 以统一 size 包装图标组件调用(放在 JSX 子元素位)。 */
|
|
17
|
-
export declare function Icon(comp: unknown, size: number, extra?: Record<string, unknown>): ReactNode;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 通用工具函数
|
|
3
|
-
* @module dsh-group-chat/client/utils
|
|
4
|
-
*/
|
|
5
|
-
/** HTML 转义(芯片以 execCommand('insertHTML') 注入,角色名需转义)。 */
|
|
6
|
-
export declare function escapeHtml(v: string): string;
|
|
7
|
-
export declare function execCommand(commandId: 'delete' | 'insertHTML' | 'insertText' | 'insertLineBreak', value?: string): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* contenteditable 输入区 → 纯文本序列化(发送/参与判定的唯一事实源):
|
|
10
|
-
* 文本节点原样;<br> → 换行;@提及芯片(.dsgc-chipin)展开回「@名字␠」;
|
|
11
|
-
* DIV/P 块前补换行(防粘贴残留的块级包裹)。手打纯文本 @名字 与芯片展开
|
|
12
|
-
* 结果同形——语义统一由 mentionedRoles 正则承载(芯片=糖,正则=真)。
|
|
13
|
-
*/
|
|
14
|
-
export declare function serializeInput(root: HTMLElement): string;
|
|
15
|
-
/** @提及芯片的 HTML(原子元素:contenteditable=false + draggable,退格整删)。 */
|
|
16
|
-
export declare function chipHtml(role: {
|
|
17
|
-
id: string;
|
|
18
|
-
name: string;
|
|
19
|
-
color?: string;
|
|
20
|
-
}): string;
|
|
21
|
-
/** 光标前未闭合的 @词(弹层触发判定);无返回 null */
|
|
22
|
-
export declare function queryAtCaret(): string | null;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 动作分发(handleAction,POST /api/group-chat/action 的载荷):
|
|
3
|
-
* mutate(12 种 CRUD/配置操作)| send | stop | confirmCommand | models | efforts。
|
|
4
|
-
* @module dsh-group-chat/host/actions
|
|
5
|
-
*/
|
|
6
|
-
import type { BrowseResult, Snapshot } from '../core/types.ts';
|
|
7
|
-
import type { HostState } from './state.ts';
|
|
8
|
-
/** 动作面。 */
|
|
9
|
-
export interface Actions {
|
|
10
|
-
handleAction: (body: Record<string, unknown>) => Promise<unknown>;
|
|
11
|
-
}
|
|
12
|
-
/** 创建动作分发面。 */
|
|
13
|
-
export declare function createActions(core: HostState, deps: {
|
|
14
|
-
touch: () => void;
|
|
15
|
-
snapshot: () => Snapshot;
|
|
16
|
-
schedulePersist: (targets?: {
|
|
17
|
-
ledger?: boolean;
|
|
18
|
-
session?: string | null;
|
|
19
|
-
roles?: string | null;
|
|
20
|
-
workspace?: string | null;
|
|
21
|
-
}) => void;
|
|
22
|
-
dropDirty: (targets: {
|
|
23
|
-
session?: string | null;
|
|
24
|
-
roles?: string | null;
|
|
25
|
-
workspace?: string | null;
|
|
26
|
-
}) => void;
|
|
27
|
-
appendMessage: import('./conversation.ts').Conversation['appendMessage'];
|
|
28
|
-
runLoop: import('./conversation.ts').Conversation['runLoop'];
|
|
29
|
-
wakeConfirm: () => void;
|
|
30
|
-
killChild: () => void;
|
|
31
|
-
browse: (args: {
|
|
32
|
-
path?: string;
|
|
33
|
-
} | undefined) => Promise<BrowseResult>;
|
|
34
|
-
}): Actions;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 对话引擎:消息追加、群聊记录转写、角色发言(speak:prompt 构建 + 流式
|
|
3
|
-
* 轮次 + 工具回注循环)、多轮 runLoop,以及会话标题/主题自动整理(retitle)。
|
|
4
|
-
* @module dsh-group-chat/host/conversation
|
|
5
|
-
*/
|
|
6
|
-
import type { MessageRecord, SessionRecord } from '../core/types.ts';
|
|
7
|
-
import type { HostState } from './state.ts';
|
|
8
|
-
import type { Materials } from './materials.ts';
|
|
9
|
-
import type { Tools } from './tools.ts';
|
|
10
|
-
/** 对话引擎面。 */
|
|
11
|
-
export interface Conversation {
|
|
12
|
-
/** 追加一条消息到会话(touch + 落盘调度)。 */
|
|
13
|
-
appendMessage: (sess: SessionRecord, speaker: string, text: string, extra?: Partial<MessageRecord>) => MessageRecord;
|
|
14
|
-
/** 多轮 round-robin 主循环(send 触发;finally 复位 run)。 */
|
|
15
|
-
runLoop: (sess: SessionRecord) => Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
/** 创建对话引擎。 */
|
|
18
|
-
export declare function createConversation(core: HostState, deps: {
|
|
19
|
-
touch: () => void;
|
|
20
|
-
schedulePersist: (targets?: {
|
|
21
|
-
session?: string | null;
|
|
22
|
-
}) => void;
|
|
23
|
-
materials: Materials;
|
|
24
|
-
tools: Tools;
|
|
25
|
-
}): Conversation;
|
package/lib/types/host/http.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Host HTTP 工具:回环信任栏(对齐 dsh-web shared/host/loopback.ts 语义 +
|
|
3
|
-
* 浏览器同源标记栏)、有界 JSON 请求体读取、JSON 响应写出。
|
|
4
|
-
* @module dsh-group-chat/host/http
|
|
5
|
-
*/
|
|
6
|
-
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
7
|
-
/**
|
|
8
|
-
* 请求级信任栏:浏览器同源标记(sec-fetch-site / Origin)必须存在且回环
|
|
9
|
-
* socket + 回环 Host 全过;X-Forwarded-For 一律不信任。无任何同源标记的
|
|
10
|
-
* 非浏览器请求(如裸 curl)一律拒绝。
|
|
11
|
-
*/
|
|
12
|
-
export declare function isTrustedRequest(req: IncomingMessage): boolean;
|
|
13
|
-
/** 读有界 JSON 请求体;超限抛 'body-too-large'(路由映射 413)。 */
|
|
14
|
-
export declare function readBody(req: IncomingMessage): Promise<unknown>;
|
|
15
|
-
/** 写 JSON 响应;调用方可追加/覆盖默认头。 */
|
|
16
|
-
export declare function writeJson(res: ServerResponse, status: number, body: unknown, headers?: Record<string, string | number>): void;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 资料读取与路径解析:群组工作区目录 → 注入文件清单 + 目录浏览器。
|
|
3
|
-
* 路径解析顺序:~ 展开到 home;绝对路径直用;相对路径先试各工作区根,
|
|
4
|
-
* 再试 dsh web 进程 cwd。目录浏览器与资料读取共用同一套解析。
|
|
5
|
-
* @module dsh-group-chat/host/materials
|
|
6
|
-
*/
|
|
7
|
-
import type { BrowseResult, GroupRecord } from '../core/types.ts';
|
|
8
|
-
import type { HostState } from './state.ts';
|
|
9
|
-
/** 资料面。 */
|
|
10
|
-
export interface Materials {
|
|
11
|
-
/** 群组工作区目录 → 注入文件清单(dir 为解析后的展示路径)。 */
|
|
12
|
-
loadWorkspaceFiles: (g: GroupRecord) => Promise<{
|
|
13
|
-
dir: string;
|
|
14
|
-
parts: {
|
|
15
|
-
name: string;
|
|
16
|
-
content: string;
|
|
17
|
-
error?: string;
|
|
18
|
-
}[];
|
|
19
|
-
}>;
|
|
20
|
-
/** 文件清单 → system 提示词内的「共享资料」块(单文件 16k / 总量 48k 截断)。 */
|
|
21
|
-
materialBlock: (parts: {
|
|
22
|
-
name: string;
|
|
23
|
-
content: string;
|
|
24
|
-
error?: string;
|
|
25
|
-
}[], dir: string) => string;
|
|
26
|
-
/** 目录浏览:返回文件+目录条目(绝对路径由 Host 解析,客户端不拼路径)。 */
|
|
27
|
-
browse: (args: {
|
|
28
|
-
path?: string;
|
|
29
|
-
} | undefined) => Promise<BrowseResult>;
|
|
30
|
-
}
|
|
31
|
-
/** 创建资料面。 */
|
|
32
|
-
export declare function createMaterials(core: HostState): Materials;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 持久化(PERSISTENCE.md v2.1):事件驱动脏标记合并落盘 + 启动恢复。
|
|
3
|
-
* 锁失败/写失败时降级为内存态运行(console 告警)。
|
|
4
|
-
* @module dsh-group-chat/host/persistence
|
|
5
|
-
*/
|
|
6
|
-
import type { HostState } from './state.ts';
|
|
7
|
-
/** 持久化面。 */
|
|
8
|
-
export interface Persistence {
|
|
9
|
-
/** 事件驱动落盘;同一 tick 内多次变更合并为一次写。 */
|
|
10
|
-
schedulePersist: (targets?: {
|
|
11
|
-
ledger?: boolean;
|
|
12
|
-
session?: string | null;
|
|
13
|
-
roles?: string | null;
|
|
14
|
-
workspace?: string | null;
|
|
15
|
-
}) => void;
|
|
16
|
-
/** 同步 flush:写全部脏文件(dispose 最终落盘用)。 */
|
|
17
|
-
flushNow: () => void;
|
|
18
|
-
/** 删除群组/会话后摘除脏标记(对应文件已删/将删,flush 跳过)。 */
|
|
19
|
-
dropDirty: (targets: {
|
|
20
|
-
session?: string | null;
|
|
21
|
-
roles?: string | null;
|
|
22
|
-
workspace?: string | null;
|
|
23
|
-
}) => void;
|
|
24
|
-
/** dispose:同步最终 flush → 释放锁 → 摘除句柄。 */
|
|
25
|
-
release: () => void;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* 创建持久化面:构造即完成 store 初始化 + hydrate(v1 迁移 → 残留清理 →
|
|
29
|
-
* 清单 → 群组数据 → 会话文件;缺文件空重建;补建默认会话/群组立即落盘)。
|
|
30
|
-
*/
|
|
31
|
-
export declare function createPersistence(core: HostState): Persistence;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HTTP 路由(经 webServer 暴露):
|
|
3
|
-
* GET /api/group-chat/state 全量快照
|
|
4
|
-
* POST /api/group-chat/action { kind: mutate|send|stop|models|preview, ... }
|
|
5
|
-
* GET /api/group-chat/events SSE,状态变化时推送节流后的全量快照
|
|
6
|
-
* @module dsh-group-chat/host/routes
|
|
7
|
-
*/
|
|
8
|
-
import type { WebRoute } from '@deepseek-ai/dsh-host-webserver';
|
|
9
|
-
import type { GroupChatService } from './service.ts';
|
|
10
|
-
/** 构建群聊的三条 HTTP 路由。 */
|
|
11
|
-
export declare function makeGroupChatRoutes(service: GroupChatService): WebRoute[];
|