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,82 @@
1
+ /**
2
+ * Unified LLM Client
3
+ * Provides a single interface to interact with multiple LLM providers
4
+ */
5
+ import type { ChatOptions, CompletionOptions, LLMProvider, LLMResponse } from './types.ts';
6
+ /**
7
+ * LLM Client - Unified interface for LLM operations
8
+ *
9
+ * Uses environment variables for configuration:
10
+ * - LLM_PROVIDER: Which provider to use (openai, anthropic, google)
11
+ * - Provider-specific API keys and models
12
+ */
13
+ export declare class LLMClient {
14
+ private defaultProvider;
15
+ private apiKeys;
16
+ constructor(config?: {
17
+ provider?: LLMProvider;
18
+ apiKeys?: Partial<Record<LLMProvider, string>>;
19
+ });
20
+ /** Get the API key for a provider */
21
+ private getApiKey;
22
+ /** Resolve the provider from options or default */
23
+ private resolveProvider;
24
+ /**
25
+ * Generate a completion from a prompt
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const client = new LLMClient();
30
+ * const response = await client.complete({
31
+ * prompt: "What is the capital of France?",
32
+ * systemPrompt: "You are a helpful geography assistant."
33
+ * });
34
+ * console.log(response.content);
35
+ * ```
36
+ */
37
+ complete(options: CompletionOptions): Promise<LLMResponse>;
38
+ /**
39
+ * Generate a response in a chat conversation
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const client = new LLMClient();
44
+ * const response = await client.chat({
45
+ * messages: [
46
+ * { role: "user", content: "Hello!" },
47
+ * { role: "assistant", content: "Hi there! How can I help?" },
48
+ * { role: "user", content: "What's the weather like?" }
49
+ * ]
50
+ * });
51
+ * console.log(response.content);
52
+ * ```
53
+ */
54
+ chat(options: ChatOptions): Promise<LLMResponse>;
55
+ /**
56
+ * Switch to a different provider
57
+ */
58
+ withProvider(provider: LLMProvider): LLMClient;
59
+ }
60
+ /**
61
+ * Get the default LLM client (singleton)
62
+ */
63
+ export declare function getClient(): LLMClient;
64
+ /**
65
+ * Convenience function for simple completions
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * const response = await complete("What is 2 + 2?");
70
+ * console.log(response.content); // "4"
71
+ * ```
72
+ */
73
+ export declare function complete(prompt: string, options?: Omit<CompletionOptions, 'prompt'>): Promise<LLMResponse>;
74
+ /**
75
+ * Convenience function for simple chat completions
76
+ */
77
+ export declare function chat(options: ChatOptions): Promise<LLMResponse>;
78
+ /**
79
+ * Clear the provider cache (useful for testing or reconfiguration)
80
+ */
81
+ export declare function clearProviderCache(): void;
82
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/llm/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EAEjB,WAAW,EAEX,WAAW,EACZ,MAAM,YAAY,CAAC;AAkCpB;;;;;;GAMG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,eAAe,CAAc;IACrC,OAAO,CAAC,OAAO,CAAuC;gBAE1C,MAAM,CAAC,EAAE;QACnB,QAAQ,CAAC,EAAE,WAAW,CAAC;QACvB,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;KAChD;IAMD,qCAAqC;IACrC,OAAO,CAAC,SAAS;IAIjB,mDAAmD;IACnD,OAAO,CAAC,eAAe;IAIvB;;;;;;;;;;;;OAYG;IACG,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IAMhE;;;;;;;;;;;;;;;OAeG;IACG,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAMtD;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS;CAM/C;AAKD;;GAEG;AACH,wBAAgB,SAAS,IAAI,SAAS,CAKrC;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,GAC1C,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED;;GAEG;AACH,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAErE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAGzC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * LLM Module Exports
3
+ * Unified API for interacting with multiple LLM providers
4
+ */
5
+ export type { LLMProvider, MessageRole, Message, LLMConfig, CompletionOptions, ChatOptions, LLMResponse, LLMProviderInterface, LLMEnvironment, } from './types.ts';
6
+ export { getEnvConfig } from './types.ts';
7
+ export { LLMClient, getClient, complete, chat, clearProviderCache, } from './client.ts';
8
+ export { OpenAIProvider } from './providers/openai.ts';
9
+ export { AnthropicProvider } from './providers/anthropic.ts';
10
+ export { GoogleProvider } from './providers/google.ts';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/llm/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,WAAW,EACX,WAAW,EACX,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Anthropic Provider Implementation
3
+ */
4
+ import type { ChatOptions, CompletionOptions, LLMProviderInterface, LLMResponse } from '../types.ts';
5
+ export declare class AnthropicProvider implements LLMProviderInterface {
6
+ readonly provider: "anthropic";
7
+ private client;
8
+ private defaultModel;
9
+ constructor(apiKey?: string, model?: string);
10
+ complete(options: CompletionOptions): Promise<LLMResponse>;
11
+ chat(options: ChatOptions): Promise<LLMResponse>;
12
+ }
13
+ //# sourceMappingURL=anthropic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/anthropic.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EAEZ,MAAM,aAAa,CAAC;AAuBrB,qBAAa,iBAAkB,YAAW,oBAAoB;IAC5D,QAAQ,CAAC,QAAQ,EAAG,WAAW,CAAU;IACzC,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,YAAY,CAAS;gBAEjB,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAYrC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IA8B1D,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CAgCvD"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Google Generative AI (Gemini) Provider Implementation
3
+ */
4
+ import type { ChatOptions, CompletionOptions, LLMProviderInterface, LLMResponse } from '../types.ts';
5
+ export declare class GoogleProvider implements LLMProviderInterface {
6
+ readonly provider: "google";
7
+ private client;
8
+ private defaultModel;
9
+ constructor(apiKey?: string, model?: string);
10
+ complete(options: CompletionOptions): Promise<LLMResponse>;
11
+ chat(options: ChatOptions): Promise<LLMResponse>;
12
+ }
13
+ //# sourceMappingURL=google.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/google.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EAEZ,MAAM,aAAa,CAAC;AAqBrB,qBAAa,cAAe,YAAW,oBAAoB;IACzD,QAAQ,CAAC,QAAQ,EAAG,QAAQ,CAAU;IACtC,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,YAAY,CAAS;gBAEjB,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAYrC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IAoC1D,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CAwCvD"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * LLM Provider Exports
3
+ */
4
+ export { OpenAIProvider } from './openai.ts';
5
+ export { AnthropicProvider } from './anthropic.ts';
6
+ export { GoogleProvider } from './google.ts';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * OpenAI Provider Implementation
3
+ */
4
+ import type { ChatOptions, CompletionOptions, LLMProviderInterface, LLMResponse } from '../types.ts';
5
+ export declare class OpenAIProvider implements LLMProviderInterface {
6
+ readonly provider: "openai";
7
+ private client;
8
+ private defaultModel;
9
+ constructor(apiKey?: string, model?: string);
10
+ complete(options: CompletionOptions): Promise<LLMResponse>;
11
+ chat(options: ChatOptions): Promise<LLMResponse>;
12
+ }
13
+ //# sourceMappingURL=openai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/openai.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EAEZ,MAAM,aAAa,CAAC;AAoBrB,qBAAa,cAAe,YAAW,oBAAoB;IACzD,QAAQ,CAAC,QAAQ,EAAG,QAAQ,CAAU;IACtC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,YAAY,CAAS;gBAEjB,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAYrC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IAoC1D,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CAgCvD"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * LLM Provider Types and Interfaces
3
+ * Provides a universal API for interacting with different LLM providers
4
+ */
5
+ /** Supported LLM providers */
6
+ export type LLMProvider = 'openai' | 'anthropic' | 'google';
7
+ /** Role in a conversation message */
8
+ export type MessageRole = 'system' | 'user' | 'assistant';
9
+ /** A single message in a conversation */
10
+ export interface Message {
11
+ role: MessageRole;
12
+ content: string;
13
+ }
14
+ /** Configuration for LLM requests */
15
+ export interface LLMConfig {
16
+ /** The provider to use (defaults to LLM_PROVIDER env var) */
17
+ provider?: LLMProvider;
18
+ /** Model identifier (uses provider-specific default if not set) */
19
+ model?: string;
20
+ /** Maximum tokens to generate */
21
+ maxTokens?: number;
22
+ /** Temperature for response randomness (0-2) */
23
+ temperature?: number;
24
+ /** Top-p sampling parameter */
25
+ topP?: number;
26
+ /** Stop sequences to end generation */
27
+ stopSequences?: string[];
28
+ }
29
+ /** Options for a completion request */
30
+ export interface CompletionOptions extends LLMConfig {
31
+ /** The prompt to send to the model */
32
+ prompt: string;
33
+ /** Optional system message to set context */
34
+ systemPrompt?: string;
35
+ }
36
+ /** Options for a chat request */
37
+ export interface ChatOptions extends LLMConfig {
38
+ /** Array of messages in the conversation */
39
+ messages: Message[];
40
+ /** Optional system message (prepended to messages) */
41
+ systemPrompt?: string;
42
+ }
43
+ /** Standard response from an LLM request */
44
+ export interface LLMResponse {
45
+ /** The generated text content */
46
+ content: string;
47
+ /** The provider that generated the response */
48
+ provider: LLMProvider;
49
+ /** The model that was used */
50
+ model: string;
51
+ /** Token usage statistics (if available) */
52
+ usage?: {
53
+ promptTokens: number;
54
+ completionTokens: number;
55
+ totalTokens: number;
56
+ };
57
+ /** The raw response from the provider (for advanced use) */
58
+ raw?: unknown;
59
+ }
60
+ /** Interface that all LLM provider implementations must follow */
61
+ export interface LLMProviderInterface {
62
+ /** Provider identifier */
63
+ readonly provider: LLMProvider;
64
+ /** Generate a completion from a prompt */
65
+ complete(options: CompletionOptions): Promise<LLMResponse>;
66
+ /** Generate a response in a chat conversation */
67
+ chat(options: ChatOptions): Promise<LLMResponse>;
68
+ }
69
+ /** Environment configuration for LLM */
70
+ export interface LLMEnvironment {
71
+ provider: LLMProvider;
72
+ openai: {
73
+ apiKey?: string;
74
+ model: string;
75
+ };
76
+ anthropic: {
77
+ apiKey?: string;
78
+ model: string;
79
+ };
80
+ google: {
81
+ apiKey?: string;
82
+ model: string;
83
+ };
84
+ defaults: {
85
+ maxTokens: number;
86
+ temperature: number;
87
+ };
88
+ }
89
+ /** Get environment configuration */
90
+ export declare function getEnvConfig(): LLMEnvironment;
91
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/llm/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,8BAA8B;AAC9B,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE5D,qCAAqC;AACrC,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAE1D,yCAAyC;AACzC,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qCAAqC;AACrC,MAAM,WAAW,SAAS;IACxB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,uCAAuC;AACvC,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,iCAAiC;AACjC,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,4CAA4C;IAC5C,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,QAAQ,EAAE,WAAW,CAAC;IACtB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,KAAK,CAAC,EAAE;QACN,YAAY,EAAE,MAAM,CAAC;QACrB,gBAAgB,EAAE,MAAM,CAAC;QACzB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,4DAA4D;IAC5D,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,kEAAkE;AAClE,MAAM,WAAW,oBAAoB;IACnC,0BAA0B;IAC1B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAE/B,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE3D,iDAAiD;IACjD,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAClD;AAED,wCAAwC;AACxC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,WAAW,CAAC;IACtB,MAAM,EAAE;QACN,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,SAAS,EAAE;QACT,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,EAAE;QACN,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,QAAQ,EAAE;QACR,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,oCAAoC;AACpC,wBAAgB,YAAY,IAAI,cAAc,CAoB7C"}
@@ -0,0 +1,197 @@
1
+ /**
2
+ * SemanticBigInt
3
+ * A BigInt type with LLM-powered semantic understanding
4
+ *
5
+ * Implements shared interfaces:
6
+ * - Semantic<bigint> - Base semantic wrapper
7
+ * - Comparable<bigint | SemanticBigInt> - Semantic equality comparison
8
+ * - ContextValidatable - Domain-specific validation
9
+ * - Describable - Human-readable descriptions
10
+ */
11
+ import type { LLMClient } from '../../llm/client.ts';
12
+ import type { SemanticEqualsResult, ReasonableResult, InferDomainResult } from '../../shared/types.ts';
13
+ import type { Semantic, Comparable, ContextValidatable, Describable } from '../../shared/interfaces.ts';
14
+ export type { SemanticEqualsResult, ReasonableResult, InferDomainResult } from '../../shared/types.ts';
15
+ /** Format style options for BigInt display */
16
+ export type FormatStyle = 'words' | 'compact' | 'scientific' | 'full';
17
+ /** Options for formatting BigInt values */
18
+ export interface FormatOptions {
19
+ style?: FormatStyle;
20
+ locale?: string;
21
+ }
22
+ /** Result of scale/magnitude analysis */
23
+ export interface ScaleResult {
24
+ magnitude: number;
25
+ name: string;
26
+ scientificNotation: string;
27
+ }
28
+ /** Common mathematical patterns */
29
+ export type MatchPattern = 'power-of-two' | 'prime' | 'perfect-square' | 'factorial' | 'fibonacci' | 'even' | 'odd';
30
+ /**
31
+ * SemanticBigInt - BigInt with LLM-powered semantic understanding
32
+ *
33
+ * Unlike traditional BigInts that are just large integers,
34
+ * semantic BigInts can interpret natural language, understand domain context,
35
+ * and provide human-readable representations.
36
+ */
37
+ export declare class SemanticBigInt implements Semantic<bigint>, Comparable<bigint | SemanticBigInt>, ContextValidatable, Describable {
38
+ private readonly _value;
39
+ private readonly client;
40
+ private constructor();
41
+ /**
42
+ * Create a SemanticBigInt from a raw bigint value
43
+ */
44
+ static fromBigInt(value: bigint, client?: LLMClient): SemanticBigInt;
45
+ /**
46
+ * Create a SemanticBigInt from a number
47
+ */
48
+ static fromNumber(value: number, client?: LLMClient): SemanticBigInt;
49
+ /**
50
+ * Parse a BigInt from natural language or formatted string.
51
+ * Understands scientific notation, word forms, and abbreviations.
52
+ *
53
+ * @param input - Natural language or formatted BigInt string, number, or bigint
54
+ * @param client - Optional LLM client to use
55
+ * @returns Promise resolving to SemanticBigInt instance
56
+ *
57
+ * @example
58
+ * await SemanticBigInt.from("1 trillion") // 1000000000000n
59
+ * await SemanticBigInt.from("10^18") // 1000000000000000000n
60
+ * await SemanticBigInt.from("5.2e15") // 5200000000000000n
61
+ */
62
+ static from(input: string | number | bigint, client?: LLMClient): Promise<SemanticBigInt>;
63
+ /**
64
+ * Check if two BigInts are semantically equivalent.
65
+ * Considers approximate values for very large numbers.
66
+ *
67
+ * @param other - BigInt to compare with
68
+ * @param options - Comparison options
69
+ * @returns Promise resolving to equivalence result with confidence
70
+ *
71
+ * @example
72
+ * const trillion = await SemanticBigInt.from("1 trillion");
73
+ * await trillion.semanticallyEquals(1000000000000n)
74
+ * // { equivalent: true, confidence: 1.0 }
75
+ */
76
+ semanticallyEquals(other: bigint | SemanticBigInt, options?: {
77
+ tolerance?: 'exact' | 'approximate';
78
+ }): Promise<SemanticEqualsResult>;
79
+ /**
80
+ * Validate if the BigInt is reasonable for a given domain.
81
+ *
82
+ * @param domain - Domain context (e.g., "database-id", "cryptocurrency-amount")
83
+ * @returns Promise resolving to validation result with explanation
84
+ *
85
+ * @example
86
+ * const negative = SemanticBigInt.fromBigInt(-1n);
87
+ * await negative.isReasonable("database-id")
88
+ * // { reasonable: false, explanation: "Database IDs are typically positive" }
89
+ */
90
+ isReasonable(domain: string): Promise<ReasonableResult>;
91
+ /**
92
+ * Format the BigInt in a human-readable way.
93
+ *
94
+ * @param options - Formatting options
95
+ * @returns Promise resolving to formatted string
96
+ *
97
+ * @example
98
+ * const big = SemanticBigInt.fromBigInt(1234567890123n);
99
+ * await big.format({ style: "words" }) // "1.23 trillion"
100
+ * await big.format({ style: "scientific" }) // "1.23 × 10^12"
101
+ */
102
+ format(options?: FormatOptions): Promise<string>;
103
+ /**
104
+ * Format with thousands separators (full style)
105
+ */
106
+ private formatFull;
107
+ /**
108
+ * Generate a human-readable explanation of this BigInt.
109
+ * Implements Explainable interface.
110
+ *
111
+ * @param context - Optional context for more relevant explanation
112
+ * @returns Promise resolving to human-readable explanation
113
+ *
114
+ * @example
115
+ * const big = SemanticBigInt.fromBigInt(1000000000000n);
116
+ * await big.explain() // "A 12-digit number in the trillions"
117
+ */
118
+ explain(context?: string): Promise<string>;
119
+ /**
120
+ * Get a human-friendly description of the magnitude.
121
+ *
122
+ * @param context - Optional context for more relevant comparison
123
+ * @returns Promise resolving to human-readable description with relatable comparisons
124
+ *
125
+ * @example
126
+ * const population = SemanticBigInt.fromBigInt(7900000000n);
127
+ * await population.describe("population")
128
+ * // "about 7.9 billion (roughly the world population)"
129
+ */
130
+ describe(context?: string): Promise<string>;
131
+ /**
132
+ * Infer what domain or type this BigInt likely represents.
133
+ *
134
+ * @returns Promise resolving to inferred domain with confidence
135
+ *
136
+ * @example
137
+ * const timestamp = SemanticBigInt.fromBigInt(1609459200000n);
138
+ * await timestamp.inferDomain()
139
+ * // { domain: "unix-timestamp-ms", confidence: 0.87 }
140
+ */
141
+ inferDomain(): Promise<InferDomainResult>;
142
+ /**
143
+ * Check if this BigInt matches common patterns.
144
+ * Uses local computation for efficiency when possible.
145
+ *
146
+ * @param pattern - Pattern to check
147
+ * @returns Promise resolving to whether the BigInt matches the pattern
148
+ *
149
+ * @example
150
+ * const power = SemanticBigInt.fromBigInt(1024n);
151
+ * await power.matches("power-of-two") // true
152
+ * const prime = SemanticBigInt.fromBigInt(13n);
153
+ * await prime.matches("prime") // true
154
+ */
155
+ matches(pattern: string): Promise<boolean>;
156
+ /**
157
+ * Check if value is a power of two (local computation)
158
+ */
159
+ private isPowerOfTwo;
160
+ /**
161
+ * Check if value is a perfect square (local computation)
162
+ */
163
+ private isPerfectSquare;
164
+ /**
165
+ * Check if value is prime (local computation for small numbers)
166
+ */
167
+ private isPrimeLocal;
168
+ /**
169
+ * Get the scale/order of magnitude.
170
+ *
171
+ * @returns Scale description with magnitude, name, and scientific notation
172
+ *
173
+ * @example
174
+ * const trillion = SemanticBigInt.fromBigInt(1000000000000n);
175
+ * trillion.scale()
176
+ * // { magnitude: 12, name: "trillion", scientificNotation: "10^12" }
177
+ */
178
+ scale(): ScaleResult;
179
+ /**
180
+ * Get the raw BigInt value.
181
+ *
182
+ * @returns The underlying BigInt
183
+ */
184
+ valueOf(): bigint;
185
+ /**
186
+ * Convert to string representation
187
+ */
188
+ toString(): string;
189
+ /**
190
+ * Convert to JSON representation
191
+ */
192
+ toJSON(): {
193
+ value: string;
194
+ scale: ScaleResult;
195
+ };
196
+ }
197
+ //# sourceMappingURL=bigint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../../../src/primitives/bigint/bigint.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * SemanticBigInt Module
3
+ * Exports all SemanticBigInt types and utilities
4
+ */
5
+ export { SemanticBigInt, type FormatStyle, type FormatOptions, type ScaleResult, type MatchPattern, } from './bigint.ts';
6
+ export type { SemanticEqualsResult, ReasonableResult, InferDomainResult, } from '../../shared/types.ts';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/bigint/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Prompts for SemanticBigInt LLM operations
3
+ * These prompts are used to interpret, analyze, and describe large integers
4
+ */
5
+ /**
6
+ * System prompt for BigInt interpretation and analysis tasks
7
+ */
8
+ export declare const BIGINT_SYSTEM_PROMPT = "You are a semantic BigInt interpreter. Your task is to analyze large integers, understand their context, and provide meaningful interpretations.\n\nYou must respond with valid JSON only, no additional text or explanation.\n\nGuidelines:\n- Interpret natural language representations of large numbers (billions, trillions, scientific notation)\n- Recognize common BigInt domains: timestamps, database IDs, cryptocurrency amounts, cryptographic values\n- Provide confidence scores from 0.0 to 1.0 based on clarity and certainty\n- Consider the magnitude and context when making domain inferences\n- Use appropriate scale names: thousand, million, billion, trillion, quadrillion, etc.";
9
+ /**
10
+ * Prompt template for parsing natural language to BigInt
11
+ */
12
+ export declare function createFromPrompt(input: string): string;
13
+ /**
14
+ * Prompt template for semantic equality comparison
15
+ */
16
+ export declare function createSemanticallyEqualsPrompt(value1: string, value2: string, tolerance: 'exact' | 'approximate'): string;
17
+ /**
18
+ * Prompt template for domain reasonableness validation
19
+ */
20
+ export declare function createIsReasonablePrompt(value: string, domain: string): string;
21
+ /**
22
+ * Prompt template for human-readable formatting
23
+ */
24
+ export declare function createFormatPrompt(value: string, style: 'words' | 'compact' | 'scientific' | 'full', locale?: string): string;
25
+ /**
26
+ * Prompt template for describing magnitude with context
27
+ */
28
+ export declare function createDescribePrompt(value: string, context?: string): string;
29
+ /**
30
+ * Prompt template for domain inference
31
+ */
32
+ export declare function createInferDomainPrompt(value: string): string;
33
+ /**
34
+ * Prompt template for pattern matching
35
+ */
36
+ export declare function createMatchesPatternPrompt(value: string, pattern: string): string;
37
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/primitives/bigint/prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,8qBASsD,CAAC;AAExF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgBtD;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,OAAO,GAAG,aAAa,GACjC,MAAM,CAcR;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,MAAM,CAoBR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,EAClD,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CAiBR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAeR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAoB7D;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GACd,MAAM,CAsBR"}