@vesk/agentic 0.2.11

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.
Files changed (62) hide show
  1. package/README.md +53 -0
  2. package/dist/checkpoints.d.ts +155 -0
  3. package/dist/checkpoints.d.ts.map +1 -0
  4. package/dist/checkpoints.js +394 -0
  5. package/dist/config.d.ts +57 -0
  6. package/dist/config.d.ts.map +1 -0
  7. package/dist/config.js +399 -0
  8. package/dist/context.d.ts +21 -0
  9. package/dist/context.d.ts.map +1 -0
  10. package/dist/context.js +64 -0
  11. package/dist/dev-api.d.ts +85 -0
  12. package/dist/dev-api.d.ts.map +1 -0
  13. package/dist/dev-api.js +942 -0
  14. package/dist/index.d.ts +25 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +23 -0
  17. package/dist/loop.d.ts +156 -0
  18. package/dist/loop.d.ts.map +1 -0
  19. package/dist/loop.js +178 -0
  20. package/dist/permissions.d.ts +14 -0
  21. package/dist/permissions.d.ts.map +1 -0
  22. package/dist/permissions.js +74 -0
  23. package/dist/plugin.d.ts +38 -0
  24. package/dist/plugin.d.ts.map +1 -0
  25. package/dist/plugin.js +28 -0
  26. package/dist/providers/anthropic.d.ts +13 -0
  27. package/dist/providers/anthropic.d.ts.map +1 -0
  28. package/dist/providers/anthropic.js +100 -0
  29. package/dist/providers/google.d.ts +12 -0
  30. package/dist/providers/google.d.ts.map +1 -0
  31. package/dist/providers/google.js +87 -0
  32. package/dist/providers/ollama.d.ts +11 -0
  33. package/dist/providers/ollama.d.ts.map +1 -0
  34. package/dist/providers/ollama.js +61 -0
  35. package/dist/providers/openai.d.ts +12 -0
  36. package/dist/providers/openai.d.ts.map +1 -0
  37. package/dist/providers/openai.js +193 -0
  38. package/dist/providers/registry.d.ts +7 -0
  39. package/dist/providers/registry.d.ts.map +1 -0
  40. package/dist/providers/registry.js +33 -0
  41. package/dist/providers/types.d.ts +28 -0
  42. package/dist/providers/types.d.ts.map +1 -0
  43. package/dist/providers/types.js +15 -0
  44. package/dist/slash.d.ts +18 -0
  45. package/dist/slash.d.ts.map +1 -0
  46. package/dist/slash.js +77 -0
  47. package/dist/tools/browser.d.ts +3 -0
  48. package/dist/tools/browser.d.ts.map +1 -0
  49. package/dist/tools/browser.js +289 -0
  50. package/dist/tools/command.d.ts +14 -0
  51. package/dist/tools/command.d.ts.map +1 -0
  52. package/dist/tools/command.js +55 -0
  53. package/dist/tools/fs.d.ts +10 -0
  54. package/dist/tools/fs.d.ts.map +1 -0
  55. package/dist/tools/fs.js +142 -0
  56. package/dist/tools/vesk.d.ts +22 -0
  57. package/dist/tools/vesk.d.ts.map +1 -0
  58. package/dist/tools/vesk.js +828 -0
  59. package/dist/tools/web.d.ts +3 -0
  60. package/dist/tools/web.d.ts.map +1 -0
  61. package/dist/tools/web.js +111 -0
  62. package/package.json +47 -0
@@ -0,0 +1,3 @@
1
+ import type { Tool } from '../loop.js';
2
+ export declare function createWebTools(): Tool[];
3
+ //# sourceMappingURL=web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/tools/web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,wBAAgB,cAAc,IAAI,IAAI,EAAE,CAkGvC"}
@@ -0,0 +1,111 @@
1
+ export function createWebTools() {
2
+ return [
3
+ {
4
+ name: 'web.search',
5
+ description: 'Search the web for information. Returns top results with titles and snippets.',
6
+ parameters: {
7
+ type: 'object',
8
+ properties: {
9
+ query: { type: 'string', description: 'Search query' },
10
+ count: { type: 'number', description: 'Number of results (1-10)' },
11
+ },
12
+ required: ['query'],
13
+ },
14
+ async execute(args) {
15
+ const query = String(args.query || '').trim();
16
+ const count = Math.min(10, Math.max(1, Number(args.count) || 5));
17
+ if (!query)
18
+ return JSON.stringify({ error: 'missing query' });
19
+ try {
20
+ // Use DuckDuckGo HTML search (no key, fetch-only)
21
+ const url = `https://html.duckduckgo.com/html/?q=${encodeURIComponent(query)}`;
22
+ const res = await fetch(url, { headers: { 'User-Agent': 'vesk-agentic/0.2.10' } });
23
+ if (!res.ok)
24
+ return JSON.stringify({ error: `search failed: ${res.status}` });
25
+ const html = await res.text();
26
+ // Very lightweight parse: extract result links/titles via string ops (no regex for complex parsing, just substring)
27
+ const results = [];
28
+ let pos = 0;
29
+ while (results.length < count) {
30
+ const aIdx = html.indexOf('class="result__a"', pos);
31
+ if (aIdx === -1)
32
+ break;
33
+ const hrefIdx = html.lastIndexOf('href="', aIdx);
34
+ const hrefEnd = html.indexOf('"', hrefIdx + 6);
35
+ const href = hrefIdx !== -1 && hrefEnd !== -1 ? html.slice(hrefIdx + 6, hrefEnd) : '';
36
+ const titleStart = html.indexOf('>', aIdx) + 1;
37
+ const titleEnd = html.indexOf('</a>', titleStart);
38
+ const title = titleStart !== -1 && titleEnd !== -1 ? html.slice(titleStart, titleEnd).replace(/<[^>]*>/g, '').trim() : '';
39
+ const snippetIdx = html.indexOf('class="result__snippet"', titleEnd);
40
+ let snippet = '';
41
+ if (snippetIdx !== -1) {
42
+ const sStart = html.indexOf('>', snippetIdx) + 1;
43
+ const sEnd = html.indexOf('</', sStart);
44
+ snippet = sStart !== -1 && sEnd !== -1 ? html.slice(sStart, sEnd).replace(/<[^>]*>/g, '').trim().slice(0, 300) : '';
45
+ }
46
+ if (title && href)
47
+ results.push({ title, url: href, snippet });
48
+ pos = titleEnd + 1;
49
+ if (pos <= aIdx)
50
+ break;
51
+ }
52
+ if (results.length === 0) {
53
+ // Fallback: try api.duckduckgo.com JSON
54
+ try {
55
+ const apiUrl = `https://api.duckduckgo.com/?q=${encodeURIComponent(query)}&format=json&no_html=1&skip_disambig=1`;
56
+ const apiRes = await fetch(apiUrl);
57
+ if (apiRes.ok) {
58
+ const data = await apiRes.json();
59
+ if (data.AbstractText)
60
+ results.push({ title: query, url: `https://duckduckgo.com/?q=${encodeURIComponent(query)}`, snippet: String(data.AbstractText).slice(0, 300) });
61
+ }
62
+ }
63
+ catch { }
64
+ }
65
+ return JSON.stringify({ query, count: results.length, results }, null, 2);
66
+ }
67
+ catch (e) {
68
+ return JSON.stringify({ error: e instanceof Error ? e.message : String(e) });
69
+ }
70
+ },
71
+ },
72
+ {
73
+ name: 'web.fetch',
74
+ description: 'Fetch a web page and return its text content (first 8000 chars).',
75
+ parameters: {
76
+ type: 'object',
77
+ properties: {
78
+ url: { type: 'string', description: 'URL to fetch' },
79
+ maxChars: { type: 'number', description: 'Max chars to return' },
80
+ },
81
+ required: ['url'],
82
+ },
83
+ async execute(args) {
84
+ const url = String(args.url || '').trim();
85
+ const maxChars = Math.min(20000, Math.max(500, Number(args.maxChars) || 8000));
86
+ if (!url)
87
+ return JSON.stringify({ error: 'missing url' });
88
+ try {
89
+ // Basic SSRF guard: only http/https
90
+ if (!url.startsWith('http://') && !url.startsWith('https://'))
91
+ return JSON.stringify({ error: 'only http/https allowed' });
92
+ const res = await fetch(url, { headers: { 'User-Agent': 'vesk-agentic/0.2.10' } });
93
+ if (!res.ok)
94
+ return JSON.stringify({ error: `fetch failed: ${res.status} ${res.statusText}` });
95
+ const ct = res.headers.get('content-type') || '';
96
+ if (ct.includes('application/json')) {
97
+ const j = await res.text();
98
+ return j.slice(0, maxChars);
99
+ }
100
+ const html = await res.text();
101
+ // Strip tags naively
102
+ let text = html.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '').replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '').replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim();
103
+ return text.slice(0, maxChars);
104
+ }
105
+ catch (e) {
106
+ return JSON.stringify({ error: e instanceof Error ? e.message : String(e) });
107
+ }
108
+ },
109
+ },
110
+ ];
111
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@vesk/agentic",
3
+ "version": "0.2.11",
4
+ "type": "module",
5
+ "description": "Vesk agentic plugin — zero-deps agent loop, provider abstraction, permissions, tools, checkpoints",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./src/*": "./dist/*.js",
14
+ "./package.json": "./package.json"
15
+ },
16
+ "scripts": {
17
+ "build": "tsc -p tsconfig.build.json",
18
+ "typecheck": "tsc --noEmit",
19
+ "prepublishOnly": "npm run build"
20
+ },
21
+ "license": "MIT",
22
+ "author": "emeraldlinks",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/emeraldlinks/veskTs.git"
26
+ },
27
+ "homepage": "https://github.com/emeraldlinks/veskTs#readme",
28
+ "bugs": {
29
+ "url": "https://github.com/emeraldlinks/veskTs/issues"
30
+ },
31
+ "engines": {
32
+ "node": ">=20.0.0"
33
+ },
34
+ "dependencies": {
35
+ "@vesk/types": "^0.2.11"
36
+ },
37
+ "devDependencies": {
38
+ "typescript": "^5.8.0"
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "README.md"
43
+ ],
44
+ "publishConfig": {
45
+ "access": "public"
46
+ }
47
+ }