pi-agent-ide 0.6.1 → 0.6.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 (210) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +82 -30
  3. package/assets/summary/debugging.png +0 -0
  4. package/assets/summary/editing.png +0 -0
  5. package/assets/summary/read.png +0 -0
  6. package/assets/summary/search-and-replace.png +0 -0
  7. package/assets/summary/search.png +0 -0
  8. package/assets/summary/settings.png +0 -0
  9. package/assets/summary/terminal.png +0 -0
  10. package/assets/summary/thumbs/debugging.png +0 -0
  11. package/assets/summary/thumbs/editing.png +0 -0
  12. package/assets/summary/thumbs/read.png +0 -0
  13. package/assets/summary/thumbs/search-and-replace.png +0 -0
  14. package/assets/summary/thumbs/search.png +0 -0
  15. package/assets/summary/thumbs/settings.png +0 -0
  16. package/assets/summary/thumbs/terminal.png +0 -0
  17. package/assets/summary/thumbs/user_terminal.png +0 -0
  18. package/assets/summary/user_terminal.png +0 -0
  19. package/dist/{chunk-4KUFOHWP.js → chunk-3E2NTWCN.js} +1 -1
  20. package/dist/chunk-7WCZOO5I.js +1 -0
  21. package/dist/chunk-CEX3VOJ7.js +2 -0
  22. package/dist/{chunk-2527OQ4Y.js → chunk-HMLH43ZS.js} +1 -1
  23. package/dist/chunk-LVWMWWWF.js +28 -0
  24. package/dist/{chunk-HKMBQLEK.js → chunk-QDLTO5PH.js} +1 -1
  25. package/dist/{chunk-Z3VC3S2T.js → chunk-QIK2E64R.js} +1 -1
  26. package/dist/chunk-T7CZIACQ.js +27 -0
  27. package/dist/chunk-VXD6FZP5.js +5 -0
  28. package/dist/entry-1.js +1 -1
  29. package/dist/entry-2.js +1 -1
  30. package/dist/entry-31.js +8 -7
  31. package/dist/entry-34.js +1 -1
  32. package/dist/entry-36.js +1 -1
  33. package/dist/entry-37.js +1 -1
  34. package/dist/entry-51.js +9 -10
  35. package/dist/entry-53.js +1 -1
  36. package/dist/entry-54.js +1 -1
  37. package/dist/entry-55.js +1 -1
  38. package/dist/entry-56.js +1 -1
  39. package/dist/entry-57.js +1 -1
  40. package/dist/entry-58.js +1 -1
  41. package/dist/entry-59.js +1 -1
  42. package/dist/entry-60.js +1 -0
  43. package/dist/entry-61.js +1 -1
  44. package/dist/entry-63.js +1 -1
  45. package/dist/entry-64.js +0 -1
  46. package/dist/entry-65.js +1 -1
  47. package/dist/entry-66.js +1 -1
  48. package/dist/entry-67.js +1 -1
  49. package/dist/entry-68.js +1 -1
  50. package/dist/entry-69.js +1 -0
  51. package/dist/entry-70.js +1 -1
  52. package/dist/entry-72.js +1 -1
  53. package/dist/entry-73.js +0 -1
  54. package/dist/entry-74.js +1 -1
  55. package/dist/entry-75.js +1 -315
  56. package/dist/entry-76.js +1 -30
  57. package/dist/entry-77.js +315 -2
  58. package/dist/entry-78.js +30 -1
  59. package/dist/entry-79.js +2 -1
  60. package/dist/entry-80.js +1 -3
  61. package/dist/entry-81.js +1 -3
  62. package/dist/entry-82.js +3 -1
  63. package/dist/entry-83.js +3 -1
  64. package/dist/entry-84.js +1 -1
  65. package/dist/entry-85.js +1 -0
  66. package/dist/entry-86.js +1 -0
  67. package/dist/pi-agent-ide.js +1 -1
  68. package/docs/agent-guides/debugger.md +1 -1
  69. package/docs/agent-guides/terminal.md +1 -1
  70. package/node_modules/pi-agent-doctor/package.json +1 -1
  71. package/node_modules/pi-agent-documentation/package.json +1 -1
  72. package/node_modules/pi-agent-filesystem/package.json +6 -6
  73. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  74. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  75. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  76. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  77. package/node_modules/pi-agent-ide-ast/package.json +10 -9
  78. package/node_modules/pi-agent-ide-ast/src/search-presentation.ts +117 -0
  79. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +20 -2
  80. package/node_modules/pi-agent-ide-changes/package.json +7 -7
  81. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  82. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  83. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  84. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  85. package/node_modules/pi-agent-image/package.json +2 -2
  86. package/node_modules/pi-agent-invariant/package.json +1 -1
  87. package/node_modules/pi-agent-pdf/package.json +2 -2
  88. package/node_modules/pi-agent-read/package.json +7 -7
  89. package/node_modules/pi-agent-resource/package.json +1 -1
  90. package/node_modules/pi-agent-search/package.json +4 -4
  91. package/node_modules/pi-agent-search-text/package.json +14 -6
  92. package/node_modules/pi-agent-search-text/runtime/entry-54.js +1 -0
  93. package/node_modules/pi-agent-search-text/src/persisted-result.ts +9 -7
  94. package/node_modules/pi-agent-search-text/src/search-renderer.ts +10 -4
  95. package/node_modules/pi-agent-search-text/src/search-result.ts +8 -1
  96. package/node_modules/pi-agent-text/package.json +3 -3
  97. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  98. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  99. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  100. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-60.js +2 -0
  101. package/node_modules/pi-agent-text-editor/package.json +26 -26
  102. package/node_modules/pi-agent-text-editor/runtime/entry-75.js +0 -1
  103. package/node_modules/pi-agent-text-editor/runtime/entry-76.js +1 -0
  104. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  105. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-78.js +2 -0
  106. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  107. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-79.js +2 -0
  108. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  109. package/node_modules/pi-agent-tool-call-interception/runtime/entry-80.js +1 -0
  110. package/node_modules/pi-agent-tool-ui/package.json +2 -2
  111. package/node_modules/pi-agent-tool-ui/runtime/entry-81.js +1 -0
  112. package/node_modules/pi-agent-web/package.json +7 -7
  113. package/node_modules/pi-agent-web-html/package.json +3 -3
  114. package/node_modules/pi-agent-web-image/package.json +4 -4
  115. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  116. package/node_modules/pi-agent-web-pdf/runtime/entry-85.js +2 -0
  117. package/node_modules/pi-agent-web-text/package.json +4 -4
  118. package/node_modules/pi-agent-web-text/runtime/entry-86.js +2 -0
  119. package/package.json +35 -35
  120. package/src/api/plugin-protocol.ts +10 -4
  121. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +6 -6
  122. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  123. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  124. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  125. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  126. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  127. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  128. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  129. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  130. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-85.js +2 -0
  131. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  132. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-86.js +2 -0
  133. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-82.js +2 -0
  134. package/src/extensions/pi-agent-read/package.json +7 -7
  135. package/src/extensions/pi-agent-search/package.json +4 -4
  136. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +14 -6
  137. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-53.js +1 -0
  138. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-54.js +1 -0
  139. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/persisted-result.ts +9 -7
  140. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +10 -4
  141. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +8 -1
  142. package/src/extensions/pi-agent-text-editor/package.json +26 -26
  143. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  144. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  145. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  146. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-59.js +1 -0
  147. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-60.js +2 -0
  148. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  149. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-78.js +2 -0
  150. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  151. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-79.js +2 -0
  152. package/src/extensions/pi-agent-text-editor/runtime/entry-75.js +0 -1
  153. package/src/extensions/pi-agent-text-editor/runtime/entry-76.js +1 -0
  154. package/src/extensions/pi-agent-text-editor/runtime/entry-77.js +2 -0
  155. package/src/plugins/pi-agent-ide-ast/package.json +10 -9
  156. package/src/plugins/pi-agent-ide-ast/src/search-presentation.ts +117 -0
  157. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +20 -2
  158. package/src/plugins/pi-agent-ide-changes/package.json +7 -7
  159. package/src/plugins/pi-agent-ide-debugger/index.ts +32 -10
  160. package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +10 -1
  161. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +39 -0
  162. package/src/plugins/pi-agent-ide-debugger/src/ui.ts +42 -5
  163. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  164. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  165. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  166. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  167. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +88 -9
  168. package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +6 -2
  169. package/src/plugins/pi-agent-ide-vision/index.ts +2 -1
  170. package/src/plugins/pi-agent-ide-vision/src/vision.ts +17 -3
  171. package/assets/gallery/apply-editing.png +0 -0
  172. package/assets/gallery/debugging.png +0 -0
  173. package/assets/gallery/read-web.png +0 -0
  174. package/assets/gallery/search-replace.png +0 -0
  175. package/assets/gallery/terminal.png +0 -0
  176. package/assets/gallery/tool-editing.png +0 -0
  177. package/dist/chunk-4LDOV7QS.js +0 -28
  178. package/dist/chunk-I6Y3W4X6.js +0 -27
  179. package/dist/chunk-YEQOQMU7.js +0 -5
  180. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-54.js +0 -2
  181. package/node_modules/pi-agent-text-editor/runtime/entry-60.js +0 -1
  182. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-76.js +0 -2
  183. package/node_modules/pi-agent-tool-call-interception/runtime/entry-78.js +0 -1
  184. package/node_modules/pi-agent-tool-ui/runtime/entry-79.js +0 -1
  185. package/node_modules/pi-agent-web/runtime/entry-80.js +0 -2
  186. package/node_modules/pi-agent-web-html/runtime/entry-81.js +0 -2
  187. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-81.js +0 -2
  188. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-82.js +0 -2
  189. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-80.js +0 -2
  190. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-54.js +0 -2
  191. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-55.js +0 -1
  192. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-76.js +0 -2
  193. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-77.js +0 -2
  194. package/src/extensions/pi-agent-text-editor/runtime/entry-59.js +0 -1
  195. package/src/extensions/pi-agent-text-editor/runtime/entry-60.js +0 -1
  196. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-53.js +0 -0
  197. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-55.js +0 -0
  198. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-56.js +0 -0
  199. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-57.js +0 -0
  200. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-58.js +0 -0
  201. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-59.js +0 -0
  202. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-77.js +0 -0
  203. /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-82.js +0 -0
  204. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-83.js +0 -0
  205. /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-84.js +0 -0
  206. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-83.js +0 -0
  207. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-84.js +0 -0
  208. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-56.js +0 -0
  209. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-57.js +0 -0
  210. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-58.js +0 -0
@@ -0,0 +1,117 @@
1
+ import path from "node:path";
2
+ import { pathToFileURL } from "node:url";
3
+
4
+ import type {
5
+ SearchResultFile,
6
+ SearchResultLine,
7
+ SearchResultRange,
8
+ SearchToolDetails,
9
+ } from "pi-agent-search-text/result";
10
+
11
+ export interface AstSearchPresentationMatch {
12
+ readonly file: string;
13
+ readonly lines: string;
14
+ readonly range: {
15
+ readonly start: { readonly line: number; readonly column: number };
16
+ readonly end: { readonly line: number; readonly column: number };
17
+ };
18
+ }
19
+
20
+ /** Build ordinary grouped search presentation data without changing AST selection details. */
21
+ export function createAstSearchPresentation(
22
+ query: string,
23
+ matches: readonly AstSearchPresentationMatch[],
24
+ complete: boolean,
25
+ cwd: string,
26
+ sessionId: string,
27
+ ): SearchToolDetails {
28
+ const grouped = new Map<string, AstSearchPresentationMatch[]>();
29
+ for (const match of matches) {
30
+ const current = grouped.get(match.file) ?? [];
31
+ current.push(match);
32
+ grouped.set(match.file, current);
33
+ }
34
+ const files = [...grouped.entries()].map(([file, fileMatches]) =>
35
+ createFilePresentation(file, fileMatches, cwd),
36
+ );
37
+ return {
38
+ sessionId,
39
+ query,
40
+ matchCount: matches.length,
41
+ fileCount: files.length,
42
+ complete,
43
+ files,
44
+ };
45
+ }
46
+
47
+ function createFilePresentation(
48
+ file: string,
49
+ matches: readonly AstSearchPresentationMatch[],
50
+ cwd: string,
51
+ ): SearchResultFile {
52
+ const lines = new Map<
53
+ number,
54
+ { text: string; ranges: SearchResultRange[]; logicalMatchIds: string[] }
55
+ >();
56
+ matches.forEach((match, matchIndex) => {
57
+ const texts = match.lines.replace(/\r/gu, "").split("\n");
58
+ if (texts.at(-1) === "") texts.pop();
59
+ const logicalId = `${file}:${String(matchIndex)}`;
60
+ texts.forEach((text, index) => {
61
+ const lineNumber = match.range.start.line + index + 1;
62
+ const range = highlightedRange(match, text, index, texts.length);
63
+ if (range === undefined) return;
64
+ const current = lines.get(lineNumber) ?? { text, ranges: [], logicalMatchIds: [] };
65
+ current.ranges.push(range);
66
+ current.logicalMatchIds.push(logicalId);
67
+ lines.set(lineNumber, current);
68
+ });
69
+ });
70
+ const resultLines: SearchResultLine[] = [...lines.entries()]
71
+ .sort(([left], [right]) => left - right)
72
+ .map(([lineNumber, line]) => {
73
+ const ranges = mergeRanges(line.ranges);
74
+ return {
75
+ lineNumber,
76
+ text: line.text,
77
+ matchCount: ranges.length,
78
+ ranges,
79
+ logicalMatchIds: [...new Set(line.logicalMatchIds)],
80
+ };
81
+ });
82
+ const source = path.resolve(cwd, file);
83
+ return {
84
+ path: path.relative(cwd, source),
85
+ link: pathToFileURL(source).href,
86
+ matchCount: matches.length,
87
+ lines: resultLines,
88
+ };
89
+ }
90
+
91
+ function highlightedRange(
92
+ match: AstSearchPresentationMatch,
93
+ text: string,
94
+ index: number,
95
+ lineCount: number,
96
+ ): SearchResultRange | undefined {
97
+ const first = index === 0;
98
+ const last = index === lineCount - 1;
99
+ const from = first ? match.range.start.column : 0;
100
+ const to = last ? match.range.end.column : text.length;
101
+ if (to <= from) return undefined;
102
+ return { from: Math.min(from, text.length), to: Math.min(to, text.length) };
103
+ }
104
+
105
+ function mergeRanges(ranges: readonly SearchResultRange[]): SearchResultRange[] {
106
+ const sorted = [...ranges].sort((left, right) => left.from - right.from || left.to - right.to);
107
+ const merged: SearchResultRange[] = [];
108
+ for (const range of sorted) {
109
+ const previous = merged.at(-1);
110
+ if (previous === undefined || range.from > previous.to) {
111
+ merged.push(range);
112
+ } else {
113
+ merged[merged.length - 1] = { from: previous.from, to: Math.max(previous.to, range.to) };
114
+ }
115
+ }
116
+ return merged;
117
+ }
@@ -5,6 +5,9 @@ import path from "node:path";
5
5
  import type { SearchPluginApi, SearchSelectionMatch } from "pi-agent-search/api/search";
6
6
 
7
7
  import type { SearchRequest, SearchResolver } from "pi-agent-search/api/search";
8
+ import { renderSearchResult } from "pi-agent-search-text/rendering";
9
+
10
+ import { createAstSearchPresentation } from "./search-presentation.js";
8
11
 
9
12
  interface AstGrepMatch {
10
13
  readonly text: string;
@@ -24,6 +27,7 @@ export function createAstSearchResolver(
24
27
  ): SearchResolver {
25
28
  return {
26
29
  id: "ast",
30
+ renderResult: renderSearchResult as SearchResolver["renderResult"],
27
31
  async tryResolve(request, context) {
28
32
  if (!request.query.startsWith("ast:")) {
29
33
  return { kind: "not-handled" };
@@ -65,6 +69,13 @@ export function createAstSearchResolver(
65
69
  })),
66
70
  complete: selected.complete,
67
71
  sessionId: session.id,
72
+ presentation: createAstSearchPresentation(
73
+ request.query,
74
+ selected.raw,
75
+ selected.complete,
76
+ context.cwd,
77
+ session.id,
78
+ ),
68
79
  },
69
80
  };
70
81
  },
@@ -74,10 +85,14 @@ export function createAstSearchResolver(
74
85
  readonly sessionId: string;
75
86
  readonly matches: readonly AstGrepMatch[];
76
87
  readonly complete: boolean;
88
+ readonly presentation: unknown;
77
89
  };
78
90
 
79
91
  if (result.matches.length === 0) {
80
- return { content: [{ type: "text", text: "No AST matches found." }], details: result };
92
+ return {
93
+ content: [{ type: "text", text: "No AST matches found." }],
94
+ details: result.presentation,
95
+ };
81
96
  }
82
97
 
83
98
  const lines = result.matches.flatMap((match, index) => [
@@ -93,7 +108,10 @@ export function createAstSearchResolver(
93
108
  lines.push("Result limit reached.");
94
109
  }
95
110
 
96
- return { content: [{ type: "text", text: lines.join("\n") }], details: result };
111
+ return {
112
+ content: [{ type: "text", text: lines.join("\n") }],
113
+ details: result.presentation,
114
+ };
97
115
  },
98
116
  };
99
117
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-ide-changes",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -13,12 +13,12 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "diff": "^9.0.0",
16
- "pi-agent-doctor": "0.6.1",
17
- "pi-agent-documentation": "0.6.1",
18
- "pi-agent-invariant": "0.6.1",
19
- "pi-agent-read": "0.6.1",
20
- "pi-agent-text": "0.6.1",
21
- "pi-agent-text-editor": "0.6.1"
16
+ "pi-agent-doctor": "0.6.2",
17
+ "pi-agent-documentation": "0.6.2",
18
+ "pi-agent-invariant": "0.6.2",
19
+ "pi-agent-read": "0.6.2",
20
+ "pi-agent-text": "0.6.2",
21
+ "pi-agent-text-editor": "0.6.2"
22
22
  },
23
23
  "pi": {
24
24
  "extensions": [
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "pi-agent-ide-formatter",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-doctor": "0.6.1"
6
+ "pi-agent-doctor": "0.6.2"
7
7
  },
8
8
  "pi": {
9
9
  "extensions": [
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "peerDependencies": {
14
14
  "@earendil-works/pi-coding-agent": "*",
15
- "pi-agent-ide": "0.6.1"
15
+ "pi-agent-ide": "0.6.2"
16
16
  },
17
17
  "peerDependenciesMeta": {
18
18
  "pi-agent-ide": {
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "pi-agent-ide-languages",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-doctor": "0.6.1"
6
+ "pi-agent-doctor": "0.6.2"
7
7
  },
8
8
  "pi": {
9
9
  "extensions": [
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "pi-agent-ide-lint",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-doctor": "0.6.1",
7
- "pi-agent-invariant": "0.6.1",
8
- "pi-agent-read": "0.6.1",
9
- "pi-agent-resource": "0.6.1",
10
- "pi-agent-text": "0.6.1"
6
+ "pi-agent-doctor": "0.6.2",
7
+ "pi-agent-invariant": "0.6.2",
8
+ "pi-agent-read": "0.6.2",
9
+ "pi-agent-resource": "0.6.2",
10
+ "pi-agent-text": "0.6.2"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "peerDependencies": {
18
18
  "@earendil-works/pi-coding-agent": "*",
19
- "pi-agent-ide": "0.6.1"
19
+ "pi-agent-ide": "0.6.2"
20
20
  },
21
21
  "peerDependenciesMeta": {
22
22
  "pi-agent-ide": {
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "pi-agent-ide-lsp",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "cross-spawn": "^7.0.6",
7
- "pi-agent-doctor": "0.6.1",
8
- "pi-agent-invariant": "0.6.1",
9
- "pi-agent-read": "0.6.1",
10
- "pi-agent-resource": "0.6.1",
11
- "pi-agent-search": "0.6.1",
12
- "pi-agent-text": "0.6.1",
13
- "pi-agent-text-editor": "0.6.1",
7
+ "pi-agent-doctor": "0.6.2",
8
+ "pi-agent-invariant": "0.6.2",
9
+ "pi-agent-read": "0.6.2",
10
+ "pi-agent-resource": "0.6.2",
11
+ "pi-agent-search": "0.6.2",
12
+ "pi-agent-text": "0.6.2",
13
+ "pi-agent-text-editor": "0.6.2",
14
14
  "vscode-jsonrpc": "^9.0.0",
15
15
  "vscode-uri": "^3.1.0"
16
16
  },
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@earendil-works/pi-coding-agent": "*",
24
- "pi-agent-ide": "0.6.1"
24
+ "pi-agent-ide": "0.6.2"
25
25
  },
26
26
  "peerDependenciesMeta": {
27
27
  "pi-agent-ide": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-image",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "exports": {
@@ -10,7 +10,7 @@
10
10
  }
11
11
  },
12
12
  "dependencies": {
13
- "pi-agent-resource": "0.6.1"
13
+ "pi-agent-resource": "0.6.2"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@earendil-works/pi-coding-agent": "*"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-invariant",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-pdf",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "exports": {
@@ -11,6 +11,6 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "pdfjs-dist": "^6.2.108",
14
- "pi-agent-resource": "0.6.1"
14
+ "pi-agent-resource": "0.6.2"
15
15
  }
16
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-read",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -24,12 +24,12 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "pi-agent-documentation": "0.6.1",
28
- "pi-agent-invariant": "0.6.1",
29
- "pi-agent-resource": "0.6.1",
30
- "pi-agent-text": "0.6.1",
31
- "pi-agent-tool-call-interception": "0.6.1",
32
- "pi-agent-tool-ui": "0.6.1"
27
+ "pi-agent-documentation": "0.6.2",
28
+ "pi-agent-invariant": "0.6.2",
29
+ "pi-agent-resource": "0.6.2",
30
+ "pi-agent-text": "0.6.2",
31
+ "pi-agent-tool-call-interception": "0.6.2",
32
+ "pi-agent-tool-ui": "0.6.2"
33
33
  },
34
34
  "pi": {
35
35
  "extensions": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-resource",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "imports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-search",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -20,9 +20,9 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "pi-agent-documentation": "0.6.1",
24
- "pi-agent-tool-call-interception": "0.6.1",
25
- "pi-agent-tool-ui": "0.6.1"
23
+ "pi-agent-documentation": "0.6.2",
24
+ "pi-agent-tool-call-interception": "0.6.2",
25
+ "pi-agent-tool-ui": "0.6.2"
26
26
  },
27
27
  "pi": {
28
28
  "extensions": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-search-text",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -13,14 +13,22 @@
13
13
  "./search-session": {
14
14
  "types": "./src/search-session.ts",
15
15
  "default": "./runtime/entry-52.js"
16
+ },
17
+ "./rendering": {
18
+ "types": "./src/search-renderer.ts",
19
+ "default": "./runtime/entry-53.js"
20
+ },
21
+ "./result": {
22
+ "types": "./src/search-result.ts",
23
+ "default": "./runtime/entry-54.js"
16
24
  }
17
25
  },
18
26
  "dependencies": {
19
- "pi-agent-doctor": "0.6.1",
20
- "pi-agent-invariant": "0.6.1",
21
- "pi-agent-search": "0.6.1",
22
- "pi-agent-text": "0.6.1",
23
- "pi-agent-text-editor": "0.6.1"
27
+ "pi-agent-doctor": "0.6.2",
28
+ "pi-agent-invariant": "0.6.2",
29
+ "pi-agent-search": "0.6.2",
30
+ "pi-agent-text": "0.6.2",
31
+ "pi-agent-text-editor": "0.6.2"
24
32
  },
25
33
  "pi": {
26
34
  "extensions": [
@@ -0,0 +1 @@
1
+ export * from "../../../dist/entry-54.js";
@@ -1,7 +1,9 @@
1
1
  import { storeText, restoreText, type StoredText } from "pi-agent-text";
2
2
  import type { SearchToolDetails, SearchResultFile, SearchResultRange } from "./search-result.js";
3
3
 
4
- type StoredLine = readonly [number, StoredText, readonly SearchResultRange[]];
4
+ type StoredLine =
5
+ | readonly [number, StoredText, readonly SearchResultRange[]]
6
+ | readonly [number, StoredText, readonly SearchResultRange[], readonly string[]];
5
7
  interface StoredSearchDetails extends Omit<SearchToolDetails, "files"> {
6
8
  readonly storedFiles: readonly (Omit<SearchResultFile, "lines"> & {
7
9
  readonly lines: readonly StoredLine[];
@@ -24,11 +26,10 @@ export function compactSearchDetails(
24
26
  ...rest,
25
27
  storedFiles: files.map(({ lines, ...file }) => ({
26
28
  ...file,
27
- lines: lines.map((line): StoredLine => [
28
- line.lineNumber,
29
- storeText(line.text, source),
30
- line.ranges,
31
- ]),
29
+ lines: lines.map((line): StoredLine => {
30
+ const stored = [line.lineNumber, storeText(line.text, source), line.ranges] as const;
31
+ return line.logicalMatchIds === undefined ? stored : [...stored, line.logicalMatchIds];
32
+ }),
32
33
  })),
33
34
  };
34
35
  }
@@ -45,11 +46,12 @@ export function restoreSearchDetails(
45
46
  ...rest,
46
47
  files: storedFiles.map(({ lines, ...file }) => ({
47
48
  ...file,
48
- lines: lines.map(([lineNumber, text, ranges]) => ({
49
+ lines: lines.map(([lineNumber, text, ranges, logicalMatchIds]) => ({
49
50
  lineNumber,
50
51
  text: restoreText(text, source),
51
52
  ranges,
52
53
  matchCount: ranges.length,
54
+ ...(logicalMatchIds === undefined ? {} : { logicalMatchIds }),
53
55
  })),
54
56
  })),
55
57
  };
@@ -166,11 +166,17 @@ function searchViewport(details: SearchToolDetails, expanded: boolean): readonly
166
166
  selected.pop();
167
167
  }
168
168
 
169
- const shownMatches = selected.reduce(
170
- (count, row) => count + (row.kind === "line" ? row.line.matchCount : 0),
171
- 0,
169
+ const shownIds = new Set(
170
+ selected.flatMap((row) => (row.kind === "line" ? (row.line.logicalMatchIds ?? []) : [])),
172
171
  );
173
- return [...selected, { kind: "omitted", matches: details.matchCount - shownMatches }];
172
+ const shownMatches =
173
+ shownIds.size > 0
174
+ ? shownIds.size
175
+ : selected.reduce((count, row) => count + (row.kind === "line" ? row.line.matchCount : 0), 0);
176
+ return [
177
+ ...selected,
178
+ { kind: "omitted", matches: Math.max(0, details.matchCount - shownMatches) },
179
+ ];
174
180
  }
175
181
 
176
182
  function compactRenderedRows(
@@ -14,6 +14,7 @@ export interface SearchResultLine {
14
14
  readonly text: string;
15
15
  readonly matchCount: number;
16
16
  readonly ranges: readonly SearchResultRange[];
17
+ readonly logicalMatchIds?: readonly string[];
17
18
  }
18
19
 
19
20
  export interface SearchResultGroup {
@@ -155,6 +156,7 @@ function isSearchResultFile(value: unknown): value is SearchResultFile {
155
156
 
156
157
  const lines = value.lines as readonly SearchResultLine[];
157
158
  const groups = value.groups;
159
+ const logicalMatchIds = new Set(lines.flatMap((line) => line.logicalMatchIds ?? []));
158
160
  return (
159
161
  (groups === undefined ||
160
162
  (Array.isArray(groups) &&
@@ -163,7 +165,9 @@ function isSearchResultFile(value: unknown): value is SearchResultFile {
163
165
  ))) &&
164
166
  (value.uniqueLineCount === undefined || isCount(value.uniqueLineCount)) &&
165
167
  (lines.length === 0 ||
166
- value.matchCount === lines.reduce((count, line) => count + line.matchCount, 0))
168
+ (logicalMatchIds.size > 0
169
+ ? logicalMatchIds.size === value.matchCount
170
+ : value.matchCount === lines.reduce((count, line) => count + line.matchCount, 0)))
167
171
  );
168
172
  }
169
173
 
@@ -176,6 +180,9 @@ function isSearchResultLine(value: unknown): value is SearchResultLine {
176
180
  isCount(value.matchCount) &&
177
181
  Array.isArray(value.ranges) &&
178
182
  value.ranges.length === value.matchCount &&
183
+ (value.logicalMatchIds === undefined ||
184
+ (Array.isArray(value.logicalMatchIds) &&
185
+ value.logicalMatchIds.every((id) => typeof id === "string"))) &&
179
186
  value.ranges.every((range) => isSearchResultRange(range, value.text as string))
180
187
  );
181
188
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "imports": {
@@ -9,11 +9,11 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./src/index.ts",
12
- "default": "./runtime/entry-53.js"
12
+ "default": "./runtime/entry-55.js"
13
13
  }
14
14
  },
15
15
  "dependencies": {
16
- "pi-agent-resource": "0.6.1"
16
+ "pi-agent-resource": "0.6.2"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "typebox": "*"
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-constant",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-text": "0.6.1",
10
- "pi-agent-text-editor": "0.6.1"
9
+ "pi-agent-text": "0.6.2",
10
+ "pi-agent-text-editor": "0.6.2"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
14
- "./runtime/entry-54.js"
14
+ "./runtime/entry-56.js"
15
15
  ]
16
16
  },
17
17
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-exact",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,17 +8,17 @@
8
8
  "exports": {
9
9
  "./api/anchor": {
10
10
  "types": "./src/anchor.ts",
11
- "default": "./runtime/entry-55.js"
11
+ "default": "./runtime/entry-57.js"
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
15
  "fast-fuzzy": "1.12.0",
16
- "pi-agent-text": "0.6.1",
17
- "pi-agent-text-editor": "0.6.1"
16
+ "pi-agent-text": "0.6.2",
17
+ "pi-agent-text-editor": "0.6.2"
18
18
  },
19
19
  "pi": {
20
20
  "extensions": [
21
- "./runtime/entry-56.js"
21
+ "./runtime/entry-58.js"
22
22
  ]
23
23
  },
24
24
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-line-hash",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,18 +8,18 @@
8
8
  "exports": {
9
9
  "./api/anchor": {
10
10
  "types": "./src/anchor.ts",
11
- "default": "./runtime/entry-57.js"
11
+ "default": "./runtime/entry-59.js"
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "pi-agent-invariant": "0.6.1",
16
- "pi-agent-read": "0.6.1",
17
- "pi-agent-text": "0.6.1",
18
- "pi-agent-text-editor": "0.6.1"
15
+ "pi-agent-invariant": "0.6.2",
16
+ "pi-agent-read": "0.6.2",
17
+ "pi-agent-text": "0.6.2",
18
+ "pi-agent-text-editor": "0.6.2"
19
19
  },
20
20
  "pi": {
21
21
  "extensions": [
22
- "./runtime/entry-58.js"
22
+ "./runtime/entry-60.js"
23
23
  ]
24
24
  },
25
25
  "peerDependencies": {
@@ -0,0 +1,2 @@
1
+ export * from "../../../dist/entry-60.js";
2
+ export { default } from "../../../dist/entry-60.js";