@bacnh85/pi-serena 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.
Files changed (2) hide show
  1. package/index.ts +13 -2
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -150,6 +150,9 @@ export function normalizeSearchPatternParams(params: Record<string, unknown>): R
150
150
  normalized.substring_pattern = normalized.pattern;
151
151
  }
152
152
  delete normalized.pattern;
153
+ // The Python SearchForPatternTool.apply() does not accept a multiline parameter.
154
+ // Strip it here to avoid TypeError when the parameter description says "when supported by Serena".
155
+ delete normalized.multiline;
153
156
  return normalized;
154
157
  }
155
158
 
@@ -206,8 +209,16 @@ function truncateText(text: string): string {
206
209
  }
207
210
 
208
211
  function resultText(response: SerenaWorkerResponse): string {
209
- const text = !response.ok ? `Error: ${response.error ?? "Unknown Serena error"}` : typeof response.result === "string" ? response.result : JSON.stringify(response, null, 2);
210
- return truncateText(text);
212
+ if (!response.ok) {
213
+ return `Error: ${response.error ?? "Unknown Serena error"}`;
214
+ }
215
+ // For search results, show a friendly empty-state instead of raw "{}".
216
+ if (response.tool === "search_for_pattern") {
217
+ if (response.result == null || (typeof response.result === "object" && Object.keys(response.result as object).length === 0)) {
218
+ return "No results found.";
219
+ }
220
+ }
221
+ return typeof response.result === "string" ? response.result : JSON.stringify(response, null, 2);
211
222
  }
212
223
 
213
224
  export default function serenaToolsExtension(pi: ExtensionAPI) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bacnh85/pi-serena",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Pi extension that provides Serena semantic code tools through a persistent worker.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {