test(agent): move the agent suites onto the memory contract (P1.5)
Rewrites the orchestrator, recall, compaction, save_memory and assembler suites for MemoryStore (createInMemoryMemoryStore; mem0 with the word embedder for the M3b integration test), string ids, async prompt building and setWorkspace(). Creation times are set with fake timers, since a write cannot set its own. Stores of Waggle's own data (identity, traces) are built on WaggleDB; the session-manager stubs use the new create() signature. Kept behaviour: importance lane (cap, active scope, temporary exclusion), profile and event lanes, date window and its fallback, catch-up, injection blocking of recall and preloaded context, autosave safety, decision consent, compaction update-in-place, reranker wiring. New tests: recall with a workspace active versus personal only; fetchRecentMemories ordering; toRecallFrame; context loader; save_memory routing, dedup, rate limit, dramatic-claim downgrade and contradiction scope; search_memory and search_all_workspaces; pattern write-back kinds, scopes and sign gate; read_other_workspace; reranker off unless WAGGLE_RERANKER=1, wider rerank pool, failure fallbacks. Deleted, because the behaviour is gone: - w46-rawdetail-recall.test.ts: the raw-turn (RAWDETAIL) recall lane. - orchestrator.test.ts, query_knowledge (3 tests) and the recall-hardening M4 "Key Knowledge" test: the knowledge graph is not in v1 (ADR-0002). - orchestrator-context-frames "profile override": scoring profiles. - Assertions on I/P frame types, GOP sessions, FTS rows, the "Memory Facts" lane, cognify stages and session/entity counts were replaced by the equivalent contract-level checks.
This commit is contained in:
@@ -1,40 +1,33 @@
|
||||
import { describe, it, expect, afterEach } from 'vitest';
|
||||
import { MindDB } from '@waggle/core';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { createInMemoryMemoryStore } from '@waggle/memory-contract';
|
||||
import { Orchestrator } from '../src/orchestrator.js';
|
||||
import { MockEmbedder } from '../../hive-mind-core/tests/mind/helpers/mock-embedder.js';
|
||||
|
||||
describe('buildSystemPrompt goal-ancestry (#6)', () => {
|
||||
const dbs: MindDB[] = [];
|
||||
function orch(goalAncestry?: { project?: string; goal?: string; mission?: string; task?: string }) {
|
||||
const db = new MindDB(':memory:');
|
||||
dbs.push(db);
|
||||
return new Orchestrator({ db, embedder: new MockEmbedder(), ...(goalAncestry ? { goalAncestry } : {}) });
|
||||
return new Orchestrator({ memory: createInMemoryMemoryStore(), ...(goalAncestry ? { goalAncestry } : {}) });
|
||||
}
|
||||
afterEach(() => {
|
||||
while (dbs.length) dbs.pop()!.close();
|
||||
});
|
||||
|
||||
it("renders the Why You're Here section after setGoalAncestry", () => {
|
||||
it("renders the Why You're Here section after setGoalAncestry", async () => {
|
||||
const o = orch();
|
||||
o.setGoalAncestry({ project: 'Acme Redesign', goal: 'Ship the live-output pane' });
|
||||
const prompt = o.buildSystemPrompt();
|
||||
const prompt = await o.buildSystemPrompt();
|
||||
expect(prompt).toContain("# Why You're Here");
|
||||
expect(prompt).toContain('Project: Acme Redesign');
|
||||
expect(prompt).toContain('Goal: Ship the live-output pane');
|
||||
});
|
||||
|
||||
it('omits the section entirely when no ancestry is set', () => {
|
||||
expect(orch().buildSystemPrompt()).not.toContain("# Why You're Here");
|
||||
it('omits the section entirely when no ancestry is set', async () => {
|
||||
expect(await orch().buildSystemPrompt()).not.toContain("# Why You're Here");
|
||||
});
|
||||
|
||||
it('accepts goalAncestry via the constructor config', () => {
|
||||
expect(orch({ project: 'P' }).buildSystemPrompt()).toContain('Project: P');
|
||||
it('accepts goalAncestry via the constructor config', async () => {
|
||||
expect(await orch({ project: 'P' }).buildSystemPrompt()).toContain('Project: P');
|
||||
});
|
||||
|
||||
it('clears the section when setGoalAncestry(null)', () => {
|
||||
it('clears the section when setGoalAncestry(null)', async () => {
|
||||
const o = orch({ project: 'P' });
|
||||
expect(o.buildSystemPrompt()).toContain('Project: P');
|
||||
expect(await o.buildSystemPrompt()).toContain('Project: P');
|
||||
o.setGoalAncestry(null);
|
||||
expect(o.buildSystemPrompt()).not.toContain("# Why You're Here");
|
||||
expect(await o.buildSystemPrompt()).not.toContain("# Why You're Here");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user