🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
wip(memory): agentdb alpha.20 floor + sql.js lock/concurrency guard
r01fa240e7cc0
diff --git a/package-lock.json b/package-lock.jsonindex e8beb47412..fe8669cffe 100644--- a/package-lock.json+++ b/package-lock.json@@ -75,7 +75,7 @@"@ruvector/router": "^0.1.31","@ruvector/router-linux-x64-gnu": "^0.1.31","@ruvector/sona": "^0.1.5",- "agentdb": "^3.0.0-alpha.17",+ "agentdb": "^3.0.0-alpha.20","agentic-flow": "^2.0.14","better-sqlite3": "12.9.0"}@@ -177,7 +177,7 @@],"dependencies": {"@claude-flow/security": "^3.0.0",- "agentdb": "^3.0.0-alpha.17",+ "agentdb": "^3.0.0-alpha.20","sql.js": "^1.10.3"},"optionalDependencies": {diff --git a/package.json b/package.jsonindex 25aab9dd17..7cb8621df5 100644--- a/package.json+++ b/package.json@@ -101,7 +101,7 @@"@ruvector/router": "^0.1.31","@ruvector/router-linux-x64-gnu": "^0.1.31","@ruvector/sona": "^0.1.5",- "agentdb": "^3.0.0-alpha.17",+ "agentdb": "^3.0.0-alpha.20","agentic-flow": "^2.0.14","better-sqlite3": "12.9.0"},diff --git a/ruflo/package.json b/ruflo/package.jsonindex 14316fb16a..5269af5843 100644--- a/ruflo/package.json+++ b/ruflo/package.json@@ -72,7 +72,7 @@"@opentelemetry/otlp-exporter-base": ">=0.220.0","@opentelemetry/otlp-grpc-exporter-base": ">=0.220.0","@opentelemetry/otlp-transformer": ">=0.220.0",- "agentdb": ">=3.0.0-alpha.17",+ "agentdb": ">=3.0.0-alpha.20","agentic-flow": ">=2.0.14","@ruvector/ruvllm": ">=2.6.0","fast-uri": ">=3.1.6"diff --git a/v3/@claude-flow/cli/__tests__/memory-bridge-agentdb-lock.test.ts b/v3/@claude-flow/cli/__tests__/memory-bridge-agentdb-lock.test.tsnew file mode 100644index 0000000000..9961a12df1--- /dev/null+++ b/v3/@claude-flow/cli/__tests__/memory-bridge-agentdb-lock.test.ts@@ -0,0 +1,29 @@+import { afterEach, expect, it, vi } from 'vitest';+vi.mock('../src/memory/intelligence.js', () => ({ initializeIntelligence: async () => ({}), recordSignalProcessed() {} }));+vi.mock('../src/memory/memory-initializer.js', () => ({ addToHNSWIndex: async () => {} }));+const bridge = await import('../src/memory/memory-bridge.js');+afterEach(async () => { try { await bridge.shutdownBridge(); } catch { /* asserted below */ } bridge._resetRegistryCacheForTest(); });++it('shutdownBridge surfaces an AgentDB persist failure (after full cleanup) instead of swallowing it', async () => {+ let closes = 0;+ bridge.__setMemoryBridgeRegistryFactoryForTests(() => ({+ async initialize() {},+ get() { return null; },+ getAgentDB() { return null; },+ async shutdown() { closes++; throw Object.assign(new Error('AgentDB failed to persist "x.db"; pending changes were NOT saved'), { code: 'AGENTDB_LOCK_UNRECOVERABLE' }); },+ }));+ await bridge.bridgeStorePattern({ pattern: 'p', type: 'test', confidence: 0.9, dbPath: '/tmp/ruflo-lock-surface/x.db' }).catch(() => {});+ await expect(bridge.shutdownBridge()).rejects.toMatchObject({ code: 'AGENTDB_LOCK_UNRECOVERABLE' });+ expect(closes).toBe(1);+ // state fully cleared: a second shutdown is a clean no-op+ await expect(bridge.shutdownBridge()).resolves.toBeUndefined();+});++it('other shutdown errors stay best-effort', async () => {+ bridge.__setMemoryBridgeRegistryFactoryForTests(() => ({+ async initialize() {}, get() { return null; }, getAgentDB() { return null; },+ async shutdown() { throw new Error('boom'); },+ }));+ await bridge.bridgeStorePattern({ pattern: 'p', type: 'test', confidence: 0.9, dbPath: '/tmp/ruflo-lock-surface/y.db' }).catch(() => {});+ await expect(bridge.shutdownBridge()).resolves.toBeUndefined();+});diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.jsonindex 6ddd25d74e..2b68c9ceff 100644--- a/v3/@claude-flow/cli/package.json+++ b/v3/@claude-flow/cli/package.json@@ -135,7 +135,7 @@"@metaharness/radio": "~0.1.0","@metaharness/turn-credit": "~0.1.0","@napi-rs/keyring": "1.3.0",- "agentdb": "^3.0.0-alpha.17",+ "agentdb": "^3.0.0-alpha.20","agentic-flow": "^3.0.0-alpha.1","better-sqlite3": "^12.9.0","ruvector": "^0.2.27",diff --git a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.tsindex 223143cc6a..d646833163 100644--- a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts+++ b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts@@ -2803,8 +2803,12 @@ export const hooksSessionEnd: MCPTool = {// after the command has completed all logical work (#2691).try {await bridge?.shutdownBridge();- } catch {- // Cleanup is best-effort and must not fail session-end.+ } catch (err) {+ // Cleanup is best-effort and must not fail session-end, but a failed+ // AgentDB persist (lock/concurrent writer) is never silent.+ if ((err as { code?: unknown } | null)?.code === 'AGENTDB_LOCK_UNRECOVERABLE') {+ process.stderr.write(`[ruflo] warning: ${(err as Error).message}\n`);+ }}}diff --git a/v3/@claude-flow/cli/src/memory/memory-bridge.ts b/v3/@claude-flow/cli/src/memory/memory-bridge.tsindex b27279ebc0..34f4171ab5 100644--- a/v3/@claude-flow/cli/src/memory/memory-bridge.ts+++ b/v3/@claude-flow/cli/src/memory/memory-bridge.ts@@ -2325,13 +2325,20 @@ export function shutdownBridge(): Promise<void> {shutdownPromise = (async () => {if (activeOperations > 0) await new Promise<void>(resolve => { drained = resolve; });await Promise.allSettled([...registryPromises.values()]);+ // A failed PERSIST (AGENTDB_LOCK_UNRECOVERABLE: live lock or concurrent+ // writer on a sql.js database) means pending changes were not saved. That+ // is surfaced after cleanup completes; other close errors stay best-effort.+ let persistFailure: unknown;for (const registry of new Set(registryInstances.values())) {- try { await registry.shutdown(); } catch { /* best-effort cleanup */ }+ try { await registry.shutdown(); } catch (err) {+ if ((err as { code?: unknown } | null)?.code === 'AGENTDB_LOCK_UNRECOVERABLE') persistFailure ??= err;+ }}registryInstances.clear();registryPromises.clear();testRegistryOverride = null;bridgeFailureReasons.clear();+ if (persistFailure) throw persistFailure;})().finally(() => { shutdownPromise = null; });return shutdownPromise;}diff --git a/v3/@claude-flow/memory/agentdb.rvf.idmap.json b/v3/@claude-flow/memory/agentdb.rvf.idmap.jsonnew file mode 100644index 0000000000..48a7cbe14d--- /dev/null+++ b/v3/@claude-flow/memory/agentdb.rvf.idmap.json@@ -0,0 +1 @@+{"idToLabel":{},"labelToId":{},"nextLabel":1}\ No newline at end of filediff --git a/v3/@claude-flow/memory/package.json b/v3/@claude-flow/memory/package.jsonindex 99b5880806..568dddc61d 100644--- a/v3/@claude-flow/memory/package.json+++ b/v3/@claude-flow/memory/package.json@@ -18,7 +18,7 @@},"dependencies": {"@claude-flow/security": "^3.0.0",- "agentdb": "^3.0.0-alpha.17",+ "agentdb": "^3.0.0-alpha.20","sql.js": "^1.10.3"},"optionalDependencies": {diff --git a/v3/@claude-flow/memory/src/agentdb-backend.ts b/v3/@claude-flow/memory/src/agentdb-backend.tsindex 2a6d83511c..83a7c6450c 100644--- a/v3/@claude-flow/memory/src/agentdb-backend.ts+++ b/v3/@claude-flow/memory/src/agentdb-backend.ts@@ -10,6 +10,7 @@* @module v3/memory/agentdb-backend*/+import { withAgentdbLockRecovery, closeWithAgentdbLockRecovery } from './agentdb-lock-guard.js';import { EventEmitter } from 'node:events';import { safeJsonParse } from './json-security.js';import {@@ -199,14 +200,6 @@ export class AgentDBBackend extends EventEmitter implements IMemoryBackend {try {// Initialize AgentDB with config- this.agentdb = new AgentDB({- dbPath: this.config.dbPath || ':memory:',- namespace: this.config.namespace,- forceWasm: this.config.forceWasm,- vectorBackend: this.config.vectorBackend,- vectorDimension: this.config.vectorDimension,- });-// Suppress agentdb's noisy console.log during init// (EmbeddingService, AgentDB core emit info-level logs we don't need)const origLog = console.log;@@ -219,7 +212,18 @@ export class AgentDBBackend extends EventEmitter implements IMemoryBackend {origLog.apply(console, args);};try {- await this.agentdb.initialize();+ // A stale `<db>.agentdb.lock` left by a dead writer is cleared (only+ // when provably stale) and init retried once with a fresh instance.+ await withAgentdbLockRecovery(this.config.dbPath, async () => {+ this.agentdb = new AgentDB({+ dbPath: this.config.dbPath || ':memory:',+ namespace: this.config.namespace,+ forceWasm: this.config.forceWasm,+ vectorBackend: this.config.vectorBackend,+ vectorDimension: this.config.vectorDimension,+ });+ await this.agentdb.initialize();+ });} finally {console.log = origLog;}@@ -247,7 +251,15 @@ export class AgentDBBackend extends EventEmitter implements IMemoryBackend {if (!this.initialized) return;if (this.agentdb) {- await this.agentdb.close();+ // Clears a provably stale lock first; a persist failure is surfaced+ // (AgentdbLockError), never swallowed.+ try {+ await closeWithAgentdbLockRecovery(this.config.dbPath, () => this.agentdb.close());+ } finally {+ this.initialized = false;+ this.emit('shutdown');+ }+ return;}this.initialized = false;diff --git a/v3/@claude-flow/memory/src/agentdb-lock-guard.test.ts b/v3/@claude-flow/memory/src/agentdb-lock-guard.test.tsnew file mode 100644index 0000000000..3b998026bd--- /dev/null+++ b/v3/@claude-flow/memory/src/agentdb-lock-guard.test.ts@@ -0,0 +1,209 @@+/**+ * Real-agentdb regression tests for the sql.js lock/concurrency guard.+ * Reproduces the two alpha.20 failure modes (lost-update refusal, stale+ * `<db>.agentdb.lock` from a dead writer) against the actual agentdb build,+ * then proves the guard's behaviour. sql.js is forced so the lock path runs.+ */+import { describe, it, expect, beforeAll, beforeEach, afterEach } from 'vitest';+import * as fs from 'node:fs';+import * as os from 'node:os';+import * as path from 'node:path';+import {+ AgentdbLockError,+ closeWithAgentdbLockRecovery,+ clearStaleAgentdbLock,+ inspectAgentdbLock,+ isConcurrentModificationError,+ withAgentdbLockRecovery,+} from './agentdb-lock-guard.js';++let createDatabase: (f: string) => Promise<any>;+let dir: string;+let dbFile: string;+let lockFile: string;++const DEAD_PID = 2_147_483_000; // far above pid_max on Linux/mac; ESRCH+const OLD = new Date(Date.now() - 3600_000);++function plantLock(content: string, mtime: Date = OLD): void {+ fs.writeFileSync(lockFile, content);+ fs.utimesSync(lockFile, mtime, mtime);+}++async function rows(file: string): Promise<string[]> {+ const db = await createDatabase(file);+ try {+ return db.prepare('SELECT x FROM t').all().map((r: { x: string }) => r.x);+ } finally {+ try { db.close(); } catch { /* read-only use */ }+ }+}++beforeAll(async () => {+ process.env.AGENTDB_FORCE_SQLJS = '1';+ ({ createDatabase } = (await import('agentdb/db-fallback')) as any);+});++beforeEach(() => {+ dir = fs.mkdtempSync(path.join(os.tmpdir(), 'agentdb-lock-guard-'));+ dbFile = path.join(dir, 'test.db');+ lockFile = `${dbFile}.agentdb.lock`;+});++afterEach(() => {+ fs.rmSync(dir, { recursive: true, force: true });+});++describe('failure reproduction (agentdb alpha.20 behaviour)', () => {+ it('a stale handle save is refused with AGENTDB_SQLJS_CONCURRENT_MODIFICATION and keeps the other writer row', async () => {+ const a = await createDatabase(dbFile);+ const b = await createDatabase(dbFile);+ a.exec('CREATE TABLE t(x)');+ a.exec("INSERT INTO t VALUES('from-A')");+ a.close();+ b.exec('CREATE TABLE IF NOT EXISTS t(x)');+ b.exec("INSERT INTO t VALUES('from-B')");+ let err: unknown;+ try { b.close(); } catch (e) { err = e; }+ expect(isConcurrentModificationError(err)).toBe(true);+ expect(await rows(dbFile)).toEqual(['from-A']); // refused, not silently lost-updated+ });++ it('a lock left by a dead PID makes the first save fail and the db file is never created', async () => {+ plantLock(`${DEAD_PID}\n`);+ const a = await createDatabase(dbFile);+ a.exec('CREATE TABLE t(x)');+ let err: unknown;+ try { a.close(); } catch (e) { err = e; }+ expect(isConcurrentModificationError(err)).toBe(true);+ expect(fs.existsSync(dbFile)).toBe(false);+ });+});++describe('inspectAgentdbLock / clearStaleAgentdbLock', () => {+ it('absent', () => {+ expect(inspectAgentdbLock(dbFile).state).toBe('absent');+ });+ it('stale: dead PID and old', () => {+ plantLock(`${DEAD_PID}\n`);+ expect(inspectAgentdbLock(dbFile).state).toBe('stale');+ });+ it('live: PID alive is never cleared', () => {+ plantLock(`${process.ppid}\n`);+ const r = clearStaleAgentdbLock(dbFile);+ expect(r.cleared).toBe(false);+ expect(r.inspection.state).toBe('live');+ expect(fs.existsSync(lockFile)).toBe(true);+ });+ it('own PID is treated as live', () => {+ plantLock(`${process.pid}\n`);+ expect(inspectAgentdbLock(dbFile).state).toBe('live');+ });+ it('dead PID but fresh lock is not cleared', () => {+ plantLock(`${DEAD_PID}\n`, new Date());+ const r = clearStaleAgentdbLock(dbFile);+ expect(r.cleared).toBe(false);+ expect(fs.existsSync(lockFile)).toBe(true);+ });+ it('non-PID content is unverifiable and untouched', () => {+ plantLock('hello\n');+ const r = clearStaleAgentdbLock(dbFile);+ expect(r.cleared).toBe(false);+ expect(r.inspection.state).toBe('unverifiable');+ expect(fs.readFileSync(lockFile, 'utf8')).toBe('hello\n');+ });+ it('a symlinked lock is never followed or removed', () => {+ const target = path.join(dir, 'victim.txt');+ fs.writeFileSync(target, `${DEAD_PID}\n`);+ fs.symlinkSync(target, lockFile);+ const r = clearStaleAgentdbLock(dbFile);+ expect(r.cleared).toBe(false);+ expect(fs.existsSync(target)).toBe(true);+ expect(fs.lstatSync(lockFile).isSymbolicLink()).toBe(true);+ });+ it('clears exactly the lock and leaves siblings alone', () => {+ plantLock(`${DEAD_PID}\n`);+ const sibling = path.join(dir, 'other.db.agentdb.lock');+ fs.writeFileSync(sibling, `${DEAD_PID}\n`);+ const r = clearStaleAgentdbLock(dbFile);+ expect(r.cleared).toBe(true);+ expect(fs.existsSync(lockFile)).toBe(false);+ expect(fs.existsSync(sibling)).toBe(true);+ expect(fs.readdirSync(dir).filter((f) => f.includes('.stale-'))).toEqual([]);+ });+});++describe('withAgentdbLockRecovery', () => {+ it('recovers a stale lock and the save succeeds exactly once more (no data loss)', async () => {+ plantLock(`${DEAD_PID}\n`);+ const a = await createDatabase(dbFile);+ a.exec('CREATE TABLE t(x)');+ a.exec("INSERT INTO t VALUES('kept')");+ await withAgentdbLockRecovery(dbFile, () => a.save());+ expect(fs.existsSync(lockFile)).toBe(false);+ a.close();+ expect(await rows(dbFile)).toEqual(['kept']);+ });++ it('does not retry or delete a live holder lock; surfaces an actionable error', async () => {+ plantLock(`${process.ppid}\n`);+ const a = await createDatabase(dbFile);+ a.exec('CREATE TABLE t(x)');+ let err: unknown;+ try { await withAgentdbLockRecovery(dbFile, () => a.save()); } catch (e) { err = e; }+ expect(err).toBeInstanceOf(AgentdbLockError);+ expect((err as AgentdbLockError).lockState).toBe('live');+ expect((err as Error).message).toMatch(/another process/i);+ expect(fs.existsSync(lockFile)).toBe(true);+ expect(fs.existsSync(dbFile)).toBe(false);+ });++ it('a true lost-update (no lock) is surfaced, never retried, never overwritten', async () => {+ const a = await createDatabase(dbFile);+ const b = await createDatabase(dbFile);+ a.exec('CREATE TABLE t(x)'); a.exec("INSERT INTO t VALUES('from-A')"); a.close();+ b.exec('CREATE TABLE IF NOT EXISTS t(x)'); b.exec("INSERT INTO t VALUES('from-B')");+ let calls = 0;+ let err: unknown;+ try { await withAgentdbLockRecovery(dbFile, () => { calls++; return b.save(); }); } catch (e) { err = e; }+ expect(calls).toBe(1);+ expect(err).toBeInstanceOf(AgentdbLockError);+ expect((err as AgentdbLockError).lockState).toBe('absent');+ expect(await rows(dbFile)).toEqual(['from-A']);+ });++ it('passes unrelated errors through untouched and never inspects the filesystem for them', async () => {+ const boom = new Error('boom');+ await expect(withAgentdbLockRecovery(dbFile, () => { throw boom; })).rejects.toBe(boom);+ });++ it(':memory: databases are not guarded', async () => {+ const e = Object.assign(new Error('x'), { code: 'AGENTDB_SQLJS_CONCURRENT_MODIFICATION' });+ await expect(withAgentdbLockRecovery(':memory:', () => { throw e; })).rejects.toBe(e);+ });++ it('error message does not leak the full directory path', async () => {+ plantLock(`${process.ppid}\n`);+ const e = Object.assign(new Error('x'), { code: 'AGENTDB_SQLJS_CONCURRENT_MODIFICATION' });+ let err: unknown;+ try { await withAgentdbLockRecovery(dbFile, () => { throw e; }); } catch (x) { err = x; }+ expect((err as Error).message).not.toContain(dir);+ });+});++describe('closeWithAgentdbLockRecovery', () => {+ it('clears a stale lock first so close persists the data', async () => {+ plantLock(`${DEAD_PID}\n`);+ const a = await createDatabase(dbFile);+ a.exec('CREATE TABLE t(x)'); a.exec("INSERT INTO t VALUES('persisted')");+ await closeWithAgentdbLockRecovery(dbFile, () => a.close());+ expect(await rows(dbFile)).toEqual(['persisted']);+ });+ it('surfaces (never swallows) a close that cannot persist because of a live lock', async () => {+ plantLock(`${process.ppid}\n`);+ const a = await createDatabase(dbFile);+ a.exec('CREATE TABLE t(x)');+ await expect(closeWithAgentdbLockRecovery(dbFile, () => a.close())).rejects.toBeInstanceOf(AgentdbLockError);+ expect(fs.existsSync(lockFile)).toBe(true);+ });+});diff --git a/v3/@claude-flow/memory/src/agentdb-lock-guard.ts b/v3/@claude-flow/memory/src/agentdb-lock-guard.tsnew file mode 100644index 0000000000..97576fb200--- /dev/null+++ b/v3/@claude-flow/memory/src/agentdb-lock-guard.ts@@ -0,0 +1,254 @@+/**+ * AgentDB sql.js lock guard.+ *+ * agentdb >= 3.0.0-alpha.20 protects sql.js saves with an exclusive+ * `<db>.agentdb.lock` file (created with `wx`, content: the holder's PID) and+ * throws `AGENTDB_SQLJS_CONCURRENT_MODIFICATION` when the lock exists or the+ * database file changed under an open handle. A writer that dies between+ * creating and removing the lock leaves a lock that nothing ever clears, and+ * every later save then fails.+ *+ * This module (1) recognises that error, (2) removes a lock ONLY when it is+ * provably stale (regular file, exactly `<db>.agentdb.lock`, numeric PID that+ * is dead, old enough), and (3) retries once. Anything else surfaces as an+ * actionable `AgentdbLockError`. Writes are never dropped or silently+ * swallowed here.+ *+ * @module v3/memory/agentdb-lock-guard+ */++import * as fs from 'node:fs';+import * as path from 'node:path';+import { randomBytes } from 'node:crypto';++export const AGENTDB_CONCURRENT_MODIFICATION_CODE = 'AGENTDB_SQLJS_CONCURRENT_MODIFICATION';+export const AGENTDB_LOCK_SUFFIX = '.agentdb.lock';++/** A lock younger than this is never considered stale (saves take milliseconds). */+export const DEFAULT_MIN_STALE_AGE_MS = 10_000;++export type LockState = 'absent' | 'live' | 'stale' | 'unverifiable';++export interface LockInspection {+ state: LockState;+ /** Path of the lock file that was inspected (the db path plus `.agentdb.lock`). */+ lockPath: string;+ pid?: number;+ reason: string;+}++export interface LockGuardOptions {+ /** Minimum lock age before it may be treated as stale. */+ minStaleAgeMs?: number;+ /** Injectable for tests. */+ isPidAlive?: (pid: number) => boolean;+ now?: () => number;+}++/** Thrown when a lock/concurrency failure cannot be (or was not) safely recovered. */+export class AgentdbLockError extends Error {+ readonly code = 'AGENTDB_LOCK_UNRECOVERABLE';+ constructor(message: string, readonly lockState: LockState, options?: { cause?: unknown }) {+ super(message);+ this.name = 'AgentdbLockError';+ if (options?.cause !== undefined) (this as { cause?: unknown }).cause = options.cause;+ }+}++export function isConcurrentModificationError(error: unknown): boolean {+ return (+ typeof error === 'object' &&+ error !== null &&+ (error as { code?: unknown }).code === AGENTDB_CONCURRENT_MODIFICATION_CODE+ );+}++function defaultIsPidAlive(pid: number): boolean {+ try {+ process.kill(pid, 0);+ return true;+ } catch (e) {+ // ESRCH: no such process. EPERM: exists but owned by someone else -> alive.+ return (e as NodeJS.ErrnoException).code !== 'ESRCH';+ }+}++function lockPathFor(dbPath: string): string {+ const resolved = path.resolve(dbPath);+ const lockPath = path.join(path.dirname(resolved), path.basename(resolved) + AGENTDB_LOCK_SUFFIX);+ return lockPath;+}++interface LockSnapshot {+ dev: number | bigint;+ ino: number | bigint;+ content: string;+ mtimeMs: number;+}++function readLockNoFollow(lockPath: string): LockSnapshot | 'absent' | 'not-regular' {+ let st: fs.Stats;+ try {+ st = fs.lstatSync(lockPath);+ } catch (e) {+ if ((e as NodeJS.ErrnoException).code === 'ENOENT') return 'absent';+ throw e;+ }+ if (!st.isFile()) return 'not-regular'; // symlink, directory, device...+ const flags = fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0);+ let fd: number;+ try {+ fd = fs.openSync(lockPath, flags);+ } catch (e) {+ const code = (e as NodeJS.ErrnoException).code;+ if (code === 'ENOENT') return 'absent';+ if (code === 'ELOOP') return 'not-regular';+ throw e;+ }+ try {+ const fst = fs.fstatSync(fd);+ if (!fst.isFile() || fst.size > 64) return 'not-regular';+ const buf = Buffer.alloc(Math.max(1, fst.size));+ const n = fs.readSync(fd, buf, 0, buf.length, 0);+ return { dev: fst.dev, ino: fst.ino, content: buf.subarray(0, n).toString('utf8'), mtimeMs: fst.mtimeMs };+ } finally {+ fs.closeSync(fd);+ }+}++function parsePid(content: string): number | null {+ const m = /^(\d{1,10})\n?$/.exec(content);+ if (!m) return null;+ const pid = Number(m[1]);+ return Number.isSafeInteger(pid) && pid > 0 ? pid : null;+}++export function inspectAgentdbLock(dbPath: string, options: LockGuardOptions = {}): LockInspection {+ const lockPath = lockPathFor(dbPath);+ const isAlive = options.isPidAlive ?? defaultIsPidAlive;+ const now = (options.now ?? Date.now)();+ const minAge = options.minStaleAgeMs ?? DEFAULT_MIN_STALE_AGE_MS;++ let snap: LockSnapshot | 'absent' | 'not-regular';+ try {+ snap = readLockNoFollow(lockPath);+ } catch (e) {+ return { state: 'unverifiable', lockPath, reason: `cannot read lock file (${(e as NodeJS.ErrnoException).code ?? 'error'})` };+ }+ if (snap === 'absent') return { state: 'absent', lockPath, reason: 'no lock file present' };+ if (snap === 'not-regular') {+ return { state: 'unverifiable', lockPath, reason: 'lock path is not a small regular file (symlink or unexpected type); refusing to touch it' };+ }+ const pid = parsePid(snap.content);+ if (pid === null) return { state: 'unverifiable', lockPath, reason: 'lock content is not a PID; refusing to touch it' };+ if (pid === process.pid || isAlive(pid)) return { state: 'live', lockPath, pid, reason: `lock holder PID ${pid} is alive` };+ const age = now - snap.mtimeMs;+ if (age < minAge) {+ return { state: 'live', lockPath, pid, reason: `holder PID ${pid} is dead but the lock is only ${Math.round(age)}ms old` };+ }+ return { state: 'stale', lockPath, pid, reason: `holder PID ${pid} is dead and the lock is ${Math.round(age / 1000)}s old` };+}++/**+ * Remove the lock only if it is provably stale. Returns true when a stale lock+ * was removed. The lock is first renamed aside (atomic) and re-verified as the+ * very same file that was inspected, so a lock recreated by a live writer in+ * the meantime is restored instead of deleted.+ */+export function clearStaleAgentdbLock(dbPath: string, options: LockGuardOptions = {}): { cleared: boolean; inspection: LockInspection } {+ const inspection = inspectAgentdbLock(dbPath, options);+ if (inspection.state !== 'stale') return { cleared: false, inspection };++ const lockPath = inspection.lockPath;+ const before = readLockNoFollow(lockPath);+ if (typeof before === 'string') return { cleared: false, inspection: { ...inspection, state: 'unverifiable', reason: 'lock changed during inspection' } };++ const aside = path.join(path.dirname(lockPath), `.${path.basename(lockPath)}.stale-${process.pid}-${randomBytes(6).toString('hex')}`);+ try {+ fs.renameSync(lockPath, aside);+ } catch (e) {+ if ((e as NodeJS.ErrnoException).code === 'ENOENT') return { cleared: false, inspection: { ...inspection, state: 'absent', reason: 'lock vanished before removal' } };+ return { cleared: false, inspection: { ...inspection, state: 'unverifiable', reason: `cannot move lock aside (${(e as NodeJS.ErrnoException).code ?? 'error'})` } };+ }++ const moved = readLockNoFollow(aside);+ const same = typeof moved !== 'string' && moved.ino === before.ino && moved.dev === before.dev && moved.content === before.content;+ if (!same) {+ // We displaced a different (possibly live) lock. Put it back; never delete it.+ try { fs.linkSync(aside, lockPath); } catch { /* a newer lock already exists; the displaced one is discarded below */ }+ try { fs.unlinkSync(aside); } catch { /* best effort */ }+ return { cleared: false, inspection: { ...inspection, state: 'live', reason: 'lock was replaced during removal; left in place' } };+ }+ try { fs.unlinkSync(aside); } catch { /* the stale lock is already out of the way */ }+ return { cleared: true, inspection };+}++/**+ * Run `fn`. If it fails with the AgentDB concurrent-modification error AND the+ * cause is a provably stale lock, clear it and retry exactly once. Otherwise+ * throw an actionable AgentdbLockError. Errors of other kinds pass through.+ */+export async function withAgentdbLockRecovery<T>(+ dbPath: string | undefined,+ fn: () => Promise<T> | T,+ options: LockGuardOptions = {},+): Promise<T> {+ try {+ return await fn();+ } catch (error) {+ if (!isConcurrentModificationError(error) || !dbPath || dbPath === ':memory:') throw error;++ const { cleared, inspection } = clearStaleAgentdbLock(dbPath, options);+ if (!cleared) {+ throw new AgentdbLockError(+ `AgentDB could not save "${path.basename(dbPath)}": ${inspection.reason}. ` ++ (inspection.state === 'live'+ ? 'Another process is writing this database; retry when it finishes.'+ : inspection.state === 'absent'+ ? 'The database changed on disk after it was opened; reopen it and retry (no data was overwritten).'+ : `If no other process uses this database, remove "${path.basename(inspection.lockPath)}" manually and retry.`),+ inspection.state,+ { cause: error },+ );+ }+ try {+ return await fn();+ } catch (retryError) {+ if (isConcurrentModificationError(retryError)) {+ throw new AgentdbLockError(+ `AgentDB could not save "${path.basename(dbPath)}" even after removing a stale lock (${inspection.reason}); ` ++ 'another process is writing it. Retry later.',+ 'live',+ { cause: retryError },+ );+ }+ throw retryError;+ }+ }+}++/**+ * Close an AgentDB / sql.js handle safely. sql.js `close()` saves and then+ * destroys the handle even when the save fails, so a failed close cannot be+ * retried; the only safe recovery is to clear a provably stale lock BEFORE+ * closing. A concurrency failure that remains is surfaced as AgentdbLockError+ * (the caller must treat it as "not persisted"), never swallowed.+ */+export async function closeWithAgentdbLockRecovery(+ dbPath: string | undefined,+ close: () => Promise<unknown> | unknown,+ options: LockGuardOptions = {},+): Promise<void> {+ if (dbPath && dbPath !== ':memory:') clearStaleAgentdbLock(dbPath, options);+ try {+ await close();+ } catch (error) {+ if (!isConcurrentModificationError(error) || !dbPath || dbPath === ':memory:') throw error;+ const inspection = inspectAgentdbLock(dbPath, options);+ throw new AgentdbLockError(+ `AgentDB failed to persist "${path.basename(dbPath)}" on close and the pending changes were NOT saved: ${inspection.reason}.`,+ inspection.state,+ { cause: error },+ );+ }+}diff --git a/v3/@claude-flow/memory/src/controller-registry-lock.test.ts b/v3/@claude-flow/memory/src/controller-registry-lock.test.tsnew file mode 100644index 0000000000..9cbd2724a8--- /dev/null+++ b/v3/@claude-flow/memory/src/controller-registry-lock.test.ts@@ -0,0 +1,77 @@+/**+ * ControllerRegistry x agentdb alpha.20 sql.js lock handling.+ *+ * AgentDB only reaches the sql.js (locked-save) path when better-sqlite3 is+ * unavailable, which cannot be forced through the registry, so `agentdb` is+ * replaced with a stand-in that opens a REAL agentdb sql.js database+ * (agentdb/db-fallback) and closes it the way AgentDB.close() does.+ */+import { describe, it, expect, vi, beforeAll, beforeEach, afterEach } from 'vitest';+import * as fs from 'node:fs';+import * as os from 'node:os';+import * as path from 'node:path';++vi.mock('agentdb', async () => {+ const { createDatabase } = (await import('agentdb/db-fallback')) as any;+ class SqlJsAgentDB {+ db: any;+ constructor(private cfg: { dbPath: string }) {}+ async initialize() {+ this.db = await createDatabase(this.cfg.dbPath);+ this.db.exec('CREATE TABLE IF NOT EXISTS t(x)');+ }+ async close() { this.db.close(); }+ get database() { return this.db; }+ getController() { return null; }+ }+ return { AgentDB: SqlJsAgentDB, default: SqlJsAgentDB };+});++import { ControllerRegistry } from './controller-registry.js';+import { AgentdbLockError } from './agentdb-lock-guard.js';++const DEAD_PID = 2_147_483_000;+let dir: string;+let dbFile: string;+let lockFile: string;++function plant(pid: number): void {+ fs.writeFileSync(lockFile, `${pid}\n`);+ const old = new Date(Date.now() - 3600_000);+ fs.utimesSync(lockFile, old, old);+}++beforeAll(() => { process.env.AGENTDB_FORCE_SQLJS = '1'; });+beforeEach(() => {+ dir = fs.mkdtempSync(path.join(os.tmpdir(), 'registry-lock-'));+ dbFile = path.join(dir, 'agentdb-memory.db');+ lockFile = `${dbFile}.agentdb.lock`;+});+afterEach(() => fs.rmSync(dir, { recursive: true, force: true }));++const cfg = () => ({ dbPath: dbFile, controllers: {} as any });++describe('ControllerRegistry + stale/live agentdb lock', () => {+ it('stale lock from a dead writer: shutdown clears it and persists the db', async () => {+ plant(DEAD_PID);+ const reg = new ControllerRegistry();+ const unavailable: unknown[] = [];+ reg.on('agentdb:unavailable', (e) => unavailable.push(e));+ await reg.initialize(cfg());+ expect(unavailable).toEqual([]);+ await reg.shutdown();+ expect(fs.existsSync(dbFile)).toBe(true);+ expect(fs.existsSync(lockFile)).toBe(false);+ });++ it('live lock: shutdown surfaces AgentdbLockError and emits agentdb:persist-failed; lock untouched', async () => {+ const reg = new ControllerRegistry();+ await reg.initialize(cfg());+ plant(process.ppid);+ const events: unknown[] = [];+ reg.on('agentdb:persist-failed', (e) => events.push(e));+ await expect(reg.shutdown()).rejects.toBeInstanceOf(AgentdbLockError);+ expect(events.length).toBe(1);+ expect(fs.existsSync(lockFile)).toBe(true);+ });+});diff --git a/v3/@claude-flow/memory/src/controller-registry.ts b/v3/@claude-flow/memory/src/controller-registry.tsindex e22c99118f..d87890b916 100644--- a/v3/@claude-flow/memory/src/controller-registry.ts+++ b/v3/@claude-flow/memory/src/controller-registry.ts@@ -10,6 +10,7 @@* @module @claude-flow/memory/controller-registry*/+import { withAgentdbLockRecovery, closeWithAgentdbLockRecovery, AgentdbLockError, isConcurrentModificationError } from './agentdb-lock-guard.js';import { EventEmitter } from 'node:events';import type {IMemoryBackend,@@ -246,6 +247,7 @@ export const INIT_LEVELS: InitLevel[] = [export class ControllerRegistry extends EventEmitter {private controllers: Map<ControllerName, ControllerEntry> = new Map();private agentdb: any = null;+ private dbPath: string | undefined;private backend: IMemoryBackend | null = null;private config: RuntimeConfig = {};private initialized = false;@@ -343,14 +345,30 @@ export class ControllerRegistry extends EventEmitter {// Shutdown AgentDBif (this.agentdb) {+ let persistFailure: AgentdbLockError | null = null;try {if (typeof this.agentdb.close === 'function') {- await this.agentdb.close();+ const closeFn = () => this.agentdb.close();+ await closeWithAgentdbLockRecovery(this.dbPath, closeFn);+ }+ } catch (error) {+ // Best-effort cleanup for ordinary close errors, but a failed+ // PERSIST (stale/live lock or concurrent writer) must never be+ // swallowed: the caller has to know pending changes were not saved.+ if (error instanceof AgentdbLockError || isConcurrentModificationError(error)) {+ persistFailure = error instanceof AgentdbLockError+ ? error+ : new AgentdbLockError('AgentDB failed to persist on close; pending changes were NOT saved.', 'unverifiable', { cause: error });+ this.emit('agentdb:persist-failed', { reason: persistFailure.message });}- } catch {- // Best-effort cleanup}this.agentdb = null;+ if (persistFailure) {+ this.controllers.clear();+ this.initialized = false;+ this.emit('shutdown');+ throw persistFailure;+ }}this.controllers.clear();@@ -541,7 +559,7 @@ export class ControllerRegistry extends EventEmitter {return;}- this.agentdb = new AgentDBClass({ dbPath });+ this.dbPath = dbPath;// Suppress agentdb's noisy info-level output during init// using stderr redirect instead of monkey-patching console.log@@ -556,7 +574,13 @@ export class ControllerRegistry extends EventEmitter {if (!suppressFilter(args)) origLog.apply(console, args);};try {- await this.agentdb.initialize();+ // agentdb >= alpha.20 refuses sql.js saves while a `<db>.agentdb.lock`+ // exists. A lock left by a dead writer is cleared (only when provably+ // stale) and init retried once with a fresh instance.+ await withAgentdbLockRecovery(dbPath, async () => {+ this.agentdb = new AgentDBClass({ dbPath });+ await this.agentdb.initialize();+ });} finally {console.log = origLog;}diff --git a/v3/@claude-flow/memory/src/index.ts b/v3/@claude-flow/memory/src/index.tsindex f02cd3a990..a0083911fd 100644--- a/v3/@claude-flow/memory/src/index.ts+++ b/v3/@claude-flow/memory/src/index.ts@@ -190,6 +190,15 @@ export type {// ===== Core Components =====export { AgentDBAdapter } from './agentdb-adapter.js';export type { AgentDBAdapterConfig } from './agentdb-adapter.js';+export {+ AgentdbLockError,+ clearStaleAgentdbLock,+ closeWithAgentdbLockRecovery,+ inspectAgentdbLock,+ isConcurrentModificationError,+ withAgentdbLockRecovery,+} from './agentdb-lock-guard.js';+export type { LockInspection, LockState, LockGuardOptions } from './agentdb-lock-guard.js';export { AgentDBBackend } from './agentdb-backend.js';export type { AgentDBBackendConfig } from './agentdb-backend.js';export {diff --git a/v3/pnpm-lock.yaml b/v3/pnpm-lock.yamlindex 0c7ab58554..acd523d5d8 100644--- a/v3/pnpm-lock.yaml+++ b/v3/pnpm-lock.yaml@@ -227,8 +227,8 @@ importers:specifier: 1.3.0version: 1.3.0agentdb:- specifier: ^3.0.0-alpha.17- version: 3.0.0-alpha.17(@types/[email protected])([email protected])+ specifier: ^3.0.0-alpha.20+ version: 3.0.0-alpha.20(@types/[email protected])([email protected])agentic-flow:specifier: ^3.0.0-alpha.1version: 3.0.0-alpha.2@@ -452,8 +452,8 @@ importers:specifier: ^3.0.0version: link:../securityagentdb:- specifier: ^3.0.0-alpha.17- version: 3.0.0-alpha.17(@types/[email protected])([email protected])+ specifier: ^3.0.0-alpha.20+ version: 3.0.0-alpha.20(@types/[email protected])([email protected])sql.js:specifier: ^1.10.3version: 1.13.0@@ -483,7 +483,7 @@ importers:optionalDependencies:agentdb:specifier: ^2.0.0 || ^3.0.0-alpha.1- version: 3.0.0-alpha.17(@types/[email protected])([email protected])+ version: 3.0.0-alpha.20(@types/[email protected])([email protected])'@claude-flow/performance':dependencies:@@ -1777,11 +1777,29 @@ packages:hasBin: truedev: false+ /@metaharness/[email protected]:+ resolution: {integrity: sha512-Pgefr/es0Btofh7GxQrOAg/i43ZKcLUfeD9rndOAkpA8s3ZYohSmfLerJLNsGOOKc2eTvmmauljl8QEVmKC2dw==}+ engines: {node: '>=20.0.0'}+ hasBin: true+ requiresBuild: true+ optional: true+/@metaharness/[email protected]:resolution: {integrity: sha512-yrLXDXNdf4jKqHlW6QZw3Cy5T0eMMjjaPqn1XB717/Xx/y0Iv9R03W0OhMEiR/kfqMNebRBW1fi6D7inStEyqA==}requiresBuild: truedev: false+ /@metaharness/[email protected]:+ resolution: {integrity: sha512-am7dROkjyS1Zkms3TOcn2LVHjwMLQXPJ6Pu1aP55q40vWJLRONGdGvnrcBL/VhMFqjQrVB57lmSn2E+s5CSZwA==}+ requiresBuild: true+ optional: true++ /@metaharness/[email protected]:+ resolution: {integrity: sha512-KegYx/q8qXlnaSYP0l5hgNPn8iNMl6a2eONqPi68FXd1w1jt7NswJJlt2/Ftl3Sum8qAEchxH1ZJOYFWTvJxTA==}+ engines: {node: '>=20.0.0'}+ requiresBuild: true+ optional: true+/@metaharness/[email protected]:resolution: {integrity: sha512-m1GCeGCbjo7h5OLMCgb2VZFbhY6aHP5x28q0j/AFqXRWwStt5/Z+sWMuGNaNKVtnB7PGueNbtVoxLzMQ53rrFg==}requiresBuild: true@@ -1794,6 +1812,19 @@ packages:hasBin: truedev: false+ /@metaharness/[email protected](@ruvector/[email protected]):+ resolution: {integrity: sha512-LQElU6mUrWd3ffJ5bwoonEIgw7oFQZpwZaehffyl/Pg+iozpRjIBPEXdb4uTOBnKH+yPiTEWKc+h9AiZr9Os9w==}+ engines: {node: '>=20.0.0'}+ requiresBuild: true+ peerDependencies:+ '@ruvector/tiny-dancer': ^0.1.21+ peerDependenciesMeta:+ '@ruvector/tiny-dancer':+ optional: true+ dependencies:+ '@ruvector/tiny-dancer': 0.1.22+ optional: true+/@metaharness/[email protected]:resolution: {integrity: sha512-VOfjHM7AMWwDH41AAMHOHFbH1r898xJqhqyE3G/r8OAxxrMgujX2SZsYkj/eXfBEmoPMhDVRkuO2abxvzCgEUA==}engines: {node: '>=20.0.0'}@@ -1817,6 +1848,19 @@ packages:hasBin: truedev: false+ /@metaharness/[email protected]:+ resolution: {integrity: sha512-BkEdTvjD2PEhkGTCmtTIPnoeaOsxvzFtsFEAurwVKlVOu4hQetHeXDfiyAYheWg8Cp4fcGcr7E5MO1ptQveQ2g==}+ requiresBuild: true+ optional: true++ /@metaharness/[email protected]:+ resolution: {integrity: sha512-kHL7T16476a5obVunbZ2NYqK7YY/1qtZTaQC1KyXmFh/7dRNselqGAilawspuD86F9U1H/LMCDvchDj3Vh5duw==}+ hasBin: true+ requiresBuild: true+ dependencies:+ '@metaharness/workspace-lens': 0.1.1+ optional: true+resolution: {integrity: sha512-yO28oVFFC7EBoiKdAn+VqRm+plcfv4v0xp6osG/VsCB0NlPZWi87ajbCZZ8f/RvOFLEu7//rSRmuZZ7lMoe3gQ==}engines: {node: '>=18'}@@ -1908,6 +1952,38 @@ packages:transitivePeerDependencies:- supports-color+ /@modelcontextprotocol/[email protected]([email protected]):+ resolution: {integrity: sha512-2DdE+SJDtzLEEWzY1ZjY7Q+VcPhcV1KisD3zI4u0XZyktsjHum1mwbMI+JaulUBi2OZk+KJAi2uPXzxichPkdw==}+ engines: {node: '>=18'}+ requiresBuild: true+ peerDependencies:+ '@cfworker/json-schema': ^4.1.1+ zod: ^3.25 || ^4.0+ peerDependenciesMeta:+ '@cfworker/json-schema':+ optional: true+ dependencies:+ '@hono/node-server': 1.19.9([email protected])+ ajv: 8.20.0+ ajv-formats: 3.0.1([email protected])+ content-type: 1.0.5+ cors: 2.8.6+ cross-spawn: 7.0.6+ eventsource: 3.0.7+ eventsource-parser: 3.0.6+ express: 5.2.1+ express-rate-limit: 8.6.2([email protected])+ hono: 4.12.11+ jose: 6.1.3+ json-schema-typed: 8.0.2+ pkce-challenge: 5.0.1+ raw-body: 3.0.2+ zod: 3.25.76+ zod-to-json-schema: 3.25.1([email protected])+ transitivePeerDependencies:+ - supports-color+ optional: true+/@napi-rs/[email protected]:resolution: {integrity: sha512-pl76hJvdYUBn6I24bXiOBMA9nbDapo3I5B+f3OorjDU4dUMSypXeKbOVehJe8fhgTiH24flMyTS3aAIy43xegQ==}engines: {node: '>= 10'}@@ -5784,6 +5860,11 @@ packages:requiresBuild: trueoptional: true+ /@ruvector/[email protected]:+ resolution: {integrity: sha512-C6kKdnv47Ud2t0U61eAjRU8dh9DgfQT6KFlGicZKfwUwVcr9NRA52xbM9hI9nd6G3iEOtNqdhkqDe0c6BUwFew==}+ requiresBuild: true+ optional: true+/@ruvector/[email protected]:resolution: {integrity: sha512-W40NLeSj/+FwIHT0+v3soFrtk4pnAZL5Ghx93qAsZkuwriNw2y6vGPnsapflQyp34WgMN362syIRiACXx3KW8g==}requiresBuild: true@@ -5794,6 +5875,16 @@ packages:'@ruvector/rvf-wasm': 0.1.6optional: true+ /@ruvector/[email protected]:+ resolution: {integrity: sha512-Z3TGxErAa9254UTB8COt44sXU3u5CCZWDewwu4Bj3mDoE8vWsaUiXxUBTJRy4sp60ZFXygghWGB8MsX1bs3zZw==}+ requiresBuild: true+ dependencies:+ '@ruvector/rvf-node': 0.1.8+ optionalDependencies:+ '@ruvector/rvf-solver': 0.1.8+ '@ruvector/rvf-wasm': 0.1.9+ optional: true+/@ruvector/[email protected]:resolution: {integrity: sha512-+bXB7+WdbkiNbcw0Xh5VENNILgDVpuma7fyx8NwGylWaYRe1niM03k/rezdM3zbpf4qGSqp6fVKIIDU8/H9lHw==}cpu: [arm64]@@ -7204,8 +7295,8 @@ packages:- supports-colordev: false- resolution: {integrity: sha512-LK8drZFQteNkff+ji52vCmIXyE3A3ipzabx+ubBcX0CRgF96GU8m36sWyOfqL7pWRfnYDgkEEEgZmagiNCaz/A==}+ resolution: {integrity: sha512-ixjySLNWFDe3G6EiM1+0xKvVB9nWgeSMM7+hkgnQ4C5+trWfukDRYj3G/yU3l4xc/9vpAkLFQS389glsGbH0BQ==}engines: {node: '>=18.0.0'}hasBin: truerequiresBuild: true@@ -7217,6 +7308,7 @@ packages:jsonwebtoken: 9.0.3sql.js: 1.14.1optionalDependencies:+ '@huggingface/transformers': 4.2.0'@opentelemetry/resources': 2.9.0(@opentelemetry/[email protected])'@opentelemetry/sdk-node': 0.220.0(@opentelemetry/[email protected])'@opentelemetry/semantic-conventions': 1.40.0@@ -7225,27 +7317,26 @@ packages:'@ruvector/graph-node': 2.0.3'@ruvector/router': 0.1.30'@ruvector/ruvllm': 2.6.0- '@ruvector/rvf': 0.1.9+ '@ruvector/rvf': 0.2.3'@ruvector/rvf-node': 0.1.8'@ruvector/rvf-solver': 0.1.8'@ruvector/rvf-wasm': 0.1.6'@ruvector/sona': 0.1.8- '@xenova/transformers': 2.17.2argon2: 0.44.0better-sqlite3: 12.9.0chalk: 5.6.2commander: 12.1.0hnswlib-node: 3.0.0inquirer: 9.3.8(@types/[email protected])- ruvector: 0.1.100([email protected])ruvector-attention-wasm: 0.1.32ruvector-graph-transformer-wasm: 2.0.4transitivePeerDependencies:- '@cfworker/json-schema'+ - '@metaharness/kernel'+ - '@ruvector/diskann'+ - '@ruvector/pi-brain'- '@types/node'- - bare-abort-controller- - bare-buffer- - react-native-b4a- supports-color- zod@@ -7402,14 +7493,17 @@ packages:'@rollup/rollup-darwin-arm64': 4.60.3'@ruvector/attention': 0.1.32'@ruvector/sona': 0.1.8- agentdb: 3.0.0-alpha.17(@types/[email protected])([email protected])+ agentdb: 3.0.0-alpha.20(@types/[email protected])([email protected])better-sqlite3: 12.9.0onnxruntime-node: 1.24.3sharp: 0.32.6sql.js: 1.14.1transitivePeerDependencies:- '@cfworker/json-schema'+ - '@metaharness/kernel'- '@modelcontextprotocol/sdk'+ - '@ruvector/diskann'+ - '@ruvector/pi-brain'- '@types/node'- '@valibot/to-json-schema'- arktype@@ -7458,14 +7552,17 @@ packages:'@ruvector/attention': 0.1.32'@ruvector/sona': 0.1.8'@xenova/transformers': 2.17.2- agentdb: 3.0.0-alpha.17(@types/[email protected])([email protected])+ agentdb: 3.0.0-alpha.20(@types/[email protected])([email protected])better-sqlite3: 12.9.0onnxruntime-node: 1.24.3sharp: 0.32.6sql.js: 1.14.1transitivePeerDependencies:- '@cfworker/json-schema'+ - '@metaharness/kernel'- '@modelcontextprotocol/sdk'+ - '@ruvector/diskann'+ - '@ruvector/pi-brain'- '@types/node'- '@valibot/to-json-schema'- arktype@@ -10501,6 +10598,27 @@ packages:'@ruvector/ruvllm': 2.6.0dev: false+ resolution: {integrity: sha512-h94B47zBEuNEfKLFMZMV/fRnXBrkwV6L8kMukgioB/9621k6Lm6s2lR2gBKl3BAT1sfN/DYqhsqAJc+6H5PTGQ==}+ engines: {node: '>=20.0.0'}+ hasBin: true+ requiresBuild: true+ peerDependencies:+ '@metaharness/kernel': ^0.1.0+ peerDependenciesMeta:+ '@metaharness/kernel':+ optional: true+ dependencies:+ '@metaharness/darwin': 0.2.8+ '@metaharness/flywheel': 0.1.10+ '@metaharness/redblue': 0.1.4+ '@metaharness/weight-eft': 0.1.1+ kolorist: 1.8.0+ prompts: 2.4.2+ optionalDependencies:+ '@ruvector/ruvllm': 2.6.0+ optional: true+resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==}engines: {node: '>=8.6'}@@ -10516,7 +10634,10 @@ packages:agentic-flow: 2.0.12-fix.8(@types/[email protected])transitivePeerDependencies:- '@cfworker/json-schema'+ - '@metaharness/kernel'- '@modelcontextprotocol/sdk'+ - '@ruvector/diskann'+ - '@ruvector/pi-brain'- '@types/node'- '@valibot/to-json-schema'- arktype@@ -12051,6 +12172,55 @@ packages:dev: falseoptional: true+ resolution: {integrity: sha512-6ox6kcONkFxKhOv6yAp6FKonn+WlNQ8t0tnK9xsOJKkQEru1psptGrObPA57VenaZ7pToEUvvgiLJYLc9uukIg==}+ engines: {node: '>=20.0.0'}+ hasBin: true+ requiresBuild: true+ peerDependencies:+ '@ruvector/diskann': '>=0.1.0'+ '@ruvector/pi-brain': '>=0.1.0'+ '@ruvector/router': '>=0.1.0'+ '@ruvector/ruvllm': '>=2.6.0'+ peerDependenciesMeta:+ '@ruvector/diskann':+ optional: true+ '@ruvector/pi-brain':+ optional: true+ '@ruvector/router':+ optional: true+ '@ruvector/ruvllm':+ optional: true+ dependencies:+ '@metaharness/darwin': 0.8.0+ '@metaharness/flywheel': 0.1.7+ '@metaharness/harness': 0.1.0+ '@metaharness/redblue': 0.1.4+ '@metaharness/router': 0.3.2(@ruvector/[email protected])+ '@metaharness/weight-eft': 0.1.1+ '@metaharness/workspace-lens': 0.1.1+ '@metaharness/workspace-probe': 0.1.1+ '@modelcontextprotocol/sdk': 1.32.1([email protected])+ '@ruvector/attention': 0.1.32+ '@ruvector/core': 0.1.30+ '@ruvector/gnn': 0.1.25+ '@ruvector/router': 0.1.30+ '@ruvector/ruvllm': 2.6.0+ '@ruvector/sona': 0.1.8+ chalk: 4.1.2+ commander: 11.1.0+ metaharness: 0.4.2+ ora: 5.4.1+ optionalDependencies:+ '@ruvector/rvf': 0.1.9+ '@ruvector/tiny-dancer': 0.1.22+ transitivePeerDependencies:+ - '@cfworker/json-schema'+ - '@metaharness/kernel'+ - supports-color+ - zod+ optional: true+resolution: {integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==}dependencies: