@royalcat/opencode-dcp-rc 4.0.1 → 4.0.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/README.md +31 -17
- package/dist/index.js +876 -19
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +2 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/prompts/context-limit-nudge.d.ts +1 -1
- package/dist/lib/prompts/context-limit-nudge.d.ts.map +1 -1
- package/dist/lib/prompts/extensions/system.d.ts +2 -2
- package/dist/lib/prompts/extensions/system.d.ts.map +1 -1
- package/dist/lib/prompts/iteration-nudge.d.ts +1 -1
- package/dist/lib/prompts/iteration-nudge.d.ts.map +1 -1
- package/dist/lib/prompts/turn-nudge.d.ts +1 -1
- package/dist/lib/prompts/turn-nudge.d.ts.map +1 -1
- package/dist/lib/v2/index.d.ts.map +1 -1
- package/dist/lib/v2/scrub.d.ts +94 -0
- package/dist/lib/v2/scrub.d.ts.map +1 -0
- package/dist/lib/v2/usage.d.ts +2 -1
- package/dist/lib/v2/usage.d.ts.map +1 -1
- package/lib/config.ts +32 -2
- package/lib/prompts/context-limit-nudge.ts +2 -0
- package/lib/prompts/extensions/system.ts +4 -0
- package/lib/prompts/iteration-nudge.ts +2 -0
- package/lib/prompts/system.ts +1 -1
- package/lib/prompts/turn-nudge.ts +2 -0
- package/lib/v2/index.ts +7 -1
- package/lib/v2/scrub.ts +954 -0
- package/lib/v2/usage.ts +34 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,9 @@ management in OpenCode.
|
|
|
15
15
|
**Design goal: the plugin stays invisible.** Injected system prompts, message-ID
|
|
16
16
|
tags, nudges, and summary replacement only ever exist in the outgoing model
|
|
17
17
|
request. The user's stored history is never rewritten, and the only
|
|
18
|
-
user-visible artifact is the `compress` tool call itself.
|
|
18
|
+
user-visible artifact is the `compress` tool call itself. If the model echoes
|
|
19
|
+
injected tags or reminders into its reply, the fork strips them from the
|
|
20
|
+
response before OpenCode stores or displays it.
|
|
19
21
|
|
|
20
22
|
## How it differs from upstream DCP
|
|
21
23
|
|
|
@@ -37,6 +39,13 @@ user-visible artifact is the `compress` tool call itself.
|
|
|
37
39
|
`dcp-rc.json`, and no self-update. Commands and prompt overrides keep upstream
|
|
38
40
|
names: `/dcp`, `/dcp-compress`, and `dcp-prompts/overrides/`.
|
|
39
41
|
|
|
42
|
+
- **Echoes are filtered.** Models sometimes copy injected reminders or message-ID
|
|
43
|
+
tags into their replies. The fork scrubs those copies from the model response
|
|
44
|
+
before OpenCode stores or displays it. Controlled by
|
|
45
|
+
`compress.scrubModelOutput` and `compress.scrubMessageIds` (both on by
|
|
46
|
+
default); it never touches tool-call arguments, so working with DCP files or
|
|
47
|
+
quoting tags intentionally still works.
|
|
48
|
+
|
|
40
49
|
## Install
|
|
41
50
|
|
|
42
51
|
Requires OpenCode V2 (`@opencode/plugin` ^2.0.22; verified against 2.0.4).
|
|
@@ -75,18 +84,29 @@ opencode plugin add /path/to/opencode-dcp-rc
|
|
|
75
84
|
{
|
|
76
85
|
"compress": {
|
|
77
86
|
"permission": "allow",
|
|
78
|
-
"minContextLimit":
|
|
79
|
-
"maxContextLimit":
|
|
87
|
+
"minContextLimit": "20%",
|
|
88
|
+
"maxContextLimit": "80%",
|
|
89
|
+
"scrubModelOutput": true,
|
|
90
|
+
"scrubMessageIds": true,
|
|
80
91
|
},
|
|
81
92
|
"pruneNotification": "off",
|
|
82
93
|
}
|
|
83
94
|
```
|
|
84
95
|
|
|
96
|
+
Both context limits accept a token count or a percentage of the model's context
|
|
97
|
+
window; the defaults are `"20%"` and `"80%"`, and `compress.modelMinLimits` /
|
|
98
|
+
`compress.modelMaxLimits` override them per `providerID/modelID`.
|
|
99
|
+
|
|
85
100
|
The rest of the upstream configuration (strategies, protection lists, manual
|
|
86
101
|
mode, subagents) still applies, except `compress.mode` and `autoUpdate`, which
|
|
87
102
|
the fork no longer uses. Compress prompt text can be overridden through
|
|
88
103
|
`dcp-prompts/overrides/` when `experimental.customPrompts` is enabled.
|
|
89
104
|
|
|
105
|
+
`scrubModelOutput` removes DCP tags and reminder blocks the model may echo into
|
|
106
|
+
its reply; `scrubMessageIds` also removes message-ID refs (`@N@`, `@bN@`,
|
|
107
|
+
`@blocked@`) that appear alone on a line. Both default to `true` and are
|
|
108
|
+
kill-switches only — for example to debug the raw model output.
|
|
109
|
+
|
|
90
110
|
## Status and limitations
|
|
91
111
|
|
|
92
112
|
- The hidden summary call uses the session's provider/model and consumes a normal
|
|
@@ -94,6 +114,10 @@ the fork no longer uses. Compress prompt text can be overridden through
|
|
|
94
114
|
with prefix caching can reuse it.
|
|
95
115
|
- If the host rejects nested generation, the `compress` call fails visibly and the
|
|
96
116
|
selection is left uncompressed so it can be retried.
|
|
117
|
+
- Output scrubbing covers HTTP provider responses (OpenAI Responses/Chat,
|
|
118
|
+
Anthropic, Google) and the AI SDK text/reasoning path. Providers using the
|
|
119
|
+
experimental WebSocket transport are not covered, and copies already stored
|
|
120
|
+
before upgrading are not rewritten.
|
|
97
121
|
- Forked from DCP v3.2.0. Upstream is AGPL-3.0-or-later; this fork keeps the
|
|
98
122
|
same license and attribution (see `LICENSE`).
|
|
99
123
|
|
|
@@ -101,10 +125,6 @@ the fork no longer uses. Compress prompt text can be overridden through
|
|
|
101
125
|
|
|
102
126
|
# Upstream README
|
|
103
127
|
|
|
104
|
-
> **Fork note:** The upstream documentation below is kept for attribution and
|
|
105
|
-
> history. This fork does not ship its `range`/`message` modes, V1 support, or
|
|
106
|
-
> auto-update behavior; see the fork section above for what this package does.
|
|
107
|
-
|
|
108
128
|
# Dynamic Context Pruning Plugin
|
|
109
129
|
|
|
110
130
|
[](https://ko-fi.com/dansmolsky)
|
|
@@ -181,16 +201,13 @@ Each level overrides the previous, so project settings take priority over global
|
|
|
181
201
|
|
|
182
202
|
```jsonc
|
|
183
203
|
{
|
|
184
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
204
|
+
"$schema": "https://raw.githubusercontent.com/royalcat/opencode-dcp-rc/master/dcp.schema.json",
|
|
185
205
|
// Enable or disable the plugin
|
|
186
206
|
"enabled": true,
|
|
187
|
-
// Automatically update npm-installed DCP when a newer npm latest is available.
|
|
188
|
-
// Version-locked plugin specs are not updated.
|
|
189
|
-
"autoUpdate": true,
|
|
190
207
|
// Enable debug logging to ~/.config/opencode/logs/dcp/
|
|
191
208
|
"debug": false,
|
|
192
209
|
// Notification display: "off", "minimal", or "detailed"
|
|
193
|
-
"pruneNotification": "
|
|
210
|
+
"pruneNotification": "off",
|
|
194
211
|
// Notification type: "chat" (in-conversation) or "toast" (system toast)
|
|
195
212
|
"pruneNotificationType": "chat",
|
|
196
213
|
// Slash commands configuration
|
|
@@ -225,9 +242,6 @@ Each level overrides the previous, so project settings take priority over global
|
|
|
225
242
|
"protectedFilePatterns": [],
|
|
226
243
|
// Unified context compression tool and behavior settings
|
|
227
244
|
"compress": {
|
|
228
|
-
// Compression mode: "range" (compress spans into block summaries)
|
|
229
|
-
// or experimental "message" (compress individual raw messages)
|
|
230
|
-
"mode": "range",
|
|
231
245
|
// Permission mode: "allow" (no prompt), "ask" (prompt), "deny" (tool not registered)
|
|
232
246
|
"permission": "allow",
|
|
233
247
|
// Show compression content in a chat notification
|
|
@@ -237,11 +251,11 @@ Each level overrides the previous, so project settings take priority over global
|
|
|
237
251
|
// Soft upper threshold: above this, DCP keeps injecting strong
|
|
238
252
|
// compression nudges (based on nudgeFrequency), so compression is
|
|
239
253
|
// much more likely. Accepts: number or "X%" of model context window.
|
|
240
|
-
"maxContextLimit":
|
|
254
|
+
"maxContextLimit": "80%",
|
|
241
255
|
// Soft lower threshold for reminder nudges: below this, turn/iteration
|
|
242
256
|
// reminders are off (compression less likely). At/above this, reminders
|
|
243
257
|
// are on. Accepts: number or "X%" of model context window.
|
|
244
|
-
"minContextLimit":
|
|
258
|
+
"minContextLimit": "20%",
|
|
245
259
|
// Optional per-model override for maxContextLimit by providerID/modelID.
|
|
246
260
|
// If present, this wins over the global maxContextLimit.
|
|
247
261
|
// Accepts: number or "X%".
|