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,270 @@
1
+ /**
2
+ * SemanticURL - LLM-enhanced URL type with semantic understanding
3
+ *
4
+ * Extends the native JavaScript URL with semantic operations including:
5
+ * - Intelligent URL parsing and normalization
6
+ * - Context-aware equality comparison
7
+ * - URL classification by type and purpose
8
+ * - Purpose-based validation
9
+ * - Safety assessment
10
+ * - Related URL suggestions
11
+ *
12
+ * Implements shared interfaces:
13
+ * - Semantic<URL> - Base semantic wrapper
14
+ * - Comparable<URL | string> - Semantic equality comparison
15
+ * - Classifiable - URL type classification
16
+ * - Explainable - Human-readable explanations
17
+ */
18
+ import type { LLMConfig, Message } from '../../llm/types.ts';
19
+ import type { SemanticEqualsResult, ClassifyResult, SafetyResult, RelatedSuggestion } from '../../shared/types.ts';
20
+ import type { Semantic, Comparable, Classifiable, Explainable } from '../../shared/interfaces.ts';
21
+ export type { SemanticEqualsResult, ClassifyResult, SafetyResult, RelatedSuggestion, } from '../../shared/types.ts';
22
+ /** Extended semantic equals result with differences list */
23
+ export interface URLSemanticEqualsResult extends SemanticEqualsResult {
24
+ differences: string[];
25
+ }
26
+ /** Extended classify result for URLs */
27
+ export interface URLClassifyResult extends ClassifyResult {
28
+ type: string;
29
+ resource?: string;
30
+ action?: string;
31
+ }
32
+ /** Validation result for purpose-based validation */
33
+ export interface URLValidateForResult {
34
+ valid: boolean;
35
+ reason?: string;
36
+ warnings: string[];
37
+ }
38
+ /** Result of query parameter parsing */
39
+ export interface ParsedQueryParam {
40
+ value: string;
41
+ meaning: string;
42
+ }
43
+ /** LLM client interface for dependency injection */
44
+ export interface URLLLMClientInterface {
45
+ chat(options: {
46
+ messages: Message[];
47
+ systemPrompt?: string;
48
+ } & LLMConfig): Promise<{
49
+ content: string;
50
+ }>;
51
+ }
52
+ /**
53
+ * SemanticURL class
54
+ * Wraps a URL value with LLM-powered semantic operations
55
+ *
56
+ * Implements:
57
+ * - Semantic<URL> - valueOf() returns the URL value
58
+ * - Comparable<URL | string> - semanticallyEquals() for comparison
59
+ * - Classifiable - classify() for URL type classification
60
+ * - Explainable - explain() for human-readable explanations
61
+ *
62
+ * Also provides (as async methods):
63
+ * - validateFor() for purpose-based validation
64
+ * - isSafe() for safety checks
65
+ * - suggestRelated() for related URL suggestions
66
+ */
67
+ export declare class SemanticURL implements Semantic<URL>, Comparable<URL | string, URLSemanticEqualsResult>, Classifiable<URLClassifyResult>, Explainable {
68
+ private readonly _value;
69
+ private readonly _llmClient;
70
+ private readonly _llmConfig?;
71
+ /**
72
+ * Create a SemanticURL instance
73
+ * @param value - The URL value to wrap
74
+ * @param llmClient - Optional LLM client for dependency injection (useful for testing)
75
+ * @param llmConfig - Optional LLM configuration
76
+ */
77
+ constructor(value: URL, llmClient?: URLLLMClientInterface, llmConfig?: LLMConfig);
78
+ /**
79
+ * Create a SemanticURL from a string, handling various formats.
80
+ *
81
+ * @param input - URL string, potentially incomplete or malformed
82
+ * @param base - Optional base URL
83
+ * @param llmClient - Optional LLM client for dependency injection
84
+ * @param llmConfig - Optional LLM configuration
85
+ * @returns SemanticURL instance
86
+ *
87
+ * @example
88
+ * SemanticURL.from("example.com") // Adds https://
89
+ * SemanticURL.from("/path", "https://example.com")
90
+ */
91
+ static from(input: string, base?: string, llmClient?: URLLLMClientInterface, llmConfig?: LLMConfig): SemanticURL;
92
+ /**
93
+ * Check if two URLs are semantically equivalent.
94
+ * Considers trailing slashes, default ports, www prefix, etc.
95
+ *
96
+ * @param other - URL to compare
97
+ * @returns Equivalence result with differences
98
+ *
99
+ * @example
100
+ * url.semanticallyEquals("https://www.example.com/")
101
+ * // { equivalent: true, differences: ["www prefix", "trailing slash"], confidence: 0.95 }
102
+ */
103
+ semanticallyEquals(other: string | URL, _options?: Record<string, unknown>): Promise<URLSemanticEqualsResult>;
104
+ /**
105
+ * Classify the URL by type and purpose.
106
+ *
107
+ * @returns URL classification
108
+ *
109
+ * @example
110
+ * url.classify()
111
+ * // { type: "api-endpoint", category: "rest-api", resource: "users", action: "list", confidence: 0.9 }
112
+ */
113
+ classify(): Promise<URLClassifyResult>;
114
+ /**
115
+ * Validate the URL for a specific purpose.
116
+ *
117
+ * @param purpose - Intended purpose of the URL
118
+ * @returns Validation result
119
+ *
120
+ * @example
121
+ * url.validateFor("public website")
122
+ * // { valid: true, warnings: ["Uses HTTP instead of HTTPS"] }
123
+ */
124
+ validateFor(purpose: string): Promise<URLValidateForResult>;
125
+ /**
126
+ * Explain what this URL points to.
127
+ *
128
+ * @param _context - Optional context for explanation (unused, for interface compatibility)
129
+ * @returns Human-readable description
130
+ *
131
+ * @example
132
+ * SemanticURL.from("https://api.github.com/users/octocat").explain()
133
+ * // "GitHub API endpoint to fetch the user profile for 'octocat'"
134
+ */
135
+ explain(_context?: string): Promise<string>;
136
+ /**
137
+ * Extract semantic information from URL components.
138
+ *
139
+ * @returns Extracted information
140
+ *
141
+ * @example
142
+ * url.extractInfo()
143
+ * // { service: "GitHub", resourceType: "user-profile", identifier: "octocat" }
144
+ */
145
+ extractInfo(): Promise<Record<string, string | undefined>>;
146
+ /**
147
+ * Check if the URL is safe to visit/request.
148
+ *
149
+ * @param _context - Optional context (unused, for interface compatibility)
150
+ * @returns Safety assessment
151
+ *
152
+ * @example
153
+ * url.isSafe()
154
+ * // { safe: false, reason: "Known phishing domain", severity: "high" }
155
+ */
156
+ isSafe(_context?: string): Promise<SafetyResult>;
157
+ /**
158
+ * Suggest the canonical form of this URL.
159
+ *
160
+ * @returns Canonical URL
161
+ *
162
+ * @example
163
+ * SemanticURL.from("HTTP://EXAMPLE.COM:80/path/").canonical()
164
+ * // SemanticURL for "https://example.com/path"
165
+ */
166
+ canonical(): Promise<SemanticURL>;
167
+ /**
168
+ * Generate variations of this URL.
169
+ *
170
+ * @returns URL variations
171
+ *
172
+ * @example
173
+ * url.variations()
174
+ * // ["https://example.com", "https://www.example.com", "http://example.com"]
175
+ */
176
+ variations(): Promise<string[]>;
177
+ /**
178
+ * Parse query parameters with semantic understanding.
179
+ *
180
+ * @returns Parsed parameters with meanings
181
+ *
182
+ * @example
183
+ * SemanticURL.from("https://api.example.com/search?q=test&limit=10").parseQuery()
184
+ * // { q: { value: "test", meaning: "search query" }, limit: { value: "10", meaning: "results limit" } }
185
+ */
186
+ parseQuery(): Promise<Record<string, ParsedQueryParam>>;
187
+ /**
188
+ * Suggest related URLs based on patterns.
189
+ *
190
+ * @returns Related URLs
191
+ *
192
+ * @example
193
+ * url.suggestRelated()
194
+ * // [{ url: "/users/octocat/repos", reason: "User's repositories" }]
195
+ */
196
+ suggestRelated(): Promise<RelatedSuggestion[]>;
197
+ /**
198
+ * Check if URL matches a pattern description.
199
+ *
200
+ * @param pattern - Pattern description
201
+ * @returns Match result
202
+ *
203
+ * @example
204
+ * url.matches("API endpoint")
205
+ * url.matches("image URL")
206
+ */
207
+ matches(pattern: string): Promise<boolean>;
208
+ /**
209
+ * Get the raw URL value
210
+ * @returns The underlying URL
211
+ */
212
+ valueOf(): URL;
213
+ /**
214
+ * Get the full URL string
215
+ */
216
+ get href(): string;
217
+ /**
218
+ * Get the protocol (e.g., "https:")
219
+ */
220
+ get protocol(): string;
221
+ /**
222
+ * Get the hostname
223
+ */
224
+ get hostname(): string;
225
+ /**
226
+ * Get the host (hostname:port)
227
+ */
228
+ get host(): string;
229
+ /**
230
+ * Get the port
231
+ */
232
+ get port(): string;
233
+ /**
234
+ * Get the pathname
235
+ */
236
+ get pathname(): string;
237
+ /**
238
+ * Get the search string (query string including ?)
239
+ */
240
+ get search(): string;
241
+ /**
242
+ * Get the search params
243
+ */
244
+ get searchParams(): URLSearchParams;
245
+ /**
246
+ * Get the hash (fragment including #)
247
+ */
248
+ get hash(): string;
249
+ /**
250
+ * Get the origin
251
+ */
252
+ get origin(): string;
253
+ /**
254
+ * Get the username
255
+ */
256
+ get username(): string;
257
+ /**
258
+ * Get the password
259
+ */
260
+ get password(): string;
261
+ /**
262
+ * Convert to string
263
+ */
264
+ toString(): string;
265
+ /**
266
+ * Convert to JSON
267
+ */
268
+ toJSON(): string;
269
+ }
270
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/types/url/url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,WAAW,EACZ,MAAM,4BAA4B,CAAC;AA2BpC,YAAY,EACV,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,4DAA4D;AAC5D,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACnE,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AA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I,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,eAAe,CAElC;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,MAAM,IAAI,MAAM;CAGjB"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "semantic-primitives",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript library providing LLM-enhanced primitive types with built-in semantic understanding",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./llm": {
15
+ "types": "./dist/llm/index.d.ts",
16
+ "import": "./dist/llm/index.js"
17
+ },
18
+ "./primitives": {
19
+ "types": "./dist/primitives/index.d.ts",
20
+ "import": "./dist/primitives/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "build": "bun build ./src/index.ts --outdir ./dist --target node && bun run build:types",
28
+ "build:types": "tsc --emitDeclarationOnly --outDir dist",
29
+ "dev": "bun run --watch src/index.ts",
30
+ "test": "bun test",
31
+ "typecheck": "tsc --noEmit",
32
+ "lint": "eslint src/",
33
+ "lint:fix": "eslint src/ --fix",
34
+ "check": "bun run typecheck && bun run lint",
35
+ "clean": "rm -rf dist",
36
+ "prepublishOnly": "bun run clean && bun run check && bun run test && bun run build",
37
+ "version:patch": "npm version patch",
38
+ "version:minor": "npm version minor",
39
+ "version:major": "npm version major"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/elicollinson/semantic-primitives.git"
44
+ },
45
+ "homepage": "https://github.com/elicollinson/semantic-primitives#readme",
46
+ "bugs": {
47
+ "url": "https://github.com/elicollinson/semantic-primitives/issues"
48
+ },
49
+ "keywords": [
50
+ "llm",
51
+ "ai",
52
+ "semantic",
53
+ "primitives",
54
+ "typescript",
55
+ "openai",
56
+ "anthropic",
57
+ "google"
58
+ ],
59
+ "author": "Eli Collinson",
60
+ "license": "Apache-2.0",
61
+ "devDependencies": {
62
+ "@eslint/js": "^9.39.2",
63
+ "@types/bun": "latest",
64
+ "eslint": "^9.39.2",
65
+ "typescript": "^5",
66
+ "typescript-eslint": "^8.53.1"
67
+ },
68
+ "dependencies": {
69
+ "@anthropic-ai/sdk": "^0.71.2",
70
+ "@google/generative-ai": "^0.24.1",
71
+ "openai": "^6.16.0"
72
+ }
73
+ }