@soleri/core 2.12.0 → 7.0.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/data/flows/build.flow.yaml +128 -0
- package/data/flows/deliver.flow.yaml +110 -0
- package/data/flows/design.flow.yaml +108 -0
- package/data/flows/enhance.flow.yaml +90 -0
- package/data/flows/explore.flow.yaml +84 -0
- package/data/flows/fix.flow.yaml +90 -0
- package/data/flows/plan.flow.yaml +87 -0
- package/data/flows/review.flow.yaml +90 -0
- package/dist/brain/intelligence.d.ts.map +1 -1
- package/dist/brain/intelligence.js +16 -2
- package/dist/brain/intelligence.js.map +1 -1
- package/dist/capabilities/chain-mapping.d.ts +21 -0
- package/dist/capabilities/chain-mapping.d.ts.map +1 -0
- package/dist/capabilities/chain-mapping.js +86 -0
- package/dist/capabilities/chain-mapping.js.map +1 -0
- package/dist/capabilities/index.d.ts +10 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +8 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/registry.d.ts +95 -0
- package/dist/capabilities/registry.d.ts.map +1 -0
- package/dist/capabilities/registry.js +227 -0
- package/dist/capabilities/registry.js.map +1 -0
- package/dist/capabilities/types.d.ts +106 -0
- package/dist/capabilities/types.d.ts.map +1 -0
- package/dist/capabilities/types.js +12 -0
- package/dist/capabilities/types.js.map +1 -0
- package/dist/control/intent-router.d.ts.map +1 -1
- package/dist/control/intent-router.js +58 -2
- package/dist/control/intent-router.js.map +1 -1
- package/dist/domain-packs/index.d.ts +8 -0
- package/dist/domain-packs/index.d.ts.map +1 -0
- package/dist/domain-packs/index.js +8 -0
- package/dist/domain-packs/index.js.map +1 -0
- package/dist/domain-packs/inject-rules.d.ts +24 -0
- package/dist/domain-packs/inject-rules.d.ts.map +1 -0
- package/dist/domain-packs/inject-rules.js +65 -0
- package/dist/domain-packs/inject-rules.js.map +1 -0
- package/dist/domain-packs/knowledge-installer.d.ts +27 -0
- package/dist/domain-packs/knowledge-installer.d.ts.map +1 -0
- package/dist/domain-packs/knowledge-installer.js +89 -0
- package/dist/domain-packs/knowledge-installer.js.map +1 -0
- package/dist/domain-packs/loader.d.ts +28 -0
- package/dist/domain-packs/loader.d.ts.map +1 -0
- package/dist/domain-packs/loader.js +105 -0
- package/dist/domain-packs/loader.js.map +1 -0
- package/dist/domain-packs/pack-runtime.d.ts +80 -0
- package/dist/domain-packs/pack-runtime.d.ts.map +1 -0
- package/dist/domain-packs/pack-runtime.js +36 -0
- package/dist/domain-packs/pack-runtime.js.map +1 -0
- package/dist/domain-packs/skills-installer.d.ts +21 -0
- package/dist/domain-packs/skills-installer.d.ts.map +1 -0
- package/dist/domain-packs/skills-installer.js +38 -0
- package/dist/domain-packs/skills-installer.js.map +1 -0
- package/dist/domain-packs/token-resolver.d.ts +37 -0
- package/dist/domain-packs/token-resolver.d.ts.map +1 -0
- package/dist/domain-packs/token-resolver.js +109 -0
- package/dist/domain-packs/token-resolver.js.map +1 -0
- package/dist/domain-packs/types.d.ts +91 -0
- package/dist/domain-packs/types.d.ts.map +1 -0
- package/dist/domain-packs/types.js +122 -0
- package/dist/domain-packs/types.js.map +1 -0
- package/dist/engine/bin/soleri-engine.d.ts +12 -0
- package/dist/engine/bin/soleri-engine.d.ts.map +1 -0
- package/dist/engine/bin/soleri-engine.js +183 -0
- package/dist/engine/bin/soleri-engine.js.map +1 -0
- package/dist/engine/core-ops.d.ts +27 -0
- package/dist/engine/core-ops.d.ts.map +1 -0
- package/dist/engine/core-ops.js +159 -0
- package/dist/engine/core-ops.js.map +1 -0
- package/dist/engine/index.d.ts +19 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +17 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/register-engine.d.ts +54 -0
- package/dist/engine/register-engine.d.ts.map +1 -0
- package/dist/engine/register-engine.js +270 -0
- package/dist/engine/register-engine.js.map +1 -0
- package/dist/engine/test-helpers.d.ts +30 -0
- package/dist/engine/test-helpers.d.ts.map +1 -0
- package/dist/engine/test-helpers.js +59 -0
- package/dist/engine/test-helpers.js.map +1 -0
- package/dist/flows/context-router.d.ts +39 -0
- package/dist/flows/context-router.d.ts.map +1 -0
- package/dist/flows/context-router.js +206 -0
- package/dist/flows/context-router.js.map +1 -0
- package/dist/flows/dispatch-registry.d.ts +24 -0
- package/dist/flows/dispatch-registry.d.ts.map +1 -0
- package/dist/flows/dispatch-registry.js +70 -0
- package/dist/flows/dispatch-registry.js.map +1 -0
- package/dist/flows/epilogue.d.ts +24 -0
- package/dist/flows/epilogue.d.ts.map +1 -0
- package/dist/flows/epilogue.js +52 -0
- package/dist/flows/epilogue.js.map +1 -0
- package/dist/flows/executor.d.ts +25 -0
- package/dist/flows/executor.d.ts.map +1 -0
- package/dist/flows/executor.js +153 -0
- package/dist/flows/executor.js.map +1 -0
- package/dist/flows/gate-evaluator.d.ts +26 -0
- package/dist/flows/gate-evaluator.d.ts.map +1 -0
- package/dist/flows/gate-evaluator.js +162 -0
- package/dist/flows/gate-evaluator.js.map +1 -0
- package/dist/flows/index.d.ts +14 -0
- package/dist/flows/index.d.ts.map +1 -0
- package/dist/flows/index.js +20 -0
- package/dist/flows/index.js.map +1 -0
- package/dist/flows/loader.d.ts +17 -0
- package/dist/flows/loader.d.ts.map +1 -0
- package/dist/flows/loader.js +61 -0
- package/dist/flows/loader.js.map +1 -0
- package/dist/flows/plan-builder.d.ts +40 -0
- package/dist/flows/plan-builder.d.ts.map +1 -0
- package/dist/flows/plan-builder.js +213 -0
- package/dist/flows/plan-builder.js.map +1 -0
- package/dist/flows/probes.d.ts +11 -0
- package/dist/flows/probes.d.ts.map +1 -0
- package/dist/flows/probes.js +62 -0
- package/dist/flows/probes.js.map +1 -0
- package/dist/flows/types.d.ts +950 -0
- package/dist/flows/types.d.ts.map +1 -0
- package/dist/flows/types.js +105 -0
- package/dist/flows/types.js.map +1 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/intelligence/loader.d.ts +19 -0
- package/dist/intelligence/loader.d.ts.map +1 -1
- package/dist/intelligence/loader.js +35 -0
- package/dist/intelligence/loader.js.map +1 -1
- package/dist/intelligence/types.d.ts +1 -0
- package/dist/intelligence/types.d.ts.map +1 -1
- package/dist/packs/types.d.ts +58 -19
- package/dist/packs/types.d.ts.map +1 -1
- package/dist/packs/types.js +14 -0
- package/dist/packs/types.js.map +1 -1
- package/dist/playbooks/generic/onboarding.d.ts +9 -0
- package/dist/playbooks/generic/onboarding.d.ts.map +1 -0
- package/dist/playbooks/generic/onboarding.js +74 -0
- package/dist/playbooks/generic/onboarding.js.map +1 -0
- package/dist/playbooks/playbook-registry.d.ts.map +1 -1
- package/dist/playbooks/playbook-registry.js +2 -0
- package/dist/playbooks/playbook-registry.js.map +1 -1
- package/dist/runtime/admin-extra-ops.d.ts.map +1 -1
- package/dist/runtime/admin-extra-ops.js +15 -9
- package/dist/runtime/admin-extra-ops.js.map +1 -1
- package/dist/runtime/admin-ops.js +4 -4
- package/dist/runtime/admin-ops.js.map +1 -1
- package/dist/runtime/capture-ops.d.ts.map +1 -1
- package/dist/runtime/capture-ops.js +33 -1
- package/dist/runtime/capture-ops.js.map +1 -1
- package/dist/runtime/domain-ops.d.ts +21 -5
- package/dist/runtime/domain-ops.d.ts.map +1 -1
- package/dist/runtime/domain-ops.js +64 -6
- package/dist/runtime/domain-ops.js.map +1 -1
- package/dist/runtime/facades/cognee-facade.d.ts.map +1 -1
- package/dist/runtime/facades/cognee-facade.js +3 -1
- package/dist/runtime/facades/cognee-facade.js.map +1 -1
- package/dist/runtime/facades/index.d.ts.map +1 -1
- package/dist/runtime/facades/index.js +10 -6
- package/dist/runtime/facades/index.js.map +1 -1
- package/dist/runtime/facades/vault-facade.d.ts.map +1 -1
- package/dist/runtime/facades/vault-facade.js +2 -0
- package/dist/runtime/facades/vault-facade.js.map +1 -1
- package/dist/runtime/orchestrate-ops.d.ts +8 -7
- package/dist/runtime/orchestrate-ops.d.ts.map +1 -1
- package/dist/runtime/orchestrate-ops.js +217 -61
- package/dist/runtime/orchestrate-ops.js.map +1 -1
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +23 -17
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/types.d.ts +6 -2
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/vault-linking-ops.d.ts +13 -0
- package/dist/runtime/vault-linking-ops.d.ts.map +1 -0
- package/dist/runtime/vault-linking-ops.js +367 -0
- package/dist/runtime/vault-linking-ops.js.map +1 -0
- package/dist/vault/linking.d.ts +46 -0
- package/dist/vault/linking.d.ts.map +1 -0
- package/dist/vault/linking.js +275 -0
- package/dist/vault/linking.js.map +1 -0
- package/dist/vault/vault-types.d.ts +37 -0
- package/dist/vault/vault-types.d.ts.map +1 -1
- package/dist/vault/vault.d.ts +12 -0
- package/dist/vault/vault.d.ts.map +1 -1
- package/dist/vault/vault.js +85 -6
- package/dist/vault/vault.js.map +1 -1
- package/package.json +4 -1
- package/src/__tests__/admin-extra-ops.test.ts +1 -1
- package/src/__tests__/admin-ops.test.ts +2 -1
- package/src/__tests__/cognee-client-gaps.test.ts +470 -0
- package/src/__tests__/cognee-hybrid-search.test.ts +478 -0
- package/src/__tests__/cognee-sync-manager-deep.test.ts +630 -0
- package/src/__tests__/cognee-sync-manager.test.ts +1 -0
- package/src/__tests__/core-ops.test.ts +9 -61
- package/src/__tests__/domain-packs.test.ts +421 -0
- package/src/__tests__/flows.test.ts +604 -0
- package/src/__tests__/playbook-registry.test.ts +2 -2
- package/src/__tests__/playbook-seeder.test.ts +8 -8
- package/src/__tests__/playbook.test.ts +5 -5
- package/src/__tests__/token-resolver.test.ts +79 -0
- package/src/brain/intelligence.ts +21 -2
- package/src/capabilities/chain-mapping.ts +93 -0
- package/src/capabilities/index.ts +21 -0
- package/src/capabilities/registry.ts +290 -0
- package/src/capabilities/types.ts +143 -0
- package/src/control/intent-router.ts +46 -2
- package/src/domain-packs/index.ts +27 -0
- package/src/domain-packs/inject-rules.ts +74 -0
- package/src/domain-packs/knowledge-installer.ts +116 -0
- package/src/domain-packs/loader.ts +124 -0
- package/src/domain-packs/pack-runtime.ts +99 -0
- package/src/domain-packs/skills-installer.ts +56 -0
- package/src/domain-packs/token-resolver.ts +126 -0
- package/src/domain-packs/types.ts +229 -0
- package/src/engine/__tests__/register-engine.test.ts +104 -0
- package/src/engine/bin/soleri-engine.ts +217 -0
- package/src/engine/core-ops.ts +178 -0
- package/src/engine/index.ts +19 -0
- package/src/engine/register-engine.ts +385 -0
- package/src/engine/test-helpers.ts +83 -0
- package/src/flows/context-router.ts +257 -0
- package/src/flows/dispatch-registry.ts +80 -0
- package/src/flows/epilogue.ts +65 -0
- package/src/flows/executor.ts +182 -0
- package/src/flows/gate-evaluator.ts +171 -0
- package/src/flows/index.ts +52 -0
- package/src/flows/loader.ts +63 -0
- package/src/flows/plan-builder.ts +250 -0
- package/src/flows/probes.ts +70 -0
- package/src/flows/types.ts +217 -0
- package/src/index.ts +68 -1
- package/src/intelligence/loader.ts +38 -0
- package/src/intelligence/types.ts +1 -0
- package/src/packs/types.ts +19 -0
- package/src/playbooks/generic/onboarding.ts +79 -0
- package/src/playbooks/playbook-registry.ts +2 -0
- package/src/runtime/admin-extra-ops.ts +14 -8
- package/src/runtime/admin-ops.ts +4 -4
- package/src/runtime/capture-ops.ts +40 -1
- package/src/runtime/domain-ops.ts +71 -5
- package/src/runtime/facades/cognee-facade.ts +3 -1
- package/src/runtime/facades/index.ts +12 -6
- package/src/runtime/facades/vault-facade.ts +2 -0
- package/src/runtime/orchestrate-ops.ts +261 -65
- package/src/runtime/runtime.ts +27 -18
- package/src/runtime/types.ts +6 -2
- package/src/runtime/vault-linking-ops.ts +454 -0
- package/src/vault/linking.ts +333 -0
- package/src/vault/vault-types.ts +46 -0
- package/src/vault/vault.ts +94 -7
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Soleri Knowledge Engine — MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Reads agent.yaml, boots the runtime, registers all tools, connects stdio.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx @soleri/engine --agent ./agent.yaml
|
|
9
|
+
* node dist/engine/bin/soleri-engine.js --agent ./agent.yaml
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
13
|
+
import { resolve, dirname, join } from 'node:path';
|
|
14
|
+
import { homedir } from 'node:os';
|
|
15
|
+
import { parse as parseYaml } from 'yaml';
|
|
16
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
17
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
18
|
+
import { createAgentRuntime } from '../../runtime/runtime.js';
|
|
19
|
+
import { registerEngine } from '../register-engine.js';
|
|
20
|
+
import { createCoreOps } from '../core-ops.js';
|
|
21
|
+
import { seedDefaultPlaybooks } from '../../playbooks/playbook-seeder.js';
|
|
22
|
+
import type { AgentIdentityConfig } from '../core-ops.js';
|
|
23
|
+
|
|
24
|
+
// ─── Parse CLI args ───────────────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
function parseArgs(): { agentYamlPath: string } {
|
|
27
|
+
const args = process.argv.slice(2);
|
|
28
|
+
let agentYamlPath: string | undefined;
|
|
29
|
+
|
|
30
|
+
for (let i = 0; i < args.length; i++) {
|
|
31
|
+
if (args[i] === '--agent' && args[i + 1]) {
|
|
32
|
+
agentYamlPath = resolve(args[i + 1]);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!agentYamlPath) {
|
|
38
|
+
// Default: look for agent.yaml in cwd
|
|
39
|
+
agentYamlPath = resolve('agent.yaml');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!existsSync(agentYamlPath)) {
|
|
43
|
+
console.error(`[soleri-engine] agent.yaml not found: ${agentYamlPath}`);
|
|
44
|
+
console.error('Usage: soleri-engine --agent ./agent.yaml');
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return { agentYamlPath };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ─── Main ─────────────────────────────────────────────────────────────
|
|
52
|
+
|
|
53
|
+
async function main(): Promise<void> {
|
|
54
|
+
const { agentYamlPath } = parseArgs();
|
|
55
|
+
const agentDir = dirname(agentYamlPath);
|
|
56
|
+
|
|
57
|
+
// 1. Read agent.yaml
|
|
58
|
+
const raw = readFileSync(agentYamlPath, 'utf-8');
|
|
59
|
+
const config = parseYaml(raw) as Record<string, unknown>;
|
|
60
|
+
|
|
61
|
+
const agentId = config.id as string;
|
|
62
|
+
const tag = `[${agentId}]`;
|
|
63
|
+
|
|
64
|
+
console.error(`${tag} Starting Soleri Knowledge Engine...`);
|
|
65
|
+
console.error(`${tag} Agent: ${config.name} (${agentId})`);
|
|
66
|
+
console.error(`${tag} Format: file-tree`);
|
|
67
|
+
|
|
68
|
+
// 2. Resolve vault path
|
|
69
|
+
const engineConfig = (config.engine ?? {}) as Record<string, unknown>;
|
|
70
|
+
const vaultPath = engineConfig.vault
|
|
71
|
+
? resolve((engineConfig.vault as string).replace(/^~/, homedir()))
|
|
72
|
+
: join(homedir(), `.${agentId}`, 'vault.db');
|
|
73
|
+
|
|
74
|
+
// 3. Create runtime
|
|
75
|
+
const runtime = createAgentRuntime({
|
|
76
|
+
agentId,
|
|
77
|
+
vaultPath,
|
|
78
|
+
cognee: (engineConfig.cognee as boolean) ?? false,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
console.error(`${tag} Vault: ${vaultPath}`);
|
|
82
|
+
console.error(`${tag} Vault entries: ${runtime.vault.stats().totalEntries}`);
|
|
83
|
+
|
|
84
|
+
// 4. Connect linked vaults
|
|
85
|
+
const vaults = (config.vaults ?? []) as Array<{ name: string; path: string; priority?: number }>;
|
|
86
|
+
for (const vault of vaults) {
|
|
87
|
+
try {
|
|
88
|
+
const vaultAbsPath = resolve(vault.path.replace(/^~/, homedir()));
|
|
89
|
+
runtime.vaultManager.connect(vault.name, vaultAbsPath, vault.priority ?? 0.5);
|
|
90
|
+
console.error(`${tag} Linked vault: ${vault.name} (${vaultAbsPath})`);
|
|
91
|
+
} catch (err) {
|
|
92
|
+
console.error(
|
|
93
|
+
`${tag} Warning: failed to connect vault "${vault.name}": ${err instanceof Error ? err.message : String(err)}`,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 5. Seed intelligence data from knowledge/ directory
|
|
99
|
+
const knowledgeDir = join(agentDir, 'knowledge');
|
|
100
|
+
if (existsSync(knowledgeDir)) {
|
|
101
|
+
const { readdirSync } = await import('node:fs');
|
|
102
|
+
const files = readdirSync(knowledgeDir).filter((f: string) => f.endsWith('.json'));
|
|
103
|
+
for (const file of files) {
|
|
104
|
+
try {
|
|
105
|
+
const bundle = JSON.parse(readFileSync(join(knowledgeDir, file), 'utf-8'));
|
|
106
|
+
if (bundle.entries && Array.isArray(bundle.entries) && bundle.entries.length > 0) {
|
|
107
|
+
const seeded = runtime.vault.seed(bundle.entries);
|
|
108
|
+
console.error(`${tag} Seeded ${seeded} entries from ${file}`);
|
|
109
|
+
}
|
|
110
|
+
} catch {
|
|
111
|
+
// Skip invalid bundles
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 6. Seed default playbooks
|
|
117
|
+
seedDefaultPlaybooks(runtime.vault);
|
|
118
|
+
|
|
119
|
+
// 7. Load domain packs
|
|
120
|
+
const packs = (config.packs ?? []) as Array<{ name: string; package: string; version?: string }>;
|
|
121
|
+
const loadedPacks: Array<{ name: string; facades?: Array<{ name: string; ops: unknown[] }> }> =
|
|
122
|
+
[];
|
|
123
|
+
|
|
124
|
+
if (packs.length > 0) {
|
|
125
|
+
try {
|
|
126
|
+
const { loadDomainPacksFromConfig } = await import('../../domain-packs/loader.js');
|
|
127
|
+
const refs = packs.map((p) => ({ name: p.name, package: p.package, version: p.version }));
|
|
128
|
+
const manifests = await loadDomainPacksFromConfig(refs);
|
|
129
|
+
|
|
130
|
+
// Packs activate sequentially — order may matter for dependencies
|
|
131
|
+
for (const manifest of manifests) {
|
|
132
|
+
if (manifest.onActivate) {
|
|
133
|
+
await manifest.onActivate(runtime); // eslint-disable-line no-await-in-loop
|
|
134
|
+
}
|
|
135
|
+
loadedPacks.push(manifest);
|
|
136
|
+
console.error(`${tag} Domain pack: ${manifest.name}`);
|
|
137
|
+
}
|
|
138
|
+
} catch (err) {
|
|
139
|
+
console.error(
|
|
140
|
+
`${tag} Warning: domain pack loading failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// 8. Build identity config from agent.yaml
|
|
146
|
+
const identity: AgentIdentityConfig = {
|
|
147
|
+
id: agentId,
|
|
148
|
+
name: config.name as string,
|
|
149
|
+
role: config.role as string,
|
|
150
|
+
description: config.description as string,
|
|
151
|
+
domains: (config.domains ?? []) as string[],
|
|
152
|
+
principles: (config.principles ?? []) as string[],
|
|
153
|
+
tone: (config.tone as string) ?? 'pragmatic',
|
|
154
|
+
greeting: config.greeting as string | undefined,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// 9. Create core ops
|
|
158
|
+
const coreOps = createCoreOps(runtime, identity);
|
|
159
|
+
|
|
160
|
+
// 10. Create MCP server
|
|
161
|
+
const server = new McpServer({
|
|
162
|
+
name: `${agentId}-engine`,
|
|
163
|
+
version: '1.0.0',
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// 11. Register persona prompt
|
|
167
|
+
server.prompt('persona', 'Get agent persona and principles', () => ({
|
|
168
|
+
messages: [
|
|
169
|
+
{
|
|
170
|
+
role: 'user' as const,
|
|
171
|
+
content: {
|
|
172
|
+
type: 'text' as const,
|
|
173
|
+
text: `You are ${identity.name}. ${identity.role}.\n\nPrinciples:\n${identity.principles.map((p) => `- ${p}`).join('\n')}\n\nTone: ${identity.tone}`,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
}));
|
|
178
|
+
|
|
179
|
+
// 12. Register all engine tools
|
|
180
|
+
const { tools, totalOps } = registerEngine(server, runtime, {
|
|
181
|
+
agentId,
|
|
182
|
+
coreOps,
|
|
183
|
+
domains: identity.domains,
|
|
184
|
+
domainPacks: loadedPacks as Parameters<typeof registerEngine>[2]['domainPacks'],
|
|
185
|
+
hotOps: [
|
|
186
|
+
'search_intelligent',
|
|
187
|
+
'capture_knowledge',
|
|
188
|
+
'orchestrate_plan',
|
|
189
|
+
'orchestrate_execute',
|
|
190
|
+
'orchestrate_complete',
|
|
191
|
+
],
|
|
192
|
+
authPolicy: () => runtime.authPolicy,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
console.error(`${tag} Registered ${tools.length} tools (${totalOps} ops)`);
|
|
196
|
+
|
|
197
|
+
// 13. Connect stdio transport
|
|
198
|
+
const transport = new StdioServerTransport();
|
|
199
|
+
await server.connect(transport);
|
|
200
|
+
|
|
201
|
+
console.error(`${tag} Engine ready — listening on stdio`);
|
|
202
|
+
|
|
203
|
+
// 14. Graceful shutdown
|
|
204
|
+
const shutdown = () => {
|
|
205
|
+
console.error(`${tag} Shutting down...`);
|
|
206
|
+
runtime.close();
|
|
207
|
+
process.exit(0);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
process.on('SIGTERM', shutdown);
|
|
211
|
+
process.on('SIGINT', shutdown);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
main().catch((err) => {
|
|
215
|
+
console.error('[soleri-engine] Fatal:', err);
|
|
216
|
+
process.exit(1);
|
|
217
|
+
});
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Soleri v7 — Agent Core Ops
|
|
3
|
+
*
|
|
4
|
+
* Generates the agent-specific ops (health, identity, activate, setup)
|
|
5
|
+
* from agent.yaml config, without generated TypeScript.
|
|
6
|
+
*
|
|
7
|
+
* These ops were previously hardcoded in the Forge entry-point template.
|
|
8
|
+
* Now they're created dynamically by the engine at startup.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import type { OpDefinition } from '../facades/types.js';
|
|
13
|
+
import type { AgentRuntime } from '../runtime/types.js';
|
|
14
|
+
|
|
15
|
+
export interface AgentIdentityConfig {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
role: string;
|
|
19
|
+
description: string;
|
|
20
|
+
domains: string[];
|
|
21
|
+
principles: string[];
|
|
22
|
+
tone: string;
|
|
23
|
+
greeting?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Create agent-specific core ops from identity config.
|
|
28
|
+
* These are registered under `{agentId}_core`.
|
|
29
|
+
*/
|
|
30
|
+
export function createCoreOps(
|
|
31
|
+
runtime: AgentRuntime,
|
|
32
|
+
identity: AgentIdentityConfig,
|
|
33
|
+
): OpDefinition[] {
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
name: 'health',
|
|
37
|
+
description: 'Health check — vault status and agent info.',
|
|
38
|
+
auth: 'read',
|
|
39
|
+
handler: async () => {
|
|
40
|
+
const s = runtime.vault.stats();
|
|
41
|
+
return {
|
|
42
|
+
status: 'ok',
|
|
43
|
+
agent: { name: identity.name, role: identity.role, format: 'filetree' },
|
|
44
|
+
vault: { entries: s.totalEntries, domains: Object.keys(s.byDomain) },
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'identity',
|
|
50
|
+
description: 'Get agent identity — name, role, principles.',
|
|
51
|
+
auth: 'read',
|
|
52
|
+
handler: async () => {
|
|
53
|
+
// Check IdentityManager first (may have evolved via updates)
|
|
54
|
+
const managed = runtime.identityManager?.getIdentity(identity.id);
|
|
55
|
+
if (managed) return managed;
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
name: identity.name,
|
|
59
|
+
role: identity.role,
|
|
60
|
+
description: identity.description,
|
|
61
|
+
domains: identity.domains,
|
|
62
|
+
principles: identity.principles,
|
|
63
|
+
tone: identity.tone,
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'activate',
|
|
69
|
+
description: `Activate agent persona. Say "Hello, ${identity.name}!" to trigger.`,
|
|
70
|
+
auth: 'read',
|
|
71
|
+
schema: z.object({
|
|
72
|
+
projectPath: z.string().optional().default('.'),
|
|
73
|
+
deactivate: z.boolean().optional(),
|
|
74
|
+
}),
|
|
75
|
+
handler: async (params) => {
|
|
76
|
+
if (params.deactivate) {
|
|
77
|
+
return { deactivated: true, agent: identity.id };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Seed identity on first activation
|
|
81
|
+
if (runtime.identityManager && !runtime.identityManager.getIdentity(identity.id)) {
|
|
82
|
+
runtime.identityManager.setIdentity(identity.id, {
|
|
83
|
+
name: identity.name,
|
|
84
|
+
role: identity.role,
|
|
85
|
+
description: identity.description,
|
|
86
|
+
personality: identity.principles,
|
|
87
|
+
changedBy: 'system',
|
|
88
|
+
changeReason: 'Initial identity seeded from agent.yaml',
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Register project if project registry available
|
|
93
|
+
const projectPath = (params.projectPath as string) ?? '.';
|
|
94
|
+
if (runtime.projectRegistry) {
|
|
95
|
+
try {
|
|
96
|
+
runtime.projectRegistry.register(projectPath);
|
|
97
|
+
} catch {
|
|
98
|
+
// Project may already be registered
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Build activation context
|
|
103
|
+
const s = runtime.vault.stats();
|
|
104
|
+
return {
|
|
105
|
+
activated: true,
|
|
106
|
+
agent: {
|
|
107
|
+
id: identity.id,
|
|
108
|
+
name: identity.name,
|
|
109
|
+
role: identity.role,
|
|
110
|
+
description: identity.description,
|
|
111
|
+
format: 'filetree',
|
|
112
|
+
},
|
|
113
|
+
persona: {
|
|
114
|
+
tone: identity.tone,
|
|
115
|
+
principles: identity.principles,
|
|
116
|
+
greeting: identity.greeting ?? `Hello! I am ${identity.name}.`,
|
|
117
|
+
},
|
|
118
|
+
vault: {
|
|
119
|
+
connected: true,
|
|
120
|
+
entries: s.totalEntries,
|
|
121
|
+
domains: Object.keys(s.byDomain),
|
|
122
|
+
},
|
|
123
|
+
domains: identity.domains,
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'register',
|
|
129
|
+
description: 'Register a project for context tracking.',
|
|
130
|
+
auth: 'write',
|
|
131
|
+
schema: z.object({
|
|
132
|
+
projectPath: z.string().default('.'),
|
|
133
|
+
}),
|
|
134
|
+
handler: async (params) => {
|
|
135
|
+
const projectPath = (params.projectPath as string) ?? '.';
|
|
136
|
+
if (runtime.projectRegistry) {
|
|
137
|
+
try {
|
|
138
|
+
const project = runtime.projectRegistry.register(projectPath);
|
|
139
|
+
return { registered: true, project };
|
|
140
|
+
} catch {
|
|
141
|
+
return { registered: false, reason: 'Already registered or error' };
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return { registered: false, reason: 'Project registry not available' };
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'setup',
|
|
149
|
+
description: 'Check setup status — vault entries, engine health, domain packs.',
|
|
150
|
+
auth: 'read',
|
|
151
|
+
handler: async () => {
|
|
152
|
+
const s = runtime.vault.stats();
|
|
153
|
+
return {
|
|
154
|
+
agent: {
|
|
155
|
+
id: identity.id,
|
|
156
|
+
name: identity.name,
|
|
157
|
+
format: 'filetree',
|
|
158
|
+
},
|
|
159
|
+
vault: {
|
|
160
|
+
entries: s.totalEntries,
|
|
161
|
+
domains: Object.keys(s.byDomain),
|
|
162
|
+
byType: s.byType,
|
|
163
|
+
},
|
|
164
|
+
engine: {
|
|
165
|
+
cognee: runtime.cognee !== null && runtime.cognee !== undefined,
|
|
166
|
+
brain: true,
|
|
167
|
+
curator: true,
|
|
168
|
+
planner: true,
|
|
169
|
+
},
|
|
170
|
+
recommendations:
|
|
171
|
+
s.totalEntries === 0
|
|
172
|
+
? ['Vault is empty — capture knowledge to start building intelligence']
|
|
173
|
+
: [],
|
|
174
|
+
};
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Soleri Knowledge Engine — MCP Server Entry Point
|
|
3
|
+
*
|
|
4
|
+
* This is the standalone knowledge engine that file-tree agents connect to.
|
|
5
|
+
* It reads agent.yaml, initializes the runtime, and registers all tools.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx @soleri/engine --agent ./agent.yaml
|
|
9
|
+
*
|
|
10
|
+
* Or in .mcp.json:
|
|
11
|
+
* { "command": "npx", "args": ["@soleri/engine", "--agent", "./agent.yaml"] }
|
|
12
|
+
*
|
|
13
|
+
* Binary entry point: ./bin/soleri-engine.ts
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export { registerEngine } from './register-engine.js';
|
|
17
|
+
export type { EngineRegistrationOptions, EngineRegistrationResult } from './register-engine.js';
|
|
18
|
+
export { createCoreOps } from './core-ops.js';
|
|
19
|
+
export type { AgentIdentityConfig } from './core-ops.js';
|