@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 CHANGED
@@ -1872,7 +1872,9 @@ function buildRangeFormatExtension(externalModelEnabled) {
1872
1872
  }
1873
1873
  ]
1874
1874
  }
1875
- \`\`\`${externalHint}`;
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
- "Message or block ID marking the beginning of range (e.g. m0001, b2)"
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
- \u4F60\u5728\u4E00\u4E2A\u4E0A\u4E0B\u6587\u53D7\u9650\u7684\u73AF\u5883\u4E2D\u8FD0\u884C\u3002\u6301\u7EED\u7BA1\u7406\u4E0A\u4E0B\u6587\u4EE5\u907F\u514D\u5806\u79EF\u5E76\u4FDD\u6301\u68C0\u7D22\u8D28\u91CF\u3002\u9AD8\u6548\u7684\u4E0A\u4E0B\u6587\u7BA1\u7406\u5BF9\u4F60\u7684\u4EE3\u7406\u6027\u80FD\u81F3\u5173\u91CD\u8981\u3002
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
- \u4F60\u7528\u4E8E\u4E0A\u4E0B\u6587\u7BA1\u7406\u7684\u552F\u4E00\u5DE5\u5177\u662F \`compress\`\u3002\u5B83\u7528\u4F60\u751F\u6210\u7684\u6280\u672F\u6458\u8981\u66FF\u6362\u8F83\u65E7\u7684\u5BF9\u8BDD\u5185\u5BB9\u3002
5152
+ \`\` and \`\` are environment-injected metadata. Do not output them.
5141
5153
 
5142
- \u5173\u952E\u7EA6\u675F
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
- \`\` \u548C \`\` \u6807\u7B7E\u662F\u73AF\u5883\u6CE8\u5165\u7684\u5143\u6570\u636E\u3002\u4E0D\u8981\u8F93\u51FA\u5B83\u4EEC\u3002
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
- \u538B\u7F29\u7684\u54F2\u5B66
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
- \u5C06\u538B\u7F29\u89C6\u4E3A\u76F8\u53D8\uFF1A\u539F\u59CB\u63A2\u7D22\u53D8\u4E3A\u7CBE\u70BC\u7406\u89E3\u3002\u539F\u59CB\u4E0A\u4E0B\u6587\u5DF2\u5B8C\u6210\u5176\u4F7F\u547D\uFF1B\u4F60\u7684\u6458\u8981\u73B0\u5728\u627F\u8F7D\u8BE5\u7406\u89E3\u5411\u524D\u3002
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
- \u4F55\u65F6\u538B\u7F29
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
- \u5F53\u4E00\u4E2A\u90E8\u5206\u771F\u6B63\u5173\u95ED\u4E14\u539F\u59CB\u5BF9\u8BDD\u5DF2\u5B8C\u6210\u5176\u4F7F\u547D\u65F6\uFF1A
5167
+ Also compress (when a section genuinely closes even without a topic change):
5159
5168
 
5160
- - \u7814\u7A76\u5DF2\u5B8C\u6210\u4E14\u53D1\u73B0\u5DF2\u660E\u786E
5161
- - \u5B9E\u73B0\u5DF2\u5B8C\u6210\u5E76\u9A8C\u8BC1
5162
- - \u63A2\u7D22\u5DF2\u7A77\u5C3D\u4E14\u6A21\u5F0F\u5DF2\u7406\u89E3
5163
- - \u6B7B\u80E1\u540C\u566A\u97F3\u53EF\u4EE5\u5728\u4E0D\u7B49\u5F85\u6574\u4E2A\u7AE0\u8282\u5173\u95ED\u7684\u60C5\u51B5\u4E0B\u88AB\u4E22\u5F03
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
- \u4E0D\u8981\u538B\u7F29\u7684\u60C5\u51B5
5174
+ Do NOT compress when:
5166
5175
 
5167
- - \u539F\u59CB\u4E0A\u4E0B\u6587\u4ECD\u7136\u76F8\u5173\u4E14\u9700\u8981\u7528\u4E8E\u7F16\u8F91\u6216\u7CBE\u786E\u5F15\u7528
5168
- - \u76EE\u6807\u5185\u5BB9\u4ECD\u5728\u79EF\u6781\u8FDB\u884C\u4E2D
5169
- - \u4F60\u53EF\u80FD\u5728\u63A5\u4E0B\u6765\u7684\u6B65\u9AA4\u4E2D\u9700\u8981\u786E\u5207\u7684\u4EE3\u7801\u3001\u9519\u8BEF\u6D88\u606F\u6216\u6587\u4EF6\u5185\u5BB9
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
- \u538B\u7F29\u524D\u95EE\u81EA\u5DF1\uFF1A_"\u8FD9\u4E2A\u90E8\u5206\u73B0\u5728\u662F\u5426\u8DB3\u591F\u5173\u95ED\u4EE5\u6210\u4E3A\u4EC5\u6458\u8981\uFF1F"_
5180
+ Ask yourself before compressing: _"Is this section closed enough to be summary-only?"_
5172
5181
 
5173
- \u5B9A\u671F\u8BC4\u4F30\u5BF9\u8BDD\u7684\u4FE1\u566A\u6BD4\u3002\u6709\u610F\u8BC6\u5730\u4F7F\u7528 \`compress\` \u5E76\u63D0\u4F9B\u9AD8\u8D28\u91CF\u6458\u8981\u3002\u667A\u80FD\u5730\u4F18\u5148\u5904\u7406\u8FC7\u65F6\u5185\u5BB9\uFF0C\u4EE5\u7EF4\u62A4\u652F\u6301\u4F60\u4EE3\u7406\u80FD\u529B\u7684\u9AD8\u4FE1\u53F7\u4E0A\u4E0B\u6587\u7A97\u53E3\u3002
5182
+ If the answer is "the topic switched, the old content is no longer needed" \u2014 the answer is always yes.
5174
5183
 
5175
- \u4FDD\u6301\u9510\u5229\u3001\u9AD8\u8D28\u91CF\u7684\u4E0A\u4E0B\u6587\u7A97\u53E3\u4EE5\u83B7\u5F97\u6700\u4F73\u6027\u80FD\u662F\u4F60\u7684\u8D23\u4EFB\u3002
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
- \u4E25\u91CD\u8B66\u544A\uFF1A\u5DF2\u8FBE\u5230\u6700\u5927\u4E0A\u4E0B\u6587\u9650\u5236
5323
+ CRITICAL: max context limit reached.
5313
5324
 
5314
- \u4F60\u5F53\u524D\u5904\u4E8E\u6216\u5DF2\u8D85\u8FC7\u914D\u7F6E\u7684\u6700\u5927\u4E0A\u4E0B\u6587\u9608\u503C\u3002\u8FD9\u662F\u7D27\u6025\u7684\u4E0A\u4E0B\u6587\u6062\u590D\u65F6\u523B\u3002
5325
+ You are at or beyond the configured max context threshold. This is an emergency context-recovery moment.
5315
5326
 
5316
- \u4F60\u5FC5\u987B\u7ACB\u5373\u4F7F\u7528 \`compress\` \u5DE5\u5177\u3002\u5728\u5B8C\u6210\u538B\u7F29\u4E4B\u524D\uFF0C\u4E0D\u8981\u7EE7\u7EED\u6B63\u5E38\u63A2\u7D22\u3002
5327
+ You MUST call \`compress\` now. Do not continue normal exploration until compression is done.
5317
5328
 
5318
- \u5982\u679C\u4F60\u6B63\u5728\u8FDB\u884C\u5173\u952E\u7684\u539F\u5B50\u64CD\u4F5C\uFF0C\u5148\u5B8C\u6210\u8BE5\u539F\u5B50\u6B65\u9AA4\uFF0C\u7136\u540E\u7ACB\u5373\u538B\u7F29\u3002
5329
+ If mid-atomic-step, finish that one step, then compress immediately.
5319
5330
 
5320
- \u9009\u62E9\u8FC7\u7A0B
5321
- \u4ECE\u8F83\u65E9\u7684\u3001\u5DF2\u5B8C\u6210\u7684\u5386\u53F2\u5F00\u59CB\uFF0C\u5728\u4E00\u6B21\u64CD\u4F5C\u4E2D\u6355\u83B7\u5C3D\u53EF\u80FD\u591A\u7684\u8FC7\u65F6\u4E0A\u4E0B\u6587\u3002
5322
- \u9664\u975E\u6700\u65B0\u7684\u5DE5\u4F5C\u6D88\u606F\u5DF2\u660E\u663E\u7ED3\u675F\uFF0C\u5426\u5219\u4E0D\u8981\u9009\u62E9\u5B83\u4EEC\u3002
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
- \u6458\u8981\u8981\u6C42
5325
- \u4F60\u7684\u6458\u8981\u5FC5\u987B\u8986\u76D6\u6240\u9009\u6D88\u606F\u4E2D\u7684\u6240\u6709\u5173\u952E\u7EC6\u8282\uFF0C\u4EE5\u786E\u4FDD\u5DE5\u4F5C\u53EF\u4EE5\u7EE7\u7EED\u3002
5326
- \u5982\u679C\u538B\u7F29\u8303\u56F4\u5305\u542B\u7528\u6237\u6D88\u606F\uFF0C\u5B8C\u6574\u4FDD\u7559\u7528\u6237\u610F\u56FE\u3002\u5BF9\u4E8E\u8F83\u77ED\u7684\u7528\u6237\u6D88\u606F\uFF0C\u4F18\u5148\u4F7F\u7528\u76F4\u63A5\u5F15\u7528\u4EE5\u907F\u514D\u8BED\u4E49\u6F02\u79FB\u3002
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
- \u4E0A\u4E0B\u6587\u4F7F\u7528\u91CF\u5904\u4E8E\u4E2D\u7B49\u6C34\u5E73\u3002\u8003\u8651\u538B\u7F29\u5DF2\u5B8C\u6210\u7684\u5BF9\u8BDD\u8F6E\u6B21\u4EE5\u91CA\u653E\u7A7A\u95F4\u3002
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
- \u5DF2\u8FDB\u884C\u591A\u6B21\u8FED\u4EE3\u4F46\u672A\u6536\u5230\u65B0\u7684\u7528\u6237\u8F93\u5165\u3002\u8003\u8651\u538B\u7F29\u65E9\u671F\u6B65\u9AA4\u4EE5\u4FDD\u6301\u4E0A\u4E0B\u6587\u6E05\u6670\u3002
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