tune-sdk 0.2.22 → 0.2.23

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 CHANGED
@@ -15,7 +15,7 @@ install tune-sdk
15
15
  ```bash
16
16
  npm install -g tune-sdk
17
17
 
18
- tune-sdk init
18
+ tune init
19
19
  ```
20
20
 
21
21
  edit `~/.tune/.env` file and add `OPENAI_KEY` and other keys
@@ -64,8 +64,8 @@ require('tune-models')
64
64
 
65
65
  MD1 --> |cli middlewares| CTX
66
66
  MD2 --> |app middlewares| CTX
67
- Editor -->| $ tune-sdk rpc | Core
68
- CLI --> | $ tune-sdk --user hello | Core
67
+ Editor -->| $ tune rpc | Core
68
+ CLI --> | $ tune --user hello | Core
69
69
  App --> Core
70
70
 
71
71
 
@@ -85,6 +85,8 @@ Extend Tune with middlewares:
85
85
  * [tune-basic-toolset](https://www.npmjs.com/package/tune-basic-toolset) - basic tools like read file, write file, shell etc.
86
86
  * [tune-s3](https://www.npmjs.com/package/tune-s3) - read/write files from s3
87
87
  * [tune-mcp](https://www.npmjs.com/package/tune-mcp) - connect tools from mcp servers
88
+ * [maik](https://www.npmjs.com/package/@iovdin/maik) - fetch all you emails, and index them into sqlite database
89
+
88
90
 
89
91
  For example:
90
92
  ```sh
@@ -136,14 +138,14 @@ image generated
136
138
  npm install -g tune-sdk
137
139
 
138
140
  # append user message to newchat.chat run and save
139
- tune-sdk --user "hi how are you?" --filename newchat.chat --save
141
+ tune --user "hi how are you?" --filename newchat.chat --save
140
142
 
141
143
  # start new chat with system prompt and initial user message
142
144
  # print result to console
143
- tune-sdk --system "You are Groot" --user "Hi how are you?"
145
+ tune --system "You are Groot" --user "Hi how are you?"
144
146
 
145
147
  #set context variable
146
- tune-sdk --set-test "hello" --user "@test" --system "You are echo you print everythting back"
148
+ tune --set-test "hello" --user "@test" --system "You are echo you print everythting back"
147
149
  ```
148
150
 
149
151
 
@@ -15,8 +15,8 @@ module.exports = [
15
15
  basics(),
16
16
  tunefs({ paths: dirs, makeSchema: true }),
17
17
  models({
18
- default: "gpt-5-mini",
19
- alias: { "sonnet": "claude-sonnet-4-20250514"}
18
+ default: "gpt-5.4",
19
+ alias: { "sonnet": "claude-sonnet-4-6"}
20
20
  }),
21
21
  writer()
22
22
  ]
package/dist/tune.js CHANGED
@@ -1195,6 +1195,8 @@ Context.prototype.envmd = envmd;
1195
1195
  Context.prototype.text2roles = text2roles;
1196
1196
  Context.prototype.roles2text = roles2text;
1197
1197
  Context.prototype.text2call = text2call;
1198
+ Context.prototype.escape = escape;
1199
+ Context.prototype.unescape = unescape;
1198
1200
  Context.prototype.read = (async function(name, args) {
1199
1201
  var resolved, _ref;
1200
1202
  var resolved;
@@ -2280,7 +2282,7 @@ function text2run(text, ctx, opts) {
2280
2282
  }
2281
2283
  text2run;
2282
2284
  async function file2run(args, params, ctx) {
2283
- var lctx, text, stop, errors, turnsSaved, longFormatRegex, isLong, initialText, node, response, res, r, chunk, itergeNE023, _ref;
2285
+ var lctx, text, stop, errors, turnsSaved, longFormatRegex, isLong, initialText, node, response, res, r, chunk, itergZsk35p, _ref;
2284
2286
  var lctx;
2285
2287
  lctx = ctx.clone();
2286
2288
  if (params) lctx.ms.unshift(envmd(params));
@@ -2312,18 +2314,21 @@ async function file2run(args, params, ctx) {
2312
2314
  initialText = (args.system ? tpl("system:\n{system}", args) : "");
2313
2315
  if (args.filename) {
2314
2316
  node = await ctx.resolve(args.filename);
2315
- node ? lctx.stack.push(node) : lctx.stack.push({
2316
- name: args.filename,
2317
- type: "text",
2318
- fullname: args.filename,
2319
- read: (async function() {
2320
- return initialText;
2321
- })
2322
- });
2317
+ if (node) lctx.stack.push(node);
2323
2318
  if ((node && !text)) text = await node.read();
2324
2319
  }
2325
2320
  if ((!text && args.system)) text = initialText;
2326
2321
  text = text || "";
2322
+ node = node || {
2323
+ type: "text",
2324
+ read: (async function() {
2325
+ return text;
2326
+ })
2327
+ }
2328
+ node.name = args.filename;
2329
+ node.fullname = args.filename;
2330
+ node.mimetype = "text/chat";
2331
+ lctx.stack.push(node);
2327
2332
  if (args.user) text += ((text ? "\n" : "") + tpl("user:\n{user}", args));
2328
2333
  if (!text) throw new TuneError("ether 'text' or 'system' or 'user' should be specified or 'filename' should exist ");
2329
2334
  isLong = longFormatRegex.test(text);
@@ -2368,7 +2373,7 @@ async function file2run(args, params, ctx) {
2368
2373
  hookTurnEnd: save
2369
2374
  });
2370
2375
  chunk = {};
2371
- itergeNE023 = new AsyncIter();
2376
+ itergZsk35p = new AsyncIter();
2372
2377
  (async function($lastRes) {
2373
2378
  var _ref;
2374
2379
  try {
@@ -2376,20 +2381,20 @@ async function file2run(args, params, ctx) {
2376
2381
  chunk = await r.next();
2377
2382
  res = (chunk.value || "");
2378
2383
  $lastRes = transformOutput(res) || $lastRes;
2379
- itergeNE023.result = {
2384
+ itergZsk35p.result = {
2380
2385
  value: $lastRes
2381
2386
  }
2382
2387
  }
2383
- _ref = itergeNE023.result = {
2388
+ _ref = itergZsk35p.result = {
2384
2389
  value: $lastRes,
2385
2390
  done: true
2386
2391
  }
2387
2392
  } catch (e) {
2388
- _ref = (itergeNE023.err = e);
2393
+ _ref = (itergZsk35p.err = e);
2389
2394
  }
2390
2395
  return _ref;
2391
2396
  })();
2392
- _ref = itergeNE023;
2397
+ _ref = itergZsk35p;
2393
2398
  }
2394
2399
  return _ref;
2395
2400
  }
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "tune-sdk",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
4
4
  "description": "tune - LLM chat in text file",
5
5
  "main": "dist/tune.js",
6
6
  "module": "dist/tune.mjs",
7
- "bin": "bin/cli.js",
7
+ "bin": {
8
+ "tune": "bin/cli.js",
9
+ "tune-sdk": "bin/cli.js"
10
+ },
8
11
  "exports": {
9
12
  ".": {
10
13
  "require": "./dist/tune.js",
package/src/cli.js CHANGED
@@ -1,6 +1,16 @@
1
1
  var assert, tune, rpc, path, fs, os, cp, stream;
2
2
  assert = require("assert");
3
3
 
4
+
5
+ // tune app - run web server from current directory serving index.html and making it availble to call ctx via websocket
6
+ // tune ps - list of executing agents or the ones finished
7
+ // tune spawn - spawn an agent
8
+ // tune kill - kill/stop agent
9
+ // tune serve - tune manage server, run in background and spawn agents
10
+ // tune - execute call/file and quit
11
+ // tune rpc - run rpc server
12
+
13
+
4
14
  function tpl(str) {
5
15
  var _i;
6
16
  var params = 2 <= arguments.length ? [].slice.call(arguments, 1, _i = arguments.length - 0) : (_i = 1, []);
@@ -21,10 +31,10 @@ function tpl(str) {
21
31
  }
22
32
 
23
33
  function showHelp() {
24
- console.log("TUNE-CLI - Command Line Interface for Tune SDK");
34
+ console.log("TUNE-CLI - Command Line Interface for Tune");
25
35
  console.log("");
26
36
  console.log("USAGE:");
27
- console.log(" tune-sdk [cmd] [OPTIONS]");
37
+ console.log(" tune [cmd] [OPTIONS]");
28
38
  console.log("");
29
39
  console.log("COMMANDS:");
30
40
  console.log(" rpc Start RPC server mode");
@@ -32,19 +42,19 @@ function showHelp() {
32
42
  console.log("");
33
43
  console.log("EXAMPLES:");
34
44
  console.log(" # Quick chat with system prompt");
35
- console.log(" tune-sdk --system \"You are Groot\" --user \"Hi how are you?\"");
45
+ console.log(" tune --system \"You are Groot\" --user \"Hi how are you?\"");
36
46
  console.log("");
37
47
  console.log(" # Continue existing chat");
38
- console.log(" tune-sdk --user \"continue the conversation\" --filename chat.chat --save");
48
+ console.log(" tune --user \"continue the conversation\" --filename chat.chat --save");
39
49
  console.log("");
40
50
  console.log(" # Set context variables");
41
- console.log(" tune-sdk --set-test=hello --user \"@test\" --system \"Echo assistant\"");
51
+ console.log(" tune --set-test=hello --user \"@test\" --system \"Echo assistant\"");
42
52
  console.log("");
43
53
  console.log(" # RPC mode for editor integration");
44
- console.log(" tune-sdk rpc");
54
+ console.log(" tune rpc");
45
55
  console.log("");
46
56
  console.log(" # Initialize or reinitialize config directory");
47
- console.log(" tune-sdk init --force");
57
+ console.log(" tune init --force");
48
58
  console.log("");
49
59
  console.log("OPTIONS:");
50
60
  console.log(" --user <text> User message to send");
@@ -80,8 +90,8 @@ function validateArgs(args) {
80
90
  if (!!args.debug) assert(typeof args.debug === "boolean" || typeof args.debug === "string", "--debug must be a boolean");
81
91
  if (!!args.silent) assert(typeof args.silent === "boolean", "--silent must be a boolean");
82
92
  if (!!args.force) assert(typeof args.force === "boolean", "--force must be a boolean");
83
- if (typeof args.rpc !== "undefined") assert(false, "Use 'tune-sdk rpc' instead of --rpc");
84
- if (typeof args.forceInit !== "undefined") assert(false, "Use 'tune-sdk init --force' instead of --force-init");
93
+ if (typeof args.rpc !== "undefined") assert(false, "Use 'tune rpc' instead of --rpc");
94
+ if (typeof args.forceInit !== "undefined") assert(false, "Use 'tune init --force' instead of --force-init");
85
95
  if (args.params) assert(!!args.params && (typeof args.params === "object"), "--set-* parameters must form a valid object");
86
96
  if ((args.stop && (typeof args.stop === "string"))) assert((args.stop === "assistant") || (args.stop === "step") || (args.stop.length > 0), "--stop must be 'assistant', 'step', or a non-empty custom string");
87
97
  if (args.cmd) {
@@ -189,26 +199,26 @@ async function initConfig(args) {
189
199
  homedir = getHomedir(args);
190
200
  assert(typeof homedir === "string", "Home directory must be a string");
191
201
  if ((!args.force && fs.existsSync(homedir))) return;
192
- console.error("[tune-sdk] initialize " + homedir);
202
+ console.error("[tune] initialize " + homedir);
193
203
  fs.mkdirSync(homedir, {
194
204
  recursive: true
195
205
  });
196
- console.error("[tune-sdk] copying files");
206
+ console.error("[tune] copying files");
197
207
  fs.cpSync(path.resolve(__dirname, "../config"), path.resolve(homedir), { recursive: true });
198
- console.error("[tune-sdk] installing npm");
208
+ console.error("[tune] installing npm");
199
209
  try {
200
210
  _ref = cp.execSync("npm i", {
201
211
  cwd: homedir,
202
212
  encoding: "utf8"
203
213
  });
204
214
  stdout = _ref;
205
- if (stdout.trim()) console.error("[tune-sdk]", stdout.trim());
206
- //stderr.trim() ? console.error("[tune-sdk]", stderr.trim()) : undefined;
215
+ if (stdout.trim()) console.error("[tune]", stdout.trim());
216
+ //stderr.trim() ? console.error("[tune]", stderr.trim()) : undefined;
207
217
  } catch (err) {
208
218
  console.error(err)
209
219
  }
210
- console.error("[tune-sdk] done");
211
- console.error(`[tune-sdk] edit ${homedir}/.env and add OPENAI_KEY and other keys, change ${homedir}/default.ctx.js to customize tune`);
220
+ console.error("[tune] done");
221
+ console.error(`[tune] edit ${homedir}/.env and add OPENAI_KEY and other keys, change ${homedir}/default.ctx.js to customize tune`);
212
222
  }
213
223
  initConfig;
214
224
  async function suggest(params, ctx) {