@revealui/ai 0.5.0 → 0.5.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.
package/README.md CHANGED
@@ -322,10 +322,8 @@ Agent runtime and execution engine for autonomous agents.
322
322
 
323
323
  ```typescript
324
324
  import { AgentRuntime } from '@revealui/ai/orchestration/runtime'
325
- import { AgentOrchestrator } from '@revealui/ai/orchestration/orchestrator'
326
325
 
327
326
  const runtime = new AgentRuntime()
328
- const orchestrator = new AgentOrchestrator()
329
327
  ```
330
328
 
331
329
  ### Tools
@@ -334,10 +332,8 @@ Tool registry and execution system with MCP integration.
334
332
 
335
333
  ```typescript
336
334
  import { ToolRegistry } from '@revealui/ai/tools/registry'
337
- import { registerMCPTools } from '@revealui/ai/tools/mcp-adapter'
338
335
 
339
336
  const registry = new ToolRegistry()
340
- await registerMCPTools(mcpClient, registry)
341
337
  ```
342
338
 
343
339
  ## Performance Considerations
@@ -477,13 +473,13 @@ Potential optimizations (not yet implemented):
477
473
 
478
474
  ## Requirements
479
475
 
480
- - Node.js 18+
476
+ - Node.js 24.13.0 or higher
481
477
  - PostgreSQL with pgvector extension
482
478
  - Neon Postgres (for production) or compatible database
483
479
 
484
480
  ## License
485
481
 
486
- Commercial - see [LICENSE.commercial](../../LICENSE.commercial)
482
+ FSL-1.1-MIT (Fair Source — converts to MIT after 2 years). See [LICENSE](../../LICENSE).
487
483
 
488
484
  ---
489
485
 
@@ -1 +1 @@
1
- {"version":3,"file":"rag-vector-service.d.ts","sourceRoot":"","sources":["../../src/ingestion/rag-vector-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAIrE,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB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Ac,EAAE,MAAM,EAAE,EACxB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,EAAE,CAAC;IA8E7B;;OAEG;IACG,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAOnE"}
@@ -4,14 +4,14 @@
4
4
  * Semantic similarity search over rag_chunks using pgvector cosine distance.
5
5
  * Modeled after VectorMemoryService - same Drizzle cosine-distance pattern.
6
6
  */
7
- import { getVectorClient } from '@revealui/db/client';
7
+ import { getRestClient } from '@revealui/db/client';
8
8
  import { ragChunks, ragDocuments } from '@revealui/db/schema/rag';
9
9
  import { and, asc, eq, sql } from 'drizzle-orm';
10
10
  export class RagVectorService {
11
11
  _db = null;
12
12
  get db() {
13
13
  if (!this._db) {
14
- this._db = getVectorClient();
14
+ this._db = getRestClient();
15
15
  }
16
16
  return this._db;
17
17
  }
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Vector Memory Service
3
3
  *
4
- * Service for managing agent memories in Supabase with vector search capabilities.
5
- * Uses pgvector for semantic similarity search.
4
+ * Service for managing agent memories with vector search capabilities.
5
+ * Uses pgvector for semantic similarity search on the single Neon-primary database.
6
6
  *
7
7
  * @example
8
8
  * ```typescript
@@ -30,13 +30,11 @@ export interface VectorSearchResult {
30
30
  */
31
31
  export declare class VectorMemoryService {
32
32
  private _db;
33
- private _restDb;
34
33
  /**
35
34
  * Lazy-load database client to avoid connection initialization at module import time.
36
35
  * This allows the module to be imported in test environments without triggering database connections.
37
36
  */
38
37
  private get db();
39
- /** Lazy-load REST client for cross-DB reference validation. */
40
38
  private get restDb();
41
39
  /**
42
40
  * Search for similar memories using vector similarity.
@@ -1 +1 @@
1
- {"version":3,"file":"vector-memory-service.d.ts","sourceRoot":"","sources":["../../../src/memory/vector/vector-memory-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;A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E,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CA8CvD"}
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Vector Memory Service
3
3
  *
4
- * Service for managing agent memories in Supabase with vector search capabilities.
5
- * Uses pgvector for semantic similarity search.
4
+ * Service for managing agent memories with vector search capabilities.
5
+ * Uses pgvector for semantic similarity search on the single Neon-primary database.
6
6
  *
7
7
  * @example
8
8
  * ```typescript
@@ -12,7 +12,7 @@
12
12
  * const memories = await service.searchSimilar(embedding, { siteId: 'site-123', limit: 10 })
13
13
  * ```
14
14
  */
15
- import { getRestClient, getVectorClient } from '@revealui/db/client';
15
+ import { getRestClient } from '@revealui/db/client';
16
16
  import { agentMemories } from '@revealui/db/schema';
17
17
  import { assertCrossDbRefs, safeVectorInsert } from '@revealui/db/validation';
18
18
  import { and, eq, sql } from 'drizzle-orm';
@@ -21,23 +21,18 @@ import { and, eq, sql } from 'drizzle-orm';
21
21
  */
22
22
  export class VectorMemoryService {
23
23
  _db = null;
24
- _restDb = null;
25
24
  /**
26
25
  * Lazy-load database client to avoid connection initialization at module import time.
27
26
  * This allows the module to be imported in test environments without triggering database connections.
28
27
  */
29
28
  get db() {
30
29
  if (!this._db) {
31
- this._db = getVectorClient();
30
+ this._db = getRestClient();
32
31
  }
33
32
  return this._db;
34
33
  }
35
- /** Lazy-load REST client for cross-DB reference validation. */
36
34
  get restDb() {
37
- if (!this._restDb) {
38
- this._restDb = getRestClient();
39
- }
40
- return this._restDb;
35
+ return this.db;
41
36
  }
42
37
  /**
43
38
  * Search for similar memories using vector similarity.
@@ -1 +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;AA2JnD,eAAO,MAAM,cAAc,EAAE,IA0G5B,CAAC"}
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;AAqOnD,eAAO,MAAM,cAAc,EAAE,IAsF5B,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * machine-parseable output. Returns structured pass/fail/skip counts
6
6
  * and failure details.
7
7
  */
8
- import { execSync } from 'node:child_process';
8
+ import { spawn } from 'node:child_process';
9
9
  import { existsSync, readFileSync } from 'node:fs';
10
10
  import { join } from 'node:path';
11
11
  import { z } from 'zod/v4';
@@ -130,6 +130,68 @@ function parseGenericOutput(output) {
130
130
  failures,
131
131
  };
132
132
  }
133
+ /**
134
+ * Run a shell command with a hard timeout, killing the ENTIRE process tree on
135
+ * timeout — not just the direct child.
136
+ *
137
+ * `execSync`'s timeout sends its kill signal only to the immediate child (the
138
+ * shell), so a grandchild (e.g. `pnpm test` → `node …`) is orphaned and keeps
139
+ * running. For a test runner that an agent points at a hanging suite, that
140
+ * leaks a process on every timeout. Spawning detached gives the child its own
141
+ * process group; killing the negative pid (`-pgid`) reaps the whole tree.
142
+ */
143
+ function runCommand(command, opts) {
144
+ return new Promise((resolve) => {
145
+ const child = spawn(command, {
146
+ cwd: opts.cwd,
147
+ env: opts.env,
148
+ shell: true,
149
+ detached: true, // own process group so the whole tree is killable
150
+ stdio: ['ignore', 'pipe', 'pipe'],
151
+ });
152
+ let stdout = '';
153
+ let stderr = '';
154
+ let stdoutBytes = 0;
155
+ let stderrBytes = 0;
156
+ let timedOut = false;
157
+ let settled = false;
158
+ const killTree = (signal) => {
159
+ if (child.pid === undefined)
160
+ return;
161
+ try {
162
+ // Negative pid targets the process group (created by `detached: true`).
163
+ process.kill(-child.pid, signal);
164
+ }
165
+ catch {
166
+ // Group already exited — nothing to kill.
167
+ }
168
+ };
169
+ const timer = setTimeout(() => {
170
+ timedOut = true;
171
+ killTree('SIGKILL');
172
+ }, opts.timeoutMs);
173
+ child.stdout?.on('data', (chunk) => {
174
+ stdoutBytes += chunk.length;
175
+ if (stdoutBytes <= opts.maxBuffer)
176
+ stdout += chunk.toString('utf8');
177
+ });
178
+ child.stderr?.on('data', (chunk) => {
179
+ stderrBytes += chunk.length;
180
+ if (stderrBytes <= opts.maxBuffer)
181
+ stderr += chunk.toString('utf8');
182
+ });
183
+ const finish = (exitCode) => {
184
+ if (settled)
185
+ return;
186
+ settled = true;
187
+ clearTimeout(timer);
188
+ resolve({ stdout, stderr, exitCode, timedOut });
189
+ };
190
+ // `error` fires when the command can't be spawned (e.g. binary not found).
191
+ child.on('error', () => finish(127));
192
+ child.on('close', (code) => finish(code ?? 0));
193
+ });
194
+ }
133
195
  export const testRunnerTool = {
134
196
  name: 'test_runner',
135
197
  label: 'Run Tests',
@@ -151,41 +213,28 @@ export const testRunnerTool = {
151
213
  const timeoutMs = Math.min(timeout ?? DEFAULT_TIMEOUT_MS, 300_000);
152
214
  const framework = detectFramework(config.projectRoot);
153
215
  const command = buildCommand(framework, file, grep);
154
- let stdout = '';
155
- let stderr = '';
156
- let exitCode = 0;
157
- try {
158
- stdout = execSync(command, {
159
- cwd: config.projectRoot,
160
- timeout: timeoutMs,
161
- maxBuffer: MAX_OUTPUT_BYTES,
162
- encoding: 'utf8',
163
- stdio: ['pipe', 'pipe', 'pipe'],
164
- env: {
165
- ...process.env,
166
- CI: 'true',
167
- FORCE_COLOR: '0',
168
- NODE_OPTIONS: '--experimental-vm-modules',
216
+ const { stdout, stderr, exitCode, timedOut } = await runCommand(command, {
217
+ cwd: config.projectRoot,
218
+ timeoutMs,
219
+ maxBuffer: MAX_OUTPUT_BYTES,
220
+ env: {
221
+ ...process.env,
222
+ CI: 'true',
223
+ FORCE_COLOR: '0',
224
+ NODE_OPTIONS: '--experimental-vm-modules',
225
+ },
226
+ });
227
+ if (timedOut) {
228
+ return {
229
+ success: false,
230
+ error: `Tests timed out after ${timeoutMs}ms`,
231
+ data: {
232
+ framework,
233
+ command,
234
+ exitCode: -1,
235
+ summary: { passed: 0, failed: 0, skipped: 0, total: 0, failures: [] },
169
236
  },
170
- });
171
- }
172
- catch (err) {
173
- const execErr = err;
174
- if (execErr.killed || execErr.signal === 'SIGTERM') {
175
- return {
176
- success: false,
177
- error: `Tests timed out after ${timeoutMs}ms`,
178
- data: {
179
- framework,
180
- command,
181
- exitCode: -1,
182
- summary: { passed: 0, failed: 0, skipped: 0, total: 0, failures: [] },
183
- },
184
- };
185
- }
186
- exitCode = execErr.status ?? 1;
187
- stdout = (execErr.stdout ?? '').toString();
188
- stderr = (execErr.stderr ?? '').toString();
237
+ };
189
238
  }
190
239
  const combined = [stdout, stderr].filter(Boolean).join('\n');
191
240
  // Parse results
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revealui/ai",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "AI runtime for agent-driven products — agents, memory, LLM providers (Inference Snaps, Ollama, OpenAI-compatible), tools, and orchestration. Anthropic-SDK-free.",
5
5
  "keywords": [
6
6
  "agent",
@@ -23,15 +23,15 @@
23
23
  },
24
24
  "license": "FSL-1.1-MIT",
25
25
  "dependencies": {
26
- "lru-cache": "^11.3.6",
27
- "zod": "^4.3.6",
28
- "@revealui/contracts": "0.5.0",
29
- "@revealui/core": "0.7.0",
30
- "@revealui/db": "0.5.0",
26
+ "lru-cache": "^11.5.0",
27
+ "zod": "^4.4.3",
28
+ "@revealui/contracts": "0.6.0",
29
+ "@revealui/core": "0.9.0",
30
+ "@revealui/db": "0.7.0",
31
31
  "@revealui/resilience": "0.2.4"
32
32
  },
33
33
  "devDependencies": {
34
- "@electric-sql/pglite": "^0.4.4",
34
+ "@electric-sql/pglite": "^0.4.5",
35
35
  "@testing-library/react": "^16.3.2",
36
36
  "@vitest/coverage-v8": "^4.1.5",
37
37
  "jsdom": "29.1.1",