semantic-primitives 0.1.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 (238) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +449 -0
  3. package/dist/index.d.ts +8 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +25016 -0
  6. package/dist/llm/client.d.ts +82 -0
  7. package/dist/llm/client.d.ts.map +1 -0
  8. package/dist/llm/index.d.ts +11 -0
  9. package/dist/llm/index.d.ts.map +1 -0
  10. package/dist/llm/providers/anthropic.d.ts +13 -0
  11. package/dist/llm/providers/anthropic.d.ts.map +1 -0
  12. package/dist/llm/providers/google.d.ts +13 -0
  13. package/dist/llm/providers/google.d.ts.map +1 -0
  14. package/dist/llm/providers/index.d.ts +7 -0
  15. package/dist/llm/providers/index.d.ts.map +1 -0
  16. package/dist/llm/providers/openai.d.ts +13 -0
  17. package/dist/llm/providers/openai.d.ts.map +1 -0
  18. package/dist/llm/types.d.ts +91 -0
  19. package/dist/llm/types.d.ts.map +1 -0
  20. package/dist/primitives/bigint/bigint.d.ts +197 -0
  21. package/dist/primitives/bigint/bigint.d.ts.map +1 -0
  22. package/dist/primitives/bigint/index.d.ts +7 -0
  23. package/dist/primitives/bigint/index.d.ts.map +1 -0
  24. package/dist/primitives/bigint/prompts.d.ts +37 -0
  25. package/dist/primitives/bigint/prompts.d.ts.map +1 -0
  26. package/dist/primitives/boolean/boolean.d.ts +194 -0
  27. package/dist/primitives/boolean/boolean.d.ts.map +1 -0
  28. package/dist/primitives/boolean/evals/from.evals.d.ts +7 -0
  29. package/dist/primitives/boolean/evals/from.evals.d.ts.map +1 -0
  30. package/dist/primitives/boolean/evals/index.d.ts +5 -0
  31. package/dist/primitives/boolean/evals/index.d.ts.map +1 -0
  32. package/dist/primitives/boolean/index.d.ts +6 -0
  33. package/dist/primitives/boolean/index.d.ts.map +1 -0
  34. package/dist/primitives/boolean/prompts.d.ts +29 -0
  35. package/dist/primitives/boolean/prompts.d.ts.map +1 -0
  36. package/dist/primitives/index.d.ts +14 -0
  37. package/dist/primitives/index.d.ts.map +1 -0
  38. package/dist/primitives/null/index.d.ts +6 -0
  39. package/dist/primitives/null/index.d.ts.map +1 -0
  40. package/dist/primitives/null/null.d.ts +181 -0
  41. package/dist/primitives/null/null.d.ts.map +1 -0
  42. package/dist/primitives/null/prompts.d.ts +39 -0
  43. package/dist/primitives/null/prompts.d.ts.map +1 -0
  44. package/dist/primitives/number/index.d.ts +6 -0
  45. package/dist/primitives/number/index.d.ts.map +1 -0
  46. package/dist/primitives/number/number.d.ts +154 -0
  47. package/dist/primitives/number/number.d.ts.map +1 -0
  48. package/dist/primitives/number/number.prompts.d.ts +53 -0
  49. package/dist/primitives/number/number.prompts.d.ts.map +1 -0
  50. package/dist/primitives/string/evals/classify.evals.d.ts +7 -0
  51. package/dist/primitives/string/evals/classify.evals.d.ts.map +1 -0
  52. package/dist/primitives/string/evals/index.d.ts +6 -0
  53. package/dist/primitives/string/evals/index.d.ts.map +1 -0
  54. package/dist/primitives/string/evals/semanticallyEquals.evals.d.ts +7 -0
  55. package/dist/primitives/string/evals/semanticallyEquals.evals.d.ts.map +1 -0
  56. package/dist/primitives/string/index.d.ts +206 -0
  57. package/dist/primitives/string/index.d.ts.map +1 -0
  58. package/dist/primitives/string/string.prompts.d.ts +45 -0
  59. package/dist/primitives/string/string.prompts.d.ts.map +1 -0
  60. package/dist/primitives/symbol/index.d.ts +6 -0
  61. package/dist/primitives/symbol/index.d.ts.map +1 -0
  62. package/dist/primitives/symbol/symbol.d.ts +176 -0
  63. package/dist/primitives/symbol/symbol.d.ts.map +1 -0
  64. package/dist/primitives/symbol/symbol.prompts.d.ts +53 -0
  65. package/dist/primitives/symbol/symbol.prompts.d.ts.map +1 -0
  66. package/dist/primitives/undefined/index.d.ts +5 -0
  67. package/dist/primitives/undefined/index.d.ts.map +1 -0
  68. package/dist/primitives/undefined/prompts.d.ts +40 -0
  69. package/dist/primitives/undefined/prompts.d.ts.map +1 -0
  70. package/dist/primitives/undefined/undefined.d.ts +216 -0
  71. package/dist/primitives/undefined/undefined.d.ts.map +1 -0
  72. package/dist/primitives/void/index.d.ts +5 -0
  73. package/dist/primitives/void/index.d.ts.map +1 -0
  74. package/dist/primitives/void/prompts.d.ts +37 -0
  75. package/dist/primitives/void/prompts.d.ts.map +1 -0
  76. package/dist/primitives/void/void.d.ts +172 -0
  77. package/dist/primitives/void/void.d.ts.map +1 -0
  78. package/dist/shared/base-classes.d.ts +331 -0
  79. package/dist/shared/base-classes.d.ts.map +1 -0
  80. package/dist/shared/eval-types.d.ts +82 -0
  81. package/dist/shared/eval-types.d.ts.map +1 -0
  82. package/dist/shared/index.d.ts +25 -0
  83. package/dist/shared/index.d.ts.map +1 -0
  84. package/dist/shared/interfaces.d.ts +799 -0
  85. package/dist/shared/interfaces.d.ts.map +1 -0
  86. package/dist/shared/types.d.ts +335 -0
  87. package/dist/shared/types.d.ts.map +1 -0
  88. package/dist/types/array/array.d.ts +250 -0
  89. package/dist/types/array/array.d.ts.map +1 -0
  90. package/dist/types/array/index.d.ts +6 -0
  91. package/dist/types/array/index.d.ts.map +1 -0
  92. package/dist/types/array/prompts.d.ts +63 -0
  93. package/dist/types/array/prompts.d.ts.map +1 -0
  94. package/dist/types/blob-file/blob.d.ts +188 -0
  95. package/dist/types/blob-file/blob.d.ts.map +1 -0
  96. package/dist/types/blob-file/file.d.ts +144 -0
  97. package/dist/types/blob-file/file.d.ts.map +1 -0
  98. package/dist/types/blob-file/index.d.ts +8 -0
  99. package/dist/types/blob-file/index.d.ts.map +1 -0
  100. package/dist/types/blob-file/prompts.d.ts +101 -0
  101. package/dist/types/blob-file/prompts.d.ts.map +1 -0
  102. package/dist/types/bun/bun.d.ts +266 -0
  103. package/dist/types/bun/bun.d.ts.map +1 -0
  104. package/dist/types/bun/index.d.ts +7 -0
  105. package/dist/types/bun/index.d.ts.map +1 -0
  106. package/dist/types/bun/prompts.d.ts +93 -0
  107. package/dist/types/bun/prompts.d.ts.map +1 -0
  108. package/dist/types/callable/callable.d.ts +200 -0
  109. package/dist/types/callable/callable.d.ts.map +1 -0
  110. package/dist/types/callable/index.d.ts +6 -0
  111. package/dist/types/callable/index.d.ts.map +1 -0
  112. package/dist/types/callable/prompts.d.ts +45 -0
  113. package/dist/types/callable/prompts.d.ts.map +1 -0
  114. package/dist/types/constructable/constructable.d.ts +150 -0
  115. package/dist/types/constructable/constructable.d.ts.map +1 -0
  116. package/dist/types/constructable/index.d.ts +5 -0
  117. package/dist/types/constructable/index.d.ts.map +1 -0
  118. package/dist/types/constructable/prompts.d.ts +41 -0
  119. package/dist/types/constructable/prompts.d.ts.map +1 -0
  120. package/dist/types/date/date.d.ts +258 -0
  121. package/dist/types/date/date.d.ts.map +1 -0
  122. package/dist/types/date/index.d.ts +6 -0
  123. package/dist/types/date/index.d.ts.map +1 -0
  124. package/dist/types/date/prompts.d.ts +93 -0
  125. package/dist/types/date/prompts.d.ts.map +1 -0
  126. package/dist/types/error/error.d.ts +191 -0
  127. package/dist/types/error/error.d.ts.map +1 -0
  128. package/dist/types/error/index.d.ts +6 -0
  129. package/dist/types/error/index.d.ts.map +1 -0
  130. package/dist/types/error/prompts.d.ts +49 -0
  131. package/dist/types/error/prompts.d.ts.map +1 -0
  132. package/dist/types/event-emitter/event-emitter.d.ts +230 -0
  133. package/dist/types/event-emitter/event-emitter.d.ts.map +1 -0
  134. package/dist/types/event-emitter/index.d.ts +6 -0
  135. package/dist/types/event-emitter/index.d.ts.map +1 -0
  136. package/dist/types/event-emitter/prompts.d.ts +51 -0
  137. package/dist/types/event-emitter/prompts.d.ts.map +1 -0
  138. package/dist/types/fetch/headers.d.ts +126 -0
  139. package/dist/types/fetch/headers.d.ts.map +1 -0
  140. package/dist/types/fetch/index.d.ts +9 -0
  141. package/dist/types/fetch/index.d.ts.map +1 -0
  142. package/dist/types/fetch/prompts.d.ts +139 -0
  143. package/dist/types/fetch/prompts.d.ts.map +1 -0
  144. package/dist/types/fetch/request.d.ts +188 -0
  145. package/dist/types/fetch/request.d.ts.map +1 -0
  146. package/dist/types/fetch/response.d.ts +155 -0
  147. package/dist/types/fetch/response.d.ts.map +1 -0
  148. package/dist/types/form-data/form-data.d.ts +277 -0
  149. package/dist/types/form-data/form-data.d.ts.map +1 -0
  150. package/dist/types/form-data/index.d.ts +7 -0
  151. package/dist/types/form-data/index.d.ts.map +1 -0
  152. package/dist/types/form-data/prompts.d.ts +80 -0
  153. package/dist/types/form-data/prompts.d.ts.map +1 -0
  154. package/dist/types/index.d.ts +29 -0
  155. package/dist/types/index.d.ts.map +1 -0
  156. package/dist/types/map/index.d.ts +6 -0
  157. package/dist/types/map/index.d.ts.map +1 -0
  158. package/dist/types/map/map.d.ts +204 -0
  159. package/dist/types/map/map.d.ts.map +1 -0
  160. package/dist/types/map/prompts.d.ts +56 -0
  161. package/dist/types/map/prompts.d.ts.map +1 -0
  162. package/dist/types/never/index.d.ts +5 -0
  163. package/dist/types/never/index.d.ts.map +1 -0
  164. package/dist/types/never/never.d.ts +220 -0
  165. package/dist/types/never/never.d.ts.map +1 -0
  166. package/dist/types/never/prompts.d.ts +50 -0
  167. package/dist/types/never/prompts.d.ts.map +1 -0
  168. package/dist/types/object/index.d.ts +6 -0
  169. package/dist/types/object/index.d.ts.map +1 -0
  170. package/dist/types/object/object.d.ts +162 -0
  171. package/dist/types/object/object.d.ts.map +1 -0
  172. package/dist/types/object/prompts.d.ts +55 -0
  173. package/dist/types/object/prompts.d.ts.map +1 -0
  174. package/dist/types/object-literal/index.d.ts +6 -0
  175. package/dist/types/object-literal/index.d.ts.map +1 -0
  176. package/dist/types/object-literal/object-literal.d.ts +223 -0
  177. package/dist/types/object-literal/object-literal.d.ts.map +1 -0
  178. package/dist/types/object-literal/prompts.d.ts +49 -0
  179. package/dist/types/object-literal/prompts.d.ts.map +1 -0
  180. package/dist/types/promise/index.d.ts +6 -0
  181. package/dist/types/promise/index.d.ts.map +1 -0
  182. package/dist/types/promise/promise.d.ts +240 -0
  183. package/dist/types/promise/promise.d.ts.map +1 -0
  184. package/dist/types/promise/prompts.d.ts +45 -0
  185. package/dist/types/promise/prompts.d.ts.map +1 -0
  186. package/dist/types/record/index.d.ts +5 -0
  187. package/dist/types/record/index.d.ts.map +1 -0
  188. package/dist/types/record/prompts.d.ts +45 -0
  189. package/dist/types/record/prompts.d.ts.map +1 -0
  190. package/dist/types/record/record.d.ts +179 -0
  191. package/dist/types/record/record.d.ts.map +1 -0
  192. package/dist/types/regexp/index.d.ts +7 -0
  193. package/dist/types/regexp/index.d.ts.map +1 -0
  194. package/dist/types/regexp/prompts.d.ts +56 -0
  195. package/dist/types/regexp/prompts.d.ts.map +1 -0
  196. package/dist/types/regexp/regexp.d.ts +160 -0
  197. package/dist/types/regexp/regexp.d.ts.map +1 -0
  198. package/dist/types/set/index.d.ts +6 -0
  199. package/dist/types/set/index.d.ts.map +1 -0
  200. package/dist/types/set/prompts.d.ts +60 -0
  201. package/dist/types/set/prompts.d.ts.map +1 -0
  202. package/dist/types/set/set.d.ts +261 -0
  203. package/dist/types/set/set.d.ts.map +1 -0
  204. package/dist/types/streams/index.d.ts +8 -0
  205. package/dist/types/streams/index.d.ts.map +1 -0
  206. package/dist/types/streams/prompts.d.ts +53 -0
  207. package/dist/types/streams/prompts.d.ts.map +1 -0
  208. package/dist/types/streams/readable-stream.d.ts +148 -0
  209. package/dist/types/streams/readable-stream.d.ts.map +1 -0
  210. package/dist/types/streams/transform-stream.d.ts +67 -0
  211. package/dist/types/streams/transform-stream.d.ts.map +1 -0
  212. package/dist/types/streams/writable-stream.d.ts +111 -0
  213. package/dist/types/streams/writable-stream.d.ts.map +1 -0
  214. package/dist/types/text-codec/index.d.ts +12 -0
  215. package/dist/types/text-codec/index.d.ts.map +1 -0
  216. package/dist/types/text-codec/prompts.d.ts +79 -0
  217. package/dist/types/text-codec/prompts.d.ts.map +1 -0
  218. package/dist/types/text-codec/text-codec.d.ts +305 -0
  219. package/dist/types/text-codec/text-codec.d.ts.map +1 -0
  220. package/dist/types/tuple/index.d.ts +6 -0
  221. package/dist/types/tuple/index.d.ts.map +1 -0
  222. package/dist/types/tuple/prompts.d.ts +41 -0
  223. package/dist/types/tuple/prompts.d.ts.map +1 -0
  224. package/dist/types/tuple/tuple.d.ts +221 -0
  225. package/dist/types/tuple/tuple.d.ts.map +1 -0
  226. package/dist/types/unknown/index.d.ts +5 -0
  227. package/dist/types/unknown/index.d.ts.map +1 -0
  228. package/dist/types/unknown/prompts.d.ts +45 -0
  229. package/dist/types/unknown/prompts.d.ts.map +1 -0
  230. package/dist/types/unknown/unknown.d.ts +220 -0
  231. package/dist/types/unknown/unknown.d.ts.map +1 -0
  232. package/dist/types/url/index.d.ts +7 -0
  233. package/dist/types/url/index.d.ts.map +1 -0
  234. package/dist/types/url/prompts.d.ts +93 -0
  235. package/dist/types/url/prompts.d.ts.map +1 -0
  236. package/dist/types/url/url.d.ts +270 -0
  237. package/dist/types/url/url.d.ts.map +1 -0
  238. package/package.json +73 -0
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Prompts for SemanticMap LLM operations
3
+ * These prompts enable semantic operations on Map key-value collections
4
+ */
5
+ /**
6
+ * System prompt for map semantic operations
7
+ */
8
+ export declare const MAP_SYSTEM_PROMPT = "You are a semantic map analyzer. Your task is to analyze Map key-value pairs to provide semantic understanding of keys, values, and their relationships.\n\nYou must respond with valid JSON only, no additional text or explanation.\n\nGuidelines:\n- Consider key meanings, synonyms, and naming conventions\n- Understand value relationships and patterns\n- Provide confidence scores from 0.0 to 1.0\n- Be precise and consistent in your analysis\n- Handle both primitive and complex object values";
9
+ /**
10
+ * Prompt for semantic key lookup
11
+ */
12
+ export declare function createSemanticGetPrompt(keys: string[], query: string, context?: Record<string, unknown>): string;
13
+ /**
14
+ * Prompt for semantic has check
15
+ */
16
+ export declare function createSemanticHasPrompt(keys: string[], query: string): string;
17
+ /**
18
+ * Prompt for semantic equality comparison
19
+ */
20
+ export declare function createSemanticallyEqualsPrompt(map1Entries: [string, unknown][], map2Entries: [string, unknown][]): string;
21
+ /**
22
+ * Prompt for finding keys by criteria
23
+ */
24
+ export declare function createFindKeysPrompt(entries: [string, unknown][], criteria: string): string;
25
+ /**
26
+ * Prompt for finding values by criteria
27
+ */
28
+ export declare function createFindValuesPrompt(entries: [string, unknown][], criteria: string): string;
29
+ /**
30
+ * Prompt for semantic merge
31
+ */
32
+ export declare function createSemanticMergePrompt(thisEntries: [string, unknown][], otherEntries: [string, unknown][], conflictResolution: 'prefer-this' | 'prefer-other' | 'combine'): string;
33
+ /**
34
+ * Prompt for validation
35
+ */
36
+ export declare function createValidatePrompt(entries: [string, unknown][], rules: {
37
+ keys?: string;
38
+ values?: string;
39
+ }): string;
40
+ /**
41
+ * Prompt for suggesting missing keys
42
+ */
43
+ export declare function createSuggestMissingKeysPrompt(entries: [string, unknown][]): string;
44
+ /**
45
+ * Prompt for grouping entries
46
+ */
47
+ export declare function createGroupByPrompt(entries: [string, unknown][], criteria: string): string;
48
+ /**
49
+ * Prompt for summarization
50
+ */
51
+ export declare function createSummarizePrompt(entries: [string, unknown][], mapSize: number): string;
52
+ /**
53
+ * Prompt for inferring purpose
54
+ */
55
+ export declare function createInferPurposePrompt(entries: [string, unknown][]): string;
56
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/types/map/prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB,ifASoB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,MAAM,CA2BR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAA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BR;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM,CAe7E"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * SemanticNever exports
3
+ */
4
+ export { SemanticNever, type UnreachabilityType, type ExhaustiveResult, type UnreachabilityResult, type DeadCodeResult, type ExhaustiveHandlerResult, type ValidateExhaustivenessResult, type ShouldReturnNeverResult, type IntersectionAnalysisResult, type NeverPattern, } from './never.ts';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/never/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,220 @@
1
+ /**
2
+ * SemanticNever
3
+ * A semantic wrapper for TypeScript's never type with LLM-powered analysis
4
+ *
5
+ * Since 'never' represents values that never occur, this class provides
6
+ * static methods for analyzing unreachable code, exhaustiveness checking,
7
+ * and explaining the never type's semantics.
8
+ *
9
+ * Note: SemanticNever has no instances - all methods are static because
10
+ * 'never' is the bottom type with no values.
11
+ */
12
+ import type { LLMClient } from '../../llm/client.ts';
13
+ /** Unreachability type classification */
14
+ export type UnreachabilityType = 'control-flow' | 'type-narrowing' | 'exhaustive-check' | 'impossible-state';
15
+ /** Result of exhaustiveness check */
16
+ export interface ExhaustiveResult {
17
+ exhaustive: boolean;
18
+ missing: string[];
19
+ }
20
+ /** Result of unreachability explanation */
21
+ export interface UnreachabilityResult {
22
+ reason: string;
23
+ type: UnreachabilityType;
24
+ suggestion: string;
25
+ }
26
+ /** Result of dead code analysis */
27
+ export interface DeadCodeResult {
28
+ isDead: boolean;
29
+ reason: string;
30
+ safeToRemove: boolean;
31
+ }
32
+ /** Result of exhaustive handler suggestion */
33
+ export interface ExhaustiveHandlerResult {
34
+ code: string;
35
+ usage: string;
36
+ }
37
+ /** Result of exhaustiveness validation */
38
+ export interface ValidateExhaustivenessResult {
39
+ valid: boolean;
40
+ covers: string[];
41
+ missing?: string[];
42
+ suggestion?: string;
43
+ }
44
+ /** Result of should-return-never analysis */
45
+ export interface ShouldReturnNeverResult {
46
+ shouldReturn: boolean;
47
+ reason: string;
48
+ }
49
+ /** Result of type intersection analysis */
50
+ export interface IntersectionAnalysisResult {
51
+ resultsInNever: boolean;
52
+ reason: string;
53
+ }
54
+ /** Pattern where never is appropriate */
55
+ export interface NeverPattern {
56
+ pattern: string;
57
+ description: string;
58
+ example: string;
59
+ }
60
+ /**
61
+ * SemanticNever - Static utilities for never type analysis
62
+ *
63
+ * This class provides LLM-powered analysis of:
64
+ * - Exhaustiveness checking for discriminated unions
65
+ * - Dead code detection
66
+ * - Unreachability explanation
67
+ * - Type intersection analysis
68
+ *
69
+ * All methods are static because 'never' has no values to instantiate.
70
+ */
71
+ export declare class SemanticNever {
72
+ /**
73
+ * Private constructor - SemanticNever cannot be instantiated
74
+ * The never type represents values that never occur, so there can be no instances.
75
+ */
76
+ private constructor();
77
+ /**
78
+ * Check if a switch statement or conditional is exhaustive.
79
+ *
80
+ * @param type - The union type being checked (e.g., "Status", "Result")
81
+ * @param handledCases - Array of cases that are handled
82
+ * @param client - Optional LLM client for dependency injection
83
+ * @returns Exhaustiveness check result with any missing cases
84
+ *
85
+ * @example
86
+ * await SemanticNever.isExhaustive("Status", ["pending", "active"])
87
+ * // { exhaustive: false, missing: ["completed"] }
88
+ *
89
+ * await SemanticNever.isExhaustive("Direction", ["up", "down", "left", "right"])
90
+ * // { exhaustive: true, missing: [] }
91
+ */
92
+ static isExhaustive(type: string, handledCases: string[], client?: LLMClient): Promise<ExhaustiveResult>;
93
+ /**
94
+ * Explain why a code path is unreachable (never).
95
+ *
96
+ * @param context - The code context to analyze
97
+ * @param client - Optional LLM client for dependency injection
98
+ * @returns Explanation with type classification and suggestion
99
+ *
100
+ * @example
101
+ * await SemanticNever.explainUnreachability("after throw statement")
102
+ * // {
103
+ * // reason: "Code after a throw statement cannot execute",
104
+ * // type: "control-flow",
105
+ * // suggestion: "Remove dead code after throw"
106
+ * // }
107
+ */
108
+ static explainUnreachability(context: string, client?: LLMClient): Promise<UnreachabilityResult>;
109
+ /**
110
+ * Check if a code path is actually dead code.
111
+ *
112
+ * @param code - Code snippet or description to analyze
113
+ * @param context - Optional surrounding context
114
+ * @param client - Optional LLM client for dependency injection
115
+ * @returns Dead code analysis with removal safety
116
+ *
117
+ * @example
118
+ * await SemanticNever.isDeadCode("return statement after return")
119
+ * // { isDead: true, reason: "First return already exits the function", safeToRemove: true }
120
+ */
121
+ static isDeadCode(code: string, context?: string, client?: LLMClient): Promise<DeadCodeResult>;
122
+ /**
123
+ * Suggest an exhaustive switch handler (assertNever pattern).
124
+ *
125
+ * @param typeName - The discriminated union type name
126
+ * @param client - Optional LLM client for dependency injection
127
+ * @returns Suggested code and usage example
128
+ *
129
+ * @example
130
+ * await SemanticNever.suggestExhaustiveHandler("Status")
131
+ * // {
132
+ * // code: "function assertNever(x: never): never { throw new Error(`Unexpected value: ${x}`); }",
133
+ * // usage: "default: return assertNever(status);"
134
+ * // }
135
+ */
136
+ static suggestExhaustiveHandler(typeName: string, client?: LLMClient): Promise<ExhaustiveHandlerResult>;
137
+ /**
138
+ * Validate that a function properly uses never for exhaustiveness.
139
+ *
140
+ * @param fnCode - Function code to validate
141
+ * @param client - Optional LLM client for dependency injection
142
+ * @returns Validation result with covered cases and suggestions
143
+ *
144
+ * @example
145
+ * await SemanticNever.validateExhaustivenessCheck(`
146
+ * function handleStatus(status: Status) {
147
+ * switch (status) {
148
+ * case "pending": return "Waiting...";
149
+ * case "active": return "In progress";
150
+ * case "completed": return "Done!";
151
+ * default: return assertNever(status);
152
+ * }
153
+ * }
154
+ * `)
155
+ * // { valid: true, covers: ["pending", "active", "completed"] }
156
+ */
157
+ static validateExhaustivenessCheck(fnCode: string, client?: LLMClient): Promise<ValidateExhaustivenessResult>;
158
+ /**
159
+ * Identify if a function should return never based on its behavior.
160
+ *
161
+ * @param fnName - Function name
162
+ * @param behavior - Description of function behavior
163
+ * @param client - Optional LLM client for dependency injection
164
+ * @returns Analysis with recommendation
165
+ *
166
+ * @example
167
+ * await SemanticNever.shouldReturnNever("throwError", "always throws an exception")
168
+ * // { shouldReturn: true, reason: "Function always throws, never returns normally" }
169
+ *
170
+ * await SemanticNever.shouldReturnNever("maybeThrow", "throws on invalid input")
171
+ * // { shouldReturn: false, reason: "Function may return normally with valid input" }
172
+ */
173
+ static shouldReturnNever(fnName: string, behavior: string, client?: LLMClient): Promise<ShouldReturnNeverResult>;
174
+ /**
175
+ * Explain the never type to developers.
176
+ *
177
+ * @param context - Optional usage context for tailored explanation
178
+ * @param client - Optional LLM client for dependency injection
179
+ * @returns Educational explanation string
180
+ *
181
+ * @example
182
+ * await SemanticNever.explain()
183
+ * // "The 'never' type represents values that never occur..."
184
+ *
185
+ * await SemanticNever.explain("in function return type")
186
+ * // "A function returning 'never' will never complete normally..."
187
+ */
188
+ static explain(context?: string, client?: LLMClient): Promise<string>;
189
+ /**
190
+ * Detect if type intersection results in never.
191
+ *
192
+ * @param types - Array of type names to intersect
193
+ * @param client - Optional LLM client for dependency injection
194
+ * @returns Analysis of whether intersection is never
195
+ *
196
+ * @example
197
+ * await SemanticNever.analyzeIntersection(["string", "number"])
198
+ * // { resultsInNever: true, reason: "A value cannot be both string and number" }
199
+ *
200
+ * await SemanticNever.analyzeIntersection(["{ name: string }", "{ age: number }"])
201
+ * // { resultsInNever: false, reason: "Object types can be merged" }
202
+ */
203
+ static analyzeIntersection(types: string[], client?: LLMClient): Promise<IntersectionAnalysisResult>;
204
+ /**
205
+ * Get common patterns where never is appropriate.
206
+ * This is a static list - no LLM call required.
207
+ *
208
+ * @returns List of appropriate never patterns with examples
209
+ *
210
+ * @example
211
+ * SemanticNever.appropriatePatterns()
212
+ * // [
213
+ * // { pattern: "Exhaustive switch handler", description: "...", example: "..." },
214
+ * // { pattern: "Functions that never return", description: "...", example: "..." },
215
+ * // ...
216
+ * // ]
217
+ */
218
+ static appropriatePatterns(): NeverPattern[];
219
+ }
220
+ //# sourceMappingURL=never.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"never.d.ts","sourceRoot":"","sources":["../../../src/types/never/never.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAerD,yCAAyC;AACzC,MAAM,MAAM,kBAAkB,GAC1B,cAAc,GACd,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,CAAC;AAEvB,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,2CAA2C;AAC3C,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,kBAAkB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,8CAA8C;AAC9C,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,0CAA0C;AAC1C,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAA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,SAAS,GACjB,OAAO,CAAC,uBAAuB,CAAC;IAanC;;;;;;;;;;;;;OAaG;WACU,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAc3E;;;;;;;;;;;;;OAaG;WACU,mBAAmB,CAC9B,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC,0BAA0B,CAAC;IAatC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,mBAAmB,IAAI,YAAY,EAAE;CAG7C"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Prompts for SemanticNever LLM operations
3
+ * These prompts are used to analyze unreachable code, exhaustiveness, and never type semantics
4
+ */
5
+ /**
6
+ * System prompt for never type analysis tasks
7
+ */
8
+ export declare const NEVER_SYSTEM_PROMPT = "You are a TypeScript type system expert specializing in the 'never' type and exhaustiveness checking. Your task is to analyze code patterns related to unreachable code, exhaustive switches, and impossible type states.\n\nYou must respond with valid JSON only, no additional text or explanation.\n\nKey concepts:\n- \"never\" is the bottom type in TypeScript - it represents values that never occur\n- A function returning \"never\" will never return normally (throws or infinite loop)\n- Exhaustive checks ensure all cases of a union type are handled\n- Dead code is code that can never be executed\n- Type narrowing can result in \"never\" when all possibilities are eliminated\n- Intersecting incompatible types (string & number) results in \"never\"\n\nUnreachability types:\n- \"control-flow\": Code after throw, return, or infinite loops\n- \"type-narrowing\": Code in branches where type is narrowed to never\n- \"exhaustive-check\": Default case in exhaustive switch that should never be reached\n- \"impossible-state\": Code that handles states that cannot exist\n\nGuidelines:\n- Be precise about why code is unreachable\n- Consider all edge cases in exhaustiveness analysis\n- Provide actionable suggestions for handling never types\n- Explain type intersections clearly";
9
+ /**
10
+ * Prompt template for checking if a switch/conditional is exhaustive
11
+ */
12
+ export declare function createIsExhaustivePrompt(typeName: string, handledCases: string[]): string;
13
+ /**
14
+ * Prompt template for explaining why code is unreachable
15
+ */
16
+ export declare function createExplainUnreachabilityPrompt(context: string): string;
17
+ /**
18
+ * Prompt template for checking if code is dead code
19
+ */
20
+ export declare function createIsDeadCodePrompt(code: string, context?: string): string;
21
+ /**
22
+ * Prompt template for suggesting exhaustive handler code
23
+ */
24
+ export declare function createSuggestExhaustiveHandlerPrompt(typeName: string): string;
25
+ /**
26
+ * Prompt template for validating exhaustiveness in function code
27
+ */
28
+ export declare function createValidateExhaustivenessCheckPrompt(fnCode: string): string;
29
+ /**
30
+ * Prompt template for checking if a function should return never
31
+ */
32
+ export declare function createShouldReturnNeverPrompt(fnName: string, behavior: string): string;
33
+ /**
34
+ * Prompt template for explaining the never type
35
+ */
36
+ export declare function createExplainPrompt(context?: string): string;
37
+ /**
38
+ * Prompt template for analyzing type intersections
39
+ */
40
+ export declare function createAnalyzeIntersectionPrompt(types: string[]): string;
41
+ /**
42
+ * Get appropriate patterns where never is commonly used
43
+ * Note: This is a static list, not LLM-powered
44
+ */
45
+ export declare function getAppropriatePatterns(): {
46
+ pattern: string;
47
+ description: string;
48
+ example: string;
49
+ }[];
50
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/types/never/prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB,qwCAsBK,CAAC;AAEtC;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EAAE,GACrB,MAAM,CAsBR;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAsBzE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAyB7E;AAED;;GAEG;AACH,wBAAgB,oCAAoC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAiB7E;AAED;;GAEG;AACH,wBAAgB,uCAAuC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAqB9E;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,MAAM,CAsBR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAuB5D;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAsBvE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,EAAE,CA4CF"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * SemanticObject module
3
+ * Exports the SemanticObject class and related types
4
+ */
5
+ export { SemanticObject, type ObjectValidateResult, type SemanticMergeOptions, type KeyConvention, type SemanticEqualsResultWithMappings, type SemanticGetResult, type InferSchemaResult, type MissingSuggestion, type InferTypeResult, type SensitiveResult, } from './object.ts';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/object/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,gCAAgC,EACrC,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * SemanticObject
3
+ * An object type with LLM-powered semantic understanding
4
+ *
5
+ * Implements shared interfaces:
6
+ * - Semantic<T> - Base semantic wrapper
7
+ * - Comparable<SemanticObject<T>> - Semantic equality comparison
8
+ * - Validatable - Validation against semantic rules
9
+ * - Summarizable - Content summarization
10
+ * - TypeInferable - Type/purpose detection
11
+ * - SchemaInferable - Schema inference
12
+ * - SensitivityDetectable - Sensitive data detection
13
+ */
14
+ import type { LLMClient } from '../../llm/client.ts';
15
+ import type { SemanticEqualsResultWithMappings, SemanticGetResult, InferSchemaResult, MissingSuggestion, InferTypeResult, SensitiveResult } from '../../shared/types.ts';
16
+ import type { Semantic, Comparable } from '../../shared/interfaces.ts';
17
+ export type { SemanticEqualsResultWithMappings, SemanticGetResult, InferSchemaResult, MissingSuggestion, InferTypeResult, SensitiveResult, } from '../../shared/types.ts';
18
+ /** Validation result with field-specific issues */
19
+ export interface ObjectValidateResult {
20
+ valid: boolean;
21
+ issues: {
22
+ field: string;
23
+ problem: string;
24
+ }[];
25
+ }
26
+ /** Options for semantic merge */
27
+ export interface SemanticMergeOptions {
28
+ conflictResolution?: 'prefer-this' | 'prefer-other' | 'combine';
29
+ }
30
+ /** Key naming conventions */
31
+ export type KeyConvention = 'camelCase' | 'snake_case' | 'PascalCase' | 'kebab-case';
32
+ /**
33
+ * SemanticObject - Object with LLM-powered semantic understanding
34
+ *
35
+ * Unlike traditional objects that require exact key matches,
36
+ * semantic objects can access properties using natural language
37
+ * queries and understand synonymous keys.
38
+ *
39
+ * @template T - The type of the underlying object
40
+ */
41
+ export declare class SemanticObject<T extends object = object> implements Semantic<T>, Comparable<SemanticObject<T> | object, SemanticEqualsResultWithMappings> {
42
+ private readonly data;
43
+ private readonly client;
44
+ private constructor();
45
+ /**
46
+ * Create a SemanticObject from an existing object
47
+ */
48
+ static from<T extends object>(obj: T, client?: LLMClient): SemanticObject<T>;
49
+ /**
50
+ * Create an empty SemanticObject
51
+ */
52
+ static empty<T extends object = object>(client?: LLMClient): SemanticObject<T>;
53
+ /**
54
+ * Get the underlying object value
55
+ */
56
+ valueOf(): T;
57
+ /**
58
+ * Get a property using semantic key matching.
59
+ * Matches property names semantically, not just exactly.
60
+ *
61
+ * @param query - Property name or semantic query
62
+ * @returns Property value with match info
63
+ */
64
+ semanticGet(query: string): Promise<SemanticGetResult>;
65
+ /**
66
+ * Check if two objects are semantically equivalent.
67
+ * Considers property name synonyms and value meaning.
68
+ *
69
+ * @param other - Object to compare with
70
+ * @returns Equivalence result with mappings
71
+ */
72
+ semanticallyEquals(other: SemanticObject<T> | object): Promise<SemanticEqualsResultWithMappings>;
73
+ /**
74
+ * Validate the object against semantic rules.
75
+ *
76
+ * @param rules - Natural language validation rules
77
+ * @returns Validation result
78
+ */
79
+ validate(rules: string[]): Promise<ObjectValidateResult>;
80
+ /**
81
+ * Infer the semantic schema of this object.
82
+ *
83
+ * @returns Inferred schema with field descriptions
84
+ */
85
+ inferSchema(): Promise<InferSchemaResult>;
86
+ /**
87
+ * Transform property names to a different convention.
88
+ *
89
+ * @param convention - Target naming convention
90
+ * @returns Transformed object
91
+ */
92
+ transformKeys(convention: KeyConvention): Promise<SemanticObject<T>>;
93
+ /**
94
+ * Merge with another object, handling key synonyms.
95
+ *
96
+ * @param other - Object to merge
97
+ * @param options - Merge options
98
+ * @returns Merged object
99
+ */
100
+ semanticMerge(other: object, options?: SemanticMergeOptions): Promise<SemanticObject<T>>;
101
+ /**
102
+ * Extract specific fields using semantic matching.
103
+ *
104
+ * @param fields - Fields to extract (semantic descriptions)
105
+ * @returns Extracted object
106
+ */
107
+ pick(fields: string[]): Promise<SemanticObject<Partial<T>>>;
108
+ /**
109
+ * Suggest missing fields based on the object's purpose.
110
+ *
111
+ * @returns Suggested fields
112
+ */
113
+ suggestMissingFields(): Promise<MissingSuggestion[]>;
114
+ /**
115
+ * Summarize the object contents.
116
+ *
117
+ * @returns Human-readable summary
118
+ */
119
+ summarize(): Promise<string>;
120
+ /**
121
+ * Detect the semantic type/purpose of this object.
122
+ *
123
+ * @returns Inferred type
124
+ */
125
+ inferType(): Promise<InferTypeResult>;
126
+ /**
127
+ * Check if a field contains sensitive data.
128
+ *
129
+ * @param field - Field name to check
130
+ * @returns Sensitivity assessment
131
+ */
132
+ isSensitive(field: string): Promise<SensitiveResult>;
133
+ /**
134
+ * Get all keys of the object
135
+ */
136
+ keys(): string[];
137
+ /**
138
+ * Get all values of the object
139
+ */
140
+ values(): unknown[];
141
+ /**
142
+ * Get all entries of the object
143
+ */
144
+ entries(): [string, unknown][];
145
+ /**
146
+ * Check if object has a property (exact match)
147
+ */
148
+ has(key: string): boolean;
149
+ /**
150
+ * Get a property value (exact match)
151
+ */
152
+ get<K extends keyof T>(key: K): T[K];
153
+ /**
154
+ * Convert to string
155
+ */
156
+ toString(): string;
157
+ /**
158
+ * Convert to JSON
159
+ */
160
+ toJSON(): T;
161
+ }
162
+ //# sourceMappingURL=object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../src/types/object/object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EACV,gCAAgC,EAChC,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAgBvE,YAAY,EACV,gCAAgC,EAChC,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAE/B,mDAAmD;AACnD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC9C;AAED,iCAAiC;AACjC,MAAM,WAAW,oBAAoB;IACnC,kBAAkB,CAAC,EAAE,aAAa,GAAG,cAAc,GAAG,SAAS,CAAC;CACjE;AAED,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BAAoB,GAC7B,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IA6B7B;;;;;OAKG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IA2BjE;;;;OAIG;IACG,oBAAoB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAqB1D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAsBlC;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC;IAiB3C;;;;;OAKG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IA2B1D;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE;IAIhB;;OAEG;IACH,MAAM,IAAI,OAAO,EAAE;IAInB;;OAEG;IACH,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;IAI9B;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB;;OAEG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAIpC;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,MAAM,IAAI,CAAC;CAGZ"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Prompts for SemanticObject LLM operations
3
+ * These prompts enable semantic operations on object data structures
4
+ */
5
+ /**
6
+ * System prompt for object semantic operations
7
+ */
8
+ export declare const OBJECT_SYSTEM_PROMPT = "You are a semantic object analyzer. Your task is to analyze objects and their properties to provide semantic understanding.\n\nYou must respond with valid JSON only, no additional text or explanation.\n\nGuidelines:\n- Consider property names, values, and their semantic meanings\n- Understand common naming conventions (camelCase, snake_case, etc.)\n- Recognize synonymous property names (e.g., \"email\" and \"emailAddress\")\n- Provide confidence scores from 0.0 to 1.0\n- Be precise and consistent in your analysis";
9
+ /**
10
+ * Prompt for semantic property access
11
+ */
12
+ export declare function createSemanticGetPrompt(obj: object, query: string): string;
13
+ /**
14
+ * Prompt for semantic equality comparison
15
+ */
16
+ export declare function createSemanticallyEqualsPrompt(obj1: object, obj2: object): string;
17
+ /**
18
+ * Prompt for validation against rules
19
+ */
20
+ export declare function createValidatePrompt(obj: object, rules: string[]): string;
21
+ /**
22
+ * Prompt for schema inference
23
+ */
24
+ export declare function createInferSchemaPrompt(obj: object): string;
25
+ /**
26
+ * Prompt for key transformation
27
+ */
28
+ export declare function createTransformKeysPrompt(obj: object, convention: 'camelCase' | 'snake_case' | 'PascalCase' | 'kebab-case'): string;
29
+ /**
30
+ * Prompt for semantic merge
31
+ */
32
+ export declare function createSemanticMergePrompt(obj1: object, obj2: object, options?: {
33
+ conflictResolution?: 'prefer-this' | 'prefer-other' | 'combine';
34
+ }): string;
35
+ /**
36
+ * Prompt for semantic field extraction (pick)
37
+ */
38
+ export declare function createPickPrompt(obj: object, fields: string[]): string;
39
+ /**
40
+ * Prompt for suggesting missing fields
41
+ */
42
+ export declare function createSuggestMissingFieldsPrompt(obj: object): string;
43
+ /**
44
+ * Prompt for summarization
45
+ */
46
+ export declare function createSummarizePrompt(obj: object): string;
47
+ /**
48
+ * Prompt for type inference
49
+ */
50
+ export declare function createInferTypePrompt(obj: object): string;
51
+ /**
52
+ * Prompt for sensitive data detection
53
+ */
54
+ export declare function createIsSensitivePrompt(obj: object, field: string): string;
55
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/types/object/prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,2gBASY,CAAC;AAE9C;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,MAAM,CAmBR;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,MAAM,CAoBR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EAAE,GACd,MAAM,CAiBR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAsB3D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,GACnE,MAAM,CAcR;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IAAE,kBAAkB,CAAC,EAAE,aAAa,GAAG,cAAc,GAAG,SAAS,CAAA;CAAE,GAC5E,MAAM,CAwBR;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EAAE,GACf,MAAM,CAiBR;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAkBpE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAezD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAYzD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACZ,MAAM,CAoBR"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * SemanticObjectLiteral
3
+ * LLM-enhanced object literal type with semantic understanding
4
+ */
5
+ export { SemanticObjectLiteral, type ObjectLiteralValidateResult, type DetectDomainResult, type PropertySearchResult, type MissingPropertySuggestion, type KeyConvention, type SemanticEqualsResultWithMappings, type InferSchemaResult, type SensitiveResult, } from './object-literal.ts';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/object-literal/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,qBAAqB,EACrB,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAClB,KAAK,gCAAgC,EACrC,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAC"}