refactor(server): search memory through the contract in artifacts, agent runs, route proposals and onboarding (P1.5)

- Artifact Center related search lists personal and workspace memories
  through server.memory and finds related chat sessions in the session
  files (UF-034).
- /api/agent/run searches the requested workspace's memory, or personal
  memory when no known workspace is given.
- Executor briefs search only the workspace's own memory and leave out
  temporary memories in the query; route proposals no longer borrow a
  mind from the cache.
- Onboarding treats any personal memory as evidence of prior use.
- The service no longer creates personal.mind on a fresh install, and
  isFirstRun also looks for waggle.db.
This commit is contained in:
shumeiko.it
2026-10-24 12:50:15 +02:00
parent e9ed8c0765
commit f310333970
13 changed files with 239 additions and 219 deletions

View File

@@ -7,12 +7,13 @@
// - Faza 1 GEPA-evolved shapes register on import (A3.2 effect).
// - listShapes() includes the LOCKED Phase 5 scope after import.
//
// Full Fastify .inject() integration tests (mocking multiMind +
// embeddingProvider + LiteLLM) are deferred to Phase 5 e2e validation —
// Full Fastify .inject() integration tests (mocking memory + LiteLLM)
// are deferred to Phase 5 e2e validation —
// current critical-path coverage is module + side-effect validation.
import Fastify from 'fastify';
import { describe, it, expect, vi } from 'vitest';
import { createInMemoryMemoryStore } from '@waggle/memory-contract';
describe('agent-run.ts route module', () => {
it('exports agentRunRoutes plugin function', async () => {
@@ -110,8 +111,7 @@ describe('agent-run.ts route module', () => {
const fetchImpl = vi.fn(async () => new Response('{', { status: 200 }));
vi.stubGlobal('fetch', fetchImpl);
const server = Fastify({ logger: false });
server.decorate('multiMind', { personal: {} } as never);
server.decorate('embeddingProvider', { dimensions: 3 } as never);
server.decorate('memory', createInMemoryMemoryStore());
server.decorate('agentState', { litellmApiKey: 'test-key' } as never);
server.decorate('localConfig', { litellmUrl: 'http://127.0.0.1:43123/v1' } as never);