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,107 +0,0 @@
/**
* Enterprise Packs — unit tests for KVARK-conditional pack definitions
* and the enterprise-packs endpoint behavior.
*/
import { describe, it, expect } from 'vitest';
import { ENTERPRISE_PACKS, type EnterprisePack } from '../src/enterprise-packs';
describe('ENTERPRISE_PACKS definitions', () => {
it('has at least 3 enterprise packs', () => {
expect(ENTERPRISE_PACKS.length).toBeGreaterThanOrEqual(3);
});
it('every pack has required fields', () => {
for (const pack of ENTERPRISE_PACKS) {
expect(typeof pack.slug).toBe('string');
expect(pack.slug.length).toBeGreaterThan(0);
expect(typeof pack.display_name).toBe('string');
expect(pack.display_name.length).toBeGreaterThan(0);
expect(typeof pack.description).toBe('string');
expect(pack.description.length).toBeGreaterThan(0);
expect(typeof pack.target_roles).toBe('string');
expect(pack.target_roles.length).toBeGreaterThan(0);
expect(typeof pack.icon).toBe('string');
expect(pack.icon.length).toBeGreaterThan(0);
expect(Array.isArray(pack.skills)).toBe(true);
expect(pack.skills.length).toBeGreaterThan(0);
expect(Array.isArray(pack.kvarkRequirements)).toBe(true);
expect(pack.kvarkRequirements.length).toBeGreaterThan(0);
}
});
it('all slugs are unique', () => {
const slugs = ENTERPRISE_PACKS.map(p => p.slug);
expect(new Set(slugs).size).toBe(slugs.length);
});
it('slugs are kebab-case (no spaces or uppercase)', () => {
for (const pack of ENTERPRISE_PACKS) {
expect(pack.slug).toMatch(/^[a-z0-9]+(-[a-z0-9]+)*$/);
}
});
it('every pack references at least one kvark skill', () => {
for (const pack of ENTERPRISE_PACKS) {
const hasKvarkSkill = pack.skills.some(s => s.startsWith('kvark_'));
expect(hasKvarkSkill).toBe(true);
}
});
it('contains the expected pack slugs', () => {
const slugs = ENTERPRISE_PACKS.map(p => p.slug);
expect(slugs).toContain('enterprise-document-qa');
expect(slugs).toContain('compliance-workflow');
expect(slugs).toContain('knowledge-graph-enrichment');
});
});
describe('Enterprise packs endpoint behavior (simulated)', () => {
// Simulate the endpoint logic without starting a real Fastify server.
// The real endpoint uses getKvarkConfig(vault) to decide.
function simulateEndpoint(kvarkConfigured: boolean) {
if (!kvarkConfigured) {
return {
packs: [] as EnterprisePack[],
total: 0,
kvarkRequired: true,
hint: 'Enterprise packs require a KVARK connection. Configure KVARK credentials in the vault to unlock.',
};
}
return {
packs: ENTERPRISE_PACKS,
total: ENTERPRISE_PACKS.length,
kvarkRequired: false,
};
}
it('returns packs when KVARK is configured', () => {
const result = simulateEndpoint(true);
expect(result.packs.length).toBeGreaterThanOrEqual(3);
expect(result.total).toBe(ENTERPRISE_PACKS.length);
expect(result.kvarkRequired).toBe(false);
});
it('returns empty array when KVARK is not configured', () => {
const result = simulateEndpoint(false);
expect(result.packs).toEqual([]);
expect(result.total).toBe(0);
expect(result.kvarkRequired).toBe(true);
expect(result.hint).toBeDefined();
});
it('no packs leak when KVARK is absent', () => {
const result = simulateEndpoint(false);
expect(result.packs).toHaveLength(0);
// Ensure the response shape is consistent
expect(result).toHaveProperty('kvarkRequired', true);
expect(result).toHaveProperty('total', 0);
});
});