dsh-mini-remote 0.1.7 → 0.1.9
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/CHANGELOG.md +49 -10
- package/README.en.md +33 -1
- package/README.md +33 -1
- package/client/client.js +272 -1
- package/lib/commands.js +6 -0
- package/lib/events.js +36 -5
- package/lib/history.js +21 -3
- package/lib/index.js +1323 -19
- package/lib/lark.js +1154 -0
- package/lib/page.html +2658 -136
- package/lib/page.js +17 -3
- package/lib/pairing.js +32 -3
- package/lib/permissions.js +1 -0
- package/lib/server.js +522 -30
- package/lib/session-meta-cache.js +100 -0
- package/lib/store.js +253 -2
- package/lib/subagent-cache.js +63 -0
- package/lib/trajectory.js +570 -0
- package/lib/tree.js +107 -15
- package/package.json +2 -1
package/lib/history.js
CHANGED
|
@@ -17,9 +17,13 @@ import { foldCommandEvent } from './commands.js'
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @param {Array<{type:string, time?:number, data?:any}>} events DSH 的原始事件,**按发生顺序**。
|
|
20
|
-
* @returns {Array<{role:'user'|'assistant'|'command', text?:string|null, timestamp:number|null,
|
|
20
|
+
* @returns {Array<{role:'user'|'assistant'|'command'|'notice', text?:string|null, timestamp:number|null,
|
|
21
21
|
* id?:string|null, reason?:string, interrupted?:boolean,
|
|
22
|
-
* commandId?:string, name?:string, args?:string, kind?:string
|
|
22
|
+
* commandId?:string, name?:string, args?:string, kind?:string,
|
|
23
|
+
* summary?:string, senderSessionId?:string,
|
|
24
|
+
* turn?:number|null}>}
|
|
25
|
+
* turn=这条消息发生在第几轮(指令行没有轮号,留空)。完整模式靠它把
|
|
26
|
+
* 每轮的轨迹块插回对话原位。
|
|
23
27
|
*/
|
|
24
28
|
export function replayHistory(events) {
|
|
25
29
|
const tracker = createTurnTracker()
|
|
@@ -34,12 +38,26 @@ export function replayHistory(events) {
|
|
|
34
38
|
const action = tracker.feed('replay', event)
|
|
35
39
|
if (!action) continue
|
|
36
40
|
const timestamp = typeof event?.time === 'number' ? event.time : null
|
|
41
|
+
// 子智能体完工的通知:它既不是用户说的话,也不是模型的回答,是**第三样东西**
|
|
42
|
+
// (和指令行同类)。单独一个 role,界面上按一张可展开的卡片画。
|
|
43
|
+
if (action.kind === 'notice') {
|
|
44
|
+
out.push({
|
|
45
|
+
role: 'notice',
|
|
46
|
+
text: action.text,
|
|
47
|
+
summary: action.summary,
|
|
48
|
+
senderSessionId: action.senderSessionId,
|
|
49
|
+
turn: action.turn ?? null,
|
|
50
|
+
timestamp,
|
|
51
|
+
})
|
|
52
|
+
continue
|
|
53
|
+
}
|
|
37
54
|
if (action.kind === 'user') {
|
|
38
|
-
out.push({ role: 'user', text: action.text, id: action.id ?? null, timestamp })
|
|
55
|
+
out.push({ role: 'user', text: action.text, id: action.id ?? null, turn: action.turn ?? null, timestamp })
|
|
39
56
|
} else {
|
|
40
57
|
out.push({
|
|
41
58
|
role: 'assistant',
|
|
42
59
|
text: action.text,
|
|
60
|
+
turn: action.turn ?? null,
|
|
43
61
|
timestamp,
|
|
44
62
|
reason: action.reason,
|
|
45
63
|
interrupted: action.interrupted === true,
|