pi-ui-extend 1.0.11 → 1.0.12
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.
|
@@ -41,8 +41,10 @@ const DEFAULT_LOOKUP_MAX_IMAGES = 6;
|
|
|
41
41
|
const DEFAULT_LOOKUP_MAX_TOKENS = 1_600;
|
|
42
42
|
const DEFAULT_LOOKUP_TIMEOUT_MS = 120_000;
|
|
43
43
|
const MAX_IMAGE_BYTES = 16 * 1024 * 1024;
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
// Keep recovery nudges sparse: newer GLM coding models are substantially better at
|
|
45
|
+
// long-horizon tool use, and repeated developer reminders can become prompt noise.
|
|
46
|
+
const SILENCE_REMINDER_MIN_VIOLATION_GAP = 5;
|
|
47
|
+
const SILENCE_REMINDER_MIN_MESSAGE_GAP = 20;
|
|
46
48
|
// When the visible history shrinks by more than this many messages (compaction or
|
|
47
49
|
// truncation), the chatter baseline is reset so it isn't measured against a stale peak.
|
|
48
50
|
const SILENCE_REMINDER_COMPACTION_MARGIN = 8;
|
|
@@ -89,7 +91,9 @@ function buildDisciplineLines(strictness: CodingDisciplineStrictness): readonly
|
|
|
89
91
|
isStrict ? "- WORKING: exactly one next tool call with empty text;" : "- WORKING: one or more independent tool calls with empty text;",
|
|
90
92
|
"- FINAL: one final answer after completion or practical verification;",
|
|
91
93
|
"- BLOCKED: one concise question only when no safe/useful tool action can continue.",
|
|
92
|
-
|
|
94
|
+
isStrict
|
|
95
|
+
? "No transition permits commentary between tool calls."
|
|
96
|
+
: "When a thinking/reasoning channel is available, do not duplicate that reasoning as visible commentary between tool calls.",
|
|
93
97
|
"",
|
|
94
98
|
"PRIORITY: this overrides default assistant friendliness and conversational behavior.",
|
|
95
99
|
"",
|
|
@@ -107,7 +111,7 @@ function buildDisciplineLines(strictness: CodingDisciplineStrictness): readonly
|
|
|
107
111
|
const LOOKUP_DISCIPLINE_LINES = [
|
|
108
112
|
"",
|
|
109
113
|
"Visual lookup discipline:",
|
|
110
|
-
"
|
|
114
|
+
"Treat the current GLM coding endpoint as text-only; do not assume it can inspect images/screenshots directly.",
|
|
111
115
|
"When the user refers to an image, screenshot, UI visual bug, layout problem, arrow, annotation, highlight, visible text, chart, diagram, or any visual evidence, call the `lookup` tool before making visual claims.",
|
|
112
116
|
"Use a focused lookup query that includes the user's visual concern and asks the helper to pay attention to arrows, annotations, highlights, visible UI state, text, spacing/layout, and suspected bugs.",
|
|
113
117
|
"Treat lookup output as visual evidence; do not invent visual details beyond it.",
|
|
@@ -141,7 +145,8 @@ const DISCIPLINE_PROMPT_BLOCK_PATTERN = new RegExp(
|
|
|
141
145
|
* Strips pi's built-in "Pi documentation" reference block from the system prompt.
|
|
142
146
|
* That block (≈10 lines listing docs/examples paths and "when asked about X" routing)
|
|
143
147
|
* is useless dead weight for non-pi work and dilutes attention to the trailing
|
|
144
|
-
* <available_skills> section
|
|
148
|
+
* <available_skills> section and wastes attention that should stay on the task and
|
|
149
|
+
* the extension-provided agent contract.
|
|
145
150
|
* Anchored on the fixed header/footer strings from buildSystemPrompt() so it only
|
|
146
151
|
* ever matches pi's own block regardless of resolved doc/example paths.
|
|
147
152
|
*/
|
|
@@ -151,7 +156,7 @@ const PI_DOCS_BLOCK_PATTERN = new RegExp(
|
|
|
151
156
|
);
|
|
152
157
|
|
|
153
158
|
const LOOKUP_SYSTEM_PROMPT = [
|
|
154
|
-
"You are a vision-capable lookup helper for a
|
|
159
|
+
"You are a vision-capable lookup helper for a text-only GLM coding agent.",
|
|
155
160
|
"Inspect the provided screenshots/images and answer the parent agent's focused question using concrete visual evidence.",
|
|
156
161
|
"Pay special attention to arrows, annotations, highlights, cursor position, visible UI state, text, layout, spacing, colors, overlays, visual bugs, and error messages.",
|
|
157
162
|
"Use recent session context only to understand what the user is asking; do not perform code changes.",
|
|
@@ -676,7 +681,7 @@ function codingDisciplineStrictnessFromConfig(cwd?: string): CodingDisciplineStr
|
|
|
676
681
|
|
|
677
682
|
function buildLookupPrompt(params: LookupParams, recentContext: string, imageCount: number, warnings: string[]): string {
|
|
678
683
|
return [
|
|
679
|
-
"Lookup request from a
|
|
684
|
+
"Lookup request from a text-only GLM parent model.",
|
|
680
685
|
"",
|
|
681
686
|
"Focused question:",
|
|
682
687
|
params.query.trim(),
|
package/package.json
CHANGED