@happyvertical/smrt-core 0.42.6 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/AGENTS.md +39 -43
  2. package/agents/collection-reads.md +40 -0
  3. package/agents/data-query.md +21 -0
  4. package/agents/latest-related.md +35 -0
  5. package/agents/memory.md +16 -0
  6. package/agents/schema-paths.md +29 -15
  7. package/dist/browser.js +2 -2
  8. package/dist/cascade.d.ts +7 -6
  9. package/dist/cascade.d.ts.map +1 -1
  10. package/dist/cascade.js +19 -21
  11. package/dist/cascade.js.map +1 -1
  12. package/dist/class.d.ts +17 -0
  13. package/dist/class.d.ts.map +1 -1
  14. package/dist/class.js +30 -0
  15. package/dist/class.js.map +1 -1
  16. package/dist/collection.d.ts +164 -3
  17. package/dist/collection.d.ts.map +1 -1
  18. package/dist/collection.js +345 -10
  19. package/dist/collection.js.map +1 -1
  20. package/dist/decorators/index.d.ts +33 -15
  21. package/dist/decorators/index.d.ts.map +1 -1
  22. package/dist/decorators/index.js +16 -11
  23. package/dist/decorators/index.js.map +1 -1
  24. package/dist/generators/rest.d.ts.map +1 -1
  25. package/dist/generators/rest.js +10 -2
  26. package/dist/generators/rest.js.map +1 -1
  27. package/dist/generators/tool-schema.d.ts +14 -0
  28. package/dist/generators/tool-schema.d.ts.map +1 -1
  29. package/dist/generators/tool-schema.js +13 -1
  30. package/dist/generators/tool-schema.js.map +1 -1
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +3 -2
  34. package/dist/interceptors.d.ts +2 -1
  35. package/dist/interceptors.d.ts.map +1 -1
  36. package/dist/interceptors.js.map +1 -1
  37. package/dist/manifest/static-manifest.d.ts.map +1 -1
  38. package/dist/manifest/static-manifest.js +53 -1
  39. package/dist/manifest/static-manifest.js.map +1 -1
  40. package/dist/manifest/store.js +1 -1
  41. package/dist/manifest/store.js.map +1 -1
  42. package/dist/manifest.json +62 -1
  43. package/dist/migrations/differ.d.ts +2 -0
  44. package/dist/migrations/differ.d.ts.map +1 -1
  45. package/dist/migrations/differ.js +75 -0
  46. package/dist/migrations/differ.js.map +1 -1
  47. package/dist/migrations/generator.d.ts.map +1 -1
  48. package/dist/migrations/generator.js +19 -2
  49. package/dist/migrations/generator.js.map +1 -1
  50. package/dist/migrations/orchestrate.d.ts.map +1 -1
  51. package/dist/migrations/orchestrate.js +4 -1
  52. package/dist/migrations/orchestrate.js.map +1 -1
  53. package/dist/object.d.ts +4 -4
  54. package/dist/object.js +4 -4
  55. package/dist/object.js.map +1 -1
  56. package/dist/prebuild/index.d.ts.map +1 -1
  57. package/dist/prebuild/index.js +9 -0
  58. package/dist/prebuild/index.js.map +1 -1
  59. package/dist/registry/schema-builder.d.ts +6 -0
  60. package/dist/registry/schema-builder.d.ts.map +1 -1
  61. package/dist/registry/schema-builder.js +78 -8
  62. package/dist/registry/schema-builder.js.map +1 -1
  63. package/dist/registry.d.ts +5 -7
  64. package/dist/registry.d.ts.map +1 -1
  65. package/dist/registry.js +6 -8
  66. package/dist/registry.js.map +1 -1
  67. package/dist/runtime/types.d.ts +2 -2
  68. package/dist/runtime/types.d.ts.map +1 -1
  69. package/dist/scanner/manifest-generator.d.ts.map +1 -1
  70. package/dist/scanner/manifest-generator.js +62 -18
  71. package/dist/scanner/manifest-generator.js.map +1 -1
  72. package/dist/scanner/types.d.ts +5 -1
  73. package/dist/scanner/types.d.ts.map +1 -1
  74. package/dist/scanner/types.js.map +1 -1
  75. package/dist/schema/ddl/base-strategy.d.ts.map +1 -1
  76. package/dist/schema/ddl/base-strategy.js +2 -0
  77. package/dist/schema/ddl/base-strategy.js.map +1 -1
  78. package/dist/schema/ddl/duckdb-strategy.d.ts +1 -0
  79. package/dist/schema/ddl/duckdb-strategy.d.ts.map +1 -1
  80. package/dist/schema/ddl/duckdb-strategy.js +17 -1
  81. package/dist/schema/ddl/duckdb-strategy.js.map +1 -1
  82. package/dist/schema/ddl/postgres-strategy.js +1 -1
  83. package/dist/schema/foreign-key-ddl.d.ts +9 -0
  84. package/dist/schema/foreign-key-ddl.d.ts.map +1 -0
  85. package/dist/schema/foreign-key-ddl.js +53 -0
  86. package/dist/schema/foreign-key-ddl.js.map +1 -0
  87. package/dist/schema/foreign-key-planner.d.ts +18 -0
  88. package/dist/schema/foreign-key-planner.d.ts.map +1 -0
  89. package/dist/schema/foreign-key-planner.js +109 -0
  90. package/dist/schema/foreign-key-planner.js.map +1 -0
  91. package/dist/schema/foreign-key-policy.d.ts +21 -0
  92. package/dist/schema/foreign-key-policy.d.ts.map +1 -0
  93. package/dist/schema/foreign-key-policy.js +41 -0
  94. package/dist/schema/foreign-key-policy.js.map +1 -0
  95. package/dist/schema/generator.d.ts +3 -0
  96. package/dist/schema/generator.d.ts.map +1 -1
  97. package/dist/schema/generator.js +54 -10
  98. package/dist/schema/generator.js.map +1 -1
  99. package/dist/schema/index.d.ts +3 -0
  100. package/dist/schema/index.d.ts.map +1 -1
  101. package/dist/schema/index.js +4 -1
  102. package/dist/schema/manifest-schema.d.ts.map +1 -1
  103. package/dist/schema/manifest-schema.js +20 -3
  104. package/dist/schema/manifest-schema.js.map +1 -1
  105. package/dist/schema/schema-aggregator.d.ts +7 -1
  106. package/dist/schema/schema-aggregator.d.ts.map +1 -1
  107. package/dist/schema/schema-aggregator.js +54 -9
  108. package/dist/schema/schema-aggregator.js.map +1 -1
  109. package/dist/schema/schema-manager.d.ts +1 -6
  110. package/dist/schema/schema-manager.d.ts.map +1 -1
  111. package/dist/schema/schema-manager.js +26 -30
  112. package/dist/schema/schema-manager.js.map +1 -1
  113. package/dist/schema/types.d.ts +8 -5
  114. package/dist/schema/types.d.ts.map +1 -1
  115. package/dist/schema/utils.d.ts.map +1 -1
  116. package/dist/schema/utils.js +14 -1
  117. package/dist/schema/utils.js.map +1 -1
  118. package/dist/schema.js +4 -1
  119. package/dist/smrt-knowledge.json +63 -8
  120. package/dist/testing/database.d.ts +11 -1
  121. package/dist/testing/database.d.ts.map +1 -1
  122. package/dist/testing/database.js +80 -9
  123. package/dist/testing/database.js.map +1 -1
  124. package/dist/vite-plugin/index.d.ts.map +1 -1
  125. package/dist/vite-plugin/index.js +12 -3
  126. package/dist/vite-plugin/index.js.map +1 -1
  127. package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
  128. package/dist/vite-plugin/sveltekit-generator.js +24 -3
  129. package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
  130. package/dist/vite-plugin/web-collections.d.ts +3 -1
  131. package/dist/vite-plugin/web-collections.d.ts.map +1 -1
  132. package/dist/vite-plugin/web-collections.js +24 -4
  133. package/dist/vite-plugin/web-collections.js.map +1 -1
  134. package/package.json +4 -4
package/dist/registry.js CHANGED
@@ -1301,13 +1301,11 @@ var ObjectRegistry = class ObjectRegistry {
1301
1301
  * Foreign-key cycles (e.g. smrt-chat's ChatMessage.threadId -> ChatThread
1302
1302
  * and ChatThread.rootMessageId -> ChatMessage) are BROKEN rather than
1303
1303
  * treated as a fatal error: when a back-edge is encountered the recursion
1304
- * stops there, so every class still appears in the returned order. SMRT does
1305
- * not emit real DB `FOREIGN KEY` constraints in its generated CREATE TABLE
1306
- * DDL, so a table can be created before its cyclic reference target exists —
1307
- * the reference is satisfied once both tables are present. This mirrors the
1308
- * standard RDBMS approach (create tables first, wire cyclic references
1309
- * afterward) and matches SchemaManager.sortByDependencies, which already
1310
- * tolerates cycles. See issue #1333.
1304
+ * stops there, so every class still appears in the returned order. The schema
1305
+ * creation planner then handles physical constraints per engine: SQLite
1306
+ * keeps cyclic constraints inline, PostgreSQL defers them until both tables
1307
+ * exist, and DuckDB refuses unsupported cycles with actionable guidance.
1308
+ * See issues #1333 and #2413.
1311
1309
  *
1312
1310
  * @returns Array of class names in initialization order. Every registered
1313
1311
  * class appears exactly once; cycle back-edges are dropped from the
@@ -1339,7 +1337,7 @@ var ObjectRegistry = class ObjectRegistry {
1339
1337
  order.push(className);
1340
1338
  }
1341
1339
  for (const className of graph.keys()) if (!visited.has(className)) visit(className);
1342
- if (cycleMembers.size > 0) logger.warn(`[ObjectRegistry] Foreign-key cycle(s) detected and broken for ordering: ${[...cycleMembers].join(", ")}. Tables are created without strict cyclic ordering; SMRT does not emit DB-level FOREIGN KEY constraints, so this is safe.`);
1340
+ if (cycleMembers.size > 0) logger.warn(`[ObjectRegistry] Foreign-key cycle(s) detected and broken for ordering: ${[...cycleMembers].join(", ")}. Tables are created without strict cyclic ordering; the schema creation planner will apply engine-specific cycle handling.`);
1343
1341
  return order;
1344
1342
  }
1345
1343
  /**