@soleri/core 2.0.2 → 2.4.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 +14 -50
- package/dist/brain/brain.d.ts.map +1 -1
- package/dist/brain/brain.js +207 -16
- package/dist/brain/brain.js.map +1 -1
- package/dist/brain/intelligence.d.ts +86 -0
- package/dist/brain/intelligence.d.ts.map +1 -0
- package/dist/brain/intelligence.js +771 -0
- package/dist/brain/intelligence.js.map +1 -0
- package/dist/brain/types.d.ts +197 -0
- package/dist/brain/types.d.ts.map +1 -0
- package/dist/brain/types.js +2 -0
- package/dist/brain/types.js.map +1 -0
- package/dist/cognee/client.d.ts +35 -0
- package/dist/cognee/client.d.ts.map +1 -0
- package/dist/cognee/client.js +291 -0
- package/dist/cognee/client.js.map +1 -0
- package/dist/cognee/types.d.ts +46 -0
- package/dist/cognee/types.d.ts.map +1 -0
- package/dist/cognee/types.js +3 -0
- package/dist/cognee/types.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 +29 -0
- package/dist/curator/curator.d.ts.map +1 -1
- package/dist/curator/curator.js +142 -5
- package/dist/curator/curator.js.map +1 -1
- 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 +35 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -1
- package/dist/index.js.map +1 -1
- package/dist/llm/llm-client.d.ts.map +1 -1
- package/dist/llm/llm-client.js +9 -2
- package/dist/llm/llm-client.js.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 +49 -0
- package/dist/loop/loop-manager.d.ts.map +1 -0
- package/dist/loop/loop-manager.js +105 -0
- package/dist/loop/loop-manager.js.map +1 -0
- package/dist/loop/types.d.ts +35 -0
- package/dist/loop/types.d.ts.map +1 -0
- package/dist/loop/types.js +8 -0
- package/dist/loop/types.js.map +1 -0
- package/dist/planning/gap-analysis.d.ts +29 -0
- package/dist/planning/gap-analysis.d.ts.map +1 -0
- package/dist/planning/gap-analysis.js +265 -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 +150 -1
- package/dist/planning/planner.d.ts.map +1 -1
- package/dist/planning/planner.js +365 -2
- package/dist/planning/planner.js.map +1 -1
- 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 +276 -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/runtime/admin-extra-ops.d.ts +13 -0
- package/dist/runtime/admin-extra-ops.d.ts.map +1 -0
- package/dist/runtime/admin-extra-ops.js +284 -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 +322 -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 +345 -0
- package/dist/runtime/capture-ops.js.map +1 -0
- package/dist/runtime/core-ops.d.ts +7 -3
- package/dist/runtime/core-ops.d.ts.map +1 -1
- package/dist/runtime/core-ops.js +646 -15
- 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 +59 -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 +59 -13
- 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/loop-ops.d.ts +13 -0
- package/dist/runtime/loop-ops.d.ts.map +1 -0
- package/dist/runtime/loop-ops.js +179 -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 +240 -0
- package/dist/runtime/orchestrate-ops.js.map +1 -0
- package/dist/runtime/planning-extra-ops.d.ts +17 -0
- package/dist/runtime/planning-extra-ops.d.ts.map +1 -0
- package/dist/runtime/planning-extra-ops.js +300 -0
- package/dist/runtime/planning-extra-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 +181 -0
- package/dist/runtime/project-ops.js.map +1 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +48 -1
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/types.d.ts +23 -0
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/vault-extra-ops.d.ts +9 -0
- package/dist/runtime/vault-extra-ops.d.ts.map +1 -0
- package/dist/runtime/vault-extra-ops.js +195 -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/vault.d.ts +94 -0
- package/dist/vault/vault.d.ts.map +1 -1
- package/dist/vault/vault.js +340 -1
- package/dist/vault/vault.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/admin-extra-ops.test.ts +420 -0
- package/src/__tests__/admin-ops.test.ts +271 -0
- package/src/__tests__/brain-intelligence.test.ts +828 -0
- package/src/__tests__/brain.test.ts +396 -27
- package/src/__tests__/capture-ops.test.ts +509 -0
- package/src/__tests__/cognee-client.test.ts +524 -0
- package/src/__tests__/core-ops.test.ts +341 -49
- package/src/__tests__/curator-extra-ops.test.ts +359 -0
- package/src/__tests__/curator.test.ts +126 -31
- package/src/__tests__/domain-ops.test.ts +111 -9
- package/src/__tests__/governance.test.ts +522 -0
- package/src/__tests__/grading-ops.test.ts +340 -0
- package/src/__tests__/identity-manager.test.ts +243 -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 +398 -0
- package/src/__tests__/memory-cross-project-ops.test.ts +246 -0
- package/src/__tests__/memory-extra-ops.test.ts +352 -0
- package/src/__tests__/orchestrate-ops.test.ts +284 -0
- package/src/__tests__/planner.test.ts +331 -0
- package/src/__tests__/planning-extra-ops.test.ts +548 -0
- package/src/__tests__/project-ops.test.ts +367 -0
- package/src/__tests__/runtime.test.ts +13 -11
- package/src/__tests__/vault-extra-ops.test.ts +407 -0
- package/src/brain/brain.ts +308 -72
- package/src/brain/intelligence.ts +1230 -0
- package/src/brain/types.ts +214 -0
- package/src/cognee/client.ts +352 -0
- package/src/cognee/types.ts +62 -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 +265 -15
- 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 +128 -3
- package/src/llm/llm-client.ts +18 -24
- package/src/logging/logger.ts +154 -0
- package/src/logging/types.ts +21 -0
- package/src/loop/loop-manager.ts +130 -0
- package/src/loop/types.ts +44 -0
- package/src/planning/gap-analysis.ts +506 -0
- package/src/planning/gap-types.ts +58 -0
- package/src/planning/planner.ts +478 -2
- package/src/project/project-registry.ts +358 -0
- package/src/project/types.ts +31 -0
- package/src/runtime/admin-extra-ops.ts +307 -0
- package/src/runtime/admin-ops.ts +329 -0
- package/src/runtime/capture-ops.ts +385 -0
- package/src/runtime/core-ops.ts +747 -26
- package/src/runtime/curator-extra-ops.ts +71 -0
- package/src/runtime/domain-ops.ts +65 -13
- package/src/runtime/grading-ops.ts +121 -0
- package/src/runtime/loop-ops.ts +194 -0
- package/src/runtime/memory-cross-project-ops.ts +192 -0
- package/src/runtime/memory-extra-ops.ts +186 -0
- package/src/runtime/orchestrate-ops.ts +272 -0
- package/src/runtime/planning-extra-ops.ts +327 -0
- package/src/runtime/project-ops.ts +196 -0
- package/src/runtime/runtime.ts +54 -1
- package/src/runtime/types.ts +23 -0
- package/src/runtime/vault-extra-ops.ts +225 -0
- package/src/telemetry/telemetry.ts +118 -0
- package/src/vault/vault.ts +412 -1
|
@@ -34,8 +34,8 @@ describe('createCoreOps', () => {
|
|
|
34
34
|
return op;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
it('should return
|
|
38
|
-
expect(ops.length).toBe(
|
|
37
|
+
it('should return 147 ops', () => {
|
|
38
|
+
expect(ops.length).toBe(147);
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
it('should have all expected op names', () => {
|
|
@@ -60,9 +60,24 @@ describe('createCoreOps', () => {
|
|
|
60
60
|
expect(names).toContain('complete_plan');
|
|
61
61
|
// Brain
|
|
62
62
|
expect(names).toContain('record_feedback');
|
|
63
|
+
expect(names).toContain('brain_feedback');
|
|
64
|
+
expect(names).toContain('brain_feedback_stats');
|
|
63
65
|
expect(names).toContain('rebuild_vocabulary');
|
|
64
66
|
expect(names).toContain('brain_stats');
|
|
65
67
|
expect(names).toContain('llm_status');
|
|
68
|
+
// Brain Intelligence
|
|
69
|
+
expect(names).toContain('brain_session_context');
|
|
70
|
+
expect(names).toContain('brain_strengths');
|
|
71
|
+
expect(names).toContain('brain_global_patterns');
|
|
72
|
+
expect(names).toContain('brain_recommend');
|
|
73
|
+
expect(names).toContain('brain_build_intelligence');
|
|
74
|
+
expect(names).toContain('brain_export');
|
|
75
|
+
expect(names).toContain('brain_import');
|
|
76
|
+
expect(names).toContain('brain_extract_knowledge');
|
|
77
|
+
expect(names).toContain('brain_archive_sessions');
|
|
78
|
+
expect(names).toContain('brain_promote_proposals');
|
|
79
|
+
expect(names).toContain('brain_lifecycle');
|
|
80
|
+
expect(names).toContain('brain_reset_extracted');
|
|
66
81
|
// Curator
|
|
67
82
|
expect(names).toContain('curator_status');
|
|
68
83
|
expect(names).toContain('curator_detect_duplicates');
|
|
@@ -72,61 +87,196 @@ describe('createCoreOps', () => {
|
|
|
72
87
|
expect(names).toContain('curator_groom_all');
|
|
73
88
|
expect(names).toContain('curator_consolidate');
|
|
74
89
|
expect(names).toContain('curator_health_audit');
|
|
90
|
+
// Control
|
|
91
|
+
expect(names).toContain('get_identity');
|
|
92
|
+
expect(names).toContain('update_identity');
|
|
93
|
+
expect(names).toContain('add_guideline');
|
|
94
|
+
expect(names).toContain('remove_guideline');
|
|
95
|
+
expect(names).toContain('rollback_identity');
|
|
96
|
+
expect(names).toContain('route_intent');
|
|
97
|
+
expect(names).toContain('morph');
|
|
98
|
+
expect(names).toContain('get_behavior_rules');
|
|
99
|
+
// Cognee
|
|
100
|
+
expect(names).toContain('cognee_status');
|
|
101
|
+
expect(names).toContain('cognee_search');
|
|
102
|
+
expect(names).toContain('cognee_add');
|
|
103
|
+
expect(names).toContain('cognee_cognify');
|
|
104
|
+
expect(names).toContain('cognee_config');
|
|
105
|
+
// LLM
|
|
106
|
+
expect(names).toContain('llm_rotate');
|
|
107
|
+
expect(names).toContain('llm_call');
|
|
108
|
+
// Governance
|
|
109
|
+
expect(names).toContain('governance_policy');
|
|
110
|
+
expect(names).toContain('governance_proposals');
|
|
111
|
+
expect(names).toContain('governance_stats');
|
|
112
|
+
expect(names).toContain('governance_expire');
|
|
113
|
+
expect(names).toContain('governance_dashboard');
|
|
114
|
+
// Planning Extra (9)
|
|
115
|
+
expect(names).toContain('plan_iterate');
|
|
116
|
+
expect(names).toContain('plan_split');
|
|
117
|
+
expect(names).toContain('plan_reconcile');
|
|
118
|
+
expect(names).toContain('plan_complete_lifecycle');
|
|
119
|
+
expect(names).toContain('plan_dispatch');
|
|
120
|
+
expect(names).toContain('plan_review');
|
|
121
|
+
expect(names).toContain('plan_archive');
|
|
122
|
+
expect(names).toContain('plan_list_tasks');
|
|
123
|
+
expect(names).toContain('plan_stats');
|
|
124
|
+
// Memory Extra (8)
|
|
125
|
+
expect(names).toContain('memory_delete');
|
|
126
|
+
expect(names).toContain('memory_stats');
|
|
127
|
+
expect(names).toContain('memory_export');
|
|
128
|
+
expect(names).toContain('memory_import');
|
|
129
|
+
expect(names).toContain('memory_prune');
|
|
130
|
+
expect(names).toContain('memory_deduplicate');
|
|
131
|
+
expect(names).toContain('memory_topics');
|
|
132
|
+
expect(names).toContain('memory_by_project');
|
|
133
|
+
// Vault Extra (12)
|
|
134
|
+
expect(names).toContain('vault_get');
|
|
135
|
+
expect(names).toContain('vault_update');
|
|
136
|
+
expect(names).toContain('vault_remove');
|
|
137
|
+
expect(names).toContain('vault_bulk_add');
|
|
138
|
+
expect(names).toContain('vault_bulk_remove');
|
|
139
|
+
expect(names).toContain('vault_tags');
|
|
140
|
+
expect(names).toContain('vault_domains');
|
|
141
|
+
expect(names).toContain('vault_recent');
|
|
142
|
+
expect(names).toContain('vault_import');
|
|
143
|
+
expect(names).toContain('vault_seed');
|
|
144
|
+
expect(names).toContain('vault_backup');
|
|
145
|
+
expect(names).toContain('vault_age_report');
|
|
146
|
+
// Admin (8)
|
|
147
|
+
expect(names).toContain('admin_health');
|
|
148
|
+
expect(names).toContain('admin_tool_list');
|
|
149
|
+
expect(names).toContain('admin_config');
|
|
150
|
+
expect(names).toContain('admin_vault_size');
|
|
151
|
+
expect(names).toContain('admin_uptime');
|
|
152
|
+
expect(names).toContain('admin_version');
|
|
153
|
+
expect(names).toContain('admin_reset_cache');
|
|
154
|
+
expect(names).toContain('admin_diagnostic');
|
|
155
|
+
// Admin Extra (10)
|
|
156
|
+
expect(names).toContain('admin_telemetry');
|
|
157
|
+
expect(names).toContain('admin_telemetry_recent');
|
|
158
|
+
expect(names).toContain('admin_telemetry_reset');
|
|
159
|
+
expect(names).toContain('admin_permissions');
|
|
160
|
+
expect(names).toContain('admin_vault_analytics');
|
|
161
|
+
expect(names).toContain('admin_search_insights');
|
|
162
|
+
expect(names).toContain('admin_module_status');
|
|
163
|
+
expect(names).toContain('admin_env');
|
|
164
|
+
expect(names).toContain('admin_gc');
|
|
165
|
+
expect(names).toContain('admin_export_config');
|
|
166
|
+
// Loop (7)
|
|
167
|
+
expect(names).toContain('loop_start');
|
|
168
|
+
expect(names).toContain('loop_iterate');
|
|
169
|
+
expect(names).toContain('loop_status');
|
|
170
|
+
expect(names).toContain('loop_cancel');
|
|
171
|
+
expect(names).toContain('loop_history');
|
|
172
|
+
expect(names).toContain('loop_is_active');
|
|
173
|
+
expect(names).toContain('loop_complete');
|
|
174
|
+
// Orchestrate (5)
|
|
175
|
+
expect(names).toContain('orchestrate_plan');
|
|
176
|
+
expect(names).toContain('orchestrate_execute');
|
|
177
|
+
expect(names).toContain('orchestrate_complete');
|
|
178
|
+
expect(names).toContain('orchestrate_status');
|
|
179
|
+
expect(names).toContain('orchestrate_quick_capture');
|
|
180
|
+
// Grading (5)
|
|
181
|
+
expect(names).toContain('plan_grade');
|
|
182
|
+
expect(names).toContain('plan_check_history');
|
|
183
|
+
expect(names).toContain('plan_latest_check');
|
|
184
|
+
expect(names).toContain('plan_meets_grade');
|
|
185
|
+
expect(names).toContain('plan_auto_improve');
|
|
186
|
+
// Capture (4)
|
|
187
|
+
expect(names).toContain('capture_knowledge');
|
|
188
|
+
expect(names).toContain('capture_quick');
|
|
189
|
+
expect(names).toContain('search_intelligent');
|
|
190
|
+
expect(names).toContain('search_feedback');
|
|
191
|
+
// Curator Extra (4)
|
|
192
|
+
expect(names).toContain('curator_entry_history');
|
|
193
|
+
expect(names).toContain('curator_record_snapshot');
|
|
194
|
+
expect(names).toContain('curator_queue_stats');
|
|
195
|
+
expect(names).toContain('curator_enrich');
|
|
196
|
+
// Project (12)
|
|
197
|
+
expect(names).toContain('project_get');
|
|
198
|
+
expect(names).toContain('project_list');
|
|
199
|
+
expect(names).toContain('project_unregister');
|
|
200
|
+
expect(names).toContain('project_get_rules');
|
|
201
|
+
expect(names).toContain('project_list_rules');
|
|
202
|
+
expect(names).toContain('project_add_rule');
|
|
203
|
+
expect(names).toContain('project_remove_rule');
|
|
204
|
+
expect(names).toContain('project_link');
|
|
205
|
+
expect(names).toContain('project_unlink');
|
|
206
|
+
expect(names).toContain('project_get_links');
|
|
207
|
+
expect(names).toContain('project_linked_projects');
|
|
208
|
+
expect(names).toContain('project_touch');
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
it('register should include governance summary', async () => {
|
|
212
|
+
const result = (await findOp('register').handler({ projectPath: '/tmp/test-gov-reg' })) as {
|
|
213
|
+
governance: { pendingProposals: number; quotaPercent: number; isQuotaWarning: boolean };
|
|
214
|
+
};
|
|
215
|
+
expect(typeof result.governance.pendingProposals).toBe('number');
|
|
216
|
+
expect(typeof result.governance.quotaPercent).toBe('number');
|
|
217
|
+
expect(typeof result.governance.isQuotaWarning).toBe('boolean');
|
|
75
218
|
});
|
|
76
219
|
|
|
77
220
|
it('search should query vault via brain', async () => {
|
|
78
|
-
runtime.vault.seed([
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
221
|
+
runtime.vault.seed([
|
|
222
|
+
{
|
|
223
|
+
id: 'co-1',
|
|
224
|
+
type: 'pattern',
|
|
225
|
+
domain: 'testing',
|
|
226
|
+
title: 'Test pattern for core ops',
|
|
227
|
+
severity: 'warning',
|
|
228
|
+
description: 'Core ops test.',
|
|
229
|
+
tags: ['test'],
|
|
230
|
+
},
|
|
231
|
+
]);
|
|
87
232
|
runtime.brain.rebuildVocabulary();
|
|
88
233
|
|
|
89
234
|
// Re-create ops since brain state changed
|
|
90
235
|
ops = createCoreOps(runtime);
|
|
91
|
-
const results = await findOp('search').handler({ query: 'core ops test' }) as unknown[];
|
|
236
|
+
const results = (await findOp('search').handler({ query: 'core ops test' })) as unknown[];
|
|
92
237
|
expect(results.length).toBeGreaterThan(0);
|
|
93
238
|
});
|
|
94
239
|
|
|
95
240
|
it('vault_stats should return counts', async () => {
|
|
96
|
-
runtime.vault.seed([
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
241
|
+
runtime.vault.seed([
|
|
242
|
+
{
|
|
243
|
+
id: 'vs-1',
|
|
244
|
+
type: 'pattern',
|
|
245
|
+
domain: 'd1',
|
|
246
|
+
title: 'T',
|
|
247
|
+
severity: 'warning',
|
|
248
|
+
description: 'D',
|
|
249
|
+
tags: ['t'],
|
|
250
|
+
},
|
|
251
|
+
]);
|
|
252
|
+
const stats = (await findOp('vault_stats').handler({})) as { totalEntries: number };
|
|
106
253
|
expect(stats.totalEntries).toBe(1);
|
|
107
254
|
});
|
|
108
255
|
|
|
109
256
|
it('create_plan + get_plan should work', async () => {
|
|
110
|
-
const created = await findOp('create_plan').handler({
|
|
257
|
+
const created = (await findOp('create_plan').handler({
|
|
111
258
|
objective: 'Test plan',
|
|
112
259
|
scope: 'core-ops test',
|
|
113
260
|
tasks: [{ title: 'Task 1', description: 'Do something' }],
|
|
114
|
-
}) as { created: boolean; plan: { id: string; status: string } };
|
|
261
|
+
})) as { created: boolean; plan: { id: string; status: string } };
|
|
115
262
|
expect(created.created).toBe(true);
|
|
116
263
|
expect(created.plan.status).toBe('draft');
|
|
117
264
|
|
|
118
|
-
const plan = await findOp('get_plan').handler({ planId: created.plan.id }) as { id: string };
|
|
265
|
+
const plan = (await findOp('get_plan').handler({ planId: created.plan.id })) as { id: string };
|
|
119
266
|
expect(plan.id).toBe(created.plan.id);
|
|
120
267
|
});
|
|
121
268
|
|
|
122
269
|
it('brain_stats should return stats', async () => {
|
|
123
|
-
const stats = await findOp('brain_stats').handler({}) as {
|
|
270
|
+
const stats = (await findOp('brain_stats').handler({})) as {
|
|
271
|
+
vocabularySize: number;
|
|
272
|
+
feedbackCount: number;
|
|
273
|
+
};
|
|
124
274
|
expect(stats.vocabularySize).toBe(0);
|
|
125
275
|
expect(stats.feedbackCount).toBe(0);
|
|
126
276
|
});
|
|
127
277
|
|
|
128
278
|
it('llm_status should return provider info', async () => {
|
|
129
|
-
const status = await findOp('llm_status').handler({}) as {
|
|
279
|
+
const status = (await findOp('llm_status').handler({})) as {
|
|
130
280
|
providers: {
|
|
131
281
|
openai: { available: boolean };
|
|
132
282
|
anthropic: { available: boolean };
|
|
@@ -139,22 +289,24 @@ describe('createCoreOps', () => {
|
|
|
139
289
|
});
|
|
140
290
|
|
|
141
291
|
it('curator_status should return initialized', async () => {
|
|
142
|
-
const status = await findOp('curator_status').handler({}) as { initialized: boolean };
|
|
292
|
+
const status = (await findOp('curator_status').handler({})) as { initialized: boolean };
|
|
143
293
|
expect(status.initialized).toBe(true);
|
|
144
294
|
});
|
|
145
295
|
|
|
146
296
|
it('curator_health_audit should return score', async () => {
|
|
147
|
-
runtime.vault.seed([
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
297
|
+
runtime.vault.seed([
|
|
298
|
+
{
|
|
299
|
+
id: 'ha-1',
|
|
300
|
+
type: 'pattern',
|
|
301
|
+
domain: 'testing',
|
|
302
|
+
title: 'Health pattern',
|
|
303
|
+
severity: 'warning',
|
|
304
|
+
description: 'Testing health.',
|
|
305
|
+
tags: ['health'],
|
|
306
|
+
},
|
|
307
|
+
]);
|
|
156
308
|
runtime.curator.groomAll();
|
|
157
|
-
const result = await findOp('curator_health_audit').handler({}) as { score: number };
|
|
309
|
+
const result = (await findOp('curator_health_audit').handler({})) as { score: number };
|
|
158
310
|
expect(result.score).toBeGreaterThan(0);
|
|
159
311
|
});
|
|
160
312
|
|
|
@@ -169,22 +321,162 @@ describe('createCoreOps', () => {
|
|
|
169
321
|
toolsUsed: [],
|
|
170
322
|
});
|
|
171
323
|
|
|
172
|
-
const results = await findOp('memory_search').handler({
|
|
324
|
+
const results = (await findOp('memory_search').handler({
|
|
325
|
+
query: 'core ops memory',
|
|
326
|
+
})) as unknown[];
|
|
173
327
|
expect(results.length).toBeGreaterThan(0);
|
|
174
328
|
});
|
|
175
329
|
|
|
330
|
+
it('brain_feedback should record enhanced feedback', async () => {
|
|
331
|
+
runtime.vault.seed([
|
|
332
|
+
{
|
|
333
|
+
id: 'bf-1',
|
|
334
|
+
type: 'pattern',
|
|
335
|
+
domain: 'testing',
|
|
336
|
+
title: 'Brain feedback test',
|
|
337
|
+
severity: 'warning',
|
|
338
|
+
description: 'Test.',
|
|
339
|
+
tags: ['test'],
|
|
340
|
+
},
|
|
341
|
+
]);
|
|
342
|
+
ops = createCoreOps(runtime);
|
|
343
|
+
const result = (await findOp('brain_feedback').handler({
|
|
344
|
+
query: 'test',
|
|
345
|
+
entryId: 'bf-1',
|
|
346
|
+
action: 'modified',
|
|
347
|
+
source: 'recommendation',
|
|
348
|
+
confidence: 0.8,
|
|
349
|
+
})) as { id: number; action: string; source: string };
|
|
350
|
+
expect(result.id).toBeGreaterThan(0);
|
|
351
|
+
expect(result.action).toBe('modified');
|
|
352
|
+
expect(result.source).toBe('recommendation');
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it('brain_feedback_stats should return stats', async () => {
|
|
356
|
+
const stats = (await findOp('brain_feedback_stats').handler({})) as {
|
|
357
|
+
total: number;
|
|
358
|
+
acceptanceRate: number;
|
|
359
|
+
};
|
|
360
|
+
expect(typeof stats.total).toBe('number');
|
|
361
|
+
expect(typeof stats.acceptanceRate).toBe('number');
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
it('brain_reset_extracted should return reset count', async () => {
|
|
365
|
+
const result = (await findOp('brain_reset_extracted').handler({ all: true })) as {
|
|
366
|
+
reset: number;
|
|
367
|
+
};
|
|
368
|
+
expect(typeof result.reset).toBe('number');
|
|
369
|
+
});
|
|
370
|
+
|
|
176
371
|
it('export should return bundles', async () => {
|
|
177
|
-
runtime.vault.seed([
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
372
|
+
runtime.vault.seed([
|
|
373
|
+
{
|
|
374
|
+
id: 'exp-1',
|
|
375
|
+
type: 'pattern',
|
|
376
|
+
domain: 'security',
|
|
377
|
+
title: 'Export test',
|
|
378
|
+
severity: 'warning',
|
|
379
|
+
description: 'Testing export.',
|
|
380
|
+
tags: ['export'],
|
|
381
|
+
},
|
|
382
|
+
]);
|
|
383
|
+
const result = (await findOp('export').handler({})) as {
|
|
384
|
+
exported: boolean;
|
|
385
|
+
totalEntries: number;
|
|
386
|
+
};
|
|
187
387
|
expect(result.exported).toBe(true);
|
|
188
388
|
expect(result.totalEntries).toBe(1);
|
|
189
389
|
});
|
|
390
|
+
|
|
391
|
+
it('cognee_status should return health check result', async () => {
|
|
392
|
+
// Cognee is not running in tests — should degrade gracefully
|
|
393
|
+
const result = (await findOp('cognee_status').handler({})) as {
|
|
394
|
+
available: boolean;
|
|
395
|
+
url: string;
|
|
396
|
+
};
|
|
397
|
+
expect(typeof result.available).toBe('boolean');
|
|
398
|
+
expect(typeof result.url).toBe('string');
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
it('cognee_search should return empty when unavailable', async () => {
|
|
402
|
+
const results = (await findOp('cognee_search').handler({
|
|
403
|
+
query: 'test pattern',
|
|
404
|
+
})) as unknown[];
|
|
405
|
+
expect(results).toEqual([]);
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
it('cognee_add should return 0 when unavailable', async () => {
|
|
409
|
+
runtime.vault.seed([
|
|
410
|
+
{
|
|
411
|
+
id: 'cog-1',
|
|
412
|
+
type: 'pattern',
|
|
413
|
+
domain: 'testing',
|
|
414
|
+
title: 'Cognee test',
|
|
415
|
+
severity: 'warning',
|
|
416
|
+
description: 'Test.',
|
|
417
|
+
tags: ['test'],
|
|
418
|
+
},
|
|
419
|
+
]);
|
|
420
|
+
const result = (await findOp('cognee_add').handler({
|
|
421
|
+
entryIds: ['cog-1'],
|
|
422
|
+
})) as { added: number };
|
|
423
|
+
expect(result.added).toBe(0);
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
it('cognee_cognify should return unavailable when Cognee is down', async () => {
|
|
427
|
+
const result = (await findOp('cognee_cognify').handler({})) as { status: string };
|
|
428
|
+
expect(result.status).toBe('unavailable');
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
it('cognee_config should return config and null status', async () => {
|
|
432
|
+
const result = (await findOp('cognee_config').handler({})) as {
|
|
433
|
+
config: { baseUrl: string; dataset: string };
|
|
434
|
+
cachedStatus: null;
|
|
435
|
+
};
|
|
436
|
+
expect(result.config.baseUrl).toBe('http://localhost:8000');
|
|
437
|
+
expect(result.config.dataset).toBe('test-core-ops');
|
|
438
|
+
expect(result.cachedStatus).toBeNull();
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it('llm_rotate should return rotation status', async () => {
|
|
442
|
+
const result = (await findOp('llm_rotate').handler({ provider: 'openai' })) as {
|
|
443
|
+
rotated?: boolean;
|
|
444
|
+
poolSize?: number;
|
|
445
|
+
error?: string;
|
|
446
|
+
};
|
|
447
|
+
// Either reports no keys or successfully rotates
|
|
448
|
+
expect(typeof result.rotated === 'boolean' || typeof result.error === 'string').toBe(true);
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
it('governance_policy get should return defaults', async () => {
|
|
452
|
+
const result = (await findOp('governance_policy').handler({
|
|
453
|
+
action: 'get',
|
|
454
|
+
projectPath: '/test',
|
|
455
|
+
})) as { quotas: { maxEntriesTotal: number } };
|
|
456
|
+
expect(result.quotas.maxEntriesTotal).toBe(500);
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
it('governance_stats should return quota and proposal stats', async () => {
|
|
460
|
+
const result = (await findOp('governance_stats').handler({
|
|
461
|
+
projectPath: '/test',
|
|
462
|
+
})) as {
|
|
463
|
+
quotaStatus: { total: number };
|
|
464
|
+
proposalStats: { total: number };
|
|
465
|
+
};
|
|
466
|
+
expect(typeof result.quotaStatus.total).toBe('number');
|
|
467
|
+
expect(typeof result.proposalStats.total).toBe('number');
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
it('governance_dashboard should return combined view', async () => {
|
|
471
|
+
const result = (await findOp('governance_dashboard').handler({
|
|
472
|
+
projectPath: '/test',
|
|
473
|
+
})) as {
|
|
474
|
+
vaultSize: number;
|
|
475
|
+
quotaPercent: number;
|
|
476
|
+
pendingProposals: number;
|
|
477
|
+
};
|
|
478
|
+
expect(typeof result.vaultSize).toBe('number');
|
|
479
|
+
expect(typeof result.quotaPercent).toBe('number');
|
|
480
|
+
expect(result.pendingProposals).toBe(0);
|
|
481
|
+
});
|
|
190
482
|
});
|