genesis-ai-cli 13.11.0 → 13.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/morphogenetic/index.d.ts +279 -0
- package/dist/src/morphogenetic/index.js +748 -0
- package/dist/src/second-order/index.d.ts +223 -0
- package/dist/src/second-order/index.js +578 -0
- package/dist/src/semiotics/index.d.ts +216 -0
- package/dist/src/semiotics/index.js +622 -0
- package/dist/src/strange-loop/index.d.ts +189 -0
- package/dist/src/strange-loop/index.js +480 -0
- package/dist/src/symbiotic/index.d.ts +237 -0
- package/dist/src/symbiotic/index.js +538 -0
- package/dist/src/umwelt/index.d.ts +270 -0
- package/dist/src/umwelt/index.js +569 -0
- package/dist/test/phase7-strange-science.test.d.ts +12 -0
- package/dist/test/phase7-strange-science.test.js +691 -0
- package/package.json +1 -1
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Morphogenetic Module - Bio-inspired Self-Repair
|
|
3
|
+
*
|
|
4
|
+
* Implements Michael Levin's morphogenetic principles:
|
|
5
|
+
* - Target morphology (desired functional shape)
|
|
6
|
+
* - Bioelectric-inspired error signals
|
|
7
|
+
* - Cellular automata for collective repair
|
|
8
|
+
* - Self-correcting agent colonies
|
|
9
|
+
*
|
|
10
|
+
* Agents know their target state and work collectively
|
|
11
|
+
* to achieve and maintain it, like cells in a regenerating organism.
|
|
12
|
+
*
|
|
13
|
+
* Based on:
|
|
14
|
+
* - Michael Levin's bioelectric research
|
|
15
|
+
* - Neural Cellular Automata (NCA)
|
|
16
|
+
* - Morphogenetic fields
|
|
17
|
+
*/
|
|
18
|
+
import { EventEmitter } from 'events';
|
|
19
|
+
export interface Capability {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
level: number;
|
|
23
|
+
required: number;
|
|
24
|
+
dependencies: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface AgentMorphology {
|
|
27
|
+
capabilities: Map<string, Capability>;
|
|
28
|
+
connections: Map<string, string[]>;
|
|
29
|
+
position: number[];
|
|
30
|
+
health: number;
|
|
31
|
+
}
|
|
32
|
+
export interface TargetMorphology {
|
|
33
|
+
requiredCapabilities: Map<string, number>;
|
|
34
|
+
minHealth: number;
|
|
35
|
+
optimalConnections: number;
|
|
36
|
+
description: string;
|
|
37
|
+
}
|
|
38
|
+
export interface MorphogeneticError {
|
|
39
|
+
type: 'missing' | 'degraded' | 'disconnected' | 'excess';
|
|
40
|
+
capability?: string;
|
|
41
|
+
magnitude: number;
|
|
42
|
+
priority: number;
|
|
43
|
+
}
|
|
44
|
+
export interface RepairAction {
|
|
45
|
+
type: 'regenerate' | 'strengthen' | 'connect' | 'prune';
|
|
46
|
+
target: string;
|
|
47
|
+
parameters: Record<string, unknown>;
|
|
48
|
+
estimatedCost: number;
|
|
49
|
+
estimatedTime: number;
|
|
50
|
+
}
|
|
51
|
+
export interface CellState {
|
|
52
|
+
id: string;
|
|
53
|
+
type: CellType;
|
|
54
|
+
potential: number;
|
|
55
|
+
neighbors: string[];
|
|
56
|
+
alive: boolean;
|
|
57
|
+
age: number;
|
|
58
|
+
}
|
|
59
|
+
export type CellType = 'stem' | 'sensor' | 'processor' | 'effector' | 'memory' | 'communicator';
|
|
60
|
+
export interface MorphogeneticConfig {
|
|
61
|
+
errorThreshold: number;
|
|
62
|
+
degradationRate: number;
|
|
63
|
+
regenerationRate: number;
|
|
64
|
+
healingCost: number;
|
|
65
|
+
gridSize: number;
|
|
66
|
+
updateInterval: number;
|
|
67
|
+
minQuorum: number;
|
|
68
|
+
consensusThreshold: number;
|
|
69
|
+
}
|
|
70
|
+
export interface MorphogeneticMetrics {
|
|
71
|
+
totalErrors: number;
|
|
72
|
+
repairsAttempted: number;
|
|
73
|
+
repairsSucceeded: number;
|
|
74
|
+
regenerations: number;
|
|
75
|
+
currentHealth: number;
|
|
76
|
+
morphogeneticDistance: number;
|
|
77
|
+
}
|
|
78
|
+
export declare class MorphogeneticAgent extends EventEmitter {
|
|
79
|
+
readonly id: string;
|
|
80
|
+
private morphology;
|
|
81
|
+
private targetMorphology;
|
|
82
|
+
private config;
|
|
83
|
+
private errors;
|
|
84
|
+
private metrics;
|
|
85
|
+
constructor(id: string, targetMorphology: TargetMorphology, config?: Partial<MorphogeneticConfig>);
|
|
86
|
+
/**
|
|
87
|
+
* Initialize morphology from target
|
|
88
|
+
*/
|
|
89
|
+
private initializeMorphology;
|
|
90
|
+
/**
|
|
91
|
+
* Calculate morphogenetic error
|
|
92
|
+
* Returns distance from current state to target morphology
|
|
93
|
+
*/
|
|
94
|
+
morphogeneticError(): number;
|
|
95
|
+
/**
|
|
96
|
+
* Detect errors in current morphology
|
|
97
|
+
*/
|
|
98
|
+
detectErrors(): MorphogeneticError[];
|
|
99
|
+
/**
|
|
100
|
+
* Get missing capabilities
|
|
101
|
+
*/
|
|
102
|
+
missingCapabilities(): string[];
|
|
103
|
+
/**
|
|
104
|
+
* Self-correct toward target morphology
|
|
105
|
+
*/
|
|
106
|
+
selfCorrect(): RepairAction[];
|
|
107
|
+
/**
|
|
108
|
+
* Execute a repair action
|
|
109
|
+
*/
|
|
110
|
+
executeRepair(action: RepairAction): Promise<boolean>;
|
|
111
|
+
/**
|
|
112
|
+
* Regenerate a capability
|
|
113
|
+
*/
|
|
114
|
+
private regenerate;
|
|
115
|
+
/**
|
|
116
|
+
* Strengthen a capability or health
|
|
117
|
+
*/
|
|
118
|
+
private strengthen;
|
|
119
|
+
/**
|
|
120
|
+
* Connect to another capability/agent
|
|
121
|
+
*/
|
|
122
|
+
private connect;
|
|
123
|
+
/**
|
|
124
|
+
* Prune an excess capability
|
|
125
|
+
*/
|
|
126
|
+
private prune;
|
|
127
|
+
/**
|
|
128
|
+
* Update overall health based on capabilities
|
|
129
|
+
*/
|
|
130
|
+
private updateHealth;
|
|
131
|
+
/**
|
|
132
|
+
* Apply degradation over time
|
|
133
|
+
*/
|
|
134
|
+
degrade(): void;
|
|
135
|
+
/**
|
|
136
|
+
* Get current morphology
|
|
137
|
+
*/
|
|
138
|
+
getMorphology(): AgentMorphology;
|
|
139
|
+
/**
|
|
140
|
+
* Get target morphology
|
|
141
|
+
*/
|
|
142
|
+
getTarget(): TargetMorphology;
|
|
143
|
+
/**
|
|
144
|
+
* Get metrics
|
|
145
|
+
*/
|
|
146
|
+
getMetrics(): MorphogeneticMetrics;
|
|
147
|
+
/**
|
|
148
|
+
* Get current errors
|
|
149
|
+
*/
|
|
150
|
+
getErrors(): MorphogeneticError[];
|
|
151
|
+
/**
|
|
152
|
+
* Helper delay function
|
|
153
|
+
*/
|
|
154
|
+
private delay;
|
|
155
|
+
}
|
|
156
|
+
export declare class NeuralCellularAutomata extends EventEmitter {
|
|
157
|
+
private grid;
|
|
158
|
+
private config;
|
|
159
|
+
private generation;
|
|
160
|
+
private targetPattern;
|
|
161
|
+
constructor(config?: Partial<MorphogeneticConfig>);
|
|
162
|
+
/**
|
|
163
|
+
* Initialize grid with stem cells
|
|
164
|
+
*/
|
|
165
|
+
private initializeGrid;
|
|
166
|
+
/**
|
|
167
|
+
* Get neighbor cell IDs
|
|
168
|
+
*/
|
|
169
|
+
private getNeighborIds;
|
|
170
|
+
/**
|
|
171
|
+
* Set target pattern
|
|
172
|
+
*/
|
|
173
|
+
setTargetPattern(pattern: Map<string, CellType>): void;
|
|
174
|
+
/**
|
|
175
|
+
* Update one generation
|
|
176
|
+
*/
|
|
177
|
+
step(): void;
|
|
178
|
+
/**
|
|
179
|
+
* Update single cell based on neighbors
|
|
180
|
+
*/
|
|
181
|
+
private updateCell;
|
|
182
|
+
/**
|
|
183
|
+
* Differentiate stem cell based on potential and neighbors
|
|
184
|
+
*/
|
|
185
|
+
private differentiate;
|
|
186
|
+
/**
|
|
187
|
+
* Calculate distance from target pattern
|
|
188
|
+
*/
|
|
189
|
+
patternError(): number;
|
|
190
|
+
/**
|
|
191
|
+
* Run until pattern converges or max generations
|
|
192
|
+
*/
|
|
193
|
+
runUntilConverged(maxGenerations?: number): Promise<number>;
|
|
194
|
+
/**
|
|
195
|
+
* Get grid state
|
|
196
|
+
*/
|
|
197
|
+
getGrid(): Map<string, CellState>;
|
|
198
|
+
/**
|
|
199
|
+
* Get cell at position
|
|
200
|
+
*/
|
|
201
|
+
getCell(x: number, y: number): CellState | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* Get generation count
|
|
204
|
+
*/
|
|
205
|
+
getGeneration(): number;
|
|
206
|
+
/**
|
|
207
|
+
* Count cells by type
|
|
208
|
+
*/
|
|
209
|
+
getCellCounts(): Map<CellType, number>;
|
|
210
|
+
/**
|
|
211
|
+
* Reset grid
|
|
212
|
+
*/
|
|
213
|
+
reset(): void;
|
|
214
|
+
}
|
|
215
|
+
export declare class AgentColony extends EventEmitter {
|
|
216
|
+
private agents;
|
|
217
|
+
private config;
|
|
218
|
+
private sharedKnowledge;
|
|
219
|
+
constructor(config?: Partial<MorphogeneticConfig>);
|
|
220
|
+
/**
|
|
221
|
+
* Add agent to colony
|
|
222
|
+
*/
|
|
223
|
+
addAgent(agent: MorphogeneticAgent): void;
|
|
224
|
+
/**
|
|
225
|
+
* Remove agent from colony
|
|
226
|
+
*/
|
|
227
|
+
removeAgent(id: string): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Share knowledge across colony
|
|
230
|
+
*/
|
|
231
|
+
shareKnowledge(key: string, value: unknown): void;
|
|
232
|
+
/**
|
|
233
|
+
* Collective repair - agents work together
|
|
234
|
+
*/
|
|
235
|
+
solveCollectively(problem: string): Promise<{
|
|
236
|
+
success: boolean;
|
|
237
|
+
solution: unknown;
|
|
238
|
+
}>;
|
|
239
|
+
/**
|
|
240
|
+
* Find consensus among agent proposals
|
|
241
|
+
*/
|
|
242
|
+
private findConsensus;
|
|
243
|
+
/**
|
|
244
|
+
* Get colony health (average agent health)
|
|
245
|
+
*/
|
|
246
|
+
getColonyHealth(): number;
|
|
247
|
+
/**
|
|
248
|
+
* Get all agents
|
|
249
|
+
*/
|
|
250
|
+
getAgents(): MorphogeneticAgent[];
|
|
251
|
+
/**
|
|
252
|
+
* Get shared knowledge
|
|
253
|
+
*/
|
|
254
|
+
getSharedKnowledge(): Map<string, unknown>;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Create a target morphology
|
|
258
|
+
*/
|
|
259
|
+
export declare function createTargetMorphology(capabilities: Record<string, number>, minHealth?: number, description?: string): TargetMorphology;
|
|
260
|
+
/**
|
|
261
|
+
* Create a morphogenetic agent
|
|
262
|
+
*/
|
|
263
|
+
export declare function createMorphogeneticAgent(id: string, capabilities: Record<string, number>, config?: Partial<MorphogeneticConfig>): MorphogeneticAgent;
|
|
264
|
+
/**
|
|
265
|
+
* Get global agent colony
|
|
266
|
+
*/
|
|
267
|
+
export declare function getColony(config?: Partial<MorphogeneticConfig>): AgentColony;
|
|
268
|
+
/**
|
|
269
|
+
* Reset global colony
|
|
270
|
+
*/
|
|
271
|
+
export declare function resetColony(): void;
|
|
272
|
+
/**
|
|
273
|
+
* Get global NCA
|
|
274
|
+
*/
|
|
275
|
+
export declare function getNCA(config?: Partial<MorphogeneticConfig>): NeuralCellularAutomata;
|
|
276
|
+
/**
|
|
277
|
+
* Reset global NCA
|
|
278
|
+
*/
|
|
279
|
+
export declare function resetNCA(): void;
|