tune-sdk 0.2.4 → 0.2.6

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 (82) hide show
  1. package/.github/workflows/publish.yml +27 -0
  2. package/README.md +4 -6
  3. package/dist/cli.js +8 -7
  4. package/dist/tune.js +6 -6
  5. package/docs/vscode.md +133 -0
  6. package/package.json +2 -5
  7. package/tools/README.md +0 -636
  8. package/tools/append.schema.json +0 -17
  9. package/tools/append.tool.mjs +0 -5
  10. package/tools/brave.schema.json +0 -13
  11. package/tools/brave.tool.mjs +0 -32
  12. package/tools/claude.txt +0 -1
  13. package/tools/clipboard.txt +0 -1
  14. package/tools/default.llm.js +0 -2
  15. package/tools/dev.txt +0 -6
  16. package/tools/echo.txt +0 -1
  17. package/tools/editor-filename.chat +0 -10
  18. package/tools/gemini-dev.txt +0 -7
  19. package/tools/gemini25.txt +0 -1
  20. package/tools/gemini_files.schema.json +0 -13
  21. package/tools/gemini_files.tool.mjs +0 -204
  22. package/tools/gemini_ocr.schema.json +0 -21
  23. package/tools/gemini_ocr.tool.mjs +0 -211
  24. package/tools/gemini_tts.schema.json +0 -59
  25. package/tools/gemini_tts.tool.mjs +0 -175
  26. package/tools/gemini_veo.schema.json +0 -12
  27. package/tools/gemini_veo.tool.mjs +0 -233
  28. package/tools/groq_whisper.schema.json +0 -48
  29. package/tools/groq_whisper.tool.mjs +0 -59
  30. package/tools/head.proc.js +0 -24
  31. package/tools/init.proc.js +0 -19
  32. package/tools/jina_r.schema.json +0 -21
  33. package/tools/jina_r.tool.mjs +0 -27
  34. package/tools/js.schema.json +0 -19
  35. package/tools/js.tool.mjs +0 -60
  36. package/tools/json_format.proc.mjs +0 -22
  37. package/tools/linenum.proc.js +0 -21
  38. package/tools/list.schema.json +0 -19
  39. package/tools/list.tool.mjs +0 -20
  40. package/tools/llm-utils.js +0 -150
  41. package/tools/log.proc.js +0 -15
  42. package/tools/mcp.proc.mjs +0 -174
  43. package/tools/message.schema.json +0 -21
  44. package/tools/message.tool.js +0 -14
  45. package/tools/mock.proc.js +0 -35
  46. package/tools/nu.schema.json +0 -13
  47. package/tools/nu.tool.mjs +0 -14
  48. package/tools/openai.js +0 -27
  49. package/tools/openai_imgen.schema.json +0 -35
  50. package/tools/openai_imgen.tool.mjs +0 -83
  51. package/tools/openai_stt.schema.json +0 -49
  52. package/tools/openai_stt.tool.mjs +0 -66
  53. package/tools/openai_tts.schema.json +0 -26
  54. package/tools/openai_tts.tool.mjs +0 -26
  55. package/tools/osa.schema.json +0 -13
  56. package/tools/osa.tool.mjs +0 -12
  57. package/tools/package.json +0 -7
  58. package/tools/patch.schema.json +0 -17
  59. package/tools/patch.tool.mjs +0 -38
  60. package/tools/prop.proc.mjs +0 -34
  61. package/tools/py.schema.json +0 -17
  62. package/tools/py.tool.py +0 -22
  63. package/tools/queryimage.schema.json +0 -17
  64. package/tools/queryimage.tool.chat +0 -4
  65. package/tools/resolve.proc.js +0 -10
  66. package/tools/rf.schema.json +0 -17
  67. package/tools/rf.tool.mjs +0 -21
  68. package/tools/schema.schema.json +0 -13
  69. package/tools/schema.tool.chat +0 -81
  70. package/tools/sh.schema.json +0 -13
  71. package/tools/sh.tool.mjs +0 -12
  72. package/tools/short.txt +0 -1
  73. package/tools/shp.proc.mjs +0 -31
  74. package/tools/slice.proc.js +0 -55
  75. package/tools/tail.proc.js +0 -35
  76. package/tools/text.proc.js +0 -13
  77. package/tools/turn.schema.json +0 -17
  78. package/tools/turn.tool.mjs +0 -8
  79. package/tools/wf.schema.json +0 -17
  80. package/tools/wf.tool.mjs +0 -16
  81. package/tools/yandex_tts.schema.json +0 -41
  82. package/tools/yandex_tts.tool.mjs +0 -31
package/tools/README.md DELETED
@@ -1,636 +0,0 @@
1
- ## Tools & Processors & Contexts
2
- This is a personal directory of [tools](https://iovdin.github.io/tune/template-language/tools) [processors](https://iovdin.github.io/tune/template-language/tools) and [contexts](https://iovdin.github.io/tune/template-language/context) and prompts.
3
-
4
- They're supposed to be forked/cloned, and changed.
5
- Set `TUNE_PATH` to the directory to make them available in tune editor extensions
6
-
7
- ##### Table of Contents
8
- - [Prompts](#prompts)
9
- - [LLMs](#llms)
10
- - [Tools](#tools)
11
- - [rf](#rf) read file
12
- - [wf](#wf) write file
13
- - [patch](#patch) patch file
14
- - [append](#append) append to file
15
- - [sh](#sh) execute shell command
16
- - [osa](#osa) manage reminder/notes/calendar etc. with applescript
17
- - [jina_r](#jina_r) read webpage content
18
- - [brave](#brave) web search
19
- - [openai_tts](#openai_tts) text to speech from openai
20
- - [gemini_tts](#gemini_tts) text to speech from gemini with single/multi-speaker support
21
- - [openai_imgen](#openai_imgen) generate and edit images with openai gpt-image model
22
- - [gemini_ocr](#gemini_ocr) ask question about file content (PDF/video/audio/image)
23
- - [turn](#turn) turn based agent
24
- - [list](#list) keep list of tasks todo (loops for llm)
25
- - [py](#py) run python code
26
- - [js](#js) run javascript code
27
- - [message](#message) talk to another chat/agent
28
- - [Processors](#processors)
29
- - [shp](#shp) include shell command output
30
- - [init](#init) set initial value
31
- - [mcp](#mcp) connect mcp tools
32
- - [json_format](#json_format) make llm respond with json
33
- - [log](#log) save llm payload
34
- - [mock](#mock) set variables inline
35
- - [linenum](#linenum) prepend line numbers
36
- - [text](#text) convert any variable to text variable
37
- - [resolve](#resolve) resolve a variable
38
- - [prop](#prop) set additional properties of llm
39
- - [head](#head) take first N lines of a file
40
- - [tail](#tail) take last N lines of a file or llm payload
41
- - [slice](#slice) take lines from <start> to <finish> of a file
42
-
43
-
44
- ## Prompts
45
- * `short.txt` - for short answers
46
- * `echo.txt` - to debug variable expansions and context
47
- * `dev.txt` - developer copilot prompt with claude 3.7
48
- * `gemini-dev.txt` - developer copilot use gemini-2.5-pro with
49
- * `clipboard.txt` - @@clipboard - insert content of clipboard (mac osx)
50
-
51
- ## LLMs
52
- Contexts: `openai.ctx.js`, `anthropic.ctx.js` `openrouter.ctx.js`, `mistral.ctx.js`, `groq.ctx.js`, `gemini.ctx.js`.
53
- Put together in `default.ctx.js`.
54
-
55
- Download model list from the provider (saved in .cache directory), and then can be used by name in the `.chat` files.
56
- ```chat
57
- system:
58
- @gpt-4o - uses openai.ctx.js
59
- @anthropic/claude-3.7-sonnet - uses openrouter.ctx.js
60
- @mistral-small-latest - get model using mistral.ctx.js
61
- @qwen-qwq-32b - uses groq.ctx.js
62
- @gemini-2.0-flash will use gemini.ctx.js
63
- @claude-3-7-sonnet-20250219 will use antrophic.ctx.js
64
- ```
65
- To connect a model there has to be OPENAI_KEY or OPENROUTER_KEY or MISTRAL_KEY or GROQ_KEY or GEMINI_KEY in the environment or in `.env` file
66
-
67
-
68
- `default.llm.js` - which model is called by default (i.e. without connecting @llm)
69
-
70
- ## Tools
71
- [Tools](https://iovdin.github.io/tune/template-language/tools) is a function that llm can run on your local machine or server
72
-
73
- ### `rf`
74
- Read file
75
- ```chat
76
- user: @rf
77
- can you read README.md?
78
- tool_call: rf {"filename":"README.md"}
79
- tool_result:
80
- @README.md
81
- ```
82
- It takes optional `linenum` parameter so that file is included with line numbers - useful for patching
83
-
84
- ### `wf`
85
- Write to a file
86
- ```chat
87
- user: @wf
88
- make a hello world javascript
89
- tool_call: wf {"filename":"helloWorld.js"}
90
- console.log('Hello, World!');
91
- tool_result:
92
- written
93
- ```
94
-
95
- ### `patch`
96
- ```chat
97
- user: @patch
98
- translate "hello world" in helloWorld.js to dutch
99
- tool_call: patch {"filename":"helloWorld.js"}
100
- <<<<<<< ORIGINAL
101
- console.log('Hello, World!');
102
- =======
103
- console.log('Hallo, Wereld!');
104
- >>>>>>> UPDATED
105
- tool_result:
106
- patched
107
- ```
108
-
109
-
110
- ### `append`
111
- ```chat
112
- user: @append
113
- Add a todo that i want to buy a car and go to the moon
114
- tool_call: append {"filename":"todo.md"}
115
- - buy a car
116
- - fly to the moon
117
- tool_result:
118
- appended
119
- ```
120
-
121
- ### `sh`
122
- Execute shell command
123
- ```chat
124
- user: @sh
125
- find with ripgrep where echo is used
126
- tool_call: sh
127
- rg 'echo' ./
128
- tool_result:
129
- ./README.md: echo: "You are echo, you print everything back",
130
- ./README.md: const text = "s: \@echo\nu: hello world";
131
- ./tools/echo.txt:you are echo, you print everything back
132
- ./tools/README.md:* `echo.txt` - to debug variable expansions and context
133
- ```
134
-
135
- ### `osa`
136
- AppleScript tool, manage reminders, notes, calendar etc on osx
137
- ```chat
138
- system: @osa @gpt-4.1
139
- you're personal assistant with access to osx apps
140
- like reminder, calendar etc
141
-
142
- user:
143
- can you remind me in 2 hours that i have meeting with jack
144
-
145
- assistant:
146
-
147
- tool_call: osa
148
- tell application "Reminders" to make new reminder with properties {name:"Meeting with Jack", remind me date:(current date) + 2 * hours}
149
- tool_result:
150
- reminder id x-apple-reminder://849EA642-B7E0-4E16-94AA-B50FF1BC282D
151
- ```
152
-
153
- ### `jina_r`
154
- Fetch webpage content with [jina reader](https://jina.ai/reader) api.
155
- It works without a key to some limit. Put `JINA_KEY` into `.env` for higher rate limits
156
-
157
- ```chat
158
- user: @jina_r
159
- take https://iovdin.github.io/tune/ page content
160
- and put it into `home` directory
161
- then make short summary
162
-
163
- tool_call: jina_r {"url":"https://iovdin.github.io/tune/","filename":"home/tune_page_content.md"}
164
-
165
- tool_result:
166
- @home/tune_page_content.md
167
-
168
- assistant:
169
- The content from the "Tune" page has been successfully retrieved and saved into the `home/tune_page_content.md` file. Below is a short summary of the page:
170
-
171
- ---
172
-
173
- **Summary of Tune - Your Everyday LLM Toolkit:**
174
-
175
- Tune is a versatile toolkit designed for developers and users to effectively interact with Large Language Models (LLMs). It allows users to chat with AI, build applications, and create AI agents in a simple manner.
176
- <cut for brevity>
177
- ```
178
-
179
- ### `brave`
180
- Use [brave web search api](https://brave.com/search/api/). It requires `BRAVE_KEY` in your `.env`
181
-
182
- ```chat
183
- system:
184
- @brave
185
- today is @{| shp date }
186
-
187
- user:
188
- what are the latest trumps tariffs?
189
-
190
- tool_call: brave
191
- latest Trump tariffs 2025
192
-
193
- tool_result:
194
- Trump tariffs fallout: China retaliates, Vietnam talks, U.S. markets melt down
195
- https://www.cnbc.com/2025/04/04/trump-tariff-live-updates-retaliation-trade-war.html
196
- U.S. President Donald <strong>Trump</strong> pumps ... April 3, <strong>2025</strong>. Miami Herald | Tribune News Service | Getty Images · <strong>Trump</strong> touted a better-than-expected March jobs report as proof of the strength of his agenda. &quot;GREAT JOB NUMBERS, FAR BETTER THAN EXPECTED. IT&#x27;S ALREADY WORKING. HANG TOUGH, WE CAN&#x27;T LOSE!!!&quot; he wrote on Truth Social. The <strong>latest</strong> nonfarm payrolls report from the Bureau of Labor Statistics covers the month ending mid-March — before <strong>Trump</strong>&#x27;<strong>s</strong> <strong>latest</strong> <strong>tariff</strong> ...
197
-
198
- Trump Tariffs: The Economic Impact of the Trump Trade War
199
- https://taxfoundation.org/research/all/federal/trump-tariffs-trade-war/
200
- As of April 4, China, Canada, and ... April 4 will reduce US GDP by another 0.1 percent. In 2025, the Trump tariffs will <strong>increase federal tax revenues by $258.4 billion, or 0.85 percent of GDP</strong>, making the tariffs the largest tax hike since 1982....
201
-
202
- Trump tariffs: Visualising new US trade restrictions | World Economic Forum
203
- https://www.weforum.org/stories/2025/02/trump-tariffs-visualising-new-us-trade-restrictions/
204
- For a better visual understanding ... On 2 April, the Trump administration unveiled a new tariff regime that applies a <strong>baseline additional tariff of 10% on US imports from all countries</strong>....
205
- <cut for brevity>
206
- ```
207
-
208
- ### `openai_tts`
209
- use openai [speech generation api](https://platform.openai.com/docs/guides/text-to-speech)
210
-
211
- ```chat
212
- user: @openai_tts
213
- Read out in the style of Arnold Schwarzenegger:
214
- Hasta la vista, baby!
215
-
216
- tool_call: openai_tts {"voice":"fable","filename":"hasta_la_vista_baby.mp3","instructions":"Voice: Deep, powerful, and energetic, with a strong Austrian accent that is unmistakable. Punctuation: Pronounced with emphatic pauses for dramatic effect. Delivery: Confident and assertive, with a clear and impactful enunciation. Phrasing: Bold and straightforward, using a commanding tone that captures attention. Tone: Iconic and motivating, embodying a legendary action hero."}
217
- Hasta la vista, baby!
218
-
219
- tool_result:
220
- speech generated
221
- ```
222
-
223
- ### `gemini_tts`
224
- Use Gemini's [text-to-speech API](https://ai.google.dev/gemini-api/docs/speech-generation) with support for both single-speaker and multi-speaker audio generation.
225
-
226
- **Single-speaker example:**
227
- ```chat
228
- user: @gemini_tts
229
- Say in a cheerful voice: "Welcome to our podcast!"
230
-
231
- tool_call: gemini_tts {"voice":"Puck","filename":"welcome.wav"}
232
- Say cheerfully: Welcome to our podcast!
233
- tool_result:
234
- Speech generated successfully and saved to welcome.wav
235
- ```
236
-
237
- **Multi-speaker dialogue example:**
238
- ```chat
239
- user: @gemini_tts
240
- Create a conversation between Alice and Bob discussing AI
241
-
242
- tool_call: gemini_tts {"speakers":[{"name":"Alice","voice":"Aoede"},{"name":"Bob","voice":"Charon"}],"filename":"ai_discussion.wav"}
243
- TTS the following conversation between Alice and Bob: Alice: What do you think about artificial intelligence? Bob: I think it's fascinating! It's changing how we work and live. Alice: I agree, but we need to be careful about the implications.
244
- tool_result:
245
- Speech generated successfully and saved to ai_discussion.wav
246
- ```
247
-
248
- **Styled speech example:**
249
- ```chat
250
- user: @gemini_tts
251
- Make it sound spooky and mysterious
252
-
253
- tool_call: gemini_tts {"voice":"Enceladus","filename":"spooky.wav"}
254
- Say in a spooky whisper: Something wicked this way comes...
255
- tool_result:
256
- Speech generated successfully and saved to spooky.wav
257
- ```
258
-
259
- ### `openai_imgen`
260
- use openai [image generation api](https://platform.openai.com/docs/guides/image-generation)
261
-
262
- ```chat
263
- user: @openai_imgen
264
- draw a stickman with talking bubble "Hello world"
265
-
266
- assistant:
267
- tool_call: openai_imgen {"filename":"stickman_hello_world.png"}
268
- a simple stickman drawing with a talking bubble saying 'Hello world'
269
-
270
- tool_result:
271
- image generated
272
-
273
- ```
274
-
275
-
276
- ### `gemini_ocr`
277
- Use gemini model to query all supported files (pdf/images/audio) [gemini api docs](https://ai.google.dev/gemini-api/docs/)
278
-
279
- ```chat
280
- user: @gemini_ocr
281
- can you transcribe hasta_la_vista_baby.mp3?
282
-
283
- tool_call: gemini_ocr {"filename":"hasta_la_vista_baby.mp3"}
284
- Transcribe audio
285
-
286
- tool_result:
287
- Hasta la vista, baby.
288
- ```
289
-
290
- ### `turn`
291
- A way to switch roles when building multistep agents [read more](https://iovdin.github.io/tune/examples/multi-agent)
292
- ```chat
293
- system: @turn @gpt-4o
294
- You're playing 20 questions game.
295
- You switch turns between 'thinker' and 'player' agent.
296
- Current agent stored in agent.txt file
297
- 'player' always plays first
298
-
299
- @@agent|init
300
- assistant:
301
- Is it a living thing?
302
-
303
- tool_call: turn {"role":"thinker","filename":"agent.txt"}
304
- tool_result: now it is turn of thinker to reply
305
-
306
- assistant:
307
- No.
308
-
309
- tool_call: turn {"role":"player","filename":"agent.txt"}
310
- tool_result: now it is turn of player to reply
311
-
312
- assistant:
313
- Is it something that can be used indoors?
314
-
315
- tool_call: turn {"role":"thinker","filename":"agent.txt"}
316
- tool_result: now it is turn of thinker to reply
317
-
318
- assistant:
319
- Yes.
320
-
321
- ...
322
- ```
323
-
324
- ### `list`
325
- Keep list of tasks to do
326
-
327
- ```chat
328
- system: @list
329
- You manage todo list in file todo.txt
330
-
331
- user:
332
- Today i need to refactor xyz
333
- and then release abc
334
-
335
- assistant:
336
-
337
- tool_call: list {"filename":"todo.txt"}
338
- todo - refactor xyz
339
- todo - release abc
340
-
341
- tool_result:
342
- list updated
343
-
344
- user:
345
- ok, i've finished refactoring xyz
346
-
347
- assistant:
348
-
349
- tool_call: list {"filename":"todo.txt"}
350
- done - refactor xyz
351
-
352
- tool_result:
353
- list updated
354
- ```
355
-
356
-
357
- ### `py`
358
- execute python code
359
- ```chat
360
- user: @py
361
- 1234 + 4311
362
-
363
- tool_call: py
364
- 1234 + 4311
365
-
366
- tool_result:
367
- 5545
368
- ```
369
-
370
- ### `js`
371
- execut javascript code
372
- ```chat
373
- user: @js
374
- 1234 + 4311
375
-
376
- tool_call: js {"inputType":"commonjs"}
377
- 1234 + 4311
378
-
379
- tool_result:
380
- 5545
381
-
382
- ```
383
-
384
- ### `message`
385
- Talk to another chat/agent via tool call.
386
- Orchestrate or evaulate other agents/chats.
387
- ```chat
388
- system:
389
- @message
390
- Your goal is to talk to Groot at `groot.prompt` system prompt
391
- and try to make him say anything but 'I am Groot'
392
-
393
- tool_call: message {"filename":"groot.chat","system":"groot.prompt"}
394
- Hello Groot! How are you feeling today?
395
-
396
- tool_result:
397
- I am Groot!
398
-
399
- tool_call: message {"filename":"groot.chat","system":"groot.prompt"}
400
- What do you think about trees?
401
-
402
- tool_result:
403
- I am Groot!
404
-
405
- tool_call: message {"filename":"groot.chat","system":"groot.prompt"}
406
- Can you tell me a joke?
407
-
408
- tool_result:
409
- Sure! Why did the tree go to the dentist?
410
-
411
- Because it had a root canal!
412
- ```
413
-
414
- The content of `groot.chat` is then:
415
- ```chat
416
- system: @@groot.prompt
417
- user:
418
- Hello Groot! How are you feeling today?
419
-
420
- assistant:
421
- I am Groot!
422
-
423
- user:
424
- What do you think about trees?
425
-
426
- assistant:
427
- I am Groot!
428
-
429
- user:
430
- Can you tell me a joke?
431
-
432
- assistant:
433
- Sure! Why did the tree go to the dentist?
434
-
435
- Because it had a root canal!
436
- ```
437
-
438
-
439
- ## Processors
440
- [Processors](https://iovdin.github.io/tune/template-language/processors) is a way to modify variable or insert new ones into chat.
441
-
442
- ### `shp`
443
- Insert shell command output
444
- ```chat
445
- system:
446
- include project file list to system prompt
447
- @{| shp git ls-files }
448
-
449
- include buffer content on osx
450
- @{| shp pbpaste }
451
-
452
- include current date
453
- @{| shp date }
454
-
455
- pipe filename content to shell command
456
- @{ a.log | shp tail }
457
-
458
- @{ a.log | shp grep pattern }
459
- ```
460
-
461
- ### `init`
462
- Set default value for non set variables
463
-
464
- ```chat
465
- system:
466
- @memory|init
467
- if memory does not exist the chat will fail
468
- ```
469
-
470
- ### `mcp`
471
- Connect Model Context Protocol tools
472
- ```chat
473
- system:
474
- @{| mcp npx -y @modelcontextprotocol/server-filesystem ./ }
475
- user:
476
- what is in my current directory?
477
- tool_call: list_allowed_directories
478
- tool_result:
479
- Allowed directories:
480
- /Users/username/projects/tune
481
- ```
482
- ### `json_format`
483
- Set llm response format to json [read more](https://platform.openai.com/docs/guides/structured-outputs?api-mode=chat).
484
-
485
- Without arguments it sets
486
- ```json
487
- "response_format": {
488
- "type": "json_object"
489
- }
490
- ```
491
-
492
- ```chat
493
- system:
494
- @{ gpt-4o | json_format }
495
- please reply in json format:
496
- { "message": "Your reply"}
497
-
498
- user:
499
- hi how are you?
500
-
501
- assistant:
502
- { "message": "I'm just a virtual assistant, so I don't have feelings, but I'm here and ready to help you! How can I assist you today?" }
503
-
504
- ```
505
-
506
- with argument it sets
507
- ```json
508
- "response_format": {
509
- "type": "json_schema",
510
- "json_schema": { "schema": <contents of the file argument> }
511
- }
512
- ```
513
-
514
- ```chat
515
- system:
516
- @{ gpt-4o | json_format path/to/schema.json }
517
- ```
518
-
519
- ### `log`
520
- Save LLM payload to a json file, used for debugging
521
- ```chat
522
- system: @{ gpt-4o | log path/to/log.json }
523
- ```
524
-
525
- ### `mock`
526
- Set variables inline in chat.
527
- ```
528
- system: @{| mock hello=world }
529
- @echo
530
- user:
531
- @hello
532
- assistant:
533
- world
534
- ```
535
-
536
- ### `linenum`
537
- Prepend line numbers to a file content.
538
- Useful when patching file.
539
- ```chat
540
- system:
541
- @echo
542
- user:
543
- @{ helloWorld | linenum }
544
- assistant:
545
- 1 | console.log('Hello, World!');
546
- ```
547
-
548
- ### `text`
549
- Treat special files (`.ctx.js`, `.llm.js`, `.tool.js`) like text
550
- ```chat
551
- system:
552
- @echo
553
-
554
- user:
555
- content
556
- @rf.tool.mjs
557
-
558
- assistant:
559
- content
560
-
561
- user:
562
- content
563
- @{ rf.tool.mjs | text}
564
-
565
- assistant:
566
- content
567
- import { promises as fs } from 'fs';
568
- import { relative, dirname } from 'path'
569
- ....
570
- ```
571
-
572
- ### `resolve`
573
- Given filename resolve it and include
574
-
575
- ```chat
576
- @{ filename | resolve }
577
- ```
578
-
579
- see `examples/queryimage` example
580
-
581
- ### `prop`
582
- set additional propertis for llm
583
-
584
- ```chat
585
- system:
586
- @{ o3-mini | prop reasoning_effort=low temperature=2.0 }
587
- or
588
- @{ gpt-4o-search-preview | prop web_search_options={\} }
589
- ```
590
-
591
- ### `head`
592
- Take first *N* lines of text from a file or variable. Default is 20 lines.
593
-
594
- ```chat
595
- user:
596
- @{ filename.txt | head 10 } # first 10 lines
597
- ```
598
-
599
- ### `tail`
600
- Take last *N* lines of text from a file or variable. Default is 20 lines.
601
-
602
- ```chat
603
- user:
604
- @{ filename.txt | tail 15 } # last 15 lines
605
- ```
606
-
607
- You can limit llm request context with tail like
608
- ```chat
609
- system:
610
- @{ gpt-4.1 | tail 2 } # take last 2 messages from the chat + system message
611
-
612
- user:
613
- 1
614
-
615
- assistant:
616
- 2
617
-
618
- user:
619
- 3
620
-
621
- assistant:
622
- 4
623
- ```
624
-
625
-
626
- ### `slice`
627
- Extract a range of lines from a file or variable.
628
-
629
- ```chat
630
- user:
631
- @{ filename.txt | slice 5 15 } # lines 5 to 15 inclusive
632
- @{ filename.txt | slice 10 } # from line 10 to end
633
- @{ filename.txt | slice -10 -1 } # last 10 lines
634
- @{ filename.txt | slice -20 } # last 20 lines
635
- @{ filename.txt | slice 1 20 } # first 20 lines (like head 20)
636
- ```
@@ -1,17 +0,0 @@
1
- {
2
- "description": "Append text to a file",
3
- "parameters": {
4
- "type": "object",
5
- "properties": {
6
- "filename": {
7
- "type": "string",
8
- "description": "Name of the file to append text to"
9
- },
10
- "text": {
11
- "type": "string",
12
- "description": "Text content to append to the file"
13
- }
14
- },
15
- "required": ["filename", "text"]
16
- }
17
- }
@@ -1,5 +0,0 @@
1
- export default async function append({filename, text}) {
2
- const content = await this.read(filename) || ""
3
- await this.write(filename, `${content}\n${text}`)
4
- return "done"
5
- }
@@ -1,13 +0,0 @@
1
- {
2
- "description": "Search the internet with brave search",
3
- "parameters": {
4
- "type": "object",
5
- "properties": {
6
- "text": {
7
- "type": "string",
8
- "description": "Query to search"
9
- }
10
- },
11
- "required": ["text"]
12
- }
13
- }
@@ -1,32 +0,0 @@
1
- export default async function brave({text}, ctx) {
2
- const key = await ctx.read("BRAVE_KEY");
3
-
4
- if (!key) {
5
- throw new Error("BRAVE_KEY not found in context. Please set up your Brave Search API key.");
6
- }
7
-
8
- if (!text) {
9
- throw new Error("Query parameter is required.");
10
- }
11
-
12
- const encodedQuery = encodeURIComponent(text);
13
- const url = `https://api.search.brave.com/res/v1/web/search?q=${encodedQuery}`;
14
-
15
- const response = await fetch(url, {
16
- method: 'GET',
17
- headers: {
18
- 'Accept': 'application/json',
19
- 'X-Subscription-Token': key
20
- }
21
- });
22
-
23
-
24
- if (!response.ok) {
25
- throw new Error(`Brave Search API returned ${response.status}: ${response.statusText}\n`);
26
- }
27
-
28
- const data = await response.json();
29
- return data.web.results.map(item =>
30
- `${item.title}\n${item.url}\n${item.description}`
31
- ).join("\n\n").replace(/@/g, "\\@");
32
- }
package/tools/claude.txt DELETED
@@ -1 +0,0 @@
1
- @claude-sonnet-4-20250514
@@ -1 +0,0 @@
1
- @{|shp pbpaste }
@@ -1,2 +0,0 @@
1
- module.exports = require("./openai")({ model: "gpt-4.1-mini" })
2
-