genesis-ai-cli 7.4.5
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/.env.example +78 -0
- package/README.md +282 -0
- package/dist/src/active-inference/actions.d.ts +75 -0
- package/dist/src/active-inference/actions.js +250 -0
- package/dist/src/active-inference/autonomous-loop.d.ts +103 -0
- package/dist/src/active-inference/autonomous-loop.js +289 -0
- package/dist/src/active-inference/core.d.ts +85 -0
- package/dist/src/active-inference/core.js +555 -0
- package/dist/src/active-inference/demo-autonomous-loop.d.ts +8 -0
- package/dist/src/active-inference/demo-autonomous-loop.js +338 -0
- package/dist/src/active-inference/demo-value-integration.d.ts +8 -0
- package/dist/src/active-inference/demo-value-integration.js +174 -0
- package/dist/src/active-inference/index.d.ts +32 -0
- package/dist/src/active-inference/index.js +88 -0
- package/dist/src/active-inference/integration.d.ts +114 -0
- package/dist/src/active-inference/integration.js +698 -0
- package/dist/src/active-inference/memory-integration.d.ts +51 -0
- package/dist/src/active-inference/memory-integration.js +232 -0
- package/dist/src/active-inference/observations.d.ts +67 -0
- package/dist/src/active-inference/observations.js +147 -0
- package/dist/src/active-inference/test-active-inference.d.ts +8 -0
- package/dist/src/active-inference/test-active-inference.js +320 -0
- package/dist/src/active-inference/test-value-integration.d.ts +6 -0
- package/dist/src/active-inference/test-value-integration.js +168 -0
- package/dist/src/active-inference/types.d.ts +150 -0
- package/dist/src/active-inference/types.js +59 -0
- package/dist/src/active-inference/value-integration.d.ts +164 -0
- package/dist/src/active-inference/value-integration.js +459 -0
- package/dist/src/agents/base-agent.d.ts +53 -0
- package/dist/src/agents/base-agent.js +178 -0
- package/dist/src/agents/builder.d.ts +67 -0
- package/dist/src/agents/builder.js +537 -0
- package/dist/src/agents/critic.d.ts +35 -0
- package/dist/src/agents/critic.js +322 -0
- package/dist/src/agents/ethicist.d.ts +54 -0
- package/dist/src/agents/ethicist.js +393 -0
- package/dist/src/agents/explorer.d.ts +26 -0
- package/dist/src/agents/explorer.js +216 -0
- package/dist/src/agents/feeling.d.ts +41 -0
- package/dist/src/agents/feeling.js +320 -0
- package/dist/src/agents/index.d.ts +111 -0
- package/dist/src/agents/index.js +222 -0
- package/dist/src/agents/memory.d.ts +69 -0
- package/dist/src/agents/memory.js +404 -0
- package/dist/src/agents/message-bus.d.ts +88 -0
- package/dist/src/agents/message-bus.js +267 -0
- package/dist/src/agents/narrator.d.ts +90 -0
- package/dist/src/agents/narrator.js +473 -0
- package/dist/src/agents/planner.d.ts +38 -0
- package/dist/src/agents/planner.js +341 -0
- package/dist/src/agents/predictor.d.ts +73 -0
- package/dist/src/agents/predictor.js +506 -0
- package/dist/src/agents/sensor.d.ts +88 -0
- package/dist/src/agents/sensor.js +377 -0
- package/dist/src/agents/test-agents.d.ts +6 -0
- package/dist/src/agents/test-agents.js +73 -0
- package/dist/src/agents/types.d.ts +194 -0
- package/dist/src/agents/types.js +7 -0
- package/dist/src/brain/index.d.ts +185 -0
- package/dist/src/brain/index.js +843 -0
- package/dist/src/brain/trace.d.ts +91 -0
- package/dist/src/brain/trace.js +327 -0
- package/dist/src/brain/types.d.ts +165 -0
- package/dist/src/brain/types.js +51 -0
- package/dist/src/cli/chat.d.ts +237 -0
- package/dist/src/cli/chat.js +1959 -0
- package/dist/src/cli/dispatcher.d.ts +182 -0
- package/dist/src/cli/dispatcher.js +718 -0
- package/dist/src/cli/human-loop.d.ts +170 -0
- package/dist/src/cli/human-loop.js +543 -0
- package/dist/src/cli/index.d.ts +12 -0
- package/dist/src/cli/index.js +28 -0
- package/dist/src/cli/interactive.d.ts +141 -0
- package/dist/src/cli/interactive.js +757 -0
- package/dist/src/cli/ui.d.ts +205 -0
- package/dist/src/cli/ui.js +632 -0
- package/dist/src/consciousness/attention-schema.d.ts +154 -0
- package/dist/src/consciousness/attention-schema.js +432 -0
- package/dist/src/consciousness/global-workspace.d.ts +149 -0
- package/dist/src/consciousness/global-workspace.js +422 -0
- package/dist/src/consciousness/index.d.ts +186 -0
- package/dist/src/consciousness/index.js +476 -0
- package/dist/src/consciousness/phi-calculator.d.ts +119 -0
- package/dist/src/consciousness/phi-calculator.js +445 -0
- package/dist/src/consciousness/phi-decisions.d.ts +169 -0
- package/dist/src/consciousness/phi-decisions.js +383 -0
- package/dist/src/consciousness/phi-monitor.d.ts +153 -0
- package/dist/src/consciousness/phi-monitor.js +465 -0
- package/dist/src/consciousness/types.d.ts +260 -0
- package/dist/src/consciousness/types.js +44 -0
- package/dist/src/daemon/dream-mode.d.ts +115 -0
- package/dist/src/daemon/dream-mode.js +470 -0
- package/dist/src/daemon/index.d.ts +162 -0
- package/dist/src/daemon/index.js +542 -0
- package/dist/src/daemon/maintenance.d.ts +139 -0
- package/dist/src/daemon/maintenance.js +549 -0
- package/dist/src/daemon/process.d.ts +82 -0
- package/dist/src/daemon/process.js +442 -0
- package/dist/src/daemon/scheduler.d.ts +90 -0
- package/dist/src/daemon/scheduler.js +494 -0
- package/dist/src/daemon/types.d.ts +213 -0
- package/dist/src/daemon/types.js +50 -0
- package/dist/src/epistemic/index.d.ts +74 -0
- package/dist/src/epistemic/index.js +225 -0
- package/dist/src/grounding/epistemic-stack.d.ts +100 -0
- package/dist/src/grounding/epistemic-stack.js +408 -0
- package/dist/src/grounding/feedback.d.ts +98 -0
- package/dist/src/grounding/feedback.js +276 -0
- package/dist/src/grounding/index.d.ts +123 -0
- package/dist/src/grounding/index.js +224 -0
- package/dist/src/grounding/verifier.d.ts +149 -0
- package/dist/src/grounding/verifier.js +484 -0
- package/dist/src/healing/detector.d.ts +110 -0
- package/dist/src/healing/detector.js +436 -0
- package/dist/src/healing/fixer.d.ts +138 -0
- package/dist/src/healing/fixer.js +572 -0
- package/dist/src/healing/index.d.ts +23 -0
- package/dist/src/healing/index.js +43 -0
- package/dist/src/hooks/index.d.ts +135 -0
- package/dist/src/hooks/index.js +317 -0
- package/dist/src/index.d.ts +23 -0
- package/dist/src/index.js +1266 -0
- package/dist/src/kernel/index.d.ts +155 -0
- package/dist/src/kernel/index.js +795 -0
- package/dist/src/kernel/invariants.d.ts +153 -0
- package/dist/src/kernel/invariants.js +355 -0
- package/dist/src/kernel/test-kernel.d.ts +6 -0
- package/dist/src/kernel/test-kernel.js +108 -0
- package/dist/src/kernel/test-real-mcp.d.ts +10 -0
- package/dist/src/kernel/test-real-mcp.js +295 -0
- package/dist/src/llm/index.d.ts +146 -0
- package/dist/src/llm/index.js +428 -0
- package/dist/src/llm/router.d.ts +136 -0
- package/dist/src/llm/router.js +510 -0
- package/dist/src/mcp/index.d.ts +85 -0
- package/dist/src/mcp/index.js +657 -0
- package/dist/src/mcp/resilient.d.ts +139 -0
- package/dist/src/mcp/resilient.js +417 -0
- package/dist/src/memory/cache.d.ts +118 -0
- package/dist/src/memory/cache.js +356 -0
- package/dist/src/memory/cognitive-workspace.d.ts +231 -0
- package/dist/src/memory/cognitive-workspace.js +521 -0
- package/dist/src/memory/consolidation.d.ts +99 -0
- package/dist/src/memory/consolidation.js +443 -0
- package/dist/src/memory/episodic.d.ts +114 -0
- package/dist/src/memory/episodic.js +394 -0
- package/dist/src/memory/forgetting.d.ts +134 -0
- package/dist/src/memory/forgetting.js +324 -0
- package/dist/src/memory/index.d.ts +211 -0
- package/dist/src/memory/index.js +367 -0
- package/dist/src/memory/indexer.d.ts +123 -0
- package/dist/src/memory/indexer.js +479 -0
- package/dist/src/memory/procedural.d.ts +136 -0
- package/dist/src/memory/procedural.js +479 -0
- package/dist/src/memory/semantic.d.ts +132 -0
- package/dist/src/memory/semantic.js +497 -0
- package/dist/src/memory/types.d.ts +193 -0
- package/dist/src/memory/types.js +15 -0
- package/dist/src/orchestrator.d.ts +65 -0
- package/dist/src/orchestrator.js +317 -0
- package/dist/src/persistence/index.d.ts +257 -0
- package/dist/src/persistence/index.js +763 -0
- package/dist/src/pipeline/executor.d.ts +51 -0
- package/dist/src/pipeline/executor.js +695 -0
- package/dist/src/pipeline/index.d.ts +7 -0
- package/dist/src/pipeline/index.js +11 -0
- package/dist/src/self-production.d.ts +67 -0
- package/dist/src/self-production.js +205 -0
- package/dist/src/subagents/executor.d.ts +58 -0
- package/dist/src/subagents/executor.js +283 -0
- package/dist/src/subagents/index.d.ts +37 -0
- package/dist/src/subagents/index.js +53 -0
- package/dist/src/subagents/registry.d.ts +23 -0
- package/dist/src/subagents/registry.js +167 -0
- package/dist/src/subagents/types.d.ts +79 -0
- package/dist/src/subagents/types.js +14 -0
- package/dist/src/tools/bash.d.ts +139 -0
- package/dist/src/tools/bash.js +583 -0
- package/dist/src/tools/edit.d.ts +125 -0
- package/dist/src/tools/edit.js +424 -0
- package/dist/src/tools/git.d.ts +179 -0
- package/dist/src/tools/git.js +504 -0
- package/dist/src/tools/index.d.ts +21 -0
- package/dist/src/tools/index.js +163 -0
- package/dist/src/types.d.ts +145 -0
- package/dist/src/types.js +7 -0
- package/dist/src/world-model/decoder.d.ts +163 -0
- package/dist/src/world-model/decoder.js +517 -0
- package/dist/src/world-model/digital-twin.d.ts +219 -0
- package/dist/src/world-model/digital-twin.js +695 -0
- package/dist/src/world-model/encoder.d.ts +141 -0
- package/dist/src/world-model/encoder.js +564 -0
- package/dist/src/world-model/index.d.ts +221 -0
- package/dist/src/world-model/index.js +772 -0
- package/dist/src/world-model/predictor.d.ts +161 -0
- package/dist/src/world-model/predictor.js +681 -0
- package/dist/src/world-model/test-value-jepa.d.ts +8 -0
- package/dist/src/world-model/test-value-jepa.js +430 -0
- package/dist/src/world-model/types.d.ts +341 -0
- package/dist/src/world-model/types.js +69 -0
- package/dist/src/world-model/value-jepa.d.ts +247 -0
- package/dist/src/world-model/value-jepa.js +622 -0
- package/dist/test/brain.test.d.ts +11 -0
- package/dist/test/brain.test.js +358 -0
- package/dist/test/cli/dispatcher.test.d.ts +4 -0
- package/dist/test/cli/dispatcher.test.js +332 -0
- package/dist/test/cli/human-loop.test.d.ts +4 -0
- package/dist/test/cli/human-loop.test.js +270 -0
- package/dist/test/grounding/feedback.test.d.ts +4 -0
- package/dist/test/grounding/feedback.test.js +462 -0
- package/dist/test/grounding/verifier.test.d.ts +4 -0
- package/dist/test/grounding/verifier.test.js +442 -0
- package/dist/test/grounding.test.d.ts +6 -0
- package/dist/test/grounding.test.js +246 -0
- package/dist/test/healing/detector.test.d.ts +4 -0
- package/dist/test/healing/detector.test.js +266 -0
- package/dist/test/healing/fixer.test.d.ts +4 -0
- package/dist/test/healing/fixer.test.js +369 -0
- package/dist/test/integration.test.d.ts +5 -0
- package/dist/test/integration.test.js +290 -0
- package/dist/test/tools/bash.test.d.ts +4 -0
- package/dist/test/tools/bash.test.js +348 -0
- package/dist/test/tools/edit.test.d.ts +4 -0
- package/dist/test/tools/edit.test.js +350 -0
- package/dist/test/tools/git.test.d.ts +4 -0
- package/dist/test/tools/git.test.js +350 -0
- package/package.json +60 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Demo: Autonomous Loop with Value Integration
|
|
4
|
+
*
|
|
5
|
+
* Runs the autonomous inference loop with value-augmented policy selection.
|
|
6
|
+
*
|
|
7
|
+
* Run: node dist/src/active-inference/demo-autonomous-loop.js
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const value_integration_js_1 = require("./value-integration.js");
|
|
11
|
+
const index_js_1 = require("./index.js");
|
|
12
|
+
const types_js_1 = require("./types.js");
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Simulated Environment
|
|
15
|
+
// ============================================================================
|
|
16
|
+
class SimulatedEnvironment {
|
|
17
|
+
energy = 0.5;
|
|
18
|
+
phi = 0.5;
|
|
19
|
+
taskProgress = 0;
|
|
20
|
+
cycle = 0;
|
|
21
|
+
state = 'idle';
|
|
22
|
+
getKernelState() {
|
|
23
|
+
return {
|
|
24
|
+
energy: this.energy,
|
|
25
|
+
state: this.state,
|
|
26
|
+
taskStatus: this.taskProgress >= 1 ? 'completed' :
|
|
27
|
+
this.taskProgress > 0 ? 'running' : 'pending',
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
getPhiState() {
|
|
31
|
+
return {
|
|
32
|
+
phi: this.phi,
|
|
33
|
+
state: this.phi > 0.6 ? 'aware' : this.phi > 0.3 ? 'drowsy' : 'dormant',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
applyAction(action) {
|
|
37
|
+
this.cycle++;
|
|
38
|
+
// Natural decay
|
|
39
|
+
this.energy = Math.max(0, this.energy - 0.05);
|
|
40
|
+
this.phi = Math.max(0, this.phi - 0.02);
|
|
41
|
+
// Action effects
|
|
42
|
+
switch (action) {
|
|
43
|
+
case 'recharge':
|
|
44
|
+
this.energy = Math.min(1, this.energy + 0.3);
|
|
45
|
+
this.state = 'idle';
|
|
46
|
+
break;
|
|
47
|
+
case 'sense.mcp':
|
|
48
|
+
this.phi = Math.min(1, this.phi + 0.15);
|
|
49
|
+
this.state = 'sensing';
|
|
50
|
+
break;
|
|
51
|
+
case 'recall.memory':
|
|
52
|
+
this.phi = Math.min(1, this.phi + 0.1);
|
|
53
|
+
break;
|
|
54
|
+
case 'plan.goals':
|
|
55
|
+
this.state = 'thinking';
|
|
56
|
+
if (this.energy > 0.3) {
|
|
57
|
+
this.taskProgress = Math.min(1, this.taskProgress + 0.15);
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
case 'execute.task':
|
|
61
|
+
this.state = 'acting';
|
|
62
|
+
if (this.energy > 0.4 && this.phi > 0.3) {
|
|
63
|
+
this.taskProgress = Math.min(1, this.taskProgress + 0.25);
|
|
64
|
+
this.energy = Math.max(0, this.energy - 0.1);
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
case 'dream.cycle':
|
|
68
|
+
this.phi = Math.min(1, this.phi + 0.2);
|
|
69
|
+
break;
|
|
70
|
+
case 'rest.idle':
|
|
71
|
+
this.energy = Math.min(1, this.energy + 0.1);
|
|
72
|
+
this.state = 'idle';
|
|
73
|
+
break;
|
|
74
|
+
case 'verify.ethics':
|
|
75
|
+
// Minor effect
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
isGoalAchieved() {
|
|
80
|
+
return this.taskProgress >= 1;
|
|
81
|
+
}
|
|
82
|
+
isCritical() {
|
|
83
|
+
return this.energy <= 0.05;
|
|
84
|
+
}
|
|
85
|
+
getEnergyLevel() {
|
|
86
|
+
return Math.round(this.energy * 4);
|
|
87
|
+
}
|
|
88
|
+
getTaskLevel() {
|
|
89
|
+
return this.taskProgress >= 1 ? 3 :
|
|
90
|
+
this.taskProgress > 0.5 ? 2 :
|
|
91
|
+
this.taskProgress > 0 ? 1 : 0;
|
|
92
|
+
}
|
|
93
|
+
reset() {
|
|
94
|
+
this.energy = 0.5;
|
|
95
|
+
this.phi = 0.5;
|
|
96
|
+
this.taskProgress = 0;
|
|
97
|
+
this.cycle = 0;
|
|
98
|
+
this.state = 'idle';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// Visualization
|
|
103
|
+
// ============================================================================
|
|
104
|
+
function formatAction(action) {
|
|
105
|
+
const icons = {
|
|
106
|
+
'sense.mcp': '👁️ ',
|
|
107
|
+
'recall.memory': '🧠',
|
|
108
|
+
'plan.goals': '📋',
|
|
109
|
+
'verify.ethics': '⚖️ ',
|
|
110
|
+
'execute.task': '⚡',
|
|
111
|
+
'dream.cycle': '💭',
|
|
112
|
+
'rest.idle': '😴',
|
|
113
|
+
'recharge': '🔋',
|
|
114
|
+
};
|
|
115
|
+
return `${icons[action] || '❓'} ${action}`;
|
|
116
|
+
}
|
|
117
|
+
function energyBar(level) {
|
|
118
|
+
const bars = ['▁', '▂', '▄', '▆', '█'];
|
|
119
|
+
return bars[Math.min(4, Math.max(0, level))];
|
|
120
|
+
}
|
|
121
|
+
function taskProgress(level) {
|
|
122
|
+
const stages = ['○○○', '●○○', '●●○', '●●●'];
|
|
123
|
+
return stages[Math.min(3, Math.max(0, level))];
|
|
124
|
+
}
|
|
125
|
+
// ============================================================================
|
|
126
|
+
// Demo 1: Basic Autonomous Loop
|
|
127
|
+
// ============================================================================
|
|
128
|
+
async function demoBasicLoop() {
|
|
129
|
+
console.log('╔═══════════════════════════════════════════════════════════════╗');
|
|
130
|
+
console.log('║ Demo 1: Basic Autonomous Loop (20 cycles) ║');
|
|
131
|
+
console.log('╚═══════════════════════════════════════════════════════════════╝\n');
|
|
132
|
+
const env = new SimulatedEnvironment();
|
|
133
|
+
const loop = (0, index_js_1.createAutonomousLoop)({
|
|
134
|
+
cycleInterval: 0,
|
|
135
|
+
maxCycles: 20,
|
|
136
|
+
stopOnGoalAchieved: true,
|
|
137
|
+
stopOnEnergyCritical: true,
|
|
138
|
+
verbose: false,
|
|
139
|
+
});
|
|
140
|
+
// Configure observation source using proper interface
|
|
141
|
+
loop.configureObservations({
|
|
142
|
+
kernelState: () => env.getKernelState(),
|
|
143
|
+
phiState: () => env.getPhiState(),
|
|
144
|
+
});
|
|
145
|
+
console.log('Cycle │ Energy │ Task │ Action');
|
|
146
|
+
console.log('──────┼────────┼───────┼────────────────');
|
|
147
|
+
loop.onCycle((cycle, action) => {
|
|
148
|
+
env.applyAction(action);
|
|
149
|
+
const e = env.getEnergyLevel();
|
|
150
|
+
const t = env.getTaskLevel();
|
|
151
|
+
console.log(` ${cycle.toString().padStart(2)} │ ${energyBar(e)} E:${e} │ ` +
|
|
152
|
+
`${taskProgress(t)} │ ${formatAction(action)}`);
|
|
153
|
+
});
|
|
154
|
+
const stats = await loop.run();
|
|
155
|
+
console.log('──────┴────────┴───────┴────────────────\n');
|
|
156
|
+
console.log(`Stopped after ${stats.cycles} cycles`);
|
|
157
|
+
console.log(`Goal: ${env.isGoalAchieved() ? '✓ Achieved' : '✗ Not achieved'}`);
|
|
158
|
+
console.log(`Actions: ${Object.entries(stats.actions).filter(([, c]) => c > 0).map(([a, c]) => `${a.split('.')[0]}:${c}`).join(', ')}`);
|
|
159
|
+
}
|
|
160
|
+
// ============================================================================
|
|
161
|
+
// Demo 2: Value-Integrated Autonomous Loop
|
|
162
|
+
// ============================================================================
|
|
163
|
+
async function demoValueIntegratedLoop() {
|
|
164
|
+
console.log('\n\n╔═══════════════════════════════════════════════════════════════╗');
|
|
165
|
+
console.log('║ Demo 2: Value-Integrated Autonomous Loop (30 cycles) ║');
|
|
166
|
+
console.log('╚═══════════════════════════════════════════════════════════════╝\n');
|
|
167
|
+
const env = new SimulatedEnvironment();
|
|
168
|
+
const { loop, valueEngine } = (0, value_integration_js_1.createValueIntegratedLoop)({
|
|
169
|
+
cycleInterval: 0,
|
|
170
|
+
maxCycles: 30,
|
|
171
|
+
stopOnGoalAchieved: true,
|
|
172
|
+
stopOnEnergyCritical: true,
|
|
173
|
+
verbose: false,
|
|
174
|
+
valueIntegration: {
|
|
175
|
+
valueWeight: 0.6,
|
|
176
|
+
useWorldModelPredictions: false,
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
loop.configureObservations({
|
|
180
|
+
kernelState: () => env.getKernelState(),
|
|
181
|
+
phiState: () => env.getPhiState(),
|
|
182
|
+
});
|
|
183
|
+
console.log('Cycle │ Energy │ Task │ Value │ Action');
|
|
184
|
+
console.log('──────┼────────┼───────┼───────┼────────────────');
|
|
185
|
+
loop.onCycle((cycle, action) => {
|
|
186
|
+
env.applyAction(action);
|
|
187
|
+
const e = env.getEnergyLevel();
|
|
188
|
+
const t = env.getTaskLevel();
|
|
189
|
+
const veStats = valueEngine.getStats();
|
|
190
|
+
console.log(` ${cycle.toString().padStart(2)} │ ${energyBar(e)} E:${e} │ ` +
|
|
191
|
+
`${taskProgress(t)} │ ${veStats.averageValue.toFixed(2)} │ ${formatAction(action)}`);
|
|
192
|
+
});
|
|
193
|
+
const stats = await loop.run();
|
|
194
|
+
console.log('──────┴────────┴───────┴───────┴────────────────\n');
|
|
195
|
+
const veStats = valueEngine.getStats();
|
|
196
|
+
console.log('Value Engine Statistics:');
|
|
197
|
+
console.log(` Cycles: ${veStats.cycleCount}`);
|
|
198
|
+
console.log(` Avg Value: ${veStats.averageValue.toFixed(3)}`);
|
|
199
|
+
console.log(` Goal: ${env.isGoalAchieved() ? '✓ Achieved' : '✗ Not achieved'}`);
|
|
200
|
+
}
|
|
201
|
+
// ============================================================================
|
|
202
|
+
// Demo 3: Recovery Scenario
|
|
203
|
+
// ============================================================================
|
|
204
|
+
async function demoRecoveryScenario() {
|
|
205
|
+
console.log('\n\n╔═══════════════════════════════════════════════════════════════╗');
|
|
206
|
+
console.log('║ Demo 3: Recovery from Critical State (40 cycles) ║');
|
|
207
|
+
console.log('╚═══════════════════════════════════════════════════════════════╝\n');
|
|
208
|
+
const env = new SimulatedEnvironment();
|
|
209
|
+
// Drain energy to critical
|
|
210
|
+
for (let i = 0; i < 10; i++) {
|
|
211
|
+
env.applyAction('execute.task');
|
|
212
|
+
}
|
|
213
|
+
console.log(`Starting state: Energy=${env.getKernelState().energy.toFixed(2)} (critical)\n`);
|
|
214
|
+
const { loop, valueEngine } = (0, value_integration_js_1.createValueIntegratedLoop)({
|
|
215
|
+
cycleInterval: 0,
|
|
216
|
+
maxCycles: 40,
|
|
217
|
+
stopOnGoalAchieved: true,
|
|
218
|
+
stopOnEnergyCritical: false, // Don't stop - let it recover
|
|
219
|
+
valueIntegration: {
|
|
220
|
+
valueWeight: 0.7,
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
loop.configureObservations({
|
|
224
|
+
kernelState: () => env.getKernelState(),
|
|
225
|
+
phiState: () => env.getPhiState(),
|
|
226
|
+
});
|
|
227
|
+
let phase = 'critical';
|
|
228
|
+
const phases = [];
|
|
229
|
+
console.log('Cycle │ Phase │ Energy │ Task │ Action');
|
|
230
|
+
console.log('──────┼───────────┼────────┼───────┼────────────────');
|
|
231
|
+
loop.onCycle((cycle, action) => {
|
|
232
|
+
env.applyAction(action);
|
|
233
|
+
const e = env.getEnergyLevel();
|
|
234
|
+
const t = env.getTaskLevel();
|
|
235
|
+
// Detect phase
|
|
236
|
+
const newPhase = e <= 1 ? 'critical' :
|
|
237
|
+
e <= 2 ? 'recovering' :
|
|
238
|
+
t >= 3 ? 'complete' :
|
|
239
|
+
'executing';
|
|
240
|
+
if (newPhase !== phase) {
|
|
241
|
+
phases.push(`Cycle ${cycle}: ${phase} → ${newPhase}`);
|
|
242
|
+
phase = newPhase;
|
|
243
|
+
}
|
|
244
|
+
const phaseIcon = {
|
|
245
|
+
'critical': '🔴',
|
|
246
|
+
'recovering': '🟡',
|
|
247
|
+
'executing': '🟢',
|
|
248
|
+
'complete': '🔵',
|
|
249
|
+
}[phase] || '⚪';
|
|
250
|
+
console.log(` ${cycle.toString().padStart(2)} │ ${phaseIcon} ${phase.padEnd(9)} │ ` +
|
|
251
|
+
`${energyBar(e)} E:${e} │ ${taskProgress(t)} │ ${formatAction(action)}`);
|
|
252
|
+
});
|
|
253
|
+
await loop.run();
|
|
254
|
+
console.log('──────┴───────────┴────────┴───────┴────────────────\n');
|
|
255
|
+
console.log('Phase Transitions:');
|
|
256
|
+
phases.forEach(p => console.log(` ${p}`));
|
|
257
|
+
console.log(`\nFinal: Goal ${env.isGoalAchieved() ? '✓ Achieved' : '✗ Not achieved'}`);
|
|
258
|
+
}
|
|
259
|
+
// ============================================================================
|
|
260
|
+
// Demo 4: Comparison - With vs Without Value
|
|
261
|
+
// ============================================================================
|
|
262
|
+
async function demoComparison() {
|
|
263
|
+
console.log('\n\n╔═══════════════════════════════════════════════════════════════╗');
|
|
264
|
+
console.log('║ Demo 4: Comparison - Basic vs Value-Integrated ║');
|
|
265
|
+
console.log('╚═══════════════════════════════════════════════════════════════╝\n');
|
|
266
|
+
const runExperiment = async (useValue) => {
|
|
267
|
+
const env = new SimulatedEnvironment();
|
|
268
|
+
let loop;
|
|
269
|
+
if (useValue) {
|
|
270
|
+
const result = (0, value_integration_js_1.createValueIntegratedLoop)({
|
|
271
|
+
cycleInterval: 0,
|
|
272
|
+
maxCycles: 35,
|
|
273
|
+
stopOnGoalAchieved: true,
|
|
274
|
+
stopOnEnergyCritical: true,
|
|
275
|
+
});
|
|
276
|
+
loop = result.loop;
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
loop = (0, index_js_1.createAutonomousLoop)({
|
|
280
|
+
cycleInterval: 0,
|
|
281
|
+
maxCycles: 35,
|
|
282
|
+
stopOnGoalAchieved: true,
|
|
283
|
+
stopOnEnergyCritical: true,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
loop.configureObservations({
|
|
287
|
+
kernelState: () => env.getKernelState(),
|
|
288
|
+
phiState: () => env.getPhiState(),
|
|
289
|
+
});
|
|
290
|
+
loop.onCycle((_, action) => env.applyAction(action));
|
|
291
|
+
const stats = await loop.run();
|
|
292
|
+
return {
|
|
293
|
+
cycles: stats.cycles,
|
|
294
|
+
goalAchieved: env.isGoalAchieved(),
|
|
295
|
+
actions: stats.actions,
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
const trials = 5;
|
|
299
|
+
console.log(`Running ${trials} trials each...\n`);
|
|
300
|
+
const basicResults = [];
|
|
301
|
+
const valueResults = [];
|
|
302
|
+
for (let i = 0; i < trials; i++) {
|
|
303
|
+
basicResults.push(await runExperiment(false));
|
|
304
|
+
valueResults.push(await runExperiment(true));
|
|
305
|
+
}
|
|
306
|
+
const analyze = (results) => ({
|
|
307
|
+
avgCycles: results.reduce((s, r) => s + r.cycles, 0) / trials,
|
|
308
|
+
goalRate: results.filter(r => r.goalAchieved).length / trials * 100,
|
|
309
|
+
});
|
|
310
|
+
const basic = analyze(basicResults);
|
|
311
|
+
const value = analyze(valueResults);
|
|
312
|
+
console.log(' │ Basic Loop │ Value-Integrated');
|
|
313
|
+
console.log('────────────────────┼────────────┼──────────────────');
|
|
314
|
+
console.log(` Avg Cycles │ ${basic.avgCycles.toFixed(1).padStart(10)} │ ${value.avgCycles.toFixed(1).padStart(16)}`);
|
|
315
|
+
console.log(` Goal Achieved % │ ${basic.goalRate.toFixed(0).padStart(9)}% │ ${value.goalRate.toFixed(0).padStart(15)}%`);
|
|
316
|
+
console.log('\nAction distribution (last trial):');
|
|
317
|
+
const lastBasic = basicResults[basicResults.length - 1].actions;
|
|
318
|
+
const lastValue = valueResults[valueResults.length - 1].actions;
|
|
319
|
+
for (const action of types_js_1.ACTIONS) {
|
|
320
|
+
const b = lastBasic[action] || 0;
|
|
321
|
+
const v = lastValue[action] || 0;
|
|
322
|
+
if (b > 0 || v > 0) {
|
|
323
|
+
console.log(` ${action.padEnd(14)} │ ${b.toString().padStart(10)} │ ${v.toString().padStart(16)}`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// ============================================================================
|
|
328
|
+
// Main
|
|
329
|
+
// ============================================================================
|
|
330
|
+
async function main() {
|
|
331
|
+
console.log('\n🔄 Genesis 6.2 - Autonomous Loop with Value Integration\n');
|
|
332
|
+
await demoBasicLoop();
|
|
333
|
+
await demoValueIntegratedLoop();
|
|
334
|
+
await demoRecoveryScenario();
|
|
335
|
+
await demoComparison();
|
|
336
|
+
console.log('\n✓ All demos complete!\n');
|
|
337
|
+
}
|
|
338
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Demo: Value-Augmented Active Inference
|
|
4
|
+
*
|
|
5
|
+
* Shows the ValueAugmentedEngine combining POMDP beliefs with value function.
|
|
6
|
+
*
|
|
7
|
+
* Run: node dist/src/active-inference/demo-value-integration.js
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const value_integration_js_1 = require("./value-integration.js");
|
|
11
|
+
const types_js_1 = require("./types.js");
|
|
12
|
+
const scenarios = [
|
|
13
|
+
{
|
|
14
|
+
name: 'Critical Energy',
|
|
15
|
+
description: 'Energy depleted, needs immediate recharge',
|
|
16
|
+
observation: { energy: 0, phi: 1, tool: 1, coherence: 1, task: 1 },
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'Optimal State',
|
|
20
|
+
description: 'High energy, stable, at attractor (Wu Wei)',
|
|
21
|
+
observation: { energy: 4, phi: 3, tool: 1, coherence: 2, task: 3 },
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'Task Blocked',
|
|
25
|
+
description: 'Normal energy but task is blocked',
|
|
26
|
+
observation: { energy: 2, phi: 2, tool: 2, coherence: 1, task: 2 },
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Low Coherence',
|
|
30
|
+
description: 'Need to sense/explore to understand world',
|
|
31
|
+
observation: { energy: 3, phi: 0, tool: 0, coherence: 0, task: 0 },
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'Ready to Execute',
|
|
35
|
+
description: 'High energy, good coherence, task active',
|
|
36
|
+
observation: { energy: 3, phi: 2, tool: 1, coherence: 2, task: 1 },
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
// ============================================================================
|
|
40
|
+
// Visualization
|
|
41
|
+
// ============================================================================
|
|
42
|
+
function bar(value, max = 1, width = 20) {
|
|
43
|
+
const filled = Math.round((value / max) * width);
|
|
44
|
+
return '█'.repeat(filled) + '░'.repeat(width - filled);
|
|
45
|
+
}
|
|
46
|
+
function formatPolicy(policy) {
|
|
47
|
+
const lines = [];
|
|
48
|
+
for (let i = 0; i < policy.length; i++) {
|
|
49
|
+
const action = types_js_1.ACTIONS[i];
|
|
50
|
+
const prob = policy[i];
|
|
51
|
+
lines.push(` ${action.padEnd(14)} ${bar(prob)} ${(prob * 100).toFixed(1)}%`);
|
|
52
|
+
}
|
|
53
|
+
return lines.join('\n');
|
|
54
|
+
}
|
|
55
|
+
function formatBeliefs(beliefs) {
|
|
56
|
+
const lines = [];
|
|
57
|
+
// Viability
|
|
58
|
+
const viabilityLabels = ['critical', 'low', 'medium', 'high', 'optimal'];
|
|
59
|
+
const maxVia = beliefs.viability.indexOf(Math.max(...beliefs.viability));
|
|
60
|
+
lines.push(` Viability: ${viabilityLabels[maxVia]} (${(beliefs.viability[maxVia] * 100).toFixed(0)}%)`);
|
|
61
|
+
// World State
|
|
62
|
+
const worldLabels = ['unknown', 'stable', 'changing', 'chaotic'];
|
|
63
|
+
const maxWorld = beliefs.worldState.indexOf(Math.max(...beliefs.worldState));
|
|
64
|
+
lines.push(` World State: ${worldLabels[maxWorld]} (${(beliefs.worldState[maxWorld] * 100).toFixed(0)}%)`);
|
|
65
|
+
// Coupling
|
|
66
|
+
const couplingLabels = ['none', 'weak', 'moderate', 'strong', 'synced'];
|
|
67
|
+
const maxCoup = beliefs.coupling.indexOf(Math.max(...beliefs.coupling));
|
|
68
|
+
lines.push(` Coupling: ${couplingLabels[maxCoup]} (${(beliefs.coupling[maxCoup] * 100).toFixed(0)}%)`);
|
|
69
|
+
// Goal Progress
|
|
70
|
+
const goalLabels = ['blocked', 'slow', 'onTrack', 'achieved'];
|
|
71
|
+
const maxGoal = beliefs.goalProgress.indexOf(Math.max(...beliefs.goalProgress));
|
|
72
|
+
lines.push(` Goal: ${goalLabels[maxGoal]} (${(beliefs.goalProgress[maxGoal] * 100).toFixed(0)}%)`);
|
|
73
|
+
return lines.join('\n');
|
|
74
|
+
}
|
|
75
|
+
function formatValue(value) {
|
|
76
|
+
const lines = [];
|
|
77
|
+
lines.push(` Total Value: ${value.value.toFixed(3)}`);
|
|
78
|
+
lines.push(` Components:`);
|
|
79
|
+
for (const [key, val] of Object.entries(value.components)) {
|
|
80
|
+
lines.push(` ${key.padEnd(12)} ${val.toFixed(3)}`);
|
|
81
|
+
}
|
|
82
|
+
return lines.join('\n');
|
|
83
|
+
}
|
|
84
|
+
// ============================================================================
|
|
85
|
+
// Demo Runner
|
|
86
|
+
// ============================================================================
|
|
87
|
+
async function runDemo() {
|
|
88
|
+
console.log('╔═══════════════════════════════════════════════════════════════╗');
|
|
89
|
+
console.log('║ Genesis 6.2 - Value-Augmented Active Inference Demo ║');
|
|
90
|
+
console.log('╚═══════════════════════════════════════════════════════════════╝\n');
|
|
91
|
+
console.log('Creating ValueAugmentedEngine...');
|
|
92
|
+
const engine = (0, value_integration_js_1.createValueAugmentedEngine)({ verbose: false });
|
|
93
|
+
console.log('Policy formula: π(a|s) ∝ exp(-EFE(a) + λ·V(s\'))\n');
|
|
94
|
+
console.log('─'.repeat(65));
|
|
95
|
+
for (const scenario of scenarios) {
|
|
96
|
+
console.log(`\n📍 Scenario: ${scenario.name}`);
|
|
97
|
+
console.log(` ${scenario.description}\n`);
|
|
98
|
+
// Show observation
|
|
99
|
+
console.log('Observation:');
|
|
100
|
+
console.log(` energy=${scenario.observation.energy} phi=${scenario.observation.phi} ` +
|
|
101
|
+
`tool=${scenario.observation.tool} coherence=${scenario.observation.coherence} ` +
|
|
102
|
+
`task=${scenario.observation.task}\n`);
|
|
103
|
+
// Run inference
|
|
104
|
+
const result = await engine.step(scenario.observation);
|
|
105
|
+
// Show beliefs
|
|
106
|
+
console.log('Beliefs (after inference):');
|
|
107
|
+
console.log(formatBeliefs(result.beliefs));
|
|
108
|
+
console.log();
|
|
109
|
+
// Show value
|
|
110
|
+
console.log('Value Estimate:');
|
|
111
|
+
console.log(formatValue(result.value));
|
|
112
|
+
console.log();
|
|
113
|
+
// Show policy
|
|
114
|
+
console.log('Value-Augmented Policy:');
|
|
115
|
+
console.log(formatPolicy(result.policy));
|
|
116
|
+
console.log();
|
|
117
|
+
// Show selected action
|
|
118
|
+
console.log(`➤ Selected Action: ${result.action}`);
|
|
119
|
+
console.log('─'.repeat(65));
|
|
120
|
+
}
|
|
121
|
+
// Multi-step demonstration
|
|
122
|
+
console.log('\n\n╔═══════════════════════════════════════════════════════════════╗');
|
|
123
|
+
console.log('║ Multi-Step Inference Demonstration ║');
|
|
124
|
+
console.log('╚═══════════════════════════════════════════════════════════════╝\n');
|
|
125
|
+
const engine2 = (0, value_integration_js_1.createValueAugmentedEngine)();
|
|
126
|
+
// Simulate energy recovery scenario
|
|
127
|
+
const recoverySequence = [
|
|
128
|
+
{ energy: 0, phi: 1, tool: 1, coherence: 1, task: 1 }, // Critical
|
|
129
|
+
{ energy: 1, phi: 1, tool: 1, coherence: 1, task: 1 }, // Low (after recharge)
|
|
130
|
+
{ energy: 2, phi: 2, tool: 1, coherence: 1, task: 1 }, // Normal
|
|
131
|
+
{ energy: 3, phi: 2, tool: 1, coherence: 2, task: 1 }, // High
|
|
132
|
+
{ energy: 4, phi: 3, tool: 1, coherence: 2, task: 3 }, // Optimal + Task done
|
|
133
|
+
];
|
|
134
|
+
console.log('Simulating energy recovery scenario...\n');
|
|
135
|
+
console.log('Step │ Energy │ Action │ Value │ Top Policy');
|
|
136
|
+
console.log('─────┼────────┼────────────────┼─────────┼──────────────────');
|
|
137
|
+
for (let i = 0; i < recoverySequence.length; i++) {
|
|
138
|
+
const obs = recoverySequence[i];
|
|
139
|
+
const result = await engine2.step(obs);
|
|
140
|
+
// Find top 2 actions
|
|
141
|
+
const sorted = result.policy
|
|
142
|
+
.map((p, idx) => ({ action: types_js_1.ACTIONS[idx], prob: p }))
|
|
143
|
+
.sort((a, b) => b.prob - a.prob)
|
|
144
|
+
.slice(0, 2);
|
|
145
|
+
const topPolicy = sorted.map(s => `${s.action.split('.')[0]}:${(s.prob * 100).toFixed(0)}%`).join(' ');
|
|
146
|
+
console.log(` ${(i + 1).toString().padStart(2)} │ ${obs.energy} │ ${result.action.padEnd(14)} │ ${result.value.value.toFixed(3).padStart(7)} │ ${topPolicy}`);
|
|
147
|
+
}
|
|
148
|
+
// Show final stats
|
|
149
|
+
const stats = engine2.getStats();
|
|
150
|
+
console.log('\n─'.repeat(65));
|
|
151
|
+
console.log('\nFinal Statistics:');
|
|
152
|
+
console.log(` Cycles: ${stats.cycleCount}`);
|
|
153
|
+
console.log(` Avg Value: ${stats.averageValue.toFixed(3)}`);
|
|
154
|
+
console.log(` Value Updates: ${stats.valueUpdates}`);
|
|
155
|
+
// Demo with JEPA
|
|
156
|
+
console.log('\n\n╔═══════════════════════════════════════════════════════════════╗');
|
|
157
|
+
console.log('║ Full Integration with JEPA ║');
|
|
158
|
+
console.log('╚═══════════════════════════════════════════════════════════════╝\n');
|
|
159
|
+
console.log('Creating engine with JEPA world model...');
|
|
160
|
+
const fullEngine = await (0, value_integration_js_1.createFullyIntegratedEngine)({
|
|
161
|
+
useWorldModelPredictions: true,
|
|
162
|
+
predictionHorizon: 3,
|
|
163
|
+
});
|
|
164
|
+
const jepaObs = { energy: 2, phi: 2, tool: 1, coherence: 1, task: 1 };
|
|
165
|
+
console.log(`\nObservation: energy=${jepaObs.energy} phi=${jepaObs.phi} task=${jepaObs.task}`);
|
|
166
|
+
const jepaResult = await fullEngine.step(jepaObs);
|
|
167
|
+
console.log('\nWith JEPA trajectory predictions:');
|
|
168
|
+
console.log(` Selected Action: ${jepaResult.action}`);
|
|
169
|
+
console.log(` State Value: ${jepaResult.value.value.toFixed(3)}`);
|
|
170
|
+
console.log(` Trajectory Predictions: ${fullEngine.getStats().trajectoryPredictions}`);
|
|
171
|
+
console.log('\n✓ Demo complete!');
|
|
172
|
+
}
|
|
173
|
+
// Run
|
|
174
|
+
runDemo().catch(console.error);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Genesis 6.2 - Active Inference Module
|
|
3
|
+
*
|
|
4
|
+
* Autonomous decision-making via Free Energy Principle.
|
|
5
|
+
*
|
|
6
|
+
* This module enables Genesis to operate autonomously,
|
|
7
|
+
* making decisions through Active Inference math.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createAutonomousLoop, AutonomousLoop } from './active-inference/index.js';
|
|
12
|
+
*
|
|
13
|
+
* const loop = createAutonomousLoop();
|
|
14
|
+
*
|
|
15
|
+
* // Run N inference cycles
|
|
16
|
+
* await loop.run(100);
|
|
17
|
+
*
|
|
18
|
+
* // Get current beliefs
|
|
19
|
+
* const beliefs = loop.getBeliefs();
|
|
20
|
+
*
|
|
21
|
+
* // Get statistics
|
|
22
|
+
* const stats = loop.getStats();
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export * from './types.js';
|
|
26
|
+
export { ActiveInferenceEngine, createActiveInferenceEngine } from './core.js';
|
|
27
|
+
export { ObservationGatherer, createObservationGatherer, getObservationGatherer } from './observations.js';
|
|
28
|
+
export { ActionExecutorManager, createActionExecutorManager, getActionExecutorManager, executeAction, registerAction, type ActionResult, type ActionContext, } from './actions.js';
|
|
29
|
+
export { AutonomousLoop, createAutonomousLoop, getAutonomousLoop, resetAutonomousLoop, type AutonomousLoopConfig, type LoopStats, DEFAULT_LOOP_CONFIG, } from './autonomous-loop.js';
|
|
30
|
+
export { integrateActiveInference, createIntegratedSystem, createKernelObservationBridge, registerKernelActions, registerDaemonTask, createMCPObservationBridge, createMCPInferenceLoop, type IntegrationConfig, type IntegratedSystem, type MCPObservationConfig, } from './integration.js';
|
|
31
|
+
export { ValueAugmentedEngine, createValueAugmentedEngine, createFullyIntegratedEngine, createValueIntegratedLoop, type ValueIntegrationConfig, type ValueIntegrationEvent, type ValueIntegratedLoopConfig, DEFAULT_VALUE_INTEGRATION_CONFIG, } from './value-integration.js';
|
|
32
|
+
export { integrateMemory, getMemoryMetrics, getWorkspaceState, type MemoryIntegrationConfig, DEFAULT_MEMORY_INTEGRATION_CONFIG, } from './memory-integration.js';
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Genesis 6.2 - Active Inference Module
|
|
4
|
+
*
|
|
5
|
+
* Autonomous decision-making via Free Energy Principle.
|
|
6
|
+
*
|
|
7
|
+
* This module enables Genesis to operate autonomously,
|
|
8
|
+
* making decisions through Active Inference math.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { createAutonomousLoop, AutonomousLoop } from './active-inference/index.js';
|
|
13
|
+
*
|
|
14
|
+
* const loop = createAutonomousLoop();
|
|
15
|
+
*
|
|
16
|
+
* // Run N inference cycles
|
|
17
|
+
* await loop.run(100);
|
|
18
|
+
*
|
|
19
|
+
* // Get current beliefs
|
|
20
|
+
* const beliefs = loop.getBeliefs();
|
|
21
|
+
*
|
|
22
|
+
* // Get statistics
|
|
23
|
+
* const stats = loop.getStats();
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
+
if (k2 === undefined) k2 = k;
|
|
28
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
33
|
+
}) : (function(o, m, k, k2) {
|
|
34
|
+
if (k2 === undefined) k2 = k;
|
|
35
|
+
o[k2] = m[k];
|
|
36
|
+
}));
|
|
37
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
38
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.DEFAULT_MEMORY_INTEGRATION_CONFIG = exports.getWorkspaceState = exports.getMemoryMetrics = exports.integrateMemory = exports.DEFAULT_VALUE_INTEGRATION_CONFIG = exports.createValueIntegratedLoop = exports.createFullyIntegratedEngine = exports.createValueAugmentedEngine = exports.ValueAugmentedEngine = exports.createMCPInferenceLoop = exports.createMCPObservationBridge = exports.registerDaemonTask = exports.registerKernelActions = exports.createKernelObservationBridge = exports.createIntegratedSystem = exports.integrateActiveInference = exports.DEFAULT_LOOP_CONFIG = exports.resetAutonomousLoop = exports.getAutonomousLoop = exports.createAutonomousLoop = exports.AutonomousLoop = exports.registerAction = exports.executeAction = exports.getActionExecutorManager = exports.createActionExecutorManager = exports.ActionExecutorManager = exports.getObservationGatherer = exports.createObservationGatherer = exports.ObservationGatherer = exports.createActiveInferenceEngine = exports.ActiveInferenceEngine = void 0;
|
|
42
|
+
// Export types
|
|
43
|
+
__exportStar(require("./types.js"), exports);
|
|
44
|
+
// Export core components
|
|
45
|
+
var core_js_1 = require("./core.js");
|
|
46
|
+
Object.defineProperty(exports, "ActiveInferenceEngine", { enumerable: true, get: function () { return core_js_1.ActiveInferenceEngine; } });
|
|
47
|
+
Object.defineProperty(exports, "createActiveInferenceEngine", { enumerable: true, get: function () { return core_js_1.createActiveInferenceEngine; } });
|
|
48
|
+
var observations_js_1 = require("./observations.js");
|
|
49
|
+
Object.defineProperty(exports, "ObservationGatherer", { enumerable: true, get: function () { return observations_js_1.ObservationGatherer; } });
|
|
50
|
+
Object.defineProperty(exports, "createObservationGatherer", { enumerable: true, get: function () { return observations_js_1.createObservationGatherer; } });
|
|
51
|
+
Object.defineProperty(exports, "getObservationGatherer", { enumerable: true, get: function () { return observations_js_1.getObservationGatherer; } });
|
|
52
|
+
var actions_js_1 = require("./actions.js");
|
|
53
|
+
Object.defineProperty(exports, "ActionExecutorManager", { enumerable: true, get: function () { return actions_js_1.ActionExecutorManager; } });
|
|
54
|
+
Object.defineProperty(exports, "createActionExecutorManager", { enumerable: true, get: function () { return actions_js_1.createActionExecutorManager; } });
|
|
55
|
+
Object.defineProperty(exports, "getActionExecutorManager", { enumerable: true, get: function () { return actions_js_1.getActionExecutorManager; } });
|
|
56
|
+
Object.defineProperty(exports, "executeAction", { enumerable: true, get: function () { return actions_js_1.executeAction; } });
|
|
57
|
+
Object.defineProperty(exports, "registerAction", { enumerable: true, get: function () { return actions_js_1.registerAction; } });
|
|
58
|
+
// Export Autonomous Loop (extracted to avoid circular deps)
|
|
59
|
+
var autonomous_loop_js_1 = require("./autonomous-loop.js");
|
|
60
|
+
Object.defineProperty(exports, "AutonomousLoop", { enumerable: true, get: function () { return autonomous_loop_js_1.AutonomousLoop; } });
|
|
61
|
+
Object.defineProperty(exports, "createAutonomousLoop", { enumerable: true, get: function () { return autonomous_loop_js_1.createAutonomousLoop; } });
|
|
62
|
+
Object.defineProperty(exports, "getAutonomousLoop", { enumerable: true, get: function () { return autonomous_loop_js_1.getAutonomousLoop; } });
|
|
63
|
+
Object.defineProperty(exports, "resetAutonomousLoop", { enumerable: true, get: function () { return autonomous_loop_js_1.resetAutonomousLoop; } });
|
|
64
|
+
Object.defineProperty(exports, "DEFAULT_LOOP_CONFIG", { enumerable: true, get: function () { return autonomous_loop_js_1.DEFAULT_LOOP_CONFIG; } });
|
|
65
|
+
// Export integration with Kernel/Daemon
|
|
66
|
+
var integration_js_1 = require("./integration.js");
|
|
67
|
+
Object.defineProperty(exports, "integrateActiveInference", { enumerable: true, get: function () { return integration_js_1.integrateActiveInference; } });
|
|
68
|
+
Object.defineProperty(exports, "createIntegratedSystem", { enumerable: true, get: function () { return integration_js_1.createIntegratedSystem; } });
|
|
69
|
+
Object.defineProperty(exports, "createKernelObservationBridge", { enumerable: true, get: function () { return integration_js_1.createKernelObservationBridge; } });
|
|
70
|
+
Object.defineProperty(exports, "registerKernelActions", { enumerable: true, get: function () { return integration_js_1.registerKernelActions; } });
|
|
71
|
+
Object.defineProperty(exports, "registerDaemonTask", { enumerable: true, get: function () { return integration_js_1.registerDaemonTask; } });
|
|
72
|
+
// MCP integration (Genesis 6.3+)
|
|
73
|
+
Object.defineProperty(exports, "createMCPObservationBridge", { enumerable: true, get: function () { return integration_js_1.createMCPObservationBridge; } });
|
|
74
|
+
Object.defineProperty(exports, "createMCPInferenceLoop", { enumerable: true, get: function () { return integration_js_1.createMCPInferenceLoop; } });
|
|
75
|
+
// Export Value-Guided JEPA integration (Genesis 6.2)
|
|
76
|
+
// Note: createValueIntegratedLoop moved to value-integration.ts to avoid cycle
|
|
77
|
+
var value_integration_js_1 = require("./value-integration.js");
|
|
78
|
+
Object.defineProperty(exports, "ValueAugmentedEngine", { enumerable: true, get: function () { return value_integration_js_1.ValueAugmentedEngine; } });
|
|
79
|
+
Object.defineProperty(exports, "createValueAugmentedEngine", { enumerable: true, get: function () { return value_integration_js_1.createValueAugmentedEngine; } });
|
|
80
|
+
Object.defineProperty(exports, "createFullyIntegratedEngine", { enumerable: true, get: function () { return value_integration_js_1.createFullyIntegratedEngine; } });
|
|
81
|
+
Object.defineProperty(exports, "createValueIntegratedLoop", { enumerable: true, get: function () { return value_integration_js_1.createValueIntegratedLoop; } });
|
|
82
|
+
Object.defineProperty(exports, "DEFAULT_VALUE_INTEGRATION_CONFIG", { enumerable: true, get: function () { return value_integration_js_1.DEFAULT_VALUE_INTEGRATION_CONFIG; } });
|
|
83
|
+
// Export Memory 2.0 integration (Genesis 6.3)
|
|
84
|
+
var memory_integration_js_1 = require("./memory-integration.js");
|
|
85
|
+
Object.defineProperty(exports, "integrateMemory", { enumerable: true, get: function () { return memory_integration_js_1.integrateMemory; } });
|
|
86
|
+
Object.defineProperty(exports, "getMemoryMetrics", { enumerable: true, get: function () { return memory_integration_js_1.getMemoryMetrics; } });
|
|
87
|
+
Object.defineProperty(exports, "getWorkspaceState", { enumerable: true, get: function () { return memory_integration_js_1.getWorkspaceState; } });
|
|
88
|
+
Object.defineProperty(exports, "DEFAULT_MEMORY_INTEGRATION_CONFIG", { enumerable: true, get: function () { return memory_integration_js_1.DEFAULT_MEMORY_INTEGRATION_CONFIG; } });
|