diff --git a/packages/server/tests/behavioral-spec-active.test.ts b/packages/server/tests/behavioral-spec-active.test.ts index 39f80ff..aab677c 100644 --- a/packages/server/tests/behavioral-spec-active.test.ts +++ b/packages/server/tests/behavioral-spec-active.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { MindDB } from '@waggle/core'; import { BEHAVIORAL_SPEC } from '@waggle/agent'; import { buildLocalServer } from '../src/local/index.js'; import type { FastifyInstance } from 'fastify'; @@ -12,9 +11,6 @@ describe('activeBehavioralSpec integration', () => { beforeAll(() => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-active-spec-')); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - mind.close(); }); afterAll(() => { diff --git a/packages/server/tests/dreams-routes.test.ts b/packages/server/tests/dreams-routes.test.ts index 5b4cbee..27bd54c 100644 --- a/packages/server/tests/dreams-routes.test.ts +++ b/packages/server/tests/dreams-routes.test.ts @@ -11,7 +11,6 @@ import os from 'node:os'; import path from 'node:path'; import Fastify, { type FastifyInstance } from 'fastify'; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; -import { MindDB } from '@waggle/core'; import { buildLocalServer } from '../src/local/index.js'; import { injectWithAuth } from './test-utils.js'; import { DreamJournal } from '../src/local/dream-journal.js'; @@ -119,8 +118,6 @@ describe('dreams route wiring in buildLocalServer', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-dreams-full-')); - const mind = new MindDB(path.join(tmpDir, 'personal.mind')); - mind.close(); server = await buildLocalServer({ dataDir: tmpDir }); }); diff --git a/packages/server/tests/local/browser-ext-pairing-lifecycle.test.ts b/packages/server/tests/local/browser-ext-pairing-lifecycle.test.ts index 1bcd940..6f952e3 100644 --- a/packages/server/tests/local/browser-ext-pairing-lifecycle.test.ts +++ b/packages/server/tests/local/browser-ext-pairing-lifecycle.test.ts @@ -2,7 +2,6 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import type { FastifyInstance } from 'fastify'; -import { MindDB } from '@waggle/core'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import { buildLocalServer } from '../../src/local/index.js'; import { @@ -47,7 +46,6 @@ describe('Browser Companion pairing lifecycle', () => { try { fs.mkdirSync(path.join(dataDir, 'skills'), { recursive: true }); fs.writeFileSync(path.join(dataDir, 'skills', '.starter-installed'), 'test'); - new MindDB(path.join(dataDir, 'personal.mind')).close(); server1 = await buildLocalServer({ dataDir }); const firstGlobalToken = server1.agentState.wsSessionToken; diff --git a/packages/server/tests/local/cost.test.ts b/packages/server/tests/local/cost.test.ts index e1759dc..bf68630 100644 --- a/packages/server/tests/local/cost.test.ts +++ b/packages/server/tests/local/cost.test.ts @@ -9,7 +9,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, SessionStore, FrameStore } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -26,15 +25,6 @@ describe('Cost Dashboard API', () => { fs.mkdirSync(path.join(tmpDir, 'skills'), { recursive: true }); fs.writeFileSync(path.join(tmpDir, 'skills', '.starter-installed'), 'test'); - // Create personal.mind (required by buildLocalServer) - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('cost-test'); - frames.createIFrame(s1.gop_id, 'Cost test frame', 'normal'); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); }); @@ -151,9 +141,6 @@ describe('Cost Dashboard API', () => { path.join(restartDir, 'config.json'), JSON.stringify({ tier: 'TEAMS', dailyBudget: 10 }), ); - const mind = new MindDB(path.join(restartDir, 'personal.mind')); - mind.close(); - initialServer = await buildLocalServer({ dataDir: restartDir }); const traceId = initialServer.traceStore.start({ sessionId: 'persisted-cost-dashboard-source', diff --git a/packages/server/tests/local/embedding-routing.test.ts b/packages/server/tests/local/embedding-routing.test.ts index 8280054..e2ad383 100644 --- a/packages/server/tests/local/embedding-routing.test.ts +++ b/packages/server/tests/local/embedding-routing.test.ts @@ -12,7 +12,6 @@ import { describe, it, expect, beforeAll, afterAll, beforeEach } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, SessionStore, FrameStore } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -32,14 +31,6 @@ describe('Embedding routing API', () => { fs.mkdirSync(path.join(tmpDir, 'skills'), { recursive: true }); fs.writeFileSync(path.join(tmpDir, 'skills', '.starter-installed'), 'test'); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('embrouting-test'); - frames.createIFrame(s1.gop_id, 'Embedding routing test frame', 'normal'); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); }); diff --git a/packages/server/tests/local/files.test.ts b/packages/server/tests/local/files.test.ts index 78419fa..13061ea 100644 --- a/packages/server/tests/local/files.test.ts +++ b/packages/server/tests/local/files.test.ts @@ -8,7 +8,6 @@ import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, SessionStore, FrameStore } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import type { FileEntry } from '../../src/local/storage/types.js'; @@ -23,15 +22,6 @@ describe('File Management API', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-files-')); - // Create personal.mind (required by buildLocalServer) - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('files-test'); - frames.createIFrame(s1.gop_id, 'File management test', 'normal'); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); // Create a test workspace diff --git a/packages/server/tests/local/phase2-traversal-chat.test.ts b/packages/server/tests/local/phase2-traversal-chat.test.ts index d22da9c..7a91827 100644 --- a/packages/server/tests/local/phase2-traversal-chat.test.ts +++ b/packages/server/tests/local/phase2-traversal-chat.test.ts @@ -33,7 +33,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, SessionStore, FrameStore } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -47,15 +46,6 @@ describe('R6-001 — POST /api/chat session-persistence path traversal guard', ( beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-chat-traversal-')); - // Create personal.mind (required by buildLocalServer). - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('chat-traversal-test'); - frames.createIFrame(s1.gop_id, 'chat traversal test frame', 'normal'); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); validWorkspaceId = ( server as unknown as { agentState: { activeWorkspaceId: string } } diff --git a/packages/server/tests/local/providers.test.ts b/packages/server/tests/local/providers.test.ts index b0390db..dfab015 100644 --- a/packages/server/tests/local/providers.test.ts +++ b/packages/server/tests/local/providers.test.ts @@ -8,7 +8,6 @@ import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, SessionStore, FrameStore } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -73,13 +72,6 @@ describe('Provider API', () => { prevOllamaHost = process.env.OLLAMA_HOST; process.env.OLLAMA_HOST = 'http://127.0.0.1:1'; tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-providers-')); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('providers-test'); - frames.createIFrame(s1.gop_id, 'Provider test', 'normal'); - mind.close(); server = await buildLocalServer({ dataDir: tmpDir }); }); @@ -349,13 +341,6 @@ describe('Model Validation', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-model-val-')); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('model-val-test'); - frames.createIFrame(s1.gop_id, 'Model validation test', 'normal'); - mind.close(); // Set TRIAL tier so we're not capped at the FREE limit (5 workspaces). // Without this, ensureDefault() + 4 test workspaces = 5, making the next // POST hit the tier limit (403) before reaching model validation (400). diff --git a/packages/server/tests/local/settings-permissions.test.ts b/packages/server/tests/local/settings-permissions.test.ts index 02ed814..1e02e12 100644 --- a/packages/server/tests/local/settings-permissions.test.ts +++ b/packages/server/tests/local/settings-permissions.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, FrameStore, SessionStore } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -14,15 +13,6 @@ describe('Permission settings API', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-perms-test-')); - // Create personal.mind (required by server startup) - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('test-project'); - frames.createIFrame(s1.gop_id, 'test content', 'normal'); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); }); diff --git a/packages/server/tests/local/sse-resilience.test.ts b/packages/server/tests/local/sse-resilience.test.ts index b7616d7..20812f0 100644 --- a/packages/server/tests/local/sse-resilience.test.ts +++ b/packages/server/tests/local/sse-resilience.test.ts @@ -17,7 +17,6 @@ import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; import { EventEmitter } from 'node:events'; -import { MindDB, SessionStore, FrameStore } from '@waggle/core'; import type { ToolDefinition } from '@waggle/agent'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; @@ -50,15 +49,6 @@ describe('SSE Stream Resilience', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-sse-resilience-')); - // Create personal.mind (required by buildLocalServer) - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('sse-test'); - frames.createIFrame(s1.gop_id, 'SSE resilience test frame', 'normal'); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); }); diff --git a/packages/server/tests/offline-mode.test.ts b/packages/server/tests/offline-mode.test.ts index 0232392..7a2ec67 100644 --- a/packages/server/tests/offline-mode.test.ts +++ b/packages/server/tests/offline-mode.test.ts @@ -6,7 +6,6 @@ import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, SessionStore, FrameStore } from '@waggle/core'; import { buildLocalServer } from '../src/local/index.js'; import { OfflineManager } from '../src/local/offline-manager.js'; import { EventEmitter } from 'node:events'; @@ -433,15 +432,6 @@ describe('Offline REST routes', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-offline-route-')); - // Create personal.mind - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('offline-test'); - frames.createIFrame(s1.gop_id, 'Test frame', 'normal'); - mind.close(); - serverBuild = buildLocalServer({ dataDir: tmpDir }).then(async (builtServer) => { await builtServer.offlineManager.stop(); return builtServer; diff --git a/packages/server/tests/plugin-autoload.test.ts b/packages/server/tests/plugin-autoload.test.ts index ba34b09..0bcb9bb 100644 --- a/packages/server/tests/plugin-autoload.test.ts +++ b/packages/server/tests/plugin-autoload.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, FrameStore, SessionStore } from '@waggle/core'; import { buildLocalServer } from '../src/local/index.js'; import type { FastifyInstance } from 'fastify'; @@ -14,16 +13,7 @@ import type { FastifyInstance } from 'fastify'; */ function createTmpDataDir(): string { - const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-plugin-autoload-')); - // Create personal.mind so the server can boot - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s = sessions.create('boot-test'); - frames.createIFrame(s.gop_id, 'boot test', 'normal'); - mind.close(); - return tmpDir; + return fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-plugin-autoload-')); } const SERVER_BOOT_TIMEOUT_MS = 30_000; diff --git a/packages/server/tests/routes/approval-flow.test.ts b/packages/server/tests/routes/approval-flow.test.ts index 6bf1913..dfa6b16 100644 --- a/packages/server/tests/routes/approval-flow.test.ts +++ b/packages/server/tests/routes/approval-flow.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -19,9 +18,6 @@ describe('Approval Flow — Server Side', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-approval-test-')); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - mind.close(); server = await buildLocalServer({ dataDir: tmpDir }); }); diff --git a/packages/server/tests/routes/capabilities.test.ts b/packages/server/tests/routes/capabilities.test.ts index e41de31..9ad0956 100644 --- a/packages/server/tests/routes/capabilities.test.ts +++ b/packages/server/tests/routes/capabilities.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, SessionStore, FrameStore } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -13,16 +12,6 @@ describe('Capabilities Route', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-caps-test-')); - - // Create personal.mind (required by buildLocalServer) - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('test'); - frames.createIFrame(s1.gop_id, 'Test content', 'normal'); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); }); diff --git a/packages/server/tests/routes/capability-packs.test.ts b/packages/server/tests/routes/capability-packs.test.ts index 9651b3e..0d0b632 100644 --- a/packages/server/tests/routes/capability-packs.test.ts +++ b/packages/server/tests/routes/capability-packs.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, SessionStore, FrameStore } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -13,13 +12,6 @@ describe('Capability Packs API', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-packs-')); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('test'); - frames.createIFrame(s1.gop_id, 'Test content', 'normal'); - mind.close(); server = await buildLocalServer({ dataDir: tmpDir }); }); diff --git a/packages/server/tests/routes/command-interpret.test.ts b/packages/server/tests/routes/command-interpret.test.ts index 58cd9ab..033b4c8 100644 --- a/packages/server/tests/routes/command-interpret.test.ts +++ b/packages/server/tests/routes/command-interpret.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, SessionStore } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -13,10 +12,6 @@ describe('POST /api/command/interpret', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-interpret-test-')); - const mind = new MindDB(path.join(tmpDir, 'personal.mind')); - const sessions = new SessionStore(mind); - sessions.create('test'); - mind.close(); server = await buildLocalServer({ dataDir: tmpDir }); }); diff --git a/packages/server/tests/routes/commands.test.ts b/packages/server/tests/routes/commands.test.ts index e5b9ffd..aea6618 100644 --- a/packages/server/tests/routes/commands.test.ts +++ b/packages/server/tests/routes/commands.test.ts @@ -2,7 +2,7 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB, SessionStore, FrameStore } from '@waggle/core'; +import { PERSONAL_SCOPE } from '@waggle/memory-contract'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -14,17 +14,16 @@ describe('Command Execution Route', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-cmd-test-')); - // Create personal.mind (required by buildLocalServer) - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s1 = sessions.create('test'); - frames.createIFrame(s1.gop_id, 'Test memory about architecture decisions', 'normal'); - frames.createIFrame(s1.gop_id, 'Another memory about deployment', 'important'); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); + await server.memory.remember({ + scope: PERSONAL_SCOPE, + text: 'Test memory about architecture decisions', + }); + await server.memory.remember({ + scope: PERSONAL_SCOPE, + text: 'Another memory about deployment', + importance: 'important', + }); }); afterAll(async () => { @@ -75,7 +74,7 @@ describe('Command Execution Route', () => { const body = JSON.parse(res.body); expect(body.command).toBe('/memory architecture decisions'); expect(body.result).toContain('Memory Search'); - expect(body.result).toContain('architecture decisions'); + expect(body.result).toContain('Test memory about architecture decisions'); }); it('POST /api/commands/execute with /catchup returns workspace state', async () => { diff --git a/packages/server/tests/routes/cron-api.test.ts b/packages/server/tests/routes/cron-api.test.ts index fe5574f..c3ebc7e 100644 --- a/packages/server/tests/routes/cron-api.test.ts +++ b/packages/server/tests/routes/cron-api.test.ts @@ -9,7 +9,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -20,12 +19,6 @@ describe('Cron REST API Routes', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-cron-api-')); - - // Create personal.mind - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); }); diff --git a/packages/server/tests/routes/health.test.ts b/packages/server/tests/routes/health.test.ts index 73a78b4..62b6581 100644 --- a/packages/server/tests/routes/health.test.ts +++ b/packages/server/tests/routes/health.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; @@ -12,10 +11,6 @@ describe('Health Endpoint', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-health-test-')); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir, port: 38123, diff --git a/packages/server/tests/routes/persistence.test.ts b/packages/server/tests/routes/persistence.test.ts index 3f1d4a3..d6b42fe 100644 --- a/packages/server/tests/routes/persistence.test.ts +++ b/packages/server/tests/routes/persistence.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, afterAll } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -26,12 +25,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => { return dir; } - function initMind(dataDir: string): void { - const personalPath = path.join(dataDir, 'personal.mind'); - const mind = new MindDB(personalPath); - mind.close(); - } - afterAll(() => { for (const dir of tmpDirs) { fs.rmSync(dir, { recursive: true, force: true }); @@ -42,7 +35,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => { it('installed skill survives server restart', async () => { const dataDir = makeTmpDir(); - initMind(dataDir); // 1. Build server, install a skill const server1 = await buildLocalServer({ dataDir }); @@ -79,7 +71,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => { it('multiple installed skills all survive restart', async () => { const dataDir = makeTmpDir(); - initMind(dataDir); const skillsToInstall = ['retrospective', 'daily-plan', 'brainstorm']; @@ -115,7 +106,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => { it('all endpoints agree on skill state after install', async () => { const dataDir = makeTmpDir(); - initMind(dataDir); const server = await buildLocalServer({ dataDir }); @@ -163,7 +153,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => { it('all endpoints agree after restart', async () => { const dataDir = makeTmpDir(); - initMind(dataDir); // Install, then restart const server1 = await buildLocalServer({ dataDir }); @@ -200,8 +189,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => { it('different dataDirs have independent skill state', async () => { const dataDir1 = makeTmpDir(); const dataDir2 = makeTmpDir(); - initMind(dataDir1); - initMind(dataDir2); // Install a skill in dataDir1 only const server1 = await buildLocalServer({ dataDir: dataDir1 }); @@ -226,7 +213,6 @@ describe('Capability Persistence & Cross-Surface Agreement', () => { it('deleting skill file from disk makes it unavailable after restart', async () => { const dataDir = makeTmpDir(); - initMind(dataDir); // Install const server1 = await buildLocalServer({ dataDir }); diff --git a/packages/server/tests/routes/starter-catalog.test.ts b/packages/server/tests/routes/starter-catalog.test.ts index 87d7cb2..f0bffd0 100644 --- a/packages/server/tests/routes/starter-catalog.test.ts +++ b/packages/server/tests/routes/starter-catalog.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, beforeAll, afterAll, beforeEach } from 'vitest'; import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; -import { MindDB } from '@waggle/core'; import { buildLocalServer } from '../../src/local/index.js'; import type { FastifyInstance } from 'fastify'; import { injectWithAuth } from '../test-utils.js'; @@ -16,9 +15,6 @@ describe('Starter Skill Catalog', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-catalog-test-')); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - mind.close(); server = await buildLocalServer({ dataDir: tmpDir }); }); diff --git a/packages/server/tests/skill-audit-route.test.ts b/packages/server/tests/skill-audit-route.test.ts index 2c9a471..52dabc2 100644 --- a/packages/server/tests/skill-audit-route.test.ts +++ b/packages/server/tests/skill-audit-route.test.ts @@ -12,7 +12,7 @@ import { describe, it, expect, beforeAll, afterAll, beforeEach } from 'vitest'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { MindDB, VaultStore } from '@waggle/core'; +import { VaultStore } from '@waggle/core'; import { buildLocalServer } from '../src/local/index.js'; import { injectWithAuth } from './test-utils.js'; import type { FastifyInstance } from 'fastify'; @@ -56,7 +56,6 @@ describe('skill-audit routes (§D2)', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-skill-audit-')); - new MindDB(path.join(tmpDir, 'personal.mind')).close(); new VaultStore(tmpDir).set('anthropic', KEY, { models: ['claude-haiku-4-5-20251001'] }); // One installed skill to audit. const skillsDir = path.join(tmpDir, 'skills'); diff --git a/packages/server/tests/skill-requirements-route.test.ts b/packages/server/tests/skill-requirements-route.test.ts index c1b4a9f..9a02929 100644 --- a/packages/server/tests/skill-requirements-route.test.ts +++ b/packages/server/tests/skill-requirements-route.test.ts @@ -8,7 +8,6 @@ import { describe, it, expect, beforeAll, afterAll, beforeEach } from 'vitest'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { MindDB } from '@waggle/core'; import { clearSkillRequirementsCache } from '@waggle/agent'; import { buildLocalServer } from '../src/local/index.js'; import { injectWithAuth } from './test-utils.js'; @@ -30,7 +29,6 @@ describe('skill requirements route annotation (#15)', () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-skill-req-')); - new MindDB(path.join(tmpDir, 'personal.mind')).close(); const skillsDir = path.join(tmpDir, 'skills'); fs.mkdirSync(skillsDir, { recursive: true }); fs.writeFileSync(path.join(skillsDir, 'plain.md'), '# Plain\n\nNo requirements declared.', 'utf-8'); diff --git a/packages/server/tests/tools-routes-launch.test.ts b/packages/server/tests/tools-routes-launch.test.ts index 2efc8b7..1ce2529 100644 --- a/packages/server/tests/tools-routes-launch.test.ts +++ b/packages/server/tests/tools-routes-launch.test.ts @@ -20,7 +20,6 @@ import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; import type { FastifyInstance } from 'fastify'; -import { MindDB, FrameStore, SessionStore } from '@waggle/core'; vi.mock('@waggle/agent', async (importOriginal) => { const actual = await importOriginal(); @@ -118,14 +117,6 @@ describe('POST /api/tools/launch', () => { beforeAll(async () => { tmpDir = createTmpDir('launch'); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s = sessions.create('launch-test'); - frames.createIFrame(s.gop_id, 'launch-test seed', 'normal'); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); await server.ready(); workspaceId = server.workspaceManager.getDefault() ?? server.workspaceManager.list()[0]!.id; @@ -823,13 +814,6 @@ describe('GET /api/tools/processes', () => { beforeAll(async () => { tmpDir = createTmpDir('processes'); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s = sessions.create('processes-test'); - frames.createIFrame(s.gop_id, 'processes-test seed', 'normal'); - mind.close(); server = await buildLocalServer({ dataDir: tmpDir }); await server.ready(); }); @@ -872,13 +856,6 @@ describe('POST /api/tools/kill', () => { beforeAll(async () => { tmpDir = createTmpDir('kill'); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s = sessions.create('kill-test'); - frames.createIFrame(s.gop_id, 'kill-test seed', 'normal'); - mind.close(); server = await buildLocalServer({ dataDir: tmpDir }); await server.ready(); }); @@ -949,14 +926,6 @@ describe('POST /api/tools/hooks', () => { beforeAll(async () => { tmpDir = createTmpDir('hooks'); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s = sessions.create('hooks-test'); - frames.createIFrame(s.gop_id, 'hooks-test seed', 'normal'); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); await server.ready(); }); @@ -1107,13 +1076,6 @@ describe('POST /api/tools/launch — persistence + reconcile', () => { beforeAll(() => { tmpDir = createTmpDir('persist'); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s = sessions.create('persist-test'); - frames.createIFrame(s.gop_id, 'persist-test seed', 'normal'); - mind.close(); }); afterAll(() => { diff --git a/packages/server/tests/tools-routes-stream.test.ts b/packages/server/tests/tools-routes-stream.test.ts index bf1590f..44f9294 100644 --- a/packages/server/tests/tools-routes-stream.test.ts +++ b/packages/server/tests/tools-routes-stream.test.ts @@ -11,7 +11,6 @@ import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; import type { FastifyInstance } from 'fastify'; -import { MindDB, FrameStore, SessionStore } from '@waggle/core'; vi.mock('@waggle/agent', async (importOriginal) => { const actual = await importOriginal(); @@ -69,12 +68,6 @@ describe('GET /api/tools/stream', () => { beforeAll(async () => { dir = tmp('s'); - const mind = new MindDB(path.join(dir, 'personal.mind')); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s = sessions.create('stream-test'); - frames.createIFrame(s.gop_id, 'stream seed', 'normal'); - mind.close(); server = await buildLocalServer({ dataDir: dir }); await server.ready(); }); diff --git a/packages/server/tests/tools-routes.test.ts b/packages/server/tests/tools-routes.test.ts index a342d4f..3343390 100644 --- a/packages/server/tests/tools-routes.test.ts +++ b/packages/server/tests/tools-routes.test.ts @@ -24,7 +24,6 @@ import fs from 'node:fs'; import path from 'node:path'; import os from 'node:os'; import type { FastifyInstance } from 'fastify'; -import { MindDB, FrameStore, SessionStore } from '@waggle/core'; import { SUPPORTED_TOOLS } from '@waggle/shared'; import { buildLocalServer } from '../src/local/index.js'; import { injectWithAuth } from './test-utils.js'; @@ -47,14 +46,6 @@ describe('GET /api/tools/detect', () => { beforeAll(async () => { tmpDir = createTmpDir('routes'); - const personalPath = path.join(tmpDir, 'personal.mind'); - const mind = new MindDB(personalPath); - const sessions = new SessionStore(mind); - const frames = new FrameStore(mind); - const s = sessions.create('tools-routes-test'); - frames.createIFrame(s.gop_id, 'tools-routes-test seed frame', 'normal'); - mind.close(); - server = await buildLocalServer({ dataDir: tmpDir }); await server.ready(); });