@revealui/ai 0.1.3 → 0.2.2

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 (214) hide show
  1. package/LICENSE.commercial +2 -3
  2. package/README.md +3 -0
  3. package/dist/a2a/card.d.ts.map +1 -1
  4. package/dist/a2a/handler.d.ts +1 -1
  5. package/dist/a2a/handler.d.ts.map +1 -1
  6. package/dist/a2a/handler.js +1 -1
  7. package/dist/a2a/index.d.ts.map +1 -1
  8. package/dist/a2a/task-store.d.ts.map +1 -1
  9. package/dist/audit/emitter.d.ts.map +1 -1
  10. package/dist/audit/index.d.ts.map +1 -1
  11. package/dist/audit/observer.d.ts.map +1 -1
  12. package/dist/audit/policy.d.ts.map +1 -1
  13. package/dist/audit/store.d.ts.map +1 -1
  14. package/dist/audit/types.d.ts.map +1 -1
  15. package/dist/client/hooks/index.d.ts.map +1 -1
  16. package/dist/client/hooks/useAgentContext.d.ts.map +1 -1
  17. package/dist/client/hooks/useAgentEvents.d.ts.map +1 -1
  18. package/dist/client/hooks/useAgentStream.d.ts.map +1 -1
  19. package/dist/client/hooks/useEpisodicMemory.d.ts.map +1 -1
  20. package/dist/client/hooks/useWorkingMemory.d.ts.map +1 -1
  21. package/dist/client/index.d.ts.map +1 -1
  22. package/dist/embeddings/index.d.ts.map +1 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/inference/context-assembly.d.ts.map +1 -1
  25. package/dist/inference/context-budget.d.ts +46 -0
  26. package/dist/inference/context-budget.d.ts.map +1 -0
  27. package/dist/inference/context-budget.js +113 -0
  28. package/dist/inference/index.d.ts +8 -0
  29. package/dist/inference/index.d.ts.map +1 -0
  30. package/dist/inference/index.js +7 -0
  31. package/dist/inference/overflow-compressor.d.ts.map +1 -1
  32. package/dist/inference/runRag.d.ts.map +1 -1
  33. package/dist/inference/task-decomposer.d.ts +75 -0
  34. package/dist/inference/task-decomposer.d.ts.map +1 -0
  35. package/dist/inference/task-decomposer.js +190 -0
  36. package/dist/inference/tool-result-compressor.d.ts +39 -0
  37. package/dist/inference/tool-result-compressor.d.ts.map +1 -0
  38. package/dist/inference/tool-result-compressor.js +180 -0
  39. package/dist/ingestion/bm25.d.ts.map +1 -1
  40. package/dist/ingestion/cms-indexer.d.ts.map +1 -1
  41. package/dist/ingestion/file-parsers.d.ts.map +1 -1
  42. package/dist/ingestion/hybrid-search.d.ts.map +1 -1
  43. package/dist/ingestion/index.d.ts.map +1 -1
  44. package/dist/ingestion/pipeline.d.ts +2 -1
  45. package/dist/ingestion/pipeline.d.ts.map +1 -1
  46. package/dist/ingestion/pipeline.js +10 -5
  47. package/dist/ingestion/rag-vector-service.d.ts.map +1 -1
  48. package/dist/ingestion/reranker.d.ts.map +1 -1
  49. package/dist/ingestion/text-splitter.d.ts.map +1 -1
  50. package/dist/llm/cache-utils.d.ts.map +1 -1
  51. package/dist/llm/client.d.ts +12 -2
  52. package/dist/llm/client.d.ts.map +1 -1
  53. package/dist/llm/client.js +38 -7
  54. package/dist/llm/key-validator.d.ts.map +1 -1
  55. package/dist/llm/provider-health.d.ts.map +1 -1
  56. package/dist/llm/providers/anthropic.d.ts.map +1 -1
  57. package/dist/llm/providers/anthropic.js +3 -1
  58. package/dist/llm/providers/base.d.ts.map +1 -1
  59. package/dist/llm/providers/bitnet.d.ts +28 -0
  60. package/dist/llm/providers/bitnet.d.ts.map +1 -0
  61. package/dist/llm/providers/bitnet.js +36 -0
  62. package/dist/llm/providers/groq.d.ts.map +1 -1
  63. package/dist/llm/providers/inference-snaps.d.ts.map +1 -1
  64. package/dist/llm/providers/ollama.d.ts.map +1 -1
  65. package/dist/llm/providers/openai.d.ts.map +1 -1
  66. package/dist/llm/providers/vultr.d.ts.map +1 -1
  67. package/dist/llm/response-cache.d.ts.map +1 -1
  68. package/dist/llm/semantic-cache.d.ts.map +1 -1
  69. package/dist/llm/semantic-cache.js +4 -4
  70. package/dist/llm/server.d.ts +1 -0
  71. package/dist/llm/server.d.ts.map +1 -1
  72. package/dist/llm/server.js +1 -0
  73. package/dist/llm/token-counter.d.ts.map +1 -1
  74. package/dist/llm/workspace-provider-config.d.ts.map +1 -1
  75. package/dist/memory/agent/context-manager.d.ts.map +1 -1
  76. package/dist/memory/agent/index.d.ts.map +1 -1
  77. package/dist/memory/crdt/index.d.ts.map +1 -1
  78. package/dist/memory/crdt/lww-register.d.ts.map +1 -1
  79. package/dist/memory/crdt/or-set.d.ts.map +1 -1
  80. package/dist/memory/crdt/pn-counter.d.ts.map +1 -1
  81. package/dist/memory/crdt/vector-clock.d.ts.map +1 -1
  82. package/dist/memory/errors/index.d.ts.map +1 -1
  83. package/dist/memory/index.d.ts.map +1 -1
  84. package/dist/memory/persistence/crdt-persistence.d.ts.map +1 -1
  85. package/dist/memory/persistence/crdt-persistence.js +2 -5
  86. package/dist/memory/persistence/index.d.ts.map +1 -1
  87. package/dist/memory/preferences/index.d.ts.map +1 -1
  88. package/dist/memory/preferences/user-preferences-manager.d.ts.map +1 -1
  89. package/dist/memory/preferences/user-preferences-manager.js +10 -10
  90. package/dist/memory/services/index.d.ts.map +1 -1
  91. package/dist/memory/services/node-id-service.d.ts.map +1 -1
  92. package/dist/memory/stores/episodic-memory.d.ts.map +1 -1
  93. package/dist/memory/stores/episodic-memory.js +2 -1
  94. package/dist/memory/stores/index.d.ts.map +1 -1
  95. package/dist/memory/stores/procedural-memory.d.ts.map +1 -1
  96. package/dist/memory/stores/semantic-memory.d.ts.map +1 -1
  97. package/dist/memory/stores/working-memory.d.ts.map +1 -1
  98. package/dist/memory/utils/deep-clone.d.ts.map +1 -1
  99. package/dist/memory/utils/index.d.ts +0 -1
  100. package/dist/memory/utils/index.d.ts.map +1 -1
  101. package/dist/memory/utils/index.js +0 -1
  102. package/dist/memory/utils/sql-helpers.d.ts.map +1 -1
  103. package/dist/memory/utils/validation.d.ts.map +1 -1
  104. package/dist/memory/utils/validation.js +3 -1
  105. package/dist/memory/vector/index.d.ts.map +1 -1
  106. package/dist/memory/vector/vector-memory-service.d.ts +3 -0
  107. package/dist/memory/vector/vector-memory-service.d.ts.map +1 -1
  108. package/dist/memory/vector/vector-memory-service.js +18 -5
  109. package/dist/observability/logger.d.ts.map +1 -1
  110. package/dist/observability/metrics.d.ts.map +1 -1
  111. package/dist/observability/query.d.ts.map +1 -1
  112. package/dist/observability/types.d.ts.map +1 -1
  113. package/dist/orchestration/agent.d.ts.map +1 -1
  114. package/dist/orchestration/defaults.d.ts.map +1 -1
  115. package/dist/orchestration/memory-integration.d.ts.map +1 -1
  116. package/dist/orchestration/orchestrator.d.ts.map +1 -1
  117. package/dist/orchestration/runtime.d.ts +24 -0
  118. package/dist/orchestration/runtime.d.ts.map +1 -1
  119. package/dist/orchestration/runtime.js +67 -1
  120. package/dist/orchestration/streaming-runtime.d.ts.map +1 -1
  121. package/dist/orchestration/streaming-runtime.js +11 -4
  122. package/dist/orchestration/ticket-agent.d.ts.map +1 -1
  123. package/dist/orchestration/ticket-agent.js +3 -1
  124. package/dist/skills/activation/index.d.ts.map +1 -1
  125. package/dist/skills/activation/skill-activator.d.ts.map +1 -1
  126. package/dist/skills/catalog/catalog-search.d.ts.map +1 -1
  127. package/dist/skills/catalog/catalog-types.d.ts.map +1 -1
  128. package/dist/skills/catalog/index.d.ts.map +1 -1
  129. package/dist/skills/catalog/vercel-catalog.d.ts.map +1 -1
  130. package/dist/skills/compat/index.d.ts.map +1 -1
  131. package/dist/skills/compat/skill-enhancer.d.ts.map +1 -1
  132. package/dist/skills/compat/tool-mapper.d.ts.map +1 -1
  133. package/dist/skills/compat/vercel-compat.d.ts.map +1 -1
  134. package/dist/skills/index.d.ts.map +1 -1
  135. package/dist/skills/integration/agent-skill-provider.d.ts.map +1 -1
  136. package/dist/skills/integration/index.d.ts.map +1 -1
  137. package/dist/skills/loader/github-loader.d.ts.map +1 -1
  138. package/dist/skills/loader/github-loader.js +36 -17
  139. package/dist/skills/loader/index.d.ts.map +1 -1
  140. package/dist/skills/loader/local-loader.d.ts.map +1 -1
  141. package/dist/skills/loader/vercel-loader.d.ts.map +1 -1
  142. package/dist/skills/loader/vercel-loader.js +35 -17
  143. package/dist/skills/loader/vercel-types.d.ts.map +1 -1
  144. package/dist/skills/parser/index.d.ts.map +1 -1
  145. package/dist/skills/parser/skill-md-parser.d.ts.map +1 -1
  146. package/dist/skills/parser/skill-md-parser.js +2 -2
  147. package/dist/skills/registry/index.d.ts.map +1 -1
  148. package/dist/skills/registry/skill-registry.d.ts.map +1 -1
  149. package/dist/skills/types.d.ts.map +1 -1
  150. package/dist/templates/agent-spec.d.ts.map +1 -1
  151. package/dist/templates/index.d.ts.map +1 -1
  152. package/dist/templates/prompt-spec.d.ts.map +1 -1
  153. package/dist/templates/skill-spec.d.ts.map +1 -1
  154. package/dist/tools/base.d.ts +33 -0
  155. package/dist/tools/base.d.ts.map +1 -1
  156. package/dist/tools/cms/collection-tools.d.ts.map +1 -1
  157. package/dist/tools/cms/factory.d.ts.map +1 -1
  158. package/dist/tools/cms/global-tools.d.ts.map +1 -1
  159. package/dist/tools/cms/index.d.ts.map +1 -1
  160. package/dist/tools/cms/media-tools.d.ts.map +1 -1
  161. package/dist/tools/cms/user-tools.d.ts.map +1 -1
  162. package/dist/tools/coding/file-edit.d.ts +6 -0
  163. package/dist/tools/coding/file-edit.d.ts.map +1 -0
  164. package/dist/tools/coding/file-edit.js +73 -0
  165. package/dist/tools/coding/file-glob.d.ts +6 -0
  166. package/dist/tools/coding/file-glob.d.ts.map +1 -0
  167. package/dist/tools/coding/file-glob.js +120 -0
  168. package/dist/tools/coding/file-grep.d.ts +6 -0
  169. package/dist/tools/coding/file-grep.d.ts.map +1 -0
  170. package/dist/tools/coding/file-grep.js +194 -0
  171. package/dist/tools/coding/file-read.d.ts +6 -0
  172. package/dist/tools/coding/file-read.d.ts.map +1 -0
  173. package/dist/tools/coding/file-read.js +69 -0
  174. package/dist/tools/coding/file-write.d.ts +6 -0
  175. package/dist/tools/coding/file-write.d.ts.map +1 -0
  176. package/dist/tools/coding/file-write.js +49 -0
  177. package/dist/tools/coding/git-ops.d.ts +6 -0
  178. package/dist/tools/coding/git-ops.d.ts.map +1 -0
  179. package/dist/tools/coding/git-ops.js +102 -0
  180. package/dist/tools/coding/index.d.ts +40 -0
  181. package/dist/tools/coding/index.d.ts.map +1 -0
  182. package/dist/tools/coding/index.js +62 -0
  183. package/dist/tools/coding/lint-fix.d.ts +9 -0
  184. package/dist/tools/coding/lint-fix.d.ts.map +1 -0
  185. package/dist/tools/coding/lint-fix.js +256 -0
  186. package/dist/tools/coding/project-context.d.ts +6 -0
  187. package/dist/tools/coding/project-context.d.ts.map +1 -0
  188. package/dist/tools/coding/project-context.js +126 -0
  189. package/dist/tools/coding/safety.d.ts +26 -0
  190. package/dist/tools/coding/safety.d.ts.map +1 -0
  191. package/dist/tools/coding/safety.js +104 -0
  192. package/dist/tools/coding/shell-exec.d.ts +6 -0
  193. package/dist/tools/coding/shell-exec.d.ts.map +1 -0
  194. package/dist/tools/coding/shell-exec.js +79 -0
  195. package/dist/tools/coding/test-runner.d.ts +10 -0
  196. package/dist/tools/coding/test-runner.d.ts.map +1 -0
  197. package/dist/tools/coding/test-runner.js +214 -0
  198. package/dist/tools/deduplicator.d.ts.map +1 -1
  199. package/dist/tools/document-summarizer.d.ts.map +1 -1
  200. package/dist/tools/mcp-adapter.d.ts.map +1 -1
  201. package/dist/tools/memory/index.d.ts.map +1 -1
  202. package/dist/tools/memory/store-memory.d.ts.map +1 -1
  203. package/dist/tools/registry.d.ts.map +1 -1
  204. package/dist/tools/ticket-tools.d.ts.map +1 -1
  205. package/dist/tools/web/duck-duck-go.d.ts.map +1 -1
  206. package/dist/tools/web/exa.d.ts.map +1 -1
  207. package/dist/tools/web/index.d.ts.map +1 -1
  208. package/dist/tools/web/scraper.d.ts.map +1 -1
  209. package/dist/tools/web/tavily.d.ts.map +1 -1
  210. package/dist/tools/web/types.d.ts.map +1 -1
  211. package/package.json +38 -11
  212. package/dist/memory/utils/logger.d.ts +0 -21
  213. package/dist/memory/utils/logger.d.ts.map +0 -1
  214. package/dist/memory/utils/logger.js +0 -62
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Coding Tools Safety Module
3
+ * Path sandboxing and command denylist for secure tool execution
4
+ */
5
+ import { relative, resolve } from 'node:path';
6
+ const DEFAULT_SAFETY = {
7
+ allowedPaths: [],
8
+ extraDeniedCommands: [],
9
+ deniedPathPatterns: [
10
+ /\.env(?:\.|$)/,
11
+ /credentials?\.\w+$/,
12
+ /\.pem$/,
13
+ /\.key$/,
14
+ /id_(?:rsa|ed25519|ecdsa)/,
15
+ ],
16
+ };
17
+ // Commands that should never be executed by the agent
18
+ const DENIED_COMMANDS = [
19
+ // Destructive system commands
20
+ 'rm -rf /',
21
+ 'mkfs',
22
+ 'dd if=',
23
+ 'chmod -R 777',
24
+ // Network exfiltration
25
+ 'curl.*--upload',
26
+ 'wget.*--post',
27
+ 'nc -l',
28
+ 'ncat',
29
+ // Process/system manipulation
30
+ 'kill -9 1',
31
+ 'shutdown',
32
+ 'reboot',
33
+ 'systemctl',
34
+ // Package-level destruction
35
+ 'npm publish',
36
+ 'pnpm publish',
37
+ 'yarn publish',
38
+ // Git force operations
39
+ 'git push.*--force',
40
+ 'git reset --hard',
41
+ 'git clean -fd',
42
+ // Credential access
43
+ 'cat.*\\.env',
44
+ 'cat.*id_rsa',
45
+ 'cat.*credentials',
46
+ ];
47
+ // ---------------------------------------------------------------------------
48
+ // Path Validation
49
+ // ---------------------------------------------------------------------------
50
+ export function validatePath(filePath, config) {
51
+ const resolvedPath = resolve(config.projectRoot, filePath);
52
+ const rel = relative(config.projectRoot, resolvedPath);
53
+ // Must be within project root (no ../ escapes)
54
+ if (rel.startsWith('..') || resolve(resolvedPath) !== resolvedPath.replace(/\/$/, '')) {
55
+ // Check allowed paths
56
+ const allowed = config.allowedPaths ?? DEFAULT_SAFETY.allowedPaths;
57
+ const inAllowed = allowed.some((dir) => resolvedPath.startsWith(resolve(dir)));
58
+ if (!inAllowed) {
59
+ return { safe: false, reason: `Path escapes project root: ${filePath}` };
60
+ }
61
+ }
62
+ // Check denied path patterns
63
+ const deniedPatterns = [
64
+ ...DEFAULT_SAFETY.deniedPathPatterns,
65
+ ...(config.deniedPathPatterns ?? []),
66
+ ];
67
+ for (const pattern of deniedPatterns) {
68
+ if (pattern.test(filePath)) {
69
+ return { safe: false, reason: `Path matches denied pattern: ${filePath}` };
70
+ }
71
+ }
72
+ return { safe: true };
73
+ }
74
+ export function resolveSafePath(filePath, config) {
75
+ return resolve(config.projectRoot, filePath);
76
+ }
77
+ // ---------------------------------------------------------------------------
78
+ // Command Validation
79
+ // ---------------------------------------------------------------------------
80
+ export function validateCommand(command, config) {
81
+ const allDenied = [
82
+ ...DENIED_COMMANDS,
83
+ ...(config.extraDeniedCommands ?? DEFAULT_SAFETY.extraDeniedCommands),
84
+ ];
85
+ for (const pattern of allDenied) {
86
+ if (new RegExp(pattern, 'i').test(command)) {
87
+ return { safe: false, reason: `Command matches denied pattern: ${pattern}` };
88
+ }
89
+ }
90
+ return { safe: true };
91
+ }
92
+ // ---------------------------------------------------------------------------
93
+ // Shared Config Builder
94
+ // ---------------------------------------------------------------------------
95
+ let _activeConfig;
96
+ export function configureSafety(config) {
97
+ _activeConfig = config;
98
+ }
99
+ export function getSafetyConfig() {
100
+ if (!_activeConfig) {
101
+ throw new Error('Safety not configured. Call configureSafety() before using coding tools.');
102
+ }
103
+ return _activeConfig;
104
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * shell_exec — Sandboxed shell command execution
3
+ */
4
+ import type { Tool } from '../base.js';
5
+ export declare const shellExecTool: Tool;
6
+ //# sourceMappingURL=shell-exec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-exec.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/shell-exec.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AASnD,eAAO,MAAM,aAAa,EAAE,IAwF3B,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * shell_exec — Sandboxed shell command execution
3
+ */
4
+ import { execSync } from 'node:child_process';
5
+ import { z } from 'zod/v4';
6
+ import { getSafetyConfig, validateCommand } from './safety.js';
7
+ /** Default timeout: 30 seconds */
8
+ const DEFAULT_TIMEOUT_MS = 30_000;
9
+ /** Max output size: 100KB */
10
+ const MAX_OUTPUT_BYTES = 100 * 1024;
11
+ export const shellExecTool = {
12
+ name: 'shell_exec',
13
+ label: 'Run Command',
14
+ description: 'Execute a shell command in the project directory. Commands are validated against a safety denylist. Use for build scripts, test runners, package managers, and general automation.',
15
+ parameters: z.object({
16
+ command: z.string().describe('The shell command to execute'),
17
+ timeout: z
18
+ .number()
19
+ .optional()
20
+ .describe(`Timeout in milliseconds (default: ${DEFAULT_TIMEOUT_MS}, max: 300000)`),
21
+ cwd: z
22
+ .string()
23
+ .optional()
24
+ .describe('Working directory relative to project root (default: project root)'),
25
+ }),
26
+ async execute(params) {
27
+ const { command, timeout, cwd } = params;
28
+ const config = getSafetyConfig();
29
+ // Validate command against denylist
30
+ const check = validateCommand(command, config);
31
+ if (!check.safe) {
32
+ return { success: false, error: check.reason };
33
+ }
34
+ const timeoutMs = Math.min(timeout ?? DEFAULT_TIMEOUT_MS, 300_000);
35
+ const workDir = cwd ? `${config.projectRoot}/${cwd}` : config.projectRoot;
36
+ try {
37
+ const output = execSync(command, {
38
+ cwd: workDir,
39
+ timeout: timeoutMs,
40
+ maxBuffer: MAX_OUTPUT_BYTES,
41
+ encoding: 'utf8',
42
+ stdio: ['pipe', 'pipe', 'pipe'],
43
+ env: {
44
+ ...process.env,
45
+ // Prevent interactive prompts
46
+ CI: 'true',
47
+ FORCE_COLOR: '0',
48
+ },
49
+ });
50
+ const trimmed = output.trim();
51
+ const lines = trimmed.split('\n').length;
52
+ return {
53
+ success: true,
54
+ data: { command, exitCode: 0, output: trimmed },
55
+ content: trimmed.length > 2000
56
+ ? `Command succeeded (${lines} lines, truncated):\n${trimmed.slice(0, 2000)}…`
57
+ : `Command succeeded:\n${trimmed}`,
58
+ };
59
+ }
60
+ catch (err) {
61
+ const execErr = err;
62
+ if (execErr.killed) {
63
+ return {
64
+ success: false,
65
+ error: `Command timed out after ${timeoutMs}ms: ${command}`,
66
+ };
67
+ }
68
+ const stdout = (execErr.stdout ?? '').toString().trim();
69
+ const stderr = (execErr.stderr ?? '').toString().trim();
70
+ const combined = [stdout, stderr].filter(Boolean).join('\n');
71
+ const exitCode = execErr.status ?? 1;
72
+ return {
73
+ success: false,
74
+ data: { command, exitCode, stdout, stderr },
75
+ error: `Command failed (exit ${exitCode}):\n${combined.slice(0, 2000)}`,
76
+ };
77
+ }
78
+ },
79
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * test_runner — Run tests and return structured results
3
+ *
4
+ * Detects the test framework (Vitest, Jest, Mocha) and runs tests with
5
+ * machine-parseable output. Returns structured pass/fail/skip counts
6
+ * and failure details.
7
+ */
8
+ import type { Tool } from '../base.js';
9
+ export declare const testRunnerTool: Tool;
10
+ //# sourceMappingURL=test-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-runner.d.ts","sourceRoot":"","sources":["../../../src/tools/coding/test-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAqJnD,eAAO,MAAM,cAAc,EAAE,IA0G5B,CAAC"}
@@ -0,0 +1,214 @@
1
+ /**
2
+ * test_runner — Run tests and return structured results
3
+ *
4
+ * Detects the test framework (Vitest, Jest, Mocha) and runs tests with
5
+ * machine-parseable output. Returns structured pass/fail/skip counts
6
+ * and failure details.
7
+ */
8
+ import { execSync } from 'node:child_process';
9
+ import { existsSync } from 'node:fs';
10
+ import { join } from 'node:path';
11
+ import { z } from 'zod/v4';
12
+ import { getSafetyConfig } from './safety.js';
13
+ /** Default timeout: 120 seconds (tests can be slow) */
14
+ const DEFAULT_TIMEOUT_MS = 120_000;
15
+ /** Max output: 200KB */
16
+ const MAX_OUTPUT_BYTES = 200 * 1024;
17
+ function detectFramework(projectRoot) {
18
+ const pkgPath = join(projectRoot, 'package.json');
19
+ if (!existsSync(pkgPath))
20
+ return 'unknown';
21
+ try {
22
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
23
+ const pkg = JSON.parse(execSync(`cat "${pkgPath}"`, { encoding: 'utf8', timeout: 5000 }));
24
+ const deps = {
25
+ ...pkg.dependencies,
26
+ ...pkg.devDependencies,
27
+ };
28
+ if (deps.vitest)
29
+ return 'vitest';
30
+ if (deps.jest || deps['@jest/core'])
31
+ return 'jest';
32
+ if (deps.mocha)
33
+ return 'mocha';
34
+ }
35
+ catch {
36
+ // Fall through
37
+ }
38
+ return 'unknown';
39
+ }
40
+ function buildCommand(framework, file, grep) {
41
+ const fileArg = file ? ` ${file}` : '';
42
+ const grepArg = grep ? ` -t "${grep}"` : '';
43
+ switch (framework) {
44
+ case 'vitest':
45
+ return `npx vitest run${fileArg}${grep ? ` --reporter=verbose` : ''} --no-color`;
46
+ case 'jest':
47
+ return `npx jest${fileArg}${grepArg} --no-color --forceExit`;
48
+ case 'mocha':
49
+ return `npx mocha${fileArg}${grepArg} --no-color`;
50
+ default:
51
+ // Try pnpm test as fallback
52
+ return `pnpm test${fileArg ? ` -- ${fileArg.trim()}` : ''}`;
53
+ }
54
+ }
55
+ function parseVitestOutput(output) {
56
+ const failures = [];
57
+ // Parse "Tests X passed | Y failed | Z skipped (W)"
58
+ const summaryMatch = output.match(/Tests\s+(?:(\d+)\s+passed)?[^(]*?(?:(\d+)\s+failed)?[^(]*?(?:(\d+)\s+skipped)?[^(]*?\((\d+)\)/);
59
+ const passed = summaryMatch ? Number.parseInt(summaryMatch[1] ?? '0', 10) : 0;
60
+ const failed = summaryMatch ? Number.parseInt(summaryMatch[2] ?? '0', 10) : 0;
61
+ const skipped = summaryMatch ? Number.parseInt(summaryMatch[3] ?? '0', 10) : 0;
62
+ const total = summaryMatch
63
+ ? Number.parseInt(summaryMatch[4] ?? '0', 10)
64
+ : passed + failed + skipped;
65
+ // Parse duration
66
+ const durationMatch = output.match(/Duration\s+([\d.]+s)/);
67
+ const duration = durationMatch?.[1];
68
+ // Parse failure details: "FAIL path/to/file.test.ts > suite > test name"
69
+ const failureBlocks = output.split(/(?=FAIL\s)/);
70
+ for (const block of failureBlocks) {
71
+ const headerMatch = block.match(/FAIL\s+(.+?)(?:\s+>\s+(.+))?$/m);
72
+ if (headerMatch) {
73
+ const file = headerMatch[1]?.trim();
74
+ const name = headerMatch[2]?.trim() ?? file ?? 'unknown';
75
+ // Extract assertion/error message
76
+ const errorMatch = block.match(/(?:AssertionError|Error|Expected|Received).*$/m);
77
+ const message = errorMatch?.[0]?.trim() ?? 'Test failed';
78
+ failures.push({ name, file, message: message.slice(0, 300) });
79
+ }
80
+ }
81
+ return { passed, failed, skipped, total, duration, failures };
82
+ }
83
+ function parseGenericOutput(output) {
84
+ const failures = [];
85
+ // Try common patterns
86
+ const passMatch = output.match(/(\d+)\s+(?:passing|passed)/i);
87
+ const failMatch = output.match(/(\d+)\s+(?:failing|failed)/i);
88
+ const skipMatch = output.match(/(\d+)\s+(?:skipped|pending)/i);
89
+ const passed = passMatch ? Number.parseInt(passMatch[1] ?? '0', 10) : 0;
90
+ const failed = failMatch ? Number.parseInt(failMatch[1] ?? '0', 10) : 0;
91
+ const skipped = skipMatch ? Number.parseInt(skipMatch[1] ?? '0', 10) : 0;
92
+ // Extract failure lines
93
+ const lines = output.split('\n');
94
+ let inFailure = false;
95
+ let currentFailure = {};
96
+ for (const line of lines) {
97
+ if (/(?:FAIL|✗|✕|×)\s+/.test(line)) {
98
+ if (currentFailure.name) {
99
+ failures.push({
100
+ name: currentFailure.name,
101
+ file: currentFailure.file,
102
+ message: currentFailure.message ?? 'Test failed',
103
+ });
104
+ }
105
+ inFailure = true;
106
+ currentFailure = { name: line.trim().slice(0, 200) };
107
+ }
108
+ else if (inFailure && /(?:Error|Expected|Received|assert)/i.test(line)) {
109
+ currentFailure.message = line.trim().slice(0, 300);
110
+ inFailure = false;
111
+ }
112
+ }
113
+ if (currentFailure.name) {
114
+ failures.push({
115
+ name: currentFailure.name,
116
+ file: currentFailure.file,
117
+ message: currentFailure.message ?? 'Test failed',
118
+ });
119
+ }
120
+ return {
121
+ passed,
122
+ failed,
123
+ skipped,
124
+ total: passed + failed + skipped,
125
+ failures,
126
+ };
127
+ }
128
+ export const testRunnerTool = {
129
+ name: 'test_runner',
130
+ label: 'Run Tests',
131
+ description: 'Run tests and return structured results with pass/fail counts and failure details. Auto-detects the test framework (Vitest, Jest, Mocha). Can run all tests or target a specific file.',
132
+ parameters: z.object({
133
+ file: z
134
+ .string()
135
+ .optional()
136
+ .describe('Specific test file or pattern to run (e.g., "src/__tests__/auth.test.ts")'),
137
+ grep: z.string().optional().describe('Filter tests by name pattern'),
138
+ timeout: z
139
+ .number()
140
+ .optional()
141
+ .describe(`Timeout in milliseconds (default: ${DEFAULT_TIMEOUT_MS}, max: 300000)`),
142
+ }),
143
+ async execute(params) {
144
+ const { file, grep, timeout } = params;
145
+ const config = getSafetyConfig();
146
+ const timeoutMs = Math.min(timeout ?? DEFAULT_TIMEOUT_MS, 300_000);
147
+ const framework = detectFramework(config.projectRoot);
148
+ const command = buildCommand(framework, file, grep);
149
+ let stdout = '';
150
+ let stderr = '';
151
+ let exitCode = 0;
152
+ try {
153
+ stdout = execSync(command, {
154
+ cwd: config.projectRoot,
155
+ timeout: timeoutMs,
156
+ maxBuffer: MAX_OUTPUT_BYTES,
157
+ encoding: 'utf8',
158
+ stdio: ['pipe', 'pipe', 'pipe'],
159
+ env: {
160
+ ...process.env,
161
+ CI: 'true',
162
+ FORCE_COLOR: '0',
163
+ NODE_OPTIONS: '--experimental-vm-modules',
164
+ },
165
+ });
166
+ }
167
+ catch (err) {
168
+ const execErr = err;
169
+ if (execErr.killed || execErr.signal === 'SIGTERM') {
170
+ return {
171
+ success: false,
172
+ error: `Tests timed out after ${timeoutMs}ms`,
173
+ data: {
174
+ framework,
175
+ command,
176
+ exitCode: -1,
177
+ summary: { passed: 0, failed: 0, skipped: 0, total: 0, failures: [] },
178
+ },
179
+ };
180
+ }
181
+ exitCode = execErr.status ?? 1;
182
+ stdout = (execErr.stdout ?? '').toString();
183
+ stderr = (execErr.stderr ?? '').toString();
184
+ }
185
+ const combined = [stdout, stderr].filter(Boolean).join('\n');
186
+ // Parse results
187
+ const summary = framework === 'vitest' ? parseVitestOutput(combined) : parseGenericOutput(combined);
188
+ // Build token-efficient content for LLM
189
+ const statusIcon = summary.failed > 0 ? '✗' : '✓';
190
+ const lines = [
191
+ `${statusIcon} Tests: ${summary.passed} passed, ${summary.failed} failed, ${summary.skipped} skipped (${summary.total} total)`,
192
+ ];
193
+ if (summary.duration)
194
+ lines.push(`Duration: ${summary.duration}`);
195
+ if (file)
196
+ lines.push(`File: ${file}`);
197
+ lines.push(`Framework: ${framework}`);
198
+ if (summary.failures.length > 0) {
199
+ lines.push('', 'Failures:');
200
+ for (const f of summary.failures.slice(0, 10)) {
201
+ lines.push(` ${f.file ? `${f.file}: ` : ''}${f.name}`);
202
+ lines.push(` ${f.message}`);
203
+ }
204
+ if (summary.failures.length > 10) {
205
+ lines.push(` ... and ${summary.failures.length - 10} more`);
206
+ }
207
+ }
208
+ return {
209
+ success: summary.failed === 0,
210
+ data: { framework, command, exitCode, summary },
211
+ content: lines.join('\n'),
212
+ };
213
+ },
214
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"deduplicator.d.ts","sourceRoot":"","sources":["../../src/tools/deduplicator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AA8B3C,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,KAAK,CAAqC;IAElD,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;IAIvD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS;IAIpE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI;IAInE,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
1
+ {"version":3,"file":"deduplicator.d.ts","sourceRoot":"","sources":["../../src/tools/deduplicator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA8B5C,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,KAAK,CAAsC;IAEnD,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;IAIvD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS;IAIpE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI;IAInE,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"document-summarizer.d.ts","sourceRoot":"","sources":["../../src/tools/document-summarizer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAGnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,WAAW,CAAA;AAUjD,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CA8EtF"}
1
+ {"version":3,"file":"document-summarizer.d.ts","sourceRoot":"","sources":["../../src/tools/document-summarizer.ts"],"names":[],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Q,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAuB9E;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,GACvC,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAa1D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,EAAE,CAkC9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/memory/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/memory/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"store-memory.d.ts","sourceRoot":"","sources":["../../../src/tools/memory/store-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAA;AAElD,QAAA,MAAM,uBAAuB;;;;iBAI3B,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEvE;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAkEnF"}
1
+ {"version":3,"file":"store-memory.d.ts","sourceRoot":"","sources":["../../../src/tools/memory/store-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAEnD,QAAA,MAAM,uBAAuB;;;;iBAI3B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAkEnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEjD,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAA+B;IAE5C,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAO1B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAInC,MAAM,IAAI,IAAI,EAAE;IAIhB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,kBAAkB,IAAI,cAAc,EAAE;IAWhC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;CAgBlE;AAED,eAAO,MAAM,kBAAkB,cAAqB,CAAA"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAElD,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAgC;IAE7C,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAO1B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAInC,MAAM,IAAI,IAAI,EAAE;IAIhB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,kBAAkB,IAAI,cAAc,EAAE;IAWhC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;CAgBlE;AAED,eAAO,MAAM,kBAAkB,cAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ticket-tools.d.ts","sourceRoot":"","sources":["../../src/tools/ticket-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,WAAW,CAAA;AAEjD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,YAAY,CACV,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;QACJ,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,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M,EAAE,oBAAoB,GAAG,IAAI,EAAE,CAgExF"}
@@ -1 +1 @@
1
- {"version":3,"file":"duck-duck-go.d.ts","sourceRoot":"","sources":["../../../src/tools/web/duck-duck-go.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAA;AAiCvF;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,iBAAiB;IAC1D,QAAQ,CAAC,IAAI,gBAAe;IAEtB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAwD5E;AAiBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CA8CrE;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,EAAE,IA+C3B,CAAA"}
1
+ {"version":3,"file":"duck-duck-go.d.ts","sourceRoot":"","sources":["../../../src/tools/web/duck-duck-go.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAC;AA0BxF;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,iBAAiB;IAC1D,QAAQ,CAAC,IAAI,gBAAgB;IAEvB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAwD5E;AAiBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CA8CrE;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,EAAE,IA+C3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"exa.d.ts","sourceRoot":"","sources":["../../../src/tools/web/exa.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAA;AAsBvF;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,WAAY,YAAW,iBAAiB;IACnD,QAAQ,CAAC,IAAI,SAAQ;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;gBAEnB,MAAM,EAAE,MAAM;IAKpB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA+C5E"}
1
+ {"version":3,"file":"exa.d.ts","sourceRoot":"","sources":["../../../src/tools/web/exa.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAC;AAsBxF;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,WAAY,YAAW,iBAAiB;IACnD,QAAQ,CAAC,IAAI,SAAS;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,MAAM,EAAE,MAAM;IAKpB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA+C5E"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/web/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/web/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"scraper.d.ts","sourceRoot":"","sources":["../../../src/tools/web/scraper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAA;AA+ClD,eAAO,MAAM,cAAc,EAAE,IAwE5B,CAAA"}
1
+ {"version":3,"file":"scraper.d.ts","sourceRoot":"","sources":["../../../src/tools/web/scraper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AA+CnD,eAAO,MAAM,cAAc,EAAE,IAwE5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tavily.d.ts","sourceRoot":"","sources":["../../../src/tools/web/tavily.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAA;AAsBvF;;;;;;;;;;;;;;GAcG;AACH,qBAAa,cAAe,YAAW,iBAAiB;IACtD,QAAQ,CAAC,IAAI,YAAW;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;gBAEnB,MAAM,EAAE,MAAM;IAKpB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA0C5E"}
1
+ {"version":3,"file":"tavily.d.ts","sourceRoot":"","sources":["../../../src/tools/web/tavily.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAC;AAsBxF;;;;;;;;;;;;;;GAcG;AACH,qBAAa,cAAe,YAAW,iBAAiB;IACtD,QAAQ,CAAC,IAAI,YAAY;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,MAAM,EAAE,MAAM;IAKpB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA0C5E"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/web/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;CACtE"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/web/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACvE"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@revealui/ai",
3
- "version": "0.1.3",
4
- "description": "AI system for RevealUI - memory, LLM, orchestration, and tools",
3
+ "version": "0.2.2",
4
+ "description": "[Pro] AI system for RevealUI - memory, LLM, orchestration, and tools",
5
5
  "keywords": [
6
6
  "agent",
7
7
  "ai",
@@ -16,22 +16,27 @@
16
16
  "tools",
17
17
  "vector-search"
18
18
  ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/RevealUIStudio/revealui.git",
22
+ "directory": "packages/ai"
23
+ },
19
24
  "license": "SEE LICENSE IN ../../LICENSE.commercial",
20
25
  "dependencies": {
21
26
  "lru-cache": "^11.2.5",
22
27
  "zod": "^4.3.5",
23
- "@revealui/db": "^0.2.0",
24
- "@revealui/core": "0.2.1",
25
- "@revealui/contracts": "1.1.0"
28
+ "@revealui/core": "0.5.0",
29
+ "@revealui/db": "0.3.1",
30
+ "@revealui/contracts": "1.3.1"
26
31
  },
27
32
  "devDependencies": {
28
33
  "@testing-library/react": "^16.3.2",
29
34
  "@testing-library/react-hooks": "^8.0.1",
30
35
  "@vitest/coverage-v8": "^4.0.18",
31
- "jsdom": "^27.4.0",
36
+ "jsdom": "^29.0.1",
32
37
  "react": "^19.2.3",
33
38
  "react-dom": "^19.2.3",
34
- "typescript": "^5.9.3",
39
+ "typescript": "^6.0.2",
35
40
  "vitest": "^4.0.18",
36
41
  "dev": "0.0.1"
37
42
  },
@@ -111,29 +116,51 @@
111
116
  "./orchestration/agent": {
112
117
  "types": "./dist/orchestration/agent.d.ts",
113
118
  "import": "./dist/orchestration/agent.js"
119
+ },
120
+ "./tools/coding": {
121
+ "types": "./dist/tools/coding/index.d.ts",
122
+ "import": "./dist/tools/coding/index.js"
123
+ },
124
+ "./inference": {
125
+ "types": "./dist/inference/index.d.ts",
126
+ "import": "./dist/inference/index.js"
127
+ },
128
+ "./inference/context-budget": {
129
+ "types": "./dist/inference/context-budget.d.ts",
130
+ "import": "./dist/inference/context-budget.js"
131
+ },
132
+ "./inference/tool-result-compressor": {
133
+ "types": "./dist/inference/tool-result-compressor.d.ts",
134
+ "import": "./dist/inference/tool-result-compressor.js"
135
+ },
136
+ "./inference/task-decomposer": {
137
+ "types": "./dist/inference/task-decomposer.d.ts",
138
+ "import": "./dist/inference/task-decomposer.js"
114
139
  }
115
140
  },
116
141
  "files": [
117
142
  "dist"
118
143
  ],
144
+ "funding": {
145
+ "type": "commercial",
146
+ "url": "https://revealui.com/pro"
147
+ },
119
148
  "main": "./dist/index.js",
120
149
  "module": "./dist/index.js",
121
150
  "peerDependencies": {
122
151
  "drizzle-orm": "^0.45.1",
123
152
  "react": "^18.0.0 || ^19.0.0"
124
153
  },
125
- "type": "module",
126
- "types": "./dist/index.d.ts",
127
154
  "publishConfig": {
128
- "registry": "https://registry.npmjs.org",
129
155
  "access": "public"
130
156
  },
157
+ "type": "module",
158
+ "types": "./dist/index.d.ts",
131
159
  "scripts": {
132
160
  "build": "tsc",
133
161
  "clean": "rm -rf dist",
134
162
  "dev": "tsc --watch",
135
163
  "lint": "biome check .",
136
- "lint:eslint": "eslint .",
137
164
  "test": "vitest run",
138
165
  "test:coverage": "vitest run --coverage",
139
166
  "test:integration": "vitest run --root . --config vitest.integration.config.ts",
@@ -1,21 +0,0 @@
1
- /**
2
- * Simple Logger Utility
3
- *
4
- * Provides a minimal logging interface that can be easily replaced
5
- * with a proper logging service later. Respects environment and log levels.
6
- */
7
- export interface Logger {
8
- info: (...args: unknown[]) => void;
9
- warn: (...args: unknown[]) => void;
10
- error: (...args: unknown[]) => void;
11
- debug: (...args: unknown[]) => void;
12
- }
13
- /**
14
- * Creates a logger instance with optional prefix
15
- */
16
- export declare function createLogger(prefix?: string): Logger;
17
- /**
18
- * Default logger instance
19
- */
20
- export declare const defaultLogger: Logger;
21
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/memory/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IAClC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IAClC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;CACpC;AA0DD;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAAqC,CAAA"}