dsh-manual-compact-plugin 0.2.1 → 0.2.2
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/index.js +10 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -132,9 +132,17 @@ function resolveAgent(agents, sessionId) {
|
|
|
132
132
|
async function executeCompact(ctx, agents, request, signal, onProgress) {
|
|
133
133
|
const resolved = resolveAgent(agents, request.sessionId)
|
|
134
134
|
const agent = resolved.agent
|
|
135
|
-
|
|
135
|
+
// The compaction provider may be mounted on the host-registrant context
|
|
136
|
+
// (near the root) and take the agent as its target, or directly on the
|
|
137
|
+
// agent's own context. Try both and report exactly which is available.
|
|
138
|
+
const rootCompaction = ctx && typeof ctx.get === 'function' ? ctx.get('compaction') : undefined
|
|
139
|
+
const agentCompaction = agent && agent.ctx && typeof agent.ctx.get === 'function' ? agent.ctx.get('compaction') : undefined
|
|
140
|
+
const compaction = rootCompaction || agentCompaction
|
|
136
141
|
if (!agent || !compaction) {
|
|
137
|
-
const diag = resolved.diagnostic
|
|
142
|
+
const diag = resolved.diagnostic
|
|
143
|
+
|| (agent
|
|
144
|
+
? `compaction 服务不可用(host 根:${rootCompaction ? '有' : '无'},agent ctx:${agentCompaction ? '有' : '无'})。`
|
|
145
|
+
: '当前会话暂时没有可用的压缩服务。')
|
|
138
146
|
return { ok: false, shadowed: 0, message: diag, cancelled: false, file: '' }
|
|
139
147
|
}
|
|
140
148
|
const records = []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-manual-compact-plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Manual context compaction for DeepSeek Harness: keep the latest N conversation items with stop or batch mode and a per-session compaction archive — embedded in the context meter popup when the meter panel slot exists, or a composer button otherwise.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|