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.
This commit is contained in:
shumeiko.it
2026-10-20 00:27:02 +02:00
parent 10ad678547
commit b734c1d3d2
53 changed files with 56 additions and 6936 deletions

View File

@@ -1,11 +1,8 @@
/**
* B2 wiring tests — search_memory integration with CombinedRetrieval.
*
* Tests the search_memory tool's behavior with and without kvarkClient,
* and the formatCombinedResult helper.
* formatCombinedResult — renders a CombinedRetrieval result for the agent.
*/
import { describe, it, expect, vi } from 'vitest';
import { describe, it, expect } from 'vitest';
import { formatCombinedResult } from '../src/tools.js';
import type { CombinedRetrievalResult, CombinedResult } from '../src/combined-retrieval.js';
@@ -26,10 +23,6 @@ function makeRetrievalResult(overrides: Partial<CombinedRetrievalResult> = {}):
query: overrides.query ?? 'test',
workspaceResults: overrides.workspaceResults ?? [],
personalResults: overrides.personalResults ?? [],
kvarkResults: overrides.kvarkResults ?? [],
kvarkAvailable: overrides.kvarkAvailable ?? false,
kvarkSkipped: overrides.kvarkSkipped ?? false,
kvarkError: overrides.kvarkError,
};
}
@@ -88,92 +81,14 @@ describe('formatCombinedResult', () => {
expect(result).toContain('some pref');
});
it('formats KVARK results with Enterprise Knowledge header and attribution', () => {
const result = formatCombinedResult(makeRetrievalResult({
kvarkResults: [
makeCombinedResult({
source: 'kvark',
attribution: '[KVARK: pdf: Q3 Report]',
content: 'Revenue grew 15%',
score: 0.92,
metadata: { documentId: 42, documentType: 'pdf' },
}),
],
kvarkAvailable: true,
}), true);
expect(result).toContain('## Enterprise Knowledge (KVARK)');
expect(result).toContain('[KVARK: pdf: Q3 Report]');
expect(result).toContain('Revenue grew 15%');
expect(result).toContain('score: 0.920');
});
it('appends KVARK error note while preserving local results', () => {
const result = formatCombinedResult(makeRetrievalResult({
workspaceResults: [
makeCombinedResult({ content: 'local fact', score: 0.7 }),
],
kvarkError: 'Connection refused',
kvarkAvailable: true,
}), true);
expect(result).toContain('local fact');
expect(result).toContain('Enterprise search encountered an error: Connection refused');
expect(result).toContain('Results shown are from local memory only');
});
it('formats all three sources together correctly', () => {
it('formats workspace and personal sources in order', () => {
const result = formatCombinedResult(makeRetrievalResult({
workspaceResults: [makeCombinedResult({ content: 'ws data', score: 0.9 })],
personalResults: [makeCombinedResult({ source: 'personal', content: 'personal data', score: 0.7 })],
kvarkResults: [makeCombinedResult({ source: 'kvark', attribution: '[KVARK: doc]', content: 'enterprise data', score: 0.85 })],
kvarkAvailable: true,
}), true);
expect(result).toContain('## Workspace Memory');
expect(result).toContain('## Personal Memory');
expect(result).toContain('## Enterprise Knowledge (KVARK)');
// Verify ordering: workspace → personal → KVARK
const wsIdx = result.indexOf('## Workspace Memory');
const pIdx = result.indexOf('## Personal Memory');
const kIdx = result.indexOf('## Enterprise Knowledge');
expect(wsIdx).toBeLessThan(pIdx);
expect(pIdx).toBeLessThan(kIdx);
});
it('KVARK results use score-only format (no frame_type/importance)', () => {
const result = formatCombinedResult(makeRetrievalResult({
kvarkResults: [
makeCombinedResult({
source: 'kvark',
attribution: '[KVARK: pdf: Doc]',
content: 'content',
score: 0.9,
}),
],
kvarkAvailable: true,
}), true);
// KVARK results should NOT have frame_type or importance
expect(result).not.toContain('type:');
expect(result).not.toContain('importance:');
expect(result).toContain('score: 0.900');
});
});
// ── MindToolDeps.kvarkClient integration (structural tests) ─────────────
describe('MindToolDeps kvarkClient integration', () => {
it('MindToolDeps accepts optional kvarkClient', async () => {
// This is a compile-time test — if MindToolDeps didn't have kvarkClient,
// TypeScript would catch it. We verify the type exists by importing it.
const { type } = await import('../src/tools.js');
// If we got here, the import succeeded and the type exists
expect(true).toBe(true);
});
it('OrchestratorConfig accepts optional kvarkClient', async () => {
const { type } = await import('../src/orchestrator.js');
expect(true).toBe(true);
expect(result.indexOf('## Workspace Memory')).toBeLessThan(result.indexOf('## Personal Memory'));
});
});