dsh-plugin-om 0.0.38 → 0.0.40
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 +1 -1
- package/dist/compaction-log.d.ts.map +1 -1
- package/dist/compress.d.ts +5 -4
- package/dist/compress.d.ts.map +1 -1
- package/dist/index.mjs +16 -12
- package/package.json +21 -21
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
## 安装与启用
|
|
23
23
|
|
|
24
|
-
本插件适配 dsh 0.1.
|
|
24
|
+
本插件适配 dsh 0.1.5-rc.2 及以上版本(客户端压缩卡片依赖宿主 `uiConversation` 服务)。`$DSH_HOME` 缺省为 `~/.dsh`,profile 描述 dsh 进程的启动模式。
|
|
25
25
|
|
|
26
26
|
```sh
|
|
27
27
|
dsh plugin --profile <profile> add dsh-plugin-om
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction-log.d.ts","sourceRoot":"","sources":["../src/compaction-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAoB,OAAO,EAA2B,MAAM,sBAAsB,CAAC;AAG/F,OAAO,KAAK,EAAwB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGjF,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,KAAK,YAAY,EAAQ,MAAM,YAAY,CAAC;AAErD,8CAA8C;AAC9C,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAS3D,8CAA8C;AAC9C,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,EACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,GACf,MAAM,CAER;AAkCD;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,EACxC,OAAO,E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AsBR;AAYD;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,OAAO,EACZ,aAAa,EAAE,OAAO,EACtB,OAAO,EAAE;IACP,2BAA2B;IAC3B,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,iDAAiD;IACjD,MAAM,EAAE,YAAY,CAAC;IACrB,+DAA+D;IAC/D,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7B,+BAA+B;IAC/B,KAAK,EAAE,gBAAgB,CAAC;IACxB,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,KAAK,EAAE,OAAO,CAAC;CAChB,GACA,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkD7B"}
|
package/dist/compress.d.ts
CHANGED
|
@@ -77,10 +77,11 @@ export declare function resolveCompressionEffort(ctx: Context, session: Session,
|
|
|
77
77
|
*/
|
|
78
78
|
export declare function isPairBalancedAfter(session: Session, seq: number): boolean;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* tool-call/result
|
|
83
|
-
*
|
|
80
|
+
* 观察压缩区间:压缩边界后的首个表层节点(无边界时从首个非 system/message 头节点的
|
|
81
|
+
* 表层节点起)→ 触发点完整消息(endMessageIndex)对应的表层终点(取该完整消息最后
|
|
82
|
+
* 一个事件 seq 在表层中的位置);区间终点回退到 tool-call/result 配对平衡点(不切段)。
|
|
83
|
+
* 触发点完整消息不存在或其事件已不在表层(被后续压缩遮蔽)时返回 undefined。
|
|
84
|
+
* 返回区间起止表层 seq 与被遮蔽 seq 列表。
|
|
84
85
|
*/
|
|
85
86
|
export declare function computeCompressRange(session: Session, endMessageIndex: number): {
|
|
86
87
|
start: number;
|
package/dist/compress.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress.d.ts","sourceRoot":"","sources":["../src/compress.ts"],"names":[],"mappings":"AAAA;;;;;;;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,CAAC,kBAAkB,CAAC,CAyB7B"}
|
package/dist/index.mjs
CHANGED
|
@@ -274,7 +274,8 @@ async function recordCompressionSession(ctx, parentSession, options) {
|
|
|
274
274
|
if (message.role === "assistant") child.append("assistant/message", {
|
|
275
275
|
turn: 0,
|
|
276
276
|
step,
|
|
277
|
-
message
|
|
277
|
+
message,
|
|
278
|
+
stream: []
|
|
278
279
|
}, { surfaceOp: "append" });
|
|
279
280
|
else child.append("user/message", message, { surfaceOp: "append" });
|
|
280
281
|
}
|
|
@@ -9036,16 +9037,19 @@ function isPairBalancedAfter(session, seq) {
|
|
|
9036
9037
|
return false;
|
|
9037
9038
|
}
|
|
9038
9039
|
/**
|
|
9039
|
-
*
|
|
9040
|
-
*
|
|
9041
|
-
* tool-call/result
|
|
9042
|
-
*
|
|
9040
|
+
* 观察压缩区间:压缩边界后的首个表层节点(无边界时从首个非 system/message 头节点的
|
|
9041
|
+
* 表层节点起)→ 触发点完整消息(endMessageIndex)对应的表层终点(取该完整消息最后
|
|
9042
|
+
* 一个事件 seq 在表层中的位置);区间终点回退到 tool-call/result 配对平衡点(不切段)。
|
|
9043
|
+
* 触发点完整消息不存在或其事件已不在表层(被后续压缩遮蔽)时返回 undefined。
|
|
9044
|
+
* 返回区间起止表层 seq 与被遮蔽 seq 列表。
|
|
9043
9045
|
*/
|
|
9044
9046
|
function computeCompressRange(session, endMessageIndex) {
|
|
9045
9047
|
const surface = [...session.surface.nodes];
|
|
9046
9048
|
if (surface.length === 0) return void 0;
|
|
9047
9049
|
const { boundarySeq } = historySection(session);
|
|
9048
|
-
const
|
|
9050
|
+
const headSeq = surface[0];
|
|
9051
|
+
const headOffset = (headSeq === void 0 ? void 0 : session.snapshotEvents()[headSeq])?.type === "system/message" ? 1 : 0;
|
|
9052
|
+
const startIdx = boundarySeq === void 0 ? headOffset : surface.indexOf(SessionSeq(boundarySeq)) + 1;
|
|
9049
9053
|
if (startIdx >= surface.length) return void 0;
|
|
9050
9054
|
const target = indexCompleteMessages(session).find((cm) => cm.index === endMessageIndex);
|
|
9051
9055
|
if (target === void 0) return void 0;
|
|
@@ -9209,8 +9213,8 @@ function appendHistoryMessage(session, content, sourceEventSeqs, surfaceOp, comp
|
|
|
9209
9213
|
session.append("user/message", message, {
|
|
9210
9214
|
surfaceOp: {
|
|
9211
9215
|
op: "replace",
|
|
9212
|
-
|
|
9213
|
-
|
|
9216
|
+
startSeq: SessionSeq(surfaceOp.startSeq),
|
|
9217
|
+
endSeq: SessionSeq(surfaceOp.endSeq)
|
|
9214
9218
|
},
|
|
9215
9219
|
sourceEventSeqs: sourceEventSeqs.map(SessionSeq)
|
|
9216
9220
|
});
|
|
@@ -9303,8 +9307,8 @@ async function reflectPass(ctx, agent, config, target, signal, reasoningEffort)
|
|
|
9303
9307
|
logger.step("反思提交:替换整个 <history> 块区段为合并摘要");
|
|
9304
9308
|
appendHistoryMessage(session, report, [summarySeq, ...blockSeqs], {
|
|
9305
9309
|
op: "replace",
|
|
9306
|
-
|
|
9307
|
-
|
|
9310
|
+
startSeq: first.seq,
|
|
9311
|
+
endSeq: last.seq
|
|
9308
9312
|
}, lifecycle.compactionId);
|
|
9309
9313
|
logger.step("反思提交:追加 compaction/end");
|
|
9310
9314
|
appendCompactionEnd(session, lifecycle, void 0, summaryResult.recordSessionId);
|
|
@@ -9543,8 +9547,8 @@ async function observePass(ctx, agent, config, waitCount, target, signal, reason
|
|
|
9543
9547
|
logger.step("观察提交:替换被压缩新消息区间为 <history>(旧块保留)");
|
|
9544
9548
|
appendHistoryMessage(session, report, [summarySeq, ...replaceSeqs], {
|
|
9545
9549
|
op: "replace",
|
|
9546
|
-
|
|
9547
|
-
|
|
9550
|
+
startSeq: replaceStart,
|
|
9551
|
+
endSeq: range.end
|
|
9548
9552
|
}, lifecycle.compactionId);
|
|
9549
9553
|
logger.step("观察提交:追加 compaction/end");
|
|
9550
9554
|
appendCompactionEnd(session, lifecycle, void 0, summaryResult.recordSessionId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-om",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -65,26 +65,26 @@
|
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@biomejs/biome": "^2.5.8",
|
|
67
67
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
68
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
69
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
70
|
-
"@deepseek-ai/dsh-client-ui-chat": "^0.1.
|
|
71
|
-
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.
|
|
72
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.
|
|
73
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.
|
|
74
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.
|
|
75
|
-
"@deepseek-ai/dsh-code-runtime": "^0.1.
|
|
76
|
-
"@deepseek-ai/dsh-compaction": "^0.1.
|
|
77
|
-
"@deepseek-ai/dsh-compaction-tool-result-pruner": "^0.1.
|
|
78
|
-
"@deepseek-ai/dsh-invariants": "^0.1.
|
|
79
|
-
"@deepseek-ai/dsh-llm": "^0.1.
|
|
80
|
-
"@deepseek-ai/dsh-scope": "^0.1.
|
|
81
|
-
"@deepseek-ai/dsh-session": "^0.1.
|
|
82
|
-
"@deepseek-ai/dsh-session-projection": "0.1.
|
|
83
|
-
"@deepseek-ai/dsh-subagent": "^0.1.
|
|
84
|
-
"@deepseek-ai/dsh-system-prompt": "^0.1.
|
|
85
|
-
"@deepseek-ai/dsh-token-meter": "^0.1.
|
|
86
|
-
"@deepseek-ai/dsh-tools": "^0.1.
|
|
87
|
-
"@deepseek-ai/dsh-user-approval": "^0.1.
|
|
68
|
+
"@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
|
|
69
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.5-rc.2",
|
|
70
|
+
"@deepseek-ai/dsh-client-ui-chat": "^0.1.5-rc.2",
|
|
71
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.5-rc.2",
|
|
72
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.5-rc.2",
|
|
73
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-rc.2",
|
|
74
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.5-rc.2",
|
|
75
|
+
"@deepseek-ai/dsh-code-runtime": "^0.1.5-rc.2",
|
|
76
|
+
"@deepseek-ai/dsh-compaction": "^0.1.5-rc.2",
|
|
77
|
+
"@deepseek-ai/dsh-compaction-tool-result-pruner": "^0.1.5-rc.2",
|
|
78
|
+
"@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
|
|
79
|
+
"@deepseek-ai/dsh-llm": "^0.1.5-rc.2",
|
|
80
|
+
"@deepseek-ai/dsh-scope": "^0.1.5-rc.2",
|
|
81
|
+
"@deepseek-ai/dsh-session": "^0.1.5-rc.2",
|
|
82
|
+
"@deepseek-ai/dsh-session-projection": "0.1.5-rc.2",
|
|
83
|
+
"@deepseek-ai/dsh-subagent": "^0.1.5-rc.2",
|
|
84
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.5-rc.2",
|
|
85
|
+
"@deepseek-ai/dsh-token-meter": "^0.1.5-rc.2",
|
|
86
|
+
"@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
|
|
87
|
+
"@deepseek-ai/dsh-user-approval": "^0.1.5-rc.2",
|
|
88
88
|
"@types/node": "^22.20.0",
|
|
89
89
|
"@types/react": "~18.3.1",
|
|
90
90
|
"@types/react-dom": "~18.3.0",
|