@soleri/core 2.1.0 → 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 +3 -1
- package/dist/brain/brain.d.ts.map +1 -1
- package/dist/brain/brain.js +60 -4
- 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 +32 -0
- package/dist/brain/types.d.ts.map +1 -1
- 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 +135 -0
- 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 +32 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -1
- package/dist/index.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 +474 -8
- 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 +44 -1
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/types.d.ts +21 -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 +205 -0
- package/src/__tests__/brain.test.ts +131 -0
- package/src/__tests__/capture-ops.test.ts +509 -0
- package/src/__tests__/core-ops.test.ts +266 -2
- package/src/__tests__/curator-extra-ops.test.ts +359 -0
- package/src/__tests__/domain-ops.test.ts +66 -0
- 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__/vault-extra-ops.test.ts +407 -0
- package/src/brain/brain.ts +114 -7
- package/src/brain/intelligence.ts +179 -10
- package/src/brain/types.ts +38 -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 +213 -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 +102 -2
- 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 +535 -7
- 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 +49 -1
- package/src/runtime/types.ts +21 -0
- package/src/runtime/vault-extra-ops.ts +225 -0
- package/src/telemetry/telemetry.ts +118 -0
- package/src/vault/vault.ts +412 -1
package/dist/runtime/core-ops.js
CHANGED
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generic core operations factory —
|
|
2
|
+
* Generic core operations factory — 147 ops that every agent gets.
|
|
3
3
|
*
|
|
4
4
|
* These ops are agent-agnostic (no persona, no activation).
|
|
5
5
|
* The 5 agent-specific ops (health, identity, activate, inject_claude_md, setup)
|
|
6
6
|
* stay in generated code because they reference agent-specific modules.
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
+
import { createPlanningExtraOps } from './planning-extra-ops.js';
|
|
10
|
+
import { createMemoryExtraOps } from './memory-extra-ops.js';
|
|
11
|
+
import { createVaultExtraOps } from './vault-extra-ops.js';
|
|
12
|
+
import { createAdminOps } from './admin-ops.js';
|
|
13
|
+
import { createAdminExtraOps } from './admin-extra-ops.js';
|
|
14
|
+
import { createLoopOps } from './loop-ops.js';
|
|
15
|
+
import { createOrchestrateOps } from './orchestrate-ops.js';
|
|
16
|
+
import { createGradingOps } from './grading-ops.js';
|
|
17
|
+
import { createCaptureOps } from './capture-ops.js';
|
|
18
|
+
import { createCuratorExtraOps } from './curator-extra-ops.js';
|
|
19
|
+
import { createProjectOps } from './project-ops.js';
|
|
20
|
+
import { createMemoryCrossProjectOps } from './memory-cross-project-ops.js';
|
|
9
21
|
/**
|
|
10
|
-
* Create the
|
|
22
|
+
* Create the 147 generic core operations for an agent runtime.
|
|
11
23
|
*
|
|
12
24
|
* Groups: search/vault (4), memory (4), export (1), planning (5),
|
|
13
|
-
* brain (
|
|
25
|
+
* brain (7), brain intelligence (11), cognee (5),
|
|
26
|
+
* llm (2), curator (8), control (8), governance (5),
|
|
27
|
+
* planning-extra (9), memory-extra (8), vault-extra (12),
|
|
28
|
+
* admin (8), admin-extra (10), loop (7), orchestrate (5),
|
|
29
|
+
* grading (5), capture (4), curator-extra (4), project (12).
|
|
14
30
|
*/
|
|
15
31
|
export function createCoreOps(runtime) {
|
|
16
|
-
const { vault, brain, brainIntelligence, planner, curator, llmClient, keyPool } = runtime;
|
|
32
|
+
const { vault, brain, brainIntelligence, planner, curator, governance, cognee, identityManager, intentRouter, llmClient, keyPool, } = runtime;
|
|
17
33
|
return [
|
|
18
34
|
// ─── Search / Vault ──────────────────────────────────────────
|
|
19
35
|
{
|
|
@@ -79,8 +95,15 @@ export function createCoreOps(runtime) {
|
|
|
79
95
|
const { resolve } = await import('node:path');
|
|
80
96
|
const projectPath = resolve(params.projectPath ?? '.');
|
|
81
97
|
const project = vault.registerProject(projectPath, params.name);
|
|
98
|
+
// Also track in project registry for cross-project features
|
|
99
|
+
runtime.projectRegistry.register(projectPath, params.name);
|
|
82
100
|
const stats = vault.stats();
|
|
83
101
|
const isNew = project.sessionCount === 1;
|
|
102
|
+
// Expire stale proposals on session start (fire-and-forget)
|
|
103
|
+
const policy = governance.getPolicy(projectPath);
|
|
104
|
+
const expired = governance.expireStaleProposals(policy.autoCapture.autoExpireDays);
|
|
105
|
+
const proposalStats = governance.getProposalStats(projectPath);
|
|
106
|
+
const quotaStatus = governance.getQuotaStatus(projectPath);
|
|
84
107
|
return {
|
|
85
108
|
project,
|
|
86
109
|
is_new: isNew,
|
|
@@ -88,6 +111,14 @@ export function createCoreOps(runtime) {
|
|
|
88
111
|
? 'Welcome! New project registered.'
|
|
89
112
|
: 'Welcome back! Session #' + project.sessionCount + ' for ' + project.name + '.',
|
|
90
113
|
vault: { entries: stats.totalEntries, domains: Object.keys(stats.byDomain) },
|
|
114
|
+
governance: {
|
|
115
|
+
pendingProposals: proposalStats.pending,
|
|
116
|
+
quotaPercent: quotaStatus.maxTotal > 0
|
|
117
|
+
? Math.round((quotaStatus.total / quotaStatus.maxTotal) * 100)
|
|
118
|
+
: 0,
|
|
119
|
+
isQuotaWarning: quotaStatus.isWarning,
|
|
120
|
+
expiredThisSession: expired,
|
|
121
|
+
},
|
|
91
122
|
};
|
|
92
123
|
},
|
|
93
124
|
},
|
|
@@ -321,6 +352,45 @@ export function createCoreOps(runtime) {
|
|
|
321
352
|
};
|
|
322
353
|
},
|
|
323
354
|
},
|
|
355
|
+
{
|
|
356
|
+
name: 'brain_feedback',
|
|
357
|
+
description: 'Enhanced feedback with typed actions (accepted/dismissed/modified/failed), source tracking, confidence, duration, and reason.',
|
|
358
|
+
auth: 'write',
|
|
359
|
+
schema: z.object({
|
|
360
|
+
query: z.string().describe('The original search query'),
|
|
361
|
+
entryId: z.string().describe('The entry ID'),
|
|
362
|
+
action: z.enum(['accepted', 'dismissed', 'modified', 'failed']),
|
|
363
|
+
source: z
|
|
364
|
+
.enum(['search', 'recommendation', 'tool-execution', 'explicit'])
|
|
365
|
+
.optional()
|
|
366
|
+
.describe("Feedback source. Default 'search'."),
|
|
367
|
+
confidence: z.number().optional().describe('Confidence 0-1. Default 0.6.'),
|
|
368
|
+
duration: z.number().optional().describe('Duration in ms.'),
|
|
369
|
+
context: z.string().optional().describe("JSON context string. Default '{}'."),
|
|
370
|
+
reason: z.string().optional().describe('Human-readable reason.'),
|
|
371
|
+
}),
|
|
372
|
+
handler: async (params) => {
|
|
373
|
+
const entry = brain.recordFeedback({
|
|
374
|
+
query: params.query,
|
|
375
|
+
entryId: params.entryId,
|
|
376
|
+
action: params.action,
|
|
377
|
+
source: params.source,
|
|
378
|
+
confidence: params.confidence,
|
|
379
|
+
duration: params.duration,
|
|
380
|
+
context: params.context,
|
|
381
|
+
reason: params.reason,
|
|
382
|
+
});
|
|
383
|
+
return entry;
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
name: 'brain_feedback_stats',
|
|
388
|
+
description: 'Feedback statistics — counts by action and source, acceptance rate, average confidence.',
|
|
389
|
+
auth: 'read',
|
|
390
|
+
handler: async () => {
|
|
391
|
+
return brain.getFeedbackStats();
|
|
392
|
+
},
|
|
393
|
+
},
|
|
324
394
|
{
|
|
325
395
|
name: 'rebuild_vocabulary',
|
|
326
396
|
description: 'Force rebuild the TF-IDF vocabulary from all vault entries.',
|
|
@@ -403,17 +473,22 @@ export function createCoreOps(runtime) {
|
|
|
403
473
|
},
|
|
404
474
|
{
|
|
405
475
|
name: 'brain_recommend',
|
|
406
|
-
description: 'Get pattern recommendations for a task context. Matches domain
|
|
476
|
+
description: 'Get pattern recommendations for a task context. Matches domain, task terms, and source-specific acceptance rates against known strengths.',
|
|
407
477
|
auth: 'read',
|
|
408
478
|
schema: z.object({
|
|
409
479
|
domain: z.string().optional(),
|
|
410
480
|
task: z.string().optional().describe('Task description for contextual matching.'),
|
|
481
|
+
source: z
|
|
482
|
+
.string()
|
|
483
|
+
.optional()
|
|
484
|
+
.describe('Feedback source to boost by (search, recommendation, tool-execution, explicit).'),
|
|
411
485
|
limit: z.number().optional(),
|
|
412
486
|
}),
|
|
413
487
|
handler: async (params) => {
|
|
414
488
|
return brainIntelligence.recommend({
|
|
415
489
|
domain: params.domain,
|
|
416
490
|
task: params.task,
|
|
491
|
+
source: params.source,
|
|
417
492
|
limit: params.limit ?? 5,
|
|
418
493
|
});
|
|
419
494
|
},
|
|
@@ -469,13 +544,15 @@ export function createCoreOps(runtime) {
|
|
|
469
544
|
},
|
|
470
545
|
{
|
|
471
546
|
name: 'brain_promote_proposals',
|
|
472
|
-
description: 'Promote knowledge proposals to vault entries. Creates intelligence entries from auto-extracted patterns.',
|
|
547
|
+
description: 'Promote knowledge proposals to vault entries. Creates intelligence entries from auto-extracted patterns. Gated by governance policies.',
|
|
473
548
|
auth: 'write',
|
|
474
549
|
schema: z.object({
|
|
475
550
|
proposalIds: z.array(z.string()).describe('IDs of proposals to promote.'),
|
|
551
|
+
projectPath: z.string().optional().default('.'),
|
|
476
552
|
}),
|
|
477
553
|
handler: async (params) => {
|
|
478
|
-
|
|
554
|
+
const pp = params.projectPath ?? '.';
|
|
555
|
+
return brainIntelligence.promoteProposals(params.proposalIds, governance, pp);
|
|
479
556
|
},
|
|
480
557
|
},
|
|
481
558
|
{
|
|
@@ -484,7 +561,10 @@ export function createCoreOps(runtime) {
|
|
|
484
561
|
auth: 'write',
|
|
485
562
|
schema: z.object({
|
|
486
563
|
action: z.enum(['start', 'end']),
|
|
487
|
-
sessionId: z
|
|
564
|
+
sessionId: z
|
|
565
|
+
.string()
|
|
566
|
+
.optional()
|
|
567
|
+
.describe('Required for end. Auto-generated for start if omitted.'),
|
|
488
568
|
domain: z.string().optional(),
|
|
489
569
|
context: z.string().optional(),
|
|
490
570
|
toolsUsed: z.array(z.string()).optional(),
|
|
@@ -505,6 +585,146 @@ export function createCoreOps(runtime) {
|
|
|
505
585
|
});
|
|
506
586
|
},
|
|
507
587
|
},
|
|
588
|
+
{
|
|
589
|
+
name: 'brain_reset_extracted',
|
|
590
|
+
description: 'Reset extraction status on brain sessions, allowing re-extraction. Filter by sessionId, since date, or all.',
|
|
591
|
+
auth: 'write',
|
|
592
|
+
schema: z.object({
|
|
593
|
+
sessionId: z.string().optional().describe('Reset a specific session.'),
|
|
594
|
+
since: z.string().optional().describe('Reset sessions extracted since this ISO date.'),
|
|
595
|
+
all: z.boolean().optional().describe('Reset all extracted sessions.'),
|
|
596
|
+
}),
|
|
597
|
+
handler: async (params) => {
|
|
598
|
+
return brainIntelligence.resetExtracted({
|
|
599
|
+
sessionId: params.sessionId,
|
|
600
|
+
since: params.since,
|
|
601
|
+
all: params.all,
|
|
602
|
+
});
|
|
603
|
+
},
|
|
604
|
+
},
|
|
605
|
+
// ─── Cognee ──────────────────────────────────────────────────
|
|
606
|
+
{
|
|
607
|
+
name: 'cognee_status',
|
|
608
|
+
description: 'Cognee vector search health — availability, URL, latency. Checks the Cognee API endpoint.',
|
|
609
|
+
auth: 'read',
|
|
610
|
+
handler: async () => {
|
|
611
|
+
return cognee.healthCheck();
|
|
612
|
+
},
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: 'cognee_search',
|
|
616
|
+
description: 'Vector similarity search via Cognee. Complements TF-IDF vault search with semantic understanding.',
|
|
617
|
+
auth: 'read',
|
|
618
|
+
schema: z.object({
|
|
619
|
+
query: z.string(),
|
|
620
|
+
searchType: z
|
|
621
|
+
.enum([
|
|
622
|
+
'SUMMARIES',
|
|
623
|
+
'CHUNKS',
|
|
624
|
+
'RAG_COMPLETION',
|
|
625
|
+
'TRIPLET_COMPLETION',
|
|
626
|
+
'GRAPH_COMPLETION',
|
|
627
|
+
'GRAPH_SUMMARY_COMPLETION',
|
|
628
|
+
'NATURAL_LANGUAGE',
|
|
629
|
+
'GRAPH_COMPLETION_COT',
|
|
630
|
+
'FEELING_LUCKY',
|
|
631
|
+
'CHUNKS_LEXICAL',
|
|
632
|
+
])
|
|
633
|
+
.optional()
|
|
634
|
+
.describe('Cognee search type. Default CHUNKS (pure vector similarity).'),
|
|
635
|
+
limit: z.number().optional(),
|
|
636
|
+
}),
|
|
637
|
+
handler: async (params) => {
|
|
638
|
+
return cognee.search(params.query, {
|
|
639
|
+
searchType: params.searchType,
|
|
640
|
+
limit: params.limit ?? 10,
|
|
641
|
+
});
|
|
642
|
+
},
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
name: 'cognee_add',
|
|
646
|
+
description: 'Ingest vault entries into Cognee for vector indexing. Auto-schedules cognify after ingest.',
|
|
647
|
+
auth: 'write',
|
|
648
|
+
schema: z.object({
|
|
649
|
+
entryIds: z.array(z.string()).describe('Vault entry IDs to ingest into Cognee.'),
|
|
650
|
+
}),
|
|
651
|
+
handler: async (params) => {
|
|
652
|
+
const ids = params.entryIds;
|
|
653
|
+
const entries = ids
|
|
654
|
+
.map((id) => vault.get(id))
|
|
655
|
+
.filter((e) => e !== null && e !== undefined);
|
|
656
|
+
if (entries.length === 0)
|
|
657
|
+
return { added: 0, error: 'No matching vault entries found' };
|
|
658
|
+
return cognee.addEntries(entries);
|
|
659
|
+
},
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
name: 'cognee_cognify',
|
|
663
|
+
description: 'Trigger Cognee knowledge graph processing on the vault dataset. Usually auto-scheduled after add.',
|
|
664
|
+
auth: 'write',
|
|
665
|
+
handler: async () => {
|
|
666
|
+
return cognee.cognify();
|
|
667
|
+
},
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
name: 'cognee_config',
|
|
671
|
+
description: 'Get current Cognee client configuration and cached health status.',
|
|
672
|
+
auth: 'read',
|
|
673
|
+
handler: async () => {
|
|
674
|
+
return { config: cognee.getConfig(), cachedStatus: cognee.getStatus() };
|
|
675
|
+
},
|
|
676
|
+
},
|
|
677
|
+
// ─── LLM ─────────────────────────────────────────────────────
|
|
678
|
+
{
|
|
679
|
+
name: 'llm_rotate',
|
|
680
|
+
description: 'Force rotate the active API key for a provider. Useful when rate-limited or key is failing.',
|
|
681
|
+
auth: 'write',
|
|
682
|
+
schema: z.object({
|
|
683
|
+
provider: z.enum(['openai', 'anthropic']),
|
|
684
|
+
}),
|
|
685
|
+
handler: async (params) => {
|
|
686
|
+
const provider = params.provider;
|
|
687
|
+
const pool = keyPool[provider];
|
|
688
|
+
if (!pool.hasKeys)
|
|
689
|
+
return { rotated: false, error: `No ${provider} keys configured` };
|
|
690
|
+
const newKey = pool.rotateOnError();
|
|
691
|
+
return {
|
|
692
|
+
rotated: newKey !== null,
|
|
693
|
+
activeKeyIndex: pool.activeKeyIndex,
|
|
694
|
+
poolSize: pool.poolSize,
|
|
695
|
+
exhausted: pool.exhausted,
|
|
696
|
+
};
|
|
697
|
+
},
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
name: 'llm_call',
|
|
701
|
+
description: 'Make an LLM completion call. Uses model routing config and key pool rotation.',
|
|
702
|
+
auth: 'write',
|
|
703
|
+
schema: z.object({
|
|
704
|
+
systemPrompt: z.string().describe('System prompt for the LLM.'),
|
|
705
|
+
userPrompt: z.string().describe('User prompt / task input.'),
|
|
706
|
+
model: z
|
|
707
|
+
.string()
|
|
708
|
+
.optional()
|
|
709
|
+
.describe('Model name. Routed via model-routing.json if omitted.'),
|
|
710
|
+
temperature: z.number().optional().describe('Sampling temperature (0-2). Default 0.3.'),
|
|
711
|
+
maxTokens: z.number().optional().describe('Max output tokens. Default 500.'),
|
|
712
|
+
caller: z.string().optional().describe('Caller name for routing. Default "core-ops".'),
|
|
713
|
+
task: z.string().optional().describe('Task name for routing.'),
|
|
714
|
+
}),
|
|
715
|
+
handler: async (params) => {
|
|
716
|
+
return llmClient.complete({
|
|
717
|
+
provider: 'openai',
|
|
718
|
+
model: params.model ?? '',
|
|
719
|
+
systemPrompt: params.systemPrompt,
|
|
720
|
+
userPrompt: params.userPrompt,
|
|
721
|
+
temperature: params.temperature,
|
|
722
|
+
maxTokens: params.maxTokens,
|
|
723
|
+
caller: params.caller ?? 'core-ops',
|
|
724
|
+
task: params.task,
|
|
725
|
+
});
|
|
726
|
+
},
|
|
727
|
+
},
|
|
508
728
|
// ─── Curator ─────────────────────────────────────────────────
|
|
509
729
|
{
|
|
510
730
|
name: 'curator_status',
|
|
@@ -608,6 +828,252 @@ export function createCoreOps(runtime) {
|
|
|
608
828
|
return curator.healthAudit();
|
|
609
829
|
},
|
|
610
830
|
},
|
|
831
|
+
// ─── Control ──────────────────────────────────────────────────────
|
|
832
|
+
{
|
|
833
|
+
name: 'get_identity',
|
|
834
|
+
description: 'Get current agent identity with guidelines.',
|
|
835
|
+
auth: 'read',
|
|
836
|
+
schema: z.object({
|
|
837
|
+
agentId: z.string().describe('Agent identifier.'),
|
|
838
|
+
}),
|
|
839
|
+
handler: async (params) => {
|
|
840
|
+
const identity = identityManager.getIdentity(params.agentId);
|
|
841
|
+
if (!identity)
|
|
842
|
+
return { found: false, agentId: params.agentId };
|
|
843
|
+
return identity;
|
|
844
|
+
},
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
name: 'update_identity',
|
|
848
|
+
description: 'Update identity fields. Auto-versions and snapshots previous state.',
|
|
849
|
+
auth: 'write',
|
|
850
|
+
schema: z.object({
|
|
851
|
+
agentId: z.string(),
|
|
852
|
+
name: z.string().optional(),
|
|
853
|
+
role: z.string().optional(),
|
|
854
|
+
description: z.string().optional(),
|
|
855
|
+
personality: z.array(z.string()).optional(),
|
|
856
|
+
changedBy: z.string().optional(),
|
|
857
|
+
changeReason: z.string().optional(),
|
|
858
|
+
}),
|
|
859
|
+
handler: async (params) => {
|
|
860
|
+
const identity = identityManager.setIdentity(params.agentId, {
|
|
861
|
+
name: params.name,
|
|
862
|
+
role: params.role,
|
|
863
|
+
description: params.description,
|
|
864
|
+
personality: params.personality,
|
|
865
|
+
changedBy: params.changedBy,
|
|
866
|
+
changeReason: params.changeReason,
|
|
867
|
+
});
|
|
868
|
+
return { updated: true, identity };
|
|
869
|
+
},
|
|
870
|
+
},
|
|
871
|
+
{
|
|
872
|
+
name: 'add_guideline',
|
|
873
|
+
description: 'Add a behavioral guideline (behavior/preference/restriction/style).',
|
|
874
|
+
auth: 'write',
|
|
875
|
+
schema: z.object({
|
|
876
|
+
agentId: z.string(),
|
|
877
|
+
category: z.enum(['behavior', 'preference', 'restriction', 'style']),
|
|
878
|
+
text: z.string(),
|
|
879
|
+
priority: z.number().optional(),
|
|
880
|
+
}),
|
|
881
|
+
handler: async (params) => {
|
|
882
|
+
const guideline = identityManager.addGuideline(params.agentId, {
|
|
883
|
+
category: params.category,
|
|
884
|
+
text: params.text,
|
|
885
|
+
priority: params.priority,
|
|
886
|
+
});
|
|
887
|
+
return { added: true, guideline };
|
|
888
|
+
},
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
name: 'remove_guideline',
|
|
892
|
+
description: 'Remove a guideline by ID.',
|
|
893
|
+
auth: 'write',
|
|
894
|
+
schema: z.object({
|
|
895
|
+
guidelineId: z.string(),
|
|
896
|
+
}),
|
|
897
|
+
handler: async (params) => {
|
|
898
|
+
const removed = identityManager.removeGuideline(params.guidelineId);
|
|
899
|
+
return { removed };
|
|
900
|
+
},
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
name: 'rollback_identity',
|
|
904
|
+
description: 'Restore a previous identity version. Creates a new version with the old data.',
|
|
905
|
+
auth: 'write',
|
|
906
|
+
schema: z.object({
|
|
907
|
+
agentId: z.string(),
|
|
908
|
+
version: z.number().describe('Version number to roll back to.'),
|
|
909
|
+
}),
|
|
910
|
+
handler: async (params) => {
|
|
911
|
+
const identity = identityManager.rollback(params.agentId, params.version);
|
|
912
|
+
return { rolledBack: true, identity };
|
|
913
|
+
},
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
name: 'route_intent',
|
|
917
|
+
description: 'Classify a prompt into intent + operational mode via keyword matching.',
|
|
918
|
+
auth: 'read',
|
|
919
|
+
schema: z.object({
|
|
920
|
+
prompt: z.string().describe('The user prompt to classify.'),
|
|
921
|
+
}),
|
|
922
|
+
handler: async (params) => {
|
|
923
|
+
return intentRouter.routeIntent(params.prompt);
|
|
924
|
+
},
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
name: 'morph',
|
|
928
|
+
description: 'Switch operational mode manually.',
|
|
929
|
+
auth: 'write',
|
|
930
|
+
schema: z.object({
|
|
931
|
+
mode: z
|
|
932
|
+
.string()
|
|
933
|
+
.describe('The operational mode to switch to (e.g., BUILD-MODE, FIX-MODE).'),
|
|
934
|
+
}),
|
|
935
|
+
handler: async (params) => {
|
|
936
|
+
return intentRouter.morph(params.mode);
|
|
937
|
+
},
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
name: 'get_behavior_rules',
|
|
941
|
+
description: 'Get behavior rules for current or specified mode.',
|
|
942
|
+
auth: 'read',
|
|
943
|
+
schema: z.object({
|
|
944
|
+
mode: z.string().optional().describe('Mode to get rules for. Defaults to current mode.'),
|
|
945
|
+
}),
|
|
946
|
+
handler: async (params) => {
|
|
947
|
+
const mode = params.mode;
|
|
948
|
+
const rules = intentRouter.getBehaviorRules(mode);
|
|
949
|
+
const currentMode = intentRouter.getCurrentMode();
|
|
950
|
+
return { mode: mode ?? currentMode, rules };
|
|
951
|
+
},
|
|
952
|
+
},
|
|
953
|
+
// ─── Governance ─────────────────────────────────────────────────
|
|
954
|
+
{
|
|
955
|
+
name: 'governance_policy',
|
|
956
|
+
description: 'Get, set, or apply a preset to vault governance policies (quota, retention, auto-capture).',
|
|
957
|
+
auth: 'write',
|
|
958
|
+
schema: z.object({
|
|
959
|
+
action: z.enum(['get', 'set', 'applyPreset']),
|
|
960
|
+
projectPath: z.string(),
|
|
961
|
+
policyType: z.enum(['quota', 'retention', 'auto-capture']).optional(),
|
|
962
|
+
config: z.record(z.unknown()).optional(),
|
|
963
|
+
preset: z.enum(['strict', 'moderate', 'permissive']).optional(),
|
|
964
|
+
changedBy: z.string().optional(),
|
|
965
|
+
}),
|
|
966
|
+
handler: async (params) => {
|
|
967
|
+
const action = params.action;
|
|
968
|
+
const projectPath = params.projectPath;
|
|
969
|
+
if (action === 'get') {
|
|
970
|
+
return governance.getPolicy(projectPath);
|
|
971
|
+
}
|
|
972
|
+
if (action === 'set') {
|
|
973
|
+
governance.setPolicy(projectPath, params.policyType, params.config, params.changedBy);
|
|
974
|
+
return { updated: true, policy: governance.getPolicy(projectPath) };
|
|
975
|
+
}
|
|
976
|
+
if (action === 'applyPreset') {
|
|
977
|
+
governance.applyPreset(projectPath, params.preset, params.changedBy);
|
|
978
|
+
return {
|
|
979
|
+
applied: true,
|
|
980
|
+
preset: params.preset,
|
|
981
|
+
policy: governance.getPolicy(projectPath),
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
return { error: 'Unknown action: ' + action };
|
|
985
|
+
},
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
name: 'governance_proposals',
|
|
989
|
+
description: 'Manage knowledge capture proposals — list, approve, reject, modify, get stats, or expire stale.',
|
|
990
|
+
auth: 'write',
|
|
991
|
+
schema: z.object({
|
|
992
|
+
action: z.enum(['list', 'approve', 'reject', 'modify', 'stats', 'expire']),
|
|
993
|
+
projectPath: z.string().optional(),
|
|
994
|
+
proposalId: z.number().optional(),
|
|
995
|
+
decidedBy: z.string().optional(),
|
|
996
|
+
note: z.string().optional(),
|
|
997
|
+
modifications: z.record(z.unknown()).optional(),
|
|
998
|
+
maxAgeDays: z.number().optional(),
|
|
999
|
+
limit: z.number().optional(),
|
|
1000
|
+
}),
|
|
1001
|
+
handler: async (params) => {
|
|
1002
|
+
const action = params.action;
|
|
1003
|
+
if (action === 'list') {
|
|
1004
|
+
return governance.listPendingProposals(params.projectPath, params.limit);
|
|
1005
|
+
}
|
|
1006
|
+
if (action === 'approve') {
|
|
1007
|
+
return governance.approveProposal(params.proposalId, params.decidedBy);
|
|
1008
|
+
}
|
|
1009
|
+
if (action === 'reject') {
|
|
1010
|
+
return governance.rejectProposal(params.proposalId, params.decidedBy, params.note);
|
|
1011
|
+
}
|
|
1012
|
+
if (action === 'modify') {
|
|
1013
|
+
return governance.modifyProposal(params.proposalId, params.modifications, params.decidedBy);
|
|
1014
|
+
}
|
|
1015
|
+
if (action === 'stats') {
|
|
1016
|
+
return governance.getProposalStats(params.projectPath);
|
|
1017
|
+
}
|
|
1018
|
+
if (action === 'expire') {
|
|
1019
|
+
const expired = governance.expireStaleProposals(params.maxAgeDays);
|
|
1020
|
+
return { expired };
|
|
1021
|
+
}
|
|
1022
|
+
return { error: 'Unknown action: ' + action };
|
|
1023
|
+
},
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
name: 'governance_stats',
|
|
1027
|
+
description: 'Get governance statistics — quota status and proposal stats for a project.',
|
|
1028
|
+
auth: 'read',
|
|
1029
|
+
schema: z.object({
|
|
1030
|
+
projectPath: z.string(),
|
|
1031
|
+
}),
|
|
1032
|
+
handler: async (params) => {
|
|
1033
|
+
const projectPath = params.projectPath;
|
|
1034
|
+
return {
|
|
1035
|
+
quotaStatus: governance.getQuotaStatus(projectPath),
|
|
1036
|
+
proposalStats: governance.getProposalStats(projectPath),
|
|
1037
|
+
};
|
|
1038
|
+
},
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
name: 'governance_expire',
|
|
1042
|
+
description: 'Expire stale pending proposals older than a threshold.',
|
|
1043
|
+
auth: 'write',
|
|
1044
|
+
schema: z.object({
|
|
1045
|
+
projectPath: z.string().optional(),
|
|
1046
|
+
maxAgeDays: z.number().optional().describe('Days threshold. Default 14.'),
|
|
1047
|
+
}),
|
|
1048
|
+
handler: async (params) => {
|
|
1049
|
+
const expired = governance.expireStaleProposals(params.maxAgeDays);
|
|
1050
|
+
return { expired };
|
|
1051
|
+
},
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
name: 'governance_dashboard',
|
|
1055
|
+
description: 'Get governance dashboard — vault size, quota usage, pending proposals, acceptance rate, evaluation trend.',
|
|
1056
|
+
auth: 'read',
|
|
1057
|
+
schema: z.object({
|
|
1058
|
+
projectPath: z.string(),
|
|
1059
|
+
}),
|
|
1060
|
+
handler: async (params) => {
|
|
1061
|
+
return governance.getDashboard(params.projectPath);
|
|
1062
|
+
},
|
|
1063
|
+
},
|
|
1064
|
+
// ─── Extra Ops (from dedicated modules) ─────────────────────────
|
|
1065
|
+
...createPlanningExtraOps(runtime),
|
|
1066
|
+
...createMemoryExtraOps(runtime),
|
|
1067
|
+
...createVaultExtraOps(runtime),
|
|
1068
|
+
...createAdminOps(runtime),
|
|
1069
|
+
...createAdminExtraOps(runtime),
|
|
1070
|
+
...createLoopOps(runtime),
|
|
1071
|
+
...createOrchestrateOps(runtime),
|
|
1072
|
+
...createGradingOps(runtime),
|
|
1073
|
+
...createCaptureOps(runtime),
|
|
1074
|
+
...createCuratorExtraOps(runtime),
|
|
1075
|
+
...createProjectOps(runtime),
|
|
1076
|
+
...createMemoryCrossProjectOps(runtime),
|
|
611
1077
|
];
|
|
612
1078
|
}
|
|
613
1079
|
//# sourceMappingURL=core-ops.js.map
|