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.
- package/.github/workflows/publish.yml +27 -0
- package/README.md +4 -6
- package/dist/cli.js +8 -7
- package/dist/tune.js +6 -6
- package/docs/vscode.md +133 -0
- package/package.json +2 -5
- package/tools/README.md +0 -636
- package/tools/append.schema.json +0 -17
- package/tools/append.tool.mjs +0 -5
- package/tools/brave.schema.json +0 -13
- package/tools/brave.tool.mjs +0 -32
- package/tools/claude.txt +0 -1
- package/tools/clipboard.txt +0 -1
- package/tools/default.llm.js +0 -2
- package/tools/dev.txt +0 -6
- package/tools/echo.txt +0 -1
- package/tools/editor-filename.chat +0 -10
- package/tools/gemini-dev.txt +0 -7
- package/tools/gemini25.txt +0 -1
- package/tools/gemini_files.schema.json +0 -13
- package/tools/gemini_files.tool.mjs +0 -204
- package/tools/gemini_ocr.schema.json +0 -21
- package/tools/gemini_ocr.tool.mjs +0 -211
- package/tools/gemini_tts.schema.json +0 -59
- package/tools/gemini_tts.tool.mjs +0 -175
- package/tools/gemini_veo.schema.json +0 -12
- package/tools/gemini_veo.tool.mjs +0 -233
- package/tools/groq_whisper.schema.json +0 -48
- package/tools/groq_whisper.tool.mjs +0 -59
- package/tools/head.proc.js +0 -24
- package/tools/init.proc.js +0 -19
- package/tools/jina_r.schema.json +0 -21
- package/tools/jina_r.tool.mjs +0 -27
- package/tools/js.schema.json +0 -19
- package/tools/js.tool.mjs +0 -60
- package/tools/json_format.proc.mjs +0 -22
- package/tools/linenum.proc.js +0 -21
- package/tools/list.schema.json +0 -19
- package/tools/list.tool.mjs +0 -20
- package/tools/llm-utils.js +0 -150
- package/tools/log.proc.js +0 -15
- package/tools/mcp.proc.mjs +0 -174
- package/tools/message.schema.json +0 -21
- package/tools/message.tool.js +0 -14
- package/tools/mock.proc.js +0 -35
- package/tools/nu.schema.json +0 -13
- package/tools/nu.tool.mjs +0 -14
- package/tools/openai.js +0 -27
- package/tools/openai_imgen.schema.json +0 -35
- package/tools/openai_imgen.tool.mjs +0 -83
- package/tools/openai_stt.schema.json +0 -49
- package/tools/openai_stt.tool.mjs +0 -66
- package/tools/openai_tts.schema.json +0 -26
- package/tools/openai_tts.tool.mjs +0 -26
- package/tools/osa.schema.json +0 -13
- package/tools/osa.tool.mjs +0 -12
- package/tools/package.json +0 -7
- package/tools/patch.schema.json +0 -17
- package/tools/patch.tool.mjs +0 -38
- package/tools/prop.proc.mjs +0 -34
- package/tools/py.schema.json +0 -17
- package/tools/py.tool.py +0 -22
- package/tools/queryimage.schema.json +0 -17
- package/tools/queryimage.tool.chat +0 -4
- package/tools/resolve.proc.js +0 -10
- package/tools/rf.schema.json +0 -17
- package/tools/rf.tool.mjs +0 -21
- package/tools/schema.schema.json +0 -13
- package/tools/schema.tool.chat +0 -81
- package/tools/sh.schema.json +0 -13
- package/tools/sh.tool.mjs +0 -12
- package/tools/short.txt +0 -1
- package/tools/shp.proc.mjs +0 -31
- package/tools/slice.proc.js +0 -55
- package/tools/tail.proc.js +0 -35
- package/tools/text.proc.js +0 -13
- package/tools/turn.schema.json +0 -17
- package/tools/turn.tool.mjs +0 -8
- package/tools/wf.schema.json +0 -17
- package/tools/wf.tool.mjs +0 -16
- package/tools/yandex_tts.schema.json +0 -41
- package/tools/yandex_tts.tool.mjs +0 -31
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Publish Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
id-token: write # Required for OIDC
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: '20'
|
|
21
|
+
registry-url: 'https://registry.npmjs.org'
|
|
22
|
+
|
|
23
|
+
# Ensure npm 11.5.1 or later is installed
|
|
24
|
+
- name: Update npm
|
|
25
|
+
run: npm install -g npm@latest
|
|
26
|
+
- run: npm i
|
|
27
|
+
- run: npm publish
|
package/README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# Tune - AI chat in text file
|
|
2
|
+
[](https://www.reddit.com/r/tuneai/)
|
|
3
|
+
[](https://discord.gg/hu32FNYPYD)
|
|
2
4
|
|
|
3
5
|
Tune is a handy [extension](https://marketplace.visualstudio.com/items?itemName=iovdin.tune) for Visual Studio Code and [plugin](https://github.com/iovdin/tune.nvim) for Neovim that lets you chat with large language models (LLMs) in a text file.
|
|
4
6
|
With tune [javascript sdk](https://www.npmjs.com/package/tune-sdk) you can make apps and agents.
|
|
5
7
|
|
|
6
8
|
## Demo
|
|
7
|
-
<
|
|
9
|
+
<video src="https://f003.backblazeb2.com/file/tuneai/video/nvim.mp4">
|
|
10
|
+
</video>
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
## Setup
|
|
@@ -132,8 +135,3 @@ async function main() {
|
|
|
132
135
|
main()
|
|
133
136
|
```
|
|
134
137
|
[read more](https://iovdin.github.io/tune/api) about javascript sdk
|
|
135
|
-
|
|
136
|
-
### 📫 Contact
|
|
137
|
-
|
|
138
|
-
For any inquiries or support, feel free to [open an issue](https://github.com/iovdin/tune/issues) on GitHub. Or drop a message to [Tune Discord Channel](https://discord.com/channels/1293110380813484063/1293110381400559689)
|
|
139
|
-
|
package/dist/cli.js
CHANGED
|
@@ -175,20 +175,21 @@ async function initConfig(args) {
|
|
|
175
175
|
recursive: true
|
|
176
176
|
});
|
|
177
177
|
console.error("[tune-sdk] copying files");
|
|
178
|
-
fs.
|
|
179
|
-
fs.copyFileSync(path.resolve(__dirname, "../config/package.json"), path.resolve(homedir, "package.json"));
|
|
178
|
+
fs.cpSync(path.resolve(__dirname, "../config"), path.resolve(homedir), { recursive: true });
|
|
180
179
|
console.error("[tune-sdk] installing npm");
|
|
181
180
|
try {
|
|
182
181
|
_ref = cp.execSync("npm i", {
|
|
183
182
|
cwd: homedir,
|
|
184
183
|
encoding: "utf8"
|
|
185
184
|
});
|
|
186
|
-
stdout = _ref
|
|
187
|
-
stderr = _ref[1];
|
|
185
|
+
stdout = _ref;
|
|
188
186
|
if (stdout.trim()) console.error("[tune-sdk]", stdout.trim());
|
|
189
|
-
stderr.trim() ? console.error("[tune-sdk]", stderr.trim()) : undefined;
|
|
190
|
-
} catch (err) {
|
|
191
|
-
|
|
187
|
+
//stderr.trim() ? console.error("[tune-sdk]", stderr.trim()) : undefined;
|
|
188
|
+
} catch (err) {
|
|
189
|
+
console.error(err)
|
|
190
|
+
}
|
|
191
|
+
console.error("[tune-sdk] done");
|
|
192
|
+
console.error(`[tune-sdk] edit ${homedir}/.env and add OPENAI_KEY and other keys, change ${homedir}/default.ctx.js to customize tune`);
|
|
192
193
|
}
|
|
193
194
|
initConfig;
|
|
194
195
|
async function suggest(params, ctx) {
|
package/dist/tune.js
CHANGED
|
@@ -2126,7 +2126,7 @@ function text2run(text, ctx, opts) {
|
|
|
2126
2126
|
}
|
|
2127
2127
|
text2run;
|
|
2128
2128
|
async function file2run(args, params, ctx) {
|
|
2129
|
-
var lctx, text, stop, node, response, res, r, chunk,
|
|
2129
|
+
var lctx, text, stop, node, response, res, r, chunk, itergrN0Lbw, _ref;
|
|
2130
2130
|
var lctx;
|
|
2131
2131
|
lctx = ctx.clone();
|
|
2132
2132
|
lctx.ms.unshift(envmd(params));
|
|
@@ -2192,7 +2192,7 @@ async function file2run(args, params, ctx) {
|
|
|
2192
2192
|
stream: true
|
|
2193
2193
|
});
|
|
2194
2194
|
chunk = {};
|
|
2195
|
-
|
|
2195
|
+
itergrN0Lbw = new AsyncIter();
|
|
2196
2196
|
(async function($lastRes) {
|
|
2197
2197
|
var _ref;
|
|
2198
2198
|
try {
|
|
@@ -2201,20 +2201,20 @@ async function file2run(args, params, ctx) {
|
|
|
2201
2201
|
res = (chunk.value || "");
|
|
2202
2202
|
if (chunk.done) await save();
|
|
2203
2203
|
$lastRes = transformOutput(res) || $lastRes;
|
|
2204
|
-
|
|
2204
|
+
itergrN0Lbw.result = {
|
|
2205
2205
|
value: $lastRes
|
|
2206
2206
|
}
|
|
2207
2207
|
}
|
|
2208
|
-
_ref =
|
|
2208
|
+
_ref = itergrN0Lbw.result = {
|
|
2209
2209
|
value: $lastRes,
|
|
2210
2210
|
done: true
|
|
2211
2211
|
}
|
|
2212
2212
|
} catch (e) {
|
|
2213
|
-
_ref = (
|
|
2213
|
+
_ref = (itergrN0Lbw.err = e);
|
|
2214
2214
|
}
|
|
2215
2215
|
return _ref;
|
|
2216
2216
|
})();
|
|
2217
|
-
_ref =
|
|
2217
|
+
_ref = itergrN0Lbw;
|
|
2218
2218
|
}
|
|
2219
2219
|
return _ref;
|
|
2220
2220
|
}
|
package/docs/vscode.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Tune - AI chat in text file
|
|
2
|
+
Tune is a handy [extension](https://marketplace.visualstudio.com/items?itemName=iovdin.tune) for Visual Studio Code to chat with LLM in text file.
|
|
3
|
+
|
|
4
|
+
## Demo
|
|
5
|
+
<video src="https://f003.backblazeb2.com/file/tuneai/video/vscode.mp4">
|
|
6
|
+
</video>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
install tune-sdk
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g tune-sdk
|
|
13
|
+
|
|
14
|
+
tune-sdk init
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
edit `~/.tune/.env` file and add `OPENAI_KEY` and other keys
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Template Language
|
|
21
|
+
|
|
22
|
+
```chat
|
|
23
|
+
@myprompt include file
|
|
24
|
+
@image include image
|
|
25
|
+
@path/to/file include file at path
|
|
26
|
+
@gpt-4.1 connect model
|
|
27
|
+
@shell connect tool
|
|
28
|
+
@@prompt include file recursively
|
|
29
|
+
|
|
30
|
+
@{ name with whitespaces } - include file with whitespaces
|
|
31
|
+
@{ image | resize 512 } - modify with processors
|
|
32
|
+
@{ largefile | tail 100 } - modify with processors
|
|
33
|
+
@{| sh tree } - insert generated content with processors
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
[read more](https://iovdin.github.io/tune/template-language)
|
|
37
|
+
|
|
38
|
+
## Extend with Middlewares
|
|
39
|
+
Extend Tune with middlewares:
|
|
40
|
+
|
|
41
|
+
* [tune-fs](https://www.npmjs.com/package/tune-fs) - connect tools & files from local filesystem
|
|
42
|
+
* [tune-models](https://www.npmjs.com/package/tune-models) - connect llm models from Anthropic/OpenAI/Gemini/Openrouter/Mistral/Groq
|
|
43
|
+
* [tune-basic-toolset](https://www.npmjs.com/package/tune-basic-toolset) - basic tools like read file, write file, shell etc.
|
|
44
|
+
* [tune-s3](https://www.npmjs.com/package/tune-s3) - read/write files from s3
|
|
45
|
+
|
|
46
|
+
For example:
|
|
47
|
+
```sh
|
|
48
|
+
cd ~/.tune
|
|
49
|
+
npm install tune-models
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Edit `default.ctx.js` and add middlewares
|
|
53
|
+
```javascript
|
|
54
|
+
const models = require('tune-models')
|
|
55
|
+
|
|
56
|
+
module.exports = [
|
|
57
|
+
...
|
|
58
|
+
models({
|
|
59
|
+
default: "gpt-5-mini"
|
|
60
|
+
})
|
|
61
|
+
...
|
|
62
|
+
]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Edit `.env` file and add provider's keys
|
|
66
|
+
|
|
67
|
+
```.env
|
|
68
|
+
OPENAI_KEY="<openai_key>"
|
|
69
|
+
ANTHROPIC_KEY="<anthropic_key>"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Use it in chat
|
|
73
|
+
```chat
|
|
74
|
+
system:
|
|
75
|
+
@gemini-2.5-pro @openai_imgen
|
|
76
|
+
|
|
77
|
+
user:
|
|
78
|
+
draw a stickman with talking bubble "Hello world"
|
|
79
|
+
|
|
80
|
+
assistant:
|
|
81
|
+
tool_call: openai_imgen {"filename":"stickman_hello_world.png"}
|
|
82
|
+
a simple stickman drawing with a talking bubble saying 'Hello world'
|
|
83
|
+
|
|
84
|
+
tool_result:
|
|
85
|
+
image generated
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## CLI
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# install tune globally
|
|
93
|
+
npm install -g tune-sdk
|
|
94
|
+
|
|
95
|
+
# append user message to newchat.chat run and save
|
|
96
|
+
tune-sdk --user "hi how are you?" --filename newchat.chat --save
|
|
97
|
+
|
|
98
|
+
# start new chat with system prompt and initial user message
|
|
99
|
+
# print result to console
|
|
100
|
+
tune-sdk --system "You are Groot" --user "Hi how are you?"
|
|
101
|
+
|
|
102
|
+
#set context variable
|
|
103
|
+
tune-sdk --set-test "hello" --user "@test" --system "You are echo you print everythting back"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
## Javascript SDK
|
|
108
|
+
`npm install tune-sdk`
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
const tune = require("tune-sdk");
|
|
112
|
+
const sonnet = require("./sonnet.llm.js");
|
|
113
|
+
|
|
114
|
+
require('dotenv').config();
|
|
115
|
+
|
|
116
|
+
async function main() {
|
|
117
|
+
const ctx = tune.makeContext({
|
|
118
|
+
echo: "You are echo, you print everything back",
|
|
119
|
+
OPENROUTER_KEY: process.env.OPENROUTER_KEY,
|
|
120
|
+
"default": {
|
|
121
|
+
type: "llm",
|
|
122
|
+
exec: sonnet
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const text = "s: @echo\nu: hello world";
|
|
127
|
+
const messages = await tune.text2run(text, ctx)
|
|
128
|
+
console.log(tune.msg2text(messages))
|
|
129
|
+
// a: hello world
|
|
130
|
+
}
|
|
131
|
+
main()
|
|
132
|
+
```
|
|
133
|
+
[read more](https://iovdin.github.io/tune/api) about javascript sdk
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tune-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "tune - LLM chat in text file",
|
|
5
5
|
"main": "dist/tune.js",
|
|
6
6
|
"module": "dist/tune.mjs",
|
|
@@ -30,8 +30,5 @@
|
|
|
30
30
|
"type": "git",
|
|
31
31
|
"url": "https://github.com/iovdin/tune"
|
|
32
32
|
},
|
|
33
|
-
"license": "MIT"
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"tune-sdk": "^0.2.3"
|
|
36
|
-
}
|
|
33
|
+
"license": "MIT"
|
|
37
34
|
}
|