noormme 1.0.2 → 1.0.4

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.
Files changed (376) hide show
  1. package/README.md +71 -306
  2. package/dist/cjs/agentic/ActionJournal.d.ts +55 -0
  3. package/dist/cjs/agentic/ActionJournal.js +130 -0
  4. package/dist/cjs/agentic/CapabilityManager.d.ts +43 -0
  5. package/dist/cjs/agentic/CapabilityManager.js +131 -0
  6. package/dist/cjs/agentic/CognitiveRepository.d.ts +24 -0
  7. package/dist/cjs/agentic/CognitiveRepository.js +77 -0
  8. package/dist/cjs/agentic/ContextBuffer.d.ts +54 -0
  9. package/dist/cjs/agentic/ContextBuffer.js +112 -0
  10. package/dist/cjs/agentic/Cortex.d.ts +85 -0
  11. package/dist/cjs/agentic/Cortex.js +152 -0
  12. package/dist/cjs/agentic/EpisodicMemory.d.ts +43 -0
  13. package/dist/cjs/agentic/EpisodicMemory.js +103 -0
  14. package/dist/cjs/agentic/PersonaManager.d.ts +47 -0
  15. package/dist/cjs/agentic/PersonaManager.js +100 -0
  16. package/dist/cjs/agentic/PolicyEnforcer.d.ts +57 -0
  17. package/dist/cjs/agentic/PolicyEnforcer.js +171 -0
  18. package/dist/cjs/agentic/ResourceMonitor.d.ts +48 -0
  19. package/dist/cjs/agentic/ResourceMonitor.js +95 -0
  20. package/dist/cjs/agentic/SessionCompressor.d.ts +26 -0
  21. package/dist/cjs/agentic/SessionCompressor.js +87 -0
  22. package/dist/cjs/agentic/SessionManager.d.ts +66 -0
  23. package/dist/cjs/agentic/SessionManager.js +249 -0
  24. package/dist/cjs/agentic/VectorIndexer.d.ts +37 -0
  25. package/dist/cjs/agentic/VectorIndexer.js +113 -0
  26. package/dist/cjs/agentic/improvement/AblationEngine.d.ts +31 -0
  27. package/dist/cjs/agentic/improvement/AblationEngine.js +139 -0
  28. package/dist/cjs/agentic/improvement/ActionRefiner.d.ts +26 -0
  29. package/dist/cjs/agentic/improvement/ActionRefiner.js +88 -0
  30. package/dist/cjs/agentic/improvement/ConflictResolver.d.ts +21 -0
  31. package/dist/cjs/agentic/improvement/ConflictResolver.js +98 -0
  32. package/dist/cjs/agentic/improvement/CortexJanitor.d.ts +36 -0
  33. package/dist/cjs/agentic/improvement/CortexJanitor.js +118 -0
  34. package/dist/cjs/agentic/improvement/CuriosityEngine.d.ts +45 -0
  35. package/dist/cjs/agentic/improvement/CuriosityEngine.js +220 -0
  36. package/dist/cjs/agentic/improvement/EvolutionaryPilot.d.ts +20 -0
  37. package/dist/cjs/agentic/improvement/EvolutionaryPilot.js +88 -0
  38. package/dist/cjs/agentic/improvement/GoalArchitect.d.ts +53 -0
  39. package/dist/cjs/agentic/improvement/GoalArchitect.js +158 -0
  40. package/dist/cjs/agentic/improvement/GovernanceManager.d.ts +25 -0
  41. package/dist/cjs/agentic/improvement/GovernanceManager.js +104 -0
  42. package/dist/cjs/agentic/improvement/HiveLink.d.ts +25 -0
  43. package/dist/cjs/agentic/improvement/HiveLink.js +116 -0
  44. package/dist/cjs/agentic/improvement/KnowledgeDistiller.d.ts +87 -0
  45. package/dist/cjs/agentic/improvement/KnowledgeDistiller.js +301 -0
  46. package/dist/cjs/agentic/improvement/RecursiveReasoner.d.ts +35 -0
  47. package/dist/cjs/agentic/improvement/RecursiveReasoner.js +136 -0
  48. package/dist/cjs/agentic/improvement/ReflectionEngine.d.ts +25 -0
  49. package/dist/cjs/agentic/improvement/ReflectionEngine.js +74 -0
  50. package/dist/cjs/agentic/improvement/RitualOrchestrator.d.ts +28 -0
  51. package/dist/cjs/agentic/improvement/RitualOrchestrator.js +151 -0
  52. package/dist/cjs/agentic/improvement/RuleEngine.d.ts +56 -0
  53. package/dist/cjs/agentic/improvement/RuleEngine.js +132 -0
  54. package/dist/cjs/agentic/improvement/SelfEvolution.d.ts +50 -0
  55. package/dist/cjs/agentic/improvement/SelfEvolution.js +284 -0
  56. package/dist/cjs/agentic/improvement/SelfTestRegistry.d.ts +25 -0
  57. package/dist/cjs/agentic/improvement/SelfTestRegistry.js +168 -0
  58. package/dist/cjs/agentic/improvement/SovereignMetrics.d.ts +66 -0
  59. package/dist/cjs/agentic/improvement/SovereignMetrics.js +128 -0
  60. package/dist/cjs/agentic/improvement/StrategicPlanner.d.ts +71 -0
  61. package/dist/cjs/agentic/improvement/StrategicPlanner.js +222 -0
  62. package/dist/cjs/agentic/telemetry/CognitiveSynthesizer.d.ts +26 -0
  63. package/dist/cjs/agentic/telemetry/CognitiveSynthesizer.js +164 -0
  64. package/dist/cjs/agentic/telemetry/EventHarvester.d.ts +12 -0
  65. package/dist/cjs/agentic/telemetry/EventHarvester.js +34 -0
  66. package/dist/cjs/agentic/telemetry/ResearchAlchemist.d.ts +20 -0
  67. package/dist/cjs/agentic/telemetry/ResearchAlchemist.js +48 -0
  68. package/dist/cjs/agentic/telemetry/TelemetryOrchestrator.d.ts +21 -0
  69. package/dist/cjs/agentic/telemetry/TelemetryOrchestrator.js +45 -0
  70. package/dist/cjs/cache/cache-manager.d.ts +1 -1
  71. package/dist/cjs/cache/cache-manager.js +16 -14
  72. package/dist/cjs/cli/commands/analyze.js +46 -25
  73. package/dist/cjs/cli/commands/generate.js +5 -2
  74. package/dist/cjs/cli/commands/inspect.js +25 -8
  75. package/dist/cjs/cli/commands/migrate.js +29 -154
  76. package/dist/cjs/cli/commands/optimize.js +18 -4
  77. package/dist/cjs/cli/commands/status.js +30 -10
  78. package/dist/cjs/cli/commands/watch.js +142 -135
  79. package/dist/cjs/dialect/database-introspector.d.ts +23 -2
  80. package/dist/cjs/dialect/database-introspector.js +119 -37
  81. package/dist/cjs/dialect/postgresql/postgresql-adapter.d.ts +81 -0
  82. package/dist/cjs/dialect/postgresql/postgresql-adapter.js +40 -0
  83. package/dist/cjs/dialect/postgresql/postgresql-dialect-config.d.ts +65 -0
  84. package/dist/cjs/dialect/postgresql/postgresql-dialect-config.js +2 -0
  85. package/dist/cjs/dialect/postgresql/postgresql-dialect.d.ts +80 -0
  86. package/dist/cjs/dialect/postgresql/postgresql-dialect.js +76 -0
  87. package/dist/cjs/dialect/postgresql/postgresql-driver.d.ts +51 -0
  88. package/dist/cjs/dialect/postgresql/postgresql-driver.js +159 -0
  89. package/dist/cjs/dialect/postgresql/postgresql-features.d.ts +377 -0
  90. package/dist/cjs/dialect/postgresql/postgresql-features.js +459 -0
  91. package/dist/cjs/dialect/postgresql/postgresql-introspector.d.ts +34 -0
  92. package/dist/cjs/dialect/postgresql/postgresql-introspector.js +324 -0
  93. package/dist/cjs/dialect/postgresql/postgresql-query-compiler.d.ts +11 -0
  94. package/dist/cjs/dialect/postgresql/postgresql-query-compiler.js +39 -0
  95. package/dist/cjs/dialect/sqlite/sqlite-driver.js +2 -3
  96. package/dist/cjs/dialect/sqlite/sqlite-introspector.d.ts +10 -0
  97. package/dist/cjs/dialect/sqlite/sqlite-introspector.js +36 -21
  98. package/dist/cjs/edge-runtime/edge-config.d.ts +8 -2
  99. package/dist/cjs/edge-runtime/edge-config.js +26 -29
  100. package/dist/cjs/helpers/agent-schema.d.ts +19 -0
  101. package/dist/cjs/helpers/agent-schema.js +292 -0
  102. package/dist/cjs/helpers/postgresql.d.ts +96 -0
  103. package/dist/cjs/helpers/postgresql.js +147 -0
  104. package/dist/cjs/helpers/schema-evolution.d.ts +30 -0
  105. package/dist/cjs/helpers/schema-evolution.js +122 -0
  106. package/dist/cjs/index.d.ts +40 -2
  107. package/dist/cjs/index.js +53 -2
  108. package/dist/cjs/kysely.d.ts +1 -2
  109. package/dist/cjs/kysely.js +1 -7
  110. package/dist/cjs/logging/logger.js +58 -2
  111. package/dist/cjs/migration/data_migrator.d.ts +40 -0
  112. package/dist/cjs/migration/data_migrator.js +230 -0
  113. package/dist/cjs/migration/database_migration_manager.d.ts +77 -0
  114. package/dist/cjs/migration/database_migration_manager.js +383 -0
  115. package/dist/cjs/migration/index.d.ts +19 -0
  116. package/dist/cjs/migration/index.js +53 -0
  117. package/dist/cjs/migration/migration-types.d.ts +157 -0
  118. package/dist/cjs/migration/migration-types.js +5 -0
  119. package/dist/cjs/migration/schema_differ.d.ts +24 -0
  120. package/dist/cjs/migration/schema_differ.js +323 -0
  121. package/dist/cjs/migration/schema_introspector.d.ts +13 -0
  122. package/dist/cjs/migration/schema_introspector.js +364 -0
  123. package/dist/cjs/migration/type_mapper.d.ts +23 -0
  124. package/dist/cjs/migration/type_mapper.js +263 -0
  125. package/dist/cjs/noormme.d.ts +29 -0
  126. package/dist/cjs/noormme.js +98 -3
  127. package/dist/cjs/operation-node/add-index-node.d.ts +2 -1
  128. package/dist/cjs/operation-node/create-index-node.d.ts +2 -2
  129. package/dist/cjs/operation-node/data-type-node.d.ts +1 -1
  130. package/dist/cjs/operation-node/data-type-node.js +26 -0
  131. package/dist/cjs/operation-node/delete-query-node.d.ts +0 -9
  132. package/dist/cjs/operation-node/delete-query-node.js +0 -11
  133. package/dist/cjs/operation-node/index-type-node.d.ts +13 -0
  134. package/dist/cjs/operation-node/index-type-node.js +18 -0
  135. package/dist/cjs/operation-node/insert-query-node.d.ts +0 -2
  136. package/dist/cjs/operation-node/operation-node-transformer.d.ts +2 -0
  137. package/dist/cjs/operation-node/operation-node-transformer.js +5 -1
  138. package/dist/cjs/operation-node/operation-node-visitor.d.ts +2 -0
  139. package/dist/cjs/operation-node/operation-node-visitor.js +1 -0
  140. package/dist/cjs/operation-node/operation-node.d.ts +1 -1
  141. package/dist/cjs/operation-node/select-query-node.d.ts +0 -9
  142. package/dist/cjs/operation-node/select-query-node.js +0 -11
  143. package/dist/cjs/parser/join-parser.js +1 -1
  144. package/dist/cjs/parser/order-by-parser.d.ts +1 -14
  145. package/dist/cjs/parser/order-by-parser.js +0 -12
  146. package/dist/cjs/performance/query-optimizer.d.ts +1 -1
  147. package/dist/cjs/performance/query-optimizer.js +5 -9
  148. package/dist/cjs/performance/services/metrics-collector.d.ts +11 -2
  149. package/dist/cjs/performance/services/metrics-collector.js +89 -3
  150. package/dist/cjs/query-builder/aggregate-function-builder.d.ts +1 -25
  151. package/dist/cjs/query-builder/delete-query-builder.d.ts +115 -17
  152. package/dist/cjs/query-builder/order-by-interface.d.ts +1 -14
  153. package/dist/cjs/query-builder/over-builder.d.ts +1 -14
  154. package/dist/cjs/query-builder/select-query-builder.d.ts +1 -13
  155. package/dist/cjs/query-builder/update-query-builder.d.ts +2 -17
  156. package/dist/cjs/query-compiler/default-query-compiler.d.ts +2 -0
  157. package/dist/cjs/query-compiler/default-query-compiler.js +3 -6
  158. package/dist/cjs/relationships/relationship-engine.js +2 -2
  159. package/dist/cjs/repository/repository-factory.d.ts +11 -7
  160. package/dist/cjs/repository/repository-factory.js +203 -212
  161. package/dist/cjs/schema/builders/alter-table-add-index-builder.d.ts +1 -1
  162. package/dist/cjs/schema/builders/alter-table-add-index-builder.js +2 -2
  163. package/dist/cjs/schema/builders/create-index-builder.d.ts +3 -2
  164. package/dist/cjs/schema/builders/create-index-builder.js +5 -3
  165. package/dist/cjs/schema/core/discovery/relationship-discovery.js +45 -6
  166. package/dist/cjs/schema/core/discovery/table-metadata-discovery.js +11 -7
  167. package/dist/cjs/schema/core/discovery/view-discovery.js +14 -15
  168. package/dist/cjs/schema/core/factories/discovery-factory.d.ts +5 -8
  169. package/dist/cjs/schema/core/factories/discovery-factory.js +23 -1
  170. package/dist/cjs/schema/core/utils/type-mapper.js +21 -0
  171. package/dist/cjs/schema/dialects/postgresql/postgresql-discovery.coordinator.d.ts +44 -0
  172. package/dist/cjs/schema/dialects/postgresql/postgresql-discovery.coordinator.js +116 -0
  173. package/dist/cjs/schema/dialects/sqlite/sqlite-discovery.coordinator.js +38 -10
  174. package/dist/cjs/schema/test/discovery-factory.test.js +1 -1
  175. package/dist/cjs/schema/test/error-handling.test.js +1 -1
  176. package/dist/cjs/schema/test/integration.test.js +4 -2
  177. package/dist/cjs/schema/test/sqlite-discovery-coordinator.test.js +12 -4
  178. package/dist/cjs/sqlite-migration/sqlite-migration-manager.d.ts +18 -1
  179. package/dist/cjs/sqlite-migration/sqlite-migration-manager.js +108 -34
  180. package/dist/cjs/sqlite-migration/sqlite-migration-provider.d.ts +0 -6
  181. package/dist/cjs/sqlite-migration/sqlite-migration-provider.js +72 -70
  182. package/dist/cjs/types/index.d.ts +253 -1
  183. package/dist/cjs/types/type-generator.d.ts +0 -4
  184. package/dist/cjs/types/type-generator.js +15 -57
  185. package/dist/cjs/util/similarity.d.ts +12 -0
  186. package/dist/cjs/util/similarity.js +69 -0
  187. package/dist/cjs/watch/schema-watcher.d.ts +2 -0
  188. package/dist/cjs/watch/schema-watcher.js +95 -19
  189. package/dist/esm/agentic/ActionJournal.d.ts +55 -0
  190. package/dist/esm/agentic/ActionJournal.js +127 -0
  191. package/dist/esm/agentic/CapabilityManager.d.ts +43 -0
  192. package/dist/esm/agentic/CapabilityManager.js +128 -0
  193. package/dist/esm/agentic/CognitiveRepository.d.ts +24 -0
  194. package/dist/esm/agentic/CognitiveRepository.js +74 -0
  195. package/dist/esm/agentic/ContextBuffer.d.ts +54 -0
  196. package/dist/esm/agentic/ContextBuffer.js +109 -0
  197. package/dist/esm/agentic/Cortex.d.ts +85 -0
  198. package/dist/esm/agentic/Cortex.js +149 -0
  199. package/dist/esm/agentic/EpisodicMemory.d.ts +43 -0
  200. package/dist/esm/agentic/EpisodicMemory.js +100 -0
  201. package/dist/esm/agentic/PersonaManager.d.ts +47 -0
  202. package/dist/esm/agentic/PersonaManager.js +97 -0
  203. package/dist/esm/agentic/PolicyEnforcer.d.ts +57 -0
  204. package/dist/esm/agentic/PolicyEnforcer.js +168 -0
  205. package/dist/esm/agentic/ResourceMonitor.d.ts +48 -0
  206. package/dist/esm/agentic/ResourceMonitor.js +92 -0
  207. package/dist/esm/agentic/SessionCompressor.d.ts +26 -0
  208. package/dist/esm/agentic/SessionCompressor.js +84 -0
  209. package/dist/esm/agentic/SessionManager.d.ts +66 -0
  210. package/dist/esm/agentic/SessionManager.js +246 -0
  211. package/dist/esm/agentic/VectorIndexer.d.ts +37 -0
  212. package/dist/esm/agentic/VectorIndexer.js +110 -0
  213. package/dist/esm/agentic/improvement/AblationEngine.d.ts +31 -0
  214. package/dist/esm/agentic/improvement/AblationEngine.js +136 -0
  215. package/dist/esm/agentic/improvement/ActionRefiner.d.ts +26 -0
  216. package/dist/esm/agentic/improvement/ActionRefiner.js +85 -0
  217. package/dist/esm/agentic/improvement/ConflictResolver.d.ts +21 -0
  218. package/dist/esm/agentic/improvement/ConflictResolver.js +95 -0
  219. package/dist/esm/agentic/improvement/CortexJanitor.d.ts +36 -0
  220. package/dist/esm/agentic/improvement/CortexJanitor.js +115 -0
  221. package/dist/esm/agentic/improvement/CuriosityEngine.d.ts +45 -0
  222. package/dist/esm/agentic/improvement/CuriosityEngine.js +217 -0
  223. package/dist/esm/agentic/improvement/EvolutionaryPilot.d.ts +20 -0
  224. package/dist/esm/agentic/improvement/EvolutionaryPilot.js +85 -0
  225. package/dist/esm/agentic/improvement/GoalArchitect.d.ts +53 -0
  226. package/dist/esm/agentic/improvement/GoalArchitect.js +155 -0
  227. package/dist/esm/agentic/improvement/GovernanceManager.d.ts +25 -0
  228. package/dist/esm/agentic/improvement/GovernanceManager.js +101 -0
  229. package/dist/esm/agentic/improvement/HiveLink.d.ts +25 -0
  230. package/dist/esm/agentic/improvement/HiveLink.js +113 -0
  231. package/dist/esm/agentic/improvement/KnowledgeDistiller.d.ts +87 -0
  232. package/dist/esm/agentic/improvement/KnowledgeDistiller.js +298 -0
  233. package/dist/esm/agentic/improvement/RecursiveReasoner.d.ts +35 -0
  234. package/dist/esm/agentic/improvement/RecursiveReasoner.js +133 -0
  235. package/dist/esm/agentic/improvement/ReflectionEngine.d.ts +25 -0
  236. package/dist/esm/agentic/improvement/ReflectionEngine.js +71 -0
  237. package/dist/esm/agentic/improvement/RitualOrchestrator.d.ts +28 -0
  238. package/dist/esm/agentic/improvement/RitualOrchestrator.js +148 -0
  239. package/dist/esm/agentic/improvement/RuleEngine.d.ts +56 -0
  240. package/dist/esm/agentic/improvement/RuleEngine.js +129 -0
  241. package/dist/esm/agentic/improvement/SelfEvolution.d.ts +50 -0
  242. package/dist/esm/agentic/improvement/SelfEvolution.js +248 -0
  243. package/dist/esm/agentic/improvement/SelfTestRegistry.d.ts +25 -0
  244. package/dist/esm/agentic/improvement/SelfTestRegistry.js +165 -0
  245. package/dist/esm/agentic/improvement/SovereignMetrics.d.ts +66 -0
  246. package/dist/esm/agentic/improvement/SovereignMetrics.js +125 -0
  247. package/dist/esm/agentic/improvement/StrategicPlanner.d.ts +71 -0
  248. package/dist/esm/agentic/improvement/StrategicPlanner.js +219 -0
  249. package/dist/esm/agentic/telemetry/CognitiveSynthesizer.d.ts +26 -0
  250. package/dist/esm/agentic/telemetry/CognitiveSynthesizer.js +161 -0
  251. package/dist/esm/agentic/telemetry/EventHarvester.d.ts +12 -0
  252. package/dist/esm/agentic/telemetry/EventHarvester.js +31 -0
  253. package/dist/esm/agentic/telemetry/ResearchAlchemist.d.ts +20 -0
  254. package/dist/esm/agentic/telemetry/ResearchAlchemist.js +45 -0
  255. package/dist/esm/agentic/telemetry/TelemetryOrchestrator.d.ts +21 -0
  256. package/dist/esm/agentic/telemetry/TelemetryOrchestrator.js +42 -0
  257. package/dist/esm/cache/cache-manager.d.ts +1 -1
  258. package/dist/esm/cache/cache-manager.js +16 -14
  259. package/dist/esm/cli/commands/analyze.js +46 -25
  260. package/dist/esm/cli/commands/generate.js +5 -2
  261. package/dist/esm/cli/commands/inspect.js +25 -8
  262. package/dist/esm/cli/commands/migrate.js +29 -121
  263. package/dist/esm/cli/commands/optimize.js +18 -4
  264. package/dist/esm/cli/commands/status.js +30 -10
  265. package/dist/esm/cli/commands/watch.js +109 -135
  266. package/dist/esm/dialect/database-introspector.d.ts +23 -2
  267. package/dist/esm/dialect/database-introspector.js +119 -37
  268. package/dist/esm/dialect/postgresql/postgresql-adapter.d.ts +81 -0
  269. package/dist/esm/dialect/postgresql/postgresql-adapter.js +37 -0
  270. package/dist/esm/dialect/postgresql/postgresql-dialect-config.d.ts +65 -0
  271. package/dist/esm/dialect/postgresql/postgresql-dialect-config.js +2 -0
  272. package/dist/esm/dialect/postgresql/postgresql-dialect.d.ts +80 -0
  273. package/dist/esm/dialect/postgresql/postgresql-dialect.js +73 -0
  274. package/dist/esm/dialect/postgresql/postgresql-driver.d.ts +51 -0
  275. package/dist/esm/dialect/postgresql/postgresql-driver.js +123 -0
  276. package/dist/esm/dialect/postgresql/postgresql-features.d.ts +377 -0
  277. package/dist/esm/dialect/postgresql/postgresql-features.js +457 -0
  278. package/dist/esm/dialect/postgresql/postgresql-introspector.d.ts +34 -0
  279. package/dist/esm/dialect/postgresql/postgresql-introspector.js +321 -0
  280. package/dist/esm/dialect/postgresql/postgresql-query-compiler.d.ts +11 -0
  281. package/dist/esm/dialect/postgresql/postgresql-query-compiler.js +36 -0
  282. package/dist/esm/dialect/sqlite/sqlite-driver.js +2 -3
  283. package/dist/esm/dialect/sqlite/sqlite-introspector.d.ts +10 -0
  284. package/dist/esm/dialect/sqlite/sqlite-introspector.js +36 -21
  285. package/dist/esm/edge-runtime/edge-config.d.ts +8 -2
  286. package/dist/esm/edge-runtime/edge-config.js +26 -29
  287. package/dist/esm/helpers/agent-schema.d.ts +19 -0
  288. package/dist/esm/helpers/agent-schema.js +289 -0
  289. package/dist/esm/helpers/postgresql.d.ts +96 -0
  290. package/dist/esm/helpers/postgresql.js +126 -0
  291. package/dist/esm/helpers/schema-evolution.d.ts +30 -0
  292. package/dist/esm/helpers/schema-evolution.js +119 -0
  293. package/dist/esm/index.d.ts +40 -2
  294. package/dist/esm/index.js +41 -1
  295. package/dist/esm/kysely.d.ts +1 -2
  296. package/dist/esm/kysely.js +1 -7
  297. package/dist/esm/logging/logger.js +25 -2
  298. package/dist/esm/migration/data_migrator.d.ts +40 -0
  299. package/dist/esm/migration/data_migrator.js +225 -0
  300. package/dist/esm/migration/database_migration_manager.d.ts +77 -0
  301. package/dist/esm/migration/database_migration_manager.js +379 -0
  302. package/dist/esm/migration/index.d.ts +19 -0
  303. package/dist/esm/migration/index.js +21 -0
  304. package/dist/esm/migration/migration-types.d.ts +157 -0
  305. package/dist/esm/migration/migration-types.js +5 -0
  306. package/dist/esm/migration/schema_differ.d.ts +24 -0
  307. package/dist/esm/migration/schema_differ.js +319 -0
  308. package/dist/esm/migration/schema_introspector.d.ts +13 -0
  309. package/dist/esm/migration/schema_introspector.js +361 -0
  310. package/dist/esm/migration/type_mapper.d.ts +23 -0
  311. package/dist/esm/migration/type_mapper.js +258 -0
  312. package/dist/esm/noormme.d.ts +29 -0
  313. package/dist/esm/noormme.js +98 -3
  314. package/dist/esm/operation-node/add-index-node.d.ts +2 -1
  315. package/dist/esm/operation-node/create-index-node.d.ts +2 -2
  316. package/dist/esm/operation-node/data-type-node.d.ts +1 -1
  317. package/dist/esm/operation-node/data-type-node.js +26 -0
  318. package/dist/esm/operation-node/delete-query-node.d.ts +0 -9
  319. package/dist/esm/operation-node/delete-query-node.js +0 -11
  320. package/dist/esm/operation-node/index-type-node.d.ts +13 -0
  321. package/dist/esm/operation-node/index-type-node.js +16 -0
  322. package/dist/esm/operation-node/insert-query-node.d.ts +0 -2
  323. package/dist/esm/operation-node/operation-node-transformer.d.ts +2 -0
  324. package/dist/esm/operation-node/operation-node-transformer.js +5 -1
  325. package/dist/esm/operation-node/operation-node-visitor.d.ts +2 -0
  326. package/dist/esm/operation-node/operation-node-visitor.js +1 -0
  327. package/dist/esm/operation-node/operation-node.d.ts +1 -1
  328. package/dist/esm/operation-node/select-query-node.d.ts +0 -9
  329. package/dist/esm/operation-node/select-query-node.js +0 -11
  330. package/dist/esm/parser/join-parser.js +1 -1
  331. package/dist/esm/parser/order-by-parser.d.ts +1 -14
  332. package/dist/esm/parser/order-by-parser.js +0 -12
  333. package/dist/esm/performance/query-optimizer.d.ts +1 -1
  334. package/dist/esm/performance/query-optimizer.js +5 -9
  335. package/dist/esm/performance/services/metrics-collector.d.ts +11 -2
  336. package/dist/esm/performance/services/metrics-collector.js +56 -3
  337. package/dist/esm/query-builder/aggregate-function-builder.d.ts +1 -25
  338. package/dist/esm/query-builder/delete-query-builder.d.ts +115 -17
  339. package/dist/esm/query-builder/order-by-interface.d.ts +1 -14
  340. package/dist/esm/query-builder/over-builder.d.ts +1 -14
  341. package/dist/esm/query-builder/select-query-builder.d.ts +1 -13
  342. package/dist/esm/query-builder/update-query-builder.d.ts +2 -17
  343. package/dist/esm/query-compiler/default-query-compiler.d.ts +2 -0
  344. package/dist/esm/query-compiler/default-query-compiler.js +3 -6
  345. package/dist/esm/relationships/relationship-engine.js +2 -2
  346. package/dist/esm/repository/repository-factory.d.ts +11 -7
  347. package/dist/esm/repository/repository-factory.js +203 -212
  348. package/dist/esm/schema/builders/alter-table-add-index-builder.d.ts +1 -1
  349. package/dist/esm/schema/builders/alter-table-add-index-builder.js +2 -2
  350. package/dist/esm/schema/builders/create-index-builder.d.ts +3 -2
  351. package/dist/esm/schema/builders/create-index-builder.js +5 -3
  352. package/dist/esm/schema/core/discovery/relationship-discovery.js +45 -6
  353. package/dist/esm/schema/core/discovery/table-metadata-discovery.js +11 -7
  354. package/dist/esm/schema/core/discovery/view-discovery.js +14 -15
  355. package/dist/esm/schema/core/factories/discovery-factory.d.ts +5 -8
  356. package/dist/esm/schema/core/factories/discovery-factory.js +23 -1
  357. package/dist/esm/schema/core/utils/type-mapper.js +21 -0
  358. package/dist/esm/schema/dialects/postgresql/postgresql-discovery.coordinator.d.ts +44 -0
  359. package/dist/esm/schema/dialects/postgresql/postgresql-discovery.coordinator.js +113 -0
  360. package/dist/esm/schema/dialects/sqlite/sqlite-discovery.coordinator.js +38 -10
  361. package/dist/esm/schema/test/discovery-factory.test.js +1 -1
  362. package/dist/esm/schema/test/error-handling.test.js +1 -1
  363. package/dist/esm/schema/test/integration.test.js +4 -2
  364. package/dist/esm/schema/test/sqlite-discovery-coordinator.test.js +12 -4
  365. package/dist/esm/sqlite-migration/sqlite-migration-manager.d.ts +18 -1
  366. package/dist/esm/sqlite-migration/sqlite-migration-manager.js +75 -34
  367. package/dist/esm/sqlite-migration/sqlite-migration-provider.d.ts +0 -6
  368. package/dist/esm/sqlite-migration/sqlite-migration-provider.js +39 -70
  369. package/dist/esm/types/index.d.ts +253 -1
  370. package/dist/esm/types/type-generator.d.ts +0 -4
  371. package/dist/esm/types/type-generator.js +15 -57
  372. package/dist/esm/util/similarity.d.ts +12 -0
  373. package/dist/esm/util/similarity.js +66 -0
  374. package/dist/esm/watch/schema-watcher.d.ts +2 -0
  375. package/dist/esm/watch/schema-watcher.js +95 -19
  376. package/package.json +20 -20
package/README.md CHANGED
@@ -1,344 +1,109 @@
1
- # NOORMME - The NO-ORM for Normies
1
+ # NOORMME: The Agentic Data Engine
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/noormme)](https://www.npmjs.com/package/noormme)
4
- [![npm downloads](https://img.shields.io/npm/dm/noormme)](https://www.npmjs.com/package/noormme)
5
- [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue)](https://www.typescriptlang.org/)
7
- [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D20-green)](https://nodejs.org/)
3
+ **NOORMME** is a sovereign persistence layer and cognitive operating system designed for **Autonomous AI Agents**. It transcends legacy ORM patterns by providing a self-healing, evolutionary data infrastructure that functions as an extension of the agent's internal reasoning loop.
8
4
 
9
- > **"Finally, an ORM that doesn't make me feel dumb."** - Every Normie Developer Ever
5
+ [![Version](https://img.shields.io/npm/v/noormme.svg)](https://www.npmjs.com/package/noormme)
6
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
+ [![Cognitive](https://img.shields.io/badge/Intelligence-Autonomous_Governance-purple.svg)](#-autonomous-governance)
10
8
 
11
- **NOORMME** (pronounced "normie") is the toolkit that makes you feel like a coding genius without actually being one. It's like having a senior developer in your pocket, but without the attitude.
12
-
13
- **The Mission**: Make AI-assisted development so easy, even your grandma could build a startup (if she wanted to).
14
-
15
- ## 🤔 Why Should You Care? (Spoiler: You Should)
16
-
17
- ### **The Problem (AKA Why You're Reading This):**
18
- You're probably here because:
19
- - Setting up databases makes you want to throw your laptop out the window
20
- - You've spent more time configuring ORMs than actually coding
21
- - AI tools keep suggesting code that doesn't work with your setup
22
- - You're tired of feeling like you need a computer science degree to build a simple app
23
- - Your project structure looks like a tornado hit a code factory
24
-
25
- ### **The NOORMME Solution (AKA Your New Best Friend):**
26
- We fixed all that nonsense:
27
- - **Zero-config database** - Point, click, done (well, almost)
28
- - **AI that actually helps** - No more "helpful" suggestions that break everything
29
- - **Organized by default** - Your code will look like a senior dev wrote it
30
- - **Minimal setup** - From "I have an idea" to "I have an app" in 5 minutes
31
- - **No vendor lock-in** - You're not trapped in framework jail
32
-
33
- ### **Real Benefits (The Stuff That Actually Matters):**
34
- - 🚀 **Feel like a coding wizard** - AI that understands your project
35
- - 💰 **Save money** - No expensive database servers to maintain
36
- - 🔧 **Deploy easily** - One file instead of a server farm
37
- - ⚡ **Go fast** - Direct file access beats network calls every time
38
- - 🛡️ **Stay secure** - No network = no network attacks
39
- - 😊 **Have fun** - Finally, coding that doesn't make you cry
40
-
41
- **Bottom line:** You get enterprise-grade superpowers with the simplicity of a single file.
42
-
43
- ## 🚀 What's the Big Deal? (Spoiler: It's Actually Pretty Big)
44
-
45
- **Before NOORMME:** You spend 8 hours setting up a database, 4 hours organizing your project, and 2 hours fighting with AI tools that suggest code from 2019.
46
-
47
- **With NOORMME:** Your development environment becomes AI-ready in 5 minutes:
48
- - ✅ **SQLite that acts like PostgreSQL** - All the power, none of the pain
49
- - ✅ **Organized architecture** - Patterns that actually make sense
50
- - ✅ **AI context rules** - Cursor IDE integration that works
51
- - ✅ **Type safety** - TypeScript that doesn't make you want to throw things
52
- - ✅ **Production features** - WAL mode, caching, and performance optimization
53
-
54
- **It's literally a development environment that makes AI assistance useful.** 🤯
55
-
56
- ## ⚡ Get Started in 60 Seconds (No, Really)
57
-
58
- ### 1. Install It (The Easy Part)
59
- ```bash
60
- npm install noormme
61
- ```
62
-
63
- ### 2. Initialize Your Project (The Even Easier Part)
64
- ```bash
65
- npx noormme init
66
- ```
67
-
68
- ### 3. Point at Your Database (The "Wait, That's It?" Part)
69
- ```typescript
70
- import { NOORMME } from 'noormme'
71
-
72
- const db = new NOORMME({
73
- dialect: 'sqlite',
74
- connection: {
75
- database: './your-database.sqlite' // Point to your existing database
76
- }
77
- })
78
-
79
- await db.initialize()
80
- ```
81
-
82
- ### 4. Start Building with AI Assistance (The "I'm a Genius Now" Part)
83
- ```typescript
84
- // NOORMME automatically finds your 'users' table and creates methods
85
- const userRepo = db.getRepository('users')
86
-
87
- // These methods are automatically available based on your table columns:
88
- const users = await userRepo.findAll()
89
- const user = await userRepo.findByEmail('john@example.com')
90
- const activeUsers = await userRepo.findManyByStatus('active')
91
-
92
- // Full CRUD with type safety (because we're not animals)
93
- const newUser = await userRepo.create({
94
- name: 'Jane Doe',
95
- email: 'jane@example.com'
96
- })
97
- ```
98
-
99
- **That's it!** Your development environment is now AI-ready and organized. 🎉
100
-
101
- ## 🎯 What NOORMME Does For You (The Magic Behind the Curtain)
102
-
103
- ### 🔍 **Database Automation (AKA "How Did It Know That?")**
104
- NOORMME looks at your SQLite database and goes "Oh, I see what you're trying to do here":
105
- - **Auto-discovery** - Finds tables, columns, and relationships (like a detective, but for databases)
106
- - **Type generation** - Creates TypeScript interfaces (because guessing types is for amateurs)
107
- - **Performance optimization** - WAL mode, caching, and index recommendations (because slow is the enemy)
108
- - **Health monitoring** - Real-time performance tracking (because knowing is half the battle)
109
-
110
- ### 🏗️ **Organized Architecture (AKA "Finally, Code That Makes Sense")**
111
- NOORMME applies patterns from frameworks that actually work:
112
- - **Django-style structure** - Organized folders and clear separation (because chaos is not a feature)
113
- - **Laravel-style services** - Service classes and repository patterns (because organization is beautiful)
114
- - **Rails-style conventions** - Naming conventions and file organization (because consistency is key)
115
- - **Next.js patterns** - App Router, Server Components, and modern React patterns (because we live in 2025)
116
-
117
- ### 🤖 **AI-Ready Development (AKA "Finally, AI That Actually Helps")**
118
- NOORMME makes AI assistance useful (revolutionary, we know):
119
- - **Cursor IDE integration** - Context rules that AI tools understand (because context matters)
120
- - **Consistent patterns** - AI generates code that follows your conventions (because consistency is everything)
121
- - **Type safety** - AI suggestions are always type-safe (because runtime errors are for the weak)
122
- - **Documentation** - AI understands your project structure (because understanding is power)
123
-
124
- ### ⚡ **Performance Optimization (AKA "Speed Is Life")**
125
- NOORMME automatically makes everything faster:
126
- - **WAL mode** - Concurrent read/write operations (because waiting is for losers)
127
- - **Intelligent caching** - Cache frequently accessed data (because memory is cheap, time is not)
128
- - **Query optimization** - Automatic index recommendations (because slow queries are the enemy)
129
- - **Real-time monitoring** - Performance metrics and health checks (because ignorance is not bliss)
130
-
131
- ## 🔥 WAL Mode: Why This Changes Everything (The Technical Stuff Made Simple)
132
-
133
- **The Problem:** Most SQLite databases are slow and lock up when multiple people try to use them. It's like having a single-lane road for a busy intersection during rush hour.
134
-
135
- **The NOORMME Solution:** WAL Mode (Write-Ahead Logging) turns your SQLite file into a multi-lane highway with express lanes.
136
-
137
- ### **What WAL Mode Actually Does (In Plain English):**
9
+ ---
138
10
 
139
- **Before WAL Mode (The Dark Ages):**
140
- - When someone writes to the database, EVERYONE has to wait
141
- - Reading data blocks writing data (and vice versa)
142
- - Your app freezes when multiple users try to do things at once
143
- - It's like having one checkout lane at Walmart on Black Friday
11
+ ## 🏗 The Agentic Data Loop
144
12
 
145
- **With NOORMME's WAL Mode (The Renaissance):**
146
- - ✅ **Multiple readers can access data simultaneously** - No more waiting in line
147
- - ✅ **Writers don't block readers** - Updates happen in the background
148
- - ✅ **3x faster write operations** - Append-only logging is lightning fast
149
- - ✅ **Better crash recovery** - Your data is safer than Fort Knox
150
- - ✅ **Real production performance** - Handles thousands of concurrent users
13
+ NOORMME implements a closed-loop system where data is not merely "stored" but continuously distilled, questioned, and evolved.
151
14
 
152
- ### **Real-World Proof (Because We Don't Make Stuff Up):**
153
- NOORMME's WAL Mode is already running in production at **DreamBeesArt**, where it:
154
- - Handles multiple users creating and editing content simultaneously
155
- - Processes orders and inventory updates without blocking customer browsing
156
- - Maintains sub-second response times even under heavy load
157
- - Provides enterprise-level reliability in a simple SQLite file
15
+ ### 🧠 Cognitive Orchestration
16
+ - **Strategic Planner**: Proactively suggests and applies persona mutations (roles, policies, capabilities) based on real-time success/latency telemetry.
17
+ - **Knowledge Distiller**: Extracts structured entities and facts from raw history using Jaccard similarity-based consolidation and confidence gradients.
18
+ - **Curiosity Engine**: Identifies "Knowledge Gaps" and "Factual Contradictions," generating research hypotheses and active questions for the agent to resolve.
19
+ - **Ablation Labs**: Conducts "Zombie Pruning" and "Impact Tests"—temporarily disabling knowledge to evaluate its necessity in the reasoning path.
158
20
 
159
- ### **The Magic Behind the Scenes (The Technical Wizardry):**
160
- Instead of one database file, WAL Mode creates three files:
161
- - `your-database.db` - Your actual data (the main file)
162
- - `your-database.db-wal` - Pending changes (like a shopping cart)
163
- - `your-database.db-shm` - Coordination between processes (like traffic lights)
21
+ ---
164
22
 
165
- **Don't worry** - NOORMME handles all three files automatically. You just see your database working like a high-performance server.
23
+ ## 💎 Technical Moats
166
24
 
167
- ### **Why You Should Care (The Bottom Line):**
168
- - 🚀 **Your app won't freeze** when multiple users are active
169
- - 💰 **Save money** - No need for expensive database servers
170
- - 🔧 **Easier deployment** - Copy one file instead of managing servers
171
- - **Better user experience** - Everything feels snappy and responsive
172
- - 🛡️ **More reliable** - Your data is safer with better crash recovery
25
+ ### 🧬 Evolutionary Infrastructure & "DNA Inversion"
26
+ NOORMME allows agents to autonomously mutate their own schema.
27
+ - **Dynamic DDL**: Agents can propose `CREATE TABLE`, `ADD COLUMN`, or `CREATE INDEX` mutations via the **Evolutionary Pilot**.
28
+ - **Structural Rollback**: The **DNA Inverter** automatically generates inverse SQL for any DDL mutation (e.g., inverting an `ADD COLUMN` to a `DROP COLUMN`) to ensure safe structural experimentation.
29
+ - **Real-Time Type Synthesis**: TypeScript interfaces and types are regenerated and written to disk the moment a structural change is committed.
173
30
 
174
- **Bottom line:** Your SQLite file becomes as powerful as PostgreSQL, but without the complexity.
31
+ ### 🚥 Autonomous Governance (Logic Probes)
32
+ The **Self-Test Registry** enables agents to maintain their own integrity through automated "probes":
33
+ - **Integrity Audits**: Detects orphaned records and semantic memory failures.
34
+ - **Performance Drift**: Detects when autonomous schema changes cause query latency to drift more than 50% from a rolling 100-query baseline.
35
+ - **Consistency Probes**: Verifies that new knowledge doesn't contradict established "Hive" facts.
175
36
 
176
- ## 🛠️ CLI Tools (For When You Want to Feel Like a Pro)
37
+ ### 📊 Deep Behavioral Telemetry
38
+ A three-layered telemetry stack for research and production observation:
39
+ 1. **Raw Event Harvester**: High-fidelity capture of every interaction, pivot, and failure.
40
+ 2. **Cognitive Synthesizer**: Serializes the strategic "Evolution Path" and calculates dynamic **Autonomy Levels**.
41
+ 3. **Research Alchemist**: Transmutes events into high-order metrics like **Time-to-Magic**, **Discovery Index**, and **Trust Signals**.
177
42
 
178
- NOORMME includes command-line tools that make development stupidly simple:
43
+ ---
179
44
 
180
- ### Analyze Your Database (The "What's Wrong?" Tool)
181
- ```bash
182
- # See what's slow and get recommendations
183
- npx noormme analyze --database ./app.sqlite
184
- ```
45
+ ## Performance Engineering
185
46
 
186
- ### Optimize Performance (The "Make It Faster" Tool)
187
- ```bash
188
- # Make your database faster automatically
189
- npx noormme optimize --database ./app.sqlite
190
- ```
47
+ ### Query Intelligence
48
+ - **N+1 Detection**: Real-time pattern analysis to identify and warn about inefficient recursive queries.
49
+ - **Semantic Caching**: Context-aware result caching that understands query patterns rather than just raw SQL.
50
+ - **Dialect Optimization**: Native WAL-mode management for SQLite and optimized JSONB/Vector operations for PostgreSQL.
191
51
 
192
- ### Watch and Auto-Optimize (The "Set It and Forget It" Tool)
193
- ```bash
194
- # Set it and forget it - NOORMME watches your database
195
- npx noormme watch --auto-optimize
196
- ```
52
+ ### High-Fidelity Infrastructure
53
+ - **Unified Vector Abstraction**: Seamless semantic search across `PGVector`, `SQLite-vss`, and a optimized **Manual Cosine Fallback**.
54
+ - **Ritual Orchestration**: Automated background "rituals" for semantic compression, stale history pruning, and database vacuuming.
197
55
 
198
- ### Generate Project Structure (The "I'm Too Lazy" Tool)
199
- ```bash
200
- # Create organized Next.js project with NOORMME
201
- npx noormme create --template nextjs --name my-app
202
- ```
56
+ ---
203
57
 
204
- ## 💡 Real Examples (Because Examples Are Everything)
58
+ ## 🚀 Implementation
205
59
 
206
- ### Blog App with AI Assistance (The "I Want to Build a Blog" Example)
60
+ ### Initializing the Mind
207
61
  ```typescript
208
- const db = new NOORMME({
209
- dialect: 'sqlite',
210
- connection: { database: './blog.sqlite' }
211
- })
212
-
213
- await db.initialize()
214
-
215
- // Auto-generated repositories (because we're not writing boilerplate)
216
- const postRepo = db.getRepository('posts')
217
- const userRepo = db.getRepository('users')
62
+ import { NOORMME } from 'noormme';
218
63
 
219
- // Smart methods based on your schema (because we're smart like that)
220
- const recentPosts = await postRepo.findManyByPublished(true)
221
- const adminUsers = await userRepo.findManyByRole('admin')
222
-
223
- // Complex queries with full type safety (because we're not animals)
224
- const postWithAuthor = await db.getKysely()
225
- .selectFrom('posts')
226
- .innerJoin('users', 'users.id', 'posts.author_id')
227
- .select(['posts.title', 'users.name as author'])
228
- .where('posts.published', '=', true)
229
- .execute()
230
- ```
231
-
232
- ### E-commerce App with Organized Architecture (The "I Want to Make Money" Example)
233
- ```typescript
234
- // Point at your existing e-commerce database
235
64
  const db = new NOORMME({
236
65
  dialect: 'sqlite',
237
- connection: { database: './shop.sqlite' }
238
- })
239
-
240
- await db.initialize()
241
-
242
- const productRepo = db.getRepository('products')
243
- const orderRepo = db.getRepository('orders')
66
+ connection: { database: './mind.sqlite' },
67
+ agentic: {
68
+ enableSelfEvolution: true,
69
+ enableSelfHealing: true
70
+ }
71
+ });
244
72
 
245
- // Auto-generated methods work with your existing data (because we're not picky)
246
- const featuredProducts = await productRepo.findManyByFeatured(true)
247
- const pendingOrders = await orderRepo.findManyByStatus('pending')
73
+ // Provisions 20+ tables for goals, knowledge, episodes, and logic probes
74
+ await db.initialize();
248
75
  ```
249
76
 
250
- ## 🔧 Configuration (Optional, Because We're Not Dictators)
251
-
252
- For most people, the default settings work perfectly. But if you want to customize (because you're a special snowflake):
253
-
77
+ ### Strategic Interaction
254
78
  ```typescript
255
- const db = new NOORMME({
256
- dialect: 'sqlite',
257
- connection: {
258
- database: './app.sqlite'
259
- },
260
- automation: {
261
- enableAutoOptimization: true, // Make it fast automatically
262
- enableIndexRecommendations: true, // Suggest better indexes
263
- enableQueryAnalysis: true, // Find slow queries
264
- },
265
- performance: {
266
- enableCaching: true, // Cache results for speed
267
- maxCacheSize: 1000 // How much to cache
268
- }
269
- })
270
- ```
271
-
272
- ## 🚀 Production Ready (Because We're Not Playing Around)
273
-
274
- NOORMME is already running in production applications with real-world success stories. It includes:
275
-
276
- - **Health monitoring** - Know when something's wrong (because ignorance is not bliss)
277
- - **Performance metrics** - See how fast your queries are (because speed is life)
278
- - **Security features** - Protection against common attacks (because security matters)
279
- - **Migration support** - Move from PostgreSQL to SQLite easily (because change is good)
280
- - **Backup strategies** - Your data is safe (because data loss is not fun)
281
- - **WAL Mode implementation** - Proven in production at DreamBeesArt with enterprise-level performance
282
-
283
- ### **Real Production Success (Because We Don't Make Stuff Up):**
284
- The DreamBeesArt application successfully migrated from Drizzle ORM to NOORMME with WAL Mode, achieving:
285
- - **Better concurrent access** - Multiple users can create/edit content simultaneously
286
- - **Improved write performance** - 3x faster operations with append-only logging
287
- - **Enhanced reliability** - Better crash recovery and data integrity
288
- - **Reduced complexity** - From complex database server setup to a single SQLite file
289
- - **Lower costs** - No database hosting fees while maintaining enterprise performance
290
-
291
- ## ❓ FAQ for Normies (The Questions You're Too Afraid to Ask)
292
-
293
- **Q: Do I need to learn SQL?**
294
- A: Nope! NOORMME handles most things automatically. You only need SQL for complex queries (and even then, we'll help you).
295
-
296
- **Q: Can I use my existing database?**
297
- A: Yes! Just point NOORMME at your existing SQLite file and it figures everything out (because we're not picky).
79
+ // Access the higher-order cognitive facade
80
+ const cortex = db.agent.cortex;
298
81
 
299
- **Q: Is this really production-ready?**
300
- A: Absolutely. Real applications are using it right now with better performance than PostgreSQL (because we're not lying).
82
+ // Execute a background knowledge distillation ritual
83
+ await cortex.rituals.runPendingRituals();
301
84
 
302
- **Q: What if I'm already using another ORM?**
303
- A: NOORMME works alongside other tools. You can migrate gradually or use both (because we're not territorial).
304
-
305
- **Q: Do I need TypeScript?**
306
- A: NOORMME works with JavaScript too, but TypeScript gives you the best experience (because types are your friends).
307
-
308
- **Q: How does this work with AI tools like Cursor?**
309
- A: NOORMME includes Cursor IDE context rules that make AI assistance actually useful. The AI understands your project structure and generates code that follows your conventions (because we're not savages).
310
-
311
- **Q: What makes this different from other toolkits?**
312
- A: NOORMME combines database automation, organized architecture, and AI-ready patterns in one integrated toolkit. It's not just an ORM - it's a complete development environment (because we're ambitious).
313
-
314
- **Q: Will this make me a better developer?**
315
- A: Probably not, but it will make you feel like one (which is half the battle).
316
-
317
- ## 🤝 Contributing (Because We're Not Perfect)
318
-
319
- Found a bug? Have an idea? We'd love your help! (Because we're not too proud to ask for help)
320
-
321
- ```bash
322
- git clone https://github.com/cardsorting/noormme.git
323
- cd noormme
324
- npm install
325
- npm test
85
+ // Challenge existing knowledge with new evidence
86
+ await cortex.knowledge.challengeKnowledge('SystemArchitecture', 'New facts contradict old.', 0.95);
326
87
  ```
327
88
 
328
- ## 📄 License (The Legal Stuff)
89
+ ---
329
90
 
330
- Apache 2.0 License - see [LICENSE](LICENSE) file for details. (Because we're not lawyers, but we try to be responsible)
91
+ ## 🗄 Dialect Matrix
331
92
 
332
- ## 🎉 Start Today (Because Tomorrow Is Overrated)
93
+ | Feature | SQLite (Edge) | PostgreSQL (Enterprise) |
94
+ | :--- | :--- | :--- |
95
+ | **Search** | `sqlite-vss` / Fallback | `pgvector` |
96
+ | **Persistence** | WAL Mode | Native Pooling / SSL |
97
+ | **Evolution** | DNA Inversion | Structural Migrations |
98
+ | **Reliability** | Local Atomicity | Multi-Tenant Isolation |
333
99
 
334
- Ready to make your development environment work for you instead of against you?
100
+ ---
335
101
 
336
- ```bash
337
- npm install noormme
338
- ```
102
+ ## 🤝 Community & Contribution
103
+ NOORMME is an Apache 2.0 open-source project. We invite AI researchers and data engineers to contribute to the future of autonomous persistence.
339
104
 
340
- **Because AI-assisted development should be normal, not rocket science.** 🚀
105
+ [Contribution Guide](CONTRIBUTING.md) | [Security Audit](SECURITY.md)
341
106
 
342
107
  ---
343
108
 
344
- *NOORMME - Making AI-assisted development so simple, even normies can use it.*
109
+ *Transforming passive records into sovereign intelligence.*
@@ -0,0 +1,55 @@
1
+ import type { Kysely } from '../kysely.js';
2
+ import type { AgenticConfig, AgentAction } from '../types/index.js';
3
+ import type { TelemetryOrchestrator } from './telemetry/TelemetryOrchestrator.js';
4
+ export interface ActionTable {
5
+ id: number | string;
6
+ session_id: number | string;
7
+ message_id: number | string | null;
8
+ tool_name: string;
9
+ arguments: string;
10
+ outcome: string | null;
11
+ status: 'success' | 'failure' | 'pending';
12
+ duration_ms: number | null;
13
+ metadata: string | null;
14
+ created_at: string | Date;
15
+ }
16
+ export interface ActionDatabase {
17
+ agent_actions: ActionTable;
18
+ }
19
+ /**
20
+ * ActionJournal records tool usage and outcomes to help agents learn
21
+ * from their past actions.
22
+ */
23
+ export declare class ActionJournal {
24
+ private db;
25
+ private config;
26
+ private telemetry?;
27
+ private actionsTable;
28
+ constructor(db: Kysely<any>, config?: AgenticConfig, telemetry?: TelemetryOrchestrator | undefined);
29
+ private get typedDb();
30
+ /**
31
+ * Log an action (tool call)
32
+ */
33
+ logAction(sessionId: string | number, toolName: string, args: Record<string, any>, messageId?: string | number): Promise<AgentAction>;
34
+ /**
35
+ * Update action with outcome
36
+ */
37
+ recordOutcome(actionId: string | number, status: AgentAction['status'], outcome: string, durationMs?: number, metadata?: Record<string, any>): Promise<AgentAction>;
38
+ /**
39
+ * Get actions for a session
40
+ */
41
+ getSessionActions(sessionId: string | number): Promise<AgentAction[]>;
42
+ /**
43
+ * Get actions by tool name across all sessions.
44
+ */
45
+ getActionsByTool(toolName: string, limit?: number): Promise<AgentAction[]>;
46
+ /**
47
+ * Generate a report of tool failures.
48
+ */
49
+ getFailureReport(): Promise<{
50
+ toolName: string;
51
+ failureCount: number;
52
+ lastFailure: string;
53
+ }[]>;
54
+ private parseAction;
55
+ }
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionJournal = void 0;
4
+ /**
5
+ * ActionJournal records tool usage and outcomes to help agents learn
6
+ * from their past actions.
7
+ */
8
+ class ActionJournal {
9
+ db;
10
+ config;
11
+ telemetry;
12
+ actionsTable;
13
+ constructor(db, config = {}, telemetry) {
14
+ this.db = db;
15
+ this.config = config;
16
+ this.telemetry = telemetry;
17
+ this.actionsTable = config.actionsTable || 'agent_actions';
18
+ }
19
+ get typedDb() {
20
+ return this.db;
21
+ }
22
+ /**
23
+ * Log an action (tool call)
24
+ */
25
+ async logAction(sessionId, toolName, args, messageId) {
26
+ const action = await this.typedDb
27
+ .insertInto(this.actionsTable)
28
+ .values({
29
+ session_id: sessionId,
30
+ message_id: messageId || null,
31
+ tool_name: toolName,
32
+ arguments: JSON.stringify(args),
33
+ status: 'pending',
34
+ created_at: new Date()
35
+ })
36
+ .returningAll()
37
+ .executeTakeFirstOrThrow();
38
+ const parsed = this.parseAction(action);
39
+ // Telemetry: Track action start
40
+ if (this.telemetry) {
41
+ await this.telemetry.track(sessionId, 'action', `Tool call: ${toolName}`, { actionId: action.id, arguments: args });
42
+ }
43
+ return parsed;
44
+ }
45
+ /**
46
+ * Update action with outcome
47
+ */
48
+ async recordOutcome(actionId, status, outcome, durationMs, metadata) {
49
+ const action = await this.typedDb
50
+ .updateTable(this.actionsTable)
51
+ .set({
52
+ status,
53
+ outcome,
54
+ duration_ms: durationMs || null,
55
+ metadata: metadata ? JSON.stringify(metadata) : null
56
+ })
57
+ .where('id', '=', actionId)
58
+ .returningAll()
59
+ .executeTakeFirstOrThrow();
60
+ const parsed = this.parseAction(action);
61
+ // Telemetry: Track outcome and failures
62
+ if (this.telemetry) {
63
+ if (status === 'failure') {
64
+ await this.telemetry.track(parsed.sessionId, 'error', `Action failed: ${outcome}`, { actionId, status });
65
+ }
66
+ }
67
+ return parsed;
68
+ }
69
+ /**
70
+ * Get actions for a session
71
+ */
72
+ async getSessionActions(sessionId) {
73
+ const actions = await this.typedDb
74
+ .selectFrom(this.actionsTable)
75
+ .selectAll()
76
+ .where('session_id', '=', sessionId)
77
+ .orderBy('created_at', 'asc')
78
+ .execute();
79
+ return actions.map(a => this.parseAction(a));
80
+ }
81
+ /**
82
+ * Get actions by tool name across all sessions.
83
+ */
84
+ async getActionsByTool(toolName, limit = 50) {
85
+ const actions = await this.typedDb
86
+ .selectFrom(this.actionsTable)
87
+ .selectAll()
88
+ .where('tool_name', '=', toolName)
89
+ .orderBy('created_at', 'desc')
90
+ .limit(limit)
91
+ .execute();
92
+ return actions.map(a => this.parseAction(a));
93
+ }
94
+ /**
95
+ * Generate a report of tool failures.
96
+ */
97
+ async getFailureReport() {
98
+ const results = await this.typedDb
99
+ .selectFrom(this.actionsTable)
100
+ .select([
101
+ 'tool_name',
102
+ (eb) => eb.fn.count('id').as('failureCount'),
103
+ (eb) => eb.fn.max('created_at').as('lastFailure')
104
+ ])
105
+ .where('status', '=', 'failure')
106
+ .groupBy('tool_name')
107
+ .orderBy((eb) => eb.fn.count('id'), 'desc')
108
+ .execute();
109
+ return results.map((r) => ({
110
+ toolName: r.tool_name,
111
+ failureCount: Number(r.failureCount),
112
+ lastFailure: r.lastFailure
113
+ }));
114
+ }
115
+ parseAction(action) {
116
+ return {
117
+ id: action.id,
118
+ sessionId: action.session_id,
119
+ messageId: action.message_id,
120
+ toolName: action.tool_name,
121
+ arguments: typeof action.arguments === 'string' ? JSON.parse(action.arguments) : (action.arguments || {}),
122
+ status: action.status,
123
+ outcome: action.outcome,
124
+ durationMs: action.duration_ms,
125
+ metadata: typeof action.metadata === 'string' ? JSON.parse(action.metadata) : (action.metadata || {}),
126
+ createdAt: new Date(action.created_at)
127
+ };
128
+ }
129
+ }
130
+ exports.ActionJournal = ActionJournal;
@@ -0,0 +1,43 @@
1
+ import type { Kysely } from '../kysely.js';
2
+ import type { AgenticConfig, AgentCapability } from '../types/index.js';
3
+ export interface CapabilityTable {
4
+ id: number | string;
5
+ name: string;
6
+ version: string;
7
+ description: string | null;
8
+ reliability: number;
9
+ metadata: string | null;
10
+ created_at: string | Date;
11
+ updated_at: string | Date;
12
+ }
13
+ export interface CapabilityDatabase {
14
+ agent_capabilities: CapabilityTable;
15
+ }
16
+ /**
17
+ * CapabilityManager tracks the skills (tools) available to an agent
18
+ * and their historical reliability.
19
+ */
20
+ export declare class CapabilityManager {
21
+ private db;
22
+ private config;
23
+ private capabilitiesTable;
24
+ constructor(db: Kysely<any>, config?: AgenticConfig);
25
+ private get typedDb();
26
+ /**
27
+ * Register or update a capability (skill)
28
+ */
29
+ registerCapability(name: string, version: string, description?: string, metadata?: Record<string, any>): Promise<AgentCapability>;
30
+ /**
31
+ * Update reliability based on action outcome using a damped moving average.
32
+ */
33
+ reportOutcome(name: string, success: boolean): Promise<void>;
34
+ /**
35
+ * Get reliability score for a capability.
36
+ */
37
+ getReliability(name: string): Promise<number>;
38
+ /**
39
+ * Get all registered capabilities
40
+ */
41
+ getCapabilities(): Promise<AgentCapability[]>;
42
+ private parseCapability;
43
+ }