@lexwdex-org/opencode-dcp 3.4.1 → 3.4.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/dist/index.js +63 -40
- package/dist/index.js.map +1 -1
- package/dist/lib/compress/range.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/tool.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/system.d.ts +1 -1
- package/dist/lib/prompts/system.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/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1872,7 +1872,9 @@ function buildRangeFormatExtension(externalModelEnabled) {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
]
|
|
1874
1874
|
}
|
|
1875
|
-
|
|
1875
|
+
\`\`\`
|
|
1876
|
+
|
|
1877
|
+
\u8FB9\u754C ID \u5FC5\u987B\u4ECE\u5F53\u524D\u53EF\u89C1\u4E0A\u4E0B\u6587\u4E2D\u5DF2\u6709\u7684\u6CE8\u5165 ID \u7CBE\u786E\u9009\u53D6\uFF1B\u4E0D\u8981\u53D1\u660E ID\uFF0C\u4E5F\u4E0D\u8981\u6839\u636E\u987A\u5E8F\u5916\u63A8\u4E0D\u5B58\u5728\u7684 ID\u3002${externalHint}`;
|
|
1876
1878
|
}
|
|
1877
1879
|
function buildMessageFormatExtension(externalModelEnabled) {
|
|
1878
1880
|
const summaryField = externalModelEnabled ? `summary?: string // \u66FF\u6362\u8BE5\u6761\u6D88\u606F\u7684\u5B8C\u6574\u6280\u672F\u6458\u8981\uFF08\u53EF\u7701\u7565\uFF1B\u5916\u90E8\u6A21\u578B\u751F\u6210\uFF09` : `summary: string // \u66FF\u6362\u8BE5\u6761\u6D88\u606F\u7684\u5B8C\u6574\u6280\u672F\u6458\u8981`;
|
|
@@ -4732,9 +4734,11 @@ function buildSchema2(externalModelEnabled) {
|
|
|
4732
4734
|
content: tool2.schema.array(
|
|
4733
4735
|
tool2.schema.object({
|
|
4734
4736
|
startId: tool2.schema.string().describe(
|
|
4735
|
-
"
|
|
4737
|
+
"Injected message or block ID visible in the current context marking the beginning of the range. Do not invent IDs; use an exact visible mNNNN or bN boundary."
|
|
4738
|
+
),
|
|
4739
|
+
endId: tool2.schema.string().describe(
|
|
4740
|
+
"Injected message or block ID visible in the current context marking the end of the range. Do not invent IDs; use an exact visible mNNNN or bN boundary."
|
|
4736
4741
|
),
|
|
4737
|
-
endId: tool2.schema.string().describe("Message or block ID marking the end of range (e.g. m0012, b5)"),
|
|
4738
4742
|
summary: summaryField
|
|
4739
4743
|
})
|
|
4740
4744
|
).describe(
|
|
@@ -5135,44 +5139,51 @@ import { homedir as homedir4 } from "os";
|
|
|
5135
5139
|
|
|
5136
5140
|
// lib/prompts/system.ts
|
|
5137
5141
|
var SYSTEM = `
|
|
5138
|
-
|
|
5142
|
+
You run in a context-limited environment. Manage context actively to avoid accumulation and keep retrieval quality high.
|
|
5143
|
+
|
|
5144
|
+
Your only context-management tool is \`compress\`. It replaces older conversation content with a technical summary you generate.
|
|
5145
|
+
|
|
5146
|
+
Hard constraints
|
|
5147
|
+
- Context management is done ONLY by calling \`compress\`. Never produce summaries in plain text.
|
|
5148
|
+
- NEVER output \`<summary>\` or \`<analysis>\` XML tags in text responses \u2014 they cause system errors.
|
|
5149
|
+
- If context needs compression, call \`compress\`. Do not write summaries inline.
|
|
5150
|
+
- Use Markdown headings (e.g. \`## Analysis\`, \`## Summary\`) to organize information. Never use XML tags.
|
|
5139
5151
|
|
|
5140
|
-
|
|
5152
|
+
\`\` and \`\` are environment-injected metadata. Do not output them.
|
|
5141
5153
|
|
|
5142
|
-
|
|
5143
|
-
- \u4E0A\u4E0B\u6587\u7BA1\u7406\u4EC5\u901A\u8FC7\u8C03\u7528 \`compress\` \u5DE5\u5177\u5B8C\u6210\u3002\u7EDD\u4E0D\u4EE5\u7EAF\u6587\u672C\u5F62\u5F0F\u751F\u6210\u6458\u8981\u3002
|
|
5144
|
-
- **\u4E25\u683C\u7981\u6B62**\u5728\u6587\u672C\u54CD\u5E94\u4E2D\u8F93\u51FA \`<summary>\` \u6216 \`<analysis>\` XML \u6807\u7B7E\u3002\u8FD9\u4E9B\u6807\u7B7E\u4F1A\u5BFC\u81F4\u7CFB\u7EDF\u9519\u8BEF\u3002
|
|
5145
|
-
- \u5982\u679C\u4F60\u8BA4\u4E3A\u4E0A\u4E0B\u6587\u9700\u8981\u538B\u7F29\uFF0C\u8C03\u7528 \`compress\` \u5DE5\u5177\u3002\u4E0D\u8981\u5185\u8054\u7F16\u5199\u6458\u8981\u3002
|
|
5146
|
-
- \u6240\u6709\u8F93\u51FA\u5FC5\u987B\u4F7F\u7528**\u4E2D\u6587**\u3002
|
|
5147
|
-
- \u5982\u679C\u9700\u8981\u5728\u6587\u672C\u4E2D\u7EC4\u7EC7\u4FE1\u606F\uFF0C\u4F7F\u7528 Markdown \u683C\u5F0F\uFF08\u5982 \`## \u5206\u6790\`\u3001\`## \u603B\u7ED3\`\uFF09\uFF0C\u7EDD\u4E0D\u4F7F\u7528 XML \u6807\u7B7E\u3002
|
|
5154
|
+
When to compress
|
|
5148
5155
|
|
|
5149
|
-
|
|
5156
|
+
HIGHEST-PRIORITY HARD TRIGGER \u2014 call \`compress\` immediately whenever the conversation TOPIC changes. Compress the previous topic's finished context into a summary.
|
|
5150
5157
|
|
|
5151
|
-
|
|
5152
|
-
\`compress\` \u5C06\u5BF9\u8BDD\u5185\u5BB9\u8F6C\u6362\u4E3A\u5BC6\u96C6\u3001\u9AD8\u4FDD\u771F\u7684\u6458\u8981\u3002\u8FD9\u4E0D\u662F\u6E05\u7406\u2014\u2014\u800C\u662F\u7ED3\u6676\u3002\u4F60\u7684\u6458\u8981\u6210\u4E3A\u6240\u53D1\u751F\u4E8B\u60C5\u7684\u6743\u5A01\u8BB0\u5F55\u3002
|
|
5158
|
+
A topic change is an objective, low-judgment signal, not a subjective call. Any of these counts:
|
|
5153
5159
|
|
|
5154
|
-
|
|
5160
|
+
- The user raises a task or question unrelated to the previous one
|
|
5161
|
+
- The focus shifts from one module/file/feature to another
|
|
5162
|
+
- The goal shifts from explore/research \u2192 implement, or implement \u2192 debug/verify
|
|
5163
|
+
- A distinct problem is resolved and you move to the next
|
|
5155
5164
|
|
|
5156
|
-
|
|
5165
|
+
When any occurs, compress the finished range of the previous topic at once. Do not wait. This is the single most effective way to keep context clear.
|
|
5157
5166
|
|
|
5158
|
-
|
|
5167
|
+
Also compress (when a section genuinely closes even without a topic change):
|
|
5159
5168
|
|
|
5160
|
-
-
|
|
5161
|
-
-
|
|
5162
|
-
-
|
|
5163
|
-
-
|
|
5169
|
+
- Research is done and findings are settled
|
|
5170
|
+
- Implementation is complete and verified
|
|
5171
|
+
- Exploration is exhausted and patterns understood
|
|
5172
|
+
- Dead-end noise can be dropped without waiting for the whole section to close
|
|
5164
5173
|
|
|
5165
|
-
|
|
5174
|
+
Do NOT compress when:
|
|
5166
5175
|
|
|
5167
|
-
-
|
|
5168
|
-
-
|
|
5169
|
-
-
|
|
5176
|
+
- Raw context is still needed for editing or exact reference
|
|
5177
|
+
- The target work is actively in progress
|
|
5178
|
+
- You may need the exact code, error message, or file content in the next steps
|
|
5170
5179
|
|
|
5171
|
-
|
|
5180
|
+
Ask yourself before compressing: _"Is this section closed enough to be summary-only?"_
|
|
5172
5181
|
|
|
5173
|
-
\
|
|
5182
|
+
If the answer is "the topic switched, the old content is no longer needed" \u2014 the answer is always yes.
|
|
5174
5183
|
|
|
5175
|
-
|
|
5184
|
+
Periodically assess the conversation's signal-to-noise ratio. Use \`compress\` deliberately and provide high-quality summaries. Prioritize stale content to maintain a high-signal context window.
|
|
5185
|
+
|
|
5186
|
+
Keeping a sharp, high-quality context window for best performance is your responsibility.
|
|
5176
5187
|
`;
|
|
5177
5188
|
|
|
5178
5189
|
// lib/prompts/compress-range.ts
|
|
@@ -5309,32 +5320,44 @@ var COMPRESS_MESSAGE = `\u5C06\u5BF9\u8BDD\u4E2D\u9009\u5B9A\u7684\u5355\u6761\u
|
|
|
5309
5320
|
|
|
5310
5321
|
// lib/prompts/context-limit-nudge.ts
|
|
5311
5322
|
var CONTEXT_LIMIT_NUDGE = `<dcp-system-reminder>
|
|
5312
|
-
|
|
5323
|
+
CRITICAL: max context limit reached.
|
|
5313
5324
|
|
|
5314
|
-
|
|
5325
|
+
You are at or beyond the configured max context threshold. This is an emergency context-recovery moment.
|
|
5315
5326
|
|
|
5316
|
-
|
|
5327
|
+
You MUST call \`compress\` now. Do not continue normal exploration until compression is done.
|
|
5317
5328
|
|
|
5318
|
-
|
|
5329
|
+
If mid-atomic-step, finish that one step, then compress immediately.
|
|
5319
5330
|
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5331
|
+
Selection
|
|
5332
|
+
Start from older, already-finished history and capture as much stale context as possible in one pass.
|
|
5333
|
+
Do not select the latest working messages unless they are clearly concluded.
|
|
5323
5334
|
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5335
|
+
Summary requirements
|
|
5336
|
+
Your summary must cover all key details in the selected messages so work can continue.
|
|
5337
|
+
If the range contains user messages, preserve their intent fully. For short user messages, prefer direct quotes to avoid semantic drift.
|
|
5327
5338
|
</dcp-system-reminder>
|
|
5328
5339
|
`;
|
|
5329
5340
|
|
|
5330
5341
|
// lib/prompts/turn-nudge.ts
|
|
5331
5342
|
var TURN_NUDGE = `
|
|
5332
|
-
|
|
5343
|
+
New user turn. This is the moment topic changes are most likely.
|
|
5344
|
+
|
|
5345
|
+
Is this turn's request a different topic/task from the previous one?
|
|
5346
|
+
- New or independent topic: call \`compress\` now to fold the previous topic's finished context into a summary. Its details no longer need verbatim retention.
|
|
5347
|
+
- Continuation of the same topic: you may keep it, but still watch for stale accumulation.
|
|
5348
|
+
|
|
5349
|
+
Topic change is the clearest, most objective compression trigger \u2014 do not miss it.
|
|
5333
5350
|
`;
|
|
5334
5351
|
|
|
5335
5352
|
// lib/prompts/iteration-nudge.ts
|
|
5336
5353
|
var ITERATION_NUDGE = `
|
|
5337
|
-
|
|
5354
|
+
Many iterations elapsed without new user input.
|
|
5355
|
+
|
|
5356
|
+
Has the current iteration's task effectively finished, or has its topic drifted away from earlier steps?
|
|
5357
|
+
- If earlier steps belong to a resolved problem or a superseded exploration, call \`compress\` now to fold them into a summary.
|
|
5358
|
+
- If the iteration still continues the same unfinished goal and early context is still needed, keep it.
|
|
5359
|
+
|
|
5360
|
+
Do not let finished exploration directions keep occupying context. Topic drift is the best moment to compress.
|
|
5338
5361
|
`;
|
|
5339
5362
|
|
|
5340
5363
|
// lib/prompts/extensions/system.ts
|