@bacnh85/pi-model-tools 0.3.1 → 0.3.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/extensions/index.ts
CHANGED
|
@@ -345,8 +345,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
345
345
|
if (readHint) systemPrompt = `${systemPrompt}\n\n${readHint}`;
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
// apply_patch preference — DeepSeek V4
|
|
349
|
-
//
|
|
348
|
+
// apply_patch preference — all DeepSeek V4 (flash+pro); GLM excluded per eval.
|
|
349
|
+
// Eval (2026-07-29, 15 trials, 3 targets) showed all models use edit with zero
|
|
350
|
+
// edit_mismatch errors. DeepSeek keeps guidance as a safety net for real-world
|
|
351
|
+
// multi-file/frontmatter edits beyond the eval's scope; GLM excluded because it
|
|
352
|
+
// doesn't receive the suite of DeepSeek-specific steering (Super Power, selection
|
|
353
|
+
// guidance, semantic-miss blocking) and thus doesn't need the companion hint.
|
|
350
354
|
if (activeFamily === "deepseek-v4") {
|
|
351
355
|
const patchHint = applyPatchPreferenceGuidance(activeForHint);
|
|
352
356
|
if (patchHint) systemPrompt = `${systemPrompt}\n\n${patchHint}`;
|
|
@@ -96,18 +96,21 @@ export function deepSeekSelectionGuidance(activeTools: readonly string[]): strin
|
|
|
96
96
|
// ── apply_patch preference hint (DeepSeek/GLM) ──
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* When apply_patch is available, tell
|
|
100
|
-
* anything beyond a
|
|
101
|
-
*
|
|
102
|
-
*
|
|
99
|
+
* When apply_patch is available, tell the model to prefer it over edit for
|
|
100
|
+
* anything beyond a small change (>3 lines, YAML frontmatter, or
|
|
101
|
+
* multi-hunk/multi-file). Returns undefined if the tool is not active so it
|
|
102
|
+
* never misdirects. Gated per family by the caller (see index.ts
|
|
103
|
+
* before_agent_start).
|
|
103
104
|
*/
|
|
104
105
|
export function applyPatchPreferenceGuidance(activeTools: readonly string[]): string | undefined {
|
|
105
106
|
if (!activeTools.includes("apply_patch")) return undefined;
|
|
106
107
|
return [
|
|
107
108
|
"apply_patch (preferred for non-trivial edits):",
|
|
108
|
-
" • For multi-line, multi-hunk, or multi-file edits, emit a small V4D diff (context + -/+ lines) via apply_patch instead of reproducing large verbatim oldText blocks — far fewer match failures.",
|
|
109
|
+
" • For multi-line (>3 lines), multi-hunk, or multi-file edits, emit a small V4D diff (context + -/+ lines) via apply_patch instead of reproducing large verbatim oldText blocks — far fewer match failures.",
|
|
109
110
|
" • Each Update hunk must anchor on enough unchanged context that the context+removed block matches UNIQUELY in the file.",
|
|
110
|
-
" • Keep using edit for a single tiny one-line exact replacement.",
|
|
111
|
+
" • Keep using edit for a single tiny one-line exact replacement (≤3 lines).",
|
|
112
|
+
" • Touching frontmatter (YAML) — always use apply_patch. YAML is whitespace-sensitive; edit\'s exact-match oldText rarely succeeds on the first try.",
|
|
113
|
+
" • One-strike rule: if edit fails once, stop — switch to apply_patch, do not retry edit.",
|
|
111
114
|
].join("\n");
|
|
112
115
|
}
|
|
113
116
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bacnh85/pi-model-tools",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Unified tool-wrapping, argument repair, reasoning management, DeepSeek V4 guidance + Super Power Mode, defensive leak-cleaning, edit mismatch repair (read-notice stripping + trim-tolerant retry), and a Codex-style apply_patch diff tool for DeepSeek V4 and GLM model families from any provider.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|