polydev-ai 1.8.14 → 1.8.15

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.
@@ -100,6 +100,75 @@ if (writableTmp) {
100
100
  console.error(`[Stdio Wrapper] Using TMP directory: ${writableTmp}`);
101
101
  }
102
102
 
103
+ /**
104
+ * Clean CLI response by removing metadata and debug info
105
+ * Strips: provider info, approval, sandbox, reasoning, session id, MCP errors, etc.
106
+ */
107
+ function cleanCliResponse(content) {
108
+ if (!content || typeof content !== 'string') {
109
+ return content || '';
110
+ }
111
+
112
+ const lines = content.split('\n');
113
+ const cleanedLines = [];
114
+ let skipUntilContent = true;
115
+ let inThinkingSection = false;
116
+
117
+ for (const line of lines) {
118
+ const trimmed = line.trim();
119
+
120
+ // Skip metadata lines at the start
121
+ if (skipUntilContent) {
122
+ // Skip empty lines
123
+ if (!trimmed) continue;
124
+
125
+ // Skip known metadata patterns
126
+ if (trimmed.startsWith('provider:')) continue;
127
+ if (trimmed.startsWith('approval:')) continue;
128
+ if (trimmed.startsWith('sandbox:')) continue;
129
+ if (trimmed.startsWith('reasoning effort:')) continue;
130
+ if (trimmed.startsWith('reasoning summaries:')) continue;
131
+ if (trimmed.startsWith('session id:')) continue;
132
+ if (trimmed.match(/^-{4,}$/)) continue; // Skip separator lines like --------
133
+ if (trimmed === 'user') continue; // Skip role markers
134
+ if (trimmed === 'assistant') continue;
135
+
136
+ // Skip MCP client errors
137
+ if (trimmed.startsWith('ERROR: MCP client for')) continue;
138
+ if (trimmed.includes('failed to start')) continue;
139
+
140
+ // Found actual content - stop skipping
141
+ skipUntilContent = false;
142
+ }
143
+
144
+ // Handle thinking sections (optional: can show or hide)
145
+ if (trimmed === 'thinking') {
146
+ inThinkingSection = true;
147
+ continue; // Skip the "thinking" marker
148
+ }
149
+
150
+ // End of thinking section on empty line after content
151
+ if (inThinkingSection && !trimmed) {
152
+ inThinkingSection = false;
153
+ continue;
154
+ }
155
+
156
+ // Skip more MCP errors anywhere in output
157
+ if (trimmed.startsWith('ERROR: MCP client for')) continue;
158
+ if (trimmed.includes('failed to start') && trimmed.includes('MCP')) continue;
159
+
160
+ // Keep this line
161
+ cleanedLines.push(line);
162
+ }
163
+
164
+ // Trim trailing empty lines and return
165
+ while (cleanedLines.length > 0 && !cleanedLines[cleanedLines.length - 1].trim()) {
166
+ cleanedLines.pop();
167
+ }
168
+
169
+ return cleanedLines.join('\n');
170
+ }
171
+
103
172
  class StdioMCPWrapper {
104
173
  constructor() {
105
174
  this.userToken = process.env.POLYDEV_USER_TOKEN;
@@ -837,7 +906,7 @@ class StdioMCPWrapper {
837
906
  ? cliResult.model_used
838
907
  : cliResult.provider_id;
839
908
  formatted += `🟢 **Local CLI Response** (${modelDisplay})\n\n`;
840
- formatted += `${cliResult.content}\n\n`;
909
+ formatted += `${cleanCliResponse(cliResult.content)}\n\n`;
841
910
  formatted += `*Latency: ${cliResult.latency_ms || 0}ms | Tokens: ${cliResult.tokens_used || 0}*\n\n`;
842
911
  formatted += `---\n\n`;
843
912
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polydev-ai",
3
- "version": "1.8.14",
3
+ "version": "1.8.15",
4
4
  "description": "Agentic workflow assistant with CLI integration - get diverse perspectives from multiple LLMs when stuck or need enhanced reasoning",
5
5
  "keywords": [
6
6
  "mcp",