@oh-my-pi/pi-coding-agent 15.9.5 → 15.10.0

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 (192) hide show
  1. package/CHANGELOG.md +98 -1
  2. package/dist/types/cli/args.d.ts +1 -1
  3. package/dist/types/cli/gallery-cli.d.ts +43 -0
  4. package/dist/types/cli/gallery-fixtures/agentic.d.ts +2 -0
  5. package/dist/types/cli/gallery-fixtures/codeintel.d.ts +3 -0
  6. package/dist/types/cli/gallery-fixtures/edit.d.ts +3 -0
  7. package/dist/types/cli/gallery-fixtures/fs.d.ts +2 -0
  8. package/dist/types/cli/gallery-fixtures/index.d.ts +4 -0
  9. package/dist/types/cli/gallery-fixtures/interaction.d.ts +3 -0
  10. package/dist/types/cli/gallery-fixtures/memory.d.ts +2 -0
  11. package/dist/types/cli/gallery-fixtures/misc.d.ts +3 -0
  12. package/dist/types/cli/gallery-fixtures/search.d.ts +3 -0
  13. package/dist/types/cli/gallery-fixtures/shell.d.ts +3 -0
  14. package/dist/types/cli/gallery-fixtures/types.d.ts +44 -0
  15. package/dist/types/cli/gallery-fixtures/web.d.ts +2 -0
  16. package/dist/types/cli/gallery-screenshot.d.ts +35 -0
  17. package/dist/types/commands/gallery.d.ts +47 -0
  18. package/dist/types/config/keybindings.d.ts +10 -2
  19. package/dist/types/config/model-id-affixes.d.ts +2 -0
  20. package/dist/types/config/model-registry.d.ts +8 -1
  21. package/dist/types/config/settings-schema.d.ts +43 -7
  22. package/dist/types/edit/file-snapshot-store.d.ts +1 -1
  23. package/dist/types/eval/backend.d.ts +6 -6
  24. package/dist/types/eval/bridge-timeout.d.ts +27 -0
  25. package/dist/types/eval/idle-timeout.d.ts +16 -14
  26. package/dist/types/eval/js/executor.d.ts +3 -3
  27. package/dist/types/eval/py/executor.d.ts +2 -2
  28. package/dist/types/eval/py/spawn-options.d.ts +58 -0
  29. package/dist/types/extensibility/plugins/marketplace-auto-update.d.ts +8 -0
  30. package/dist/types/lsp/types.d.ts +10 -0
  31. package/dist/types/main.d.ts +3 -2
  32. package/dist/types/memory-backend/index.d.ts +2 -1
  33. package/dist/types/memory-backend/resolve.d.ts +1 -1
  34. package/dist/types/memory-backend/types.d.ts +1 -1
  35. package/dist/types/modes/components/assistant-message.d.ts +5 -0
  36. package/dist/types/modes/components/copy-selector.d.ts +22 -0
  37. package/dist/types/modes/components/custom-editor.d.ts +2 -1
  38. package/dist/types/modes/components/model-selector.d.ts +1 -0
  39. package/dist/types/modes/components/tool-execution.d.ts +18 -0
  40. package/dist/types/modes/controllers/command-controller.d.ts +0 -1
  41. package/dist/types/modes/controllers/selector-controller.d.ts +2 -1
  42. package/dist/types/modes/index.d.ts +5 -4
  43. package/dist/types/modes/interactive-mode.d.ts +2 -2
  44. package/dist/types/modes/setup-version.d.ts +11 -0
  45. package/dist/types/modes/setup-wizard/index.d.ts +2 -1
  46. package/dist/types/modes/setup-wizard/scenes/web-search.d.ts +2 -1
  47. package/dist/types/modes/types.d.ts +2 -2
  48. package/dist/types/modes/utils/copy-targets.d.ts +53 -0
  49. package/dist/types/sdk.d.ts +1 -1
  50. package/dist/types/task/executor.d.ts +7 -0
  51. package/dist/types/telemetry-export.d.ts +1 -1
  52. package/dist/types/tools/eval-render.d.ts +1 -0
  53. package/dist/types/tools/fetch.d.ts +15 -7
  54. package/dist/types/tools/render-utils.d.ts +33 -0
  55. package/dist/types/tools/renderers.d.ts +16 -2
  56. package/dist/types/tools/search.d.ts +1 -1
  57. package/dist/types/tools/write.d.ts +2 -0
  58. package/dist/types/tui/code-cell.d.ts +6 -0
  59. package/dist/types/tui/output-block.d.ts +11 -0
  60. package/dist/types/web/scrapers/github.d.ts +22 -0
  61. package/dist/types/web/search/providers/perplexity.d.ts +8 -1
  62. package/dist/types/web/search/types.d.ts +1 -1
  63. package/package.json +9 -9
  64. package/scripts/dev-launch +42 -0
  65. package/scripts/dev-launch-preload.ts +19 -0
  66. package/src/autoresearch/dashboard.ts +11 -21
  67. package/src/cli/args.ts +2 -2
  68. package/src/cli/claude-trace-cli.ts +13 -1
  69. package/src/cli/gallery-cli.ts +223 -0
  70. package/src/cli/gallery-fixtures/agentic.ts +292 -0
  71. package/src/cli/gallery-fixtures/codeintel.ts +188 -0
  72. package/src/cli/gallery-fixtures/edit.ts +194 -0
  73. package/src/cli/gallery-fixtures/fs.ts +153 -0
  74. package/src/cli/gallery-fixtures/index.ts +40 -0
  75. package/src/cli/gallery-fixtures/interaction.ts +49 -0
  76. package/src/cli/gallery-fixtures/memory.ts +81 -0
  77. package/src/cli/gallery-fixtures/misc.ts +221 -0
  78. package/src/cli/gallery-fixtures/search.ts +213 -0
  79. package/src/cli/gallery-fixtures/shell.ts +167 -0
  80. package/src/cli/gallery-fixtures/types.ts +41 -0
  81. package/src/cli/gallery-fixtures/web.ts +158 -0
  82. package/src/cli/gallery-screenshot.ts +279 -0
  83. package/src/cli-commands.ts +1 -0
  84. package/src/commands/gallery.ts +52 -0
  85. package/src/commands/launch.ts +1 -1
  86. package/src/config/keybindings.ts +68 -2
  87. package/src/config/model-equivalence.ts +35 -12
  88. package/src/config/model-id-affixes.ts +39 -22
  89. package/src/config/model-registry.ts +16 -16
  90. package/src/config/settings-schema.ts +29 -6
  91. package/src/config/settings.ts +11 -0
  92. package/src/dap/client.ts +14 -16
  93. package/src/debug/raw-sse.ts +18 -4
  94. package/src/edit/file-snapshot-store.ts +1 -1
  95. package/src/edit/index.ts +1 -1
  96. package/src/edit/renderer.ts +43 -55
  97. package/src/edit/streaming.ts +1 -1
  98. package/src/eval/__tests__/agent-bridge.test.ts +102 -58
  99. package/src/eval/__tests__/bridge-timeout.test.ts +64 -0
  100. package/src/eval/__tests__/idle-timeout.test.ts +26 -12
  101. package/src/eval/__tests__/kernel-spawn.test.ts +103 -0
  102. package/src/eval/__tests__/llm-bridge.test.ts +10 -10
  103. package/src/eval/agent-bridge.ts +38 -12
  104. package/src/eval/backend.ts +6 -6
  105. package/src/eval/bridge-timeout.ts +44 -0
  106. package/src/eval/idle-timeout.ts +33 -15
  107. package/src/eval/js/executor.ts +10 -10
  108. package/src/eval/llm-bridge.ts +4 -5
  109. package/src/eval/py/executor.ts +6 -6
  110. package/src/eval/py/kernel.ts +11 -1
  111. package/src/eval/py/spawn-options.ts +126 -0
  112. package/src/export/ttsr.ts +9 -0
  113. package/src/extensibility/extensions/runner.ts +3 -0
  114. package/src/extensibility/plugins/doctor.ts +0 -1
  115. package/src/extensibility/plugins/marketplace-auto-update.ts +49 -0
  116. package/src/goals/tools/goal-tool.ts +2 -2
  117. package/src/internal-urls/docs-index.generated.ts +7 -6
  118. package/src/lsp/client.ts +179 -52
  119. package/src/lsp/index.ts +38 -4
  120. package/src/lsp/render.ts +3 -3
  121. package/src/lsp/types.ts +10 -0
  122. package/src/main.ts +47 -52
  123. package/src/memory-backend/index.ts +13 -1
  124. package/src/memory-backend/resolve.ts +3 -5
  125. package/src/memory-backend/types.ts +1 -1
  126. package/src/modes/components/agent-dashboard.ts +13 -4
  127. package/src/modes/components/assistant-message.ts +22 -1
  128. package/src/modes/components/copy-selector.ts +249 -0
  129. package/src/modes/components/custom-editor.ts +10 -1
  130. package/src/modes/components/extensions/extension-list.ts +17 -8
  131. package/src/modes/components/history-search.ts +19 -11
  132. package/src/modes/components/model-selector.ts +125 -29
  133. package/src/modes/components/oauth-selector.ts +28 -12
  134. package/src/modes/components/session-observer-overlay.ts +13 -15
  135. package/src/modes/components/session-selector.ts +24 -13
  136. package/src/modes/components/status-line.ts +3 -5
  137. package/src/modes/components/tool-execution.ts +83 -24
  138. package/src/modes/components/tree-selector.ts +19 -7
  139. package/src/modes/components/user-message-selector.ts +25 -14
  140. package/src/modes/controllers/command-controller.ts +13 -118
  141. package/src/modes/controllers/event-controller.ts +26 -10
  142. package/src/modes/controllers/input-controller.ts +11 -3
  143. package/src/modes/controllers/selector-controller.ts +40 -3
  144. package/src/modes/index.ts +5 -4
  145. package/src/modes/interactive-mode.ts +21 -7
  146. package/src/modes/setup-version.ts +11 -0
  147. package/src/modes/setup-wizard/index.ts +3 -2
  148. package/src/modes/setup-wizard/scenes/web-search.ts +3 -2
  149. package/src/modes/theme/theme.ts +46 -10
  150. package/src/modes/types.ts +2 -2
  151. package/src/modes/utils/context-usage.ts +10 -6
  152. package/src/modes/utils/copy-targets.ts +254 -0
  153. package/src/modes/utils/hotkeys-markdown.ts +1 -0
  154. package/src/prompts/tools/ast-edit.md +1 -1
  155. package/src/prompts/tools/ast-grep.md +1 -1
  156. package/src/prompts/tools/read.md +1 -1
  157. package/src/prompts/tools/search.md +1 -1
  158. package/src/sdk.ts +21 -23
  159. package/src/session/agent-session.ts +13 -9
  160. package/src/slash-commands/builtin-registry.ts +4 -12
  161. package/src/slash-commands/helpers/usage-report.ts +2 -0
  162. package/src/task/executor.ts +20 -2
  163. package/src/task/render.ts +37 -11
  164. package/src/telemetry-export.ts +25 -7
  165. package/src/tools/bash.ts +18 -8
  166. package/src/tools/browser/render.ts +5 -4
  167. package/src/tools/debug.ts +3 -3
  168. package/src/tools/eval-backends.ts +6 -17
  169. package/src/tools/eval-render.ts +28 -10
  170. package/src/tools/eval.ts +19 -23
  171. package/src/tools/fetch.ts +99 -89
  172. package/src/tools/read.ts +7 -7
  173. package/src/tools/render-utils.ts +63 -3
  174. package/src/tools/renderers.ts +16 -1
  175. package/src/tools/report-tool-issue.ts +1 -1
  176. package/src/tools/search.ts +173 -81
  177. package/src/tools/ssh.ts +21 -8
  178. package/src/tools/todo.ts +20 -7
  179. package/src/tools/write.ts +39 -9
  180. package/src/tui/code-cell.ts +19 -4
  181. package/src/tui/output-block.ts +14 -0
  182. package/src/web/scrapers/github.ts +255 -3
  183. package/src/web/scrapers/youtube.ts +3 -2
  184. package/src/web/search/providers/perplexity.ts +199 -51
  185. package/src/web/search/render.ts +42 -57
  186. package/src/web/search/types.ts +5 -1
  187. package/dist/types/eval/heartbeat.d.ts +0 -45
  188. package/src/eval/__tests__/heartbeat.test.ts +0 -84
  189. package/src/eval/__tests__/shared-executors.test.ts +0 -609
  190. package/src/eval/heartbeat.ts +0 -74
  191. /package/dist/types/eval/__tests__/{heartbeat.test.d.ts → bridge-timeout.test.d.ts} +0 -0
  192. /package/dist/types/eval/__tests__/{shared-executors.test.d.ts → kernel-spawn.test.d.ts} +0 -0
@@ -0,0 +1,213 @@
1
+ /** Gallery fixtures for the search tools (search, search_tool_bm25, ast_grep). */
2
+ import type { GalleryFixture } from "./types";
3
+
4
+ export const searchFixtures: Record<string, GalleryFixture> = {
5
+ search: {
6
+ label: "Search",
7
+ streamingArgs: {
8
+ pattern: "useState",
9
+ },
10
+ args: {
11
+ pattern: "useState",
12
+ paths: ["packages/tui/src"],
13
+ },
14
+ result: {
15
+ content: [
16
+ {
17
+ type: "text",
18
+ text: [
19
+ "# packages/tui/src/components/",
20
+ "## SearchBox.tsx",
21
+ '18: const [query, setQuery] = useState("");',
22
+ "19: const [results, setResults] = useState<Match[]>([]);",
23
+ "## StatusBar.tsx",
24
+ "27: const [expanded, setExpanded] = useState(false);",
25
+ "",
26
+ "# packages/tui/src/hooks/",
27
+ "## useDebounced.ts",
28
+ "9: const [value, setValue] = useState(initial);",
29
+ "10: const [pending, setPending] = useState(false);",
30
+ ].join("\n"),
31
+ },
32
+ ],
33
+ details: {
34
+ scopePath: "packages/tui/src",
35
+ searchPath: "/Users/dev/Projects/pi/packages/tui/src",
36
+ matchCount: 5,
37
+ fileCount: 3,
38
+ files: [
39
+ "packages/tui/src/components/SearchBox.tsx",
40
+ "packages/tui/src/components/StatusBar.tsx",
41
+ "packages/tui/src/hooks/useDebounced.ts",
42
+ ],
43
+ fileMatches: [
44
+ { path: "packages/tui/src/components/SearchBox.tsx", count: 2 },
45
+ { path: "packages/tui/src/components/StatusBar.tsx", count: 1 },
46
+ { path: "packages/tui/src/hooks/useDebounced.ts", count: 2 },
47
+ ],
48
+ truncated: false,
49
+ displayContent: [
50
+ "# packages/tui/src/components/",
51
+ "## SearchBox.tsx",
52
+ '*18│ const [query, setQuery] = useState("");',
53
+ "*19│ const [results, setResults] = useState<Match[]>([]);",
54
+ "## StatusBar.tsx",
55
+ "*27│ const [expanded, setExpanded] = useState(false);",
56
+ "",
57
+ "# packages/tui/src/hooks/",
58
+ "## useDebounced.ts",
59
+ " *9│ const [value, setValue] = useState(initial);",
60
+ "*10│ const [pending, setPending] = useState(false);",
61
+ ].join("\n"),
62
+ },
63
+ },
64
+ errorResult: {
65
+ content: [
66
+ {
67
+ type: "text",
68
+ text: "Invalid regex pattern: unclosed group near index 8",
69
+ },
70
+ ],
71
+ isError: true,
72
+ details: {
73
+ error: "Invalid regex pattern: unclosed group near index 8",
74
+ },
75
+ },
76
+ },
77
+
78
+ search_tool_bm25: {
79
+ label: "SearchTools",
80
+ streamingArgs: {
81
+ query: "read pdf and ext",
82
+ },
83
+ args: {
84
+ query: "read pdf and extract tables",
85
+ limit: 5,
86
+ },
87
+ result: {
88
+ content: [
89
+ {
90
+ type: "text",
91
+ text: JSON.stringify({
92
+ query: "read pdf and extract tables",
93
+ activated_tools: ["docling_extract_tables", "docling_convert", "pdf_read_text"],
94
+ match_count: 4,
95
+ total_tools: 142,
96
+ }),
97
+ },
98
+ ],
99
+ details: {
100
+ query: "read pdf and extract tables",
101
+ limit: 5,
102
+ total_tools: 142,
103
+ activated_tools: ["docling_extract_tables", "docling_convert", "pdf_read_text"],
104
+ active_selected_tools: ["read", "search", "edit", "bash"],
105
+ tools: [
106
+ {
107
+ name: "docling_extract_tables",
108
+ label: "Extract Tables",
109
+ description: "Extract tabular data from PDF documents into CSV or JSON rows.",
110
+ server_name: "docling",
111
+ mcp_tool_name: "extract_tables",
112
+ schema_keys: ["path", "pages", "format"],
113
+ score: 9.412037,
114
+ },
115
+ {
116
+ name: "docling_convert",
117
+ label: "Convert Document",
118
+ description: "Convert PDF, DOCX, or PPTX into structured Markdown with layout preserved.",
119
+ server_name: "docling",
120
+ mcp_tool_name: "convert",
121
+ schema_keys: ["path", "target", "ocr"],
122
+ score: 6.83102,
123
+ },
124
+ {
125
+ name: "pdf_read_text",
126
+ label: "Read PDF Text",
127
+ description: "Read raw text from a PDF, optionally scoped to a page range.",
128
+ server_name: "pdf-tools",
129
+ mcp_tool_name: "read_text",
130
+ schema_keys: ["path", "page_start", "page_end"],
131
+ score: 5.207884,
132
+ },
133
+ {
134
+ name: "tabula_scan",
135
+ label: "Scan Tables",
136
+ description: "Detect table bounding boxes on scanned PDF pages before extraction.",
137
+ server_name: "pdf-tools",
138
+ mcp_tool_name: "scan",
139
+ schema_keys: ["path", "dpi"],
140
+ score: 3.119556,
141
+ },
142
+ ],
143
+ },
144
+ },
145
+ errorResult: {
146
+ content: [
147
+ {
148
+ type: "text",
149
+ text: "Tool discovery is disabled. Enable tools.discoveryMode or mcp.discoveryMode to use search_tool_bm25.",
150
+ },
151
+ ],
152
+ isError: true,
153
+ },
154
+ },
155
+
156
+ ast_grep: {
157
+ label: "AST Grep",
158
+ streamingArgs: {
159
+ pat: "useState(",
160
+ },
161
+ args: {
162
+ pat: "useState($A)",
163
+ paths: ["packages/tui/src/components"],
164
+ },
165
+ result: {
166
+ content: [
167
+ {
168
+ type: "text",
169
+ text: [
170
+ "# packages/tui/src/components/",
171
+ "## SearchBox.tsx",
172
+ '18: const [query, setQuery] = useState("");',
173
+ ' meta: $A=""',
174
+ "## StatusBar.tsx",
175
+ "27: const [expanded, setExpanded] = useState(false);",
176
+ " meta: $A=false",
177
+ ].join("\n"),
178
+ },
179
+ ],
180
+ details: {
181
+ matchCount: 2,
182
+ fileCount: 2,
183
+ filesSearched: 14,
184
+ limitReached: false,
185
+ scopePath: "packages/tui/src/components",
186
+ searchPath: "/Users/dev/Projects/pi/packages/tui/src/components",
187
+ files: ["packages/tui/src/components/SearchBox.tsx", "packages/tui/src/components/StatusBar.tsx"],
188
+ fileMatches: [
189
+ { path: "packages/tui/src/components/SearchBox.tsx", count: 1 },
190
+ { path: "packages/tui/src/components/StatusBar.tsx", count: 1 },
191
+ ],
192
+ displayContent: [
193
+ "# packages/tui/src/components/",
194
+ "## SearchBox.tsx",
195
+ '*18│ const [query, setQuery] = useState("");',
196
+ ' meta: $A=""',
197
+ "## StatusBar.tsx",
198
+ "*27│ const [expanded, setExpanded] = useState(false);",
199
+ " meta: $A=false",
200
+ ].join("\n"),
201
+ },
202
+ },
203
+ errorResult: {
204
+ content: [
205
+ {
206
+ type: "text",
207
+ text: "Pattern parse error: incomplete node `useState(` — expected a closing `)`",
208
+ },
209
+ ],
210
+ isError: true,
211
+ },
212
+ },
213
+ };
@@ -0,0 +1,167 @@
1
+ /** Gallery fixtures for the shell tools (bash, eval). */
2
+ import type { GalleryFixture } from "./types";
3
+
4
+ export const shellFixtures: Record<string, GalleryFixture> = {
5
+ bash: {
6
+ label: "Bash",
7
+ streamingArgs: {
8
+ command: "git status --short && git log --on",
9
+ },
10
+ args: {
11
+ command: "git status --short && git log --oneline -5",
12
+ cwd: "packages/coding-agent",
13
+ timeout: 30,
14
+ },
15
+ result: {
16
+ content: [
17
+ {
18
+ type: "text",
19
+ text: [
20
+ " M src/cli/gallery-cli.ts",
21
+ " M src/tools/bash.ts",
22
+ "?? src/cli/gallery-fixtures/shell.ts",
23
+ "a1b2c3d Wire gallery command into CLI dispatch",
24
+ "9f8e7d6 Add ToolExecutionComponent lifecycle states",
25
+ "4c5b6a7 Extract createShellRenderer from bashToolRenderer",
26
+ "2d3e4f5 Strip LLM-facing notices before TUI render",
27
+ "7a8b9c0 Cap preview lines in pending command block",
28
+ ].join("\n"),
29
+ },
30
+ ],
31
+ details: {
32
+ exitCode: 0,
33
+ wallTimeMs: 184,
34
+ timeoutSeconds: 30,
35
+ },
36
+ },
37
+ errorResult: {
38
+ content: [
39
+ {
40
+ type: "text",
41
+ text: [
42
+ "src/tools/bash.ts:1142:34 - error TS2339: Property 'requestedTimeoutSeconds' does not exist on type 'BashToolDetails'.",
43
+ "",
44
+ "1142 const requestedTimeoutSeconds = details?.requestedTimeoutSeconds;",
45
+ " ~~~~~~~~~~~~~~~~~~~~~~~~",
46
+ "Found 1 error in src/tools/bash.ts:1142",
47
+ ].join("\n"),
48
+ },
49
+ ],
50
+ isError: true,
51
+ details: {
52
+ exitCode: 2,
53
+ wallTimeMs: 5120,
54
+ timeoutSeconds: 30,
55
+ },
56
+ },
57
+ },
58
+
59
+ eval: {
60
+ label: "Eval",
61
+ streamingArgs: {
62
+ cells: [
63
+ {
64
+ language: "py",
65
+ code: 'import json\nfrom pathlib import Path\n\ndata = json.loads(Path("package.js',
66
+ title: "load config",
67
+ },
68
+ ],
69
+ },
70
+ args: {
71
+ cells: [
72
+ {
73
+ language: "py",
74
+ title: "load config",
75
+ code: [
76
+ "import json",
77
+ "from pathlib import Path",
78
+ "",
79
+ 'data = json.loads(Path("package.json").read_text())',
80
+ 'deps = data.get("dependencies", {})',
81
+ 'print(f"{data[\\"name\\"]} v{data[\\"version\\"]}")',
82
+ 'print(f"{len(deps)} dependencies")',
83
+ "display(sorted(deps)[:3])",
84
+ ].join("\n"),
85
+ },
86
+ ],
87
+ },
88
+ result: {
89
+ content: [
90
+ {
91
+ type: "text",
92
+ text: ["@oh-my-pi/coding-agent v0.42.0", "37 dependencies"].join("\n"),
93
+ },
94
+ ],
95
+ details: {
96
+ language: "python",
97
+ languages: ["python"],
98
+ jsonOutputs: [["@ai-sdk/anthropic", "@oh-my-pi/pi-ai", "@oh-my-pi/pi-tui"]],
99
+ cells: [
100
+ {
101
+ index: 0,
102
+ title: "load config",
103
+ language: "python",
104
+ code: [
105
+ "import json",
106
+ "from pathlib import Path",
107
+ "",
108
+ 'data = json.loads(Path("package.json").read_text())',
109
+ 'deps = data.get("dependencies", {})',
110
+ 'print(f"{data[\\"name\\"]} v{data[\\"version\\"]}")',
111
+ 'print(f"{len(deps)} dependencies")',
112
+ "display(sorted(deps)[:3])",
113
+ ].join("\n"),
114
+ output: ["@oh-my-pi/coding-agent v0.42.0", "37 dependencies"].join("\n"),
115
+ status: "complete",
116
+ durationMs: 64,
117
+ exitCode: 0,
118
+ },
119
+ ],
120
+ },
121
+ },
122
+ errorResult: {
123
+ content: [
124
+ {
125
+ type: "text",
126
+ text: [
127
+ "Traceback (most recent call last):",
128
+ ' File "<cell 0>", line 4, in <module>',
129
+ ' data = json.loads(Path("package.json").read_text())',
130
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",
131
+ "json.decoder.JSONDecodeError: Expecting ',' delimiter: line 12 column 3 (char 318)",
132
+ ].join("\n"),
133
+ },
134
+ ],
135
+ isError: true,
136
+ details: {
137
+ language: "python",
138
+ languages: ["python"],
139
+ isError: true,
140
+ cells: [
141
+ {
142
+ index: 0,
143
+ title: "load config",
144
+ language: "python",
145
+ code: [
146
+ "import json",
147
+ "from pathlib import Path",
148
+ "",
149
+ 'data = json.loads(Path("package.json").read_text())',
150
+ 'deps = data.get("dependencies", {})',
151
+ 'print(f"{data[\\"name\\"]} v{data[\\"version\\"]}")',
152
+ ].join("\n"),
153
+ output: [
154
+ "Traceback (most recent call last):",
155
+ ' File "<cell 0>", line 4, in <module>',
156
+ ' data = json.loads(Path("package.json").read_text())',
157
+ "json.decoder.JSONDecodeError: Expecting ',' delimiter: line 12 column 3 (char 318)",
158
+ ].join("\n"),
159
+ status: "error",
160
+ durationMs: 41,
161
+ exitCode: 1,
162
+ },
163
+ ],
164
+ },
165
+ },
166
+ },
167
+ };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Types for `omp gallery` sample data. See {@link ./index} for the aggregated
3
+ * fixture registry and the contract each fixture must satisfy.
4
+ */
5
+ import type { EditMode } from "../../edit";
6
+
7
+ /** A tool result snapshot, matching the shape `ToolExecutionComponent` consumes. */
8
+ export interface GalleryResult {
9
+ content: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;
10
+ details?: unknown;
11
+ isError?: boolean;
12
+ }
13
+
14
+ export interface GalleryFixture {
15
+ /** Display label for the tool header (defaults to the tool name). */
16
+ label?: string;
17
+ /** Edit mode for edit-like tools so the streaming preview dispatches correctly. */
18
+ editMode?: EditMode;
19
+ /**
20
+ * Set for tools whose real `AgentTool` attaches `renderCall`/`renderResult`
21
+ * directly on the instance (e.g. `lsp`, `task`). The harness then attaches
22
+ * the registry renderer onto the fake tool so the component routes through
23
+ * the custom-tool branch — the same path production takes — instead of the
24
+ * built-in registry branch. The two branches can diverge, so exercising the
25
+ * real one keeps the gallery honest for these tools.
26
+ */
27
+ customRendered?: boolean;
28
+ /**
29
+ * Arguments shown during the streaming state — a partial view of {@link args}
30
+ * as if the tool-call JSON were still arriving. May include `__partialJson`
31
+ * for renderers (bash, edit) that surface fields before the object closes.
32
+ * Defaults to {@link args} when omitted.
33
+ */
34
+ streamingArgs?: unknown;
35
+ /** Complete arguments shown for the in-progress, success, and error states. */
36
+ args: unknown;
37
+ /** Successful result. */
38
+ result: GalleryResult;
39
+ /** Failed result. Falls back to a generic error when omitted. */
40
+ errorResult?: GalleryResult;
41
+ }
@@ -0,0 +1,158 @@
1
+ // Gallery fixtures for the web tools (web_search, browser).
2
+ import type { GalleryFixture } from "./types";
3
+
4
+ export const webFixtures: Record<string, GalleryFixture> = {
5
+ web_search: {
6
+ label: "Web Search",
7
+ // Streaming: query still being typed, no recency/limit yet.
8
+ streamingArgs: { query: "bun vs node performance" },
9
+ args: {
10
+ query: "Bun vs Node.js performance benchmarks 2026",
11
+ recency: "month",
12
+ limit: 4,
13
+ },
14
+ result: {
15
+ content: [
16
+ {
17
+ type: "text",
18
+ text: [
19
+ "Bun continues to outperform Node.js on raw HTTP throughput and cold-start",
20
+ "time thanks to its JavaScriptCore engine and native-Zig runtime, while",
21
+ "Node.js retains an edge in ecosystem maturity and long-term stability.",
22
+ "For script-heavy workflows Bun's faster startup is the decisive factor.",
23
+ ].join("\n"),
24
+ },
25
+ ],
26
+ details: {
27
+ response: {
28
+ provider: "perplexity",
29
+ model: "sonar-pro",
30
+ authMode: "api_key",
31
+ requestId: "req_a1b2c3d4e5f6",
32
+ answer: [
33
+ "Bun continues to outperform Node.js on raw HTTP throughput and cold-start",
34
+ "time thanks to its JavaScriptCore engine and native-Zig runtime, while",
35
+ "Node.js retains an edge in ecosystem maturity and long-term stability.",
36
+ "For script-heavy workflows Bun's faster startup is the decisive factor.",
37
+ ].join("\n"),
38
+ searchQueries: ["bun vs node.js performance benchmarks 2026", "bun http throughput vs node"],
39
+ sources: [
40
+ {
41
+ title: "Bun 1.2 Benchmarks: HTTP, SQLite, and Startup Time",
42
+ url: "https://bun.sh/blog/bun-v1.2-benchmarks",
43
+ snippet:
44
+ "Bun serves roughly 2.5x the requests per second of Node.js on a simple HTTP server and starts in under 10ms.",
45
+ ageSeconds: 86400 * 12,
46
+ author: "The Bun Team",
47
+ },
48
+ {
49
+ title: "Node.js vs Bun: A 2026 Performance Deep Dive",
50
+ url: "https://blog.platformatic.dev/nodejs-vs-bun-2026",
51
+ snippet:
52
+ "Across CPU-bound workloads the gap narrows, but Bun's faster module resolution keeps cold starts ahead.",
53
+ ageSeconds: 86400 * 3,
54
+ author: "Matteo Collina",
55
+ },
56
+ {
57
+ title: "Real-world API latency: Bun, Deno, and Node compared",
58
+ url: "https://www.theregister.com/2026/05/18/js_runtime_latency/",
59
+ snippet:
60
+ "Under sustained load p99 latencies converge, suggesting runtime choice matters less for steady-state services.",
61
+ ageSeconds: 86400 * 19,
62
+ },
63
+ {
64
+ title: "Why we migrated our CLI tooling from Node to Bun",
65
+ url: "https://engineering.example.com/posts/bun-cli-migration",
66
+ snippet:
67
+ "Startup dropped from 180ms to 22ms, shaving seconds off every developer command invocation.",
68
+ ageSeconds: 86400 * 27,
69
+ author: "Dana Whitfield",
70
+ },
71
+ ],
72
+ citations: [
73
+ {
74
+ url: "https://bun.sh/blog/bun-v1.2-benchmarks",
75
+ title: "Bun 1.2 Benchmarks",
76
+ citedText: "Bun serves roughly 2.5x the requests per second of Node.js",
77
+ },
78
+ ],
79
+ usage: {
80
+ inputTokens: 312,
81
+ outputTokens: 248,
82
+ totalTokens: 560,
83
+ searchRequests: 2,
84
+ },
85
+ },
86
+ },
87
+ },
88
+ errorResult: {
89
+ isError: true,
90
+ content: [{ type: "text", text: "Web search failed: provider returned HTTP 429 (rate limited)." }],
91
+ details: {
92
+ response: {
93
+ provider: "perplexity",
94
+ sources: [],
95
+ },
96
+ error: "Provider returned HTTP 429 (rate limited). Retry after 30s.",
97
+ },
98
+ },
99
+ },
100
+
101
+ browser: {
102
+ label: "Browser",
103
+ // Streaming: code body still arriving for a `run` action.
104
+ streamingArgs: {
105
+ action: "run",
106
+ name: "docs",
107
+ code: "const obs = await tab.observe();\n",
108
+ },
109
+ args: {
110
+ action: "run",
111
+ name: "docs",
112
+ code: [
113
+ "const obs = await tab.observe();",
114
+ "const heading = obs.elements.find(e => e.role === 'heading');",
115
+ "display({ url: obs.url, title: obs.title, headings: obs.elements.filter(e => e.role === 'heading').length });",
116
+ "return heading?.name ?? 'no heading found';",
117
+ ].join("\n"),
118
+ },
119
+ result: {
120
+ content: [
121
+ {
122
+ type: "text",
123
+ text: [
124
+ '{ url: "https://bun.sh/docs", title: "Bun Documentation", headings: 14 }',
125
+ '"Get started with Bun"',
126
+ ].join("\n"),
127
+ },
128
+ ],
129
+ details: {
130
+ action: "run",
131
+ name: "docs",
132
+ url: "https://bun.sh/docs",
133
+ browser: "headless",
134
+ viewport: { width: 1280, height: 800, deviceScaleFactor: 1 },
135
+ result: '"Get started with Bun"',
136
+ },
137
+ },
138
+ errorResult: {
139
+ isError: true,
140
+ content: [
141
+ {
142
+ type: "text",
143
+ text: [
144
+ "TimeoutError: waiting for selector `aria/Sign in` failed: timeout 30000ms exceeded",
145
+ " at Tab.waitFor (browser/tab.ts:212:13)",
146
+ " at run (eval:3:7)",
147
+ ].join("\n"),
148
+ },
149
+ ],
150
+ details: {
151
+ action: "run",
152
+ name: "docs",
153
+ url: "https://bun.sh/docs",
154
+ browser: "headless",
155
+ },
156
+ },
157
+ },
158
+ };