Files
waggle-os/packages/agent/src/result-formatter.ts
shumeiko.it b734c1d3d2 refactor: remove KVARK, enterprise packs and the compliance subsystem (P1.4, P1.6)
KVARK is the commercial enterprise product and is not part of the community
edition. The agent's KVARK tools were never wired into the server, so
removing them changes no runtime behaviour beyond the routes listed here.

- agent: delete kvark-tools; CombinedRetrieval and formatCombinedResult now
  merge workspace and personal memory only (no KVARK lane, no source
  conflict note); connector substrate is always 'waggle'
- agent: promote_skill stops at workspace scope; team and enterprise scopes
  answer "not available in this edition" instead of an upgrade prompt
- server: delete src/kvark and GET /api/marketplace/enterprise-packs
- marketplace: delete ENTERPRISE_PACKS
- compliance (EU AI Act dashboard, its templates and the KVARK template
  seeded on every boot): delete core/src/compliance, the /api/compliance/*
  routes, agent compliance-pdf and the Cockpit compliance panel. The
  ai_interactions table lives in the memory substrate and goes with P1.5.
2026-10-20 00:27:16 +02:00

51 lines
1.8 KiB
TypeScript

import type { CombinedRetrievalResult, CombinedResult } from './combined-retrieval.js';
// ── Combined retrieval result formatter ─────────────────────────────────
function formatResultEntry(r: CombinedResult, includeFrameType: boolean): string {
const lines = [`- ${r.content} ${r.attribution} (score: ${r.score.toFixed(3)}`];
if (includeFrameType && r.metadata.frameType) {
lines[0] += `, type: ${r.metadata.frameType}`;
}
if (includeFrameType && r.metadata.importance) {
lines[0] += `, importance: ${r.metadata.importance}`;
}
lines[0] += ')';
return lines.join('\n');
}
/**
* Format a CombinedRetrievalResult into a human-readable string for the agent.
* @param result The combined retrieval result
* @param hasWorkspace Whether a workspace is active (controls header display)
*/
export function formatCombinedResult(result: CombinedRetrievalResult, hasWorkspace: boolean): string {
const sections: string[] = [];
// Workspace results
if (result.workspaceResults.length > 0) {
const header = '## Workspace Memory';
const entries = result.workspaceResults.map(r => formatResultEntry(r, true)).join('\n');
sections.push(`${header}\n${entries}`);
}
// Personal results
if (result.personalResults.length > 0) {
if (hasWorkspace) {
const header = '## Personal Memory';
const entries = result.personalResults.map(r => formatResultEntry(r, true)).join('\n');
sections.push(`${header}\n${entries}`);
} else {
// No workspace = no header, just results
const entries = result.personalResults.map(r => formatResultEntry(r, true)).join('\n');
sections.push(entries);
}
}
if (sections.length === 0) {
return 'No relevant memories found.';
}
return sections.join('\n\n');
}