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,176 @@
1
+ /**
2
+ * SemanticSymbol - LLM-enhanced symbol type with semantic understanding
3
+ *
4
+ * Extends the native JavaScript Symbol with semantic operations including:
5
+ * - Semantic equivalence comparison
6
+ * - Name suggestion based on conventions
7
+ * - Category classification
8
+ * - Validation against best practices
9
+ * - Purpose description
10
+ * - Appropriateness assessment
11
+ *
12
+ * Implements shared interfaces:
13
+ * - Semantic<symbol> - Base semantic wrapper
14
+ * - Comparable<SemanticSymbol | symbol> - Semantic equality comparison
15
+ */
16
+ import type { LLMConfig, Message } from '../../llm/types.ts';
17
+ import type { SemanticEqualsResultWithReason, ValidateResultWithWarnings, AppropriateResult, Suggestion } from '../../shared/types.ts';
18
+ import type { Semantic, Comparable } from '../../shared/interfaces.ts';
19
+ export type { SemanticEqualsResultWithReason, ValidateResultWithWarnings, AppropriateResult, Suggestion, } from '../../shared/types.ts';
20
+ /** LLM client interface for dependency injection */
21
+ export interface LLMClientInterface {
22
+ chat(options: {
23
+ messages: Message[];
24
+ systemPrompt?: string;
25
+ } & LLMConfig): Promise<{
26
+ content: string;
27
+ }>;
28
+ }
29
+ /** Result type for classification without confidence */
30
+ export interface SymbolClassifyResult {
31
+ category: string;
32
+ subcategory?: string;
33
+ }
34
+ /**
35
+ * SemanticSymbol class
36
+ * Wraps a Symbol with LLM-powered semantic operations
37
+ *
38
+ * Implements:
39
+ * - Semantic<symbol> - valueOf() returns the symbol
40
+ * - Comparable<SemanticSymbol | symbol> - semanticallyEquals() for comparison
41
+ */
42
+ export declare class SemanticSymbol implements Semantic<symbol>, Comparable<SemanticSymbol | symbol> {
43
+ private readonly _symbol;
44
+ private readonly _description;
45
+ private readonly _llmClient;
46
+ private readonly _llmConfig?;
47
+ /**
48
+ * Private constructor - use static factory methods to create instances
49
+ */
50
+ private constructor();
51
+ /**
52
+ * Create a SemanticSymbol with a semantically meaningful description.
53
+ *
54
+ * @param description - Human-readable description of the symbol's purpose
55
+ * @param llmClient - Optional LLM client for dependency injection
56
+ * @param llmConfig - Optional LLM configuration
57
+ * @returns SemanticSymbol instance
58
+ *
59
+ * @example
60
+ * SemanticSymbol.create("userAuthToken")
61
+ * SemanticSymbol.create("cacheInvalidationKey")
62
+ */
63
+ static create(description: string, llmClient?: LLMClientInterface, llmConfig?: LLMConfig): SemanticSymbol;
64
+ /**
65
+ * Create or retrieve a global symbol with semantic validation.
66
+ * Uses the global symbol registry to ensure the same key always returns the same SemanticSymbol.
67
+ *
68
+ * @param key - Registry key for the symbol
69
+ * @param llmClient - Optional LLM client for dependency injection
70
+ * @param llmConfig - Optional LLM configuration
71
+ * @returns SemanticSymbol from global registry
72
+ *
73
+ * @example
74
+ * SemanticSymbol.for("app.config.database")
75
+ * SemanticSymbol.for("plugin.lifecycle.init")
76
+ */
77
+ static for(key: string, llmClient?: LLMClientInterface, llmConfig?: LLMConfig): SemanticSymbol;
78
+ /**
79
+ * Wrap an existing symbol in a SemanticSymbol.
80
+ *
81
+ * @param symbol - The native symbol to wrap
82
+ * @param llmClient - Optional LLM client for dependency injection
83
+ * @param llmConfig - Optional LLM configuration
84
+ * @returns SemanticSymbol instance
85
+ */
86
+ static from(symbol: symbol, llmClient?: LLMClientInterface, llmConfig?: LLMConfig): SemanticSymbol;
87
+ /**
88
+ * Check if two symbols serve the same semantic purpose.
89
+ * Even unique symbols can be semantically equivalent in purpose.
90
+ *
91
+ * @param other - Another symbol to compare
92
+ * @returns Equivalence result with confidence and note
93
+ *
94
+ * @example
95
+ * SemanticSymbol.create("userId").semanticallyEquals(SemanticSymbol.create("user_id"))
96
+ * // { equivalent: true, confidence: 0.95, note: "Same concept, different naming convention" }
97
+ */
98
+ semanticallyEquals(other: SemanticSymbol | symbol): Promise<SemanticEqualsResultWithReason>;
99
+ /**
100
+ * Suggest a better description for the symbol based on conventions.
101
+ *
102
+ * @returns Suggestion with explanation
103
+ *
104
+ * @example
105
+ * SemanticSymbol.create("x").suggestBetterName()
106
+ * // { suggestion: null, reason: "Cannot suggest without more context" }
107
+ *
108
+ * SemanticSymbol.create("usrid").suggestBetterName()
109
+ * // { suggestion: "userId", reason: "Use camelCase and avoid abbreviations" }
110
+ */
111
+ suggestBetterName(): Promise<Suggestion>;
112
+ /**
113
+ * Classify the symbol into a category based on its description.
114
+ *
115
+ * @returns Category classification
116
+ *
117
+ * @example
118
+ * SemanticSymbol.create("onUserLogin").classify()
119
+ * // { category: "event", subcategory: "lifecycle" }
120
+ *
121
+ * SemanticSymbol.create("API_SECRET_KEY").classify()
122
+ * // { category: "configuration", subcategory: "secrets" }
123
+ */
124
+ classify(): Promise<SymbolClassifyResult>;
125
+ /**
126
+ * Validate the symbol description follows best practices.
127
+ *
128
+ * @param conventions - Optional custom conventions to check against
129
+ * @returns Validation result with warnings
130
+ *
131
+ * @example
132
+ * SemanticSymbol.create("_private_internal").validate()
133
+ * // { valid: true, warnings: ["Underscore prefix suggests private; consider using # for true privacy"] }
134
+ */
135
+ validate(conventions?: string[]): Promise<ValidateResultWithWarnings>;
136
+ /**
137
+ * Get the semantic purpose/intent of this symbol.
138
+ *
139
+ * @returns Description of the symbol's purpose
140
+ *
141
+ * @example
142
+ * SemanticSymbol.create("cacheKey").describePurpose()
143
+ * // "Unique identifier for cache entries"
144
+ */
145
+ describePurpose(): Promise<string>;
146
+ /**
147
+ * Check if this symbol is appropriate for a given use case.
148
+ *
149
+ * @param useCase - The intended use case
150
+ * @returns Appropriateness assessment
151
+ *
152
+ * @example
153
+ * SemanticSymbol.create("tempId").isAppropriateFor("database primary key")
154
+ * // { appropriate: false, reason: "Temporary identifiers should not be used as permanent keys" }
155
+ */
156
+ isAppropriateFor(useCase: string): Promise<AppropriateResult>;
157
+ /**
158
+ * Get the underlying Symbol value.
159
+ * @returns The native Symbol
160
+ */
161
+ valueOf(): symbol;
162
+ /**
163
+ * Get the symbol's description.
164
+ * @returns The description string or undefined
165
+ */
166
+ description(): string | undefined;
167
+ /**
168
+ * Convert to string representation
169
+ */
170
+ toString(): string;
171
+ /**
172
+ * Convert to JSON - symbols cannot be serialized, returns description
173
+ */
174
+ toJSON(): string | undefined;
175
+ }
176
+ //# sourceMappingURL=symbol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbol.d.ts","sourceRoot":"","sources":["../../../src/primitives/symbol/symbol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,8BAA8B,EAC9B,0BAA0B,EAC1B,iBAAiB,EACjB,UAAU,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAiBvE,YAAY,EACV,8BAA8B,EAC9B,0BAA0B,EAC1B,iBAAiB,EACjB,UAAU,GACX,MAAM,uBAAuB,CAAC;AAE/B,oDAAoD;AACpD,MAAM,WAAW,kBAAkB;IACjC,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+B9C;;;;;;;;;;;OAWG;IACG,QAAQ,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAuB/C;;;;;;;;;OASG;IACG,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAiC3E;;;;;;;;OAQG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAqBxC;;;;;;;;;OASG;IACG,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAuBnE;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,WAAW,IAAI,MAAM,GAAG,SAAS;IAIjC;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,MAAM,IAAI,MAAM,GAAG,SAAS;CAG7B"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Prompts for SemanticSymbol LLM operations
3
+ * These prompts are used for various semantic symbol operations that require LLM understanding
4
+ */
5
+ /**
6
+ * System prompt for semantic equality comparison of symbols
7
+ */
8
+ export declare const SEMANTIC_EQUALS_SYSTEM = "You are a symbol naming expert. Your task is to determine if two symbol descriptions serve the same semantic purpose.\n\nConsider:\n- Naming conventions (camelCase, snake_case, SCREAMING_CASE)\n- Common abbreviations and their expansions\n- Synonyms and related concepts\n- The underlying intent, not just the literal text\n\nAlways respond with valid JSON only.";
9
+ /**
10
+ * User prompt template for semantic equality
11
+ */
12
+ export declare function semanticEqualsPrompt(desc1: string, desc2: string): string;
13
+ /**
14
+ * System prompt for suggesting better names
15
+ */
16
+ export declare const SUGGEST_NAME_SYSTEM = "You are a code naming expert. Your task is to suggest better names for identifiers based on best practices.\n\nBest practices:\n- Use descriptive, meaningful names\n- Follow camelCase for most identifiers\n- Avoid single letters except for well-known conventions (i, j for loops)\n- Expand abbreviations when clarity is improved\n- Keep names concise but clear\n\nAlways respond with valid JSON only.";
17
+ /**
18
+ * User prompt template for suggesting better names
19
+ */
20
+ export declare function suggestBetterNamePrompt(description: string): string;
21
+ /**
22
+ * System prompt for classifying symbols
23
+ */
24
+ export declare const CLASSIFY_SYSTEM = "You are a code analysis expert. Your task is to classify symbol descriptions into categories.\n\nCategories:\n- event: Event handlers, listeners, callbacks (e.g., onClick, onUserLogin)\n- configuration: Config keys, settings, options (e.g., API_KEY, maxRetries)\n- lifecycle: Initialization, cleanup, state transitions (e.g., init, destroy, mount)\n- identifier: IDs, keys, references (e.g., userId, cacheKey)\n- action: Methods, commands, operations (e.g., submit, validate, process)\n- data: Data structures, storage (e.g., userData, itemList)\n- constant: Unchanging values (e.g., MAX_SIZE, DEFAULT_TIMEOUT)\n- internal: Private/internal markers (e.g., _private, __internal)\n- metadata: Descriptive information (e.g., version, timestamp)\n- unknown: Cannot be determined\n\nSubcategories provide more specific classification within each category.\n\nAlways respond with valid JSON only.";
25
+ /**
26
+ * User prompt template for classification
27
+ */
28
+ export declare function classifyPrompt(description: string): string;
29
+ /**
30
+ * System prompt for validation
31
+ */
32
+ export declare const VALIDATE_SYSTEM = "You are a code review expert. Your task is to validate symbol descriptions against naming conventions and best practices.\n\nCheck for:\n- Clarity and descriptiveness\n- Consistent naming convention (camelCase, snake_case, etc.)\n- Appropriate length (not too short, not too long)\n- Avoidance of reserved words or problematic names\n- Proper use of prefixes/suffixes\n\nAlways respond with valid JSON only.";
33
+ /**
34
+ * User prompt template for validation
35
+ */
36
+ export declare function validatePrompt(description: string, conventions?: string[]): string;
37
+ /**
38
+ * System prompt for describing purpose
39
+ */
40
+ export declare const DESCRIBE_PURPOSE_SYSTEM = "You are a documentation expert. Your task is to describe the likely purpose of a symbol based on its name.\n\nConsider:\n- Common naming patterns in programming\n- Domain-specific terminology\n- Prefixes and suffixes that indicate purpose\n\nAlways respond with valid JSON only.";
41
+ /**
42
+ * User prompt template for describing purpose
43
+ */
44
+ export declare function describePurposePrompt(description: string): string;
45
+ /**
46
+ * System prompt for appropriateness check
47
+ */
48
+ export declare const IS_APPROPRIATE_SYSTEM = "You are a software design expert. Your task is to assess if a symbol is appropriate for a given use case.\n\nConsider:\n- Semantic fit between the name and use case\n- Potential confusion or misuse\n- Naming conventions for the specific use case\n- Longevity and maintainability concerns\n\nAlways respond with valid JSON only.";
49
+ /**
50
+ * User prompt template for appropriateness check
51
+ */
52
+ export declare function isAppropriateForPrompt(description: string, useCase: string): string;
53
+ //# sourceMappingURL=symbol.prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbol.prompts.d.ts","sourceRoot":"","sources":["../../../src/primitives/symbol/symbol.prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB,+WAQE,CAAC;AAEtC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAUzE;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,qZASK,CAAC;AAEtC;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAUnE;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,+3BAgBS,CAAC;AAEtC;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAO1D;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,4ZASS,CAAC;AAEtC;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAWlF;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,2RAOC,CAAC;AAEtC;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CASjE;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,4UAQG,CAAC;AAEtC;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAQnF"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * SemanticUndefined exports
3
+ */
4
+ export { SemanticUndefined, type UndefinedType, type UndefinedClassifyResult, type SuggestInitializationResult, type TypeHint, type AcceptableResult, type CompareToNullResult, type SemanticEqualsResult, type InferReasonResult, } from './undefined.ts';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/undefined/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Prompts for SemanticUndefined LLM operations
3
+ * These prompts are used to reason about undefined values and their semantic meaning
4
+ */
5
+ /**
6
+ * System prompt for undefined interpretation tasks
7
+ */
8
+ export declare const UNDEFINED_SYSTEM_PROMPT = "You are a semantic undefined value interpreter. Your task is to analyze and reason about undefined values, their meaning, and appropriate handling in JavaScript/TypeScript contexts.\n\nYou must respond with valid JSON only, no additional text or explanation.\n\nKey concepts:\n- \"not-initialized\": A variable/property that has been declared but not assigned a value\n- \"optional-unset\": An optional parameter/property that was not provided\n- \"property-missing\": Accessing a property that doesn't exist on an object\n- \"void-return\": A function that doesn't explicitly return a value\n- \"unknown\": The reason for undefined is unclear or indeterminate\n\nGuidelines:\n- Consider property/variable names when inferring reasons\n- Analyze context to determine if undefined is intentional or a potential bug\n- Provide confidence scores from 0.0 to 1.0 based on clarity\n- Suggest appropriate initializations only when safe (never for sensitive data)\n- Distinguish between undefined (uninitialized) and null (intentional absence)";
9
+ /**
10
+ * Prompt template for comparing two undefined contexts for semantic equivalence
11
+ */
12
+ export declare function createSemanticallyEqualsPrompt(context1: string, context2: string): string;
13
+ /**
14
+ * Prompt template for inferring the reason a property/value is undefined
15
+ */
16
+ export declare function createInferReasonPrompt(propertyPath: string, context?: unknown): string;
17
+ /**
18
+ * Prompt template for suggesting an appropriate initialization value
19
+ */
20
+ export declare function createSuggestInitializationPrompt(propertyName: string, typeHint?: {
21
+ type: string;
22
+ schema?: unknown;
23
+ }): string;
24
+ /**
25
+ * Prompt template for checking if undefined is acceptable for a context
26
+ */
27
+ export declare function createIsAcceptablePrompt(context: string, details?: Record<string, unknown>): string;
28
+ /**
29
+ * Prompt template for comparing null vs undefined appropriateness
30
+ */
31
+ export declare function createCompareToNullPrompt(context: string): string;
32
+ /**
33
+ * Prompt template for generating a human-readable explanation
34
+ */
35
+ export declare function createExplainPrompt(propertyPath: string, context?: string): string;
36
+ /**
37
+ * Prompt template for classifying the type of undefined
38
+ */
39
+ export declare function createClassifyPrompt(context: string): string;
40
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/primitives/undefined/prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB,ihCAgB2C,CAAC;AAEhF;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,MAAM,CAgBR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,OAAO,GAChB,MAAM,CAuBR;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5C,MAAM,CA2BR;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,MAAM,CAwBR;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAkBjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAsBR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAmB5D"}
@@ -0,0 +1,216 @@
1
+ /**
2
+ * SemanticUndefined
3
+ * An undefined type with LLM-powered semantic understanding
4
+ *
5
+ * Implements shared interfaces:
6
+ * - Semantic<undefined> - Base semantic wrapper
7
+ * - Comparable<SemanticUndefined> - Semantic equality comparison
8
+ * - Explainable - Human-readable explanation
9
+ *
10
+ * Note: Does not implement SemanticAbsence<undefined> because undefined
11
+ * has different classification types than null (not-initialized, optional-unset,
12
+ * property-missing, void-return vs not-set, not-applicable).
13
+ */
14
+ import type { LLMClient } from '../../llm/client.ts';
15
+ import type { SemanticEqualsResult, InferReasonResult } from '../../shared/types.ts';
16
+ import type { Semantic, Comparable, Explainable } from '../../shared/interfaces.ts';
17
+ export type { SemanticEqualsResult, InferReasonResult, } from '../../shared/types.ts';
18
+ /** Classification types for undefined values */
19
+ export type UndefinedType = 'not-initialized' | 'optional-unset' | 'property-missing' | 'void-return' | 'unknown';
20
+ /** Result of undefined classification */
21
+ export interface UndefinedClassifyResult {
22
+ type: UndefinedType;
23
+ canBeInitialized: boolean;
24
+ }
25
+ /** Result of suggesting an initialization value */
26
+ export interface SuggestInitializationResult {
27
+ value: unknown;
28
+ explanation: string;
29
+ }
30
+ /** Type hint for initialization suggestion */
31
+ export interface TypeHint {
32
+ type: string;
33
+ schema?: unknown;
34
+ }
35
+ /** Result of checking if undefined is acceptable */
36
+ export interface AcceptableResult {
37
+ acceptable: boolean;
38
+ reason: string;
39
+ }
40
+ /** Result of comparing null vs undefined */
41
+ export interface CompareToNullResult {
42
+ recommendation: 'null' | 'undefined';
43
+ explanation: string;
44
+ }
45
+ /**
46
+ * SemanticUndefined - Undefined with LLM-powered semantic understanding
47
+ *
48
+ * Unlike plain undefined that only represents an uninitialized/missing value,
49
+ * SemanticUndefined can explain why a value is undefined, suggest initialization,
50
+ * and help reason about appropriate handling.
51
+ *
52
+ * Implements:
53
+ * - Semantic<undefined> - valueOf() returns undefined
54
+ * - Comparable<SemanticUndefined> - semanticallyEquals() for comparison
55
+ * - Explainable - explain() for human-readable description
56
+ * - SemanticAbsence<undefined> - getReason() and classify()
57
+ */
58
+ export declare class SemanticUndefined implements Semantic<undefined>, Comparable<SemanticUndefined>, Explainable {
59
+ private readonly context;
60
+ private readonly client;
61
+ private constructor();
62
+ /**
63
+ * Create a SemanticUndefined with context about why the value is undefined.
64
+ *
65
+ * @param context - Context explaining the undefined state
66
+ * @param client - Optional LLM client for dependency injection
67
+ * @returns SemanticUndefined instance with context
68
+ *
69
+ * @example
70
+ * SemanticUndefined.because("property not yet initialized")
71
+ * SemanticUndefined.because("optional parameter not provided")
72
+ */
73
+ static because(context: string, client?: LLMClient): SemanticUndefined;
74
+ /**
75
+ * Create a SemanticUndefined without a context.
76
+ *
77
+ * @param client - Optional LLM client for dependency injection
78
+ * @returns SemanticUndefined instance
79
+ */
80
+ static create(client?: LLMClient): SemanticUndefined;
81
+ /**
82
+ * Check if two undefined values are semantically equivalent.
83
+ * Undefined values with similar contexts are considered equivalent.
84
+ *
85
+ * @param other - Another SemanticUndefined to compare
86
+ * @returns Equivalence result with confidence score
87
+ *
88
+ * @example
89
+ * await SemanticUndefined.because("not initialized").semanticallyEquals(
90
+ * SemanticUndefined.because("unset")
91
+ * )
92
+ * // { equivalent: true, confidence: 0.9 }
93
+ */
94
+ semanticallyEquals(other: SemanticUndefined): Promise<SemanticEqualsResult>;
95
+ /**
96
+ * Infer why a value is undefined based on context.
97
+ *
98
+ * @param propertyPath - The property path that is undefined
99
+ * @param context - Surrounding context
100
+ * @param client - Optional LLM client for dependency injection
101
+ * @returns Inferred reason
102
+ *
103
+ * @example
104
+ * await SemanticUndefined.inferReason("user.profile.avatar", { user: { profile: {} } })
105
+ * // { reason: "Optional property not set", type: "optional-unset" }
106
+ */
107
+ static inferReason(propertyPath: string, context?: unknown, client?: LLMClient): Promise<InferReasonResult>;
108
+ /**
109
+ * Suggest an appropriate initialization value.
110
+ *
111
+ * @param propertyName - Name of the property
112
+ * @param typeHint - Optional type information
113
+ * @param client - Optional LLM client for dependency injection
114
+ * @returns Suggested initialization with explanation
115
+ *
116
+ * @example
117
+ * await SemanticUndefined.suggestInitialization("items", { type: "array" })
118
+ * // { value: [], explanation: "Arrays should be initialized empty, not undefined" }
119
+ *
120
+ * await SemanticUndefined.suggestInitialization("config", { type: "object" })
121
+ * // { value: {}, explanation: "Objects should be initialized empty" }
122
+ */
123
+ static suggestInitialization(propertyName: string, typeHint?: TypeHint, client?: LLMClient): Promise<SuggestInitializationResult>;
124
+ /**
125
+ * Determine if undefined is acceptable here or indicates a bug.
126
+ *
127
+ * @param context - Context about where this undefined occurred
128
+ * @param details - Additional details
129
+ * @param client - Optional LLM client for dependency injection
130
+ * @returns Assessment result
131
+ *
132
+ * @example
133
+ * await SemanticUndefined.isAcceptable("return value", { functionName: "getUserById" })
134
+ * // { acceptable: false, reason: "Function should return null for not found, not undefined" }
135
+ */
136
+ static isAcceptable(context: string, details?: Record<string, unknown>, client?: LLMClient): Promise<AcceptableResult>;
137
+ /**
138
+ * Check if this undefined differs semantically from null.
139
+ * Explains when null vs undefined should be used.
140
+ *
141
+ * @param context - Context for the comparison
142
+ * @param client - Optional LLM client for dependency injection
143
+ * @returns Explanation of which is more appropriate
144
+ *
145
+ * @example
146
+ * await SemanticUndefined.compareToNull("user.deletedAt")
147
+ * // {
148
+ * // recommendation: "null",
149
+ * // explanation: "Use null for intentional absence (not deleted), undefined implies uninitialized"
150
+ * // }
151
+ */
152
+ static compareToNull(context: string, client?: LLMClient): Promise<CompareToNullResult>;
153
+ /**
154
+ * Determine if this undefined represents a specific classification.
155
+ *
156
+ * @returns Classification of the undefined type
157
+ *
158
+ * @example
159
+ * // For a property that was never initialized:
160
+ * // { type: "not-initialized", canBeInitialized: true }
161
+ *
162
+ * // For an optional parameter not provided:
163
+ * // { type: "optional-unset", canBeInitialized: true }
164
+ */
165
+ classify(): Promise<UndefinedClassifyResult>;
166
+ /**
167
+ * Generate a human-readable explanation of this undefined value.
168
+ *
169
+ * @param propertyPath - The property path
170
+ * @returns Human-readable explanation
171
+ *
172
+ * @example
173
+ * await SemanticUndefined.because("not in response").explain("user.nickname")
174
+ * // "The nickname property was not included in the API response"
175
+ */
176
+ explain(propertyPath: string): Promise<string>;
177
+ /**
178
+ * Get the context/reason for this undefined.
179
+ * Note: This method is named getContext per the spec, but also implements
180
+ * getReason from SemanticAbsence interface for compatibility.
181
+ *
182
+ * @returns The context string or undefined
183
+ */
184
+ getContext(): string | undefined;
185
+ /**
186
+ * Get the reason for this undefined (alias for getContext).
187
+ * Implements SemanticAbsence interface.
188
+ *
189
+ * @returns The reason string or undefined
190
+ */
191
+ getReason(): string | undefined;
192
+ /**
193
+ * Check if this is semantically undefined (always true for SemanticUndefined).
194
+ *
195
+ * @returns true
196
+ */
197
+ isUndefined(): true;
198
+ /**
199
+ * Get the underlying undefined value.
200
+ *
201
+ * @returns undefined
202
+ */
203
+ valueOf(): undefined;
204
+ /**
205
+ * Convert to string representation
206
+ */
207
+ toString(): string;
208
+ /**
209
+ * Convert to JSON representation
210
+ */
211
+ toJSON(): {
212
+ value: undefined;
213
+ context?: string;
214
+ };
215
+ }
216
+ //# sourceMappingURL=undefined.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"undefined.d.ts","sourceRoot":"","sources":["../../../src/primitives/undefined/undefined.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KA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AC,EAAE,MAAM,CAAA;KAAE;CAMjD"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * SemanticVoid module exports
3
+ */
4
+ export { SemanticVoid, type VoidFunction, type AnalyzeSideEffectsResult, type ShouldReturnValueResult, type ValidateUsageResult, type CheckErrorHandlingResult, type SuggestSignatureResult, type AppropriateResult, } from './void.ts';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/void/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,GACvB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Prompts for SemanticVoid LLM operations
3
+ * These prompts analyze void functions, side effects, and proper usage patterns
4
+ */
5
+ /**
6
+ * System prompt for void function analysis tasks
7
+ */
8
+ export declare const VOID_SYSTEM_PROMPT = "You are a semantic void function analyzer. Your task is to analyze functions that return void, understand their side effects, and validate their proper usage.\n\nYou must respond with valid JSON only, no additional text or explanation.\n\nKey concepts:\n- Void functions perform side effects without returning values\n- Side effects include: I/O operations, state mutations, logging, network requests, DOM manipulation\n- Pure functions have no side effects and should typically return values\n- Error handling is critical for void functions since errors cannot be returned\n\nGuidelines:\n- Analyze function code to identify all side effects\n- Consider the function name semantics when inferring behavior\n- Provide clear, actionable recommendations\n- Be conservative with safety assessments";
9
+ /**
10
+ * Prompt template for analyzing side effects of a void function
11
+ */
12
+ export declare function createAnalyzeSideEffectsPrompt(fnSource: string): string;
13
+ /**
14
+ * Prompt template for determining if a function should return a value
15
+ */
16
+ export declare function createShouldReturnValuePrompt(fnSource: string, context?: string): string;
17
+ /**
18
+ * Prompt template for explaining what a void function does
19
+ */
20
+ export declare function createExplainPrompt(fnSource: string): string;
21
+ /**
22
+ * Prompt template for validating usage of a void function
23
+ */
24
+ export declare function createValidateUsagePrompt(fnSource: string, usage: string): string;
25
+ /**
26
+ * Prompt template for checking error handling in a void function
27
+ */
28
+ export declare function createCheckErrorHandlingPrompt(fnSource: string): string;
29
+ /**
30
+ * Prompt template for suggesting a better function signature
31
+ */
32
+ export declare function createSuggestSignaturePrompt(fnSource: string): string;
33
+ /**
34
+ * Prompt template for checking if void is appropriate for a function name
35
+ */
36
+ export declare function createIsAppropriateForPrompt(fnName: string): string;
37
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/primitives/void/prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,+xBAcW,CAAC;AAE3C;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoBvE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAsBR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAiB5D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,CAqBR;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoBvE;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoBrE;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAiBnE"}