@revealui/ai 0.2.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/README.md +2 -2
  2. package/dist/a2a/card.d.ts +1 -1
  3. package/dist/a2a/card.d.ts.map +1 -1
  4. package/dist/a2a/card.js +4 -4
  5. package/dist/a2a/handler.d.ts +4 -4
  6. package/dist/a2a/handler.js +5 -5
  7. package/dist/a2a/index.d.ts +1 -1
  8. package/dist/a2a/index.js +1 -1
  9. package/dist/audit/emitter.d.ts +1 -1
  10. package/dist/audit/emitter.js +2 -2
  11. package/dist/audit/index.d.ts +2 -2
  12. package/dist/audit/index.js +2 -2
  13. package/dist/audit/store.d.ts +2 -2
  14. package/dist/audit/store.js +2 -2
  15. package/dist/client/errors.d.ts +13 -0
  16. package/dist/client/errors.d.ts.map +1 -0
  17. package/dist/client/errors.js +28 -0
  18. package/dist/client/hooks/useAgentContext.d.ts.map +1 -1
  19. package/dist/client/hooks/useAgentContext.js +6 -5
  20. package/dist/client/hooks/useAgentStream.d.ts +2 -2
  21. package/dist/client/hooks/useAgentStream.js +3 -3
  22. package/dist/client/hooks/useEpisodicMemory.d.ts.map +1 -1
  23. package/dist/client/hooks/useEpisodicMemory.js +6 -5
  24. package/dist/client/hooks/useWorkingMemory.d.ts.map +1 -1
  25. package/dist/client/hooks/useWorkingMemory.js +7 -6
  26. package/dist/embeddings/index.d.ts +1 -1
  27. package/dist/embeddings/index.js +4 -4
  28. package/dist/inference/context-budget.d.ts +1 -1
  29. package/dist/inference/context-budget.js +4 -4
  30. package/dist/inference/index.d.ts +1 -1
  31. package/dist/inference/index.js +1 -1
  32. package/dist/inference/runRag.d.ts +3 -3
  33. package/dist/inference/runRag.d.ts.map +1 -1
  34. package/dist/inference/runRag.js +1 -1
  35. package/dist/inference/task-decomposer.d.ts +1 -1
  36. package/dist/inference/task-decomposer.d.ts.map +1 -1
  37. package/dist/inference/task-decomposer.js +3 -3
  38. package/dist/inference/tool-result-compressor.d.ts +1 -1
  39. package/dist/inference/tool-result-compressor.js +1 -1
  40. package/dist/ingestion/{cms-indexer.d.ts → admin-indexer.d.ts} +12 -12
  41. package/dist/ingestion/admin-indexer.d.ts.map +1 -0
  42. package/dist/ingestion/{cms-indexer.js → admin-indexer.js} +10 -10
  43. package/dist/ingestion/bm25.d.ts +1 -1
  44. package/dist/ingestion/bm25.js +1 -1
  45. package/dist/ingestion/file-parsers.d.ts +1 -1
  46. package/dist/ingestion/file-parsers.d.ts.map +1 -1
  47. package/dist/ingestion/file-parsers.js +36 -17
  48. package/dist/ingestion/hybrid-search.d.ts +1 -1
  49. package/dist/ingestion/hybrid-search.js +1 -1
  50. package/dist/ingestion/index.d.ts +1 -1
  51. package/dist/ingestion/index.d.ts.map +1 -1
  52. package/dist/ingestion/index.js +1 -1
  53. package/dist/ingestion/pipeline.d.ts +1 -1
  54. package/dist/ingestion/pipeline.d.ts.map +1 -1
  55. package/dist/ingestion/rag-vector-service.d.ts +1 -1
  56. package/dist/ingestion/rag-vector-service.js +1 -1
  57. package/dist/ingestion/reranker.d.ts +1 -1
  58. package/dist/ingestion/reranker.js +1 -1
  59. package/dist/ingestion/text-splitter.d.ts +1 -1
  60. package/dist/ingestion/text-splitter.js +2 -2
  61. package/dist/llm/client.d.ts +7 -16
  62. package/dist/llm/client.d.ts.map +1 -1
  63. package/dist/llm/client.js +10 -70
  64. package/dist/llm/key-validator.d.ts +1 -1
  65. package/dist/llm/key-validator.js +8 -8
  66. package/dist/llm/providers/base.d.ts +2 -2
  67. package/dist/llm/providers/groq.d.ts +2 -2
  68. package/dist/llm/providers/groq.d.ts.map +1 -1
  69. package/dist/llm/providers/groq.js +2 -2
  70. package/dist/llm/providers/inference-snaps.d.ts +5 -5
  71. package/dist/llm/providers/inference-snaps.d.ts.map +1 -1
  72. package/dist/llm/providers/inference-snaps.js +4 -4
  73. package/dist/llm/providers/ollama.d.ts +2 -2
  74. package/dist/llm/providers/ollama.d.ts.map +1 -1
  75. package/dist/llm/providers/ollama.js +1 -1
  76. package/dist/llm/providers/openai-compat.d.ts +2 -2
  77. package/dist/llm/providers/openai-compat.js +5 -5
  78. package/dist/llm/providers/vultr.js +1 -1
  79. package/dist/llm/server.d.ts +0 -1
  80. package/dist/llm/server.d.ts.map +1 -1
  81. package/dist/llm/server.js +0 -1
  82. package/dist/llm/token-counter.d.ts.map +1 -1
  83. package/dist/llm/token-counter.js +11 -8
  84. package/dist/llm/workspace-provider-config.d.ts +1 -1
  85. package/dist/llm/workspace-provider-config.d.ts.map +1 -1
  86. package/dist/llm/workspace-provider-config.js +1 -1
  87. package/dist/memory/crdt/lww-register.js +1 -1
  88. package/dist/memory/crdt/or-set.d.ts +12 -0
  89. package/dist/memory/crdt/or-set.d.ts.map +1 -1
  90. package/dist/memory/crdt/or-set.js +27 -0
  91. package/dist/memory/index.d.ts +1 -0
  92. package/dist/memory/index.d.ts.map +1 -1
  93. package/dist/memory/index.js +1 -0
  94. package/dist/memory/persistence/crdt-persistence.d.ts +21 -1
  95. package/dist/memory/persistence/crdt-persistence.d.ts.map +1 -1
  96. package/dist/memory/persistence/crdt-persistence.js +67 -0
  97. package/dist/memory/preferences/user-preferences-manager.d.ts.map +1 -1
  98. package/dist/memory/preferences/user-preferences-manager.js +12 -2
  99. package/dist/memory/stores/episodic-memory.js +2 -2
  100. package/dist/memory/stores/working-memory.d.ts +7 -2
  101. package/dist/memory/stores/working-memory.d.ts.map +1 -1
  102. package/dist/memory/stores/working-memory.js +32 -18
  103. package/dist/memory/sync/index.d.ts +2 -0
  104. package/dist/memory/sync/index.d.ts.map +1 -0
  105. package/dist/memory/sync/index.js +1 -0
  106. package/dist/memory/sync/sync-manager.d.ts +104 -0
  107. package/dist/memory/sync/sync-manager.d.ts.map +1 -0
  108. package/dist/memory/sync/sync-manager.js +137 -0
  109. package/dist/memory/utils/index.d.ts +1 -2
  110. package/dist/memory/utils/index.d.ts.map +1 -1
  111. package/dist/memory/utils/index.js +1 -2
  112. package/dist/memory/utils/sql-helpers.d.ts +0 -39
  113. package/dist/memory/utils/sql-helpers.d.ts.map +1 -1
  114. package/dist/memory/utils/sql-helpers.js +0 -88
  115. package/dist/memory/utils/validation.js +1 -1
  116. package/dist/memory/vector/vector-memory-service.d.ts +1 -1
  117. package/dist/memory/vector/vector-memory-service.js +1 -1
  118. package/dist/orchestration/agent.d.ts +2 -2
  119. package/dist/orchestration/defaults.d.ts +1 -1
  120. package/dist/orchestration/defaults.js +1 -1
  121. package/dist/orchestration/orchestrator.d.ts +3 -3
  122. package/dist/orchestration/orchestrator.js +3 -3
  123. package/dist/orchestration/runtime.d.ts +1 -1
  124. package/dist/orchestration/runtime.js +1 -1
  125. package/dist/orchestration/streaming-runtime.d.ts +2 -2
  126. package/dist/orchestration/streaming-runtime.js +2 -2
  127. package/dist/orchestration/ticket-agent.d.ts +11 -11
  128. package/dist/orchestration/ticket-agent.d.ts.map +1 -1
  129. package/dist/orchestration/ticket-agent.js +10 -10
  130. package/dist/skills/catalog/vercel-catalog.d.ts.map +1 -1
  131. package/dist/skills/catalog/vercel-catalog.js +16 -7
  132. package/dist/skills/loader/github-loader.d.ts.map +1 -1
  133. package/dist/skills/loader/github-loader.js +2 -0
  134. package/dist/skills/loader/local-loader.js +1 -1
  135. package/dist/skills/loader/vercel-loader.d.ts.map +1 -1
  136. package/dist/skills/loader/vercel-loader.js +2 -0
  137. package/dist/skills/parser/skill-md-parser.js +2 -2
  138. package/dist/skills/registry/skill-registry.js +1 -1
  139. package/dist/templates/prompt-spec.js +1 -1
  140. package/dist/templates/skill-spec.js +1 -1
  141. package/dist/tools/{cms → admin}/collection-tools.d.ts +2 -2
  142. package/dist/tools/admin/collection-tools.d.ts.map +1 -0
  143. package/dist/tools/{cms → admin}/collection-tools.js +8 -8
  144. package/dist/tools/{cms → admin}/factory.d.ts +11 -11
  145. package/dist/tools/admin/factory.d.ts.map +1 -0
  146. package/dist/tools/{cms → admin}/factory.js +4 -4
  147. package/dist/tools/{cms → admin}/global-tools.d.ts +1 -1
  148. package/dist/tools/admin/global-tools.d.ts.map +1 -0
  149. package/dist/tools/{cms → admin}/global-tools.js +4 -4
  150. package/dist/tools/{cms → admin}/index.d.ts +4 -4
  151. package/dist/tools/admin/index.d.ts.map +1 -0
  152. package/dist/tools/{cms → admin}/index.js +3 -3
  153. package/dist/tools/{cms → admin}/media-tools.d.ts +1 -1
  154. package/dist/tools/admin/media-tools.d.ts.map +1 -0
  155. package/dist/tools/{cms → admin}/media-tools.js +4 -4
  156. package/dist/tools/{cms → admin}/user-tools.d.ts +1 -1
  157. package/dist/tools/admin/user-tools.d.ts.map +1 -0
  158. package/dist/tools/{cms → admin}/user-tools.js +1 -1
  159. package/dist/tools/coding/file-edit.d.ts +1 -1
  160. package/dist/tools/coding/file-edit.js +2 -2
  161. package/dist/tools/coding/file-glob.d.ts +1 -1
  162. package/dist/tools/coding/file-glob.d.ts.map +1 -1
  163. package/dist/tools/coding/file-glob.js +2 -1
  164. package/dist/tools/coding/file-grep.d.ts +1 -1
  165. package/dist/tools/coding/file-grep.d.ts.map +1 -1
  166. package/dist/tools/coding/file-grep.js +2 -1
  167. package/dist/tools/coding/file-read.d.ts +1 -1
  168. package/dist/tools/coding/file-read.d.ts.map +1 -1
  169. package/dist/tools/coding/file-read.js +15 -9
  170. package/dist/tools/coding/file-write.d.ts +1 -1
  171. package/dist/tools/coding/file-write.js +1 -1
  172. package/dist/tools/coding/git-ops.d.ts +1 -1
  173. package/dist/tools/coding/git-ops.d.ts.map +1 -1
  174. package/dist/tools/coding/git-ops.js +5 -7
  175. package/dist/tools/coding/index.d.ts +1 -1
  176. package/dist/tools/coding/index.d.ts.map +1 -1
  177. package/dist/tools/coding/lint-fix.d.ts +1 -1
  178. package/dist/tools/coding/lint-fix.d.ts.map +1 -1
  179. package/dist/tools/coding/lint-fix.js +8 -4
  180. package/dist/tools/coding/project-context.d.ts +1 -1
  181. package/dist/tools/coding/project-context.d.ts.map +1 -1
  182. package/dist/tools/coding/project-context.js +25 -24
  183. package/dist/tools/coding/safety.d.ts +1 -1
  184. package/dist/tools/coding/safety.d.ts.map +1 -1
  185. package/dist/tools/coding/shell-exec.d.ts +1 -1
  186. package/dist/tools/coding/shell-exec.js +1 -1
  187. package/dist/tools/coding/test-runner.d.ts +1 -1
  188. package/dist/tools/coding/test-runner.d.ts.map +1 -1
  189. package/dist/tools/coding/test-runner.js +12 -7
  190. package/dist/tools/deduplicator.js +1 -1
  191. package/dist/tools/document-summarizer.js +2 -2
  192. package/dist/tools/memory/store-memory.d.ts +1 -1
  193. package/dist/tools/memory/store-memory.js +2 -2
  194. package/dist/tools/ticket-tools.d.ts +2 -2
  195. package/dist/tools/ticket-tools.js +3 -3
  196. package/dist/tools/web/duck-duck-go.d.ts +3 -3
  197. package/dist/tools/web/duck-duck-go.js +4 -4
  198. package/dist/tools/web/exa.d.ts +1 -1
  199. package/dist/tools/web/exa.js +1 -1
  200. package/dist/tools/web/scraper.js +1 -1
  201. package/dist/tools/web/tavily.d.ts +2 -2
  202. package/dist/tools/web/tavily.js +2 -2
  203. package/dist/tools/web/types.d.ts +2 -2
  204. package/dist/tools/web/types.js +2 -2
  205. package/package.json +44 -15
  206. package/dist/ingestion/cms-indexer.d.ts.map +0 -1
  207. package/dist/llm/providers/bitnet.d.ts +0 -28
  208. package/dist/llm/providers/bitnet.d.ts.map +0 -1
  209. package/dist/llm/providers/bitnet.js +0 -36
  210. package/dist/tools/cms/collection-tools.d.ts.map +0 -1
  211. package/dist/tools/cms/factory.d.ts.map +0 -1
  212. package/dist/tools/cms/global-tools.d.ts.map +0 -1
  213. package/dist/tools/cms/index.d.ts.map +0 -1
  214. package/dist/tools/cms/media-tools.d.ts.map +0 -1
  215. package/dist/tools/cms/user-tools.d.ts.map +0 -1
@@ -3,46 +3,9 @@
3
3
  *
4
4
  * Single interface for all LLM providers with fallback and rate limiting
5
5
  */
6
- // =============================================================================
7
- // Log redaction
8
- // =============================================================================
9
- const SENSITIVE_KEYS = new Set([
10
- 'apiKey',
11
- 'api_key',
12
- 'authorization',
13
- 'Authorization',
14
- 'x-ai-api-key',
15
- 'X-AI-Api-Key',
16
- 'token',
17
- 'secret',
18
- 'password',
19
- 'encryptedKey',
20
- 'encrypted_key',
21
- ]);
22
- /**
23
- * Redact sensitive fields before passing an object to a logger.
24
- * Replaces API keys, tokens, and authorization headers with `[REDACTED]`.
25
- * Recurses into nested plain objects; leaves arrays and primitives as-is.
26
- */
27
- export function redactSensitiveFields(obj) {
28
- const result = {};
29
- for (const [key, value] of Object.entries(obj)) {
30
- if (SENSITIVE_KEYS.has(key)) {
31
- result[key] = '[REDACTED]';
32
- }
33
- else if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
34
- result[key] = redactSensitiveFields(value);
35
- }
36
- else {
37
- result[key] = value;
38
- }
39
- }
40
- return result;
41
- }
42
6
  import { decryptApiKey } from '@revealui/db/crypto';
43
7
  import { tenantProviderConfigs, userApiKeys } from '@revealui/db/schema';
44
8
  import { and, eq } from 'drizzle-orm';
45
- import { BitnetProvider } from './providers/bitnet.js';
46
9
  import { GroqProvider } from './providers/groq.js';
47
10
  import { InferenceSnapsProvider, } from './providers/inference-snaps.js';
48
11
  import { OllamaProvider } from './providers/ollama.js';
@@ -79,7 +42,7 @@ export class LLMClient {
79
42
  }
80
43
  // Wire health monitor if provided
81
44
  this.healthMonitor = config.healthMonitor;
82
- // Wire dedicated embed provider if supplied (e.g. Ollama when BitNet is primary)
45
+ // Wire dedicated embed provider if supplied
83
46
  this.embedProviderOverride = config.embedProvider;
84
47
  // Create primary provider
85
48
  this.provider = this.createProvider(config.provider, {
@@ -108,8 +71,6 @@ export class LLMClient {
108
71
  return new GroqProvider(config);
109
72
  case 'ollama':
110
73
  return new OllamaProvider(config);
111
- case 'bitnet':
112
- return new BitnetProvider(config);
113
74
  case 'inference-snaps':
114
75
  return new InferenceSnapsProvider(config);
115
76
  default:
@@ -273,7 +234,7 @@ export class LLMClient {
273
234
  if (!this.checkRateLimit()) {
274
235
  throw new Error('Rate limit exceeded');
275
236
  }
276
- // Use dedicated embed provider if one was configured (e.g. Ollama when BitNet is primary)
237
+ // Use dedicated embed provider if one was configured
277
238
  const embedProvider = this.embedProviderOverride ?? this.provider;
278
239
  try {
279
240
  this.recordRequest();
@@ -363,13 +324,13 @@ export class LLMClient {
363
324
  * Create an LLM client from environment variables.
364
325
  *
365
326
  * When LLM_PROVIDER is not set, auto-detects the provider by checking env vars
366
- * in priority order: INFERENCE_SNAPS → BITNET → GROQ → OLLAMA.
327
+ * in priority order: INFERENCE_SNAPS → GROQ → OLLAMA.
367
328
  *
368
329
  * All providers use OpenAI-compatible APIs. No proprietary provider SDKs.
369
330
  *
370
331
  * Provider defaults:
371
- * groq → llama-3.3-70b-versatile
372
- * ollama → llama3.2:3b
332
+ * groq → qwen/qwen3-32b
333
+ * ollama → gemma4:e2b
373
334
  */
374
335
  export function createLLMClientFromEnv() {
375
336
  // Auto-detect provider when LLM_PROVIDER is not explicitly set
@@ -380,9 +341,6 @@ export function createLLMClientFromEnv() {
380
341
  else if (process.env.INFERENCE_SNAPS_BASE_URL) {
381
342
  provider = 'inference-snaps';
382
343
  }
383
- else if (process.env.BITNET_BASE_URL) {
384
- provider = 'bitnet';
385
- }
386
344
  else if (process.env.GROQ_API_KEY) {
387
345
  provider = 'groq';
388
346
  }
@@ -390,9 +348,8 @@ export function createLLMClientFromEnv() {
390
348
  provider = 'ollama';
391
349
  }
392
350
  else {
393
- throw new Error('No LLM provider configured. Set one of: BITNET_BASE_URL (local BitNet), ' +
394
- 'INFERENCE_SNAPS_BASE_URL (local snap), GROQ_API_KEY (recommended cloud), ' +
395
- 'OLLAMA_BASE_URL (local Ollama). ' +
351
+ throw new Error('No LLM provider configured. Set one of: OLLAMA_BASE_URL (local Ollama), ' +
352
+ 'INFERENCE_SNAPS_BASE_URL (local snap), GROQ_API_KEY (cloud). ' +
396
353
  'Alternatively, set LLM_PROVIDER explicitly.');
397
354
  }
398
355
  let apiKey;
@@ -409,19 +366,14 @@ export function createLLMClientFromEnv() {
409
366
  else if (provider === 'groq') {
410
367
  apiKey = process.env.GROQ_API_KEY;
411
368
  baseURL = process.env.GROQ_BASE_URL;
412
- defaultModel = 'llama-3.3-70b-versatile';
369
+ defaultModel = 'qwen/qwen3-32b';
413
370
  }
414
371
  else if (provider === 'ollama') {
415
372
  apiKey = 'ollama'; // Ollama ignores the API key
416
373
  // Ollama's OpenAI-compatible endpoint lives at /v1
417
374
  const ollamaBase = process.env.OLLAMA_BASE_URL ?? 'http://localhost:11434';
418
375
  baseURL = ollamaBase.endsWith('/v1') ? ollamaBase : `${ollamaBase}/v1`;
419
- defaultModel = 'llama3.2:3b';
420
- }
421
- else if (provider === 'bitnet') {
422
- apiKey = 'bitnet'; // llama-server ignores the API key
423
- baseURL = process.env.BITNET_BASE_URL;
424
- defaultModel = 'bitnet-b1.58-2B-4T';
376
+ defaultModel = 'gemma4:e2b';
425
377
  }
426
378
  else if (provider === 'inference-snaps') {
427
379
  apiKey = 'inference-snaps'; // inference-snaps ignores the API key
@@ -430,18 +382,7 @@ export function createLLMClientFromEnv() {
430
382
  }
431
383
  if (!apiKey) {
432
384
  throw new Error(`API key not found for provider "${provider}". Set the corresponding env var ` +
433
- `(INFERENCE_SNAPS_BASE_URL, GROQ_API_KEY, OLLAMA_BASE_URL, ANTHROPIC_API_KEY, or OPENAI_API_KEY).`);
434
- }
435
- // When BitNet is the chat provider, auto-wire Ollama as the embed backend.
436
- // BitNet does not support /v1/embeddings; Ollama (nomic-embed-text) fills that role.
437
- // If OLLAMA_BASE_URL is not set, embed() will throw with a helpful message.
438
- let embedProvider;
439
- if (provider === 'bitnet' && process.env.OLLAMA_BASE_URL) {
440
- embedProvider = new OllamaProvider({
441
- apiKey: 'ollama',
442
- baseURL: process.env.OLLAMA_BASE_URL,
443
- embedModel: process.env.OLLAMA_EMBED_MODEL ?? 'nomic-embed-text',
444
- });
385
+ `(INFERENCE_SNAPS_BASE_URL, GROQ_API_KEY, OLLAMA_BASE_URL, VULTR_API_KEY, or HF_TOKEN).`);
445
386
  }
446
387
  return new LLMClient({
447
388
  provider,
@@ -455,7 +396,6 @@ export function createLLMClientFromEnv() {
455
396
  process.env.RESPONSE_CACHE_ENABLED === 'true',
456
397
  enableSemanticCache: process.env.LLM_ENABLE_SEMANTIC_CACHE === 'true' ||
457
398
  process.env.SEMANTIC_CACHE_ENABLED === 'true',
458
- embedProvider,
459
399
  });
460
400
  }
461
401
  /**
@@ -2,7 +2,7 @@
2
2
  * BYOK Provider Key Validator
3
3
  *
4
4
  * Validates API keys against their provider before storage.
5
- * Uses the cheapest available endpoint for each providertypically a
5
+ * Uses the cheapest available endpoint for each provider - typically a
6
6
  * models list (read-only, no token cost). Falls back gracefully when the
7
7
  * provider is unreachable so that network failures don't block key storage.
8
8
  */
@@ -2,7 +2,7 @@
2
2
  * BYOK Provider Key Validator
3
3
  *
4
4
  * Validates API keys against their provider before storage.
5
- * Uses the cheapest available endpoint for each providertypically a
5
+ * Uses the cheapest available endpoint for each provider - typically a
6
6
  * models list (read-only, no token cost). Falls back gracefully when the
7
7
  * provider is unreachable so that network failures don't block key storage.
8
8
  */
@@ -38,7 +38,7 @@ export async function validateProviderKey(provider, apiKey) {
38
38
  return { valid: true };
39
39
  if (res.status === 401)
40
40
  return { valid: false, error: 'Invalid Groq API key' };
41
- // Any other non-OK status (429, 500 etc.)treat as reachable but unknown
41
+ // Any other non-OK status (429, 500 etc.) - treat as reachable but unknown
42
42
  return { valid: false, error: `Groq validation failed: HTTP ${res.status}` };
43
43
  }
44
44
  case 'anthropic': {
@@ -50,7 +50,7 @@ export async function validateProviderKey(provider, apiKey) {
50
50
  return { valid: true };
51
51
  }
52
52
  case 'openai': {
53
- // Validate by formatkeys start with "sk-"
53
+ // Validate by format - keys start with "sk-"
54
54
  // (Per LLM policy, OpenAI API calls are blocked until we have revenue.)
55
55
  if (!apiKey.startsWith('sk-')) {
56
56
  return { valid: false, error: 'OpenAI API key must start with "sk-"' };
@@ -80,22 +80,22 @@ export async function validateProviderKey(provider, apiKey) {
80
80
  return { valid: false, error: `Vultr validation failed: HTTP ${res.status}` };
81
81
  }
82
82
  case 'ollama': {
83
- // Ollama is localwe cannot reliably probe it from the server.
83
+ // Ollama is local - we cannot reliably probe it from the server.
84
84
  // Accept the key as-is (Ollama doesn't use API keys anyway).
85
85
  return { valid: true };
86
86
  }
87
87
  default:
88
- // Unknown providerskip validation
88
+ // Unknown provider - skip validation
89
89
  return { valid: true };
90
90
  }
91
91
  }
92
92
  catch (err) {
93
- // Network error (AbortError, DNS failure, etc.)don't block storage
93
+ // Network error (AbortError, DNS failure, etc.) - don't block storage
94
94
  if (err instanceof Error && err.name === 'AbortError') {
95
- // Timeoutprovider unreachable, proceed with storage
95
+ // Timeout - provider unreachable, proceed with storage
96
96
  return { valid: true };
97
97
  }
98
- // Other network errors (ECONNREFUSED, etc.)proceed with storage
98
+ // Other network errors (ECONNREFUSED, etc.) - proceed with storage
99
99
  return { valid: true };
100
100
  }
101
101
  }
@@ -4,14 +4,14 @@
4
4
  * Abstract interface for all LLM providers (OpenAI, Anthropic, etc.)
5
5
  */
6
6
  /**
7
- * A plain text content partused in multipart messages.
7
+ * A plain text content part - used in multipart messages.
8
8
  */
9
9
  export interface TextPart {
10
10
  type: 'text';
11
11
  text: string;
12
12
  }
13
13
  /**
14
- * An image content partbase64 data URL or HTTPS URL.
14
+ * An image content part - base64 data URL or HTTPS URL.
15
15
  * Supported by OpenAI-compatible providers (inference-snaps, Ollama vision, GPT-4o).
16
16
  *
17
17
  * @example
@@ -2,7 +2,7 @@
2
2
  * Groq Provider
3
3
  *
4
4
  * Thin wrapper over OpenAIProvider using Groq's OpenAI-compatible API.
5
- * Free tier: 6,000 TPM / 500k TPD for Llama 3.3 70B.
5
+ * Free tier: 6,000 TPM / 500k TPD.
6
6
  * Sign up: console.groq.com
7
7
  */
8
8
  import type { Embedding, LLMChatOptions, LLMChunk, LLMEmbedOptions, LLMProvider, LLMProviderConfig, LLMResponse, LLMStreamOptions, Message } from './base.js';
@@ -10,7 +10,7 @@ export interface GroqProviderConfig extends Omit<LLMProviderConfig, 'apiKey'> {
10
10
  apiKey: string;
11
11
  /** Defaults to https://api.groq.com/openai/v1 */
12
12
  baseURL?: string;
13
- /** Defaults to llama-3.3-70b-versatile */
13
+ /** Defaults to qwen/qwen3-32b */
14
14
  model?: string;
15
15
  }
16
16
  export declare class GroqProvider implements LLMProvider {
@@ -1 +1 @@
1
- {"version":3,"file":"groq.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/groq.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,QAAQ,EACR,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,OAAO,EACR,MAAM,WAAW,CAAC;AAGnB,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,YAAa,YAAW,WAAW;IAC9C,OAAO,CAAC,KAAK,CAAuB;gBAExB,MAAM,EAAE,kBAAkB;IAQtC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;IAIzE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,aAAa,CAAC,QAAQ,CAAC;IAIhF,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,EAAE,CAAC;CAG9F"}
1
+ {"version":3,"file":"groq.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/groq.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,QAAQ,EACR,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,OAAO,EACR,MAAM,WAAW,CAAC;AAGnB,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,YAAa,YAAW,WAAW;IAC9C,OAAO,CAAC,KAAK,CAAuB;gBAExB,MAAM,EAAE,kBAAkB;IAQtC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;IAIzE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,aAAa,CAAC,QAAQ,CAAC;IAIhF,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,EAAE,CAAC;CAG9F"}
@@ -2,7 +2,7 @@
2
2
  * Groq Provider
3
3
  *
4
4
  * Thin wrapper over OpenAIProvider using Groq's OpenAI-compatible API.
5
- * Free tier: 6,000 TPM / 500k TPD for Llama 3.3 70B.
5
+ * Free tier: 6,000 TPM / 500k TPD.
6
6
  * Sign up: console.groq.com
7
7
  */
8
8
  import { OpenAICompatProvider } from './openai-compat.js';
@@ -12,7 +12,7 @@ export class GroqProvider {
12
12
  this.inner = new OpenAICompatProvider({
13
13
  ...config,
14
14
  baseURL: config.baseURL ?? 'https://api.groq.com/openai/v1',
15
- model: config.model ?? 'llama-3.3-70b-versatile',
15
+ model: config.model ?? 'qwen/qwen3-32b',
16
16
  });
17
17
  }
18
18
  chat(messages, options) {
@@ -5,10 +5,10 @@
5
5
  * No API key required. Zero cost, fully offline, hardware-optimized.
6
6
  *
7
7
  * Supported models (snaps):
8
- * gemma3general LLM + vision (text/image in, text out)
9
- * deepseek-r1reasoning LLM
10
- * qwen-vlvision-language model (image + text)
11
- * nemotron-nano general LLM (reasoning + non-reasoning)
8
+ * gemma3 - general LLM + vision (text/image in, text out)
9
+ * deepseek-r1 - reasoning LLM
10
+ * qwen-vl - vision-language model (image + text)
11
+ * nemotron-nano - general LLM (reasoning + non-reasoning)
12
12
  *
13
13
  * Install a model:
14
14
  * sudo snap install gemma3
@@ -27,7 +27,7 @@ export interface InferenceSnapsProviderConfig extends Omit<LLMProviderConfig, 'a
27
27
  apiKey?: string;
28
28
  /** Base URL of the inference-snaps service, e.g. http://localhost:9090/v1 */
29
29
  baseURL: string;
30
- /** Chat/vision model namemust match the snap's model ID (e.g. 'gemma3', 'deepseek-r1') */
30
+ /** Chat/vision model name - must match the snap's model ID (e.g. 'gemma3', 'deepseek-r1') */
31
31
  model?: string;
32
32
  /** Embedding model name. Defaults to the chat model when omitted. */
33
33
  embedModel?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"inference-snaps.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/inference-snaps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,QAAQ,EACR,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,OAAO,EACR,MAAM,WAAW,CAAC;AAGnB,MAAM,WAAW,4BAA6B,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IACrF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,6FAA6F;I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IAC3B,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,4BAA4B;IAahD,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;IAIzE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,aAAa,CAAC,QAAQ,CAAC;IAI1E,KAAK,CACT,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,eAAe,GACzB,OAAO,CAAC,SAAS,GAAG,SAAS,EAAE,CAAC;CAsBpC"}
@@ -5,10 +5,10 @@
5
5
  * No API key required. Zero cost, fully offline, hardware-optimized.
6
6
  *
7
7
  * Supported models (snaps):
8
- * gemma3general LLM + vision (text/image in, text out)
9
- * deepseek-r1reasoning LLM
10
- * qwen-vlvision-language model (image + text)
11
- * nemotron-nano general LLM (reasoning + non-reasoning)
8
+ * gemma3 - general LLM + vision (text/image in, text out)
9
+ * deepseek-r1 - reasoning LLM
10
+ * qwen-vl - vision-language model (image + text)
11
+ * nemotron-nano - general LLM (reasoning + non-reasoning)
12
12
  *
13
13
  * Install a model:
14
14
  * sudo snap install gemma3
@@ -10,9 +10,9 @@ export interface OllamaProviderConfig extends Omit<LLMProviderConfig, 'apiKey'>
10
10
  apiKey?: string;
11
11
  /** Defaults to http://localhost:11434/v1 */
12
12
  baseURL?: string;
13
- /** Chat model. Defaults to llama3.2:3b — run `ollama pull llama3.2:3b` first */
13
+ /** Chat model. Defaults to gemma4:e2b - run `ollama pull gemma4:e2b` first */
14
14
  model?: string;
15
- /** Embedding model. Defaults to nomic-embed-textrun `ollama pull nomic-embed-text` first */
15
+ /** Embedding model. Defaults to nomic-embed-text - run `ollama pull nomic-embed-text` first */
16
16
  embedModel?: string;
17
17
  }
18
18
  export declare class OllamaProvider implements LLMProvider {
@@ -1 +1 @@
1
- {"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/ollama.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,QAAQ,EACR,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,OAAO,EACR,MAAM,WAAW,CAAC;AAGnB,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+FAA+F;IAC/F,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,oBAAoB;IAaxC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;IAIzE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,aAAa,CAAC,QAAQ,CAAC;IAI1E,KAAK,CACT,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,eAAe,GACzB,OAAO,CAAC,SAAS,GAAG,SAAS,EAAE,CAAC;CAsBpC"}
1
+ {"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/ollama.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,QAAQ,EACR,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,OAAO,EACR,MAAM,WAAW,CAAC;AAGnB,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iGAAiG;IACjG,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,oBAAoB;IAaxC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC;IAIzE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,aAAa,CAAC,QAAQ,CAAC;IAI1E,KAAK,CACT,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,QAAQ,CAAC,EAAE,eAAe,GACzB,OAAO,CAAC,SAAS,GAAG,SAAS,EAAE,CAAC;CAsBpC"}
@@ -19,7 +19,7 @@ export class OllamaProvider {
19
19
  // Ollama ignores the API key but the OpenAI client requires a non-empty value
20
20
  apiKey: config.apiKey ?? 'ollama',
21
21
  baseURL,
22
- model: config.model ?? 'llama3.2:3b',
22
+ model: config.model ?? 'gemma4:e2b',
23
23
  });
24
24
  }
25
25
  chat(messages, options) {
@@ -2,8 +2,8 @@
2
2
  * OpenAI-Compatible Provider
3
3
  *
4
4
  * Base implementation for any LLM API that follows the OpenAI chat/completions
5
- * format. Used by: Ollama, Groq, Inference Snaps, BitNet, Vultr.
6
- * NOT for direct OpenAI usageRevealUI uses open-source models only.
5
+ * format. Used by: Ollama, Groq, Inference Snaps, Vultr.
6
+ * NOT for direct OpenAI usage - RevealUI uses open-source models only.
7
7
  */
8
8
  import type { Embedding, LLMChatOptions, LLMChunk, LLMEmbedOptions, LLMProvider, LLMProviderConfig, LLMResponse, LLMStreamOptions, Message } from './base.js';
9
9
  export interface OpenAICompatConfig extends LLMProviderConfig {
@@ -2,8 +2,8 @@
2
2
  * OpenAI-Compatible Provider
3
3
  *
4
4
  * Base implementation for any LLM API that follows the OpenAI chat/completions
5
- * format. Used by: Ollama, Groq, Inference Snaps, BitNet, Vultr.
6
- * NOT for direct OpenAI usageRevealUI uses open-source models only.
5
+ * format. Used by: Ollama, Groq, Inference Snaps, Vultr.
6
+ * NOT for direct OpenAI usage - RevealUI uses open-source models only.
7
7
  */
8
8
  const authorizationHeader = 'Authorization';
9
9
  const maxTokensKey = 'max_tokens';
@@ -34,7 +34,7 @@ export class OpenAICompatProvider {
34
34
  constructor(config) {
35
35
  this.config = config;
36
36
  if (!config.baseURL) {
37
- throw new Error('OpenAICompatProvider requires a baseURLuse a specific provider (InferenceSnapsProvider, BitNetProvider, OllamaProvider, etc.)');
37
+ throw new Error('OpenAICompatProvider requires a baseURL - use a specific provider (InferenceSnapsProvider, OllamaProvider, etc.)');
38
38
  }
39
39
  this.baseURL = config.baseURL;
40
40
  }
@@ -113,7 +113,7 @@ export class OpenAICompatProvider {
113
113
  'Content-Type': 'application/json',
114
114
  [authorizationHeader]: `Bearer ${this.config.apiKey}`,
115
115
  },
116
- // lgtm[js/file-access-to-http]embedding providers must send text to their API by design
116
+ // lgtm[js/file-access-to-http] - embedding providers must send text to their API by design
117
117
  body: JSON.stringify({
118
118
  model,
119
119
  input: texts,
@@ -220,7 +220,7 @@ export class OpenAICompatProvider {
220
220
  return messages.map((msg) => {
221
221
  const formatted = {
222
222
  role: msg.role,
223
- // Pass array content through as-isOpenAI-compatible APIs (including
223
+ // Pass array content through as-is - OpenAI-compatible APIs (including
224
224
  // inference-snaps vision models) accept the same multipart format natively.
225
225
  content: msg.content,
226
226
  };
@@ -81,7 +81,7 @@ export class VultrProvider {
81
81
  [contentTypeHeader]: 'application/json',
82
82
  [authorizationHeader]: `Bearer ${this.config.apiKey}`,
83
83
  },
84
- // lgtm[js/file-access-to-http]embedding providers must send text to their API by design
84
+ // lgtm[js/file-access-to-http] - embedding providers must send text to their API by design
85
85
  body: JSON.stringify({ model, input: inputs }),
86
86
  });
87
87
  if (!res.ok) {
@@ -6,7 +6,6 @@
6
6
  */
7
7
  export * from './client.js';
8
8
  export * from './providers/base.js';
9
- export * from './providers/bitnet.js';
10
9
  export * from './providers/groq.js';
11
10
  export * from './providers/inference-snaps.js';
12
11
  export * from './providers/ollama.js';
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/llm/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,aAAa,CAAC;AAG5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/llm/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,aAAa,CAAC;AAG5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC"}
@@ -8,7 +8,6 @@
8
8
  export * from './client.js';
9
9
  // Export provider implementations
10
10
  export * from './providers/base.js';
11
- export * from './providers/bitnet.js';
12
11
  export * from './providers/groq.js';
13
12
  export * from './providers/inference-snaps.js';
14
13
  export * from './providers/ollama.js';
@@ -1 +1 @@
1
- {"version":3,"file":"token-counter.d.ts","sourceRoot":"","sources":["../../src/llm/token-counter.ts"],"names":[],"mappings":"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,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC/B;AAiCD;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,gBAAgB,CAGxF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,gBAAgB,CAQjG;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,OAAO,GAAG,QAAQ,GAC5B,YAAY,CASd;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,MAAM,GACZ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,CAI9C"}
@@ -8,7 +8,7 @@
8
8
  * Limitation: actual token counts differ by model tokenizer. This is
9
9
  * accurate enough for budget tracking and context window management.
10
10
  */
11
- // Cost per 1M tokens (USD)input/output pricing
11
+ // Cost per 1M tokens (USD) - input/output pricing
12
12
  const MODEL_PRICING = {
13
13
  // Anthropic
14
14
  'claude-opus-4-6': { input: 15.0, output: 75.0 },
@@ -17,17 +17,20 @@ const MODEL_PRICING = {
17
17
  // OpenAI
18
18
  'gpt-4o': { input: 5.0, output: 15.0 },
19
19
  'gpt-4o-mini': { input: 0.15, output: 0.6 },
20
- // Groq (Llama)
21
- 'llama-3.3-70b-versatile': { input: 0.59, output: 0.79 },
22
- 'llama-3.1-8b-instant': { input: 0.05, output: 0.08 },
23
- // Ollama (self-hosted no cost)
24
- 'llama3.2:3b': { input: 0, output: 0 },
25
- 'llama3.2:1b': { input: 0, output: 0 },
20
+ // Groq (Qwen - Apache 2.0)
21
+ 'qwen/qwen3-32b': { input: 0.59, output: 0.79 },
22
+ // Ollama (self-hosted - no cost)
23
+ 'gemma4:e2b': { input: 0, output: 0 },
24
+ 'gemma4:e4b': { input: 0, output: 0 },
25
+ 'gemma4:26b': { input: 0, output: 0 },
26
26
  'nomic-embed-text': { input: 0, output: 0 },
27
27
  };
28
28
  function charsPerToken(model) {
29
29
  const lower = model.toLowerCase();
30
- if (lower.includes('ollama') || lower.includes('llama') || lower.includes('nomic')) {
30
+ if (lower.includes('ollama') ||
31
+ lower.includes('gemma') ||
32
+ lower.includes('nomic') ||
33
+ lower.includes('qwen')) {
31
34
  return 3.5;
32
35
  }
33
36
  return 4.0;
@@ -33,6 +33,6 @@ export declare class WorkspaceProviderRegistry {
33
33
  */
34
34
  createClientForWorkspace(workspaceId: string, fallback: LLMClient): LLMClient;
35
35
  }
36
- /** Singleton registryuse this in API route handlers */
36
+ /** Singleton registry - use this in API route handlers */
37
37
  export declare const workspaceProviderRegistry: WorkspaceProviderRegistry;
38
38
  //# sourceMappingURL=workspace-provider-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-provider-config.d.ts","sourceRoot":"","sources":["../../src/llm/workspace-provider-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAwB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEpF,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,OAAO,CAAmD;IAElE,GAAG,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI;IAI1C,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS;IAI7D,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;OAMG;IACH,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,SAAS;CAe9E;AAED,0DAA0D;AAC1D,eAAO,MAAM,yBAAyB,2BAAkC,CAAC"}
1
+ {"version":3,"file":"workspace-provider-config.d.ts","sourceRoot":"","sources":["../../src/llm/workspace-provider-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAwB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEpF,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,OAAO,CAAmD;IAElE,GAAG,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI;IAI1C,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS;IAI7D,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;OAMG;IACH,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,GAAG,SAAS;CAe9E;AAED,4DAA4D;AAC5D,eAAO,MAAM,yBAAyB,2BAAkC,CAAC"}
@@ -43,5 +43,5 @@ export class WorkspaceProviderRegistry {
43
43
  return new LLMClient(clientConfig);
44
44
  }
45
45
  }
46
- /** Singleton registryuse this in API route handlers */
46
+ /** Singleton registry - use this in API route handlers */
47
47
  export const workspaceProviderRegistry = new WorkspaceProviderRegistry();
@@ -26,7 +26,7 @@
26
26
  * ```
27
27
  */
28
28
  import { randomUUID } from 'node:crypto';
29
- import { deepClone } from '../utils/deep-clone.js';
29
+ import { deepClone } from '@revealui/core/utils/deep-clone';
30
30
  export class LWWRegister {
31
31
  value;
32
32
  timestamp;
@@ -104,6 +104,18 @@ export declare class ORSet<T> {
104
104
  * @returns A new merged ORSet
105
105
  */
106
106
  merge(other: ORSet<T>): ORSet<T>;
107
+ /**
108
+ * Removes tombstones - entries in `added` whose tag appears in `removed`.
109
+ * Reduces memory usage and serialization size. Safe to call after all peers
110
+ * have merged the corresponding remove operations.
111
+ *
112
+ * @returns Number of tombstones compacted
113
+ */
114
+ compact(): number;
115
+ /**
116
+ * Number of tombstones (removed tags still tracked).
117
+ */
118
+ get tombstoneCount(): number;
107
119
  /**
108
120
  * Clears all elements from the set.
109
121
  */
@@ -1 +1 @@
1
- {"version":3,"file":"or-set.d.ts","sourceRoot":"","sources":["../../../src/memory/crdt/or-set.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEtE,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC;IACT,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,eAAe,CAAC;CACxB;AAED,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,qBAAa,KAAK,CAAC,CAAC;IAClB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK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C;IAU7B;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAQjB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAkChC;;;;;;OAMG;IACH,OAAO,IAAI,MAAM;IAejB;;OAEG;IACH,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;IAOb;;;OAGG;IACH,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IAkBjB;;;OAGG;IACH,MAAM,IAAI,SAAS,CAAC,CAAC,CAAC;IAkBtB;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAiBhD;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC;IAI5B;;OAEG;IACH,OAAO,CAAC,UAAU;IAQlB;;OAEG;IACH,QAAQ,IAAI,MAAM;CAInB"}
@@ -198,6 +198,33 @@ export class ORSet {
198
198
  }
199
199
  return merged;
200
200
  }
201
+ /**
202
+ * Removes tombstones - entries in `added` whose tag appears in `removed`.
203
+ * Reduces memory usage and serialization size. Safe to call after all peers
204
+ * have merged the corresponding remove operations.
205
+ *
206
+ * @returns Number of tombstones compacted
207
+ */
208
+ compact() {
209
+ let count = 0;
210
+ for (const tag of this.removed) {
211
+ if (this.added.has(tag)) {
212
+ this.added.delete(tag);
213
+ count++;
214
+ }
215
+ }
216
+ // Clear the removed set - all tombstones have been applied
217
+ if (count > 0) {
218
+ this.removed.clear();
219
+ }
220
+ return count;
221
+ }
222
+ /**
223
+ * Number of tombstones (removed tags still tracked).
224
+ */
225
+ get tombstoneCount() {
226
+ return this.removed.size;
227
+ }
201
228
  /**
202
229
  * Clears all elements from the set.
203
230
  */
@@ -17,5 +17,6 @@ export * from './errors/index.js';
17
17
  export * from './persistence/index.js';
18
18
  export * from './preferences/index.js';
19
19
  export * from './services/index.js';
20
+ export * from './sync/index.js';
20
21
  export * from './vector/index.js';
21
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
@@ -17,4 +17,5 @@ export * from './errors/index.js';
17
17
  export * from './persistence/index.js';
18
18
  export * from './preferences/index.js';
19
19
  export * from './services/index.js';
20
+ export * from './sync/index.js';
20
21
  export * from './vector/index.js';