test(server): stop seeding a legacy personal mind (P1.5)
The server no longer opens personal.mind, so tests build it on an empty data directory. The /memory command test seeds its two memories through server.memory and now checks that the seeded text is found.
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 } }
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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<typeof import('@waggle/agent')>();
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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<typeof import('@waggle/agent')>();
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user