@getanima/core 0.1.0 → 0.2.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/README.md +148 -113
- package/dist/alme/core/KnowledgeGraph.d.ts +58 -0
- package/dist/alme/core/KnowledgeGraph.d.ts.map +1 -0
- package/dist/alme/core/KnowledgeGraph.js +114 -0
- package/dist/alme/core/KnowledgeGraph.js.map +1 -0
- package/dist/alme/core/MetacognitionEngine.d.ts +35 -0
- package/dist/alme/core/MetacognitionEngine.d.ts.map +1 -0
- package/dist/alme/core/MetacognitionEngine.js +90 -0
- package/dist/alme/core/MetacognitionEngine.js.map +1 -0
- package/dist/alme/core/PerformanceAnalyzer.d.ts +68 -0
- package/dist/alme/core/PerformanceAnalyzer.d.ts.map +1 -0
- package/dist/alme/core/PerformanceAnalyzer.js +142 -0
- package/dist/alme/core/PerformanceAnalyzer.js.map +1 -0
- package/dist/alme/core/SelfReflectionModule.d.ts +41 -0
- package/dist/alme/core/SelfReflectionModule.d.ts.map +1 -0
- package/dist/alme/core/SelfReflectionModule.js +101 -0
- package/dist/alme/core/SelfReflectionModule.js.map +1 -0
- package/dist/alme/core/SkillProfile.d.ts +52 -0
- package/dist/alme/core/SkillProfile.d.ts.map +1 -0
- package/dist/alme/core/SkillProfile.js +97 -0
- package/dist/alme/core/SkillProfile.js.map +1 -0
- package/dist/anima.d.ts +57 -0
- package/dist/anima.d.ts.map +1 -1
- package/dist/anima.js +106 -8
- package/dist/anima.js.map +1 -1
- package/dist/codegen/ArchitecturalDesignGenerator.d.ts +77 -0
- package/dist/codegen/ArchitecturalDesignGenerator.d.ts.map +1 -0
- package/dist/codegen/ArchitecturalDesignGenerator.js +194 -0
- package/dist/codegen/ArchitecturalDesignGenerator.js.map +1 -0
- package/dist/codegen/ContextAwareGenerator.d.ts +67 -0
- package/dist/codegen/ContextAwareGenerator.d.ts.map +1 -0
- package/dist/codegen/ContextAwareGenerator.js +158 -0
- package/dist/codegen/ContextAwareGenerator.js.map +1 -0
- package/dist/codegen/SystemInteractionSimulator.d.ts +87 -0
- package/dist/codegen/SystemInteractionSimulator.d.ts.map +1 -0
- package/dist/codegen/SystemInteractionSimulator.js +203 -0
- package/dist/codegen/SystemInteractionSimulator.js.map +1 -0
- package/dist/codegen/multiStageCodegen.d.ts +30 -0
- package/dist/codegen/multiStageCodegen.d.ts.map +1 -0
- package/dist/codegen/multiStageCodegen.js +60 -0
- package/dist/codegen/multiStageCodegen.js.map +1 -0
- package/dist/esm/anima.js +340 -0
- package/dist/esm/anima.js.map +1 -0
- package/dist/esm/identity.js +205 -0
- package/dist/esm/identity.js.map +1 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/memory.js +429 -0
- package/dist/esm/memory.js.map +1 -0
- package/dist/esm/reflection.js +86 -0
- package/dist/esm/reflection.js.map +1 -0
- package/dist/esm/signing.js +194 -0
- package/dist/esm/signing.js.map +1 -0
- package/dist/esm/types.js +6 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils.js +155 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/ideation/InnovationEngine.d.ts +47 -0
- package/dist/ideation/InnovationEngine.d.ts.map +1 -0
- package/dist/ideation/InnovationEngine.js +127 -0
- package/dist/ideation/InnovationEngine.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/learning-tracker/LearningVisualizer.d.ts +26 -0
- package/dist/learning-tracker/LearningVisualizer.d.ts.map +1 -0
- package/dist/learning-tracker/LearningVisualizer.js +61 -0
- package/dist/learning-tracker/LearningVisualizer.js.map +1 -0
- package/dist/memory.d.ts +28 -0
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +77 -0
- package/dist/memory.js.map +1 -1
- package/dist/signing.d.ts +96 -0
- package/dist/signing.d.ts.map +1 -0
- package/dist/signing.js +231 -0
- package/dist/signing.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +8 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +28 -9
- package/dist/utils.js.map +1 -1
- package/package.json +5 -2
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity Signing — cryptographic proof that an agent is who they claim to be.
|
|
3
|
+
*
|
|
4
|
+
* Uses Node.js built-in crypto (Ed25519) — no external dependencies.
|
|
5
|
+
*
|
|
6
|
+
* Flow:
|
|
7
|
+
* 1. Agent boots → generates key pair (or loads existing)
|
|
8
|
+
* 2. Agent signs their identity files → produces a signature bundle
|
|
9
|
+
* 3. Any other agent can verify: "this identity was created by this key and hasn't been tampered with"
|
|
10
|
+
*
|
|
11
|
+
* This is NOT blockchain. It's just public-key cryptography.
|
|
12
|
+
* Simple, fast, and solves the Moltbook impersonation problem.
|
|
13
|
+
*/
|
|
14
|
+
import { generateKeyPairSync, sign, verify, createHash } from 'crypto';
|
|
15
|
+
import { readFileSafe, writeFileSafe, now } from './utils';
|
|
16
|
+
import { join } from 'path';
|
|
17
|
+
// ============ HELPERS ============
|
|
18
|
+
/** Canonical JSON — deterministic serialization for signing */
|
|
19
|
+
function canonicalize(obj) {
|
|
20
|
+
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
21
|
+
}
|
|
22
|
+
/** SHA-256 fingerprint of a public key */
|
|
23
|
+
function fingerprint(publicKeyBase64) {
|
|
24
|
+
const hash = createHash('sha256').update(publicKeyBase64).digest('hex');
|
|
25
|
+
// Format as colon-separated pairs for readability: ab:cd:ef:...
|
|
26
|
+
return hash.match(/.{2}/g).slice(0, 16).join(':');
|
|
27
|
+
}
|
|
28
|
+
// ============ SIGNING ENGINE ============
|
|
29
|
+
export class SigningEngine {
|
|
30
|
+
storagePath;
|
|
31
|
+
privateKey = null;
|
|
32
|
+
publicKey = null;
|
|
33
|
+
keyBundle = null;
|
|
34
|
+
constructor(storagePath) {
|
|
35
|
+
this.storagePath = storagePath;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Initialize signing — loads existing keys or generates new ones.
|
|
39
|
+
* Call this once during agent boot.
|
|
40
|
+
*/
|
|
41
|
+
async init(agentName) {
|
|
42
|
+
const keysPath = join(this.storagePath, '.keys');
|
|
43
|
+
const bundlePath = join(keysPath, 'key-bundle.json');
|
|
44
|
+
const privatePath = join(keysPath, 'private.pem');
|
|
45
|
+
const publicPath = join(keysPath, 'public.pem');
|
|
46
|
+
// Try to load existing keys
|
|
47
|
+
const existingBundle = await readFileSafe(bundlePath);
|
|
48
|
+
const existingPrivate = await readFileSafe(privatePath);
|
|
49
|
+
const existingPublic = await readFileSafe(publicPath);
|
|
50
|
+
if (existingBundle && existingPrivate && existingPublic) {
|
|
51
|
+
try {
|
|
52
|
+
const { createPrivateKey, createPublicKey } = await import('crypto');
|
|
53
|
+
this.privateKey = createPrivateKey(existingPrivate);
|
|
54
|
+
this.publicKey = createPublicKey(existingPublic);
|
|
55
|
+
this.keyBundle = JSON.parse(existingBundle);
|
|
56
|
+
return this.keyBundle;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
console.warn('[anima/signing] Corrupted keys, regenerating...');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Generate new Ed25519 key pair
|
|
63
|
+
const { publicKey, privateKey } = generateKeyPairSync('ed25519');
|
|
64
|
+
this.privateKey = privateKey;
|
|
65
|
+
this.publicKey = publicKey;
|
|
66
|
+
const pubKeyBase64 = publicKey.export({ type: 'spki', format: 'pem' }).toString();
|
|
67
|
+
const privKeyPem = privateKey.export({ type: 'pkcs8', format: 'pem' }).toString();
|
|
68
|
+
const pubKeyPem = publicKey.export({ type: 'spki', format: 'pem' }).toString();
|
|
69
|
+
// Extract raw public key bytes for fingerprinting
|
|
70
|
+
const pubKeyDer = publicKey.export({ type: 'spki', format: 'der' });
|
|
71
|
+
const pubKeyB64 = pubKeyDer.toString('base64');
|
|
72
|
+
this.keyBundle = {
|
|
73
|
+
publicKey: pubKeyB64,
|
|
74
|
+
fingerprint: fingerprint(pubKeyB64),
|
|
75
|
+
createdAt: now(),
|
|
76
|
+
agentName,
|
|
77
|
+
};
|
|
78
|
+
// Save keys
|
|
79
|
+
await writeFileSafe(privatePath, privKeyPem);
|
|
80
|
+
await writeFileSafe(publicPath, pubKeyPem);
|
|
81
|
+
await writeFileSafe(bundlePath, JSON.stringify(this.keyBundle, null, 2));
|
|
82
|
+
return this.keyBundle;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Sign an identity — produces a verifiable signature bundle.
|
|
86
|
+
* This proves: "I, the holder of this private key, attest that this is my identity."
|
|
87
|
+
*/
|
|
88
|
+
signIdentity(identity) {
|
|
89
|
+
if (!this.privateKey || !this.keyBundle) {
|
|
90
|
+
throw new Error('[anima/signing] Not initialized. Call init() first.');
|
|
91
|
+
}
|
|
92
|
+
const canonical = canonicalize(identity);
|
|
93
|
+
const signature = sign(null, Buffer.from(canonical), this.privateKey);
|
|
94
|
+
return {
|
|
95
|
+
identity,
|
|
96
|
+
signature: signature.toString('base64'),
|
|
97
|
+
signerFingerprint: this.keyBundle.fingerprint,
|
|
98
|
+
signerPublicKey: this.keyBundle.publicKey,
|
|
99
|
+
signedAt: now(),
|
|
100
|
+
version: '0.1.0',
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Sign arbitrary data — for signing memories, opinions, messages, etc.
|
|
105
|
+
* Returns base64 signature.
|
|
106
|
+
*/
|
|
107
|
+
signData(data) {
|
|
108
|
+
if (!this.privateKey) {
|
|
109
|
+
throw new Error('[anima/signing] Not initialized. Call init() first.');
|
|
110
|
+
}
|
|
111
|
+
return sign(null, Buffer.from(data), this.privateKey).toString('base64');
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Verify a signed identity — checks that:
|
|
115
|
+
* 1. The signature matches the identity data
|
|
116
|
+
* 2. The identity hasn't been tampered with
|
|
117
|
+
*
|
|
118
|
+
* This is a STATIC method — any agent can verify without needing their own keys.
|
|
119
|
+
*/
|
|
120
|
+
static verifyIdentity(signed) {
|
|
121
|
+
try {
|
|
122
|
+
const { createPublicKey } = require('crypto');
|
|
123
|
+
// Reconstruct public key from the bundle
|
|
124
|
+
const pubKeyBuffer = Buffer.from(signed.signerPublicKey, 'base64');
|
|
125
|
+
const publicKey = createPublicKey({
|
|
126
|
+
key: pubKeyBuffer,
|
|
127
|
+
format: 'der',
|
|
128
|
+
type: 'spki',
|
|
129
|
+
});
|
|
130
|
+
// Verify signature against canonical identity
|
|
131
|
+
const canonical = canonicalize(signed.identity);
|
|
132
|
+
const signatureBuffer = Buffer.from(signed.signature, 'base64');
|
|
133
|
+
const valid = verify(null, Buffer.from(canonical), publicKey, signatureBuffer);
|
|
134
|
+
// Verify fingerprint matches public key
|
|
135
|
+
const expectedFingerprint = fingerprint(signed.signerPublicKey);
|
|
136
|
+
const fingerprintMatch = expectedFingerprint === signed.signerFingerprint;
|
|
137
|
+
if (!fingerprintMatch) {
|
|
138
|
+
return {
|
|
139
|
+
valid: false,
|
|
140
|
+
signerFingerprint: signed.signerFingerprint,
|
|
141
|
+
agentName: signed.identity.name,
|
|
142
|
+
signedAt: signed.signedAt,
|
|
143
|
+
reason: 'Fingerprint mismatch — public key does not match claimed fingerprint',
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
valid,
|
|
148
|
+
signerFingerprint: signed.signerFingerprint,
|
|
149
|
+
agentName: signed.identity.name,
|
|
150
|
+
signedAt: signed.signedAt,
|
|
151
|
+
reason: valid ? undefined : 'Signature verification failed — identity may have been tampered with',
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
return {
|
|
156
|
+
valid: false,
|
|
157
|
+
signerFingerprint: signed.signerFingerprint,
|
|
158
|
+
agentName: signed.identity.name,
|
|
159
|
+
signedAt: signed.signedAt,
|
|
160
|
+
reason: `Verification error: ${err.message}`,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Export the public key bundle — share this with other agents for verification.
|
|
166
|
+
* Never includes the private key.
|
|
167
|
+
*/
|
|
168
|
+
getKeyBundle() {
|
|
169
|
+
if (!this.keyBundle) {
|
|
170
|
+
throw new Error('[anima/signing] Not initialized. Call init() first.');
|
|
171
|
+
}
|
|
172
|
+
return { ...this.keyBundle };
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Get the fingerprint — a human-readable identifier for this agent's key.
|
|
176
|
+
* Like SSH fingerprints: "ab:cd:ef:12:34:..."
|
|
177
|
+
*/
|
|
178
|
+
getFingerprint() {
|
|
179
|
+
if (!this.keyBundle) {
|
|
180
|
+
throw new Error('[anima/signing] Not initialized. Call init() first.');
|
|
181
|
+
}
|
|
182
|
+
return this.keyBundle.fingerprint;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Save a signed identity to disk — produces a .signed.json file
|
|
186
|
+
* that any agent can independently verify.
|
|
187
|
+
*/
|
|
188
|
+
async saveSignedIdentity(signed) {
|
|
189
|
+
const outPath = join(this.storagePath, 'identity.signed.json');
|
|
190
|
+
await writeFileSafe(outPath, JSON.stringify(signed, null, 2));
|
|
191
|
+
return outPath;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=signing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing.js","sourceRoot":"","sources":["../../src/signing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAa,MAAM,QAAQ,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AA4C5B,o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D,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities — file I/O, ID generation, date helpers.
|
|
3
|
+
* Zero external dependencies. Node.js built-ins only.
|
|
4
|
+
*/
|
|
5
|
+
import { readFile, writeFile, mkdir, readdir } from 'fs/promises';
|
|
6
|
+
import { existsSync } from 'fs';
|
|
7
|
+
import { dirname } from 'path';
|
|
8
|
+
import { randomUUID } from 'crypto';
|
|
9
|
+
/** Generate a unique ID */
|
|
10
|
+
export function uid() {
|
|
11
|
+
return randomUUID();
|
|
12
|
+
}
|
|
13
|
+
/** Generate a session ID */
|
|
14
|
+
export function sessionId() {
|
|
15
|
+
return `session_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
|
|
16
|
+
}
|
|
17
|
+
/** ISO timestamp */
|
|
18
|
+
export function now() {
|
|
19
|
+
return new Date().toISOString();
|
|
20
|
+
}
|
|
21
|
+
/** Format date as YYYY-MM-DD in local timezone (or ANIMA_TZ env) */
|
|
22
|
+
export function dateKey(date) {
|
|
23
|
+
const d = date || new Date();
|
|
24
|
+
const tz = process.env.ANIMA_TZ || Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
25
|
+
try {
|
|
26
|
+
// Use Intl to get locale-correct date parts
|
|
27
|
+
const parts = new Intl.DateTimeFormat('en-CA', { timeZone: tz, year: 'numeric', month: '2-digit', day: '2-digit' }).format(d);
|
|
28
|
+
return parts; // en-CA formats as YYYY-MM-DD
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return d.toISOString().split('T')[0];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Yesterday's date key */
|
|
35
|
+
export function yesterdayKey() {
|
|
36
|
+
const d = new Date();
|
|
37
|
+
d.setDate(d.getDate() - 1);
|
|
38
|
+
return dateKey(d);
|
|
39
|
+
}
|
|
40
|
+
/** Ensure a directory exists */
|
|
41
|
+
export async function ensureDir(dirPath) {
|
|
42
|
+
if (!existsSync(dirPath)) {
|
|
43
|
+
await mkdir(dirPath, { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Read a file, return null if not found */
|
|
47
|
+
export async function readFileSafe(filePath) {
|
|
48
|
+
try {
|
|
49
|
+
return await readFile(filePath, 'utf-8');
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Write a file, creating directories as needed */
|
|
56
|
+
export async function writeFileSafe(filePath, content) {
|
|
57
|
+
await ensureDir(dirname(filePath));
|
|
58
|
+
await writeFile(filePath, content, 'utf-8');
|
|
59
|
+
}
|
|
60
|
+
/** Append to a file, creating it if needed */
|
|
61
|
+
export async function appendFileSafe(filePath, content) {
|
|
62
|
+
await ensureDir(dirname(filePath));
|
|
63
|
+
const existing = await readFileSafe(filePath);
|
|
64
|
+
await writeFile(filePath, (existing || '') + content, 'utf-8');
|
|
65
|
+
}
|
|
66
|
+
/** List files in a directory matching a pattern */
|
|
67
|
+
export async function listFiles(dirPath, extension) {
|
|
68
|
+
try {
|
|
69
|
+
const files = await readdir(dirPath);
|
|
70
|
+
if (extension) {
|
|
71
|
+
return files.filter(f => f.endsWith(extension));
|
|
72
|
+
}
|
|
73
|
+
return files;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** Parse frontmatter-style key: value from markdown */
|
|
80
|
+
export function parseFrontmatter(content) {
|
|
81
|
+
const result = {};
|
|
82
|
+
const lines = content.split('\n');
|
|
83
|
+
let inFrontmatter = false;
|
|
84
|
+
for (const line of lines) {
|
|
85
|
+
if (line.trim() === '---') {
|
|
86
|
+
if (inFrontmatter)
|
|
87
|
+
break;
|
|
88
|
+
inFrontmatter = true;
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (inFrontmatter) {
|
|
92
|
+
const colonIdx = line.indexOf(':');
|
|
93
|
+
if (colonIdx > 0) {
|
|
94
|
+
const key = line.substring(0, colonIdx).trim();
|
|
95
|
+
const value = line.substring(colonIdx + 1).trim();
|
|
96
|
+
result[key] = value;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
/** Serialize a memory entry to markdown */
|
|
103
|
+
export function memoryToMarkdown(memory) {
|
|
104
|
+
return [
|
|
105
|
+
`### [${memory.type}] ${memory.timestamp}`,
|
|
106
|
+
`> ID: ${memory.id} | Importance: ${memory.importance} | Salience: ${memory.salienceScore?.toFixed(2) ?? 'unscored'}`,
|
|
107
|
+
`> Tags: ${memory.tags.join(', ') || 'none'}`,
|
|
108
|
+
'',
|
|
109
|
+
memory.content,
|
|
110
|
+
'',
|
|
111
|
+
].join('\n');
|
|
112
|
+
}
|
|
113
|
+
/** Calculate salience score: weighted combination that actually differentiates memories.
|
|
114
|
+
* Old formula (novelty + retention + momentum + continuity - effort) always produced ~1.0
|
|
115
|
+
* because new memories have high novelty AND high momentum, pushing sum past 1.0 immediately.
|
|
116
|
+
*
|
|
117
|
+
* New formula uses weights that keep scores distributed across 0-1 range:
|
|
118
|
+
* S = 0.25*novelty + 0.25*retention + 0.2*momentum + 0.2*continuity + 0.1*(1-effort)
|
|
119
|
+
*/
|
|
120
|
+
export function calculateSalience(params) {
|
|
121
|
+
const { novelty, retention, momentum, continuity, effort } = params;
|
|
122
|
+
const score = (0.25 * novelty) + (0.25 * retention) + (0.2 * momentum) + (0.2 * continuity) + (0.1 * (1 - effort));
|
|
123
|
+
return Math.max(0, Math.min(1, score));
|
|
124
|
+
}
|
|
125
|
+
/** Calculate memory decay based on type and time */
|
|
126
|
+
export function calculateDecay(params) {
|
|
127
|
+
const { type, ageHours, accessCount, emotionalWeight, decayRates } = params;
|
|
128
|
+
// Get base rate by memory type
|
|
129
|
+
let rate;
|
|
130
|
+
switch (type) {
|
|
131
|
+
case 'lesson':
|
|
132
|
+
case 'decision':
|
|
133
|
+
rate = decayRates.procedural; // skills decay slowly
|
|
134
|
+
break;
|
|
135
|
+
case 'insight':
|
|
136
|
+
rate = decayRates.semantic; // knowledge decays medium
|
|
137
|
+
break;
|
|
138
|
+
case 'conversation':
|
|
139
|
+
case 'event':
|
|
140
|
+
default:
|
|
141
|
+
rate = decayRates.episodic; // conversations decay fast
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
// Clamp inputs to safe ranges
|
|
145
|
+
const safeAge = Math.max(0, ageHours);
|
|
146
|
+
const safeAccess = Math.max(0, accessCount);
|
|
147
|
+
const safeEmotion = Math.max(0, Math.min(1, emotionalWeight));
|
|
148
|
+
// Emotional memories resist decay (0.2 to 1.0 range)
|
|
149
|
+
const emotionalResistance = Math.max(0.2, 1 - (safeEmotion * 0.8));
|
|
150
|
+
// Access count slows decay (frequently recalled = important)
|
|
151
|
+
const accessBonus = Math.max(0.1, 1 - (safeAccess * 0.1));
|
|
152
|
+
// Decay with modifiers, clamped to [0, 1]
|
|
153
|
+
return Math.min(1, Math.max(0, rate * emotionalResistance * accessBonus * safeAge));
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAQ,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAQ,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,2BAA2B;AAC3B,MAAM,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D,MAAM;IACV,CAAC;IAED,8BAA8B;IAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;IAE9D,qDAAqD;IACrD,MAAM,mBAAmB,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC;IAEnE,6DAA6D;IAC7D,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC;IAE1D,0CAA0C;IAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,mBAAmB,GAAG,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;AACtF,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { KnowledgeGraph } from '../alme/core/KnowledgeGraph';
|
|
2
|
+
declare enum IdeationTechnique {
|
|
3
|
+
ParadoxicalThinking = 0,
|
|
4
|
+
InverseReality = 1,
|
|
5
|
+
CrossDomainSynthesis = 2,
|
|
6
|
+
ExtremeConstraints = 3,
|
|
7
|
+
RandomConnectionGeneration = 4,
|
|
8
|
+
FirstPrinciplesAnalysis = 5
|
|
9
|
+
}
|
|
10
|
+
interface IdeaCandidate {
|
|
11
|
+
concept: string;
|
|
12
|
+
innovationScore: number;
|
|
13
|
+
potentialImpact: 'incremental' | 'transformative' | 'disruptive';
|
|
14
|
+
generationTechnique: IdeationTechnique;
|
|
15
|
+
relatedDomains: string[];
|
|
16
|
+
}
|
|
17
|
+
export declare class InnovationEngine {
|
|
18
|
+
private knowledgeGraph;
|
|
19
|
+
private ideaHistory;
|
|
20
|
+
constructor(knowledgeGraph: KnowledgeGraph);
|
|
21
|
+
/**
|
|
22
|
+
* Generate breakthrough ideas
|
|
23
|
+
* @param initialContext Starting domain or problem
|
|
24
|
+
* @returns Array of innovative idea candidates
|
|
25
|
+
*/
|
|
26
|
+
generateIdeas(initialContext: string, complexity?: number): IdeaCandidate[];
|
|
27
|
+
private ideationTechniqueMap;
|
|
28
|
+
/**
|
|
29
|
+
* Select ideation techniques based on complexity
|
|
30
|
+
*/
|
|
31
|
+
private selectIdeationTechniques;
|
|
32
|
+
/**
|
|
33
|
+
* Rank generated ideas
|
|
34
|
+
*/
|
|
35
|
+
private rankIdeas;
|
|
36
|
+
/**
|
|
37
|
+
* Update knowledge ecosystem with new ideas
|
|
38
|
+
*/
|
|
39
|
+
private updateKnowledgeEcosystem;
|
|
40
|
+
/**
|
|
41
|
+
* Retrieve idea generation history
|
|
42
|
+
*/
|
|
43
|
+
getIdeaHistory(limit?: number): IdeaCandidate[];
|
|
44
|
+
}
|
|
45
|
+
export declare const innovationEngine: InnovationEngine;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=InnovationEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InnovationEngine.d.ts","sourceRoot":"","sources":["../../src/ideation/InnovationEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,aAAK,iBAAiB;IACpB,mBAAmB,IAAA;IACnB,cAAc,IAAA;IACd,oBAAoB,IAAA;IACpB,kBAAkB,IAAA;IAClB,0BAA0B,IAAA;IAC1B,uBAAuB,IAAA;CACxB;AAED,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,aAAa,GAAG,gBAAgB,GAAG,YAAY,CAAC;IACjE,mBAAmB,EAAE,iBAAiB,CAAC;IACvC,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,WAAW,CAAuB;gBAE9B,cAAc,EAAE,cAAc;IAI1C;;;;OAIG;IACH,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,GAAE,MAAU,GAAG,aAAa,EAAE;IAmB9E,OAAO,CAAC,oBAAoB,CA4C1B;IAEF;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAOhC;;OAEG;IACH,OAAO,CAAC,SAAS;IASjB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAehC;;OAEG;IACH,cAAc,CAAC,KAAK,GAAE,MAAW,GAAG,aAAa,EAAE;CAKpD;AAGD,eAAO,MAAM,gBAAgB,kBAA6C,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.innovationEngine = exports.InnovationEngine = void 0;
|
|
4
|
+
const KnowledgeGraph_1 = require("../alme/core/KnowledgeGraph");
|
|
5
|
+
var IdeationTechnique;
|
|
6
|
+
(function (IdeationTechnique) {
|
|
7
|
+
IdeationTechnique[IdeationTechnique["ParadoxicalThinking"] = 0] = "ParadoxicalThinking";
|
|
8
|
+
IdeationTechnique[IdeationTechnique["InverseReality"] = 1] = "InverseReality";
|
|
9
|
+
IdeationTechnique[IdeationTechnique["CrossDomainSynthesis"] = 2] = "CrossDomainSynthesis";
|
|
10
|
+
IdeationTechnique[IdeationTechnique["ExtremeConstraints"] = 3] = "ExtremeConstraints";
|
|
11
|
+
IdeationTechnique[IdeationTechnique["RandomConnectionGeneration"] = 4] = "RandomConnectionGeneration";
|
|
12
|
+
IdeationTechnique[IdeationTechnique["FirstPrinciplesAnalysis"] = 5] = "FirstPrinciplesAnalysis";
|
|
13
|
+
})(IdeationTechnique || (IdeationTechnique = {}));
|
|
14
|
+
class InnovationEngine {
|
|
15
|
+
knowledgeGraph;
|
|
16
|
+
ideaHistory = [];
|
|
17
|
+
constructor(knowledgeGraph) {
|
|
18
|
+
this.knowledgeGraph = knowledgeGraph;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Generate breakthrough ideas
|
|
22
|
+
* @param initialContext Starting domain or problem
|
|
23
|
+
* @returns Array of innovative idea candidates
|
|
24
|
+
*/
|
|
25
|
+
generateIdeas(initialContext, complexity = 3) {
|
|
26
|
+
const techniques = this.selectIdeationTechniques(complexity);
|
|
27
|
+
const ideas = [];
|
|
28
|
+
techniques.forEach(technique => {
|
|
29
|
+
const ideaGenerator = this.ideationTechniqueMap[technique];
|
|
30
|
+
const generatedIdeas = ideaGenerator(initialContext);
|
|
31
|
+
ideas.push(...generatedIdeas);
|
|
32
|
+
});
|
|
33
|
+
// Rank and filter ideas
|
|
34
|
+
const rankedIdeas = this.rankIdeas(ideas);
|
|
35
|
+
// Update idea history and knowledge graph
|
|
36
|
+
this.updateKnowledgeEcosystem(rankedIdeas);
|
|
37
|
+
return rankedIdeas.slice(0, 5); // Top 5 ideas
|
|
38
|
+
}
|
|
39
|
+
ideationTechniqueMap = {
|
|
40
|
+
[IdeationTechnique.ParadoxicalThinking]: (context) => {
|
|
41
|
+
const paradoxes = [
|
|
42
|
+
`What if ${context} was completely opposite?`,
|
|
43
|
+
`How would ${context} work if its core assumption was wrong?`,
|
|
44
|
+
`Explore ${context} by deliberately challenging its fundamental logic`
|
|
45
|
+
];
|
|
46
|
+
return paradoxes.map(paradox => ({
|
|
47
|
+
concept: paradox,
|
|
48
|
+
innovationScore: Math.random() * 0.7 + 0.3,
|
|
49
|
+
potentialImpact: 'transformative',
|
|
50
|
+
generationTechnique: IdeationTechnique.ParadoxicalThinking,
|
|
51
|
+
relatedDomains: [context, 'critical_thinking']
|
|
52
|
+
}));
|
|
53
|
+
},
|
|
54
|
+
[IdeationTechnique.CrossDomainSynthesis]: (context) => {
|
|
55
|
+
const randomDomains = ['biology', 'quantum physics', 'ancient philosophy', 'neuroscience'];
|
|
56
|
+
return randomDomains.map(domain => ({
|
|
57
|
+
concept: `Apply ${domain} principles to ${context}`,
|
|
58
|
+
innovationScore: Math.random() * 0.8 + 0.2,
|
|
59
|
+
potentialImpact: 'disruptive',
|
|
60
|
+
generationTechnique: IdeationTechnique.CrossDomainSynthesis,
|
|
61
|
+
relatedDomains: [context, domain]
|
|
62
|
+
}));
|
|
63
|
+
},
|
|
64
|
+
[IdeationTechnique.ExtremeConstraints]: (context) => {
|
|
65
|
+
const constraints = [
|
|
66
|
+
`Solve ${context} with zero budget`,
|
|
67
|
+
`${context} implementation using only analog technologies`,
|
|
68
|
+
`Redesign ${context} for users with extreme limitations`
|
|
69
|
+
];
|
|
70
|
+
return constraints.map(constraint => ({
|
|
71
|
+
concept: constraint,
|
|
72
|
+
innovationScore: Math.random() * 0.6 + 0.4,
|
|
73
|
+
potentialImpact: 'incremental',
|
|
74
|
+
generationTechnique: IdeationTechnique.ExtremeConstraints,
|
|
75
|
+
relatedDomains: [context, 'constraint_innovation']
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Select ideation techniques based on complexity
|
|
81
|
+
*/
|
|
82
|
+
selectIdeationTechniques(complexity) {
|
|
83
|
+
const allTechniques = Object.values(IdeationTechnique);
|
|
84
|
+
return allTechniques
|
|
85
|
+
.sort(() => 0.5 - Math.random())
|
|
86
|
+
.slice(0, complexity);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Rank generated ideas
|
|
90
|
+
*/
|
|
91
|
+
rankIdeas(ideas) {
|
|
92
|
+
return ideas
|
|
93
|
+
.sort((a, b) => b.innovationScore - a.innovationScore)
|
|
94
|
+
.map(idea => ({
|
|
95
|
+
...idea,
|
|
96
|
+
innovationScore: Number(idea.innovationScore.toFixed(2))
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Update knowledge ecosystem with new ideas
|
|
101
|
+
*/
|
|
102
|
+
updateKnowledgeEcosystem(ideas) {
|
|
103
|
+
ideas.forEach(idea => {
|
|
104
|
+
this.knowledgeGraph.addNode(idea.concept, 'idea', {
|
|
105
|
+
metadata: {
|
|
106
|
+
innovationScore: idea.innovationScore,
|
|
107
|
+
potentialImpact: idea.potentialImpact,
|
|
108
|
+
generationTechnique: idea.generationTechnique
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
// Store in idea history for future reference
|
|
112
|
+
this.ideaHistory.push(idea);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Retrieve idea generation history
|
|
117
|
+
*/
|
|
118
|
+
getIdeaHistory(limit = 10) {
|
|
119
|
+
return this.ideaHistory
|
|
120
|
+
.sort((a, b) => b.innovationScore - a.innovationScore)
|
|
121
|
+
.slice(0, limit);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.InnovationEngine = InnovationEngine;
|
|
125
|
+
// Singleton instance
|
|
126
|
+
exports.innovationEngine = new InnovationEngine(new KnowledgeGraph_1.KnowledgeGraph());
|
|
127
|
+
//# sourceMappingURL=InnovationEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InnovationEngine.js","sourceRoot":"","sources":["../../src/ideation/InnovationEngine.ts"],"names":[],"mappings":";;;AAAA,gEAA6D;AAE7D,IAAK,iBAOJ;AAPD,WAAK,iBAAiB;IACpB,uFAAmB,CAAA;IACnB,6EAAc,CAAA;IACd,yFAAoB,CAAA;IACpB,qFAAkB,CAAA;IAClB,qGAA0B,CAAA;IAC1B,+FAAuB,CAAA;AACzB,CAAC,EAPI,iBAAiB,KAAjB,iBAAiB,QAOrB;AAUD,MAAa,gBAAgB;IACnB,cAAc,CAAiB;IAC/B,WAAW,GAAoB,EAAE,CAAC;IAE1C,YAAY,cAA8B;QACx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HANGED
|
@@ -10,5 +10,7 @@ export { Anima } from './anima';
|
|
|
10
10
|
export { MemoryEngine } from './memory';
|
|
11
11
|
export { IdentityManager } from './identity';
|
|
12
12
|
export { ReflectionEngine } from './reflection';
|
|
13
|
+
export { SigningEngine } from './signing';
|
|
13
14
|
export type { AnimaConfig, Memory, MemoryType, MemoryTier, ImportanceLevel, Identity, VoiceCalibration, Opinion, OpinionHistory, Relationship, Checkpoint, WakeContext, SessionSummary, DecayConfig, MemoryConflict, AnimaEvent, AutoSaveConfig, } from './types';
|
|
15
|
+
export type { KeyBundle, SignedIdentity, VerificationResult, } from './signing';
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,YAAY,EACV,WAAW,EACX,MAAM,EACN,UAAU,EACV,UAAU,EACV,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,UAAU,EACV,WAAW,EACX,cAAc,EACd,WAAW,EACX,cAAc,EACd,UAAU,EACV,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,SAAS,EACT,cAAc,EACd,kBAAkB,GACnB,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @see https://getanima.dev
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.ReflectionEngine = exports.IdentityManager = exports.MemoryEngine = exports.Anima = void 0;
|
|
11
|
+
exports.SigningEngine = exports.ReflectionEngine = exports.IdentityManager = exports.MemoryEngine = exports.Anima = void 0;
|
|
12
12
|
var anima_1 = require("./anima");
|
|
13
13
|
Object.defineProperty(exports, "Anima", { enumerable: true, get: function () { return anima_1.Anima; } });
|
|
14
14
|
var memory_1 = require("./memory");
|
|
@@ -17,4 +17,6 @@ var identity_1 = require("./identity");
|
|
|
17
17
|
Object.defineProperty(exports, "IdentityManager", { enumerable: true, get: function () { return identity_1.IdentityManager; } });
|
|
18
18
|
var reflection_1 = require("./reflection");
|
|
19
19
|
Object.defineProperty(exports, "ReflectionEngine", { enumerable: true, get: function () { return reflection_1.ReflectionEngine; } });
|
|
20
|
+
var signing_1 = require("./signing");
|
|
21
|
+
Object.defineProperty(exports, "SigningEngine", { enumerable: true, get: function () { return signing_1.SigningEngine; } });
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AACrB,uCAA6C;AAApC,2GAAA,eAAe,OAAA;AACxB,2CAAgD;AAAvC,8GAAA,gBAAgB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AACrB,uCAA6C;AAApC,2GAAA,eAAe,OAAA;AACxB,2CAAgD;AAAvC,8GAAA,gBAAgB,OAAA;AACzB,qCAA0C;AAAjC,wGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare class LearningVisualizer {
|
|
2
|
+
private learningLog;
|
|
3
|
+
/**
|
|
4
|
+
* Log a learning event with full transparency
|
|
5
|
+
*/
|
|
6
|
+
logLearningEvent(event: {
|
|
7
|
+
context: string;
|
|
8
|
+
type: string;
|
|
9
|
+
score: number;
|
|
10
|
+
outcome: string;
|
|
11
|
+
}): void;
|
|
12
|
+
/**
|
|
13
|
+
* Generate a human-readable learning report
|
|
14
|
+
*/
|
|
15
|
+
generateLearningReport(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Write learning report to a visible file
|
|
18
|
+
*/
|
|
19
|
+
private writeReportToFile;
|
|
20
|
+
/**
|
|
21
|
+
* Provide a way to inspect recent learning events
|
|
22
|
+
*/
|
|
23
|
+
getRecentLearningEvents(limit?: number): any[];
|
|
24
|
+
}
|
|
25
|
+
export declare const learningVisualizer: LearningVisualizer;
|
|
26
|
+
//# sourceMappingURL=LearningVisualizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LearningVisualizer.d.ts","sourceRoot":"","sources":["../../src/learning-tracker/LearningVisualizer.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAkB;IAE7B,OAAO,CAAC,WAAW,CAMX;IAER;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE;QACtB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,IAAI;IAaR;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAiBhC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAazB;;OAEG;IACH,uBAAuB,CAAC,KAAK,GAAE,MAAW,GAAG,GAAG,EAAE;CAGnD;AAGD,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}
|