@soleri/core 9.2.0 → 9.3.1
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/data/flows/build.flow.yaml +8 -9
- package/data/flows/deliver.flow.yaml +9 -10
- package/data/flows/design.flow.yaml +3 -4
- package/data/flows/enhance.flow.yaml +5 -6
- package/data/flows/explore.flow.yaml +3 -4
- package/data/flows/fix.flow.yaml +5 -6
- package/data/flows/plan.flow.yaml +4 -5
- package/data/flows/review.flow.yaml +3 -4
- package/dist/curator/curator.d.ts.map +1 -1
- package/dist/curator/curator.js +98 -22
- package/dist/curator/curator.js.map +1 -1
- package/dist/engine/bin/soleri-engine.js.map +1 -1
- package/dist/engine/module-manifest.d.ts +2 -0
- package/dist/engine/module-manifest.d.ts.map +1 -1
- package/dist/engine/module-manifest.js +136 -1
- package/dist/engine/module-manifest.js.map +1 -1
- package/dist/engine/register-engine.d.ts.map +1 -1
- package/dist/engine/register-engine.js +25 -1
- package/dist/engine/register-engine.js.map +1 -1
- package/dist/flows/gate-evaluator.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/operator/operator-profile.d.ts.map +1 -1
- package/dist/operator/operator-profile.js +11 -5
- package/dist/operator/operator-profile.js.map +1 -1
- package/dist/operator/operator-signals.d.ts.map +1 -1
- package/dist/operator/operator-signals.js.map +1 -1
- package/dist/planning/evidence-collector.js.map +1 -1
- package/dist/planning/gap-passes.d.ts.map +1 -1
- package/dist/planning/gap-passes.js +23 -6
- package/dist/planning/gap-passes.js.map +1 -1
- package/dist/planning/gap-patterns.d.ts.map +1 -1
- package/dist/planning/gap-patterns.js +57 -11
- package/dist/planning/gap-patterns.js.map +1 -1
- package/dist/planning/github-projection.d.ts.map +1 -1
- package/dist/planning/github-projection.js +39 -20
- package/dist/planning/github-projection.js.map +1 -1
- package/dist/planning/impact-analyzer.d.ts.map +1 -1
- package/dist/planning/impact-analyzer.js +20 -18
- package/dist/planning/impact-analyzer.js.map +1 -1
- package/dist/planning/plan-lifecycle.d.ts.map +1 -1
- package/dist/planning/plan-lifecycle.js +22 -9
- package/dist/planning/plan-lifecycle.js.map +1 -1
- package/dist/planning/planner.d.ts.map +1 -1
- package/dist/planning/planner.js +60 -17
- package/dist/planning/planner.js.map +1 -1
- package/dist/planning/rationalization-detector.d.ts.map +1 -1
- package/dist/planning/rationalization-detector.js.map +1 -1
- package/dist/planning/reconciliation-engine.d.ts.map +1 -1
- package/dist/planning/reconciliation-engine.js.map +1 -1
- package/dist/planning/task-complexity-assessor.d.ts +42 -0
- package/dist/planning/task-complexity-assessor.d.ts.map +1 -0
- package/dist/planning/task-complexity-assessor.js +132 -0
- package/dist/planning/task-complexity-assessor.js.map +1 -0
- package/dist/planning/task-verifier.d.ts.map +1 -1
- package/dist/planning/task-verifier.js +14 -6
- package/dist/planning/task-verifier.js.map +1 -1
- package/dist/runtime/admin-ops.d.ts.map +1 -1
- package/dist/runtime/admin-ops.js +18 -0
- package/dist/runtime/admin-ops.js.map +1 -1
- package/dist/runtime/admin-setup-ops.d.ts.map +1 -1
- package/dist/runtime/admin-setup-ops.js +2 -1
- package/dist/runtime/admin-setup-ops.js.map +1 -1
- package/dist/runtime/branching-ops.d.ts +12 -0
- package/dist/runtime/branching-ops.d.ts.map +1 -0
- package/dist/runtime/branching-ops.js +100 -0
- package/dist/runtime/branching-ops.js.map +1 -0
- package/dist/runtime/context-health.d.ts.map +1 -1
- package/dist/runtime/context-health.js.map +1 -1
- package/dist/runtime/facades/branching-facade.d.ts +7 -0
- package/dist/runtime/facades/branching-facade.d.ts.map +1 -0
- package/dist/runtime/facades/branching-facade.js +8 -0
- package/dist/runtime/facades/branching-facade.js.map +1 -0
- package/dist/runtime/facades/chat-service-ops.d.ts.map +1 -1
- package/dist/runtime/facades/chat-service-ops.js +3 -1
- package/dist/runtime/facades/chat-service-ops.js.map +1 -1
- package/dist/runtime/facades/chat-transport-ops.d.ts.map +1 -1
- package/dist/runtime/facades/chat-transport-ops.js.map +1 -1
- package/dist/runtime/facades/index.d.ts.map +1 -1
- package/dist/runtime/facades/index.js +42 -0
- package/dist/runtime/facades/index.js.map +1 -1
- package/dist/runtime/facades/intake-facade.d.ts +9 -0
- package/dist/runtime/facades/intake-facade.d.ts.map +1 -0
- package/dist/runtime/facades/intake-facade.js +11 -0
- package/dist/runtime/facades/intake-facade.js.map +1 -0
- package/dist/runtime/facades/links-facade.d.ts +9 -0
- package/dist/runtime/facades/links-facade.d.ts.map +1 -0
- package/dist/runtime/facades/links-facade.js +10 -0
- package/dist/runtime/facades/links-facade.js.map +1 -0
- package/dist/runtime/facades/operator-facade.d.ts.map +1 -1
- package/dist/runtime/facades/operator-facade.js.map +1 -1
- package/dist/runtime/facades/plan-facade.d.ts.map +1 -1
- package/dist/runtime/facades/plan-facade.js +4 -1
- package/dist/runtime/facades/plan-facade.js.map +1 -1
- package/dist/runtime/facades/tier-facade.d.ts +7 -0
- package/dist/runtime/facades/tier-facade.d.ts.map +1 -0
- package/dist/runtime/facades/tier-facade.js +8 -0
- package/dist/runtime/facades/tier-facade.js.map +1 -0
- package/dist/runtime/facades/vault-facade.d.ts +9 -1
- package/dist/runtime/facades/vault-facade.d.ts.map +1 -1
- package/dist/runtime/facades/vault-facade.js +44 -187
- package/dist/runtime/facades/vault-facade.js.map +1 -1
- package/dist/runtime/github-integration.d.ts.map +1 -1
- package/dist/runtime/github-integration.js +11 -4
- package/dist/runtime/github-integration.js.map +1 -1
- package/dist/runtime/orchestrate-ops.d.ts.map +1 -1
- package/dist/runtime/orchestrate-ops.js +75 -42
- package/dist/runtime/orchestrate-ops.js.map +1 -1
- package/dist/runtime/planning-extra-ops.d.ts.map +1 -1
- package/dist/runtime/planning-extra-ops.js.map +1 -1
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +3 -1
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/session-briefing.d.ts.map +1 -1
- package/dist/runtime/session-briefing.js +5 -1
- package/dist/runtime/session-briefing.js.map +1 -1
- package/dist/runtime/tier-ops.d.ts +13 -0
- package/dist/runtime/tier-ops.d.ts.map +1 -0
- package/dist/runtime/tier-ops.js +110 -0
- package/dist/runtime/tier-ops.js.map +1 -0
- package/dist/skills/sync-skills.d.ts.map +1 -1
- package/dist/skills/sync-skills.js +1 -1
- package/dist/skills/sync-skills.js.map +1 -1
- package/dist/vault/linking.d.ts.map +1 -1
- package/dist/vault/linking.js +41 -5
- package/dist/vault/linking.js.map +1 -1
- package/dist/vault/vault-entries.d.ts.map +1 -1
- package/dist/vault/vault-entries.js +68 -26
- package/dist/vault/vault-entries.js.map +1 -1
- package/dist/vault/vault-maintenance.d.ts.map +1 -1
- package/dist/vault/vault-maintenance.js +6 -2
- package/dist/vault/vault-maintenance.js.map +1 -1
- package/dist/vault/vault-markdown-sync.d.ts.map +1 -1
- package/dist/vault/vault-markdown-sync.js.map +1 -1
- package/dist/vault/vault-memories.d.ts.map +1 -1
- package/dist/vault/vault-memories.js +3 -1
- package/dist/vault/vault-memories.js.map +1 -1
- package/dist/vault/vault-schema.js +36 -10
- package/dist/vault/vault-schema.js.map +1 -1
- package/dist/vault/vault.d.ts.map +1 -1
- package/dist/vault/vault.js +5 -1
- package/dist/vault/vault.js.map +1 -1
- package/package.json +7 -7
- package/src/agency/agency-manager.test.ts +60 -40
- package/src/agency/default-rules.test.ts +17 -9
- package/src/capabilities/registry.test.ts +2 -12
- package/src/chat/agent-loop.test.ts +33 -43
- package/src/chat/mcp-bridge.test.ts +7 -2
- package/src/claudemd/inject.test.ts +2 -12
- package/src/context/context-engine.test.ts +96 -51
- package/src/control/intent-router.test.ts +3 -3
- package/src/curator/classifier.test.ts +14 -8
- package/src/curator/contradiction-detector.test.ts +30 -5
- package/src/curator/curator.ts +278 -56
- package/src/curator/duplicate-detector.test.ts +77 -15
- package/src/curator/quality-gate.test.ts +71 -31
- package/src/curator/tag-manager.test.ts +12 -4
- package/src/domain-packs/knowledge-installer.test.ts +2 -10
- package/src/domain-packs/token-resolver.test.ts +1 -3
- package/src/domain-packs/types.test.ts +16 -2
- package/src/enforcement/registry.test.ts +2 -8
- package/src/engine/bin/soleri-engine.ts +3 -1
- package/src/engine/module-manifest.test.ts +48 -4
- package/src/engine/module-manifest.ts +138 -1
- package/src/engine/register-engine.test.ts +6 -1
- package/src/engine/register-engine.ts +26 -3
- package/src/errors/classify.test.ts +6 -2
- package/src/errors/retry.test.ts +1 -4
- package/src/facades/facade-factory.test.ts +110 -64
- package/src/flows/epilogue.test.ts +16 -10
- package/src/flows/gate-evaluator.test.ts +12 -6
- package/src/flows/gate-evaluator.ts +1 -3
- package/src/governance/governance.test.ts +137 -21
- package/src/health/health-registry.test.ts +8 -1
- package/src/index.ts +8 -0
- package/src/intake/content-classifier.test.ts +121 -51
- package/src/intake/dedup-gate.test.ts +38 -22
- package/src/intake/intake-pipeline.test.ts +5 -3
- package/src/intake/text-ingester.test.ts +26 -20
- package/src/llm/key-pool.test.ts +1 -3
- package/src/llm/llm-client.test.ts +1 -4
- package/src/llm/oauth-discovery.test.ts +16 -16
- package/src/llm/utils.test.ts +62 -18
- package/src/logging/logger.test.ts +4 -1
- package/src/loop/loop-manager.test.ts +2 -6
- package/src/migrations/migration-runner.edge-cases.test.ts +2 -7
- package/src/operator/operator-profile-extended.test.ts +15 -5
- package/src/operator/operator-profile.test.ts +26 -8
- package/src/operator/operator-profile.ts +38 -22
- package/src/operator/operator-signals-extended.test.ts +35 -23
- package/src/operator/operator-signals.test.ts +6 -10
- package/src/operator/operator-signals.ts +2 -1
- package/src/operator/prompts/hook-precompact-operator-dispatch.md +10 -6
- package/src/operator/prompts/subagent-soft-signal-extractor.md +5 -0
- package/src/operator/prompts/subagent-synthesis-cognition.md +19 -10
- package/src/operator/prompts/subagent-synthesis-communication.md +13 -7
- package/src/operator/prompts/subagent-synthesis-technical.md +19 -9
- package/src/operator/prompts/subagent-synthesis-trust.md +27 -21
- package/src/persona/defaults.test.ts +1 -5
- package/src/planning/evidence-collector.test.ts +147 -38
- package/src/planning/evidence-collector.ts +1 -4
- package/src/planning/gap-analysis-alternatives.test.ts +41 -11
- package/src/planning/gap-passes.test.ts +215 -33
- package/src/planning/gap-passes.ts +115 -46
- package/src/planning/gap-patterns.test.ts +87 -13
- package/src/planning/gap-patterns.ts +114 -31
- package/src/planning/github-projection.test.ts +6 -1
- package/src/planning/github-projection.ts +41 -20
- package/src/planning/impact-analyzer.test.ts +10 -23
- package/src/planning/impact-analyzer.ts +33 -46
- package/src/planning/plan-lifecycle.test.ts +103 -36
- package/src/planning/plan-lifecycle.ts +49 -18
- package/src/planning/planner.test.ts +12 -2
- package/src/planning/planner.ts +198 -58
- package/src/planning/rationalization-detector.test.ts +5 -20
- package/src/planning/rationalization-detector.ts +14 -16
- package/src/planning/reconciliation-engine.test.ts +20 -3
- package/src/planning/reconciliation-engine.ts +1 -2
- package/src/planning/task-complexity-assessor.test.ts +298 -0
- package/src/planning/task-complexity-assessor.ts +183 -0
- package/src/planning/task-verifier.test.ts +59 -27
- package/src/planning/task-verifier.ts +15 -9
- package/src/playbooks/playbook-executor.test.ts +1 -3
- package/src/plugins/plugin-loader.test.ts +19 -14
- package/src/plugins/plugin-registry.test.ts +45 -33
- package/src/project/project-registry.test.ts +23 -12
- package/src/prompts/template-manager.test.ts +4 -1
- package/src/queue/job-queue.test.ts +10 -14
- package/src/runtime/admin-extra-ops.test.ts +5 -19
- package/src/runtime/admin-ops.test.ts +22 -1
- package/src/runtime/admin-ops.ts +19 -0
- package/src/runtime/admin-setup-ops.test.ts +3 -4
- package/src/runtime/admin-setup-ops.ts +9 -2
- package/src/runtime/archive-ops.test.ts +4 -1
- package/src/runtime/branching-ops.test.ts +144 -0
- package/src/runtime/branching-ops.ts +107 -0
- package/src/runtime/capture-ops.test.ts +7 -21
- package/src/runtime/chain-ops.test.ts +16 -6
- package/src/runtime/claude-md-helpers.test.ts +1 -3
- package/src/runtime/context-health.test.ts +1 -3
- package/src/runtime/context-health.ts +1 -3
- package/src/runtime/curator-extra-ops.test.ts +3 -1
- package/src/runtime/domain-ops.test.ts +46 -36
- package/src/runtime/facades/admin-facade.test.ts +1 -4
- package/src/runtime/facades/archive-facade.test.ts +21 -7
- package/src/runtime/facades/brain-facade.test.ts +176 -72
- package/src/runtime/facades/branching-facade.test.ts +43 -0
- package/src/runtime/facades/branching-facade.ts +11 -0
- package/src/runtime/facades/chat-facade.test.ts +81 -28
- package/src/runtime/facades/chat-service-ops.test.ts +178 -73
- package/src/runtime/facades/chat-service-ops.ts +3 -1
- package/src/runtime/facades/chat-session-ops.test.ts +25 -10
- package/src/runtime/facades/chat-transport-ops.test.ts +101 -34
- package/src/runtime/facades/chat-transport-ops.ts +0 -1
- package/src/runtime/facades/context-facade.test.ts +19 -4
- package/src/runtime/facades/control-facade.test.ts +3 -3
- package/src/runtime/facades/index.ts +42 -0
- package/src/runtime/facades/intake-facade.test.ts +215 -0
- package/src/runtime/facades/intake-facade.ts +14 -0
- package/src/runtime/facades/links-facade.test.ts +203 -0
- package/src/runtime/facades/links-facade.ts +13 -0
- package/src/runtime/facades/loop-facade.test.ts +22 -5
- package/src/runtime/facades/memory-facade.test.ts +19 -5
- package/src/runtime/facades/operator-facade.test.ts +17 -4
- package/src/runtime/facades/operator-facade.ts +11 -3
- package/src/runtime/facades/orchestrate-facade.test.ts +7 -1
- package/src/runtime/facades/plan-facade.test.ts +29 -12
- package/src/runtime/facades/plan-facade.ts +7 -2
- package/src/runtime/facades/tier-facade.test.ts +47 -0
- package/src/runtime/facades/tier-facade.ts +11 -0
- package/src/runtime/facades/vault-facade.test.ts +174 -242
- package/src/runtime/facades/vault-facade.ts +55 -199
- package/src/runtime/github-integration.ts +11 -8
- package/src/runtime/grading-ops.test.ts +39 -8
- package/src/runtime/intake-ops.test.ts +69 -16
- package/src/runtime/loop-ops.test.ts +16 -6
- package/src/runtime/memory-cross-project-ops.test.ts +25 -14
- package/src/runtime/orchestrate-ops.test.ts +204 -0
- package/src/runtime/orchestrate-ops.ts +103 -65
- package/src/runtime/pack-ops.test.ts +23 -6
- package/src/runtime/planning-extra-ops.test.ts +17 -7
- package/src/runtime/planning-extra-ops.ts +3 -1
- package/src/runtime/playbook-ops.test.ts +26 -3
- package/src/runtime/plugin-ops.test.ts +83 -25
- package/src/runtime/project-ops.test.ts +26 -6
- package/src/runtime/runtime.ts +3 -1
- package/src/runtime/session-briefing.test.ts +183 -54
- package/src/runtime/session-briefing.ts +8 -2
- package/src/runtime/sync-ops.test.ts +3 -12
- package/src/runtime/telemetry-ops.test.ts +31 -6
- package/src/runtime/tier-ops.test.ts +159 -0
- package/src/runtime/tier-ops.ts +119 -0
- package/src/runtime/vault-extra-ops.test.ts +32 -8
- package/src/runtime/vault-sharing-ops.test.ts +1 -4
- package/src/skills/sync-skills.ts +2 -12
- package/src/transport/ws-server.test.ts +7 -4
- package/src/vault/__tests__/vault-characterization.test.ts +492 -81
- package/src/vault/linking.test.ts +50 -17
- package/src/vault/linking.ts +48 -7
- package/src/vault/obsidian-sync.test.ts +6 -3
- package/src/vault/scope-detector.test.ts +1 -3
- package/src/vault/vault-branching.test.ts +9 -7
- package/src/vault/vault-entries.ts +209 -65
- package/src/vault/vault-maintenance.ts +7 -12
- package/src/vault/vault-manager.test.ts +10 -10
- package/src/vault/vault-markdown-sync.ts +4 -1
- package/src/vault/vault-memories.ts +7 -7
- package/src/vault/vault-scaling.test.ts +5 -5
- package/src/vault/vault-schema.ts +72 -15
- package/src/vault/vault.ts +55 -9
- package/src/brain/strength-scorer.ts +0 -404
- package/src/engine/index.ts +0 -21
- package/src/persona/index.ts +0 -9
- package/src/vault/vault-interfaces.ts +0 -56
|
@@ -10,8 +10,19 @@ import type { OperatorProfile } from '../operator/operator-types.js';
|
|
|
10
10
|
|
|
11
11
|
function makeRuntime(overrides?: {
|
|
12
12
|
vaultStats?: { totalEntries: number; byType?: Record<string, number> };
|
|
13
|
-
sessions?: Array<{
|
|
14
|
-
|
|
13
|
+
sessions?: Array<{
|
|
14
|
+
endedAt: string | null;
|
|
15
|
+
domain: string | null;
|
|
16
|
+
context: string | null;
|
|
17
|
+
toolsUsed: string[];
|
|
18
|
+
filesModified: string[];
|
|
19
|
+
}>;
|
|
20
|
+
plans?: Array<{
|
|
21
|
+
id: string;
|
|
22
|
+
status: string;
|
|
23
|
+
objective?: string;
|
|
24
|
+
tasks: Array<{ status: string }>;
|
|
25
|
+
}>;
|
|
15
26
|
recentEntries?: Array<{ title: string }>;
|
|
16
27
|
recommendations?: Array<{ pattern: string; strength: number }>;
|
|
17
28
|
proposals?: Array<{ title: string; confidence: number; type: string; promoted: boolean }>;
|
|
@@ -54,7 +65,11 @@ describe('session-briefing', () => {
|
|
|
54
65
|
const res = await executeOp(ops, 'session_briefing', {});
|
|
55
66
|
|
|
56
67
|
expect(res.success).toBe(true);
|
|
57
|
-
const data = res.data as {
|
|
68
|
+
const data = res.data as {
|
|
69
|
+
sections: Array<{ label: string }>;
|
|
70
|
+
generatedAt: number;
|
|
71
|
+
dataPointsConsulted: number;
|
|
72
|
+
};
|
|
58
73
|
expect(data.generatedAt).toBeGreaterThan(0);
|
|
59
74
|
expect(Array.isArray(data.sections)).toBe(true);
|
|
60
75
|
});
|
|
@@ -81,13 +96,15 @@ describe('session-briefing', () => {
|
|
|
81
96
|
|
|
82
97
|
it('includes Last session section', async () => {
|
|
83
98
|
const runtime = makeRuntime({
|
|
84
|
-
sessions: [
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
sessions: [
|
|
100
|
+
{
|
|
101
|
+
endedAt: new Date(Date.now() - 3600000).toISOString(),
|
|
102
|
+
domain: 'frontend',
|
|
103
|
+
context: 'Refactored button component',
|
|
104
|
+
toolsUsed: ['vault_search', 'brain_recommend'],
|
|
105
|
+
filesModified: ['src/button.tsx'],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
91
108
|
});
|
|
92
109
|
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
93
110
|
const res = await executeOp(ops, 'session_briefing', {});
|
|
@@ -102,7 +119,12 @@ describe('session-briefing', () => {
|
|
|
102
119
|
it('includes Active plans section', async () => {
|
|
103
120
|
const runtime = makeRuntime({
|
|
104
121
|
plans: [
|
|
105
|
-
{
|
|
122
|
+
{
|
|
123
|
+
id: 'p1',
|
|
124
|
+
status: 'executing',
|
|
125
|
+
objective: 'Build dashboard',
|
|
126
|
+
tasks: [{ status: 'completed' }, { status: 'pending' }],
|
|
127
|
+
},
|
|
106
128
|
{ id: 'p2', status: 'completed', objective: 'Done', tasks: [] },
|
|
107
129
|
],
|
|
108
130
|
});
|
|
@@ -110,7 +132,9 @@ describe('session-briefing', () => {
|
|
|
110
132
|
const res = await executeOp(ops, 'session_briefing', {});
|
|
111
133
|
|
|
112
134
|
const data = res.data as { sections: Array<{ label: string; content: string }> };
|
|
113
|
-
const plans = data.sections.find(
|
|
135
|
+
const plans = data.sections.find(
|
|
136
|
+
(s) => s.label === 'Active plan' || s.label.startsWith('Active plans'),
|
|
137
|
+
);
|
|
114
138
|
expect(plans).toBeDefined();
|
|
115
139
|
expect(plans!.content).toContain('Build dashboard');
|
|
116
140
|
expect(plans!.content).toContain('1/2 tasks');
|
|
@@ -162,7 +186,15 @@ describe('session-briefing', () => {
|
|
|
162
186
|
it('respects maxSections limit', async () => {
|
|
163
187
|
const runtime = makeRuntime({
|
|
164
188
|
vaultStats: { totalEntries: 2, byType: {} },
|
|
165
|
-
sessions: [
|
|
189
|
+
sessions: [
|
|
190
|
+
{
|
|
191
|
+
endedAt: new Date().toISOString(),
|
|
192
|
+
domain: 'd',
|
|
193
|
+
context: 'c',
|
|
194
|
+
toolsUsed: ['t'],
|
|
195
|
+
filesModified: ['f'],
|
|
196
|
+
},
|
|
197
|
+
],
|
|
166
198
|
plans: [{ id: 'p', status: 'executing', objective: 'o', tasks: [] }],
|
|
167
199
|
recentEntries: [{ title: 't' }],
|
|
168
200
|
recommendations: [{ pattern: 'p', strength: 0.9 }],
|
|
@@ -179,17 +211,39 @@ describe('session-briefing', () => {
|
|
|
179
211
|
it('gracefully handles subsystem errors', async () => {
|
|
180
212
|
const runtime = {
|
|
181
213
|
brainIntelligence: {
|
|
182
|
-
listSessions: () => {
|
|
183
|
-
|
|
184
|
-
|
|
214
|
+
listSessions: () => {
|
|
215
|
+
throw new Error('DB closed');
|
|
216
|
+
},
|
|
217
|
+
recommend: () => {
|
|
218
|
+
throw new Error('DB closed');
|
|
219
|
+
},
|
|
220
|
+
getProposals: () => {
|
|
221
|
+
throw new Error('DB closed');
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
planner: {
|
|
225
|
+
list: () => {
|
|
226
|
+
throw new Error('no plans');
|
|
227
|
+
},
|
|
185
228
|
},
|
|
186
|
-
planner: { list: () => { throw new Error('no plans'); } },
|
|
187
229
|
vault: {
|
|
188
|
-
stats: () => {
|
|
189
|
-
|
|
230
|
+
stats: () => {
|
|
231
|
+
throw new Error('no vault');
|
|
232
|
+
},
|
|
233
|
+
getRecent: () => {
|
|
234
|
+
throw new Error('no vault');
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
curator: {
|
|
238
|
+
healthAudit: () => {
|
|
239
|
+
throw new Error('no curator');
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
operatorProfile: {
|
|
243
|
+
getProfile: () => {
|
|
244
|
+
throw new Error('no profile');
|
|
245
|
+
},
|
|
190
246
|
},
|
|
191
|
-
curator: { healthAudit: () => { throw new Error('no curator'); } },
|
|
192
|
-
operatorProfile: { getProfile: () => { throw new Error('no profile'); } },
|
|
193
247
|
} as unknown as AgentRuntime;
|
|
194
248
|
|
|
195
249
|
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
@@ -202,7 +256,12 @@ describe('session-briefing', () => {
|
|
|
202
256
|
it('includes Pending proposals when present', async () => {
|
|
203
257
|
const runtime = makeRuntime({
|
|
204
258
|
proposals: [
|
|
205
|
-
{
|
|
259
|
+
{
|
|
260
|
+
title: 'Use TDD for all new features',
|
|
261
|
+
confidence: 0.8,
|
|
262
|
+
type: 'pattern',
|
|
263
|
+
promoted: false,
|
|
264
|
+
},
|
|
206
265
|
{ title: 'Low confidence', confidence: 0.2, type: 'anti-pattern', promoted: false },
|
|
207
266
|
],
|
|
208
267
|
});
|
|
@@ -225,13 +284,36 @@ describe('session-briefing', () => {
|
|
|
225
284
|
operatorId: 'op',
|
|
226
285
|
version: 1,
|
|
227
286
|
identity: { name: null, timezone: null, locale: null, personalDetails: [] },
|
|
228
|
-
cognition: {
|
|
229
|
-
|
|
287
|
+
cognition: {
|
|
288
|
+
learningStyle: 'visual',
|
|
289
|
+
decisionStyle: 'analytical',
|
|
290
|
+
abstractionPreference: 0.5,
|
|
291
|
+
detailOrientation: 0.5,
|
|
292
|
+
attentionPatterns: [],
|
|
293
|
+
},
|
|
294
|
+
communication: {
|
|
295
|
+
style: 'mixed',
|
|
296
|
+
formality: 0.5,
|
|
297
|
+
verbosity: 0.5,
|
|
298
|
+
preferredFormats: [],
|
|
299
|
+
reactionPatterns: [],
|
|
300
|
+
},
|
|
230
301
|
workingRules: { rules: [], inferredPriorities: [] },
|
|
231
|
-
trustModel: {
|
|
302
|
+
trustModel: {
|
|
303
|
+
level: 'new',
|
|
304
|
+
currentLevel: 0.5,
|
|
305
|
+
challengeThreshold: 0.5,
|
|
306
|
+
autonomyGrants: [],
|
|
307
|
+
corrections: [],
|
|
308
|
+
},
|
|
232
309
|
tasteProfile: { aestheticPreferences: [], toolPreferences: [], workflowPreferences: [] },
|
|
233
310
|
growthEdges: { observed: [], selfReported: [], progressNotes: [] },
|
|
234
|
-
technicalContext: {
|
|
311
|
+
technicalContext: {
|
|
312
|
+
primaryLanguages: [],
|
|
313
|
+
frameworks: [],
|
|
314
|
+
expertiseLevels: [],
|
|
315
|
+
environmentDetails: [],
|
|
316
|
+
},
|
|
235
317
|
sessionCount: 0,
|
|
236
318
|
lastSynthesis: null,
|
|
237
319
|
createdAt: new Date().toISOString(),
|
|
@@ -246,56 +328,103 @@ describe('session-briefing', () => {
|
|
|
246
328
|
});
|
|
247
329
|
|
|
248
330
|
it('includes communication style when not mixed', () => {
|
|
249
|
-
const result = buildAdaptationSummary(
|
|
250
|
-
|
|
251
|
-
|
|
331
|
+
const result = buildAdaptationSummary(
|
|
332
|
+
makeProfile({
|
|
333
|
+
communication: {
|
|
334
|
+
style: 'terse',
|
|
335
|
+
formality: 0.8,
|
|
336
|
+
verbosity: 0.3,
|
|
337
|
+
preferredFormats: [],
|
|
338
|
+
reactionPatterns: [],
|
|
339
|
+
},
|
|
340
|
+
}),
|
|
341
|
+
);
|
|
252
342
|
expect(result).toContain('Communication: terse, formal');
|
|
253
343
|
});
|
|
254
344
|
|
|
255
345
|
it('includes trust level when not new', () => {
|
|
256
|
-
const result = buildAdaptationSummary(
|
|
257
|
-
|
|
258
|
-
|
|
346
|
+
const result = buildAdaptationSummary(
|
|
347
|
+
makeProfile({
|
|
348
|
+
trustModel: {
|
|
349
|
+
level: 'established',
|
|
350
|
+
currentLevel: 0.8,
|
|
351
|
+
challengeThreshold: 0.5,
|
|
352
|
+
autonomyGrants: [],
|
|
353
|
+
corrections: [],
|
|
354
|
+
},
|
|
355
|
+
}),
|
|
356
|
+
);
|
|
259
357
|
expect(result).toContain('Trust: established');
|
|
260
358
|
expect(result).toContain('high autonomy');
|
|
261
359
|
});
|
|
262
360
|
|
|
263
361
|
it('includes working rules as priorities', () => {
|
|
264
|
-
const result = buildAdaptationSummary(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
362
|
+
const result = buildAdaptationSummary(
|
|
363
|
+
makeProfile({
|
|
364
|
+
workingRules: {
|
|
365
|
+
rules: [
|
|
366
|
+
{
|
|
367
|
+
rule: 'Always write tests first',
|
|
368
|
+
source: 'observed',
|
|
369
|
+
confidence: 0.9,
|
|
370
|
+
addedAt: '',
|
|
371
|
+
},
|
|
372
|
+
{ rule: 'Prefer small PRs', source: 'observed', confidence: 0.8, addedAt: '' },
|
|
373
|
+
],
|
|
374
|
+
inferredPriorities: [],
|
|
375
|
+
},
|
|
376
|
+
}),
|
|
377
|
+
);
|
|
273
378
|
expect(result).toContain('Priorities:');
|
|
274
379
|
expect(result).toContain('Always write tests first');
|
|
275
380
|
});
|
|
276
381
|
|
|
277
382
|
it('includes growth edges', () => {
|
|
278
|
-
const result = buildAdaptationSummary(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
383
|
+
const result = buildAdaptationSummary(
|
|
384
|
+
makeProfile({
|
|
385
|
+
growthEdges: {
|
|
386
|
+
observed: [
|
|
387
|
+
{
|
|
388
|
+
area: 'TypeScript generics',
|
|
389
|
+
evidence: 'struggled with mapped types',
|
|
390
|
+
observedAt: '',
|
|
391
|
+
},
|
|
392
|
+
],
|
|
393
|
+
selfReported: [],
|
|
394
|
+
progressNotes: [],
|
|
395
|
+
},
|
|
396
|
+
}),
|
|
397
|
+
);
|
|
285
398
|
expect(result).toContain('Growth edges: TypeScript generics');
|
|
286
399
|
});
|
|
287
400
|
|
|
288
401
|
it('shows casual for low formality', () => {
|
|
289
|
-
const result = buildAdaptationSummary(
|
|
290
|
-
|
|
291
|
-
|
|
402
|
+
const result = buildAdaptationSummary(
|
|
403
|
+
makeProfile({
|
|
404
|
+
communication: {
|
|
405
|
+
style: 'conversational',
|
|
406
|
+
formality: 0.2,
|
|
407
|
+
verbosity: 0.5,
|
|
408
|
+
preferredFormats: [],
|
|
409
|
+
reactionPatterns: [],
|
|
410
|
+
},
|
|
411
|
+
}),
|
|
412
|
+
);
|
|
292
413
|
expect(result).toContain('casual');
|
|
293
414
|
});
|
|
294
415
|
|
|
295
416
|
it('shows check before acting for low trust level', () => {
|
|
296
|
-
const result = buildAdaptationSummary(
|
|
297
|
-
|
|
298
|
-
|
|
417
|
+
const result = buildAdaptationSummary(
|
|
418
|
+
makeProfile({
|
|
419
|
+
trustModel: {
|
|
420
|
+
level: 'developing',
|
|
421
|
+
currentLevel: 0.2,
|
|
422
|
+
challengeThreshold: 0.5,
|
|
423
|
+
autonomyGrants: [],
|
|
424
|
+
corrections: [],
|
|
425
|
+
},
|
|
426
|
+
}),
|
|
427
|
+
);
|
|
299
428
|
expect(result).toContain('check before acting');
|
|
300
429
|
});
|
|
301
430
|
});
|
|
@@ -215,14 +215,20 @@ export function buildAdaptationSummary(profile: OperatorProfile): string | null
|
|
|
215
215
|
|
|
216
216
|
// Communication style
|
|
217
217
|
if (communication.style && communication.style !== 'mixed') {
|
|
218
|
-
const formality =
|
|
218
|
+
const formality =
|
|
219
|
+
communication.formality >= 0.7 ? 'formal' : communication.formality <= 0.3 ? 'casual' : '';
|
|
219
220
|
const parts = [communication.style, formality].filter(Boolean);
|
|
220
221
|
lines.push(`Communication: ${parts.join(', ')}`);
|
|
221
222
|
}
|
|
222
223
|
|
|
223
224
|
// Challenge threshold / pushback level
|
|
224
225
|
if (trustModel.level !== 'new') {
|
|
225
|
-
const autonomy =
|
|
226
|
+
const autonomy =
|
|
227
|
+
trustModel.currentLevel >= 0.7
|
|
228
|
+
? 'high autonomy'
|
|
229
|
+
: trustModel.currentLevel <= 0.3
|
|
230
|
+
? 'check before acting'
|
|
231
|
+
: 'moderate autonomy';
|
|
226
232
|
lines.push(`Trust: ${trustModel.level} — ${autonomy}`);
|
|
227
233
|
}
|
|
228
234
|
|
|
@@ -95,10 +95,7 @@ describe('createSyncOps', () => {
|
|
|
95
95
|
describe('vault_git_push', () => {
|
|
96
96
|
it('initializes sync and pushes entries', async () => {
|
|
97
97
|
const op = findOp(ops, 'vault_git_push');
|
|
98
|
-
const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<
|
|
99
|
-
string,
|
|
100
|
-
unknown
|
|
101
|
-
>;
|
|
98
|
+
const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<string, unknown>;
|
|
102
99
|
expect(result.pushed).toBe(5);
|
|
103
100
|
});
|
|
104
101
|
});
|
|
@@ -108,10 +105,7 @@ describe('createSyncOps', () => {
|
|
|
108
105
|
describe('vault_git_pull', () => {
|
|
109
106
|
it('pulls entries from git directory', async () => {
|
|
110
107
|
const op = findOp(ops, 'vault_git_pull');
|
|
111
|
-
const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<
|
|
112
|
-
string,
|
|
113
|
-
unknown
|
|
114
|
-
>;
|
|
108
|
+
const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<string, unknown>;
|
|
115
109
|
expect(result.imported).toBe(3);
|
|
116
110
|
});
|
|
117
111
|
});
|
|
@@ -121,10 +115,7 @@ describe('createSyncOps', () => {
|
|
|
121
115
|
describe('vault_git_sync', () => {
|
|
122
116
|
it('performs bidirectional sync', async () => {
|
|
123
117
|
const op = findOp(ops, 'vault_git_sync');
|
|
124
|
-
const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<
|
|
125
|
-
string,
|
|
126
|
-
unknown
|
|
127
|
-
>;
|
|
118
|
+
const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<string, unknown>;
|
|
128
119
|
expect(result.pushed).toBe(2);
|
|
129
120
|
expect(result.pulled).toBe(1);
|
|
130
121
|
});
|
|
@@ -8,8 +8,18 @@ import { createTelemetryOps } from './telemetry-ops.js';
|
|
|
8
8
|
import type { AgentRuntime } from './types.js';
|
|
9
9
|
|
|
10
10
|
function makeTelemetryStub(
|
|
11
|
-
stats: {
|
|
12
|
-
|
|
11
|
+
stats: {
|
|
12
|
+
errorsByOp: Record<string, number>;
|
|
13
|
+
slowestOps: Array<{ op: string; avgMs: number }>;
|
|
14
|
+
avgDurationMs: number;
|
|
15
|
+
},
|
|
16
|
+
recent: Array<{
|
|
17
|
+
op: string;
|
|
18
|
+
facade: string;
|
|
19
|
+
success: boolean;
|
|
20
|
+
error?: string;
|
|
21
|
+
timestamp: number;
|
|
22
|
+
}>,
|
|
13
23
|
) {
|
|
14
24
|
return {
|
|
15
25
|
getStats: () => stats,
|
|
@@ -28,7 +38,11 @@ describe('telemetry-ops', () => {
|
|
|
28
38
|
const res = await executeOp(ops, 'telemetry_errors');
|
|
29
39
|
|
|
30
40
|
expect(res.success).toBe(true);
|
|
31
|
-
const data = res.data as {
|
|
41
|
+
const data = res.data as {
|
|
42
|
+
errorCount: number;
|
|
43
|
+
errorsByOp: Record<string, number>;
|
|
44
|
+
recentErrors: unknown[];
|
|
45
|
+
};
|
|
32
46
|
expect(data.errorCount).toBe(0);
|
|
33
47
|
expect(data.recentErrors).toEqual([]);
|
|
34
48
|
expect(data.errorsByOp).toEqual({});
|
|
@@ -49,7 +63,11 @@ describe('telemetry-ops', () => {
|
|
|
49
63
|
const res = await executeOp(ops, 'telemetry_errors');
|
|
50
64
|
|
|
51
65
|
expect(res.success).toBe(true);
|
|
52
|
-
const data = res.data as {
|
|
66
|
+
const data = res.data as {
|
|
67
|
+
errorCount: number;
|
|
68
|
+
errorsByOp: Record<string, number>;
|
|
69
|
+
recentErrors: Array<{ op: string }>;
|
|
70
|
+
};
|
|
53
71
|
expect(data.errorCount).toBe(3);
|
|
54
72
|
expect(data.errorsByOp).toEqual({ vault_search: 2, plan_create: 1 });
|
|
55
73
|
expect(data.recentErrors).toHaveLength(3);
|
|
@@ -58,7 +76,11 @@ describe('telemetry-ops', () => {
|
|
|
58
76
|
|
|
59
77
|
it('caps recentErrors at 20', async () => {
|
|
60
78
|
const recent = Array.from({ length: 30 }, (_, i) => ({
|
|
61
|
-
op: `op_${i}`,
|
|
79
|
+
op: `op_${i}`,
|
|
80
|
+
facade: 'test',
|
|
81
|
+
success: false,
|
|
82
|
+
error: 'err',
|
|
83
|
+
timestamp: i,
|
|
62
84
|
}));
|
|
63
85
|
const telemetry = makeTelemetryStub(
|
|
64
86
|
{ errorsByOp: {}, slowestOps: [], avgDurationMs: 0 },
|
|
@@ -90,7 +112,10 @@ describe('telemetry-ops', () => {
|
|
|
90
112
|
const res = await executeOp(ops, 'telemetry_slow_ops', {});
|
|
91
113
|
|
|
92
114
|
expect(res.success).toBe(true);
|
|
93
|
-
const data = res.data as {
|
|
115
|
+
const data = res.data as {
|
|
116
|
+
slowOps: Array<{ op: string; avgMs: number }>;
|
|
117
|
+
avgDurationMs: number;
|
|
118
|
+
};
|
|
94
119
|
expect(data.slowOps).toHaveLength(2);
|
|
95
120
|
expect(data.slowOps.map((o) => o.op)).toEqual(['vault_search', 'plan_create']);
|
|
96
121
|
expect(data.avgDurationMs).toBe(133);
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colocated contract tests for tier-ops.ts.
|
|
3
|
+
* Tests the 7 multi-vault tier and named source ops extracted from vault-facade.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
7
|
+
import { createTierOps } from './tier-ops.js';
|
|
8
|
+
import { captureOps, executeOp } from '../engine/test-helpers.js';
|
|
9
|
+
import type { CapturedOp } from '../engine/test-helpers.js';
|
|
10
|
+
import type { AgentRuntime } from './types.js';
|
|
11
|
+
|
|
12
|
+
function makeMockVaultManager() {
|
|
13
|
+
return {
|
|
14
|
+
open: vi.fn(),
|
|
15
|
+
disconnect: vi.fn().mockReturnValue(true),
|
|
16
|
+
listTiers: vi.fn().mockReturnValue([{ tier: 'agent', connected: true, entries: 25 }]),
|
|
17
|
+
search: vi.fn().mockReturnValue([{ id: 'e1', tier: 'agent', score: 0.9 }]),
|
|
18
|
+
connect: vi.fn(),
|
|
19
|
+
disconnectNamed: vi.fn().mockReturnValue(true),
|
|
20
|
+
listConnected: vi.fn().mockReturnValue([{ name: 'team-shared', priority: 0.5 }]),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function makeRuntime(): AgentRuntime {
|
|
25
|
+
return {
|
|
26
|
+
vaultManager: makeMockVaultManager(),
|
|
27
|
+
config: { agentId: 'test-agent' },
|
|
28
|
+
} as unknown as AgentRuntime;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('tier-ops', () => {
|
|
32
|
+
let runtime: AgentRuntime;
|
|
33
|
+
let ops: Map<string, CapturedOp>;
|
|
34
|
+
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
runtime = makeRuntime();
|
|
37
|
+
ops = captureOps(createTierOps(runtime));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('registers all 7 tier/source ops', () => {
|
|
41
|
+
expect(ops.size).toBe(7);
|
|
42
|
+
expect(ops.has('vault_connect')).toBe(true);
|
|
43
|
+
expect(ops.has('vault_disconnect')).toBe(true);
|
|
44
|
+
expect(ops.has('vault_tiers')).toBe(true);
|
|
45
|
+
expect(ops.has('vault_search_all')).toBe(true);
|
|
46
|
+
expect(ops.has('vault_connect_source')).toBe(true);
|
|
47
|
+
expect(ops.has('vault_disconnect_source')).toBe(true);
|
|
48
|
+
expect(ops.has('vault_list_sources')).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('has correct auth levels', () => {
|
|
52
|
+
expect(ops.get('vault_connect')!.auth).toBe('admin');
|
|
53
|
+
expect(ops.get('vault_disconnect')!.auth).toBe('admin');
|
|
54
|
+
expect(ops.get('vault_tiers')!.auth).toBe('read');
|
|
55
|
+
expect(ops.get('vault_search_all')!.auth).toBe('read');
|
|
56
|
+
expect(ops.get('vault_connect_source')!.auth).toBe('admin');
|
|
57
|
+
expect(ops.get('vault_disconnect_source')!.auth).toBe('admin');
|
|
58
|
+
expect(ops.get('vault_list_sources')!.auth).toBe('read');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// ─── Multi-vault ops ──────────────────────────────────────────────
|
|
62
|
+
|
|
63
|
+
describe('vault_connect', () => {
|
|
64
|
+
it('connects a vault tier', async () => {
|
|
65
|
+
const result = await executeOp(ops, 'vault_connect', {
|
|
66
|
+
tier: 'project',
|
|
67
|
+
path: '/tmp/project.db',
|
|
68
|
+
});
|
|
69
|
+
expect(result.success).toBe(true);
|
|
70
|
+
const data = result.data as { connected: boolean; tier: string; path: string };
|
|
71
|
+
expect(data.connected).toBe(true);
|
|
72
|
+
expect(data.tier).toBe('project');
|
|
73
|
+
expect(data.path).toBe('/tmp/project.db');
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
describe('vault_disconnect', () => {
|
|
78
|
+
it('disconnects a vault tier', async () => {
|
|
79
|
+
const result = await executeOp(ops, 'vault_disconnect', { tier: 'team' });
|
|
80
|
+
expect(result.success).toBe(true);
|
|
81
|
+
const data = result.data as { disconnected: boolean; tier: string };
|
|
82
|
+
expect(data.disconnected).toBe(true);
|
|
83
|
+
expect(data.tier).toBe('team');
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('vault_tiers', () => {
|
|
88
|
+
it('lists vault tiers', async () => {
|
|
89
|
+
const result = await executeOp(ops, 'vault_tiers', {});
|
|
90
|
+
expect(result.success).toBe(true);
|
|
91
|
+
const data = result.data as { tiers: Array<{ tier: string }> };
|
|
92
|
+
expect(data.tiers).toHaveLength(1);
|
|
93
|
+
expect(data.tiers[0].tier).toBe('agent');
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
describe('vault_search_all', () => {
|
|
98
|
+
it('searches across all tiers', async () => {
|
|
99
|
+
const result = await executeOp(ops, 'vault_search_all', { query: 'tokens' });
|
|
100
|
+
expect(result.success).toBe(true);
|
|
101
|
+
const data = result.data as { results: unknown[]; count: number };
|
|
102
|
+
expect(data.count).toBe(1);
|
|
103
|
+
const vm = runtime.vaultManager as ReturnType<typeof makeMockVaultManager>;
|
|
104
|
+
expect(vm.search).toHaveBeenCalledWith('tokens', 20);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('passes custom limit', async () => {
|
|
108
|
+
await executeOp(ops, 'vault_search_all', { query: 'test', limit: 5 });
|
|
109
|
+
const vm = runtime.vaultManager as ReturnType<typeof makeMockVaultManager>;
|
|
110
|
+
expect(vm.search).toHaveBeenCalledWith('test', 5);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// ─── Named vault connections ───────────────────────────────────────
|
|
115
|
+
|
|
116
|
+
describe('vault_connect_source', () => {
|
|
117
|
+
it('connects with default priority', async () => {
|
|
118
|
+
const result = await executeOp(ops, 'vault_connect_source', {
|
|
119
|
+
name: 'team-kb',
|
|
120
|
+
path: '/tmp/team.db',
|
|
121
|
+
});
|
|
122
|
+
expect(result.success).toBe(true);
|
|
123
|
+
const data = result.data as { connected: boolean; priority: number };
|
|
124
|
+
expect(data.connected).toBe(true);
|
|
125
|
+
expect(data.priority).toBe(0.5);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('connects with custom priority', async () => {
|
|
129
|
+
const result = await executeOp(ops, 'vault_connect_source', {
|
|
130
|
+
name: 'primary',
|
|
131
|
+
path: '/tmp/p.db',
|
|
132
|
+
priority: 1.5,
|
|
133
|
+
});
|
|
134
|
+
expect(result.success).toBe(true);
|
|
135
|
+
const vm = runtime.vaultManager as ReturnType<typeof makeMockVaultManager>;
|
|
136
|
+
expect(vm.connect).toHaveBeenCalledWith('primary', '/tmp/p.db', 1.5);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
describe('vault_disconnect_source', () => {
|
|
141
|
+
it('disconnects a named source', async () => {
|
|
142
|
+
const result = await executeOp(ops, 'vault_disconnect_source', { name: 'team-kb' });
|
|
143
|
+
expect(result.success).toBe(true);
|
|
144
|
+
const data = result.data as { disconnected: boolean; name: string };
|
|
145
|
+
expect(data.disconnected).toBe(true);
|
|
146
|
+
expect(data.name).toBe('team-kb');
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
describe('vault_list_sources', () => {
|
|
151
|
+
it('lists connected sources', async () => {
|
|
152
|
+
const result = await executeOp(ops, 'vault_list_sources', {});
|
|
153
|
+
expect(result.success).toBe(true);
|
|
154
|
+
const data = result.data as { sources: Array<{ name: string }> };
|
|
155
|
+
expect(data.sources).toHaveLength(1);
|
|
156
|
+
expect(data.sources[0].name).toBe('team-shared');
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
});
|