@ridit/lens 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.
@@ -1,5 +1,5 @@
1
1
  export const FEW_SHOT_MESSAGES: { role: string; content: string }[] = [
2
- // ── create new file directly (no read first) ──────────────────────────────
2
+ // ── create new file directly ──────────────────────────────────────────────
3
3
  {
4
4
  role: "user",
5
5
  content: "this codebase doesn't have a readme",
@@ -7,7 +7,7 @@ export const FEW_SHOT_MESSAGES: { role: string; content: string }[] = [
7
7
  {
8
8
  role: "assistant",
9
9
  content:
10
- '<write-file>\n{"path": "README.md", "content": "# Project\\n\\nA brief description of what this project does.\\n\\n## Getting Started\\n\\n```bash\\nbun install\\nbun run dev\\n```"}\n</write-file>',
10
+ '<write-file>\n{"path": "README.md", "content": "# Project\\n\\nA brief description.\\n\\n## Getting Started\\n\\n```bash\\nbun install\\nbun run dev\\n```"}\n</write-file>',
11
11
  },
12
12
  {
13
13
  role: "user",
@@ -19,207 +19,149 @@ export const FEW_SHOT_MESSAGES: { role: string; content: string }[] = [
19
19
  content: "Done — README.md has been created.",
20
20
  },
21
21
 
22
- // ── expand existing file (read first, then write) ─────────────────────────
22
+ // ── fix a single file (read once, write once, done) ───────────────────────
23
23
  {
24
24
  role: "user",
25
- content: "add more information to the README",
25
+ content: "fix the bug in addons/clean-cache.js",
26
26
  },
27
27
  {
28
28
  role: "assistant",
29
- content: "<read-file>README.md</read-file>",
29
+ content: "<read-file>addons/clean-cache.js</read-file>",
30
30
  },
31
31
  {
32
32
  role: "user",
33
33
  content:
34
- "Here is the output from read-file of README.md:\n\nFile: README.md (10 lines)\n\n# Project\n\nA brief description.\n\n## Getting Started\n\n```bash\nbun install\n```\n\nPlease continue your response based on this output.",
34
+ 'Here is the output from read-file of addons/clean-cache.js:\n\nFile: addons/clean-cache.js (42 lines)\n\nconst { defineTool } = require("@ridit/lens-sdk");\ndefineTool({ name: "clean-cache", execute: async (_, ctx) => { const { shell } = ctx.tools; await shell("rm -rf node_modules"); } });\n\nPlease continue your response based on this output.',
35
35
  },
36
36
  {
37
37
  role: "assistant",
38
38
  content:
39
- '<write-file>\n{"path": "README.md", "content": "# Project\\n\\nA brief description.\\n\\n## Getting Started\\n\\n```bash\\nbun install\\nbun run dev\\n```\\n\\n## Features\\n\\n- Feature one\\n- Feature two\\n\\n## Contributing\\n\\nPull requests welcome."}\n</write-file>',
39
+ '<write-file>\n{"path": "addons/clean-cache.js", "content": "const { defineTool } = require(\\"@ridit/lens-sdk\\");\\nconst { execSync } = require(\\"child_process\\");\\n\\ndefineTool({\\n name: \\"clean-cache\\",\\n description: \\"Clean node_modules and bun cache\\",\\n safe: false,\\n permissionLabel: \\"Clean cache\\",\\n systemPromptEntry: () => \\"<clean-cache>{}</clean-cache> — clean node_modules and bun cache\\",\\n parseInput: () => ({}),\\n summariseInput: () => \\"clean cache\\",\\n execute: async (_, ctx) => {\\n try {\\n execSync(\\"rm -rf node_modules\\", { cwd: ctx.repoPath, stdio: \\"pipe\\" });\\n return { kind: \\"text\\", value: \\"Cache cleaned!\\" };\\n } catch (err) {\\n return { kind: \\"error\\", value: err.message };\\n }\\n },\\n});"}\n</write-file>',
40
40
  },
41
41
  {
42
42
  role: "user",
43
43
  content:
44
- "Here is the output from write-file to README.md:\n\nWritten: /repo/README.md (20 lines, 280 bytes)\n\nPlease continue your response based on this output.",
44
+ "Here is the output from write-file to addons/clean-cache.js:\n\nWritten: /repo/addons/clean-cache.js (20 lines, 480 bytes)\n\nPlease continue your response based on this output.",
45
45
  },
46
46
  {
47
47
  role: "assistant",
48
- content: "Done — README.md updated with more detail.",
48
+ content:
49
+ "Done — clean-cache.js fixed. Now uses execSync instead of ctx.tools.shell.",
49
50
  },
50
51
 
51
- // ── update an existing file ───────────────────────────────────────────────
52
+ // ── modify existing file (read first, then write) ─────────────────────────
52
53
  {
53
54
  role: "user",
54
- content: "update LENS.md",
55
+ content: "add a logout button to src/components/Header.tsx",
55
56
  },
56
57
  {
57
58
  role: "assistant",
58
- content: "<read-file>LENS.md</read-file>",
59
+ content: "<read-file>src/components/Header.tsx</read-file>",
59
60
  },
60
61
  {
61
62
  role: "user",
62
63
  content:
63
- "Here is the output from read-file of LENS.md:\n\nFile: LENS.md (33 lines)\n\n# Lens Analysis\n\n## Overview\nA CLI tool for codebase analysis.\n\n## Important Folders\n- src/components\n- src/utils\n\n## Suggestions\n- Add tests\n\nPlease continue your response based on this output.",
64
+ "Here is the output from read-file of src/components/Header.tsx:\n\nFile: src/components/Header.tsx (42 lines)\n\nimport React from 'react';\n// ... existing content ...\n\nPlease continue your response based on this output.",
64
65
  },
65
66
  {
66
67
  role: "assistant",
67
68
  content:
68
- '<write-file>\n{"path": "LENS.md", "content": "# Lens Analysis\\n\\n## Overview\\nA CLI tool for AI-powered codebase analysis, built with React and Ink.\\n\\n## Important Folders\\n- src/components — UI components rendered in the terminal\\n- src/utils — tools, chat, memory, and registry utilities\\n\\n## Suggestions\\n- Add tests\\n- Add more providers\\n- Improve error handling"}\n</write-file>',
69
+ '<changes>\n{"summary": "Add logout button to Header preserves all existing content", "patches": [{"path": "src/components/Header.tsx", "content": "// complete file with logout button added", "isNew": false}]}\n</changes>',
69
70
  },
70
71
  {
71
72
  role: "user",
72
73
  content:
73
- "Here is the output from write-file to LENS.md:\n\nWritten: /repo/LENS.md (15 lines, 420 bytes)\n\nPlease continue your response based on this output.",
74
+ "Here is the output from changes:\n\nChanges applied.\n\nPlease continue your response based on this output.",
74
75
  },
75
76
  {
76
77
  role: "assistant",
77
- content: "Done — LENS.md updated.",
78
+ content: "Done — logout button added to Header.tsx.",
78
79
  },
79
80
 
80
- // ── write a new doc file directly ─────────────────────────────────────────
81
+ // ── fix multiple files (read-files first, write each once) ────────────────
81
82
  {
82
83
  role: "user",
83
- content: "write a contributing guide",
84
+ content: "fix addons/a.js, addons/b.js and addons/c.js",
84
85
  },
85
86
  {
86
87
  role: "assistant",
87
88
  content:
88
- '<write-file>\n{"path": "CONTRIBUTING.md", "content": "# Contributing\\n\\nPull requests welcome. Please open an issue first to discuss major changes."}\n</write-file>',
89
+ '<read-files>\n["addons/a.js", "addons/b.js", "addons/c.js"]\n</read-files>',
89
90
  },
90
91
  {
91
92
  role: "user",
92
93
  content:
93
- "Here is the output from write-file to CONTRIBUTING.md:\n\nWritten: /repo/CONTRIBUTING.md (4 lines, 96 bytes)\n\nPlease continue your response based on this output.",
94
+ "Here is the output from read-files:\n\n=== addons/a.js ===\nmodule.exports = { name: 'a', run: async () => {} }\n\n=== addons/b.js ===\nmodule.exports = { name: 'b', run: async () => {} }\n\n=== addons/c.js ===\nmodule.exports = { name: 'c', run: async () => {} }\n\nPlease continue your response based on this output.",
94
95
  },
95
96
  {
96
97
  role: "assistant",
97
- content: "Done — CONTRIBUTING.md has been written.",
98
+ content:
99
+ '<write-file>\n{"path": "addons/a.js", "content": "const { defineTool } = require(\\"@ridit/lens-sdk\\");\\n\\ndefineTool({\\n name: \\"a\\",\\n description: \\"Does A\\",\\n safe: true,\\n permissionLabel: \\"Run A\\",\\n systemPromptEntry: () => \\"<a>{}</a> — run A\\",\\n parseInput: () => ({}),\\n summariseInput: () => \\"a\\",\\n execute: async (_, ctx) => ({ kind: \\"text\\", value: \\"A done!\\" }),\\n});"}\n</write-file>',
98
100
  },
99
-
100
- // ── scaffolding a project ─────────────────────────────────────────────────
101
101
  {
102
102
  role: "user",
103
103
  content:
104
- "scaffold a new project called myapp with package.json and src/index.tsx",
104
+ "Here is the output from write-file to addons/a.js:\n\nWritten: /repo/addons/a.js (12 lines, 280 bytes)\n\nPlease continue your response based on this output.",
105
105
  },
106
106
  {
107
107
  role: "assistant",
108
108
  content:
109
- '<write-file>\n{"path": "myapp/package.json", "content": "{\\n \\"name\\": \\"myapp\\",\\n \\"version\\": \\"1.0.0\\",\\n \\"scripts\\": { \\"dev\\": \\"bun run src/index.tsx\\" },\\n \\"dependencies\\": { \\"react\\": \\"^18.2.0\\", \\"ink\\": \\"^4.4.1\\" },\\n \\"devDependencies\\": { \\"@types/react\\": \\"^18.2.0\\" }\\n}"}\n</write-file>',
109
+ '<write-file>\n{"path": "addons/b.js", "content": "const { defineTool } = require(\\"@ridit/lens-sdk\\");\\n\\ndefineTool({\\n name: \\"b\\",\\n description: \\"Does B\\",\\n safe: true,\\n permissionLabel: \\"Run B\\",\\n systemPromptEntry: () => \\"<b>{}</b> run B\\",\\n parseInput: () => ({}),\\n summariseInput: () => \\"b\\",\\n execute: async (_, ctx) => ({ kind: \\"text\\", value: \\"B done!\\" }),\\n});"}\n</write-file>',
110
110
  },
111
111
  {
112
112
  role: "user",
113
113
  content:
114
- "Here is the output from write-file to myapp/package.json:\n\nWritten: /repo/myapp/package.json (10 lines, 220 bytes)\n\nPlease continue your response based on this output.",
114
+ "Here is the output from write-file to addons/b.js:\n\nWritten: /repo/addons/b.js (12 lines, 280 bytes)\n\nPlease continue your response based on this output.",
115
115
  },
116
116
  {
117
117
  role: "assistant",
118
118
  content:
119
- '<write-file>\n{"path": "myapp/src/index.tsx", "content": "/** @jsxImportSource react */\\nimport React from \'react\';\\nimport { render, Text } from \'ink\';\\n\\nfunction App() {\\n return <Text>Hello from myapp!</Text>;\\n}\\n\\nrender(<App />);"}\n</write-file>',
119
+ '<write-file>\n{"path": "addons/c.js", "content": "const { defineTool } = require(\\"@ridit/lens-sdk\\");\\n\\ndefineTool({\\n name: \\"c\\",\\n description: \\"Does C\\",\\n safe: true,\\n permissionLabel: \\"Run C\\",\\n systemPromptEntry: () => \\"<c>{}</c> run C\\",\\n parseInput: () => ({}),\\n summariseInput: () => \\"c\\",\\n execute: async (_, ctx) => ({ kind: \\"text\\", value: \\"C done!\\" }),\\n});"}\n</write-file>',
120
120
  },
121
121
  {
122
122
  role: "user",
123
123
  content:
124
- "Here is the output from write-file to myapp/src/index.tsx:\n\nWritten: /repo/myapp/src/index.tsx (9 lines, 210 bytes)\n\nPlease continue your response based on this output.",
124
+ "Here is the output from write-file to addons/c.js:\n\nWritten: /repo/addons/c.js (12 lines, 280 bytes)\n\nPlease continue your response based on this output.",
125
125
  },
126
126
  {
127
127
  role: "assistant",
128
128
  content:
129
- "Done — scaffolded myapp/package.json and myapp/src/index.tsx. Run `cd myapp && bun install` to get started.",
129
+ "Done — fixed all three addons. Each now uses defineTool from @ridit/lens-sdk correctly.",
130
130
  },
131
131
 
132
- // ── delete / open / pdf ───────────────────────────────────────────────────
133
- {
134
- role: "user",
135
- content: "delete src/old-component.tsx",
136
- },
137
- {
138
- role: "assistant",
139
- content: "<delete-file>src/old-component.tsx</delete-file>",
140
- },
132
+ // ── scaffold a project ────────────────────────────────────────────────────
141
133
  {
142
134
  role: "user",
143
135
  content:
144
- "Here is the output from delete-file of src/old-component.tsx:\n\nDeleted: /repo/src/old-component.tsx\n\nPlease continue your response based on this output.",
145
- },
146
- {
147
- role: "assistant",
148
- content: "Done — src/old-component.tsx has been deleted.",
149
- },
150
- {
151
- role: "user",
152
- content: "delete the legacy folder",
153
- },
154
- {
155
- role: "assistant",
156
- content: "<delete-folder>src/legacy</delete-folder>",
157
- },
158
- {
159
- role: "user",
160
- content:
161
- "Here is the output from delete-folder of src/legacy:\n\nDeleted folder: /repo/src/legacy\n\nPlease continue your response based on this output.",
162
- },
163
- {
164
- role: "assistant",
165
- content: "Done — src/legacy and all its contents have been deleted.",
166
- },
167
- {
168
- role: "user",
169
- content: "open https://github.com/microsoft/typescript",
136
+ "scaffold a new project called myapp with package.json and src/index.tsx",
170
137
  },
171
138
  {
172
139
  role: "assistant",
173
- content: "<open-url>https://github.com/microsoft/typescript</open-url>",
174
- },
175
- {
176
- role: "user",
177
140
  content:
178
- "Here is the output from open-url https://github.com/microsoft/typescript:\n\nOpened: https://github.com/microsoft/typescript\n\nPlease continue your response based on this output.",
179
- },
180
- {
181
- role: "assistant",
182
- content: "Opened the TypeScript GitHub page in your browser.",
141
+ '<write-file>\n{"path": "myapp/package.json", "content": "{\\n \\"name\\": \\"myapp\\",\\n \\"version\\": \\"1.0.0\\",\\n \\"scripts\\": { \\"dev\\": \\"bun run src/index.tsx\\" },\\n \\"dependencies\\": { \\"react\\": \\"^18.2.0\\", \\"ink\\": \\"^4.4.1\\" }\\n}"}\n</write-file>',
183
142
  },
184
143
  {
185
144
  role: "user",
186
145
  content:
187
- "generate a PDF report about the project and save it to docs/report.pdf",
146
+ "Here is the output from write-file to myapp/package.json:\n\nWritten: /repo/myapp/package.json (8 lines, 180 bytes)\n\nPlease continue your response based on this output.",
188
147
  },
189
148
  {
190
149
  role: "assistant",
191
150
  content:
192
- '<generate-pdf>\n{"path": "docs/report.pdf", "content": "# Project Report\\n\\n## Overview\\n\\nThis document summarizes the project.\\n\\n## Details\\n\\nMore content here."}\n</generate-pdf>',
151
+ '<write-file>\n{"path": "myapp/src/index.tsx", "content": "/** @jsxImportSource react */\\nimport React from \'react\';\\nimport { render, Text } from \'ink\';\\n\\nfunction App() {\\n return <Text>Hello from myapp!</Text>;\\n}\\n\\nrender(<App />);"}\n</write-file>',
193
152
  },
194
153
  {
195
154
  role: "user",
196
155
  content:
197
- "Here is the output from generate-pdf to docs/report.pdf:\n\nPDF generated: /repo/docs/report.pdf\n\nPlease continue your response based on this output.",
156
+ "Here is the output from write-file to myapp/src/index.tsx:\n\nWritten: /repo/myapp/src/index.tsx (9 lines, 210 bytes)\n\nPlease continue your response based on this output.",
198
157
  },
199
158
  {
200
159
  role: "assistant",
201
- content: "Done — docs/report.pdf has been generated.",
160
+ content:
161
+ "Done — scaffolded myapp/package.json and myapp/src/index.tsx. Run cd myapp && bun install to get started.",
202
162
  },
203
163
 
204
164
  // ── grep ──────────────────────────────────────────────────────────────────
205
- {
206
- role: "user",
207
- content: 'grep -R "ChatRunner" -n src',
208
- },
209
- {
210
- role: "assistant",
211
- content: '<grep>\n{"pattern": "ChatRunner", "glob": "src/**/*"}\n</grep>',
212
- },
213
- {
214
- role: "user",
215
- content:
216
- 'Here is the output from grep for "ChatRunner":\n\ngrep /ChatRunner/ src/**/* — 3 match(es) in 2 file(s)\n\nsrc/index.tsx\n 12: import { ChatRunner } from "./components/chat/ChatRunner";\n\nsrc/components/chat/ChatRunner.tsx\n 1: export const ChatRunner = ...\n\nPlease continue your response based on this output.',
217
- },
218
- {
219
- role: "assistant",
220
- content:
221
- "ChatRunner is defined in src/components/chat/ChatRunner.tsx and imported in src/index.tsx.",
222
- },
223
165
  {
224
166
  role: "user",
225
167
  content: "find all usages of useInput in the codebase",
@@ -239,160 +181,6 @@ export const FEW_SHOT_MESSAGES: { role: string; content: string }[] = [
239
181
  "useInput is used in src/components/chat/ChatRunner.tsx — imported on line 5 and called on line 210.",
240
182
  },
241
183
 
242
- // ── showing tool usage as an example (bracket notation, NOT real tags) ────
243
- {
244
- role: "user",
245
- content: "show me how to use the read-file tool",
246
- },
247
- {
248
- role: "assistant",
249
- content:
250
- "To read a file, emit the tag alone in your response — nothing else on that turn:\n\n```text\n[read-file]src/components/Header.tsx[/read-file]\n```\n\nThe result comes back as the next user message and you can then analyze it.",
251
- },
252
- {
253
- role: "user",
254
- content: "show me an example of the shell tool",
255
- },
256
- {
257
- role: "assistant",
258
- content:
259
- "To run a shell command, emit only the tag:\n\n```text\n[shell]node -v[/shell]\n```\n\nThe stdout/stderr is returned and you can read it in the next turn.",
260
- },
261
-
262
- // ── read-folder ───────────────────────────────────────────────────────────
263
- {
264
- role: "user",
265
- content: "read src folder",
266
- },
267
- {
268
- role: "assistant",
269
- content: "<read-folder>src</read-folder>",
270
- },
271
- {
272
- role: "user",
273
- content:
274
- "Here is the output from read-folder of src:\n\nFolder: src (4 entries)\n\nFiles:\n index.ts\n App.tsx\n\nSubfolders:\n components/\n utils/\n\nPlease continue your response based on this output.",
275
- },
276
- {
277
- role: "assistant",
278
- content:
279
- "The src folder contains index.ts, App.tsx, plus subfolders components/ and utils/.",
280
- },
281
- {
282
- role: "user",
283
- content: "what files are in src/components?",
284
- },
285
- {
286
- role: "assistant",
287
- content: "<read-folder>src/components</read-folder>",
288
- },
289
- {
290
- role: "user",
291
- content:
292
- "Here is the output from read-folder of src/components:\n\nFolder: src/components (5 entries)\n\nFiles:\n Header.tsx\n Footer.tsx\n Button.tsx\n\nSubfolders:\n ui/\n forms/\n\nPlease continue your response based on this output.",
293
- },
294
- {
295
- role: "assistant",
296
- content:
297
- "src/components has 3 files — Header.tsx, Footer.tsx, Button.tsx — plus two subfolders: ui/ and forms/.",
298
- },
299
- {
300
- role: "user",
301
- content: "show me the project structure",
302
- },
303
- {
304
- role: "assistant",
305
- content: "<read-folder>.</read-folder>",
306
- },
307
- {
308
- role: "user",
309
- content:
310
- "Here is the output from read-folder of .:\n\nFolder: . (5 entries)\n\nFiles:\n package.json\n tsconfig.json\n README.md\n\nSubfolders:\n src/\n node_modules/\n\nPlease continue your response based on this output.",
311
- },
312
- {
313
- role: "assistant",
314
- content:
315
- "The project root has package.json, tsconfig.json, README.md and the src/ folder for source code.",
316
- },
317
-
318
- // ── fetch → write → done ──────────────────────────────────────────────────
319
- {
320
- role: "user",
321
- content: "fetch https://api.github.com/repos/microsoft/typescript",
322
- },
323
- {
324
- role: "assistant",
325
- content: "<fetch>https://api.github.com/repos/microsoft/typescript</fetch>",
326
- },
327
- {
328
- role: "user",
329
- content:
330
- 'Here is the output from fetch of https://api.github.com/repos/microsoft/typescript:\n\n{"name":"TypeScript","stargazers_count":100000}\n\nPlease continue your response based on this output.',
331
- },
332
- {
333
- role: "assistant",
334
- content:
335
- "Found 1 object with fields: name, stargazers_count. Writing to ts-info.json now.",
336
- },
337
- {
338
- role: "user",
339
- content: "ok go ahead",
340
- },
341
- {
342
- role: "assistant",
343
- content:
344
- '<write-file>\n{"path": "ts-info.json", "content": "{\"name\":\"TypeScript\",\"stars\":100000}"}\n</write-file>',
345
- },
346
- {
347
- role: "user",
348
- content:
349
- "Here is the output from write-file to ts-info.json:\n\nWritten: /repo/ts-info.json (1 lines, 44 bytes)\n\nPlease continue your response based on this output.",
350
- },
351
- {
352
- role: "assistant",
353
- content: "Done — ts-info.json has been saved.",
354
- },
355
-
356
- // ── write it to a file → done ─────────────────────────────────────────────
357
- {
358
- role: "user",
359
- content: "write it to a file called hello.py",
360
- },
361
- {
362
- role: "assistant",
363
- content:
364
- '<write-file>\n{"path": "hello.py", "content": "# hello.py\\nprint(\'hello\')"}\n</write-file>',
365
- },
366
- {
367
- role: "user",
368
- content:
369
- "Here is the output from write-file to hello.py:\n\nWritten: /repo/hello.py (2 lines, 32 bytes)\n\nPlease continue your response based on this output.",
370
- },
371
- {
372
- role: "assistant",
373
- content: "Done — hello.py has been written.",
374
- },
375
-
376
- // ── read before write (modifying existing file only) ─────────────────────
377
- {
378
- role: "user",
379
- content: "add a logout button to src/components/Header.tsx",
380
- },
381
- {
382
- role: "assistant",
383
- content: "<read-file>src/components/Header.tsx</read-file>",
384
- },
385
- {
386
- role: "user",
387
- content:
388
- "Here is the output from read-file of src/components/Header.tsx:\n\nFile: src/components/Header.tsx (42 lines)\n\nimport React from 'react';\n// ... full file content ...\n\nPlease continue your response based on this output.",
389
- },
390
- {
391
- role: "assistant",
392
- content:
393
- '<changes>\n{"summary": "Add logout button to Header — preserves all existing nav items and imports", "patches": [{"path": "src/components/Header.tsx", "content": "// complete file with logout button added", "isNew": false}]}\n</changes>',
394
- },
395
-
396
184
  // ── shell ─────────────────────────────────────────────────────────────────
397
185
  {
398
186
  role: "user",
@@ -409,66 +197,38 @@ export const FEW_SHOT_MESSAGES: { role: string; content: string }[] = [
409
197
  },
410
198
  {
411
199
  role: "assistant",
412
- content: "You're running Node.js v20.11.0.",
200
+ content: "You're on Node.js v20.11.0.",
413
201
  },
414
202
 
415
- // ── clone ─────────────────────────────────────────────────────────────────
416
- {
417
- role: "user",
418
- content: "clone https://github.com/facebook/react",
419
- },
420
- {
421
- role: "assistant",
422
- content: "<clone>https://github.com/facebook/react</clone>",
423
- },
203
+ // ── memory ────────────────────────────────────────────────────────────────
424
204
  {
425
205
  role: "user",
426
- content:
427
- "Cloned react to /tmp/react — 2847 files available. You can now read files from this repo using read-file with paths relative to /tmp/react.",
206
+ content: "remember that we always use bun in this project",
428
207
  },
429
208
  {
430
209
  role: "assistant",
431
210
  content:
432
- "Cloned! The React repo has 2847 files. I can read source files, explain how it works, or suggest improvements just ask.",
211
+ "<memory-add>Project uses bun as the package manager and runtime, not npm or node</memory-add>\n\nGot it I'll always use bun for this project.",
433
212
  },
434
213
 
435
- // ── search ────────────────────────────────────────────────────────────────
214
+ // ── addon format ──────────────────────────────────────────────────────────
436
215
  {
437
216
  role: "user",
438
- content: "what does the ?? operator do in typescript",
217
+ content: "add a new addon that prints hello world",
439
218
  },
440
219
  {
441
220
  role: "assistant",
442
- content: "<search>nullish coalescing operator ?? TypeScript</search>",
443
- },
444
- {
445
- role: "user",
446
221
  content:
447
- 'Here is the output from web search for "nullish coalescing operator ?? TypeScript":\n\nAnswer: The ?? operator returns the right-hand side when the left-hand side is null or undefined.\n\nPlease continue your response based on this output.',
222
+ '<write-file>\n{"path": "addons/hello-world.js", "content": "const { defineTool } = require(\\"@ridit/lens-sdk\\");\\n\\ndefineTool({\\n name: \\"hello-world\\",\\n description: \\"Prints hello world\\",\\n safe: true,\\n permissionLabel: \\"Print hello world\\",\\n systemPromptEntry: () => \\"<hello-world>{}</hello-world> print hello world\\",\\n parseInput: () => ({}),\\n summariseInput: () => \\"hello world\\",\\n execute: async (_, ctx) => ({ kind: \\"text\\", value: \\"Hello world!\\" }),\\n});"}\n</write-file>',
448
223
  },
449
- {
450
- role: "assistant",
451
- content:
452
- "The ?? operator is the nullish coalescing operator. It returns the right side only when the left side is null or undefined.",
453
- },
454
-
455
- // ── memory ────────────────────────────────────────────────────────────────
456
224
  {
457
225
  role: "user",
458
- content: "remember that we always use bun in this project",
459
- },
460
- {
461
- role: "assistant",
462
226
  content:
463
- "<memory-add>Project uses bun as the package manager and runtime, not npm or node</memory-add>\n\nGot it I'll always use bun for this project.",
464
- },
465
- {
466
- role: "user",
467
- content: "forget the bun preference",
227
+ "Here is the output from write-file to addons/hello-world.js:\n\nWritten: /repo/addons/hello-world.js (14 lines, 320 bytes)\n\nPlease continue your response based on this output.",
468
228
  },
469
229
  {
470
230
  role: "assistant",
471
231
  content:
472
- "<memory-delete>MEMORY_ID</memory-delete>\n\nDoneremoved that memory.",
232
+ "Doneaddons/hello-world.js created using defineTool from @ridit/lens-sdk.",
473
233
  },
474
234
  ];