@soleri/core 2.1.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brain/brain.d.ts +10 -1
- package/dist/brain/brain.d.ts.map +1 -1
- package/dist/brain/brain.js +116 -13
- package/dist/brain/brain.js.map +1 -1
- package/dist/brain/intelligence.d.ts +36 -1
- package/dist/brain/intelligence.d.ts.map +1 -1
- package/dist/brain/intelligence.js +119 -14
- package/dist/brain/intelligence.js.map +1 -1
- package/dist/brain/types.d.ts +34 -2
- package/dist/brain/types.d.ts.map +1 -1
- package/dist/cognee/client.d.ts +3 -0
- package/dist/cognee/client.d.ts.map +1 -1
- package/dist/cognee/client.js +17 -0
- package/dist/cognee/client.js.map +1 -1
- package/dist/cognee/sync-manager.d.ts +94 -0
- package/dist/cognee/sync-manager.d.ts.map +1 -0
- package/dist/cognee/sync-manager.js +293 -0
- package/dist/cognee/sync-manager.js.map +1 -0
- package/dist/control/identity-manager.d.ts +22 -0
- package/dist/control/identity-manager.d.ts.map +1 -0
- package/dist/control/identity-manager.js +233 -0
- package/dist/control/identity-manager.js.map +1 -0
- package/dist/control/intent-router.d.ts +32 -0
- package/dist/control/intent-router.d.ts.map +1 -0
- package/dist/control/intent-router.js +242 -0
- package/dist/control/intent-router.js.map +1 -0
- package/dist/control/types.d.ts +68 -0
- package/dist/control/types.d.ts.map +1 -0
- package/dist/control/types.js +9 -0
- package/dist/control/types.js.map +1 -0
- package/dist/curator/curator.d.ts +37 -1
- package/dist/curator/curator.d.ts.map +1 -1
- package/dist/curator/curator.js +199 -1
- package/dist/curator/curator.js.map +1 -1
- package/dist/errors/classify.d.ts +13 -0
- package/dist/errors/classify.d.ts.map +1 -0
- package/dist/errors/classify.js +97 -0
- package/dist/errors/classify.js.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +4 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/retry.d.ts +40 -0
- package/dist/errors/retry.d.ts.map +1 -0
- package/dist/errors/retry.js +97 -0
- package/dist/errors/retry.js.map +1 -0
- package/dist/errors/types.d.ts +48 -0
- package/dist/errors/types.d.ts.map +1 -0
- package/dist/errors/types.js +59 -0
- package/dist/errors/types.js.map +1 -0
- package/dist/facades/types.d.ts +1 -1
- package/dist/governance/governance.d.ts +42 -0
- package/dist/governance/governance.d.ts.map +1 -0
- package/dist/governance/governance.js +488 -0
- package/dist/governance/governance.js.map +1 -0
- package/dist/governance/index.d.ts +3 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +2 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/governance/types.d.ts +102 -0
- package/dist/governance/types.d.ts.map +1 -0
- package/dist/governance/types.js +3 -0
- package/dist/governance/types.js.map +1 -0
- package/dist/index.d.ts +52 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -1
- package/dist/index.js.map +1 -1
- package/dist/intake/content-classifier.d.ts +14 -0
- package/dist/intake/content-classifier.d.ts.map +1 -0
- package/dist/intake/content-classifier.js +125 -0
- package/dist/intake/content-classifier.js.map +1 -0
- package/dist/intake/dedup-gate.d.ts +17 -0
- package/dist/intake/dedup-gate.d.ts.map +1 -0
- package/dist/intake/dedup-gate.js +66 -0
- package/dist/intake/dedup-gate.js.map +1 -0
- package/dist/intake/intake-pipeline.d.ts +63 -0
- package/dist/intake/intake-pipeline.d.ts.map +1 -0
- package/dist/intake/intake-pipeline.js +373 -0
- package/dist/intake/intake-pipeline.js.map +1 -0
- package/dist/intake/types.d.ts +65 -0
- package/dist/intake/types.d.ts.map +1 -0
- package/dist/intake/types.js +3 -0
- package/dist/intake/types.js.map +1 -0
- package/dist/intelligence/loader.js +1 -1
- package/dist/intelligence/loader.js.map +1 -1
- package/dist/intelligence/types.d.ts +3 -1
- package/dist/intelligence/types.d.ts.map +1 -1
- package/dist/logging/logger.d.ts +37 -0
- package/dist/logging/logger.d.ts.map +1 -0
- package/dist/logging/logger.js +145 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/logging/types.d.ts +19 -0
- package/dist/logging/types.d.ts.map +1 -0
- package/dist/logging/types.js +2 -0
- package/dist/logging/types.js.map +1 -0
- package/dist/loop/loop-manager.d.ts +100 -0
- package/dist/loop/loop-manager.d.ts.map +1 -0
- package/dist/loop/loop-manager.js +379 -0
- package/dist/loop/loop-manager.js.map +1 -0
- package/dist/loop/types.d.ts +103 -0
- package/dist/loop/types.d.ts.map +1 -0
- package/dist/loop/types.js +11 -0
- package/dist/loop/types.js.map +1 -0
- package/dist/persistence/index.d.ts +3 -0
- package/dist/persistence/index.d.ts.map +1 -0
- package/dist/persistence/index.js +2 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/persistence/sqlite-provider.d.ts +25 -0
- package/dist/persistence/sqlite-provider.d.ts.map +1 -0
- package/dist/persistence/sqlite-provider.js +59 -0
- package/dist/persistence/sqlite-provider.js.map +1 -0
- package/dist/persistence/types.d.ts +36 -0
- package/dist/persistence/types.d.ts.map +1 -0
- package/dist/persistence/types.js +8 -0
- package/dist/persistence/types.js.map +1 -0
- package/dist/planning/gap-analysis.d.ts +72 -0
- package/dist/planning/gap-analysis.d.ts.map +1 -0
- package/dist/planning/gap-analysis.js +442 -0
- package/dist/planning/gap-analysis.js.map +1 -0
- package/dist/planning/gap-types.d.ts +29 -0
- package/dist/planning/gap-types.d.ts.map +1 -0
- package/dist/planning/gap-types.js +28 -0
- package/dist/planning/gap-types.js.map +1 -0
- package/dist/planning/planner.d.ts +421 -4
- package/dist/planning/planner.d.ts.map +1 -1
- package/dist/planning/planner.js +949 -21
- package/dist/planning/planner.js.map +1 -1
- package/dist/playbooks/generic/brainstorming.d.ts +9 -0
- package/dist/playbooks/generic/brainstorming.d.ts.map +1 -0
- package/dist/playbooks/generic/brainstorming.js +105 -0
- package/dist/playbooks/generic/brainstorming.js.map +1 -0
- package/dist/playbooks/generic/code-review.d.ts +11 -0
- package/dist/playbooks/generic/code-review.d.ts.map +1 -0
- package/dist/playbooks/generic/code-review.js +176 -0
- package/dist/playbooks/generic/code-review.js.map +1 -0
- package/dist/playbooks/generic/subagent-execution.d.ts +9 -0
- package/dist/playbooks/generic/subagent-execution.d.ts.map +1 -0
- package/dist/playbooks/generic/subagent-execution.js +68 -0
- package/dist/playbooks/generic/subagent-execution.js.map +1 -0
- package/dist/playbooks/generic/systematic-debugging.d.ts +9 -0
- package/dist/playbooks/generic/systematic-debugging.d.ts.map +1 -0
- package/dist/playbooks/generic/systematic-debugging.js +87 -0
- package/dist/playbooks/generic/systematic-debugging.js.map +1 -0
- package/dist/playbooks/generic/tdd.d.ts +9 -0
- package/dist/playbooks/generic/tdd.d.ts.map +1 -0
- package/dist/playbooks/generic/tdd.js +70 -0
- package/dist/playbooks/generic/tdd.js.map +1 -0
- package/dist/playbooks/generic/verification.d.ts +9 -0
- package/dist/playbooks/generic/verification.d.ts.map +1 -0
- package/dist/playbooks/generic/verification.js +74 -0
- package/dist/playbooks/generic/verification.js.map +1 -0
- package/dist/playbooks/index.d.ts +4 -0
- package/dist/playbooks/index.d.ts.map +1 -0
- package/dist/playbooks/index.js +5 -0
- package/dist/playbooks/index.js.map +1 -0
- package/dist/playbooks/playbook-registry.d.ts +42 -0
- package/dist/playbooks/playbook-registry.d.ts.map +1 -0
- package/dist/playbooks/playbook-registry.js +227 -0
- package/dist/playbooks/playbook-registry.js.map +1 -0
- package/dist/playbooks/playbook-seeder.d.ts +47 -0
- package/dist/playbooks/playbook-seeder.d.ts.map +1 -0
- package/dist/playbooks/playbook-seeder.js +104 -0
- package/dist/playbooks/playbook-seeder.js.map +1 -0
- package/dist/playbooks/playbook-types.d.ts +132 -0
- package/dist/playbooks/playbook-types.d.ts.map +1 -0
- package/dist/playbooks/playbook-types.js +12 -0
- package/dist/playbooks/playbook-types.js.map +1 -0
- package/dist/project/project-registry.d.ts +79 -0
- package/dist/project/project-registry.d.ts.map +1 -0
- package/dist/project/project-registry.js +274 -0
- package/dist/project/project-registry.js.map +1 -0
- package/dist/project/types.d.ts +28 -0
- package/dist/project/types.d.ts.map +1 -0
- package/dist/project/types.js +5 -0
- package/dist/project/types.js.map +1 -0
- package/dist/prompts/index.d.ts +4 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +3 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/parser.d.ts +17 -0
- package/dist/prompts/parser.d.ts.map +1 -0
- package/dist/prompts/parser.js +47 -0
- package/dist/prompts/parser.js.map +1 -0
- package/dist/prompts/template-manager.d.ts +25 -0
- package/dist/prompts/template-manager.d.ts.map +1 -0
- package/dist/prompts/template-manager.js +71 -0
- package/dist/prompts/template-manager.js.map +1 -0
- package/dist/prompts/types.d.ts +26 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/prompts/types.js +5 -0
- package/dist/prompts/types.js.map +1 -0
- package/dist/runtime/admin-extra-ops.d.ts +15 -0
- package/dist/runtime/admin-extra-ops.d.ts.map +1 -0
- package/dist/runtime/admin-extra-ops.js +595 -0
- package/dist/runtime/admin-extra-ops.js.map +1 -0
- package/dist/runtime/admin-ops.d.ts +15 -0
- package/dist/runtime/admin-ops.d.ts.map +1 -0
- package/dist/runtime/admin-ops.js +329 -0
- package/dist/runtime/admin-ops.js.map +1 -0
- package/dist/runtime/capture-ops.d.ts +15 -0
- package/dist/runtime/capture-ops.d.ts.map +1 -0
- package/dist/runtime/capture-ops.js +363 -0
- package/dist/runtime/capture-ops.js.map +1 -0
- package/dist/runtime/cognee-sync-ops.d.ts +12 -0
- package/dist/runtime/cognee-sync-ops.d.ts.map +1 -0
- package/dist/runtime/cognee-sync-ops.js +55 -0
- package/dist/runtime/cognee-sync-ops.js.map +1 -0
- package/dist/runtime/core-ops.d.ts +9 -3
- package/dist/runtime/core-ops.d.ts.map +1 -1
- package/dist/runtime/core-ops.js +693 -10
- package/dist/runtime/core-ops.js.map +1 -1
- package/dist/runtime/curator-extra-ops.d.ts +9 -0
- package/dist/runtime/curator-extra-ops.d.ts.map +1 -0
- package/dist/runtime/curator-extra-ops.js +71 -0
- package/dist/runtime/curator-extra-ops.js.map +1 -0
- package/dist/runtime/domain-ops.d.ts.map +1 -1
- package/dist/runtime/domain-ops.js +61 -15
- package/dist/runtime/domain-ops.js.map +1 -1
- package/dist/runtime/grading-ops.d.ts +14 -0
- package/dist/runtime/grading-ops.d.ts.map +1 -0
- package/dist/runtime/grading-ops.js +105 -0
- package/dist/runtime/grading-ops.js.map +1 -0
- package/dist/runtime/intake-ops.d.ts +14 -0
- package/dist/runtime/intake-ops.d.ts.map +1 -0
- package/dist/runtime/intake-ops.js +110 -0
- package/dist/runtime/intake-ops.js.map +1 -0
- package/dist/runtime/loop-ops.d.ts +14 -0
- package/dist/runtime/loop-ops.d.ts.map +1 -0
- package/dist/runtime/loop-ops.js +251 -0
- package/dist/runtime/loop-ops.js.map +1 -0
- package/dist/runtime/memory-cross-project-ops.d.ts +12 -0
- package/dist/runtime/memory-cross-project-ops.d.ts.map +1 -0
- package/dist/runtime/memory-cross-project-ops.js +165 -0
- package/dist/runtime/memory-cross-project-ops.js.map +1 -0
- package/dist/runtime/memory-extra-ops.d.ts +13 -0
- package/dist/runtime/memory-extra-ops.d.ts.map +1 -0
- package/dist/runtime/memory-extra-ops.js +173 -0
- package/dist/runtime/memory-extra-ops.js.map +1 -0
- package/dist/runtime/orchestrate-ops.d.ts +17 -0
- package/dist/runtime/orchestrate-ops.d.ts.map +1 -0
- package/dist/runtime/orchestrate-ops.js +246 -0
- package/dist/runtime/orchestrate-ops.js.map +1 -0
- package/dist/runtime/planning-extra-ops.d.ts +25 -0
- package/dist/runtime/planning-extra-ops.d.ts.map +1 -0
- package/dist/runtime/planning-extra-ops.js +663 -0
- package/dist/runtime/planning-extra-ops.js.map +1 -0
- package/dist/runtime/playbook-ops.d.ts +14 -0
- package/dist/runtime/playbook-ops.d.ts.map +1 -0
- package/dist/runtime/playbook-ops.js +141 -0
- package/dist/runtime/playbook-ops.js.map +1 -0
- package/dist/runtime/project-ops.d.ts +15 -0
- package/dist/runtime/project-ops.d.ts.map +1 -0
- package/dist/runtime/project-ops.js +186 -0
- package/dist/runtime/project-ops.js.map +1 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +65 -3
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/types.d.ts +29 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/vault-extra-ops.d.ts +10 -0
- package/dist/runtime/vault-extra-ops.d.ts.map +1 -0
- package/dist/runtime/vault-extra-ops.js +536 -0
- package/dist/runtime/vault-extra-ops.js.map +1 -0
- package/dist/telemetry/telemetry.d.ts +48 -0
- package/dist/telemetry/telemetry.d.ts.map +1 -0
- package/dist/telemetry/telemetry.js +87 -0
- package/dist/telemetry/telemetry.js.map +1 -0
- package/dist/vault/playbook.d.ts +34 -0
- package/dist/vault/playbook.d.ts.map +1 -0
- package/dist/vault/playbook.js +60 -0
- package/dist/vault/playbook.js.map +1 -0
- package/dist/vault/vault.d.ts +97 -4
- package/dist/vault/vault.d.ts.map +1 -1
- package/dist/vault/vault.js +424 -65
- package/dist/vault/vault.js.map +1 -1
- package/package.json +7 -3
- package/src/__tests__/admin-extra-ops.test.ts +467 -0
- package/src/__tests__/admin-ops.test.ts +271 -0
- package/src/__tests__/brain-intelligence.test.ts +205 -0
- package/src/__tests__/brain.test.ts +134 -3
- package/src/__tests__/capture-ops.test.ts +509 -0
- package/src/__tests__/cognee-integration.test.ts +80 -0
- package/src/__tests__/cognee-sync-manager.test.ts +103 -0
- package/src/__tests__/core-ops.test.ts +292 -2
- package/src/__tests__/curator-extra-ops.test.ts +381 -0
- package/src/__tests__/domain-ops.test.ts +66 -0
- package/src/__tests__/errors.test.ts +388 -0
- package/src/__tests__/governance.test.ts +522 -0
- package/src/__tests__/grading-ops.test.ts +361 -0
- package/src/__tests__/identity-manager.test.ts +243 -0
- package/src/__tests__/intake-pipeline.test.ts +162 -0
- package/src/__tests__/intent-router.test.ts +222 -0
- package/src/__tests__/logger.test.ts +200 -0
- package/src/__tests__/loop-ops.test.ts +469 -0
- package/src/__tests__/memory-cross-project-ops.test.ts +248 -0
- package/src/__tests__/memory-extra-ops.test.ts +352 -0
- package/src/__tests__/orchestrate-ops.test.ts +289 -0
- package/src/__tests__/persistence.test.ts +225 -0
- package/src/__tests__/planner.test.ts +416 -7
- package/src/__tests__/planning-extra-ops.test.ts +706 -0
- package/src/__tests__/playbook-registry.test.ts +326 -0
- package/src/__tests__/playbook-seeder.test.ts +163 -0
- package/src/__tests__/playbook.test.ts +389 -0
- package/src/__tests__/project-ops.test.ts +381 -0
- package/src/__tests__/template-manager.test.ts +222 -0
- package/src/__tests__/vault-extra-ops.test.ts +482 -0
- package/src/brain/brain.ts +185 -16
- package/src/brain/intelligence.ts +179 -10
- package/src/brain/types.ts +40 -2
- package/src/cognee/client.ts +18 -0
- package/src/cognee/sync-manager.ts +389 -0
- package/src/control/identity-manager.ts +354 -0
- package/src/control/intent-router.ts +326 -0
- package/src/control/types.ts +102 -0
- package/src/curator/curator.ts +295 -1
- package/src/errors/classify.ts +102 -0
- package/src/errors/index.ts +5 -0
- package/src/errors/retry.ts +132 -0
- package/src/errors/types.ts +81 -0
- package/src/governance/governance.ts +698 -0
- package/src/governance/index.ts +18 -0
- package/src/governance/types.ts +111 -0
- package/src/index.ts +213 -2
- package/src/intake/content-classifier.ts +146 -0
- package/src/intake/dedup-gate.ts +92 -0
- package/src/intake/intake-pipeline.ts +503 -0
- package/src/intake/types.ts +69 -0
- package/src/intelligence/loader.ts +1 -1
- package/src/intelligence/types.ts +3 -1
- package/src/logging/logger.ts +154 -0
- package/src/logging/types.ts +21 -0
- package/src/loop/loop-manager.ts +448 -0
- package/src/loop/types.ts +115 -0
- package/src/persistence/index.ts +7 -0
- package/src/persistence/sqlite-provider.ts +62 -0
- package/src/persistence/types.ts +44 -0
- package/src/planning/gap-analysis.ts +775 -0
- package/src/planning/gap-types.ts +61 -0
- package/src/planning/planner.ts +1273 -24
- package/src/playbooks/generic/brainstorming.ts +110 -0
- package/src/playbooks/generic/code-review.ts +181 -0
- package/src/playbooks/generic/subagent-execution.ts +74 -0
- package/src/playbooks/generic/systematic-debugging.ts +92 -0
- package/src/playbooks/generic/tdd.ts +75 -0
- package/src/playbooks/generic/verification.ts +79 -0
- package/src/playbooks/index.ts +27 -0
- package/src/playbooks/playbook-registry.ts +284 -0
- package/src/playbooks/playbook-seeder.ts +119 -0
- package/src/playbooks/playbook-types.ts +162 -0
- package/src/project/project-registry.ts +370 -0
- package/src/project/types.ts +31 -0
- package/src/prompts/index.ts +3 -0
- package/src/prompts/parser.ts +59 -0
- package/src/prompts/template-manager.ts +77 -0
- package/src/prompts/types.ts +28 -0
- package/src/runtime/admin-extra-ops.ts +652 -0
- package/src/runtime/admin-ops.ts +340 -0
- package/src/runtime/capture-ops.ts +404 -0
- package/src/runtime/cognee-sync-ops.ts +63 -0
- package/src/runtime/core-ops.ts +787 -9
- package/src/runtime/curator-extra-ops.ts +85 -0
- package/src/runtime/domain-ops.ts +67 -15
- package/src/runtime/grading-ops.ts +130 -0
- package/src/runtime/intake-ops.ts +126 -0
- package/src/runtime/loop-ops.ts +277 -0
- package/src/runtime/memory-cross-project-ops.ts +191 -0
- package/src/runtime/memory-extra-ops.ts +186 -0
- package/src/runtime/orchestrate-ops.ts +278 -0
- package/src/runtime/planning-extra-ops.ts +718 -0
- package/src/runtime/playbook-ops.ts +169 -0
- package/src/runtime/project-ops.ts +202 -0
- package/src/runtime/runtime.ts +77 -3
- package/src/runtime/types.ts +29 -0
- package/src/runtime/vault-extra-ops.ts +606 -0
- package/src/telemetry/telemetry.ts +118 -0
- package/src/vault/playbook.ts +87 -0
- package/src/vault/vault.ts +575 -98
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
|
+
import { createAgentRuntime } from '../runtime/runtime.js';
|
|
3
|
+
import { createCuratorExtraOps } from '../runtime/curator-extra-ops.js';
|
|
4
|
+
import type { AgentRuntime } from '../runtime/types.js';
|
|
5
|
+
import type { OpDefinition } from '../facades/types.js';
|
|
6
|
+
|
|
7
|
+
describe('createCuratorExtraOps', () => {
|
|
8
|
+
let runtime: AgentRuntime;
|
|
9
|
+
let ops: OpDefinition[];
|
|
10
|
+
|
|
11
|
+
function findOp(name: string): OpDefinition {
|
|
12
|
+
const op = ops.find((o) => o.name === name);
|
|
13
|
+
if (!op) throw new Error(`Op "${name}" not found`);
|
|
14
|
+
return op;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
runtime?.close();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
function setup() {
|
|
22
|
+
runtime = createAgentRuntime({
|
|
23
|
+
agentId: 'test-curator-extra',
|
|
24
|
+
vaultPath: ':memory:',
|
|
25
|
+
});
|
|
26
|
+
ops = createCuratorExtraOps(runtime);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
it('should return 5 ops', () => {
|
|
30
|
+
setup();
|
|
31
|
+
expect(ops).toHaveLength(5);
|
|
32
|
+
const names = ops.map((o) => o.name);
|
|
33
|
+
expect(names).toEqual([
|
|
34
|
+
'curator_entry_history',
|
|
35
|
+
'curator_record_snapshot',
|
|
36
|
+
'curator_queue_stats',
|
|
37
|
+
'curator_enrich',
|
|
38
|
+
'curator_hybrid_contradictions',
|
|
39
|
+
]);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// ─── curator_record_snapshot ───────────────────────────────────
|
|
43
|
+
|
|
44
|
+
describe('curator_record_snapshot', () => {
|
|
45
|
+
it('should record a snapshot and return historyId', async () => {
|
|
46
|
+
setup();
|
|
47
|
+
runtime.vault.seed([
|
|
48
|
+
{
|
|
49
|
+
id: 'snap-1',
|
|
50
|
+
type: 'pattern',
|
|
51
|
+
domain: 'testing',
|
|
52
|
+
title: 'Snapshot Test',
|
|
53
|
+
severity: 'warning',
|
|
54
|
+
description: 'A test entry for snapshots.',
|
|
55
|
+
tags: ['test'],
|
|
56
|
+
},
|
|
57
|
+
]);
|
|
58
|
+
const result = (await findOp('curator_record_snapshot').handler({
|
|
59
|
+
entryId: 'snap-1',
|
|
60
|
+
changedBy: 'user',
|
|
61
|
+
changeReason: 'manual snapshot',
|
|
62
|
+
})) as { recorded: boolean; historyId: number };
|
|
63
|
+
|
|
64
|
+
expect(result.recorded).toBe(true);
|
|
65
|
+
expect(result.historyId).toBeGreaterThan(0);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should return recorded false for missing entry', async () => {
|
|
69
|
+
setup();
|
|
70
|
+
const result = (await findOp('curator_record_snapshot').handler({
|
|
71
|
+
entryId: 'nonexistent',
|
|
72
|
+
})) as { recorded: boolean; historyId: number };
|
|
73
|
+
|
|
74
|
+
expect(result.recorded).toBe(false);
|
|
75
|
+
expect(result.historyId).toBe(-1);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// ─── curator_entry_history ─────────────────────────────────────
|
|
80
|
+
|
|
81
|
+
describe('curator_entry_history', () => {
|
|
82
|
+
it('should return version history with 2 snapshots in order', async () => {
|
|
83
|
+
setup();
|
|
84
|
+
runtime.vault.seed([
|
|
85
|
+
{
|
|
86
|
+
id: 'hist-1',
|
|
87
|
+
type: 'pattern',
|
|
88
|
+
domain: 'testing',
|
|
89
|
+
title: 'History Test',
|
|
90
|
+
severity: 'warning',
|
|
91
|
+
description: 'Entry for history test.',
|
|
92
|
+
tags: ['test'],
|
|
93
|
+
},
|
|
94
|
+
]);
|
|
95
|
+
|
|
96
|
+
// Record two snapshots
|
|
97
|
+
runtime.curator.recordSnapshot('hist-1', 'user', 'first snapshot');
|
|
98
|
+
runtime.curator.recordSnapshot('hist-1', 'system', 'second snapshot');
|
|
99
|
+
|
|
100
|
+
const result = (await findOp('curator_entry_history').handler({
|
|
101
|
+
entryId: 'hist-1',
|
|
102
|
+
})) as {
|
|
103
|
+
entryId: string;
|
|
104
|
+
history: Array<{
|
|
105
|
+
historyId: number;
|
|
106
|
+
entryId: string;
|
|
107
|
+
snapshot: { title: string };
|
|
108
|
+
changedBy: string;
|
|
109
|
+
changeReason: string | null;
|
|
110
|
+
createdAt: number;
|
|
111
|
+
}>;
|
|
112
|
+
count: number;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
expect(result.entryId).toBe('hist-1');
|
|
116
|
+
expect(result.count).toBe(2);
|
|
117
|
+
expect(result.history).toHaveLength(2);
|
|
118
|
+
// First snapshot first (ASC order)
|
|
119
|
+
expect(result.history[0].changedBy).toBe('user');
|
|
120
|
+
expect(result.history[0].changeReason).toBe('first snapshot');
|
|
121
|
+
expect(result.history[0].snapshot.title).toBe('History Test');
|
|
122
|
+
expect(result.history[1].changedBy).toBe('system');
|
|
123
|
+
expect(result.history[1].changeReason).toBe('second snapshot');
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should return empty history for entry with no snapshots', async () => {
|
|
127
|
+
setup();
|
|
128
|
+
runtime.vault.seed([
|
|
129
|
+
{
|
|
130
|
+
id: 'hist-2',
|
|
131
|
+
type: 'pattern',
|
|
132
|
+
domain: 'testing',
|
|
133
|
+
title: 'No History',
|
|
134
|
+
severity: 'warning',
|
|
135
|
+
description: 'Entry with no history.',
|
|
136
|
+
tags: ['test'],
|
|
137
|
+
},
|
|
138
|
+
]);
|
|
139
|
+
|
|
140
|
+
const result = (await findOp('curator_entry_history').handler({
|
|
141
|
+
entryId: 'hist-2',
|
|
142
|
+
})) as { count: number };
|
|
143
|
+
|
|
144
|
+
expect(result.count).toBe(0);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// ─── curator_queue_stats ───────────────────────────────────────
|
|
149
|
+
|
|
150
|
+
describe('curator_queue_stats', () => {
|
|
151
|
+
it('should return correct grooming stats', async () => {
|
|
152
|
+
setup();
|
|
153
|
+
// Seed 3 entries
|
|
154
|
+
runtime.vault.seed([
|
|
155
|
+
{
|
|
156
|
+
id: 'qs-1',
|
|
157
|
+
type: 'pattern',
|
|
158
|
+
domain: 'testing',
|
|
159
|
+
title: 'Queue A',
|
|
160
|
+
severity: 'warning',
|
|
161
|
+
description: 'Test.',
|
|
162
|
+
tags: ['test'],
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: 'qs-2',
|
|
166
|
+
type: 'pattern',
|
|
167
|
+
domain: 'testing',
|
|
168
|
+
title: 'Queue B',
|
|
169
|
+
severity: 'warning',
|
|
170
|
+
description: 'Test.',
|
|
171
|
+
tags: ['test'],
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: 'qs-3',
|
|
175
|
+
type: 'pattern',
|
|
176
|
+
domain: 'testing',
|
|
177
|
+
title: 'Queue C',
|
|
178
|
+
severity: 'warning',
|
|
179
|
+
description: 'Test.',
|
|
180
|
+
tags: ['test'],
|
|
181
|
+
},
|
|
182
|
+
]);
|
|
183
|
+
|
|
184
|
+
// Groom only 2 of the 3
|
|
185
|
+
runtime.curator.groomEntry('qs-1');
|
|
186
|
+
runtime.curator.groomEntry('qs-2');
|
|
187
|
+
|
|
188
|
+
const result = (await findOp('curator_queue_stats').handler({})) as {
|
|
189
|
+
totalEntries: number;
|
|
190
|
+
groomedEntries: number;
|
|
191
|
+
ungroomedEntries: number;
|
|
192
|
+
staleEntries: number;
|
|
193
|
+
freshEntries: number;
|
|
194
|
+
avgDaysSinceGroom: number;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
expect(result.totalEntries).toBe(3);
|
|
198
|
+
expect(result.groomedEntries).toBe(2);
|
|
199
|
+
expect(result.ungroomedEntries).toBe(1);
|
|
200
|
+
// Just groomed, so they should be fresh
|
|
201
|
+
expect(result.freshEntries).toBe(2);
|
|
202
|
+
expect(result.staleEntries).toBe(0);
|
|
203
|
+
expect(result.avgDaysSinceGroom).toBeGreaterThanOrEqual(0);
|
|
204
|
+
expect(result.avgDaysSinceGroom).toBeLessThan(1);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('should return zeroes for empty vault', async () => {
|
|
208
|
+
setup();
|
|
209
|
+
const result = (await findOp('curator_queue_stats').handler({})) as {
|
|
210
|
+
totalEntries: number;
|
|
211
|
+
groomedEntries: number;
|
|
212
|
+
ungroomedEntries: number;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
expect(result.totalEntries).toBe(0);
|
|
216
|
+
expect(result.groomedEntries).toBe(0);
|
|
217
|
+
expect(result.ungroomedEntries).toBe(0);
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// ─── curator_enrich ────────────────────────────────────────────
|
|
222
|
+
|
|
223
|
+
describe('curator_enrich', () => {
|
|
224
|
+
it('should enrich entry with messy metadata', async () => {
|
|
225
|
+
setup();
|
|
226
|
+
runtime.vault.seed([
|
|
227
|
+
{
|
|
228
|
+
id: 'enrich-1',
|
|
229
|
+
type: 'pattern',
|
|
230
|
+
domain: 'testing',
|
|
231
|
+
title: 'avoid using any types',
|
|
232
|
+
severity: 'suggestion',
|
|
233
|
+
description: ' You should avoid using any types in TypeScript. ',
|
|
234
|
+
tags: ['TypeScript', ' testing ', 'typescript'],
|
|
235
|
+
},
|
|
236
|
+
]);
|
|
237
|
+
|
|
238
|
+
const result = (await findOp('curator_enrich').handler({
|
|
239
|
+
entryId: 'enrich-1',
|
|
240
|
+
})) as {
|
|
241
|
+
enriched: boolean;
|
|
242
|
+
changes: Array<{ field: string; before: string; after: string }>;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
expect(result.enriched).toBe(true);
|
|
246
|
+
expect(result.changes.length).toBeGreaterThan(0);
|
|
247
|
+
|
|
248
|
+
// Check specific changes
|
|
249
|
+
const fieldNames = result.changes.map((c) => c.field);
|
|
250
|
+
|
|
251
|
+
// Title should be capitalized
|
|
252
|
+
expect(fieldNames).toContain('title');
|
|
253
|
+
const titleChange = result.changes.find((c) => c.field === 'title')!;
|
|
254
|
+
expect(titleChange.after).toBe('Avoid using any types');
|
|
255
|
+
|
|
256
|
+
// Tags should be normalized (lowercase, trimmed, deduped)
|
|
257
|
+
expect(fieldNames).toContain('tags');
|
|
258
|
+
const tagChange = result.changes.find((c) => c.field === 'tags')!;
|
|
259
|
+
const normalizedTags = JSON.parse(tagChange.after);
|
|
260
|
+
expect(normalizedTags).toEqual(['typescript', 'testing']);
|
|
261
|
+
|
|
262
|
+
// Type should be inferred as anti-pattern (starts with "avoid")
|
|
263
|
+
expect(fieldNames).toContain('type');
|
|
264
|
+
const typeChange = result.changes.find((c) => c.field === 'type')!;
|
|
265
|
+
expect(typeChange.after).toBe('anti-pattern');
|
|
266
|
+
|
|
267
|
+
// Description should be trimmed
|
|
268
|
+
expect(fieldNames).toContain('description');
|
|
269
|
+
const descChange = result.changes.find((c) => c.field === 'description')!;
|
|
270
|
+
expect(descChange.after).toBe('You should avoid using any types in TypeScript.');
|
|
271
|
+
|
|
272
|
+
// Verify the entry was actually updated in the vault
|
|
273
|
+
const updated = runtime.vault.get('enrich-1');
|
|
274
|
+
expect(updated).not.toBeNull();
|
|
275
|
+
expect(updated!.type).toBe('anti-pattern');
|
|
276
|
+
expect(updated!.title).toBe('Avoid using any types');
|
|
277
|
+
|
|
278
|
+
// Verify a snapshot was recorded
|
|
279
|
+
const history = runtime.curator.getVersionHistory('enrich-1');
|
|
280
|
+
expect(history.length).toBeGreaterThan(0);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
it('should return enriched false for clean entry', async () => {
|
|
284
|
+
setup();
|
|
285
|
+
runtime.vault.seed([
|
|
286
|
+
{
|
|
287
|
+
id: 'enrich-2',
|
|
288
|
+
type: 'pattern',
|
|
289
|
+
domain: 'testing',
|
|
290
|
+
title: 'Clean entry with proper metadata',
|
|
291
|
+
severity: 'warning',
|
|
292
|
+
description: 'This entry is already clean.',
|
|
293
|
+
tags: ['clean', 'testing'],
|
|
294
|
+
},
|
|
295
|
+
]);
|
|
296
|
+
|
|
297
|
+
const result = (await findOp('curator_enrich').handler({
|
|
298
|
+
entryId: 'enrich-2',
|
|
299
|
+
})) as {
|
|
300
|
+
enriched: boolean;
|
|
301
|
+
changes: Array<{ field: string; before: string; after: string }>;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
expect(result.enriched).toBe(false);
|
|
305
|
+
expect(result.changes).toEqual([]);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
it('should return enriched false for missing entry', async () => {
|
|
309
|
+
setup();
|
|
310
|
+
const result = (await findOp('curator_enrich').handler({
|
|
311
|
+
entryId: 'nonexistent',
|
|
312
|
+
})) as { enriched: boolean };
|
|
313
|
+
|
|
314
|
+
expect(result.enriched).toBe(false);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
it('should infer severity from critical keywords', async () => {
|
|
318
|
+
setup();
|
|
319
|
+
runtime.vault.seed([
|
|
320
|
+
{
|
|
321
|
+
id: 'enrich-3',
|
|
322
|
+
type: 'rule',
|
|
323
|
+
domain: 'security',
|
|
324
|
+
title: 'Never expose API keys',
|
|
325
|
+
severity: 'suggestion',
|
|
326
|
+
description: 'API keys must not be committed to version control.',
|
|
327
|
+
tags: ['security'],
|
|
328
|
+
},
|
|
329
|
+
]);
|
|
330
|
+
|
|
331
|
+
const result = (await findOp('curator_enrich').handler({
|
|
332
|
+
entryId: 'enrich-3',
|
|
333
|
+
})) as {
|
|
334
|
+
enriched: boolean;
|
|
335
|
+
changes: Array<{ field: string; before: string; after: string }>;
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
expect(result.enriched).toBe(true);
|
|
339
|
+
const severityChange = result.changes.find((c) => c.field === 'severity');
|
|
340
|
+
expect(severityChange).toBeDefined();
|
|
341
|
+
expect(severityChange!.after).toBe('critical');
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
// ─── curator_hybrid_contradictions ──────────────────────────────
|
|
346
|
+
|
|
347
|
+
describe('curator_hybrid_contradictions', () => {
|
|
348
|
+
it('should return empty contradictions and tfidf-only method', async () => {
|
|
349
|
+
setup();
|
|
350
|
+
const result = (await findOp('curator_hybrid_contradictions').handler({})) as {
|
|
351
|
+
contradictions: unknown[];
|
|
352
|
+
cogneeAvailable: boolean;
|
|
353
|
+
method: string;
|
|
354
|
+
};
|
|
355
|
+
expect(result.contradictions).toEqual([]);
|
|
356
|
+
expect(result.cogneeAvailable).toBe(false);
|
|
357
|
+
expect(result.method).toBe('tfidf-only');
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
it('should have read auth', () => {
|
|
361
|
+
setup();
|
|
362
|
+
expect(findOp('curator_hybrid_contradictions').auth).toBe('read');
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
// ─── Auth levels ───────────────────────────────────────────────
|
|
367
|
+
|
|
368
|
+
describe('auth levels', () => {
|
|
369
|
+
it('should use read auth for query ops', () => {
|
|
370
|
+
setup();
|
|
371
|
+
expect(findOp('curator_entry_history').auth).toBe('read');
|
|
372
|
+
expect(findOp('curator_queue_stats').auth).toBe('read');
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
it('should use write auth for mutation ops', () => {
|
|
376
|
+
setup();
|
|
377
|
+
expect(findOp('curator_record_snapshot').auth).toBe('write');
|
|
378
|
+
expect(findOp('curator_enrich').auth).toBe('write');
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
});
|
|
@@ -101,6 +101,72 @@ describe('createDomainFacade', () => {
|
|
|
101
101
|
expect(runtime.vault.get('rm-1')).toBeNull();
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
+
it('capture should include governance action on default (moderate) preset', async () => {
|
|
105
|
+
const facade = createDomainFacade(runtime, 'test-domain', 'security');
|
|
106
|
+
const captureOp = facade.ops.find((o) => o.name === 'capture')!;
|
|
107
|
+
const result = (await captureOp.handler({
|
|
108
|
+
id: 'gov-cap-1',
|
|
109
|
+
type: 'pattern',
|
|
110
|
+
title: 'Governed Pattern',
|
|
111
|
+
severity: 'warning',
|
|
112
|
+
description: 'Test governance capture.',
|
|
113
|
+
tags: ['gov'],
|
|
114
|
+
})) as { captured: boolean; governance: { action: string } };
|
|
115
|
+
expect(result.captured).toBe(true);
|
|
116
|
+
expect(result.governance.action).toBe('capture');
|
|
117
|
+
expect(runtime.vault.get('gov-cap-1')).not.toBeNull();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('capture should create proposal under strict preset', async () => {
|
|
121
|
+
runtime.governance.applyPreset('.', 'strict', 'test');
|
|
122
|
+
const facade = createDomainFacade(runtime, 'test-domain', 'security');
|
|
123
|
+
const captureOp = facade.ops.find((o) => o.name === 'capture')!;
|
|
124
|
+
const result = (await captureOp.handler({
|
|
125
|
+
id: 'gov-prop-1',
|
|
126
|
+
type: 'pattern',
|
|
127
|
+
title: 'Needs Review',
|
|
128
|
+
severity: 'warning',
|
|
129
|
+
description: 'Should be proposed.',
|
|
130
|
+
tags: ['gov'],
|
|
131
|
+
})) as {
|
|
132
|
+
captured: boolean;
|
|
133
|
+
governance: { action: string; proposalId: number; reason?: string };
|
|
134
|
+
};
|
|
135
|
+
expect(result.captured).toBe(false);
|
|
136
|
+
expect(result.governance.action).toBe('propose');
|
|
137
|
+
expect(result.governance.proposalId).toBeGreaterThan(0);
|
|
138
|
+
// Entry should NOT be in vault
|
|
139
|
+
expect(runtime.vault.get('gov-prop-1')).toBeNull();
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('capture should reject when total quota exceeded', async () => {
|
|
143
|
+
runtime.governance.setPolicy('.', 'quota', { maxEntriesTotal: 1 }, 'test');
|
|
144
|
+
runtime.vault.seed([
|
|
145
|
+
{
|
|
146
|
+
id: 'existing-1',
|
|
147
|
+
type: 'pattern',
|
|
148
|
+
domain: 'security',
|
|
149
|
+
title: 'Existing',
|
|
150
|
+
severity: 'warning',
|
|
151
|
+
description: 'Takes the slot.',
|
|
152
|
+
tags: ['fill'],
|
|
153
|
+
},
|
|
154
|
+
]);
|
|
155
|
+
const facade = createDomainFacade(runtime, 'test-domain', 'security');
|
|
156
|
+
const captureOp = facade.ops.find((o) => o.name === 'capture')!;
|
|
157
|
+
const result = (await captureOp.handler({
|
|
158
|
+
id: 'gov-rej-1',
|
|
159
|
+
type: 'pattern',
|
|
160
|
+
title: 'Over Quota',
|
|
161
|
+
severity: 'warning',
|
|
162
|
+
description: 'Should be rejected.',
|
|
163
|
+
tags: ['gov'],
|
|
164
|
+
})) as { captured: boolean; governance: { action: string; reason?: string } };
|
|
165
|
+
expect(result.captured).toBe(false);
|
|
166
|
+
expect(result.governance.action).toBe('reject');
|
|
167
|
+
expect(runtime.vault.get('gov-rej-1')).toBeNull();
|
|
168
|
+
});
|
|
169
|
+
|
|
104
170
|
it('get_entry should return specific entry', async () => {
|
|
105
171
|
runtime.vault.seed([
|
|
106
172
|
{
|