tune-sdk 0.2.13 → 0.2.14

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
@@ -2,7 +2,7 @@
2
2
  [![Reddit](https://img.shields.io/badge/Reddit-%23FF4500.svg?style=for-the-badge&logo=Reddit&logoColor=white)](https://www.reddit.com/r/tuneai/)
3
3
  [![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/hu32FNYPYD)
4
4
 
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.
5
+ Tune is a handy [extension for Visual Studio Code and](https://marketplace.visualstudio.com/items?itemName=iovdin.tune) and [plugin for Neovim](https://github.com/iovdin/tune.nvim) and [plugin for Sublime Text](https://github.com/iovdin/tune-sublime) that lets you chat with large language models (LLMs) in a text file.
6
6
  With tune [javascript sdk](https://www.npmjs.com/package/tune-sdk) you can make apps and agents.
7
7
 
8
8
  ## Demo
@@ -24,6 +24,7 @@ edit `~/.tune/.env` file and add `OPENAI_KEY` and other keys
24
24
  ## Template Language
25
25
 
26
26
  ```chat
27
+ user:
27
28
  @myprompt include file
28
29
  @image include image
29
30
  @path/to/file include file at path
@@ -39,6 +40,43 @@ edit `~/.tune/.env` file and add `OPENAI_KEY` and other keys
39
40
  ```
40
41
  [read more](https://iovdin.github.io/tune/template-language)
41
42
 
43
+
44
+ ## Diagram
45
+
46
+ ```mermaid
47
+ flowchart TD
48
+
49
+ subgraph Entry[" "]
50
+ Editor["VSCode/Neovim/Sublime Text"]
51
+ CLI["CLI"]
52
+ App["App"]
53
+ end
54
+
55
+ subgraph Core[" "]
56
+ MD1["~/.tune/default.ctx.js"]
57
+ MD2["require('tune-fs')
58
+ require('tune-models')
59
+ "]
60
+ CTX["tune.makeContext(...middlewares)"]
61
+ F2R["ctx.file2run(params)"]
62
+ end
63
+
64
+
65
+ MD1 --> |cli middlewares| CTX
66
+ MD2 --> |app middlewares| CTX
67
+ Editor -->| $ tune-sdk rpc | Core
68
+ CLI --> | $ tune-sdk --user hello | Core
69
+ App --> Core
70
+
71
+
72
+
73
+ F2R -->|ctx.resolve #40; system.txt #124; shell #124; gpt-5 #41; | CTX
74
+ CTX -->| #123; type: text #124; tool #124; llm #125; | F2R
75
+
76
+ F2R --> |fetch| LLM["https://provider.com/v1/chat/completions"]
77
+ F2R --> |call| Tool
78
+ ```
79
+
42
80
  ## Extend with Middlewares
43
81
  Extend Tune with middlewares:
44
82
 
package/dist/tune.js CHANGED
@@ -1569,12 +1569,14 @@ async function text2ast(text, ctx, resolve) {
1569
1569
  continue;
1570
1570
  }(function(it) {
1571
1571
  it = it.replace(/\\\}/g, "}");
1572
+ it = it.replace(/\\\|/g, "__PIPE_ESC__");
1572
1573
  it = it.split("|");
1573
1574
  it = it.map((function(it) {
1574
1575
  return it.trim();
1575
1576
  }));
1576
1577
  it = it.map((function(item, index) {
1577
1578
  var idx;
1579
+ item = item.replace(/__PIPE_ESC__/g, "|");
1578
1580
  if ((index === 0)) return item;
1579
1581
  var idx;
1580
1582
  idx = item.indexOf(" ");
@@ -2202,7 +2204,7 @@ function text2run(text, ctx, opts) {
2202
2204
  }
2203
2205
  text2run;
2204
2206
  async function file2run(args, params, ctx) {
2205
- var lctx, text, stop, node, response, res, r, chunk, itergnVy4sP, _ref;
2207
+ var lctx, text, stop, node, response, res, r, chunk, itergJeXzne, _ref;
2206
2208
  var lctx;
2207
2209
  lctx = ctx.clone();
2208
2210
  if (params) lctx.ms.unshift(envmd(params));
@@ -2269,7 +2271,7 @@ async function file2run(args, params, ctx) {
2269
2271
  stream: true
2270
2272
  });
2271
2273
  chunk = {};
2272
- itergnVy4sP = new AsyncIter();
2274
+ itergJeXzne = new AsyncIter();
2273
2275
  (async function($lastRes) {
2274
2276
  var _ref;
2275
2277
  try {
@@ -2278,20 +2280,20 @@ async function file2run(args, params, ctx) {
2278
2280
  res = (chunk.value || "");
2279
2281
  if (chunk.done) await save();
2280
2282
  $lastRes = transformOutput(res) || $lastRes;
2281
- itergnVy4sP.result = {
2283
+ itergJeXzne.result = {
2282
2284
  value: $lastRes
2283
2285
  }
2284
2286
  }
2285
- _ref = itergnVy4sP.result = {
2287
+ _ref = itergJeXzne.result = {
2286
2288
  value: $lastRes,
2287
2289
  done: true
2288
2290
  }
2289
2291
  } catch (e) {
2290
- _ref = (itergnVy4sP.err = e);
2292
+ _ref = (itergJeXzne.err = e);
2291
2293
  }
2292
2294
  return _ref;
2293
2295
  })();
2294
- _ref = itergnVy4sP;
2296
+ _ref = itergJeXzne;
2295
2297
  }
2296
2298
  return _ref;
2297
2299
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tune-sdk",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "tune - LLM chat in text file",
5
5
  "main": "dist/tune.js",
6
6
  "module": "dist/tune.mjs",
@@ -1,27 +0,0 @@
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