@duke-dsh-plugins/dsh-remote-control 1.3.2 → 1.3.3
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/lib/host-bridge.mjs +27 -2
- package/market/index.json +10 -0
- package/package.json +1 -1
package/lib/host-bridge.mjs
CHANGED
|
@@ -588,11 +588,31 @@ export function mapToolResultEvent(sessionId, event) {
|
|
|
588
588
|
};
|
|
589
589
|
}
|
|
590
590
|
|
|
591
|
+
/**
|
|
592
|
+
* 事件是否属于「对话记录(transcript)」来源(2026-11-13 修复)。
|
|
593
|
+
*
|
|
594
|
+
* 宿主在 `compaction/prune` 时把超长的工具结果改写成 head+tail,并 **append 一条新的
|
|
595
|
+
* `tool/result`**(`surfaceOp:{op:'replace',startSeq,endSeq}` + `sourceEventSeqs:[原 seq]`)。
|
|
596
|
+
* 那条新事件是**模型面(model-only)的替换副本**:只有结果,**没有配对的 `tool/call`**;
|
|
597
|
+
* 桌面端同样只把 `surfaceOp === "append"` 的事件当对话记录(`dsh-client-ui-chat` 的
|
|
598
|
+
* `isAppendSurfaceEvent` 注释原话:replacement copies stay model-only)。
|
|
599
|
+
* `tool/call` 不带 `surfaceOp`(undefined)= append。
|
|
600
|
+
*
|
|
601
|
+
* `mapHistoryMessages` 一直按这条口径过滤(见其 `event.surfaceOp !== "append"`),
|
|
602
|
+
* `mapHistorySteps` 曾经漏掉 → prune 的替换副本被当成一次新调用,`name` 恒为空,
|
|
603
|
+
* 手机端渲染成兜底「工具」,还带着一个错位的 `seq` 与老页里的同名步骤重复。
|
|
604
|
+
*/
|
|
605
|
+
function isTranscriptEvent(event) {
|
|
606
|
+
const op = event?.surfaceOp;
|
|
607
|
+
return op === undefined || op === null || op === "append";
|
|
608
|
+
}
|
|
609
|
+
|
|
591
610
|
/**
|
|
592
611
|
* 契约 §5.7 StepRecord 提取:session.history 的 page.records → steps[]。
|
|
593
612
|
*
|
|
594
613
|
* 规则:
|
|
595
|
-
* - 只看 type==='tool/call' 与 'tool/result'
|
|
614
|
+
* - 只看 type==='tool/call' 与 'tool/result' 的记录;**非 append 的 surface 替换副本跳过**
|
|
615
|
+
* (prune 重写的事件只有结果、没有 call,当成步骤就是一条无名行);
|
|
596
616
|
* - 按 callId 配对:一次调用合并成一条(call 的字段 + result 的状态/文本);
|
|
597
617
|
* - seq:优先取 tool/call 事件的 seq;只有 tool/result 时取它的 seq;
|
|
598
618
|
* - status:tool/result 的 isError 决定 ok/error;只有 call 没有 result 时 running;
|
|
@@ -613,6 +633,8 @@ export function mapHistorySteps(records) {
|
|
|
613
633
|
if (!event || typeof event !== "object") continue;
|
|
614
634
|
const type = event.type;
|
|
615
635
|
if (type !== "tool/call" && type !== "tool/result") continue;
|
|
636
|
+
// 替换副本(compaction/prune 的 surface 重写)不是对话事件:跳过。
|
|
637
|
+
if (type === "tool/result" && !isTranscriptEvent(event)) continue;
|
|
616
638
|
const data = event.data;
|
|
617
639
|
if (!data || typeof data !== "object") continue;
|
|
618
640
|
const ts = eventTime(event);
|
|
@@ -1259,7 +1281,10 @@ export class HostBridge {
|
|
|
1259
1281
|
return;
|
|
1260
1282
|
}
|
|
1261
1283
|
if (type === "tool/result") {
|
|
1262
|
-
|
|
1284
|
+
// 2026-11-13:surface 替换副本(prune 重写)是模型面事件,桌面端也不把它当
|
|
1285
|
+
// 对话事件 → **不桥接**。否则手机端会多出一条没有名字的步骤(callId 没有
|
|
1286
|
+
// 配对的 tool/call 可查),并把用户已经看到的结果文本换成剪枝版。
|
|
1287
|
+
const mapped = isTranscriptEvent(event) ? mapToolResultEvent(sessionId, event) : null;
|
|
1263
1288
|
if (mapped !== null) {
|
|
1264
1289
|
this.#flushStream(sessionId);
|
|
1265
1290
|
this.#sendEvent("tool.result", mapped);
|
package/market/index.json
CHANGED
|
@@ -69,6 +69,16 @@
|
|
|
69
69
|
"sortKeys": {}
|
|
70
70
|
},
|
|
71
71
|
"versions": [
|
|
72
|
+
{
|
|
73
|
+
"version": "1.3.3",
|
|
74
|
+
"publishTimestamp": 1794529053,
|
|
75
|
+
"source": {
|
|
76
|
+
"type": "npm"
|
|
77
|
+
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"dsh": "^0.1.5-rc.3 || ^0.2.0-rc.1 || ^0.2.1-rc.0"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
72
82
|
{
|
|
73
83
|
"version": "1.3.2",
|
|
74
84
|
"publishTimestamp": 1794495828,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duke-dsh-plugins/dsh-remote-control",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Remote-control bridge for DeepSeek Harness: pairs a HarmonyOS phone app with the desktop Host over an end-to-end-encrypted public relay (WebSocket). Lets the phone list/create/switch sessions, send prompts, watch streamed replies, cancel turns, and answer approval and ask-user-question requests from anywhere; pushes Huawei Push Kit notifications (gracefully disabled when AGC is unconfigured) for approvals, questions, and turn completion. The pairing QR lives in the DSH settings panel (\"DSH Pocket\"). Fail-open by design: any relay timeout or fault hands the request back to the desktop answerer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|