refactor(server): read workspace state, briefings and workspaces from the memory contract (P1.5)
- Workspace state, the "Workspace Now" block, the home briefing and the proactive handlers read the workspace's memory through server.memory: decisions are memories of kind 'decision', critical ones or ones worded as decisions; summaries list memories most important first. They no longer open workspace .mind files, so the builders are async and ProactiveContext carries `memory` instead of `getWorkspaceMindDb`. - The home briefing counts extracted personal facts that are neither confirmed nor archived as awaiting review (memory-status.ts). - Workspace routes count memories through the contract, seed template starter memories with remember() in the background (origin 'workspace-template'), export memories through list(), and deleting a workspace forgets its memory scope and clears its awareness items before the directory is removed; the delete is refused if forgetting fails. agentState.releaseWorkspace() replaces closeWorkspaceMind for callers. - The command palette searches personal memory and the active workspace's memory (UF-033). - chat.ts drops the MindDB-flake diagnostics; the mind cache they guarded no longer serves chat turns.
This commit is contained in:
@@ -6,7 +6,8 @@ import { EventEmitter } from 'node:events';
|
||||
import { NotificationGate, materialFingerprint, getNotificationGate } from '../src/local/notification-gate.js';
|
||||
import { emitNotification } from '../src/local/routes/notifications.js';
|
||||
import { suggestCapabilities, type ProactiveContext } from '../src/local/proactive-handlers.js';
|
||||
import { WorkspaceManager } from '@waggle/core';
|
||||
import { WaggleDB, WorkspaceManager } from '@waggle/core';
|
||||
import { createInMemoryMemoryStore } from '@waggle/memory-contract';
|
||||
|
||||
const STORE_FILE = 'notification-fingerprints.json';
|
||||
|
||||
@@ -156,15 +157,18 @@ describe('emitNotification anti-nag gate', () => {
|
||||
expect(emitted).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('suppresses a repeated identical proactive payload on the second emit', () => {
|
||||
it('suppresses a repeated identical proactive payload on the second emit', async () => {
|
||||
const wsManager = new WorkspaceManager(tmpDir);
|
||||
const waggleDb = new WaggleDB(':memory:');
|
||||
const ctx: ProactiveContext = {
|
||||
dataDir: tmpDir,
|
||||
workspaceManager: wsManager,
|
||||
getWorkspaceMindDb: () => null,
|
||||
memory: createInMemoryMemoryStore(),
|
||||
waggleDb,
|
||||
};
|
||||
// No skills installed → the "capability packs" suggestion, carrying a dedupeKey + hash.
|
||||
const msg = suggestCapabilities(ctx);
|
||||
const msg = await suggestCapabilities(ctx);
|
||||
waggleDb.close();
|
||||
expect(msg).not.toBeNull();
|
||||
expect(msg!.dedupeKey).toBeDefined();
|
||||
expect(msg!.materialHash).toBeDefined();
|
||||
|
||||
Reference in New Issue
Block a user