noormme 1.2.5 → 1.2.6

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.
@@ -8,9 +8,10 @@ export declare class SelfEvolution {
8
8
  private db;
9
9
  private config;
10
10
  private evolution;
11
- private typeGenerator;
11
+ private typeGenerator?;
12
12
  private snapshotsTable;
13
13
  constructor(db: Kysely<any>, config: NOORMConfig);
14
+ private getTypeGenerator;
14
15
  /**
15
16
  * Ensure core agentic tables have telemetry columns like 'accessed_at'
16
17
  */
@@ -33,7 +34,7 @@ export declare class SelfEvolution {
33
34
  /**
34
35
  * Get the current "DNA" (structural overview) of the agent's database
35
36
  */
36
- getDNA(): Promise<string>;
37
+ getDNA(db?: Kysely<any>): Promise<string>;
37
38
  /**
38
39
  * Proactively suggest and apply optimizations based on usage patterns.
39
40
  */
@@ -53,10 +53,15 @@ class SelfEvolution {
53
53
  this.db = db;
54
54
  this.config = config;
55
55
  this.evolution = new schema_evolution_js_1.SchemaEvolutionHelper(db);
56
- this.typeGenerator = new type_generator_js_1.TypeGenerator(config.introspection);
57
56
  this.snapshotsTable =
58
57
  config.agentic?.metadata?.snapshotsTable || 'agent_snapshots';
59
58
  }
59
+ getTypeGenerator() {
60
+ if (!this.typeGenerator) {
61
+ this.typeGenerator = new type_generator_js_1.TypeGenerator(this.config.introspection);
62
+ }
63
+ return this.typeGenerator;
64
+ }
60
65
  /**
61
66
  * Ensure core agentic tables have telemetry columns like 'accessed_at'
62
67
  */
@@ -136,13 +141,13 @@ class SelfEvolution {
136
141
  console.log(`[SelfEvolution] Applying structural change: ${ddl}`);
137
142
  const runner = async (trx) => {
138
143
  // 1. Apply the DDL change
139
- await trx.execute(sql_js_1.sql.raw(ddl));
144
+ await sql_js_1.sql.raw(ddl).execute(trx);
140
145
  // 1b. Log for potential rollback
141
146
  await trx
142
147
  .insertInto(this.snapshotsTable)
143
148
  .values({
144
149
  name: options.name || `auto_evolution_${Date.now()}`,
145
- dna: await this.getDNA(),
150
+ dna: await this.getDNA(trx),
146
151
  metadata: JSON.stringify({
147
152
  ...options.metadata,
148
153
  ddl,
@@ -178,7 +183,7 @@ class SelfEvolution {
178
183
  })),
179
184
  relationships: [],
180
185
  };
181
- const generated = this.typeGenerator.generateTypes(schemaInfo);
186
+ const generated = this.getTypeGenerator().generateTypes(schemaInfo);
182
187
  if (this.config.agentic?.metadata?.typesOutputPath) {
183
188
  const outputPath = this.config.agentic.metadata.typesOutputPath;
184
189
  console.log(`[SelfEvolution] Writing regenerated types to ${outputPath}`);
@@ -189,8 +194,8 @@ class SelfEvolution {
189
194
  /**
190
195
  * Get the current "DNA" (structural overview) of the agent's database
191
196
  */
192
- async getDNA() {
193
- return this.evolution.getStructuralOverview();
197
+ async getDNA(db = this.db) {
198
+ return new schema_evolution_js_1.SchemaEvolutionHelper(db).getStructuralOverview();
194
199
  }
195
200
  /**
196
201
  * Proactively suggest and apply optimizations based on usage patterns.
@@ -8,9 +8,10 @@ export declare class SelfEvolution {
8
8
  private db;
9
9
  private config;
10
10
  private evolution;
11
- private typeGenerator;
11
+ private typeGenerator?;
12
12
  private snapshotsTable;
13
13
  constructor(db: Kysely<any>, config: NOORMConfig);
14
+ private getTypeGenerator;
14
15
  /**
15
16
  * Ensure core agentic tables have telemetry columns like 'accessed_at'
16
17
  */
@@ -33,7 +34,7 @@ export declare class SelfEvolution {
33
34
  /**
34
35
  * Get the current "DNA" (structural overview) of the agent's database
35
36
  */
36
- getDNA(): Promise<string>;
37
+ getDNA(db?: Kysely<any>): Promise<string>;
37
38
  /**
38
39
  * Proactively suggest and apply optimizations based on usage patterns.
39
40
  */
@@ -18,10 +18,15 @@ export class SelfEvolution {
18
18
  this.db = db;
19
19
  this.config = config;
20
20
  this.evolution = new SchemaEvolutionHelper(db);
21
- this.typeGenerator = new TypeGenerator(config.introspection);
22
21
  this.snapshotsTable =
23
22
  config.agentic?.metadata?.snapshotsTable || 'agent_snapshots';
24
23
  }
24
+ getTypeGenerator() {
25
+ if (!this.typeGenerator) {
26
+ this.typeGenerator = new TypeGenerator(this.config.introspection);
27
+ }
28
+ return this.typeGenerator;
29
+ }
25
30
  /**
26
31
  * Ensure core agentic tables have telemetry columns like 'accessed_at'
27
32
  */
@@ -101,13 +106,13 @@ export class SelfEvolution {
101
106
  console.log(`[SelfEvolution] Applying structural change: ${ddl}`);
102
107
  const runner = async (trx) => {
103
108
  // 1. Apply the DDL change
104
- await trx.execute(sql.raw(ddl));
109
+ await sql.raw(ddl).execute(trx);
105
110
  // 1b. Log for potential rollback
106
111
  await trx
107
112
  .insertInto(this.snapshotsTable)
108
113
  .values({
109
114
  name: options.name || `auto_evolution_${Date.now()}`,
110
- dna: await this.getDNA(),
115
+ dna: await this.getDNA(trx),
111
116
  metadata: JSON.stringify({
112
117
  ...options.metadata,
113
118
  ddl,
@@ -143,7 +148,7 @@ export class SelfEvolution {
143
148
  })),
144
149
  relationships: [],
145
150
  };
146
- const generated = this.typeGenerator.generateTypes(schemaInfo);
151
+ const generated = this.getTypeGenerator().generateTypes(schemaInfo);
147
152
  if (this.config.agentic?.metadata?.typesOutputPath) {
148
153
  const outputPath = this.config.agentic.metadata.typesOutputPath;
149
154
  console.log(`[SelfEvolution] Writing regenerated types to ${outputPath}`);
@@ -154,8 +159,8 @@ export class SelfEvolution {
154
159
  /**
155
160
  * Get the current "DNA" (structural overview) of the agent's database
156
161
  */
157
- async getDNA() {
158
- return this.evolution.getStructuralOverview();
162
+ async getDNA(db = this.db) {
163
+ return new SchemaEvolutionHelper(db).getStructuralOverview();
159
164
  }
160
165
  /**
161
166
  * Proactively suggest and apply optimizations based on usage patterns.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noormme",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "NOORMME - The Agentic Data Engine. High-fidelity persistence and cognitive governance for Autonomous AI Agents.",
5
5
  "repository": {
6
6
  "type": "git",