ai-database 2.1.1 → 2.3.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 (268) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/README.md +1063 -186
  3. package/dist/actions.d.ts +2 -2
  4. package/dist/actions.d.ts.map +1 -1
  5. package/dist/actions.js +1 -1
  6. package/dist/actions.js.map +1 -1
  7. package/dist/ai-promise-db.d.ts +52 -23
  8. package/dist/ai-promise-db.d.ts.map +1 -1
  9. package/dist/ai-promise-db.js +185 -164
  10. package/dist/ai-promise-db.js.map +1 -1
  11. package/dist/authorization.d.ts.map +1 -1
  12. package/dist/authorization.js +38 -30
  13. package/dist/authorization.js.map +1 -1
  14. package/dist/cascade-orchestrator.d.ts +404 -0
  15. package/dist/cascade-orchestrator.d.ts.map +1 -0
  16. package/dist/cascade-orchestrator.js +828 -0
  17. package/dist/cascade-orchestrator.js.map +1 -0
  18. package/dist/cascade-write-strategy.d.ts +584 -0
  19. package/dist/cascade-write-strategy.d.ts.map +1 -0
  20. package/dist/cascade-write-strategy.js +590 -0
  21. package/dist/cascade-write-strategy.js.map +1 -0
  22. package/dist/ch-adapter.d.ts +358 -0
  23. package/dist/ch-adapter.d.ts.map +1 -0
  24. package/dist/ch-adapter.js +929 -0
  25. package/dist/ch-adapter.js.map +1 -0
  26. package/dist/client/index.d.ts +42 -0
  27. package/dist/client/index.d.ts.map +1 -0
  28. package/dist/client/index.js +43 -0
  29. package/dist/client/index.js.map +1 -0
  30. package/dist/client.d.ts +266 -0
  31. package/dist/client.d.ts.map +1 -0
  32. package/dist/client.js +81 -0
  33. package/dist/client.js.map +1 -0
  34. package/dist/constants.d.ts +64 -1
  35. package/dist/constants.d.ts.map +1 -1
  36. package/dist/constants.js +52 -2
  37. package/dist/constants.js.map +1 -1
  38. package/dist/dataloader.d.ts +99 -0
  39. package/dist/dataloader.d.ts.map +1 -0
  40. package/dist/dataloader.js +225 -0
  41. package/dist/dataloader.js.map +1 -0
  42. package/dist/db-provider-port.d.ts +501 -0
  43. package/dist/db-provider-port.d.ts.map +1 -0
  44. package/dist/db-provider-port.js +113 -0
  45. package/dist/db-provider-port.js.map +1 -0
  46. package/dist/digital-objects-provider.d.ts +49 -0
  47. package/dist/digital-objects-provider.d.ts.map +1 -0
  48. package/dist/digital-objects-provider.js +55 -0
  49. package/dist/digital-objects-provider.js.map +1 -0
  50. package/dist/do-sqlite-adapter.d.ts +402 -0
  51. package/dist/do-sqlite-adapter.d.ts.map +1 -0
  52. package/dist/do-sqlite-adapter.js +745 -0
  53. package/dist/do-sqlite-adapter.js.map +1 -0
  54. package/dist/docs-rels/custom-types.d.ts +134 -0
  55. package/dist/docs-rels/custom-types.d.ts.map +1 -0
  56. package/dist/docs-rels/custom-types.js +70 -0
  57. package/dist/docs-rels/custom-types.js.map +1 -0
  58. package/dist/docs-rels/index.d.ts +16 -0
  59. package/dist/docs-rels/index.d.ts.map +1 -0
  60. package/dist/docs-rels/index.js +16 -0
  61. package/dist/docs-rels/index.js.map +1 -0
  62. package/dist/docs-rels/migrations/index.d.ts +30 -0
  63. package/dist/docs-rels/migrations/index.d.ts.map +1 -0
  64. package/dist/docs-rels/migrations/index.js +128 -0
  65. package/dist/docs-rels/migrations/index.js.map +1 -0
  66. package/dist/docs-rels/schema.d.ts +2961 -0
  67. package/dist/docs-rels/schema.d.ts.map +1 -0
  68. package/dist/docs-rels/schema.js +244 -0
  69. package/dist/docs-rels/schema.js.map +1 -0
  70. package/dist/durable-clickhouse.d.ts.map +1 -1
  71. package/dist/durable-clickhouse.js +16 -13
  72. package/dist/durable-clickhouse.js.map +1 -1
  73. package/dist/durable-promise.d.ts.map +1 -1
  74. package/dist/durable-promise.js +34 -15
  75. package/dist/durable-promise.js.map +1 -1
  76. package/dist/errors.d.ts +127 -0
  77. package/dist/errors.d.ts.map +1 -0
  78. package/dist/errors.js +210 -0
  79. package/dist/errors.js.map +1 -0
  80. package/dist/eventbridge.d.ts +117 -0
  81. package/dist/eventbridge.d.ts.map +1 -0
  82. package/dist/eventbridge.js +238 -0
  83. package/dist/eventbridge.js.map +1 -0
  84. package/dist/events.d.ts +2 -2
  85. package/dist/events.d.ts.map +1 -1
  86. package/dist/events.js +1 -1
  87. package/dist/events.js.map +1 -1
  88. package/dist/execution-queue.d.ts.map +1 -1
  89. package/dist/execution-queue.js +4 -5
  90. package/dist/execution-queue.js.map +1 -1
  91. package/dist/index.d.ts +37 -8
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +112 -6
  94. package/dist/index.js.map +1 -1
  95. package/dist/linguistic.d.ts +3 -108
  96. package/dist/linguistic.d.ts.map +1 -1
  97. package/dist/linguistic.js +3 -372
  98. package/dist/linguistic.js.map +1 -1
  99. package/dist/logger.d.ts +132 -0
  100. package/dist/logger.d.ts.map +1 -0
  101. package/dist/logger.js +137 -0
  102. package/dist/logger.js.map +1 -0
  103. package/dist/memory-provider.d.ts +129 -0
  104. package/dist/memory-provider.d.ts.map +1 -1
  105. package/dist/memory-provider.js +592 -257
  106. package/dist/memory-provider.js.map +1 -1
  107. package/dist/pg-adapter.d.ts +424 -0
  108. package/dist/pg-adapter.d.ts.map +1 -0
  109. package/dist/pg-adapter.js +921 -0
  110. package/dist/pg-adapter.js.map +1 -0
  111. package/dist/pipelines-iceberg-emitter.d.ts +327 -0
  112. package/dist/pipelines-iceberg-emitter.d.ts.map +1 -0
  113. package/dist/pipelines-iceberg-emitter.js +351 -0
  114. package/dist/pipelines-iceberg-emitter.js.map +1 -0
  115. package/dist/provider-capabilities.d.ts +146 -0
  116. package/dist/provider-capabilities.d.ts.map +1 -0
  117. package/dist/provider-capabilities.js +214 -0
  118. package/dist/provider-capabilities.js.map +1 -0
  119. package/dist/rdb-provider-adapter.d.ts +195 -0
  120. package/dist/rdb-provider-adapter.d.ts.map +1 -0
  121. package/dist/rdb-provider-adapter.js +291 -0
  122. package/dist/rdb-provider-adapter.js.map +1 -0
  123. package/dist/schema/cascade.d.ts +49 -10
  124. package/dist/schema/cascade.d.ts.map +1 -1
  125. package/dist/schema/cascade.js +491 -273
  126. package/dist/schema/cascade.js.map +1 -1
  127. package/dist/schema/definition-caches.d.ts +24 -0
  128. package/dist/schema/definition-caches.d.ts.map +1 -0
  129. package/dist/schema/definition-caches.js +26 -0
  130. package/dist/schema/definition-caches.js.map +1 -0
  131. package/dist/schema/dependency-graph.d.ts +45 -0
  132. package/dist/schema/dependency-graph.d.ts.map +1 -0
  133. package/dist/schema/dependency-graph.js +47 -0
  134. package/dist/schema/dependency-graph.js.map +1 -0
  135. package/dist/schema/diff.d.ts +103 -0
  136. package/dist/schema/diff.d.ts.map +1 -0
  137. package/dist/schema/diff.js +329 -0
  138. package/dist/schema/diff.js.map +1 -0
  139. package/dist/schema/entity-operations.d.ts +99 -0
  140. package/dist/schema/entity-operations.d.ts.map +1 -0
  141. package/dist/schema/entity-operations.js +818 -0
  142. package/dist/schema/entity-operations.js.map +1 -0
  143. package/dist/schema/generation-context.d.ts +202 -0
  144. package/dist/schema/generation-context.d.ts.map +1 -0
  145. package/dist/schema/generation-context.js +393 -0
  146. package/dist/schema/generation-context.js.map +1 -0
  147. package/dist/schema/index.d.ts +32 -34
  148. package/dist/schema/index.d.ts.map +1 -1
  149. package/dist/schema/index.js +462 -519
  150. package/dist/schema/index.js.map +1 -1
  151. package/dist/schema/migration.d.ts +205 -0
  152. package/dist/schema/migration.d.ts.map +1 -0
  153. package/dist/schema/migration.js +327 -0
  154. package/dist/schema/migration.js.map +1 -0
  155. package/dist/schema/nl-query-generator.d.ts +68 -0
  156. package/dist/schema/nl-query-generator.d.ts.map +1 -0
  157. package/dist/schema/nl-query-generator.js +362 -0
  158. package/dist/schema/nl-query-generator.js.map +1 -0
  159. package/dist/schema/nl-query.d.ts +65 -0
  160. package/dist/schema/nl-query.d.ts.map +1 -0
  161. package/dist/schema/nl-query.js +178 -0
  162. package/dist/schema/nl-query.js.map +1 -0
  163. package/dist/schema/parse.d.ts.map +1 -1
  164. package/dist/schema/parse.js +152 -89
  165. package/dist/schema/parse.js.map +1 -1
  166. package/dist/schema/provider.d.ts +38 -0
  167. package/dist/schema/provider.d.ts.map +1 -1
  168. package/dist/schema/provider.js +15 -7
  169. package/dist/schema/provider.js.map +1 -1
  170. package/dist/schema/resolve.d.ts +46 -5
  171. package/dist/schema/resolve.d.ts.map +1 -1
  172. package/dist/schema/resolve.js +334 -117
  173. package/dist/schema/resolve.js.map +1 -1
  174. package/dist/schema/search-utils.d.ts +76 -0
  175. package/dist/schema/search-utils.d.ts.map +1 -0
  176. package/dist/schema/search-utils.js +86 -0
  177. package/dist/schema/search-utils.js.map +1 -0
  178. package/dist/schema/seed.d.ts +53 -0
  179. package/dist/schema/seed.d.ts.map +1 -0
  180. package/dist/schema/seed.js +94 -0
  181. package/dist/schema/seed.js.map +1 -0
  182. package/dist/schema/semantic.d.ts +11 -0
  183. package/dist/schema/semantic.d.ts.map +1 -1
  184. package/dist/schema/semantic.js +262 -68
  185. package/dist/schema/semantic.js.map +1 -1
  186. package/dist/schema/sub-apis.d.ts +52 -0
  187. package/dist/schema/sub-apis.d.ts.map +1 -0
  188. package/dist/schema/sub-apis.js +216 -0
  189. package/dist/schema/sub-apis.js.map +1 -0
  190. package/dist/schema/system-entities.d.ts +42 -0
  191. package/dist/schema/system-entities.d.ts.map +1 -0
  192. package/dist/schema/system-entities.js +101 -0
  193. package/dist/schema/system-entities.js.map +1 -0
  194. package/dist/schema/types.d.ts +91 -9
  195. package/dist/schema/types.d.ts.map +1 -1
  196. package/dist/schema/union-fallback.d.ts +219 -0
  197. package/dist/schema/union-fallback.d.ts.map +1 -0
  198. package/dist/schema/union-fallback.js +331 -0
  199. package/dist/schema/union-fallback.js.map +1 -0
  200. package/dist/schema/value-generators/ai.d.ts +54 -0
  201. package/dist/schema/value-generators/ai.d.ts.map +1 -0
  202. package/dist/schema/value-generators/ai.js +136 -0
  203. package/dist/schema/value-generators/ai.js.map +1 -0
  204. package/dist/schema/value-generators/index.d.ts +126 -0
  205. package/dist/schema/value-generators/index.d.ts.map +1 -0
  206. package/dist/schema/value-generators/index.js +219 -0
  207. package/dist/schema/value-generators/index.js.map +1 -0
  208. package/dist/schema/value-generators/placeholder.d.ts +52 -0
  209. package/dist/schema/value-generators/placeholder.d.ts.map +1 -0
  210. package/dist/schema/value-generators/placeholder.js +328 -0
  211. package/dist/schema/value-generators/placeholder.js.map +1 -0
  212. package/dist/schema/value-generators/types.d.ts +116 -0
  213. package/dist/schema/value-generators/types.d.ts.map +1 -0
  214. package/dist/schema/value-generators/types.js +11 -0
  215. package/dist/schema/value-generators/types.js.map +1 -0
  216. package/dist/schema/verb-derivation.d.ts +167 -0
  217. package/dist/schema/verb-derivation.d.ts.map +1 -0
  218. package/dist/schema/verb-derivation.js +281 -0
  219. package/dist/schema/verb-derivation.js.map +1 -0
  220. package/dist/schema/version.d.ts +111 -0
  221. package/dist/schema/version.d.ts.map +1 -0
  222. package/dist/schema/version.js +190 -0
  223. package/dist/schema/version.js.map +1 -0
  224. package/dist/schema.d.ts +1095 -23
  225. package/dist/schema.d.ts.map +1 -1
  226. package/dist/schema.js +2854 -38
  227. package/dist/schema.js.map +1 -1
  228. package/dist/semantic-vectors.d.ts +39 -0
  229. package/dist/semantic-vectors.d.ts.map +1 -0
  230. package/dist/semantic-vectors.js +334 -0
  231. package/dist/semantic-vectors.js.map +1 -0
  232. package/dist/semantic.d.ts +29 -1
  233. package/dist/semantic.d.ts.map +1 -1
  234. package/dist/semantic.js +26 -16
  235. package/dist/semantic.js.map +1 -1
  236. package/dist/telemetry.d.ts +128 -0
  237. package/dist/telemetry.d.ts.map +1 -0
  238. package/dist/telemetry.js +305 -0
  239. package/dist/telemetry.js.map +1 -0
  240. package/dist/tests.d.ts.map +1 -1
  241. package/dist/tests.js +30 -22
  242. package/dist/tests.js.map +1 -1
  243. package/dist/type-guards.d.ts +212 -0
  244. package/dist/type-guards.d.ts.map +1 -0
  245. package/dist/type-guards.js +318 -0
  246. package/dist/type-guards.js.map +1 -0
  247. package/dist/types.d.ts +33 -245
  248. package/dist/types.d.ts.map +1 -1
  249. package/dist/types.js +62 -72
  250. package/dist/types.js.map +1 -1
  251. package/dist/validation.d.ts +165 -0
  252. package/dist/validation.d.ts.map +1 -0
  253. package/dist/validation.js +639 -0
  254. package/dist/validation.js.map +1 -0
  255. package/dist/worker/db-provider.d.ts +168 -0
  256. package/dist/worker/db-provider.d.ts.map +1 -0
  257. package/dist/worker/db-provider.js +277 -0
  258. package/dist/worker/db-provider.js.map +1 -0
  259. package/dist/worker/index.d.ts +35 -0
  260. package/dist/worker/index.d.ts.map +1 -0
  261. package/dist/worker/index.js +37 -0
  262. package/dist/worker/index.js.map +1 -0
  263. package/dist/worker.d.ts +779 -0
  264. package/dist/worker.d.ts.map +1 -0
  265. package/dist/worker.js +2786 -0
  266. package/dist/worker.js.map +1 -0
  267. package/package.json +38 -8
  268. package/src/docs-rels/migrations/0001-init.sql +125 -0
@@ -0,0 +1,328 @@
1
+ /**
2
+ * PlaceholderValueGenerator Implementation
3
+ *
4
+ * Provides deterministic, context-aware placeholder values for testing.
5
+ * This generator uses keyword matching on context and hints to produce
6
+ * appropriate values for common field names.
7
+ *
8
+ * **PURPOSE**: This is a test fixture generator that provides:
9
+ * - Deterministic, predictable outputs for testing
10
+ * - Expected behavior and API contract demonstration
11
+ * - Specific assertions about generated content
12
+ *
13
+ * In production, the AIValueGenerator would be used instead.
14
+ *
15
+ * @packageDocumentation
16
+ */
17
+ /**
18
+ * PlaceholderValueGenerator
19
+ *
20
+ * Generates deterministic values based on field name and context keywords.
21
+ * Used for testing and development when AI generation is not needed.
22
+ */
23
+ export class PlaceholderValueGenerator {
24
+ /**
25
+ * Generate a context-aware placeholder value
26
+ *
27
+ * Uses keyword matching on the context and hint to produce contextually
28
+ * relevant values for common field names.
29
+ *
30
+ * @param request - The generation request
31
+ * @returns Promise resolving to the generated value with metadata
32
+ */
33
+ async generate(request) {
34
+ const value = this.generateValue(request);
35
+ return {
36
+ value,
37
+ metadata: { source: 'placeholder' },
38
+ };
39
+ }
40
+ /**
41
+ * Synchronous value generation
42
+ *
43
+ * This is the core generation logic, exposed for callers that need
44
+ * synchronous operation (e.g., backward-compatible cascade.ts).
45
+ *
46
+ * @param request - The generation request
47
+ * @returns The generated value string
48
+ */
49
+ generateSync(request) {
50
+ return this.generateValue(request);
51
+ }
52
+ /**
53
+ * Core value generation logic
54
+ *
55
+ * Moved from cascade.ts generateContextAwareValue function.
56
+ */
57
+ generateValue(request) {
58
+ const { fieldName, type, fullContext, hint, parentData = {} } = request;
59
+ // If parent has the same field, copy its value (for self-referential types like Company.competitor)
60
+ const parentValue = parentData[fieldName];
61
+ if (typeof parentValue === 'string' && parentValue) {
62
+ return parentValue;
63
+ }
64
+ const contextLower = (fullContext || '').toLowerCase();
65
+ const hintLower = (hint || '').toLowerCase();
66
+ // For 'name' field, use hint-based generation with keyword matching
67
+ // Note: hint takes priority, check hint first before context
68
+ if (fieldName === 'name') {
69
+ if (hintLower.includes('philosopher') || contextLower.includes('philosopher'))
70
+ return 'Aristotle';
71
+ if (hintLower.includes('tech entrepreneur') || hintLower.includes('startup'))
72
+ return 'Alex Chen';
73
+ if (hint && hint.trim())
74
+ return `${type}: ${hint}`;
75
+ // Fall back to static placeholder if no context or hint
76
+ if (!fullContext || fullContext.trim() === '') {
77
+ return `Generated ${fieldName} for ${type}`;
78
+ }
79
+ return `Generated ${fieldName} for ${type}`;
80
+ }
81
+ // For 'style' field
82
+ if (fieldName === 'style') {
83
+ if (hintLower.includes('energetic') || contextLower.includes('energetic'))
84
+ return 'Energetic and engaging presentation style';
85
+ if (contextLower.includes('horror') || contextLower.includes('dark'))
86
+ return 'Dark and atmospheric horror style';
87
+ if (contextLower.includes('sci-fi') || contextLower.includes('futuristic'))
88
+ return 'Atmospheric sci-fi suspense style';
89
+ return `${fieldName}: ${fullContext}`;
90
+ }
91
+ // For 'background' field
92
+ if (fieldName === 'background') {
93
+ if (hintLower.includes('tech entrepreneur') || hintLower.includes('startup'))
94
+ return 'Tech startup founder with 10 years experience';
95
+ if (hintLower.includes('aristocrat') || hintLower.includes('noble'))
96
+ return 'English aristocrat from old noble family';
97
+ if (contextLower.includes('renewable') || contextLower.includes('energy'))
98
+ return 'Background in renewable energy sector';
99
+ if (!fullContext || fullContext.trim() === '') {
100
+ return `Generated ${fieldName} for ${type}`;
101
+ }
102
+ return `${fieldName}: ${fullContext}`;
103
+ }
104
+ // For 'specialty' field - hint takes priority over context
105
+ if (fieldName === 'specialty') {
106
+ // Check hint first for priority
107
+ if (hintLower.includes('security'))
108
+ return 'Security and authentication systems';
109
+ if (hintLower.includes('history') || hintLower.includes('medieval'))
110
+ return 'Medieval history specialist';
111
+ // Then check context
112
+ if (contextLower.includes('french') || contextLower.includes('restaurant'))
113
+ return 'French classical cuisine';
114
+ if (contextLower.includes('security'))
115
+ return 'Security and authentication systems';
116
+ if (!fullContext || fullContext.trim() === '') {
117
+ return `Generated ${fieldName} for ${type}`;
118
+ }
119
+ return `${fieldName}: ${fullContext}`;
120
+ }
121
+ // For 'training' field
122
+ if (fieldName === 'training') {
123
+ if (contextLower.includes('french') || contextLower.includes('restaurant'))
124
+ return 'Trained in classical French culinary techniques';
125
+ return `${fieldName}: ${fullContext}`;
126
+ }
127
+ // For 'backstory' field
128
+ if (fieldName === 'backstory') {
129
+ if (contextLower.includes('medieval') || contextLower.includes('fantasy'))
130
+ return 'A noble knight who served the King in the great castle, completing many quests across the kingdom';
131
+ if (contextLower.includes('sci-fi') || contextLower.includes('space'))
132
+ return 'A starship captain with years of deep space exploration';
133
+ return `${fieldName}: ${fullContext}`;
134
+ }
135
+ // For 'headline' field
136
+ if (fieldName === 'headline') {
137
+ // Check for name mentions in context for personalized headlines
138
+ if (contextLower.includes('codehelper'))
139
+ return 'CodeHelper: Dev Tools';
140
+ if (contextLower.includes('techcorp'))
141
+ return 'TechCorp Solutions';
142
+ if (contextLower.includes('software engineer'))
143
+ return 'For Dev Teams';
144
+ if (contextLower.includes('tech') || contextLower.includes('startup'))
145
+ return 'Tech Startup Solutions';
146
+ return `Headline for ${type}`.slice(0, 30);
147
+ }
148
+ // For 'copy' field
149
+ if (fieldName === 'copy') {
150
+ if (contextLower.includes('tech') || contextLower.includes('startup'))
151
+ return 'Innovative tech solutions for startups and growing companies';
152
+ if (contextLower.includes('marketing') || contextLower.includes('campaign'))
153
+ return 'Effective marketing campaign for tech launch';
154
+ return `${fieldName}: ${fullContext}`;
155
+ }
156
+ // For 'tagline' field
157
+ if (fieldName === 'tagline') {
158
+ if (contextLower.includes('luxury') || contextLower.includes('premium'))
159
+ return 'Luxury craftsmanship meets elegant design';
160
+ if (contextLower.includes('quality') || contextLower.includes('craftsmanship'))
161
+ return 'Premium quality with expert craftsmanship';
162
+ if (contextLower.includes('tech'))
163
+ return 'Technology for the future';
164
+ return `${fieldName}: ${fullContext}`;
165
+ }
166
+ // For 'description' field
167
+ if (fieldName === 'description') {
168
+ if (contextLower.includes('cyberpunk') ||
169
+ contextLower.includes('neon') ||
170
+ contextLower.includes('futuristic'))
171
+ return 'Cyberpunk character with neural augmentations';
172
+ if (contextLower.includes('luxury') ||
173
+ contextLower.includes('high-end') ||
174
+ contextLower.includes('premium'))
175
+ return 'A luxury premium product with elegant craftsmanship';
176
+ if (contextLower.includes('enterprise') || contextLower.includes('b2b'))
177
+ return 'Enterprise solution for business customers';
178
+ if (contextLower.includes('nurse') || contextLower.includes('healthcare'))
179
+ return 'Healthcare documentation solution for nurses and medical staff';
180
+ return `${fieldName}: ${fullContext}`;
181
+ }
182
+ // For 'abilities' field
183
+ if (fieldName === 'abilities') {
184
+ if (contextLower.includes('cyberpunk') || contextLower.includes('futuristic'))
185
+ return 'Neural hacking and digital infiltration';
186
+ return `${fieldName}: ${fullContext}`;
187
+ }
188
+ // For 'method' field
189
+ if (fieldName === 'method') {
190
+ if (hintLower.includes('wit') || hintLower.includes('sharp'))
191
+ return 'Brilliant deduction and clever observation';
192
+ return `${fieldName}: ${fullContext}`;
193
+ }
194
+ // For 'expertise' field - check hint first, then context
195
+ if (fieldName === 'expertise') {
196
+ // Check hint first for priority
197
+ if (hintLower.includes('machine learning') ||
198
+ hintLower.includes('medical') ||
199
+ hintLower.includes('ai'))
200
+ return 'Machine learning for medical applications';
201
+ if (hintLower.includes('physics') || hintLower.includes('professor'))
202
+ return 'Physics professor specializing in quantum mechanics';
203
+ if (hintLower.includes('journalist') || hintLower.includes('science'))
204
+ return 'Science journalist covering physics research';
205
+ // Then check context
206
+ if (contextLower.includes('machine learning') ||
207
+ contextLower.includes('medical') ||
208
+ contextLower.includes('ai'))
209
+ return 'Machine learning for medical applications';
210
+ if (!fullContext || fullContext.trim() === '') {
211
+ return `Generated ${fieldName} for ${type}`;
212
+ }
213
+ return `${fieldName}: ${fullContext}`;
214
+ }
215
+ // For 'focus' field
216
+ if (fieldName === 'focus') {
217
+ if (contextLower.includes('renewable') ||
218
+ contextLower.includes('energy') ||
219
+ contextLower.includes('green'))
220
+ return 'Focus on sustainable energy transformation';
221
+ if (contextLower.includes('tech') || contextLower.includes('programming'))
222
+ return 'Focus on technical programming topics';
223
+ return `${fieldName}: ${fullContext}`;
224
+ }
225
+ // For 'qualifications' field
226
+ if (fieldName === 'qualifications') {
227
+ if (contextLower.includes('astrophysics') ||
228
+ contextLower.includes('astronomy') ||
229
+ contextLower.includes('space'))
230
+ return 'PhD in Astrophysics from MIT';
231
+ return `${fieldName}: ${fullContext}`;
232
+ }
233
+ // For 'teachingStyle' field
234
+ if (fieldName === 'teachingStyle') {
235
+ if (contextLower.includes('beginner') || contextLower.includes('introduct'))
236
+ return 'Patient and accessible approach for beginners';
237
+ return `${fieldName}: ${fullContext}`;
238
+ }
239
+ // For 'experience' field
240
+ if (fieldName === 'experience') {
241
+ if (contextLower.includes('horror') || contextLower.includes('film'))
242
+ return 'Experience in horror film production';
243
+ return `${fieldName}: ${fullContext}`;
244
+ }
245
+ // For 'role' field
246
+ if (fieldName === 'role') {
247
+ if (hintLower.includes('research') ||
248
+ hintLower.includes('machine learning') ||
249
+ hintLower.includes('phd'))
250
+ return 'Machine learning researcher';
251
+ return `${fieldName}: ${fullContext}`;
252
+ }
253
+ // For 'portfolio' field
254
+ if (fieldName === 'portfolio') {
255
+ if (hintLower.includes('award') ||
256
+ hintLower.includes('beaux-arts') ||
257
+ hintLower.includes('ecole'))
258
+ return 'Award-winning design portfolio from Beaux-Arts';
259
+ return `${fieldName}: ${fullContext}`;
260
+ }
261
+ // For 'challenges' field
262
+ if (fieldName === 'challenges') {
263
+ if (contextLower.includes('enterprise') || contextLower.includes('software'))
264
+ return 'Budget constraints and decision-making complexity in enterprise software procurement';
265
+ if (contextLower.includes('startup') || contextLower.includes('tech'))
266
+ return 'Scaling challenges and market competition in tech startup growth';
267
+ return `${fieldName}: ${fullContext}`;
268
+ }
269
+ // For 'severity' field - return one of the enum options
270
+ if (fieldName === 'severity') {
271
+ // Check hint for enum options like 'low/medium/high'
272
+ if (hintLower.includes('low') || hintLower.includes('medium') || hintLower.includes('high')) {
273
+ // Return a contextually appropriate severity
274
+ if (contextLower.includes('critical') || contextLower.includes('urgent'))
275
+ return 'high';
276
+ if (contextLower.includes('minor') || contextLower.includes('small'))
277
+ return 'low';
278
+ return 'medium'; // default to medium
279
+ }
280
+ return 'medium';
281
+ }
282
+ // For 'effort' field - return one of the enum options
283
+ if (fieldName === 'effort') {
284
+ if (hintLower.includes('easy') ||
285
+ hintLower.includes('medium') ||
286
+ hintLower.includes('hard')) {
287
+ if (contextLower.includes('simple') || contextLower.includes('quick'))
288
+ return 'easy';
289
+ if (contextLower.includes('complex') || contextLower.includes('difficult'))
290
+ return 'hard';
291
+ return 'medium';
292
+ }
293
+ return 'medium';
294
+ }
295
+ // For 'level' field - return one of the enum options
296
+ if (fieldName === 'level') {
297
+ if (hintLower.includes('beginner') ||
298
+ hintLower.includes('intermediate') ||
299
+ hintLower.includes('expert')) {
300
+ if (contextLower.includes('beginner') || contextLower.includes('basic'))
301
+ return 'beginner';
302
+ if (contextLower.includes('expert') || contextLower.includes('advanced'))
303
+ return 'expert';
304
+ return 'intermediate';
305
+ }
306
+ return 'intermediate';
307
+ }
308
+ // For 'persona' field
309
+ if (fieldName === 'persona') {
310
+ if (contextLower.includes('enterprise') || contextLower.includes('software'))
311
+ return 'Enterprise software buyer persona';
312
+ if (contextLower.includes('tech') || contextLower.includes('startup'))
313
+ return 'Tech-savvy startup founder persona';
314
+ return `${fieldName}: ${fullContext}`;
315
+ }
316
+ // For 'jobTitle' field
317
+ if (fieldName === 'jobTitle') {
318
+ if (contextLower.includes('enterprise') || contextLower.includes('software'))
319
+ return 'VP of Engineering';
320
+ if (contextLower.includes('tech') || contextLower.includes('startup'))
321
+ return 'CTO';
322
+ return `${fieldName}: ${fullContext}`;
323
+ }
324
+ // Default: include context in the generated value
325
+ return `${fieldName}: ${fullContext}`;
326
+ }
327
+ }
328
+ //# sourceMappingURL=placeholder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder.js","sourceRoot":"","sources":["../../../src/schema/value-generators/placeholder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH;;;;;GAKG;AACH,MAAM,OAAO,yBAAyB;IACpC;;;;;;;;OAQG;IACH,KAAK,CAAC,QAAQ,CAAC,OAA0B;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;QACzC,OAAO;YACL,KAAK;YACL,QAAQ,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE;SACpC,CAAA;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,OAA0B;QACrC,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;IAED;;;;OAIG;IACK,aAAa,CAAC,OAA0B;QAC9C,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,OAAO,CAAA;QAEvE,oGAAoG;QACpG,MA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,CAAC;QAED,kDAAkD;QAClD,OAAO,GAAG,SAAS,KAAK,WAAW,EAAE,CAAA;IACvC,CAAC;CACF"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * ValueGenerator Type Definitions
3
+ *
4
+ * Defines the interface for value generation strategies used during
5
+ * entity creation. Supports both placeholder (deterministic test fixtures)
6
+ * and AI-powered (production) generation.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ import type { Entity } from '../generation-context.js';
11
+ /**
12
+ * Context about the array field being generated
13
+ */
14
+ export interface ArrayContext {
15
+ /** The name of the array field */
16
+ fieldName: string;
17
+ /** Previously generated items in this array */
18
+ previousItems: Entity[];
19
+ /** Current index being generated */
20
+ index: number;
21
+ }
22
+ /**
23
+ * Extended generation context from GenerationContext
24
+ */
25
+ export interface GenerationContextData {
26
+ /** Chain of parent entities leading to this entity */
27
+ parentChain?: Entity[];
28
+ /** All entities previously generated in this session */
29
+ previouslyGenerated?: Entity[];
30
+ /** Context for array field generation */
31
+ arrayContext?: ArrayContext;
32
+ }
33
+ /**
34
+ * Request for generating a field value
35
+ */
36
+ export interface GenerationRequest {
37
+ /** Name of the field being generated */
38
+ fieldName: string;
39
+ /** Entity type name */
40
+ type: string;
41
+ /** Combined context string (instructions, parent data, etc.) */
42
+ fullContext?: string;
43
+ /** Optional hint for guiding generation (e.g., prompt field type) */
44
+ hint?: string;
45
+ /** Data from parent entity for context inheritance */
46
+ parentData?: Record<string, unknown>;
47
+ /** Extended generation context with parent chain and array info */
48
+ generationContext?: GenerationContextData;
49
+ }
50
+ /**
51
+ * Metadata about how the value was generated
52
+ */
53
+ export interface GenerationMetadata {
54
+ /** Source of the generated value */
55
+ source: 'placeholder' | 'ai' | 'test';
56
+ /** Model used for AI generation */
57
+ model?: string;
58
+ /** Token count for AI generation */
59
+ tokens?: number;
60
+ /** Whether the result was cached */
61
+ cached?: boolean;
62
+ /** Whether this was a fallback from AI to placeholder */
63
+ fallback?: boolean;
64
+ }
65
+ /**
66
+ * Result of value generation
67
+ */
68
+ export interface GenerationResult {
69
+ /** The generated value */
70
+ value: string;
71
+ /** Optional metadata about generation */
72
+ metadata?: GenerationMetadata;
73
+ }
74
+ /**
75
+ * Interface for value generation strategies
76
+ *
77
+ * Implementations provide different generation approaches:
78
+ * - PlaceholderValueGenerator: Deterministic values for testing
79
+ * - AIValueGenerator: AI-powered contextual generation
80
+ */
81
+ export interface ValueGenerator {
82
+ /**
83
+ * Generate a value for a field
84
+ *
85
+ * @param request - The generation request with field info and context
86
+ * @returns Promise resolving to the generated value and metadata
87
+ */
88
+ generate(request: GenerationRequest): Promise<GenerationResult>;
89
+ }
90
+ /**
91
+ * AI function signature for value generation
92
+ */
93
+ export type AIFunction = (prompt: string) => Promise<{
94
+ text: string;
95
+ usage?: {
96
+ tokens: number;
97
+ };
98
+ }>;
99
+ /**
100
+ * Configuration for creating a ValueGenerator
101
+ */
102
+ export interface ValueGeneratorConfig {
103
+ /** Type of generator to create */
104
+ type?: 'placeholder' | 'ai';
105
+ /** AI function for AI generator (required when type is 'ai') */
106
+ aiFunction?: AIFunction;
107
+ /** Model to use for AI generation */
108
+ model?: string;
109
+ /** Maximum tokens for AI generation */
110
+ maxTokens?: number;
111
+ /** Temperature for AI generation */
112
+ temperature?: number;
113
+ /** Whether to fall back to placeholder on AI errors */
114
+ fallbackToPlaceholder?: boolean;
115
+ }
116
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/schema/value-generators/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAMtD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,+CAA+C;IAC/C,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;G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E,MAAM,KAAK,OAAO,CAAC;IACnD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAC3B,CAAC,CAAA;AAEF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,kCAAkC;IAClC,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC3B,gEAAgE;IAChE,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uDAAuD;IACvD,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * ValueGenerator Type Definitions
3
+ *
4
+ * Defines the interface for value generation strategies used during
5
+ * entity creation. Supports both placeholder (deterministic test fixtures)
6
+ * and AI-powered (production) generation.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/schema/value-generators/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Verb Derivation for Backward Cascade Resolution
3
+ *
4
+ * Derives reverse verbs for backward relationships:
5
+ * - manages -> managedBy
6
+ * - owns -> ownedBy
7
+ * - creates -> createdBy
8
+ * - parent_of <-> child_of (bidirectional)
9
+ *
10
+ * Used by the cascade resolver to determine the reverse relationship
11
+ * when traversing relationships in the opposite direction.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { deriveReverseVerb, fieldNameToVerb, isPassiveVerb } from './verb-derivation.js'
16
+ *
17
+ * deriveReverseVerb('manages') // 'managedBy'
18
+ * deriveReverseVerb('parent_of') // 'child_of'
19
+ * deriveReverseVerb('managedBy') // 'manages'
20
+ *
21
+ * fieldNameToVerb('manager') // 'manages'
22
+ * fieldNameToVerb('owner') // 'owns'
23
+ *
24
+ * isPassiveVerb('managedBy') // true
25
+ * isPassiveVerb('manages') // false
26
+ * ```
27
+ *
28
+ * @packageDocumentation
29
+ */
30
+ /**
31
+ * Forward verbs to their reverse forms.
32
+ * Common active verbs mapped to their passive counterparts.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * FORWARD_TO_REVERSE.manages // 'managedBy'
37
+ * FORWARD_TO_REVERSE.owns // 'ownedBy'
38
+ * FORWARD_TO_REVERSE.creates // 'createdBy'
39
+ * ```
40
+ */
41
+ export declare const FORWARD_TO_REVERSE: Readonly<Record<string, string>>;
42
+ /**
43
+ * Known verb pairs for bidirectional relationships.
44
+ * These are symmetric - each maps to the other.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * BIDIRECTIONAL_PAIRS.parent_of // 'child_of'
49
+ * BIDIRECTIONAL_PAIRS.child_of // 'parent_of'
50
+ * ```
51
+ */
52
+ export declare const BIDIRECTIONAL_PAIRS: Readonly<Record<string, string>>;
53
+ /**
54
+ * Derives the reverse verb for a given forward verb.
55
+ *
56
+ * Resolution order:
57
+ * 1. Check bidirectional pairs first (parent_of <-> child_of)
58
+ * 2. Check known forward verbs (manages -> managedBy)
59
+ * 3. Check if already a reversed verb (managedBy -> manages)
60
+ * 4. Apply standard transformation for verbs ending in 's'
61
+ * 5. Add 'By' suffix for unknown verbs
62
+ *
63
+ * @param verb - The verb to derive the reverse of
64
+ * @returns The reverse verb
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * deriveReverseVerb('manages') // 'managedBy'
69
+ * deriveReverseVerb('owns') // 'ownedBy'
70
+ * deriveReverseVerb('parent_of') // 'child_of'
71
+ * deriveReverseVerb('managedBy') // 'manages' (already reversed)
72
+ * deriveReverseVerb('customAction') // 'customActionBy' (unknown verb)
73
+ * ```
74
+ */
75
+ export declare function deriveReverseVerb(verb: string): string;
76
+ /**
77
+ * Derives a verb from a field name.
78
+ *
79
+ * Common field names like "manager", "owner", "creator" are mapped
80
+ * to their corresponding verbs. Unknown field names are returned as-is.
81
+ *
82
+ * @param fieldName - The field name to derive a verb from
83
+ * @returns The derived verb or the field name if no mapping exists
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * fieldNameToVerb('manager') // 'manages'
88
+ * fieldNameToVerb('owner') // 'owns'
89
+ * fieldNameToVerb('creator') // 'creates'
90
+ * fieldNameToVerb('customField') // 'customField' (no mapping)
91
+ * ```
92
+ */
93
+ export declare function fieldNameToVerb(fieldName: string): string;
94
+ /**
95
+ * Checks if a verb is in passive form.
96
+ *
97
+ * A verb is considered passive if it ends with:
98
+ * - 'By' (managedBy, ownedBy, createdBy)
99
+ * - 'To' (relatedTo, linkedTo, connectedTo)
100
+ * - 'Of' (parent_of, child_of, partOf)
101
+ *
102
+ * @param verb - The verb to check
103
+ * @returns True if the verb is passive, false otherwise
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * isPassiveVerb('managedBy') // true
108
+ * isPassiveVerb('relatedTo') // true
109
+ * isPassiveVerb('parent_of') // true
110
+ * isPassiveVerb('manages') // false
111
+ * ```
112
+ */
113
+ export declare function isPassiveVerb(verb: string): boolean;
114
+ /**
115
+ * Register a custom verb pair for forward/reverse derivation.
116
+ *
117
+ * This allows extending the verb derivation system with domain-specific
118
+ * verb mappings at runtime.
119
+ *
120
+ * @param forward - The forward (active) verb
121
+ * @param reverse - The reverse (passive) verb
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * registerVerbPair('sponsors', 'sponsoredBy')
126
+ * deriveReverseVerb('sponsors') // 'sponsoredBy'
127
+ * deriveReverseVerb('sponsoredBy') // 'sponsors'
128
+ * ```
129
+ */
130
+ export declare function registerVerbPair(forward: string, reverse: string): void;
131
+ /**
132
+ * Register a bidirectional verb pair.
133
+ *
134
+ * Bidirectional pairs are symmetric relationships where each verb
135
+ * maps to the other. For self-referential relationships, both
136
+ * arguments can be the same verb.
137
+ *
138
+ * @param verbA - The first verb
139
+ * @param verbB - The second verb (can be same as verbA for symmetric)
140
+ *
141
+ * @example
142
+ * ```ts
143
+ * // Asymmetric bidirectional
144
+ * registerBidirectionalPair('mentor_of', 'mentee_of')
145
+ * deriveReverseVerb('mentor_of') // 'mentee_of'
146
+ * deriveReverseVerb('mentee_of') // 'mentor_of'
147
+ *
148
+ * // Symmetric (self-referential)
149
+ * registerBidirectionalPair('relatedTo', 'relatedTo')
150
+ * deriveReverseVerb('relatedTo') // 'relatedTo'
151
+ * ```
152
+ */
153
+ export declare function registerBidirectionalPair(verbA: string, verbB: string): void;
154
+ /**
155
+ * Register a field name to verb mapping.
156
+ *
157
+ * @param fieldName - The field name
158
+ * @param verb - The verb it derives to
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * registerFieldVerb('coordinator', 'coordinates')
163
+ * fieldNameToVerb('coordinator') // 'coordinates'
164
+ * ```
165
+ */
166
+ export declare function registerFieldVerb(fieldName: string, verb: string): void;
167
+ //# sourceMappingURL=verb-derivation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verb-derivation.d.ts","sourceRoot":"","sources":["../../src/schema/verb-derivation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAiCH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAqB,CAAA;AAcrF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAuB,CAAA;AAwBxF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwCtD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAYnD;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAGvE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAG5E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAEvE"}