aura-code 0.3.0

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 (288) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +137 -0
  3. package/dist/agent/context.d.ts +13 -0
  4. package/dist/agent/context.js +183 -0
  5. package/dist/agent/context.js.map +1 -0
  6. package/dist/agent/loop.d.ts +60 -0
  7. package/dist/agent/loop.js +228 -0
  8. package/dist/agent/loop.js.map +1 -0
  9. package/dist/agent/session-store.d.ts +30 -0
  10. package/dist/agent/session-store.js +178 -0
  11. package/dist/agent/session-store.js.map +1 -0
  12. package/dist/agent/spawner.d.ts +57 -0
  13. package/dist/agent/spawner.js +112 -0
  14. package/dist/agent/spawner.js.map +1 -0
  15. package/dist/agent/system-prompt.d.ts +3 -0
  16. package/dist/agent/system-prompt.js +100 -0
  17. package/dist/agent/system-prompt.js.map +1 -0
  18. package/dist/architect/engine.d.ts +47 -0
  19. package/dist/architect/engine.js +217 -0
  20. package/dist/architect/engine.js.map +1 -0
  21. package/dist/architect/types.d.ts +61 -0
  22. package/dist/architect/types.js +6 -0
  23. package/dist/architect/types.js.map +1 -0
  24. package/dist/cli/diamond.d.ts +1 -0
  25. package/dist/cli/diamond.js +23 -0
  26. package/dist/cli/diamond.js.map +1 -0
  27. package/dist/cli/display.d.ts +44 -0
  28. package/dist/cli/display.js +234 -0
  29. package/dist/cli/display.js.map +1 -0
  30. package/dist/cli/index.d.ts +2 -0
  31. package/dist/cli/index.js +1734 -0
  32. package/dist/cli/index.js.map +1 -0
  33. package/dist/config/defaults.d.ts +46 -0
  34. package/dist/config/defaults.js +106 -0
  35. package/dist/config/defaults.js.map +1 -0
  36. package/dist/config/project-config.d.ts +90 -0
  37. package/dist/config/project-config.js +141 -0
  38. package/dist/config/project-config.js.map +1 -0
  39. package/dist/harness/proposer.d.ts +26 -0
  40. package/dist/harness/proposer.js +204 -0
  41. package/dist/harness/proposer.js.map +1 -0
  42. package/dist/harness/weakness-miner.d.ts +28 -0
  43. package/dist/harness/weakness-miner.js +359 -0
  44. package/dist/harness/weakness-miner.js.map +1 -0
  45. package/dist/integrations/harnesses.d.ts +23 -0
  46. package/dist/integrations/harnesses.js +161 -0
  47. package/dist/integrations/harnesses.js.map +1 -0
  48. package/dist/orchestration/competence.d.ts +53 -0
  49. package/dist/orchestration/competence.js +181 -0
  50. package/dist/orchestration/competence.js.map +1 -0
  51. package/dist/orchestration/executor.d.ts +42 -0
  52. package/dist/orchestration/executor.js +206 -0
  53. package/dist/orchestration/executor.js.map +1 -0
  54. package/dist/orchestration/index.d.ts +20 -0
  55. package/dist/orchestration/index.js +39 -0
  56. package/dist/orchestration/index.js.map +1 -0
  57. package/dist/orchestration/orchestrator-prompts.d.ts +11 -0
  58. package/dist/orchestration/orchestrator-prompts.js +153 -0
  59. package/dist/orchestration/orchestrator-prompts.js.map +1 -0
  60. package/dist/orchestration/orchestrator.d.ts +27 -0
  61. package/dist/orchestration/orchestrator.js +169 -0
  62. package/dist/orchestration/orchestrator.js.map +1 -0
  63. package/dist/orchestration/plan-store.d.ts +53 -0
  64. package/dist/orchestration/plan-store.js +176 -0
  65. package/dist/orchestration/plan-store.js.map +1 -0
  66. package/dist/orchestration/router-prompts.d.ts +6 -0
  67. package/dist/orchestration/router-prompts.js +55 -0
  68. package/dist/orchestration/router-prompts.js.map +1 -0
  69. package/dist/orchestration/router.d.ts +23 -0
  70. package/dist/orchestration/router.js +70 -0
  71. package/dist/orchestration/router.js.map +1 -0
  72. package/dist/orchestration/ruby-detect.d.ts +6 -0
  73. package/dist/orchestration/ruby-detect.js +130 -0
  74. package/dist/orchestration/ruby-detect.js.map +1 -0
  75. package/dist/orchestration/ruby-types.d.ts +44 -0
  76. package/dist/orchestration/ruby-types.js +6 -0
  77. package/dist/orchestration/ruby-types.js.map +1 -0
  78. package/dist/orchestration/specialist-prompts.d.ts +19 -0
  79. package/dist/orchestration/specialist-prompts.js +143 -0
  80. package/dist/orchestration/specialist-prompts.js.map +1 -0
  81. package/dist/orchestration/specialists.d.ts +66 -0
  82. package/dist/orchestration/specialists.js +175 -0
  83. package/dist/orchestration/specialists.js.map +1 -0
  84. package/dist/orchestration/types.d.ts +82 -0
  85. package/dist/orchestration/types.js +6 -0
  86. package/dist/orchestration/types.js.map +1 -0
  87. package/dist/perception/extractor.d.ts +7 -0
  88. package/dist/perception/extractor.js +521 -0
  89. package/dist/perception/extractor.js.map +1 -0
  90. package/dist/perception/graph-store.d.ts +25 -0
  91. package/dist/perception/graph-store.js +117 -0
  92. package/dist/perception/graph-store.js.map +1 -0
  93. package/dist/perception/index.d.ts +4 -0
  94. package/dist/perception/index.js +18 -0
  95. package/dist/perception/index.js.map +1 -0
  96. package/dist/perception/queries.d.ts +29 -0
  97. package/dist/perception/queries.js +354 -0
  98. package/dist/perception/queries.js.map +1 -0
  99. package/dist/perception/types.d.ts +103 -0
  100. package/dist/perception/types.js +6 -0
  101. package/dist/perception/types.js.map +1 -0
  102. package/dist/providers/anthropic.d.ts +11 -0
  103. package/dist/providers/anthropic.js +172 -0
  104. package/dist/providers/anthropic.js.map +1 -0
  105. package/dist/providers/factory.d.ts +58 -0
  106. package/dist/providers/factory.js +354 -0
  107. package/dist/providers/factory.js.map +1 -0
  108. package/dist/providers/fallback.d.ts +24 -0
  109. package/dist/providers/fallback.js +72 -0
  110. package/dist/providers/fallback.js.map +1 -0
  111. package/dist/providers/google.d.ts +11 -0
  112. package/dist/providers/google.js +129 -0
  113. package/dist/providers/google.js.map +1 -0
  114. package/dist/providers/openai-compatible.d.ts +24 -0
  115. package/dist/providers/openai-compatible.js +216 -0
  116. package/dist/providers/openai-compatible.js.map +1 -0
  117. package/dist/providers/resilient-factory.d.ts +24 -0
  118. package/dist/providers/resilient-factory.js +57 -0
  119. package/dist/providers/resilient-factory.js.map +1 -0
  120. package/dist/providers/resilient.d.ts +63 -0
  121. package/dist/providers/resilient.js +145 -0
  122. package/dist/providers/resilient.js.map +1 -0
  123. package/dist/providers/types.d.ts +84 -0
  124. package/dist/providers/types.js +6 -0
  125. package/dist/providers/types.js.map +1 -0
  126. package/dist/ruby/alternator.d.ts +40 -0
  127. package/dist/ruby/alternator.js +233 -0
  128. package/dist/ruby/alternator.js.map +1 -0
  129. package/dist/ruby/competence.d.ts +34 -0
  130. package/dist/ruby/competence.js +264 -0
  131. package/dist/ruby/competence.js.map +1 -0
  132. package/dist/ruby/episode-capture.d.ts +56 -0
  133. package/dist/ruby/episode-capture.js +193 -0
  134. package/dist/ruby/episode-capture.js.map +1 -0
  135. package/dist/ruby/fine-tune.d.ts +16 -0
  136. package/dist/ruby/fine-tune.js +253 -0
  137. package/dist/ruby/fine-tune.js.map +1 -0
  138. package/dist/ruby/index.d.ts +10 -0
  139. package/dist/ruby/index.js +26 -0
  140. package/dist/ruby/index.js.map +1 -0
  141. package/dist/ruby/ruby-model.d.ts +36 -0
  142. package/dist/ruby/ruby-model.js +81 -0
  143. package/dist/ruby/ruby-model.js.map +1 -0
  144. package/dist/ruby/training-data.d.ts +11 -0
  145. package/dist/ruby/training-data.js +107 -0
  146. package/dist/ruby/training-data.js.map +1 -0
  147. package/dist/ruby/types.d.ts +136 -0
  148. package/dist/ruby/types.js +20 -0
  149. package/dist/ruby/types.js.map +1 -0
  150. package/dist/safety/permissions.d.ts +32 -0
  151. package/dist/safety/permissions.js +304 -0
  152. package/dist/safety/permissions.js.map +1 -0
  153. package/dist/server/index.d.ts +9 -0
  154. package/dist/server/index.js +342 -0
  155. package/dist/server/index.js.map +1 -0
  156. package/dist/server/session.d.ts +22 -0
  157. package/dist/server/session.js +16 -0
  158. package/dist/server/session.js.map +1 -0
  159. package/dist/setup/first-run.d.ts +41 -0
  160. package/dist/setup/first-run.js +386 -0
  161. package/dist/setup/first-run.js.map +1 -0
  162. package/dist/setup/global-config.d.ts +19 -0
  163. package/dist/setup/global-config.js +97 -0
  164. package/dist/setup/global-config.js.map +1 -0
  165. package/dist/tools/audio-transcribe.d.ts +8 -0
  166. package/dist/tools/audio-transcribe.js +156 -0
  167. package/dist/tools/audio-transcribe.js.map +1 -0
  168. package/dist/tools/browser.d.ts +15 -0
  169. package/dist/tools/browser.js +241 -0
  170. package/dist/tools/browser.js.map +1 -0
  171. package/dist/tools/calendar.d.ts +12 -0
  172. package/dist/tools/calendar.js +196 -0
  173. package/dist/tools/calendar.js.map +1 -0
  174. package/dist/tools/clipboard.d.ts +7 -0
  175. package/dist/tools/clipboard.js +90 -0
  176. package/dist/tools/clipboard.js.map +1 -0
  177. package/dist/tools/cron.d.ts +10 -0
  178. package/dist/tools/cron.js +167 -0
  179. package/dist/tools/cron.js.map +1 -0
  180. package/dist/tools/edit-file.d.ts +6 -0
  181. package/dist/tools/edit-file.js +98 -0
  182. package/dist/tools/edit-file.js.map +1 -0
  183. package/dist/tools/email.d.ts +11 -0
  184. package/dist/tools/email.js +153 -0
  185. package/dist/tools/email.js.map +1 -0
  186. package/dist/tools/git.d.ts +1 -0
  187. package/dist/tools/git.js +7 -0
  188. package/dist/tools/git.js.map +1 -0
  189. package/dist/tools/http-request.d.ts +12 -0
  190. package/dist/tools/http-request.js +91 -0
  191. package/dist/tools/http-request.js.map +1 -0
  192. package/dist/tools/image-read.d.ts +7 -0
  193. package/dist/tools/image-read.js +125 -0
  194. package/dist/tools/image-read.js.map +1 -0
  195. package/dist/tools/index.d.ts +3 -0
  196. package/dist/tools/index.js +201 -0
  197. package/dist/tools/index.js.map +1 -0
  198. package/dist/tools/list-dir.d.ts +1 -0
  199. package/dist/tools/list-dir.js +6 -0
  200. package/dist/tools/list-dir.js.map +1 -0
  201. package/dist/tools/mcp.d.ts +11 -0
  202. package/dist/tools/mcp.js +356 -0
  203. package/dist/tools/mcp.js.map +1 -0
  204. package/dist/tools/memory.d.ts +9 -0
  205. package/dist/tools/memory.js +124 -0
  206. package/dist/tools/memory.js.map +1 -0
  207. package/dist/tools/notify.d.ts +9 -0
  208. package/dist/tools/notify.js +40 -0
  209. package/dist/tools/notify.js.map +1 -0
  210. package/dist/tools/read-file.d.ts +6 -0
  211. package/dist/tools/read-file.js +76 -0
  212. package/dist/tools/read-file.js.map +1 -0
  213. package/dist/tools/run-shell.d.ts +1 -0
  214. package/dist/tools/run-shell.js +6 -0
  215. package/dist/tools/run-shell.js.map +1 -0
  216. package/dist/tools/run-tests.d.ts +1 -0
  217. package/dist/tools/run-tests.js +6 -0
  218. package/dist/tools/run-tests.js.map +1 -0
  219. package/dist/tools/search-code.d.ts +1 -0
  220. package/dist/tools/search-code.js +6 -0
  221. package/dist/tools/search-code.js.map +1 -0
  222. package/dist/tools/telegram-bot.d.ts +2 -0
  223. package/dist/tools/telegram-bot.js +693 -0
  224. package/dist/tools/telegram-bot.js.map +1 -0
  225. package/dist/tools/telegram-safety.d.ts +52 -0
  226. package/dist/tools/telegram-safety.js +189 -0
  227. package/dist/tools/telegram-safety.js.map +1 -0
  228. package/dist/tools/telegram.d.ts +16 -0
  229. package/dist/tools/telegram.js +227 -0
  230. package/dist/tools/telegram.js.map +1 -0
  231. package/dist/tools/tools.d.ts +48 -0
  232. package/dist/tools/tools.js +328 -0
  233. package/dist/tools/tools.js.map +1 -0
  234. package/dist/tools/web-fetch.d.ts +11 -0
  235. package/dist/tools/web-fetch.js +119 -0
  236. package/dist/tools/web-fetch.js.map +1 -0
  237. package/dist/tools/web-search.d.ts +8 -0
  238. package/dist/tools/web-search.js +81 -0
  239. package/dist/tools/web-search.js.map +1 -0
  240. package/dist/tools/whatsapp.d.ts +10 -0
  241. package/dist/tools/whatsapp.js +222 -0
  242. package/dist/tools/whatsapp.js.map +1 -0
  243. package/dist/tools/write-file.d.ts +1 -0
  244. package/dist/tools/write-file.js +6 -0
  245. package/dist/tools/write-file.js.map +1 -0
  246. package/dist/tools/youtube-transcript.d.ts +9 -0
  247. package/dist/tools/youtube-transcript.js +200 -0
  248. package/dist/tools/youtube-transcript.js.map +1 -0
  249. package/dist/util/circuit-breaker.d.ts +44 -0
  250. package/dist/util/circuit-breaker.js +78 -0
  251. package/dist/util/circuit-breaker.js.map +1 -0
  252. package/dist/util/env.d.ts +18 -0
  253. package/dist/util/env.js +39 -0
  254. package/dist/util/env.js.map +1 -0
  255. package/dist/util/errors.d.ts +42 -0
  256. package/dist/util/errors.js +121 -0
  257. package/dist/util/errors.js.map +1 -0
  258. package/dist/util/rate-limiter.d.ts +71 -0
  259. package/dist/util/rate-limiter.js +141 -0
  260. package/dist/util/rate-limiter.js.map +1 -0
  261. package/dist/util/retry.d.ts +30 -0
  262. package/dist/util/retry.js +57 -0
  263. package/dist/util/retry.js.map +1 -0
  264. package/dist/util/sanitize.d.ts +16 -0
  265. package/dist/util/sanitize.js +255 -0
  266. package/dist/util/sanitize.js.map +1 -0
  267. package/dist/verify/checks.d.ts +21 -0
  268. package/dist/verify/checks.js +311 -0
  269. package/dist/verify/checks.js.map +1 -0
  270. package/dist/verify/index.d.ts +33 -0
  271. package/dist/verify/index.js +127 -0
  272. package/dist/verify/index.js.map +1 -0
  273. package/dist/verify/types.d.ts +20 -0
  274. package/dist/verify/types.js +3 -0
  275. package/dist/verify/types.js.map +1 -0
  276. package/dist/versioncheck.d.ts +22 -0
  277. package/dist/versioncheck.js +203 -0
  278. package/dist/versioncheck.js.map +1 -0
  279. package/dist/viz/index.d.ts +2 -0
  280. package/dist/viz/index.js +733 -0
  281. package/dist/viz/index.js.map +1 -0
  282. package/dist/workflows/engine.d.ts +46 -0
  283. package/dist/workflows/engine.js +320 -0
  284. package/dist/workflows/engine.js.map +1 -0
  285. package/dist/workflows/types.d.ts +92 -0
  286. package/dist/workflows/types.js +6 -0
  287. package/dist/workflows/types.js.map +1 -0
  288. package/package.json +86 -0
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HTTP_REQUEST_DEFINITION = void 0;
4
+ exports.httpRequest = httpRequest;
5
+ exports.HTTP_REQUEST_DEFINITION = {
6
+ name: 'http_request',
7
+ description: 'Make an arbitrary HTTP request to any API. Supports JSON bodies, custom headers, all HTTP methods. ' +
8
+ 'Use for calling REST APIs, webhooks, microservices. Returns status, headers, and body.',
9
+ parameters: {
10
+ type: 'object',
11
+ properties: {
12
+ url: { type: 'string', description: 'The URL to call' },
13
+ method: { type: 'string', description: 'HTTP method (default: GET)' },
14
+ headers: { type: 'object', description: 'Request headers as key-value string pairs' },
15
+ body: { type: 'string', description: 'Raw request body (string)' },
16
+ json: { type: 'object', description: 'JSON body (auto-sets Content-Type to application/json)' },
17
+ max_chars: { type: 'number', description: 'Max response chars to return (default: 50000)' },
18
+ timeout_ms: { type: 'number', description: 'Request timeout in ms (default: 30000)' },
19
+ },
20
+ required: ['url'],
21
+ },
22
+ };
23
+ async function httpRequest(input) {
24
+ const method = (input.method ?? 'GET').toUpperCase();
25
+ const maxChars = input.max_chars ?? 50_000;
26
+ const timeoutMs = input.timeout_ms ?? 30_000;
27
+ let parsed;
28
+ try {
29
+ parsed = new URL(input.url);
30
+ }
31
+ catch {
32
+ return `Error: Invalid URL: ${input.url}`;
33
+ }
34
+ const headers = {
35
+ 'User-Agent': 'Aura/0.2.4',
36
+ ...input.headers,
37
+ };
38
+ let body = input.body;
39
+ if (input.json !== undefined) {
40
+ body = JSON.stringify(input.json);
41
+ if (!headers['Content-Type']) {
42
+ headers['Content-Type'] = 'application/json';
43
+ }
44
+ }
45
+ if (body && !headers['Content-Type'] && !headers['content-type']) {
46
+ headers['Content-Type'] = 'application/json';
47
+ }
48
+ try {
49
+ const response = await fetch(input.url, {
50
+ method,
51
+ headers,
52
+ body,
53
+ signal: AbortSignal.timeout(timeoutMs),
54
+ });
55
+ const status = response.status;
56
+ const statusText = response.statusText;
57
+ const contentType = response.headers.get('content-type') ?? '';
58
+ let responseBody;
59
+ try {
60
+ responseBody = await response.text();
61
+ }
62
+ catch (e) {
63
+ return `Error reading response: ${String(e)}`;
64
+ }
65
+ // Pretty-print JSON
66
+ if (contentType.includes('json')) {
67
+ try {
68
+ const parsed = JSON.parse(responseBody);
69
+ responseBody = JSON.stringify(parsed, null, 2);
70
+ }
71
+ catch { /* leave as-is */ }
72
+ }
73
+ const truncated = responseBody.length > maxChars
74
+ ? responseBody.slice(0, maxChars) + `\n\n... [${responseBody.length} chars total, showing first ${maxChars}]`
75
+ : responseBody;
76
+ return [
77
+ `HTTP ${status} ${statusText}`,
78
+ `Content-Type: ${contentType}`,
79
+ `URL: ${input.url}`,
80
+ '',
81
+ truncated,
82
+ ].join('\n');
83
+ }
84
+ catch (e) {
85
+ if (e?.name === 'TimeoutError' || e?.name === 'AbortError') {
86
+ return `Error: Request timed out after ${timeoutMs}ms`;
87
+ }
88
+ return `Error: ${e?.message ?? String(e)}`;
89
+ }
90
+ }
91
+ //# sourceMappingURL=http-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-request.js","sourceRoot":"","sources":["../../src/tools/http-request.ts"],"names":[],"mappings":";;;AAoCA,kCA0EC;AA9FY,QAAA,uBAAuB,GAAmB;IACrD,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,qGAAqG;QACrG,wFAAwF;IAC1F,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,GAAG,EAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAE;YAC/D,MAAM,EAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;YAC1E,OAAO,EAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2CAA2C,EAAE;YACzF,IAAI,EAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EAAE;YACzE,IAAI,EAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wDAAwD,EAAE;YACtG,SAAS,EAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+CAA+C,EAAE;YAC7F,UAAU,EAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wCAAwC,E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AAE,IAAI,KAAK,YAAY,EAAE,CAAC;YAC3D,OAAO,kCAAkC,SAAS,IAAI,CAAC;QACzD,CAAC;QACD,OAAO,UAAU,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7C,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ToolDefinition } from '../providers/types.js';
2
+ export interface ImageReadInput {
3
+ path: string;
4
+ action?: 'info' | 'ocr' | 'base64';
5
+ }
6
+ export declare const IMAGE_READ_DEFINITION: ToolDefinition;
7
+ export declare function imageRead(input: ImageReadInput): Promise<string>;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.IMAGE_READ_DEFINITION = void 0;
37
+ exports.imageRead = imageRead;
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ const child_process_1 = require("child_process");
41
+ exports.IMAGE_READ_DEFINITION = {
42
+ name: 'image_read',
43
+ description: 'Read an image file. Actions: info (dimensions, size, format), ocr (extract text using tesseract), ' +
44
+ 'base64 (return base64-encoded data for LLM vision). Useful for screenshots, documents, diagrams.',
45
+ parameters: {
46
+ type: 'object',
47
+ properties: {
48
+ path: { type: 'string', description: 'Path to the image file' },
49
+ action: { type: 'string', description: 'Action: info, ocr, base64 (default: info)' },
50
+ },
51
+ required: ['path'],
52
+ },
53
+ };
54
+ const IMAGE_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.webp', '.tiff', '.svg', '.ico'];
55
+ function getInfo(filePath) {
56
+ const stat = fs.statSync(filePath);
57
+ const ext = path.extname(filePath).toLowerCase();
58
+ const sizeKB = (stat.size / 1024).toFixed(1);
59
+ let dimensions = 'unknown';
60
+ try {
61
+ // Try using `file` command for basic info
62
+ const fileInfo = (0, child_process_1.execSync)(`file "${filePath}"`, { encoding: 'utf8' }).trim();
63
+ // Extract dimensions from file output if available
64
+ const dimMatch = fileInfo.match(/(\d+)\s*x\s*(\d+)/);
65
+ if (dimMatch)
66
+ dimensions = `${dimMatch[1]}x${dimMatch[2]}`;
67
+ }
68
+ catch { /* ignore */ }
69
+ return [
70
+ `File: ${filePath}`,
71
+ `Size: ${sizeKB} KB`,
72
+ `Format: ${ext.slice(1).toUpperCase()}`,
73
+ `Dimensions: ${dimensions}`,
74
+ `Modified: ${stat.mtime.toISOString()}`,
75
+ ].join('\n');
76
+ }
77
+ function doOcr(filePath) {
78
+ try {
79
+ (0, child_process_1.execSync)('which tesseract', { stdio: 'pipe' });
80
+ }
81
+ catch {
82
+ return 'Error: tesseract not installed. Install with: sudo apt install tesseract-ocr';
83
+ }
84
+ try {
85
+ const text = (0, child_process_1.execSync)(`tesseract "${filePath}" stdout 2>/dev/null`, { encoding: 'utf8' });
86
+ return `OCR result:\n${text.trim()}`;
87
+ }
88
+ catch (e) {
89
+ return `OCR error: ${e?.message}`;
90
+ }
91
+ }
92
+ function doBase64(filePath) {
93
+ const buffer = fs.readFileSync(filePath);
94
+ const ext = path.extname(filePath).toLowerCase().slice(1);
95
+ const mimeMap = {
96
+ png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg',
97
+ gif: 'image/gif', bmp: 'image/bmp', webp: 'image/webp',
98
+ svg: 'image/svg+xml', tiff: 'image/tiff', ico: 'image/x-icon',
99
+ };
100
+ const mime = mimeMap[ext] ?? 'application/octet-stream';
101
+ const b64 = buffer.toString('base64');
102
+ return `data:${mime};base64,${b64}`;
103
+ }
104
+ async function imageRead(input) {
105
+ const filePath = path.resolve(input.path);
106
+ if (!fs.existsSync(filePath)) {
107
+ return `Error: File not found: ${input.path}`;
108
+ }
109
+ const ext = path.extname(filePath).toLowerCase();
110
+ const action = input.action ?? 'info';
111
+ // For base64, allow any file
112
+ if (action === 'base64') {
113
+ return doBase64(filePath);
114
+ }
115
+ // For info/ocr, check it's an image
116
+ if (!IMAGE_EXTENSIONS.includes(ext)) {
117
+ return `Error: Not an image file (${ext}). Supported: ${IMAGE_EXTENSIONS.join(', ')}`;
118
+ }
119
+ switch (action) {
120
+ case 'info': return getInfo(filePath);
121
+ case 'ocr': return doOcr(filePath);
122
+ default: return `Error: Unknown image_read action: ${action}`;
123
+ }
124
+ }
125
+ //# sourceMappingURL=image-read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-read.js","sourceRoot":"","sources":["../../src/tools/image-read.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFA,8BAyBC;AA3GD,uCAAyB;AACzB,2CAA6B;AAC7B,iDAAyC;AAY5B,QAAA,qBAAqB,GAAmB;IACnD,IAAI,E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GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,0BAA0B,CAAC;IACxD,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,QAAQ,IAAI,WAAW,GAAG,EAAE,CAAC;AACtC,CAAC;AAEM,KAAK,UAAU,SAAS,CAAC,KAAqB;IACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE1C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,OAAO,0BAA0B,KAAK,CAAC,IAAI,EAAE,CAAC;IAChD,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IACjD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC;IAEtC,6BAA6B;IAC7B,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED,oCAAoC;IACpC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACpC,OAAO,6BAA6B,GAAG,iBAAiB,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACxF,CAAC;IAED,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM,CAAC,CAAC,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;QACtC,KAAK,KAAK,CAAC,CAAE,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;QACpC,OAAO,CAAC,CAAK,OAAO,qCAAqC,MAAM,EAAE,CAAC;IACpE,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolDefinition } from '../providers/types.js';
2
+ export declare const TOOL_DEFINITIONS: ToolDefinition[];
3
+ export declare function executeTool(name: string, input: Record<string, unknown>, cwd: string): Promise<string>;
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TOOL_DEFINITIONS = void 0;
4
+ exports.executeTool = executeTool;
5
+ const read_file_js_1 = require("./read-file.js");
6
+ const list_dir_js_1 = require("./list-dir.js");
7
+ const edit_file_js_1 = require("./edit-file.js");
8
+ const write_file_js_1 = require("./write-file.js");
9
+ const search_code_js_1 = require("./search-code.js");
10
+ const run_shell_js_1 = require("./run-shell.js");
11
+ const run_tests_js_1 = require("./run-tests.js");
12
+ const git_js_1 = require("./git.js");
13
+ const spawner_js_1 = require("../agent/spawner.js");
14
+ const web_fetch_js_1 = require("./web-fetch.js");
15
+ const browser_js_1 = require("./browser.js");
16
+ const web_search_js_1 = require("./web-search.js");
17
+ const http_request_js_1 = require("./http-request.js");
18
+ const memory_js_1 = require("./memory.js");
19
+ const clipboard_js_1 = require("./clipboard.js");
20
+ const notify_js_1 = require("./notify.js");
21
+ const image_read_js_1 = require("./image-read.js");
22
+ const email_js_1 = require("./email.js");
23
+ const calendar_js_1 = require("./calendar.js");
24
+ const telegram_js_1 = require("./telegram.js");
25
+ const whatsapp_js_1 = require("./whatsapp.js");
26
+ const cron_js_1 = require("./cron.js");
27
+ const audio_transcribe_js_1 = require("./audio-transcribe.js");
28
+ const youtube_transcript_js_1 = require("./youtube-transcript.js");
29
+ const mcp_js_1 = require("./mcp.js");
30
+ // ─────────────────────────────────────────────────────────────────────────────
31
+ // Tool schemas (what the model sees)
32
+ // ─────────────────────────────────────────────────────────────────────────────
33
+ exports.TOOL_DEFINITIONS = [
34
+ {
35
+ name: 'read_file',
36
+ description: 'Read the contents of a file. Returns the file with line numbers. Use start_line/end_line to read a specific range in large files.',
37
+ parameters: {
38
+ type: 'object',
39
+ properties: {
40
+ path: { type: 'string', description: 'Path to the file (relative to project root)' },
41
+ start_line: { type: 'number', description: 'First line to read (1-indexed, inclusive)' },
42
+ end_line: { type: 'number', description: 'Last line to read (inclusive)' },
43
+ },
44
+ required: ['path'],
45
+ },
46
+ },
47
+ {
48
+ name: 'list_dir',
49
+ description: 'List files and directories in a path. Respects .gitignore. Use recursive=true to see the whole tree.',
50
+ parameters: {
51
+ type: 'object',
52
+ properties: {
53
+ path: { type: 'string', description: 'Directory path (default: project root)' },
54
+ recursive: { type: 'boolean', description: 'Whether to list recursively (default: false)' },
55
+ depth: { type: 'number', description: 'Max depth for recursive listing (default: 3)' },
56
+ },
57
+ required: [],
58
+ },
59
+ },
60
+ {
61
+ name: 'edit_file',
62
+ description: 'Edit a file by finding an exact block of text and replacing it. More reliable than rewriting the whole file. If the find block is not found, an error is returned with enough context to retry.',
63
+ parameters: {
64
+ type: 'object',
65
+ properties: {
66
+ path: { type: 'string', description: 'Path to the file to edit' },
67
+ find: { type: 'string', description: 'The exact block of text to find and replace. Must be unique in the file. Include enough surrounding lines for uniqueness.' },
68
+ replace: { type: 'string', description: 'The new text to replace the found block with' },
69
+ },
70
+ required: ['path', 'find', 'replace'],
71
+ },
72
+ },
73
+ {
74
+ name: 'write_file',
75
+ description: 'Write content to a file. Creates the file if it does not exist. For existing files, use edit_file instead unless you need to replace the entire file.',
76
+ parameters: {
77
+ type: 'object',
78
+ properties: {
79
+ path: { type: 'string', description: 'Path to the file' },
80
+ content: { type: 'string', description: 'Full content to write to the file' },
81
+ },
82
+ required: ['path', 'content'],
83
+ },
84
+ },
85
+ {
86
+ name: 'search_code',
87
+ description: 'Search for a pattern in the codebase using ripgrep (or grep as fallback). Returns matching lines with file paths and line numbers.',
88
+ parameters: {
89
+ type: 'object',
90
+ properties: {
91
+ pattern: { type: 'string', description: 'Search pattern (regex or literal string)' },
92
+ path: { type: 'string', description: 'Directory to search in (default: project root)' },
93
+ file_glob: { type: 'string', description: 'File pattern filter, e.g. "*.ts" or "*.py"' },
94
+ literal: { type: 'boolean', description: 'Treat pattern as literal string, not regex (default: false)' },
95
+ case_sensitive: { type: 'boolean', description: 'Case-sensitive search (default: false)' },
96
+ max_results: { type: 'number', description: 'Maximum number of results to return (default: 50)' },
97
+ },
98
+ required: ['pattern'],
99
+ },
100
+ },
101
+ {
102
+ name: 'run_shell',
103
+ description: 'Run a shell command in the project directory. Use for build commands, package managers, formatters, linters. Avoid destructive commands.',
104
+ parameters: {
105
+ type: 'object',
106
+ properties: {
107
+ command: { type: 'string', description: 'Shell command to run' },
108
+ cwd: { type: 'string', description: 'Working directory (default: project root)' },
109
+ timeout: { type: 'number', description: 'Timeout in milliseconds (default: 30000)' },
110
+ },
111
+ required: ['command'],
112
+ },
113
+ },
114
+ {
115
+ name: 'run_tests',
116
+ description: 'Run the test suite (or a specific test file). Automatically detects the test framework (Jest, Vitest, pytest, go test, etc.).',
117
+ parameters: {
118
+ type: 'object',
119
+ properties: {
120
+ file_or_pattern: { type: 'string', description: 'Specific test file or pattern to run (runs all tests if omitted)' },
121
+ },
122
+ required: [],
123
+ },
124
+ },
125
+ {
126
+ name: 'git_status',
127
+ description: 'Show the current git status: modified files, staged changes, and recent commits.',
128
+ parameters: {
129
+ type: 'object', properties: {}, required: [],
130
+ },
131
+ },
132
+ {
133
+ name: 'git_diff',
134
+ description: 'Show the diff for a specific file or all changes.',
135
+ parameters: {
136
+ type: 'object',
137
+ properties: {
138
+ path: { type: 'string', description: 'Specific file to diff (all files if omitted)' },
139
+ staged: { type: 'boolean', description: 'Show staged (indexed) changes (default: false)' },
140
+ },
141
+ required: [],
142
+ },
143
+ },
144
+ spawner_js_1.SPAWN_TASK_DEFINITION,
145
+ web_fetch_js_1.WEB_FETCH_DEFINITION,
146
+ browser_js_1.BROWSER_DEFINITION,
147
+ web_search_js_1.WEB_SEARCH_DEFINITION,
148
+ http_request_js_1.HTTP_REQUEST_DEFINITION,
149
+ memory_js_1.MEMORY_DEFINITION,
150
+ clipboard_js_1.CLIPBOARD_DEFINITION,
151
+ notify_js_1.NOTIFY_DEFINITION,
152
+ image_read_js_1.IMAGE_READ_DEFINITION,
153
+ email_js_1.EMAIL_DEFINITION,
154
+ calendar_js_1.CALENDAR_DEFINITION,
155
+ telegram_js_1.TELEGRAM_DEFINITION,
156
+ whatsapp_js_1.WHATSAPP_DEFINITION,
157
+ cron_js_1.CRON_DEFINITION,
158
+ audio_transcribe_js_1.AUDIO_TRANSCRIBE_DEFINITION,
159
+ youtube_transcript_js_1.YOUTUBE_TRANSCRIPT_DEFINITION,
160
+ mcp_js_1.MCP_DEFINITION,
161
+ ];
162
+ // ─────────────────────────────────────────────────────────────────────────────
163
+ // Tool executor — dispatches to the right implementation
164
+ // ─────────────────────────────────────────────────────────────────────────────
165
+ async function executeTool(name, input, cwd) {
166
+ try {
167
+ switch (name) {
168
+ case 'read_file': return (0, read_file_js_1.readFile)({ path: input.path, start_line: input.start_line, end_line: input.end_line }, cwd);
169
+ case 'list_dir': return (0, list_dir_js_1.listDir)({ path: input.path ?? '.', recursive: input.recursive ?? false, depth: input.depth ?? 3 }, cwd);
170
+ case 'edit_file': return (0, edit_file_js_1.editFile)({ path: input.path, find: input.find, replace: input.replace }, cwd);
171
+ case 'write_file': return (0, write_file_js_1.writeFile)({ path: input.path, content: input.content }, cwd);
172
+ case 'search_code': return (0, search_code_js_1.searchCode)({ pattern: input.pattern, path: input.path, file_glob: input.file_glob, literal: input.literal ?? false, case_sensitive: input.case_sensitive ?? false, max_results: input.max_results ?? 50 }, cwd);
173
+ case 'run_shell': return await (0, run_shell_js_1.runShell)({ command: input.command, cwd: input.cwd, timeout: input.timeout }, cwd);
174
+ case 'run_tests': return await (0, run_tests_js_1.runTests)({ file_or_pattern: input.file_or_pattern }, cwd);
175
+ case 'git_status': return (0, git_js_1.gitStatus)(cwd);
176
+ case 'git_diff': return (0, git_js_1.gitDiff)({ path: input.path, staged: input.staged ?? false }, cwd);
177
+ case 'spawn_task': return (0, spawner_js_1.executeSpawnTask)(input);
178
+ case 'web_fetch': return (0, web_fetch_js_1.webFetch)({ url: input.url, method: input.method, headers: input.headers, body: input.body, max_chars: input.max_chars, timeout_ms: input.timeout_ms });
179
+ case 'browser': return (0, browser_js_1.browserTool)(input);
180
+ case 'web_search': return (0, web_search_js_1.webSearch)({ query: input.query, max_results: input.max_results, region: input.region });
181
+ case 'http_request': return (0, http_request_js_1.httpRequest)({ url: input.url, method: input.method, headers: input.headers, body: input.body, json: input.json, max_chars: input.max_chars, timeout_ms: input.timeout_ms });
182
+ case 'memory': return (0, memory_js_1.memoryTool)(input);
183
+ case 'clipboard': return (0, clipboard_js_1.clipboardTool)(input);
184
+ case 'notify': return (0, notify_js_1.notifyTool)(input);
185
+ case 'image_read': return (0, image_read_js_1.imageRead)(input);
186
+ case 'email': return (0, email_js_1.emailTool)(input);
187
+ case 'calendar': return (0, calendar_js_1.calendarTool)(input);
188
+ case 'telegram': return (0, telegram_js_1.telegramTool)(input);
189
+ case 'whatsapp': return (0, whatsapp_js_1.whatsAppTool)(input);
190
+ case 'cron': return (0, cron_js_1.cronTool)(input);
191
+ case 'audio_transcribe': return (0, audio_transcribe_js_1.audioTranscribe)(input);
192
+ case 'youtube_transcript': return (0, youtube_transcript_js_1.youtubeTranscript)(input);
193
+ case 'mcp': return (0, mcp_js_1.mcpTool)(input);
194
+ default: return `Error: Unknown tool '${name}'`;
195
+ }
196
+ }
197
+ catch (e) {
198
+ return `Tool error (${name}): ${String(e)}`;
199
+ }
200
+ }
201
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";;;AAqKA,kCAsCC;AA1MD,iDAA0C;AAC1C,+CAAwC;AACxC,iDAA0C;AAC1C,mDAA4C;AAC5C,qDAA8C;AAC9C,iDAA0C;AAC1C,iDAA0C;AAC1C,qCAA8C;AAC9C,oDAA8E;AAC9E,iDAAgE;AAChE,6CAA+D;AAC/D,mDAAmE;AACnE,uDAAyE;AACzE,2CAA4D;AAC5D,iDAAqE;AACrE,2CAA4D;AAC5D,mDAAmE;AACnE,yCAAyD;AACzD,+CAAkE;A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CAAC,CAAC;YACzD,OAAO,CAAC,CAAoB,OAAO,wBAAwB,IAAI,GAAG,CAAC;QACrE,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,eAAe,IAAI,MAAM,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9C,CAAC;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ export { listDir } from './tools.js';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listDir = void 0;
4
+ var tools_js_1 = require("./tools.js");
5
+ Object.defineProperty(exports, "listDir", { enumerable: true, get: function () { return tools_js_1.listDir; } });
6
+ //# sourceMappingURL=list-dir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-dir.js","sourceRoot":"","sources":["../../src/tools/list-dir.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AAA5B,mGAAA,OAAO,OAAA"}
@@ -0,0 +1,11 @@
1
+ import type { ToolDefinition } from '../providers/types.js';
2
+ export interface McpInput {
3
+ action: 'connect' | 'disconnect' | 'list_tools' | 'call_tool' | 'list_servers';
4
+ server?: string;
5
+ tool?: string;
6
+ args?: Record<string, unknown>;
7
+ command?: string;
8
+ args_list?: string[];
9
+ }
10
+ export declare const MCP_DEFINITION: ToolDefinition;
11
+ export declare function mcpTool(input: McpInput): Promise<string>;