@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
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 持久化(PERSISTENCE.md v2.1:会话级文件隔离)。
|
|
3
|
-
*
|
|
4
|
-
* 目录布局(每群组一目录,一会话一文件):
|
|
5
|
-
* <dir>/ledger.json 群组/会话清单(schema 3,纯清单,pretty;群组含 permissionTier)
|
|
6
|
-
* <dir>/<group-id>/workspaceDir 工作区目录设置(纯文本一行)
|
|
7
|
-
* <dir>/<group-id>/roles.json 群组角色(schema 1,紧凑)
|
|
8
|
-
* <dir>/<group-id>/sessions/session-<uuid>.json 会话(schema 1,自包含,紧凑)
|
|
9
|
-
*
|
|
10
|
-
* 原子写 tmp+fsync+rename(每目录一次 fsync);单实例 .lock;损坏隔离重建;
|
|
11
|
-
* 写失败保留脏标记;v1 自动迁移。
|
|
12
|
-
* @module dsh-group-chat/host/store
|
|
13
|
-
*/
|
|
14
|
-
import type { GroupRecord } from '../core/types.ts';
|
|
15
|
-
/** DSH 主目录;DSH_GROUP_CHAT_STORE 供测试覆盖存储位置。 */
|
|
16
|
-
export declare const DSH_HOME: string;
|
|
17
|
-
/** 存储根目录。 */
|
|
18
|
-
export declare const STORE_DIR: string;
|
|
19
|
-
/** 会话文件名 → 会话 id。 */
|
|
20
|
-
export declare function sessionFileMatch(name: string): string | null;
|
|
21
|
-
export declare class Store {
|
|
22
|
-
readonly dir: string;
|
|
23
|
-
readonly ledgerFile: string;
|
|
24
|
-
private readonly lockFile;
|
|
25
|
-
private lockFd;
|
|
26
|
-
constructor(dir: string);
|
|
27
|
-
groupDir(groupId: string): string;
|
|
28
|
-
sessionsDir(groupId: string): string;
|
|
29
|
-
sessionFile(groupId: string, sessionId: string): string;
|
|
30
|
-
rolesFile(groupId: string): string;
|
|
31
|
-
workspaceFile(groupId: string): string;
|
|
32
|
-
private acquireLock;
|
|
33
|
-
release(): void;
|
|
34
|
-
fsyncDir(dir: string): void;
|
|
35
|
-
/** 原子写:tmp+fsync+rename;目录 fsync 由调用方按 flush 批量执行(每目录一次)。 */
|
|
36
|
-
atomicWrite(file: string, text: string): void;
|
|
37
|
-
quarantine(file: string): void;
|
|
38
|
-
/** 读 JSON;缺失返回 null;损坏则隔离后返回 null。 */
|
|
39
|
-
loadJson(file: string): unknown;
|
|
40
|
-
readWorkspace(groupId: string): string;
|
|
41
|
-
/** hydrate 残留清理:.tmp-* 删除;同前缀 .corrupt-* 只保留最近 1 份。 */
|
|
42
|
-
cleanup(): void;
|
|
43
|
-
/** v1(ledger+messages 双文件)→ v2 一次性迁移;幂等,messages.json 只归档从不删除。 */
|
|
44
|
-
migrateV1(): void;
|
|
45
|
-
}
|
|
46
|
-
/** ledger 清单的读取形态(hydrate 用;allowCommands 为 v2 遗留字段,读取时经 migrateTier 迁移)。 */
|
|
47
|
-
export interface LedgerDocument {
|
|
48
|
-
schema?: number;
|
|
49
|
-
groups?: {
|
|
50
|
-
id: string;
|
|
51
|
-
name?: string;
|
|
52
|
-
permissionTier?: string;
|
|
53
|
-
allowCommands?: boolean;
|
|
54
|
-
}[];
|
|
55
|
-
sessions?: {
|
|
56
|
-
id: string;
|
|
57
|
-
groupId: string;
|
|
58
|
-
}[];
|
|
59
|
-
}
|
|
60
|
-
/** 从磁盘目录回收群组 id 列表(ledger 缺失/损坏时的兜底路径)。 */
|
|
61
|
-
export declare function scanGroupIds(dir: string): string[];
|
|
62
|
-
/** 扫描群组目录下的会话文件(ledger 缺失/损坏时的兜底路径)。 */
|
|
63
|
-
export declare function scanSessionIds(store: Store, groupId: string): string[];
|
|
64
|
-
/** 空群组记录构造(hydrate 兜底路径用)。 */
|
|
65
|
-
export declare function emptyGroup(id: string, name: string): GroupRecord;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 工具执行(TOOLS.md §2:沙箱 / §3:确认闸门):read_file / list_dir /
|
|
3
|
-
* run_command 三件套;realpath 硬边界 + 分隔符比较;run_command 按群组
|
|
4
|
-
* 权限档位走逐条确认或直接执行。
|
|
5
|
-
* @module dsh-group-chat/host/tools
|
|
6
|
-
*/
|
|
7
|
-
import { TOOL_SCHEMAS } from '../core/tools.ts';
|
|
8
|
-
import type { GroupRecord, ToolExecution } from '../core/types.ts';
|
|
9
|
-
import type { HostState } from './state.ts';
|
|
10
|
-
/** 工具面。 */
|
|
11
|
-
export interface Tools {
|
|
12
|
-
/** 执行一次工具调用(args 解析 + 分发 + 计时;确认闸门在 run_command 内)。 */
|
|
13
|
-
executeTool: (g: GroupRecord, root: string, tc: {
|
|
14
|
-
id: string;
|
|
15
|
-
name: string;
|
|
16
|
-
args: string;
|
|
17
|
-
}) => Promise<ToolExecution>;
|
|
18
|
-
/** 工具 schema(view_only 档剔除 run_command)。 */
|
|
19
|
-
buildToolSchemas: (g: GroupRecord) => (typeof TOOL_SCHEMAS)[number][];
|
|
20
|
-
/** 置 pendingConfirm 后无限等待,confirmCommand/stop/dispose 唤醒。 */
|
|
21
|
-
requestConfirmation: (toolCallId: string, args: Record<string, unknown>) => Promise<boolean>;
|
|
22
|
-
/** 唤醒确认等待(以拒绝放行;置空 pendingConfirm)。 */
|
|
23
|
-
wakeConfirm: () => void;
|
|
24
|
-
/** kill 正在执行的命令子进程。 */
|
|
25
|
-
killChild: () => void;
|
|
26
|
-
}
|
|
27
|
-
/** 创建工具面。 */
|
|
28
|
-
export declare function createTools(core: HostState, touch: () => void): Tools;
|