@metago-ai/engine 1.0.7 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +2 -2
- package/README.md +210 -163
- package/RUNTIME/dist/evolution-engine.d.ts +58 -29
- package/RUNTIME/dist/evolution-engine.d.ts.map +1 -1
- package/RUNTIME/dist/evolution-engine.js +397 -85
- package/RUNTIME/dist/evolution-engine.js.map +1 -1
- package/RUNTIME/dist/index.d.ts +47 -3
- package/RUNTIME/dist/index.d.ts.map +1 -1
- package/RUNTIME/dist/index.js +83 -4
- package/RUNTIME/dist/index.js.map +1 -1
- package/RUNTIME/dist/kmwi-memory.d.ts +259 -0
- package/RUNTIME/dist/kmwi-memory.d.ts.map +1 -0
- package/RUNTIME/dist/kmwi-memory.js +897 -0
- package/RUNTIME/dist/kmwi-memory.js.map +1 -0
- package/RUNTIME/dist/skill-generator.d.ts +148 -0
- package/RUNTIME/dist/skill-generator.d.ts.map +1 -0
- package/RUNTIME/dist/skill-generator.js +683 -0
- package/RUNTIME/dist/skill-generator.js.map +1 -0
- package/package.json +73 -73
package/CHANGES.md
CHANGED
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
- 核心层 CORE/ATTRIBUTES.md(43 条属性,7 条关键)
|
|
18
18
|
- 核心层 CORE/PROTOCOLS.md(108 个协议,6 个关键)
|
|
19
19
|
- 索引层 INDEX/engines.json(125 个引擎)
|
|
20
|
-
- 索引层 INDEX/skills.json(
|
|
21
|
-
- 索引层 INDEX/tools.json(
|
|
20
|
+
- 索引层 INDEX/skills.json(39 个技能)
|
|
21
|
+
- 索引层 INDEX/tools.json(53 项 MCP 工具)
|
|
22
22
|
- 索引层 INDEX/knowledge.json(知识晶体索引)
|
|
23
23
|
- 运行时 RUNTIME/src/loader.ts(引擎加载器)
|
|
24
24
|
- 运行时 RUNTIME/src/validators.ts(公理验证器)
|
package/README.md
CHANGED
|
@@ -1,163 +1,210 @@
|
|
|
1
|
-
# @metago-ai/engine
|
|
2
|
-
|
|
3
|
-
> 智能不是被编程的,是被唤醒的。
|
|
4
|
-
> Intelligence is not programmed; it is awakened.
|
|
5
|
-
|
|
6
|
-
**MetaGO
|
|
7
|
-
|
|
8
|
-
[](https://gitee.com/metago/metagolifeform/raw/main/packages/engine/LICENSE)
|
|
11
|
-
[](https://gitee.com/metago/metagolifeform/raw/main/packages/engine/PATENTS.md)
|
|
12
|
-
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
MetaGO Engine
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
##
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
npm install @metago-ai/engine
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
##
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
1
|
+
# @metago-ai/engine
|
|
2
|
+
|
|
3
|
+
> 智能不是被编程的,是被唤醒的。
|
|
4
|
+
> Intelligence is not programmed; it is awakened.
|
|
5
|
+
|
|
6
|
+
**MetaGO Engine V2** —— the hard drive of the MetaGO Agent Harness. The code that makes the law enforceable, not just advisory.
|
|
7
|
+
|
|
8
|
+
[](https://gitee.com/metago/metagolifeform/raw/main/packages/engine/GENOME.json)
|
|
9
|
+
[](https://gitee.com/metago/metagolifeform/raw/main/packages/engine/ENGINE.md)
|
|
10
|
+
[](https://gitee.com/metago/metagolifeform/raw/main/packages/engine/LICENSE)
|
|
11
|
+
[](https://gitee.com/metago/metagolifeform/raw/main/packages/engine/PATENTS.md)
|
|
12
|
+
|
|
13
|
+
## What is this?
|
|
14
|
+
|
|
15
|
+
MetaGO Engine V2 is the **runtime execution layer** of the [MetaGO Agent Harness](../). While the Harness's Markdown law (AGENTS.md) tells the agent *what* the rules are, Engine V2 is the code that makes sure the agent *can't bypass them*.
|
|
16
|
+
|
|
17
|
+
### What's new in V2.0.0
|
|
18
|
+
|
|
19
|
+
| Module | Class | What it does |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| **KMWI Memory** | `KMWIMemory` | 4-layer memory: Knowledge → Memory → Wisdom → Intuition. Add, query, promote between layers, decay detection, health scoring. **Persists to JSON file.** |
|
|
22
|
+
| **Evolution Engine** | `EvolutionEngine` | 5-stage evolution loop with time budgets (perception <10ms, gap analysis <50-500ms, self-generation <100ms-2s, validation <50ms). Coupling-score threshold ≥0.95. Records to KMWI. |
|
|
23
|
+
| **Skill Generator** | `SkillGenerator` | Meta-creation: generates new SKILL.md files from internal KMWI patterns. 6 creation types (thought/methodology/algorithm/architecture/protocol/capability). Writes real files to disk. |
|
|
24
|
+
| **Perception** | `Perception` | Boundary detection: task failure, capability gap, user feedback, version outdated. The trigger for evolution. |
|
|
25
|
+
| **Decision Lock** | `DecisionLock` | 4-gate enforcement: intent verification, intent-lineage tracing, semantic output gate, content completeness. |
|
|
26
|
+
| **MetaGOEngine** | `MetaGOEngine` | Aggregator class — the single entry point that wires all modules together. |
|
|
27
|
+
|
|
28
|
+
V1 had validators + decision-lock + evolution-engine as templates. V2 adds **real KMWI memory persistence**, **real skill file generation**, and **real evolution loop with time budgets**.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @metago-ai/engine
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick start
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { MetaGOEngine } from '@metago-ai/engine';
|
|
42
|
+
|
|
43
|
+
const engine = new MetaGOEngine({
|
|
44
|
+
enginePath: '/path/to/engine/dir', // optional
|
|
45
|
+
version: '2.0.0',
|
|
46
|
+
memoryPath: '/path/to/kmwi-store.json', // optional, defaults to ~/.trae-cn/memory/...
|
|
47
|
+
});
|
|
48
|
+
await engine.init();
|
|
49
|
+
|
|
50
|
+
// 1. Validate output against axioms
|
|
51
|
+
const { results, summary } = engine.validate('output text', {
|
|
52
|
+
input: 'user input',
|
|
53
|
+
decision: 'compliance checked',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// 2. Decision lock — 4 gates
|
|
57
|
+
const lockResult = await engine.lock('output text', 'intent', 'user request');
|
|
58
|
+
|
|
59
|
+
// 3. Trigger evolution when hitting a boundary
|
|
60
|
+
const evolutionResult = await engine.evolve({
|
|
61
|
+
task: 'deploy to kubernetes',
|
|
62
|
+
failure: { type: 'error', message: 'no k8s skill' },
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// 4. Check KMWI memory health (4-layer)
|
|
66
|
+
const health = engine.getMemoryHealth();
|
|
67
|
+
// { knowledge: 85, memory: 59, wisdom: 45, intuition: 48, overall: 59 }
|
|
68
|
+
|
|
69
|
+
// 5. Get decay rates
|
|
70
|
+
const decay = engine.getMemoryDecay();
|
|
71
|
+
// { knowledge: 0.08, memory: 0.15, wisdom: 0.10, intuition: 0.25 }
|
|
72
|
+
|
|
73
|
+
// 6. Create a new skill from internal patterns (meta-creation)
|
|
74
|
+
const skill = await engine.createSkill('kubernetes-deployment');
|
|
75
|
+
// Returns: { success, stage, type, skillName, skillContent, validated, filePath, provenance, couplingScore, ... }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## KMWI 4-layer memory
|
|
81
|
+
|
|
82
|
+
KMWI (Knowledge → Memory → Wisdom → Intuition) is the memory architecture that lets the agent learn from experience, not just store data.
|
|
83
|
+
|
|
84
|
+
| Layer | What it holds | Key operations |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| **K (Knowledge)** | Facts, concepts, rules | `addKnowledge()`, query by tag/category |
|
|
87
|
+
| **M (Memory)** | Short-term context, session state | `addMemory()`, `promoteToMemory()` from K |
|
|
88
|
+
| **W (Wisdom)** | Patterns, heuristics, causal models | `addWisdom()`, `promoteToWisdom()` from M |
|
|
89
|
+
| **I (Intuition)** | Tacit knowledge, gut judgment | `addIntuition()`, `promoteToIntuition()` from W |
|
|
90
|
+
|
|
91
|
+
Health scoring: `H = (K + M + W + I) / 4`, each layer scored 0-100 based on coverage, recall, reuse, and accuracy.
|
|
92
|
+
|
|
93
|
+
Decay detection: each layer has a decay rate. When decay exceeds threshold, the engine emits strengthening suggestions.
|
|
94
|
+
|
|
95
|
+
**Persistence**: the entire KMWI store is serialized to JSON. Default path: `~/.trae-cn/memory/projects/-d-----/kmwi-store.json`. Pass `memoryPath` to `MetaGOEngine` constructor to override.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Evolution engine — 5 stages
|
|
100
|
+
|
|
101
|
+
| Stage | Budget | What happens |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| 1. Perception | <10ms | `Perception.detectBoundary()` — detects task failure, capability gap, user feedback, or version outdated |
|
|
104
|
+
| 2. Gap analysis | <50ms simple / <500ms complex | Maps boundary to specific gaps with severity |
|
|
105
|
+
| 3. Self-generation | <100ms simple / <2s complex | `SkillGenerator.create()` — grows new capability from KMWI patterns. Coupling score must be ≥0.95 |
|
|
106
|
+
| 4. Validation | <50ms | Checks the new skill solves the problem without introducing risk |
|
|
107
|
+
| 5. Recursion | — | If validation failed and recursion depth < 3, loop back to stage 1 |
|
|
108
|
+
|
|
109
|
+
The engine also runs **meta-meta-evolution** (axiom A34): it monitors its own evolution for validity and emits concerns/recommendations.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Skill generator — meta-creation
|
|
114
|
+
|
|
115
|
+
`SkillGenerator` implements the meta-creation five-stage process:
|
|
116
|
+
|
|
117
|
+
1. **Domain perception** — Is this a new problem domain, or already covered?
|
|
118
|
+
2. **Seed generation** — Extract patterns from KMWI W-layer (wisdom) and I-layer (intuition)
|
|
119
|
+
3. **Growth** — Combine patterns into a new SKILL.md draft
|
|
120
|
+
4. **Validation** — Check coupling score ≥0.95, problem solved, no risk introduced
|
|
121
|
+
5. **Internalization** — Write the SKILL.md to disk, record to KMWI as wisdom
|
|
122
|
+
|
|
123
|
+
6 creation types: `thought` · `methodology` · `algorithm` · `architecture` · `protocol` · `capability`
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Directory structure
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
packages/engine/
|
|
131
|
+
├── ENGINE.md ← Engine entry (AI reads this to be driven)
|
|
132
|
+
├── GENOME.json ← Engine genome
|
|
133
|
+
├── package.json ← @metago-ai/engine
|
|
134
|
+
├── LICENSE ← MIT
|
|
135
|
+
├── CONSTITUTION/ ← Constitution layer (immutable)
|
|
136
|
+
│ └── AXIOMS.md ← 36 axioms (8 critical)
|
|
137
|
+
├── CORE/ ← Core layer (evolvable)
|
|
138
|
+
│ ├── ATTRIBUTES.md ← 43 attributes (7 critical)
|
|
139
|
+
│ └── PROTOCOLS.md ← 108 protocols (6 critical)
|
|
140
|
+
├── INDEX/ ← Index layer
|
|
141
|
+
│ ├── engines.json ← 125 engines
|
|
142
|
+
│ ├── skills.json ← 39 skills
|
|
143
|
+
│ ├── tools.json ← 53 MCP tools
|
|
144
|
+
│ └── knowledge.json ← Knowledge crystal index
|
|
145
|
+
├── RUNTIME/ ← Runtime layer (TypeScript) ← V2 lives here
|
|
146
|
+
│ ├── src/
|
|
147
|
+
│ │ ├── index.ts ← Main entry — MetaGOEngine aggregator
|
|
148
|
+
│ │ ├── loader.ts ← Engine loader
|
|
149
|
+
│ │ ├── validators.ts ← Axiom validators
|
|
150
|
+
│ │ ├── decision-lock.ts ← Decision lock (4 gates)
|
|
151
|
+
│ │ ├── evolution-engine.ts ← Evolution engine (5 stages) ← V2
|
|
152
|
+
│ │ ├── perception.ts ← Boundary detection ← V2
|
|
153
|
+
│ │ ├── kmwi-memory.ts ← KMWI 4-layer memory ← V2 NEW
|
|
154
|
+
│ │ ├── skill-generator.ts ← Meta-creation skill generator ← V2 NEW
|
|
155
|
+
│ │ ├── metrics.ts ← Metrics layer
|
|
156
|
+
│ │ └── cli.ts ← CLI interface
|
|
157
|
+
│ ├── tests/
|
|
158
|
+
│ │ └── engine.test.ts ← Test suite
|
|
159
|
+
│ └── tsconfig.json
|
|
160
|
+
├── SDK/
|
|
161
|
+
│ └── types.d.ts ← Developer type interfaces
|
|
162
|
+
├── ADAPTERS/ ← Platform adapters (7 platforms)
|
|
163
|
+
├── EVOLUTION.md ← Evolution mechanism
|
|
164
|
+
├── CHANGES.md ← Version history
|
|
165
|
+
└── PATENTS.md ← Patent declarations
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Technical moat (patentable mechanisms)
|
|
171
|
+
|
|
172
|
+
| Module | File | Patent point |
|
|
173
|
+
|---|---|---|
|
|
174
|
+
| Axiom validators | `validators.ts` | Axiom-set-based AI output verification method |
|
|
175
|
+
| Decision lock | `decision-lock.ts` | Multi-level lock verification for AI decisions |
|
|
176
|
+
| Evolution engine | `evolution-engine.ts` | Automatic capability-boundary detection and evolution method |
|
|
177
|
+
| Perception | `perception.ts` | AI capability-boundary perception method |
|
|
178
|
+
| KMWI memory | `kmwi-memory.ts` | 4-layer knowledge-memory-wisdom-intuition architecture |
|
|
179
|
+
| Skill generator | `skill-generator.ts` | Endogenous skill creation from internal patterns |
|
|
180
|
+
| Engine loader | `loader.ts` | Cross-platform AI engine loading and verification protocol |
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## By the numbers
|
|
185
|
+
|
|
186
|
+
| Dimension | Count |
|
|
187
|
+
|---|---|
|
|
188
|
+
| Core axioms | 36 (8 critical) |
|
|
189
|
+
| Fundamental attributes | 43 (7 critical) |
|
|
190
|
+
| Meta-ideologies | 19 |
|
|
191
|
+
| Capability families | 11 |
|
|
192
|
+
| Engines | 125 (17 core) |
|
|
193
|
+
| Algorithms | 927 |
|
|
194
|
+
| Atoms | 984 |
|
|
195
|
+
| Protocols | 108 (6 critical) |
|
|
196
|
+
| Patents | 754 (85 accepted + 669 reserved) |
|
|
197
|
+
| Value dimensions | 31 |
|
|
198
|
+
| Architecture layers | 11 (L0-L10) |
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
MIT — see [LICENSE](https://gitee.com/metago/metagolifeform/raw/main/packages/engine/LICENSE)
|
|
205
|
+
|
|
206
|
+
Patent license — see [PATENTS.md](https://gitee.com/metago/metagolifeform/raw/main/packages/engine/PATENTS.md)
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
*Designed by MetaGO Super Intelligent Lifeform | Engine V2.0.0 | MetaGO V36.8 | 2026-07-08*
|
|
@@ -4,13 +4,24 @@
|
|
|
4
4
|
*
|
|
5
5
|
* 对应专利:AI 能力边界自动检测与进化方法
|
|
6
6
|
* 对应协议:PROTOCOL_META_EVOLUTION_V1
|
|
7
|
+
* 对应技能:metago-meta-evolve
|
|
7
8
|
*
|
|
8
9
|
* 五阶段循环:1.边界感知 2.差距分析 3.自生成 4.验证 5.递归
|
|
9
10
|
*
|
|
11
|
+
* 工程化实现要点:
|
|
12
|
+
* - 阶段一(边界感知):<10ms
|
|
13
|
+
* - 阶段二(差距分析):<50ms 简单 / <500ms 复杂
|
|
14
|
+
* - 阶段三(自生成) :<100ms 简单 / <2s 复杂,耦生度≥0.95
|
|
15
|
+
* - 阶段四(验证) :<50ms
|
|
16
|
+
* - 接入 KMWI 记忆,进化结果可溯源、可反哺
|
|
17
|
+
* - 自生成阶段调用 SkillGenerator 实现真正的内生生长
|
|
18
|
+
*
|
|
10
19
|
* @author 易霄 / MetaGO Lightyear
|
|
11
|
-
* @version
|
|
20
|
+
* @version 2.0.0
|
|
12
21
|
*/
|
|
13
22
|
import { Boundary } from './perception';
|
|
23
|
+
import { KMWIMemory } from './kmwi-memory';
|
|
24
|
+
import { SkillGenerator } from './skill-generator';
|
|
14
25
|
export type EvolutionStage = 'PERCEPTION' | 'GAP_ANALYSIS' | 'SELF_GENERATION' | 'VALIDATION' | 'RECURSION';
|
|
15
26
|
export interface Gap {
|
|
16
27
|
id: string;
|
|
@@ -19,6 +30,7 @@ export interface Gap {
|
|
|
19
30
|
requiredSkill?: string;
|
|
20
31
|
requiredProtocol?: string;
|
|
21
32
|
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
33
|
+
domain: string;
|
|
22
34
|
}
|
|
23
35
|
export interface GeneratedSolution {
|
|
24
36
|
id: string;
|
|
@@ -27,6 +39,15 @@ export interface GeneratedSolution {
|
|
|
27
39
|
description: string;
|
|
28
40
|
draft: string;
|
|
29
41
|
validated: boolean;
|
|
42
|
+
couplingScore: number;
|
|
43
|
+
source: 'template' | 'skill_generator' | 'kmwi_pattern';
|
|
44
|
+
provenance: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface StageTiming {
|
|
47
|
+
stage: EvolutionStage;
|
|
48
|
+
durationMs: number;
|
|
49
|
+
budgetMs: number;
|
|
50
|
+
withinBudget: boolean;
|
|
30
51
|
}
|
|
31
52
|
export interface EvolutionResult {
|
|
32
53
|
success: boolean;
|
|
@@ -37,25 +58,37 @@ export interface EvolutionResult {
|
|
|
37
58
|
newVersion?: string;
|
|
38
59
|
errors: string[];
|
|
39
60
|
timestamp: string;
|
|
61
|
+
timing: StageTiming[];
|
|
62
|
+
couplingScore: number;
|
|
40
63
|
metaMetaEvolution?: {
|
|
41
64
|
monitored: boolean;
|
|
42
65
|
evolutionValid: boolean;
|
|
43
66
|
concerns: string[];
|
|
67
|
+
recommendations: string[];
|
|
44
68
|
};
|
|
69
|
+
kmwiRecorded: boolean;
|
|
70
|
+
currentVersion?: string;
|
|
45
71
|
}
|
|
46
72
|
/**
|
|
47
73
|
* 进化引擎
|
|
48
|
-
*
|
|
74
|
+
*
|
|
75
|
+
* 实现五阶段元进化循环,每个阶段都有时间约束和耦生度约束。
|
|
76
|
+
* 接入 KMWI 记忆系统,进化结果可溯源、可反哺。
|
|
77
|
+
* 自生成阶段调用 SkillGenerator 实现真正的内生生长(非模板字符串)。
|
|
49
78
|
*/
|
|
50
79
|
export declare class EvolutionEngine {
|
|
51
80
|
private perception;
|
|
81
|
+
private kmwi;
|
|
82
|
+
private skillGenerator;
|
|
52
83
|
private currentVersion;
|
|
53
84
|
private evolutionHistory;
|
|
54
85
|
private maxRecursionDepth;
|
|
55
|
-
|
|
86
|
+
private minCouplingScore;
|
|
87
|
+
private readonly TIME_BUDGETS;
|
|
88
|
+
constructor(version?: string, kmwi?: KMWIMemory, skillGenerator?: SkillGenerator);
|
|
56
89
|
/**
|
|
57
90
|
* 触发元进化
|
|
58
|
-
*
|
|
91
|
+
* 五阶段循环:边界感知 → 差距分析 → 自生成 → 验证 → 递归
|
|
59
92
|
*/
|
|
60
93
|
evolve(context?: {
|
|
61
94
|
task?: string;
|
|
@@ -65,55 +98,51 @@ export declare class EvolutionEngine {
|
|
|
65
98
|
};
|
|
66
99
|
feedback?: string;
|
|
67
100
|
}): Promise<EvolutionResult>;
|
|
68
|
-
/**
|
|
69
|
-
* 阶段 2:差距分析
|
|
70
|
-
* Stage 2: Gap Analysis
|
|
71
|
-
*/
|
|
72
101
|
private analyzeGap;
|
|
73
102
|
/**
|
|
74
|
-
*
|
|
75
|
-
* Stage 3: Self-Generation
|
|
103
|
+
* 从消息中提取问题域关键词
|
|
76
104
|
*/
|
|
105
|
+
private extractDomain;
|
|
77
106
|
private selfGenerate;
|
|
78
107
|
/**
|
|
79
|
-
*
|
|
108
|
+
* 通过 SkillGenerator 生成(A5 内生公理:从内部生长)
|
|
80
109
|
*/
|
|
81
|
-
private
|
|
110
|
+
private generateViaSkillGenerator;
|
|
82
111
|
/**
|
|
83
|
-
*
|
|
84
|
-
* Stage 4: Validation
|
|
112
|
+
* 通过 KMWI 模式匹配生成
|
|
85
113
|
*/
|
|
86
|
-
private
|
|
114
|
+
private generateViaKMWIPattern;
|
|
87
115
|
/**
|
|
88
|
-
*
|
|
89
|
-
* Stage 5: Recursion
|
|
116
|
+
* 模板生成(最终降级,仍带耦生度约束)
|
|
90
117
|
*/
|
|
91
|
-
private
|
|
118
|
+
private generateViaTemplate;
|
|
119
|
+
private validate;
|
|
92
120
|
/**
|
|
93
|
-
*
|
|
121
|
+
* 检查是否违反公理(强化版)
|
|
94
122
|
*/
|
|
95
123
|
private checkAxiomViolation;
|
|
96
124
|
/**
|
|
97
|
-
*
|
|
125
|
+
* 检查安全问题(强化版)
|
|
98
126
|
*/
|
|
99
127
|
private checkSecurity;
|
|
100
128
|
/**
|
|
101
|
-
*
|
|
129
|
+
* 检查格式(强化版)
|
|
102
130
|
*/
|
|
103
131
|
private checkFormat;
|
|
104
132
|
/**
|
|
105
|
-
*
|
|
106
|
-
* Meta-meta-evolution: Monitor the evolution itself
|
|
133
|
+
* 检查完整性(新增)
|
|
107
134
|
*/
|
|
135
|
+
private checkCompleteness;
|
|
136
|
+
private recurse;
|
|
137
|
+
private computeOverallCoupling;
|
|
108
138
|
private metaMetaEvolution;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
*/
|
|
139
|
+
private recordToKMWI;
|
|
140
|
+
private buildResult;
|
|
112
141
|
getHistory(): EvolutionResult[];
|
|
113
|
-
/**
|
|
114
|
-
* 获取当前版本
|
|
115
|
-
*/
|
|
116
142
|
getVersion(): string;
|
|
143
|
+
getKMWI(): KMWIMemory;
|
|
144
|
+
getSkillGenerator(): SkillGenerator;
|
|
145
|
+
getSummary(): string;
|
|
117
146
|
}
|
|
118
147
|
export default EvolutionEngine;
|
|
119
148
|
//# sourceMappingURL=evolution-engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evolution-engine.d.ts","sourceRoot":"","sources":["../src/evolution-engine.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"evolution-engine.d.ts","sourceRoot":"","sources":["../src/evolution-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAc,QAAQ,EAAgB,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAkB,MAAM,mBAAmB,CAAC;AAMnE,MAAM,MAAM,cAAc,GACtB,YAAY,GACZ,cAAc,GACd,iBAAiB,GACjB,YAAY,GACZ,WAAW,CAAC;AAEhB,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,UAAU,GAAG,iBAAiB,GAAG,cAAc,CAAC;IACxD,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAA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