cognitive-core 0.0.2 → 0.1.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/README.md +302 -116
- package/SKILL.md +193 -0
- package/dist/agents/index.d.ts +3 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +5 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/mock-provider.d.ts +23 -0
- package/dist/agents/mock-provider.d.ts.map +1 -0
- package/dist/agents/mock-provider.js +71 -0
- package/dist/agents/mock-provider.js.map +1 -0
- package/dist/agents/types.d.ts +98 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +44 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/atlas.d.ts +196 -0
- package/dist/atlas.d.ts.map +1 -0
- package/dist/atlas.js +373 -0
- package/dist/atlas.js.map +1 -0
- package/dist/bin/cognitive-core.d.ts +18 -0
- package/dist/bin/cognitive-core.d.ts.map +1 -0
- package/dist/bin/cognitive-core.js +419 -0
- package/dist/bin/cognitive-core.js.map +1 -0
- package/dist/embeddings/bm25.d.ts +104 -0
- package/dist/embeddings/bm25.d.ts.map +1 -0
- package/dist/embeddings/bm25.js +264 -0
- package/dist/embeddings/bm25.js.map +1 -0
- package/dist/embeddings/index.d.ts +12 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +16 -0
- package/dist/embeddings/index.js.map +1 -0
- package/dist/embeddings/manager.d.ts +112 -0
- package/dist/embeddings/manager.d.ts.map +1 -0
- package/dist/embeddings/manager.js +215 -0
- package/dist/embeddings/manager.js.map +1 -0
- package/dist/embeddings/provider.d.ts +101 -0
- package/dist/embeddings/provider.d.ts.map +1 -0
- package/dist/embeddings/provider.js +232 -0
- package/dist/embeddings/provider.js.map +1 -0
- package/dist/embeddings/vector-store.d.ts +101 -0
- package/dist/embeddings/vector-store.d.ts.map +1 -0
- package/dist/embeddings/vector-store.js +256 -0
- package/dist/embeddings/vector-store.js.map +1 -0
- package/dist/factory.d.ts +193 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +109 -0
- package/dist/factory.js.map +1 -0
- package/dist/index.d.ts +30 -453
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -509
- package/dist/index.js.map +1 -0
- package/dist/learning/analyzer.d.ts +110 -0
- package/dist/learning/analyzer.d.ts.map +1 -0
- package/dist/learning/analyzer.js +213 -0
- package/dist/learning/analyzer.js.map +1 -0
- package/dist/learning/effectiveness.d.ts +158 -0
- package/dist/learning/effectiveness.d.ts.map +1 -0
- package/dist/learning/effectiveness.js +251 -0
- package/dist/learning/effectiveness.js.map +1 -0
- package/dist/learning/index.d.ts +8 -0
- package/dist/learning/index.d.ts.map +1 -0
- package/dist/learning/index.js +11 -0
- package/dist/learning/index.js.map +1 -0
- package/dist/learning/llm-extractor.d.ts +88 -0
- package/dist/learning/llm-extractor.d.ts.map +1 -0
- package/dist/learning/llm-extractor.js +372 -0
- package/dist/learning/llm-extractor.js.map +1 -0
- package/dist/learning/meta-learner.d.ts +80 -0
- package/dist/learning/meta-learner.d.ts.map +1 -0
- package/dist/learning/meta-learner.js +355 -0
- package/dist/learning/meta-learner.js.map +1 -0
- package/dist/learning/pipeline.d.ts +65 -0
- package/dist/learning/pipeline.d.ts.map +1 -0
- package/dist/learning/pipeline.js +170 -0
- package/dist/learning/pipeline.js.map +1 -0
- package/dist/learning/playbook-extractor.d.ts +113 -0
- package/dist/learning/playbook-extractor.d.ts.map +1 -0
- package/dist/learning/playbook-extractor.js +523 -0
- package/dist/learning/playbook-extractor.js.map +1 -0
- package/dist/learning/usage-inference.d.ts +82 -0
- package/dist/learning/usage-inference.d.ts.map +1 -0
- package/dist/learning/usage-inference.js +261 -0
- package/dist/learning/usage-inference.js.map +1 -0
- package/dist/mcp/index.d.ts +6 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +6 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/playbook-server.d.ts +120 -0
- package/dist/mcp/playbook-server.d.ts.map +1 -0
- package/dist/mcp/playbook-server.js +427 -0
- package/dist/mcp/playbook-server.js.map +1 -0
- package/dist/memory/curated-loader.d.ts +62 -0
- package/dist/memory/curated-loader.d.ts.map +1 -0
- package/dist/memory/curated-loader.js +106 -0
- package/dist/memory/curated-loader.js.map +1 -0
- package/dist/memory/experience.d.ts +122 -0
- package/dist/memory/experience.d.ts.map +1 -0
- package/dist/memory/experience.js +392 -0
- package/dist/memory/experience.js.map +1 -0
- package/dist/memory/index.d.ts +6 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +9 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/meta.d.ts +90 -0
- package/dist/memory/meta.d.ts.map +1 -0
- package/dist/memory/meta.js +362 -0
- package/dist/memory/meta.js.map +1 -0
- package/dist/memory/playbook.d.ts +133 -0
- package/dist/memory/playbook.d.ts.map +1 -0
- package/dist/memory/playbook.js +357 -0
- package/dist/memory/playbook.js.map +1 -0
- package/dist/memory/system.d.ts +167 -0
- package/dist/memory/system.d.ts.map +1 -0
- package/dist/memory/system.js +383 -0
- package/dist/memory/system.js.map +1 -0
- package/dist/runtime/backends/acp.d.ts +67 -0
- package/dist/runtime/backends/acp.d.ts.map +1 -0
- package/dist/runtime/backends/acp.js +290 -0
- package/dist/runtime/backends/acp.js.map +1 -0
- package/dist/runtime/backends/index.d.ts +5 -0
- package/dist/runtime/backends/index.d.ts.map +1 -0
- package/dist/runtime/backends/index.js +6 -0
- package/dist/runtime/backends/index.js.map +1 -0
- package/dist/runtime/backends/mock.d.ts +67 -0
- package/dist/runtime/backends/mock.d.ts.map +1 -0
- package/dist/runtime/backends/mock.js +153 -0
- package/dist/runtime/backends/mock.js.map +1 -0
- package/dist/runtime/backends/subprocess.d.ts +56 -0
- package/dist/runtime/backends/subprocess.d.ts.map +1 -0
- package/dist/runtime/backends/subprocess.js +260 -0
- package/dist/runtime/backends/subprocess.js.map +1 -0
- package/dist/runtime/flows/learning.d.ts +73 -0
- package/dist/runtime/flows/learning.d.ts.map +1 -0
- package/dist/runtime/flows/learning.js +116 -0
- package/dist/runtime/flows/learning.js.map +1 -0
- package/dist/runtime/flows/validation.d.ts +122 -0
- package/dist/runtime/flows/validation.d.ts.map +1 -0
- package/dist/runtime/flows/validation.js +223 -0
- package/dist/runtime/flows/validation.js.map +1 -0
- package/dist/runtime/index.d.ts +6 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +8 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/manager.d.ts +116 -0
- package/dist/runtime/manager.d.ts.map +1 -0
- package/dist/runtime/manager.js +416 -0
- package/dist/runtime/manager.js.map +1 -0
- package/dist/runtime/types.d.ts +138 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +2 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/search/evaluator.d.ts +102 -0
- package/dist/search/evaluator.d.ts.map +1 -0
- package/dist/search/evaluator.js +352 -0
- package/dist/search/evaluator.js.map +1 -0
- package/dist/search/index.d.ts +7 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +11 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/refinement-loop.d.ts +73 -0
- package/dist/search/refinement-loop.d.ts.map +1 -0
- package/dist/search/refinement-loop.js +245 -0
- package/dist/search/refinement-loop.js.map +1 -0
- package/dist/search/refinement-types.d.ts +154 -0
- package/dist/search/refinement-types.d.ts.map +1 -0
- package/dist/search/refinement-types.js +99 -0
- package/dist/search/refinement-types.js.map +1 -0
- package/dist/search/router.d.ts +61 -0
- package/dist/search/router.d.ts.map +1 -0
- package/dist/search/router.js +197 -0
- package/dist/search/router.js.map +1 -0
- package/dist/search/solver.d.ts +75 -0
- package/dist/search/solver.d.ts.map +1 -0
- package/dist/search/solver.js +216 -0
- package/dist/search/solver.js.map +1 -0
- package/dist/search/verification-runner.d.ts +125 -0
- package/dist/search/verification-runner.d.ts.map +1 -0
- package/dist/search/verification-runner.js +440 -0
- package/dist/search/verification-runner.js.map +1 -0
- package/dist/surfacing/index.d.ts +2 -0
- package/dist/surfacing/index.d.ts.map +1 -0
- package/dist/surfacing/index.js +2 -0
- package/dist/surfacing/index.js.map +1 -0
- package/dist/surfacing/skill-library.d.ts +158 -0
- package/dist/surfacing/skill-library.d.ts.map +1 -0
- package/dist/surfacing/skill-library.js +429 -0
- package/dist/surfacing/skill-library.js.map +1 -0
- package/dist/types/config.d.ts +1113 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +274 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +14 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/memory.d.ts +339 -0
- package/dist/types/memory.d.ts.map +1 -0
- package/dist/types/memory.js +207 -0
- package/dist/types/memory.js.map +1 -0
- package/dist/types/meta.d.ts +146 -0
- package/dist/types/meta.d.ts.map +1 -0
- package/dist/types/meta.js +51 -0
- package/dist/types/meta.js.map +1 -0
- package/dist/types/outcome.d.ts +42 -0
- package/dist/types/outcome.d.ts.map +1 -0
- package/dist/types/outcome.js +50 -0
- package/dist/types/outcome.js.map +1 -0
- package/dist/types/playbook.d.ts +119 -0
- package/dist/types/playbook.d.ts.map +1 -0
- package/dist/types/playbook.js +71 -0
- package/dist/types/playbook.js.map +1 -0
- package/dist/types/step.d.ts +44 -0
- package/dist/types/step.d.ts.map +1 -0
- package/dist/types/step.js +32 -0
- package/dist/types/step.js.map +1 -0
- package/dist/types/task.d.ts +91 -0
- package/dist/types/task.d.ts.map +1 -0
- package/dist/types/task.js +39 -0
- package/dist/types/task.js.map +1 -0
- package/dist/types/trajectory.d.ts +221 -0
- package/dist/types/trajectory.d.ts.map +1 -0
- package/dist/types/trajectory.js +60 -0
- package/dist/types/trajectory.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/similarity.d.ts +31 -0
- package/dist/utils/similarity.d.ts.map +1 -0
- package/dist/utils/similarity.js +107 -0
- package/dist/utils/similarity.js.map +1 -0
- package/dist/utils/storage.d.ts +106 -0
- package/dist/utils/storage.d.ts.map +1 -0
- package/dist/utils/storage.js +203 -0
- package/dist/utils/storage.js.map +1 -0
- package/dist/utils/validation.d.ts +129 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +171 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +50 -34
- package/scripts/migrate-to-playbooks.ts +307 -0
- package/src/agents/index.ts +14 -0
- package/src/agents/mock-provider.ts +93 -0
- package/src/agents/types.ts +137 -0
- package/src/atlas.ts +560 -0
- package/src/bin/cognitive-core.ts +470 -0
- package/src/embeddings/bm25.ts +337 -0
- package/src/embeddings/index.ts +39 -0
- package/src/embeddings/manager.ts +288 -0
- package/src/embeddings/provider.ts +311 -0
- package/src/embeddings/vector-store.ts +353 -0
- package/src/factory.ts +263 -0
- package/src/index.ts +246 -0
- package/src/learning/analyzer.ts +335 -0
- package/src/learning/effectiveness.ts +428 -0
- package/src/learning/index.ts +58 -0
- package/src/learning/llm-extractor.ts +542 -0
- package/src/learning/meta-learner.ts +516 -0
- package/src/learning/pipeline.ts +244 -0
- package/src/learning/playbook-extractor.ts +702 -0
- package/src/learning/usage-inference.ts +372 -0
- package/src/mcp/index.ts +12 -0
- package/src/mcp/playbook-server.ts +565 -0
- package/src/memory/curated-loader.ts +160 -0
- package/src/memory/experience.ts +515 -0
- package/src/memory/index.ts +27 -0
- package/src/memory/meta.ts +506 -0
- package/src/memory/playbook.ts +493 -0
- package/src/memory/system.ts +551 -0
- package/src/runtime/backends/acp.ts +378 -0
- package/src/runtime/backends/index.ts +24 -0
- package/src/runtime/backends/mock.ts +218 -0
- package/src/runtime/backends/subprocess.ts +356 -0
- package/src/runtime/flows/learning.ts +183 -0
- package/src/runtime/flows/validation.ts +381 -0
- package/src/runtime/index.ts +53 -0
- package/src/runtime/manager.ts +541 -0
- package/src/runtime/types.ts +157 -0
- package/src/search/evaluator.ts +474 -0
- package/src/search/index.ts +59 -0
- package/src/search/refinement-loop.ts +363 -0
- package/src/search/refinement-types.ts +159 -0
- package/src/search/router.ts +261 -0
- package/src/search/solver.ts +303 -0
- package/src/search/verification-runner.ts +570 -0
- package/src/surfacing/index.ts +6 -0
- package/src/surfacing/skill-library.ts +594 -0
- package/src/types/config.ts +333 -0
- package/src/types/index.ts +130 -0
- package/src/types/memory.ts +270 -0
- package/src/types/meta.ts +218 -0
- package/src/types/outcome.ts +66 -0
- package/src/types/playbook.ts +196 -0
- package/src/types/step.ts +40 -0
- package/src/types/task.ts +52 -0
- package/src/types/trajectory.ts +80 -0
- package/src/utils/index.ts +38 -0
- package/src/utils/similarity.ts +139 -0
- package/src/utils/storage.ts +249 -0
- package/src/utils/validation.ts +286 -0
- package/tests/embeddings/bm25.test.ts +130 -0
- package/tests/embeddings/manager.test.ts +205 -0
- package/tests/integration/atlas.test.ts +266 -0
- package/tests/integration/e2e.test.ts +929 -0
- package/tests/learning/analyzer.test.ts +426 -0
- package/tests/learning/effectiveness.test.ts +542 -0
- package/tests/learning/pipeline.test.ts +176 -0
- package/tests/learning/playbook-extractor-provenance.test.ts +114 -0
- package/tests/learning/usage-inference.test.ts +254 -0
- package/tests/mcp/playbook-server.test.ts +252 -0
- package/tests/memory/experience.test.ts +198 -0
- package/tests/memory/playbook.test.ts +338 -0
- package/tests/memory/provenance.test.ts +639 -0
- package/tests/memory/system.test.ts +325 -0
- package/tests/runtime/agent-manager.test.ts +512 -0
- package/tests/runtime/mock-backend.test.ts +248 -0
- package/tests/search/refinement-loop.test.ts +468 -0
- package/tests/search/refinement.test.ts +267 -0
- package/tests/search/router.test.ts +427 -0
- package/tests/surfacing/skill-library.test.ts +292 -0
- package/tests/types/outcome.test.ts +147 -0
- package/tests/types/step.test.ts +133 -0
- package/tests/types/task.test.ts +158 -0
- package/tests/types/trajectory.test.ts +253 -0
- package/tests/utils/similarity.test.ts +188 -0
- package/tests/utils/validation.test.ts +252 -0
- package/tsconfig.json +25 -0
- package/vitest.config.ts +22 -0
- package/dist/index.d.mts +0 -466
- package/dist/index.mjs +0 -478
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Credit assignment strategy for trajectory analysis
|
|
5
|
+
*/
|
|
6
|
+
export const CreditStrategySchema = z.enum(['simple', 'llm', 'counterfactual']);
|
|
7
|
+
export type CreditStrategy = z.infer<typeof CreditStrategySchema>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Pattern extraction approach
|
|
11
|
+
*/
|
|
12
|
+
export const PatternExtractorSchema = z.enum(['llm', 'text', 'both']);
|
|
13
|
+
export type PatternExtractor = z.infer<typeof PatternExtractorSchema>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Learning pipeline configuration
|
|
17
|
+
*/
|
|
18
|
+
export const LearningConfigSchema = z.object({
|
|
19
|
+
/** How to assign credit to steps */
|
|
20
|
+
creditStrategy: CreditStrategySchema.default('simple'),
|
|
21
|
+
/** How to extract patterns */
|
|
22
|
+
patternExtractor: PatternExtractorSchema.default('llm'),
|
|
23
|
+
/** Minimum trajectories before batch learning */
|
|
24
|
+
minTrajectories: z.number().default(10),
|
|
25
|
+
/** Minimum hours since last batch learning */
|
|
26
|
+
minHoursSinceLast: z.number().optional(),
|
|
27
|
+
/** Minimum success rate for extraction */
|
|
28
|
+
minSuccessRate: z.number().min(0).max(1).optional(),
|
|
29
|
+
/** Similarity threshold for deduplication */
|
|
30
|
+
deduplicationThreshold: z.number().min(0).max(1).default(0.9),
|
|
31
|
+
/** Maximum experiences to keep during pruning (default: 1000) */
|
|
32
|
+
maxExperiences: z.number().default(1000),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export type LearningConfig = z.infer<typeof LearningConfigSchema>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Task routing configuration
|
|
39
|
+
*/
|
|
40
|
+
export const RouterConfigSchema = z.object({
|
|
41
|
+
/** Threshold for considering tasks similar */
|
|
42
|
+
similarityThreshold: z.number().min(0).max(1).default(0.85),
|
|
43
|
+
/** Enable domain-based routing */
|
|
44
|
+
useDomainRouting: z.boolean().default(true),
|
|
45
|
+
/** Default search strategy */
|
|
46
|
+
defaultStrategy: z.string().default('direct'),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export type RouterConfig = z.infer<typeof RouterConfigSchema>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Memory capacity limits for automatic pruning
|
|
53
|
+
*/
|
|
54
|
+
export const MemoryCapacityConfigSchema = z.object({
|
|
55
|
+
/** Maximum number of experiences to store (0 = unlimited) */
|
|
56
|
+
maxExperiences: z.number().default(0),
|
|
57
|
+
/** Maximum number of playbooks to store (0 = unlimited) */
|
|
58
|
+
maxPlaybooks: z.number().default(0),
|
|
59
|
+
/** Maximum age of experiences in days (0 = unlimited) */
|
|
60
|
+
maxExperienceAgeDays: z.number().default(0),
|
|
61
|
+
/** Maximum age of failed experiences in days (shorter than successful) */
|
|
62
|
+
maxFailedExperienceAgeDays: z.number().default(30),
|
|
63
|
+
/** Enable automatic pruning when limits are exceeded */
|
|
64
|
+
autoPrune: z.boolean().default(true),
|
|
65
|
+
/** Preserve domain coverage when pruning */
|
|
66
|
+
preserveDomainCoverage: z.boolean().default(true),
|
|
67
|
+
/** Similarity threshold for deduplication (0 = disabled) */
|
|
68
|
+
deduplicationThreshold: z.number().min(0).max(1).default(0),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export type MemoryCapacityConfig = z.infer<typeof MemoryCapacityConfigSchema>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Memory retrieval configuration
|
|
75
|
+
*/
|
|
76
|
+
export const MemoryConfigSchema = z.object({
|
|
77
|
+
/** Maximum experiences to retrieve */
|
|
78
|
+
maxExperiences: z.number().default(4), // ReMem paper default
|
|
79
|
+
/** Maximum strategies to retrieve */
|
|
80
|
+
maxStrategies: z.number().default(3),
|
|
81
|
+
/** Maximum concepts to retrieve */
|
|
82
|
+
maxConcepts: z.number().default(5),
|
|
83
|
+
/** Maximum skills to retrieve */
|
|
84
|
+
maxSkills: z.number().default(3),
|
|
85
|
+
/** Maximum tokens for memory context */
|
|
86
|
+
maxContextTokens: z.number().default(4000),
|
|
87
|
+
/** Capacity limits for storage */
|
|
88
|
+
capacity: MemoryCapacityConfigSchema.default({}),
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export type MemoryConfig = z.infer<typeof MemoryConfigSchema>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Storage configuration
|
|
95
|
+
*/
|
|
96
|
+
export const StorageConfigSchema = z.object({
|
|
97
|
+
/** Base directory for file storage */
|
|
98
|
+
baseDir: z.string().default('.atlas'),
|
|
99
|
+
/** Enable file-based persistence */
|
|
100
|
+
persistenceEnabled: z.boolean().default(true),
|
|
101
|
+
/** Auto-save interval in milliseconds */
|
|
102
|
+
autoSaveInterval: z.number().default(60000), // 1 minute
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export type StorageConfig = z.infer<typeof StorageConfigSchema>;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Embedding provider type
|
|
109
|
+
*/
|
|
110
|
+
export const EmbeddingProviderTypeSchema = z.enum([
|
|
111
|
+
'openai',
|
|
112
|
+
'voyage',
|
|
113
|
+
'local',
|
|
114
|
+
'none',
|
|
115
|
+
]);
|
|
116
|
+
export type EmbeddingProviderType = z.infer<typeof EmbeddingProviderTypeSchema>;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Embedding configuration
|
|
120
|
+
*/
|
|
121
|
+
export const EmbeddingConfigSchema = z.object({
|
|
122
|
+
/** Embedding provider type */
|
|
123
|
+
provider: EmbeddingProviderTypeSchema.default('none'),
|
|
124
|
+
/** API key for hosted providers (OpenAI, Voyage) */
|
|
125
|
+
apiKey: z.string().optional(),
|
|
126
|
+
/** Model name/identifier */
|
|
127
|
+
model: z.string().optional(),
|
|
128
|
+
/** Path to local model (for 'local' provider) */
|
|
129
|
+
modelPath: z.string().optional(),
|
|
130
|
+
/** Embedding dimension (defaults vary by provider) */
|
|
131
|
+
dimension: z.number().optional(),
|
|
132
|
+
/** Path for sqlite-vec database file */
|
|
133
|
+
vectorDbPath: z.string().default('.atlas/vectors.db'),
|
|
134
|
+
/** Base URL for API (for custom endpoints) */
|
|
135
|
+
baseUrl: z.string().optional(),
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
export type EmbeddingConfig = z.infer<typeof EmbeddingConfigSchema>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Execution backend type
|
|
142
|
+
*/
|
|
143
|
+
export const ExecutionBackendSchema = z.enum(['acp', 'subprocess', 'mock']);
|
|
144
|
+
export type ExecutionBackend = z.infer<typeof ExecutionBackendSchema>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Execution configuration
|
|
148
|
+
*/
|
|
149
|
+
export const ExecutionConfigSchema = z.object({
|
|
150
|
+
/** Backend to use for agent execution */
|
|
151
|
+
backend: ExecutionBackendSchema.default('acp'),
|
|
152
|
+
/** Maximum execution time in seconds */
|
|
153
|
+
maxExecutionTime: z.number().default(300),
|
|
154
|
+
/** Capture tool calls for trajectory extraction */
|
|
155
|
+
captureToolCalls: z.boolean().default(true),
|
|
156
|
+
/** Default agent type */
|
|
157
|
+
defaultAgentType: z.string().default('claude-code'),
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
export type ExecutionConfig = z.infer<typeof ExecutionConfigSchema>;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Refinement configuration
|
|
164
|
+
*/
|
|
165
|
+
export const RefinementConfigSchema = z.object({
|
|
166
|
+
/** Maximum refinement iterations */
|
|
167
|
+
maxIterations: z.number().min(1).max(10).default(3),
|
|
168
|
+
/** Minimum quality score to accept without refinement */
|
|
169
|
+
acceptableScore: z.number().min(0).max(1).default(0.7),
|
|
170
|
+
/** Whether to use ACP agent for evaluation */
|
|
171
|
+
useAgentEvaluation: z.boolean().default(true),
|
|
172
|
+
/** Agent type to use for evaluation */
|
|
173
|
+
evaluatorAgentType: z.string().default('evaluator'),
|
|
174
|
+
/** Confidence threshold below which to trigger refinement */
|
|
175
|
+
confidenceThreshold: z.number().min(0).max(1).default(0.6),
|
|
176
|
+
/** Routing strategies that should trigger refinement */
|
|
177
|
+
triggerOnStrategies: z
|
|
178
|
+
.array(z.enum(['explore', 'fallback', 'direct', 'adapt']))
|
|
179
|
+
.default(['explore', 'fallback']),
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
export type RefinementConfig = z.infer<typeof RefinementConfigSchema>;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Skill Library promotion criteria
|
|
186
|
+
*/
|
|
187
|
+
export const SkillPromotionConfigSchema = z.object({
|
|
188
|
+
/** Minimum confidence to promote to core skill */
|
|
189
|
+
minConfidence: z.number().min(0).max(1).default(0.85),
|
|
190
|
+
/** Minimum success count to promote */
|
|
191
|
+
minSuccessCount: z.number().default(5),
|
|
192
|
+
/** Minimum success rate to promote */
|
|
193
|
+
minSuccessRate: z.number().min(0).max(1).default(0.8),
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
export type SkillPromotionConfig = z.infer<typeof SkillPromotionConfigSchema>;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Skill Library capacity limits
|
|
200
|
+
*/
|
|
201
|
+
export const SkillLimitsConfigSchema = z.object({
|
|
202
|
+
/** Maximum core skills (always in system prompt) */
|
|
203
|
+
maxCoreSkills: z.number().default(10),
|
|
204
|
+
/** Maximum domain skills per domain */
|
|
205
|
+
maxDomainSkills: z.number().default(5),
|
|
206
|
+
/** Maximum contextual playbooks per task */
|
|
207
|
+
maxContextualPlaybooks: z.number().default(3),
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
export type SkillLimitsConfig = z.infer<typeof SkillLimitsConfigSchema>;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Skill Library context budget
|
|
214
|
+
*/
|
|
215
|
+
export const SkillContextConfigSchema = z.object({
|
|
216
|
+
/** Maximum tokens for skills in system prompt */
|
|
217
|
+
maxTokensForSkills: z.number().default(2000),
|
|
218
|
+
/** Include refinements in skill context */
|
|
219
|
+
includeRefinements: z.boolean().default(true),
|
|
220
|
+
/** Include code examples in skill context */
|
|
221
|
+
includeExamples: z.boolean().default(false),
|
|
222
|
+
/** Cache refresh interval in milliseconds (default: 5 minutes) */
|
|
223
|
+
cacheRefreshInterval: z.number().default(5 * 60 * 1000),
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
export type SkillContextConfig = z.infer<typeof SkillContextConfigSchema>;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Skill Library demotion criteria
|
|
230
|
+
*/
|
|
231
|
+
export const SkillDemotionConfigSchema = z.object({
|
|
232
|
+
/** Number of consecutive failures before demotion */
|
|
233
|
+
failureThreshold: z.number().default(3),
|
|
234
|
+
/** Minimum confidence to retain core skill status */
|
|
235
|
+
minConfidenceToRetain: z.number().min(0).max(1).default(0.6),
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
export type SkillDemotionConfig = z.infer<typeof SkillDemotionConfigSchema>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Skill Library configuration - all thresholds configurable
|
|
242
|
+
*/
|
|
243
|
+
export const SkillLibraryConfigSchema = z.object({
|
|
244
|
+
/** Promotion criteria */
|
|
245
|
+
promotion: SkillPromotionConfigSchema.default({}),
|
|
246
|
+
/** Capacity limits */
|
|
247
|
+
limits: SkillLimitsConfigSchema.default({}),
|
|
248
|
+
/** Context budget */
|
|
249
|
+
context: SkillContextConfigSchema.default({}),
|
|
250
|
+
/** Demotion criteria */
|
|
251
|
+
demotion: SkillDemotionConfigSchema.default({}),
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
export type SkillLibraryConfig = z.infer<typeof SkillLibraryConfigSchema>;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* MCP Server configuration
|
|
258
|
+
*/
|
|
259
|
+
export const MCPServerConfigSchema = z.object({
|
|
260
|
+
/** Enable MCP server */
|
|
261
|
+
enabled: z.boolean().default(false),
|
|
262
|
+
/** Port for standalone server */
|
|
263
|
+
port: z.number().optional(),
|
|
264
|
+
/** Expose playbooks as MCP resources */
|
|
265
|
+
exposeResources: z.boolean().default(true),
|
|
266
|
+
/** Expose playbook tools */
|
|
267
|
+
exposeTools: z.boolean().default(true),
|
|
268
|
+
/** Maximum results to return from searches */
|
|
269
|
+
maxResults: z.number().default(5),
|
|
270
|
+
/** Minimum confidence threshold for search results */
|
|
271
|
+
minConfidence: z.number().min(0).max(1).default(0.3),
|
|
272
|
+
/** Include refinements in playbook details */
|
|
273
|
+
includeRefinements: z.boolean().default(true),
|
|
274
|
+
/** Enable filtering by domain */
|
|
275
|
+
enableDomainFiltering: z.boolean().default(true),
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
export type MCPServerConfig = z.infer<typeof MCPServerConfigSchema>;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Main Atlas configuration
|
|
282
|
+
*/
|
|
283
|
+
export const AtlasConfigSchema = z.object({
|
|
284
|
+
/** Learning configuration */
|
|
285
|
+
learning: LearningConfigSchema.default({}),
|
|
286
|
+
/** Router configuration */
|
|
287
|
+
router: RouterConfigSchema.default({}),
|
|
288
|
+
/** Memory configuration */
|
|
289
|
+
memory: MemoryConfigSchema.default({}),
|
|
290
|
+
/** Storage configuration */
|
|
291
|
+
storage: StorageConfigSchema.default({}),
|
|
292
|
+
/** Embedding configuration */
|
|
293
|
+
embedding: EmbeddingConfigSchema.default({}),
|
|
294
|
+
/** Execution configuration */
|
|
295
|
+
execution: ExecutionConfigSchema.default({}),
|
|
296
|
+
/** Refinement configuration */
|
|
297
|
+
refinement: RefinementConfigSchema.default({}),
|
|
298
|
+
/** Skill Library configuration */
|
|
299
|
+
skillLibrary: SkillLibraryConfigSchema.default({}),
|
|
300
|
+
/** MCP Server configuration */
|
|
301
|
+
mcp: MCPServerConfigSchema.default({}),
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
export type AtlasConfig = z.infer<typeof AtlasConfigSchema>;
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Create default configuration
|
|
308
|
+
*/
|
|
309
|
+
export function createDefaultConfig(
|
|
310
|
+
overrides?: Partial<AtlasConfig>
|
|
311
|
+
): AtlasConfig {
|
|
312
|
+
return AtlasConfigSchema.parse(overrides ?? {});
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Merge configurations
|
|
317
|
+
*/
|
|
318
|
+
export function mergeConfig(
|
|
319
|
+
base: AtlasConfig,
|
|
320
|
+
overrides: Partial<AtlasConfig>
|
|
321
|
+
): AtlasConfig {
|
|
322
|
+
return AtlasConfigSchema.parse({
|
|
323
|
+
learning: { ...base.learning, ...overrides.learning },
|
|
324
|
+
router: { ...base.router, ...overrides.router },
|
|
325
|
+
memory: { ...base.memory, ...overrides.memory },
|
|
326
|
+
storage: { ...base.storage, ...overrides.storage },
|
|
327
|
+
embedding: { ...base.embedding, ...overrides.embedding },
|
|
328
|
+
execution: { ...base.execution, ...overrides.execution },
|
|
329
|
+
refinement: { ...base.refinement, ...overrides.refinement },
|
|
330
|
+
skillLibrary: { ...base.skillLibrary, ...overrides.skillLibrary },
|
|
331
|
+
mcp: { ...base.mcp, ...overrides.mcp },
|
|
332
|
+
});
|
|
333
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// Core types
|
|
2
|
+
export {
|
|
3
|
+
type Task,
|
|
4
|
+
type VerificationSpec,
|
|
5
|
+
TaskSchema,
|
|
6
|
+
VerificationSpecSchema,
|
|
7
|
+
createTask,
|
|
8
|
+
} from './task.js';
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
type Step,
|
|
12
|
+
StepSchema,
|
|
13
|
+
createStep,
|
|
14
|
+
} from './step.js';
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
type Outcome,
|
|
18
|
+
OutcomeSchema,
|
|
19
|
+
successOutcome,
|
|
20
|
+
failureOutcome,
|
|
21
|
+
partialOutcome,
|
|
22
|
+
} from './outcome.js';
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
type Trajectory,
|
|
26
|
+
TrajectorySchema,
|
|
27
|
+
createTrajectory,
|
|
28
|
+
isSuccessful,
|
|
29
|
+
getKeySteps,
|
|
30
|
+
} from './trajectory.js';
|
|
31
|
+
|
|
32
|
+
// Memory types
|
|
33
|
+
export {
|
|
34
|
+
type Experience,
|
|
35
|
+
type CodeConcept,
|
|
36
|
+
type Strategy,
|
|
37
|
+
type Skill,
|
|
38
|
+
ExperienceSchema,
|
|
39
|
+
CodeConceptSchema,
|
|
40
|
+
StrategySchema,
|
|
41
|
+
SkillSchema,
|
|
42
|
+
createExperience,
|
|
43
|
+
createConcept,
|
|
44
|
+
createStrategy,
|
|
45
|
+
createSkill,
|
|
46
|
+
} from './memory.js';
|
|
47
|
+
|
|
48
|
+
// Playbook types (replaces Strategy + Skill)
|
|
49
|
+
export {
|
|
50
|
+
type Playbook,
|
|
51
|
+
type PlaybookApplicability,
|
|
52
|
+
type PlaybookGuidance,
|
|
53
|
+
type PlaybookVerification,
|
|
54
|
+
type PlaybookEvolution,
|
|
55
|
+
type PlaybookProvenance,
|
|
56
|
+
type PlaybookOrigin,
|
|
57
|
+
type FailureRecord,
|
|
58
|
+
type Refinement,
|
|
59
|
+
type PlaybookComplexity,
|
|
60
|
+
createPlaybook,
|
|
61
|
+
bumpPlaybookVersion,
|
|
62
|
+
getPlaybookSuccessRate,
|
|
63
|
+
hasReliableStats,
|
|
64
|
+
} from './playbook.js';
|
|
65
|
+
|
|
66
|
+
// Meta-learning types
|
|
67
|
+
export {
|
|
68
|
+
type MetaObservation,
|
|
69
|
+
type RoutingObservation,
|
|
70
|
+
type RoutingDecisionType,
|
|
71
|
+
type MemoryUsageObservation,
|
|
72
|
+
type RetrievalQuality,
|
|
73
|
+
type ExecutionObservation,
|
|
74
|
+
type OutcomeObservation,
|
|
75
|
+
type OutcomeQuality,
|
|
76
|
+
type LessonsLearned,
|
|
77
|
+
type MetaStrategy,
|
|
78
|
+
type MetaStrategyCondition,
|
|
79
|
+
type MetaStrategyAdjustment,
|
|
80
|
+
type RoutingAnalysis,
|
|
81
|
+
type RetrievalAnalysis,
|
|
82
|
+
type MetaStats,
|
|
83
|
+
type MetaContext,
|
|
84
|
+
createMetaObservation,
|
|
85
|
+
createMetaStrategy,
|
|
86
|
+
} from './meta.js';
|
|
87
|
+
|
|
88
|
+
// Configuration types
|
|
89
|
+
export {
|
|
90
|
+
type CreditStrategy,
|
|
91
|
+
type PatternExtractor,
|
|
92
|
+
type LearningConfig,
|
|
93
|
+
type RouterConfig,
|
|
94
|
+
type MemoryConfig,
|
|
95
|
+
type MemoryCapacityConfig,
|
|
96
|
+
type StorageConfig,
|
|
97
|
+
type EmbeddingProviderType,
|
|
98
|
+
type EmbeddingConfig,
|
|
99
|
+
type ExecutionBackend,
|
|
100
|
+
type ExecutionConfig,
|
|
101
|
+
type RefinementConfig,
|
|
102
|
+
type SkillPromotionConfig,
|
|
103
|
+
type SkillLimitsConfig,
|
|
104
|
+
type SkillContextConfig,
|
|
105
|
+
type SkillDemotionConfig,
|
|
106
|
+
type SkillLibraryConfig,
|
|
107
|
+
type MCPServerConfig,
|
|
108
|
+
type AtlasConfig,
|
|
109
|
+
CreditStrategySchema,
|
|
110
|
+
PatternExtractorSchema,
|
|
111
|
+
LearningConfigSchema,
|
|
112
|
+
RouterConfigSchema,
|
|
113
|
+
MemoryConfigSchema,
|
|
114
|
+
MemoryCapacityConfigSchema,
|
|
115
|
+
StorageConfigSchema,
|
|
116
|
+
EmbeddingProviderTypeSchema,
|
|
117
|
+
EmbeddingConfigSchema,
|
|
118
|
+
ExecutionBackendSchema,
|
|
119
|
+
ExecutionConfigSchema,
|
|
120
|
+
RefinementConfigSchema,
|
|
121
|
+
SkillPromotionConfigSchema,
|
|
122
|
+
SkillLimitsConfigSchema,
|
|
123
|
+
SkillContextConfigSchema,
|
|
124
|
+
SkillDemotionConfigSchema,
|
|
125
|
+
SkillLibraryConfigSchema,
|
|
126
|
+
MCPServerConfigSchema,
|
|
127
|
+
AtlasConfigSchema,
|
|
128
|
+
createDefaultConfig,
|
|
129
|
+
mergeConfig,
|
|
130
|
+
} from './config.js';
|