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
package/tools/slice.proc.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
module.exports = async function slice(node, args, context) {
|
|
2
|
-
if (!node || node.type !== 'text') {
|
|
3
|
-
return node;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const parts = args ? args.trim().split(/\s+/) : [];
|
|
7
|
-
let start, end;
|
|
8
|
-
|
|
9
|
-
const parseIdx = (str) => {
|
|
10
|
-
const n = parseInt(str, 10);
|
|
11
|
-
if (isNaN(n)) return undefined;
|
|
12
|
-
return n;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
if (parts.length >= 1) start = parseIdx(parts[0]);
|
|
16
|
-
if (parts.length >= 2) end = parseIdx(parts[1]);
|
|
17
|
-
|
|
18
|
-
const newNode = Object.assign({}, node);
|
|
19
|
-
|
|
20
|
-
newNode.read = async () => {
|
|
21
|
-
const text = await node.read();
|
|
22
|
-
const lines = text.split(/\r?\n/);
|
|
23
|
-
const N = lines.length;
|
|
24
|
-
|
|
25
|
-
// Convert 1-based to 0-based, handle negative indices
|
|
26
|
-
let s = start;
|
|
27
|
-
let e = end;
|
|
28
|
-
|
|
29
|
-
if (s === undefined) {
|
|
30
|
-
s = 1; // default to line 1
|
|
31
|
-
}
|
|
32
|
-
s = s < 0 ? N + s : s - 1; // negative or positive 1-based
|
|
33
|
-
if (s < 0) s = 0;
|
|
34
|
-
if (s > N) s = N;
|
|
35
|
-
|
|
36
|
-
if (e !== undefined) {
|
|
37
|
-
e = e < 0 ? N + e : e; // negative or positive 1-based inclusive
|
|
38
|
-
}
|
|
39
|
-
// Since Array.slice end index is exclusive and ours is inclusive, add 0 if undefined, +0 else +0
|
|
40
|
-
// But since end is inclusive for user, exclusive for slice, +1
|
|
41
|
-
if (e !== undefined) {
|
|
42
|
-
e = e < 0 ? Math.max(0, e + 1) : e; // ensure inclusive end
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Convert to slice compatible indices
|
|
46
|
-
const result = lines.slice(
|
|
47
|
-
s,
|
|
48
|
-
e !== undefined ? e : undefined
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
return result.join('\n');
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
return newNode;
|
|
55
|
-
};
|
package/tools/tail.proc.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
module.exports = async function tail(node, args, context) {
|
|
2
|
-
if (!node || (node.type !== 'text' && node.type !== 'llm')) {
|
|
3
|
-
return node;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const n = parseInt(args, 10);
|
|
7
|
-
const count = (isNaN(n) || n <= 0) ? 20 : n;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (node.type === 'text') {
|
|
11
|
-
return {
|
|
12
|
-
...node,
|
|
13
|
-
read: async () => {
|
|
14
|
-
const text = await node.read();
|
|
15
|
-
return text.split(/\r?\n/).slice(-count -1).join('\n');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// llm
|
|
21
|
-
return {
|
|
22
|
-
...node,
|
|
23
|
-
exec: async (payload, ctx) => {
|
|
24
|
-
let startIndex = Math.max(0, payload.messages.length - count)
|
|
25
|
-
startIndex = payload.messages.findIndex((msg, index) => (index >= startIndex) && (msg.role === 'user' || msg.role ==='assistant'))
|
|
26
|
-
const messages = payload.messages.filter(
|
|
27
|
-
(message, index) => (message.role === "system") || (index >= startIndex))
|
|
28
|
-
|
|
29
|
-
return node.exec({
|
|
30
|
-
...payload,
|
|
31
|
-
messages
|
|
32
|
-
}, ctx)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
package/tools/text.proc.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const util = require("util")
|
|
3
|
-
module.exports = async function(node, args) {
|
|
4
|
-
if (! node) {
|
|
5
|
-
return node
|
|
6
|
-
}
|
|
7
|
-
const newNode = Object.assign({}, node)
|
|
8
|
-
newNode.type = "text"
|
|
9
|
-
newNode.read = async function() {
|
|
10
|
-
return fs.readFileSync(node.fullname, "utf8")
|
|
11
|
-
}
|
|
12
|
-
return newNode
|
|
13
|
-
}
|
package/tools/turn.schema.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "Switch roles/agents",
|
|
3
|
-
"parameters": {
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"role": {
|
|
7
|
-
"type": "string",
|
|
8
|
-
"description": "The name of the role/agent to switch to"
|
|
9
|
-
},
|
|
10
|
-
"filename": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"description": "save the role name to filename that keeps the current role"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"required": ["name", "filename"]
|
|
16
|
-
}
|
|
17
|
-
}
|
package/tools/turn.tool.mjs
DELETED
package/tools/wf.schema.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "Asynchronous function to write content to a file",
|
|
3
|
-
"parameters": {
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"filename": {
|
|
7
|
-
"type": "string",
|
|
8
|
-
"description": "The name of the file to write"
|
|
9
|
-
},
|
|
10
|
-
"text": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"description": "The content to write to the file"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"required": ["filename", "text"]
|
|
16
|
-
}
|
|
17
|
-
}
|
package/tools/wf.tool.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
export default async function writeFile({ filename, text }) {
|
|
5
|
-
// Ensure that directory exists
|
|
6
|
-
const directory = path.dirname(filename);
|
|
7
|
-
await fs.mkdir(directory, { recursive: true }).catch(err => {
|
|
8
|
-
// Ignore error if directory already exists
|
|
9
|
-
if (err.code !== 'EEXIST') throw err;
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
// Write file
|
|
13
|
-
await fs.writeFile(filename, text, 'utf8');
|
|
14
|
-
return `written`;
|
|
15
|
-
}
|
|
16
|
-
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "Fetch audio from Yandex's TTS",
|
|
3
|
-
"parameters": {
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"text": {
|
|
7
|
-
"type": "string",
|
|
8
|
-
"description": "Text input to convert to speech. + Set stress/accent e.g. 'h+ello'\nSpecify context-dependent pause: <[small]>, allowed: tiny, small, medium, large, huge\nHighlight emcented]> or **emphasized word**"
|
|
9
|
-
},
|
|
10
|
-
"voice": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"enum": [ "alena-neutral", "alena-good",
|
|
13
|
-
"filipp",
|
|
14
|
-
"ermil-neutral", "ermil-good",
|
|
15
|
-
"jane-neutral", "jane-good", "jane-evil",
|
|
16
|
-
"omazh-neutral", "omazh-evil",
|
|
17
|
-
"zahar-neutral", "zahar-good",
|
|
18
|
-
"dasha-neutral", "dasha-good", "dasha-friendly",
|
|
19
|
-
"julia-neutral", "julia-strict",
|
|
20
|
-
"lera-neutral", "lera-friendly",
|
|
21
|
-
"masha-good", "masha-strict", "masha-friendly",
|
|
22
|
-
"marina-neutral", "marina-whisper", "marina-friendly",
|
|
23
|
-
"alexander-neutral", "alexander-good",
|
|
24
|
-
"kirill-neutral", "kirill-strict", "kirill-good",
|
|
25
|
-
"anton-neutral", "anton-good",
|
|
26
|
-
"madi_ru",
|
|
27
|
-
"saule_ru-neutral", "saule_ru-strict", "saule_ru-whisper",
|
|
28
|
-
"zamira_ru-neutral", "zamira_ru-strict", "zamira_ru-friendly",
|
|
29
|
-
"zhanar_ru-neutral", "zhanar_ru-strict", "zhanar_ru-friendly",
|
|
30
|
-
"yulduz_ru-neutral", "yulduz_ru-strict", "yulduz_ru-friendly", "yulduz_ru-whisper"
|
|
31
|
-
],
|
|
32
|
-
"description": "Voice type to use for TTS"
|
|
33
|
-
},
|
|
34
|
-
"filename": {
|
|
35
|
-
"type": "string",
|
|
36
|
-
"description": "wav filename to save the audio to"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"required": ["text", "voice", "filename"]
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
export default async function yandexTTS({ text, voice, filename }, ctx) {
|
|
3
|
-
const key = await ctx.read("YC_TOKEN");
|
|
4
|
-
const folderId = await ctx.read("YC_FOLDER_ID")
|
|
5
|
-
const [v, r] = voice.split("-")
|
|
6
|
-
const hints = [{ voice: v}]
|
|
7
|
-
if (r) {
|
|
8
|
-
hints.push({ role: r})
|
|
9
|
-
}
|
|
10
|
-
const response = await fetch("https://tts.api.cloud.yandex.net/tts/v3/utteranceSynthesis", {
|
|
11
|
-
method: "POST",
|
|
12
|
-
headers: {
|
|
13
|
-
"Authorization": `Bearer ${key}`,
|
|
14
|
-
"x-folder-id": folderId,
|
|
15
|
-
"Content-Type": "application/json",
|
|
16
|
-
},
|
|
17
|
-
body: JSON.stringify({
|
|
18
|
-
text,
|
|
19
|
-
hints
|
|
20
|
-
}),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!response.ok) {
|
|
25
|
-
const { error } = await response.json()
|
|
26
|
-
throw new Error(`Error: ${response.status} ${response.statusText}\n${error.message}`);
|
|
27
|
-
}
|
|
28
|
-
const result = await response.json()
|
|
29
|
-
await ctx.write(filename, Buffer.from(result.result.audioChunk.data, 'base64'));
|
|
30
|
-
return "speech generated"
|
|
31
|
-
}
|