tune-sdk 0.2.6 → 0.2.7
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/README.md +2 -1
- package/dist/cli.js +1 -1
- package/dist/tune.js +26 -20
- package/docs/vscode.md +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Tune is a handy [extension](https://marketplace.visualstudio.com/items?itemName=
|
|
|
6
6
|
With tune [javascript sdk](https://www.npmjs.com/package/tune-sdk) you can make apps and agents.
|
|
7
7
|
|
|
8
8
|
## Demo
|
|
9
|
-
<video src="https://
|
|
9
|
+
<video src="https://github.com/user-attachments/assets/23f8ab30-58db-4159-8761-f212a7960e0c">
|
|
10
10
|
</video>
|
|
11
11
|
|
|
12
12
|
|
|
@@ -46,6 +46,7 @@ Extend Tune with middlewares:
|
|
|
46
46
|
* [tune-models](https://www.npmjs.com/package/tune-models) - connect llm models from Anthropic/OpenAI/Gemini/Openrouter/Mistral/Groq
|
|
47
47
|
* [tune-basic-toolset](https://www.npmjs.com/package/tune-basic-toolset) - basic tools like read file, write file, shell etc.
|
|
48
48
|
* [tune-s3](https://www.npmjs.com/package/tune-s3) - read/write files from s3
|
|
49
|
+
* [tune-mcp](https://www.npmjs.com/package/tune-mcp) - connect tools from mcp servers
|
|
49
50
|
|
|
50
51
|
For example:
|
|
51
52
|
```sh
|
package/dist/cli.js
CHANGED
package/dist/tune.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var $roles
|
|
1
|
+
var $roles;
|
|
2
2
|
|
|
3
3
|
function extend() {
|
|
4
4
|
var _i;
|
|
@@ -1060,7 +1060,7 @@ Context.prototype.use = (function(middleware) {
|
|
|
1060
1060
|
var _ref;
|
|
1061
1061
|
if ((typeof middleware !== "function")) {
|
|
1062
1062
|
_ref = undefined;
|
|
1063
|
-
throw Error(tpl("middleware {} is not a function", util.inspect(middleware)));
|
|
1063
|
+
throw Error(tpl("middleware {} is not a function", ((typeof util !== 'undefined') ? util.inspect(middleware) : middleware)));
|
|
1064
1064
|
} else {
|
|
1065
1065
|
_ref = ((middleware.name === "write") ? this.ws.push(middleware) : this.ms.push(middleware));
|
|
1066
1066
|
}
|
|
@@ -1098,16 +1098,25 @@ async function resolve(ctx, name, args, middlewares) {
|
|
|
1098
1098
|
result = result.concat(res);
|
|
1099
1099
|
i++;
|
|
1100
1100
|
continue;
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1101
|
+
}(Array.isArray(res) ? res : [res])
|
|
1102
|
+
.forEach((function(item) {
|
|
1103
|
+
var _ref;
|
|
1104
|
+
if ((typeof item !== "object")) throw Error(tpl("resolved '@{name}' node must be 'object' but got '{res}'", {
|
|
1105
|
+
name: name,
|
|
1106
|
+
res: typeof item
|
|
1107
|
+
}));
|
|
1108
|
+
if (!item.type) {
|
|
1109
|
+
_ref = undefined;
|
|
1110
|
+
throw Error(tpl("resolved '@{name}' node must have a 'type' property", {
|
|
1111
|
+
name: name
|
|
1112
|
+
}));
|
|
1113
|
+
} else {
|
|
1114
|
+
_ref = undefined;
|
|
1115
|
+
}
|
|
1116
|
+
return _ref;
|
|
1108
1117
|
}));
|
|
1109
1118
|
if ((output === "first")) {
|
|
1110
|
-
result = res;
|
|
1119
|
+
result = (Array.isArray(res) ? res[0] : res);
|
|
1111
1120
|
break;
|
|
1112
1121
|
}
|
|
1113
1122
|
result.push(res);
|
|
@@ -1193,7 +1202,7 @@ function envmd(md) {
|
|
|
1193
1202
|
_ref = (lmd[name].name = name);
|
|
1194
1203
|
} else {
|
|
1195
1204
|
_ref = undefined;
|
|
1196
|
-
throw new TuneError(("unsupported type of value '" + name + "': " + util.inspect(md)));
|
|
1205
|
+
throw new TuneError(("unsupported type of value '" + name + "': " + ((typeof util !== 'undefined') ? util.inspect(md) : md)));
|
|
1197
1206
|
}
|
|
1198
1207
|
return _ref;
|
|
1199
1208
|
}));
|
|
@@ -2126,7 +2135,7 @@ function text2run(text, ctx, opts) {
|
|
|
2126
2135
|
}
|
|
2127
2136
|
text2run;
|
|
2128
2137
|
async function file2run(args, params, ctx) {
|
|
2129
|
-
var lctx, text, stop, node, response, res, r, chunk,
|
|
2138
|
+
var lctx, text, stop, node, response, res, r, chunk, itergVSO3pP, _ref;
|
|
2130
2139
|
var lctx;
|
|
2131
2140
|
lctx = ctx.clone();
|
|
2132
2141
|
lctx.ms.unshift(envmd(params));
|
|
@@ -2192,7 +2201,7 @@ async function file2run(args, params, ctx) {
|
|
|
2192
2201
|
stream: true
|
|
2193
2202
|
});
|
|
2194
2203
|
chunk = {};
|
|
2195
|
-
|
|
2204
|
+
itergVSO3pP = new AsyncIter();
|
|
2196
2205
|
(async function($lastRes) {
|
|
2197
2206
|
var _ref;
|
|
2198
2207
|
try {
|
|
@@ -2201,20 +2210,20 @@ async function file2run(args, params, ctx) {
|
|
|
2201
2210
|
res = (chunk.value || "");
|
|
2202
2211
|
if (chunk.done) await save();
|
|
2203
2212
|
$lastRes = transformOutput(res) || $lastRes;
|
|
2204
|
-
|
|
2213
|
+
itergVSO3pP.result = {
|
|
2205
2214
|
value: $lastRes
|
|
2206
2215
|
}
|
|
2207
2216
|
}
|
|
2208
|
-
_ref =
|
|
2217
|
+
_ref = itergVSO3pP.result = {
|
|
2209
2218
|
value: $lastRes,
|
|
2210
2219
|
done: true
|
|
2211
2220
|
}
|
|
2212
2221
|
} catch (e) {
|
|
2213
|
-
_ref = (
|
|
2222
|
+
_ref = (itergVSO3pP.err = e);
|
|
2214
2223
|
}
|
|
2215
2224
|
return _ref;
|
|
2216
2225
|
})();
|
|
2217
|
-
_ref =
|
|
2226
|
+
_ref = itergVSO3pP;
|
|
2218
2227
|
}
|
|
2219
2228
|
return _ref;
|
|
2220
2229
|
}
|
|
@@ -2469,9 +2478,6 @@ function pick(obj) {
|
|
|
2469
2478
|
})({});
|
|
2470
2479
|
}
|
|
2471
2480
|
pick;
|
|
2472
|
-
fs = require("fs");
|
|
2473
|
-
assert = require("node:assert/strict");
|
|
2474
|
-
util = require("util");
|
|
2475
2481
|
exports.makeContext = makeContext;
|
|
2476
2482
|
exports.Context = Context;
|
|
2477
2483
|
exports.text2roles = text2roles;
|
package/docs/vscode.md
CHANGED
|
@@ -6,6 +6,9 @@ Tune is a handy [extension](https://marketplace.visualstudio.com/items?itemName=
|
|
|
6
6
|
</video>
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
- `<Shift>+<Enter>` - to make llm respond 1 time
|
|
10
|
+
- `<Ctrl|Cmd>+<Enter>` - make llm respond until assistant without tool calls
|
|
11
|
+
|
|
9
12
|
## Setup
|
|
10
13
|
install tune-sdk
|
|
11
14
|
```bash
|