@revealui/ai 0.10.0 → 1.0.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 (58) hide show
  1. package/README.md +10 -10
  2. package/dist/client/hooks/useAgentStream.d.ts +2 -0
  3. package/dist/client/hooks/useAgentStream.d.ts.map +1 -1
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -0
  7. package/dist/llm/artifact-provenance.d.ts +73 -0
  8. package/dist/llm/artifact-provenance.d.ts.map +1 -0
  9. package/dist/llm/artifact-provenance.js +189 -0
  10. package/dist/llm/cache-utils.d.ts +0 -9
  11. package/dist/llm/cache-utils.d.ts.map +1 -1
  12. package/dist/llm/cache-utils.js +0 -17
  13. package/dist/llm/client.d.ts +16 -9
  14. package/dist/llm/client.d.ts.map +1 -1
  15. package/dist/llm/client.js +113 -61
  16. package/dist/llm/inference-route.d.ts +46 -0
  17. package/dist/llm/inference-route.d.ts.map +1 -0
  18. package/dist/llm/inference-route.js +154 -0
  19. package/dist/llm/local-ai-profile.d.ts.map +1 -1
  20. package/dist/llm/local-ai-profile.js +3 -3
  21. package/dist/llm/providers/groq.d.ts +1 -1
  22. package/dist/llm/providers/groq.d.ts.map +1 -1
  23. package/dist/llm/providers/groq.js +6 -3
  24. package/dist/llm/providers/inference-snaps.d.ts +6 -5
  25. package/dist/llm/providers/inference-snaps.d.ts.map +1 -1
  26. package/dist/llm/providers/inference-snaps.js +6 -5
  27. package/dist/llm/providers/ollama.d.ts +1 -1
  28. package/dist/llm/providers/ollama.d.ts.map +1 -1
  29. package/dist/llm/providers/ollama.js +3 -2
  30. package/dist/llm/providers/us-origin-snaps.d.ts +21 -11
  31. package/dist/llm/providers/us-origin-snaps.d.ts.map +1 -1
  32. package/dist/llm/providers/us-origin-snaps.js +23 -13
  33. package/dist/llm/resolve.d.ts.map +1 -1
  34. package/dist/llm/resolve.js +9 -2
  35. package/dist/llm/token-counter.d.ts.map +1 -1
  36. package/dist/llm/token-counter.js +4 -1
  37. package/dist/llm/tool-json-schema.d.ts +16 -0
  38. package/dist/llm/tool-json-schema.d.ts.map +1 -0
  39. package/dist/llm/tool-json-schema.js +64 -0
  40. package/dist/llm/workspace-provider-config.d.ts.map +1 -1
  41. package/dist/llm/workspace-provider-config.js +9 -2
  42. package/dist/orchestration/runtime.d.ts +3 -17
  43. package/dist/orchestration/runtime.d.ts.map +1 -1
  44. package/dist/orchestration/runtime.js +4 -15
  45. package/dist/orchestration/streaming-runtime.d.ts.map +1 -1
  46. package/dist/orchestration/streaming-runtime.js +2 -2
  47. package/dist/tools/admin/factory.d.ts +6 -0
  48. package/dist/tools/admin/factory.d.ts.map +1 -1
  49. package/dist/tools/admin/factory.js +6 -1
  50. package/dist/tools/admin/user-tools.js +2 -2
  51. package/dist/tools/mcp-adapter.d.ts +10 -94
  52. package/dist/tools/mcp-adapter.d.ts.map +1 -1
  53. package/dist/tools/mcp-adapter.js +10 -146
  54. package/dist/tools/mcp-sampling.d.ts +3 -3
  55. package/dist/tools/mcp-sampling.js +3 -3
  56. package/dist/tools/registry.d.ts.map +1 -1
  57. package/dist/tools/registry.js +2 -1
  58. package/package.json +29 -4
@@ -6,17 +6,18 @@
6
6
  *
7
7
  * Product hardline: US-origin snap models only (see us-origin-snaps.ts).
8
8
  * Allowlisted snaps (install these):
9
- * nemotron-3-nano - NVIDIA general + tools (default)
9
+ * gemma3 - Google general + vision (default; WSL-supported)
10
+ * gemma4 - Google general + vision + tools
11
+ * nemotron-3-nano - NVIDIA general + tools (heavy / capable hosts)
10
12
  * nemotron-3-nano-omni - NVIDIA multimodal
11
- * gemma3 / gemma4 - Google general + vision + tools
12
13
  *
13
14
  * Canonical also publishes non-US snaps (deepseek-r1, qwen-*, glm-*). Those
14
15
  * are rejected at construction unless REVEALUI_ALLOW_NON_US_MODELS=1.
15
16
  *
16
17
  * Install a model:
17
- * sudo snap install nemotron-3-nano
18
- * nemotron-3-nano set http.port=9090 # optional: change port
19
- * nemotron-3-nano status # shows base URL and available models
18
+ * sudo snap install gemma3
19
+ * gemma3 set http.port=9090 --assume-yes
20
+ * gemma3 status # shows base URL and available models
20
21
  *
21
22
  * Set env vars:
22
23
  * INFERENCE_SNAPS_BASE_URL=http://localhost:9090/v1
@@ -10,7 +10,7 @@ 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 gemma4:e2b - run `ollama pull gemma4:e2b` first */
13
+ /** Chat model. Defaults to DEFAULT_DAILY_OLLAMA_MODEL — run `ollama pull` first */
14
14
  model?: string;
15
15
  /** Embedding model. Defaults to nomic-embed-text - run `ollama pull nomic-embed-text` first */
16
16
  embedModel?: string;
@@ -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,EACP,oBAAoB,EACrB,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,YAAY,IAAI,oBA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,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"}
@@ -6,6 +6,7 @@
6
6
  * Install: https://ollama.com
7
7
  */
8
8
  import { OpenAICompatProvider } from './openai-compat.js';
9
+ import { DEFAULT_DAILY_OLLAMA_MODEL } from './us-origin-snaps.js';
9
10
  export class OllamaProvider {
10
11
  inner;
11
12
  embedModel;
@@ -19,11 +20,11 @@ export class OllamaProvider {
19
20
  // Ollama ignores the API key but the OpenAI client requires a non-empty value
20
21
  apiKey: config.apiKey ?? 'ollama',
21
22
  baseURL,
22
- model: config.model ?? 'gemma4:e2b',
23
+ model: config.model ?? DEFAULT_DAILY_OLLAMA_MODEL,
23
24
  });
24
25
  }
25
26
  capabilities() {
26
- // Profile for the default model (gemma4:e2b, text-only).
27
+ // Profile for the default daily Ollama model (text + tools; no vision).
27
28
  return {
28
29
  providerTag: 'ollama',
29
30
  tools: true,
@@ -7,7 +7,7 @@
7
7
  * Definition: open weights published by an organization whose ultimate parent
8
8
  * is incorporated in the United States. Packaging (Canonical snaps) is not origin.
9
9
  *
10
- * Allowlist today (Canonical catalog, 2026-07):
10
+ * Allowlist today (Canonical catalog, 2026-08):
11
11
  * - nemotron-3-nano / nemotron-3-nano-omni — NVIDIA
12
12
  * - gemma3 / gemma4 — Google (Alphabet)
13
13
  *
@@ -15,24 +15,29 @@
15
15
  * REVEALUI_ALLOW_NON_US_MODELS=1
16
16
  *
17
17
  * Companion ADR: .jv docs/decisions/2026-07-24-us-origin-inference-snaps.md
18
+ *
19
+ * Weight-file fetches (URL + sha256, pickle refuse) live in
20
+ * `../artifact-provenance.ts` (GAP-484). This module is snap-id origin only.
18
21
  */
19
22
  /**
20
23
  * Product install/list catalog (snap name + operator-facing description).
21
24
  * SSOT for harnesses InferenceService + Studio install UIs.
22
- * Order: product default first (nemotron for capable hosts; gemma preferred on low-RAM via profile daily).
25
+ * Order: product default first. Canonical marks only gemma3 as WSL-supported
26
+ * (https://documentation.ubuntu.com/inference-snaps/reference/snaps/).
27
+ * Nemotron stays allowlisted for capable hosts.
23
28
  */
24
29
  export declare const PRODUCT_INFERENCE_SNAP_CATALOG: readonly [{
25
- readonly id: "nemotron-3-nano";
26
- readonly description: "NVIDIA (US) — general + tools; product default on capable hosts";
27
- }, {
28
- readonly id: "nemotron-3-nano-omni";
29
- readonly description: "NVIDIA (US) — multimodal (text/image/video/audio in)";
30
+ readonly id: "gemma3";
31
+ readonly description: "Google (US) — product default; 270m fits 4GB WSL";
30
32
  }, {
31
33
  readonly id: "gemma4";
32
34
  readonly description: "Google (US) — general + vision + tools";
33
35
  }, {
34
- readonly id: "gemma3";
35
- readonly description: "Google (US) — general + vision; prefer 270m on low-RAM hosts";
36
+ readonly id: "nemotron-3-nano";
37
+ readonly description: "NVIDIA (US) — heavy / capable hosts (set LLM_MODEL=nemotron-3-nano)";
38
+ }, {
39
+ readonly id: "nemotron-3-nano-omni";
40
+ readonly description: "NVIDIA (US) — multimodal (text/image/video/audio in)";
36
41
  }];
37
42
  export type UsOriginInferenceSnapId = (typeof PRODUCT_INFERENCE_SNAP_CATALOG)[number]['id'];
38
43
  /** Snap model IDs permitted for product Inference Snaps usage. */
@@ -41,8 +46,13 @@ export declare const US_ORIGIN_INFERENCE_SNAP_IDS: readonly UsOriginInferenceSna
41
46
  export declare const DEFAULT_US_ORIGIN_INFERENCE_SNAP: UsOriginInferenceSnapId;
42
47
  /** Preferred snap on constrained hosts (profile `snaps` tier). */
43
48
  export declare const DEFAULT_LOW_RAM_INFERENCE_SNAP: UsOriginInferenceSnapId;
44
- /** Preferred Ollama model for profile `daily` tier (fits ~4GB WSL). */
45
- export declare const DEFAULT_DAILY_OLLAMA_MODEL = "gemma3:1b";
49
+ /**
50
+ * Preferred Ollama chat model for profile `daily` tier and bare Ollama defaults.
51
+ * ~1.9GB Q4; quality step up from 1.5b-class while still fitting ~4GB WSL with
52
+ * Studio + unload-after-request (`OLLAMA_KEEP_ALIVE=0`). One model at a time.
53
+ * Ollama accepts any GGUF; US-origin hardline remains Inference Snaps only.
54
+ */
55
+ export declare const DEFAULT_DAILY_OLLAMA_MODEL = "qwen2.5:3b";
46
56
  /** Operator escape env var. Never set in customer seed or CI green paths. */
47
57
  export declare const NON_US_MODELS_ESCAPE_ENV = "REVEALUI_ALLOW_NON_US_MODELS";
48
58
  export declare class NonUsOriginInferenceSnapError extends Error {
@@ -1 +1 @@
1
- {"version":3,"file":"us-origin-snaps.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/us-origin-snaps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;EAiBjC,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;AAE5F,kEAAkE;AAClE,eAAO,MAAM,4BAA4B,EAAE,SAAS,uBAAuB,EAClB,CAAC;AAE1D,gFAAgF;AAChF,eAAO,MAAM,gCAAgC,EAAE,uBAA2C,CAAC;AAE3F,kEAAkE;AAClE,eAAO,MAAM,8BAA8B,EAAE,uBAAkC,CAAC;AAEhF,uEAAuE;AACvE,eAAO,MAAM,0BAA0B,cAAc,CAAC;AAEtD,6EAA6E;AAC7E,eAAO,MAAM,wBAAwB,iCAAiC,CAAC;AAEvE,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,QAAQ,CAAC,IAAI,EAAG,8BAA8B,CAAU;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM;CAW5B;AAED,0DAA0D;AAC1D,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;;;;;;GA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6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAQhE;AAED,sDAAsD;AACtD,wBAAgB,0BAA0B,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAGxF;AAED,MAAM,WAAW,kCAAkC;IACjD,qFAAqF;IACrF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,CAAC,EAAE,kCAAkC,GAC3C,MAAM,CAcR"}
@@ -7,7 +7,7 @@
7
7
  * Definition: open weights published by an organization whose ultimate parent
8
8
  * is incorporated in the United States. Packaging (Canonical snaps) is not origin.
9
9
  *
10
- * Allowlist today (Canonical catalog, 2026-07):
10
+ * Allowlist today (Canonical catalog, 2026-08):
11
11
  * - nemotron-3-nano / nemotron-3-nano-omni — NVIDIA
12
12
  * - gemma3 / gemma4 — Google (Alphabet)
13
13
  *
@@ -15,38 +15,48 @@
15
15
  * REVEALUI_ALLOW_NON_US_MODELS=1
16
16
  *
17
17
  * Companion ADR: .jv docs/decisions/2026-07-24-us-origin-inference-snaps.md
18
+ *
19
+ * Weight-file fetches (URL + sha256, pickle refuse) live in
20
+ * `../artifact-provenance.ts` (GAP-484). This module is snap-id origin only.
18
21
  */
19
22
  /**
20
23
  * Product install/list catalog (snap name + operator-facing description).
21
24
  * SSOT for harnesses InferenceService + Studio install UIs.
22
- * Order: product default first (nemotron for capable hosts; gemma preferred on low-RAM via profile daily).
25
+ * Order: product default first. Canonical marks only gemma3 as WSL-supported
26
+ * (https://documentation.ubuntu.com/inference-snaps/reference/snaps/).
27
+ * Nemotron stays allowlisted for capable hosts.
23
28
  */
24
29
  export const PRODUCT_INFERENCE_SNAP_CATALOG = [
25
30
  {
26
- id: 'nemotron-3-nano',
27
- description: 'NVIDIA (US) — general + tools; product default on capable hosts',
28
- },
29
- {
30
- id: 'nemotron-3-nano-omni',
31
- description: 'NVIDIA (US) — multimodal (text/image/video/audio in)',
31
+ id: 'gemma3',
32
+ description: 'Google (US) — product default; 270m fits 4GB WSL',
32
33
  },
33
34
  {
34
35
  id: 'gemma4',
35
36
  description: 'Google (US) — general + vision + tools',
36
37
  },
37
38
  {
38
- id: 'gemma3',
39
- description: 'Google (US) — general + vision; prefer 270m on low-RAM hosts',
39
+ id: 'nemotron-3-nano',
40
+ description: 'NVIDIA (US) — heavy / capable hosts (set LLM_MODEL=nemotron-3-nano)',
41
+ },
42
+ {
43
+ id: 'nemotron-3-nano-omni',
44
+ description: 'NVIDIA (US) — multimodal (text/image/video/audio in)',
40
45
  },
41
46
  ];
42
47
  /** Snap model IDs permitted for product Inference Snaps usage. */
43
48
  export const US_ORIGIN_INFERENCE_SNAP_IDS = PRODUCT_INFERENCE_SNAP_CATALOG.map((entry) => entry.id);
44
49
  /** Default chat/embed model when none is specified (env factory / provider). */
45
- export const DEFAULT_US_ORIGIN_INFERENCE_SNAP = 'nemotron-3-nano';
50
+ export const DEFAULT_US_ORIGIN_INFERENCE_SNAP = 'gemma3';
46
51
  /** Preferred snap on constrained hosts (profile `snaps` tier). */
47
52
  export const DEFAULT_LOW_RAM_INFERENCE_SNAP = 'gemma3';
48
- /** Preferred Ollama model for profile `daily` tier (fits ~4GB WSL). */
49
- export const DEFAULT_DAILY_OLLAMA_MODEL = 'gemma3:1b';
53
+ /**
54
+ * Preferred Ollama chat model for profile `daily` tier and bare Ollama defaults.
55
+ * ~1.9GB Q4; quality step up from 1.5b-class while still fitting ~4GB WSL with
56
+ * Studio + unload-after-request (`OLLAMA_KEEP_ALIVE=0`). One model at a time.
57
+ * Ollama accepts any GGUF; US-origin hardline remains Inference Snaps only.
58
+ */
59
+ export const DEFAULT_DAILY_OLLAMA_MODEL = 'qwen2.5:3b';
50
60
  /** Operator escape env var. Never set in customer seed or CI green paths. */
51
61
  export const NON_US_MODELS_ESCAPE_ENV = 'REVEALUI_ALLOW_NON_US_MODELS';
52
62
  export class NonUsOriginInferenceSnapError extends Error {
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/llm/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAIL,SAAS,EAEV,MAAM,aAAa,CAAC;AAMrB;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAG,oBAAoB,CAAU;IAC9C,gDAAgD;IAChD,QAAQ,CAAC,YAAY,EAAG,oBAAoB,CAAU;gBAE1C,OAAO,SAAoD;CAIxE;AAED,qFAAqF;AACrF,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,oBAAoB,CAAC;IAC3B,YAAY,EAAE,oBAAoB,CAAC;CACpC;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,qBAAqB,GAAG,oBAAoB,CAOrF;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;CACzC;AAKD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAOpE;AAED;;;;;;;;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BAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,EAAE,EAAE,QAAQ,EACZ,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,SAAS,CAAC,CAsDpB"}
@@ -41,6 +41,7 @@ import { decryptApiKey } from '@revealui/db/crypto';
41
41
  import { siteCollaborators, sites, workspaceInferenceConfigs } from '@revealui/db/schema';
42
42
  import { and, eq } from 'drizzle-orm';
43
43
  import { createLLMClientForUser, createLLMClientFromEnv, isHostedViable, LLMClient, } from './client.js';
44
+ import { resolveInferenceRoute } from './inference-route.js';
44
45
  const resolverLogger = createLogger({ component: 'resolveLLMClientForRequest' });
45
46
  /** Emitted once per process when the hosted BYOK rollback lever is pulled. */
46
47
  let warnedBreakGlass = false;
@@ -199,11 +200,17 @@ async function resolveSiteInferenceClient(db, userId, workspaceId, hosted) {
199
200
  // and use the provider name as the placeholder key — matches the env
200
201
  // factory. Keyed providers decrypt server-side at dispatch time (§6.3).
201
202
  const apiKey = config.encryptedApiKey ? decryptApiKey(config.encryptedApiKey) : provider;
202
- return new LLMClient({
203
+ const route = resolveInferenceRoute({
203
204
  provider,
204
- apiKey,
205
205
  model: config.model ?? undefined,
206
206
  baseURL: config.baseURL ?? undefined,
207
+ groqCredentialAvailable: provider === 'groq',
208
+ });
209
+ return new LLMClient({
210
+ provider: route.provider,
211
+ apiKey,
212
+ model: route.model,
213
+ baseURL: route.baseURL,
207
214
  temperature: config.temperature ?? undefined,
208
215
  maxTokens: config.maxTokens ?? undefined,
209
216
  });
@@ -1 +1 @@
1
- {"version":3,"file":"token-counter.d.ts","sourceRoot":"","sources":["../../src/llm/token-counter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,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ead: 0 },
22
22
  'gpt-4o-mini': { input: 0.15, output: 0.6, cacheWrite: 0, cacheRead: 0 },
23
- // Groq (Qwen - Apache 2.0)
23
+ // Groq (current catalog + retained retired-id pricing for historical estimates)
24
+ 'openai/gpt-oss-120b': { input: 0.15, output: 0.6, cacheWrite: 0, cacheRead: 0 },
25
+ 'openai/gpt-oss-20b': { input: 0.1, output: 0.5, cacheWrite: 0, cacheRead: 0 },
24
26
  'qwen/qwen3-32b': { input: 0.59, output: 0.79, cacheWrite: 0, cacheRead: 0 },
25
27
  // Ollama (self-hosted - no cost)
28
+ 'qwen2.5:3b': { input: 0, output: 0, cacheWrite: 0, cacheRead: 0 },
26
29
  'gemma4:e2b': { input: 0, output: 0, cacheWrite: 0, cacheRead: 0 },
27
30
  'gemma4:e4b': { input: 0, output: 0, cacheWrite: 0, cacheRead: 0 },
28
31
  'gemma4:26b': { input: 0, output: 0, cacheWrite: 0, cacheRead: 0 },
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Convert a Zod tool-parameter schema into JSON Schema that OpenAI-compatible
3
+ * providers will accept.
4
+ *
5
+ * Zod v4 `z.string().email()` emits an ECMA-262 pattern with lookarounds.
6
+ * JSON Schema 2020-12 `pattern` / OpenAI / Groq reject lookarounds, so the
7
+ * entire tools[] payload 400s before the model runs (GAP-360 walk, create_user).
8
+ *
9
+ * `z.email()` already emits `{ format: "email" }`. This helper is the
10
+ * conversion chokepoint so every future `.email()` / lookaround pattern is
11
+ * rewritten here, not per-tool.
12
+ */
13
+ import { z } from 'zod/v4';
14
+ export declare function toolParametersToJsonSchema(parameters: z.ZodType): Record<string, unknown>;
15
+ export declare function sanitizeProviderToolSchema(value: unknown): Record<string, unknown>;
16
+ //# sourceMappingURL=tool-json-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-json-schema.d.ts","sourceRoot":"","sources":["../../src/llm/tool-json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAI3B,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzF;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMlF"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Convert a Zod tool-parameter schema into JSON Schema that OpenAI-compatible
3
+ * providers will accept.
4
+ *
5
+ * Zod v4 `z.string().email()` emits an ECMA-262 pattern with lookarounds.
6
+ * JSON Schema 2020-12 `pattern` / OpenAI / Groq reject lookarounds, so the
7
+ * entire tools[] payload 400s before the model runs (GAP-360 walk, create_user).
8
+ *
9
+ * `z.email()` already emits `{ format: "email" }`. This helper is the
10
+ * conversion chokepoint so every future `.email()` / lookaround pattern is
11
+ * rewritten here, not per-tool.
12
+ */
13
+ import { z } from 'zod/v4';
14
+ const LOOKAROUND_PATTERN = /\(\?<?[=!]/;
15
+ export function toolParametersToJsonSchema(parameters) {
16
+ return sanitizeProviderToolSchema(z.toJSONSchema(parameters));
17
+ }
18
+ export function sanitizeProviderToolSchema(value) {
19
+ const sanitized = sanitizeNode(value, undefined);
20
+ if (typeof sanitized !== 'object' || sanitized === null || Array.isArray(sanitized)) {
21
+ return { type: 'object', properties: {} };
22
+ }
23
+ return sanitized;
24
+ }
25
+ function sanitizeNode(value, parentKey) {
26
+ if (Array.isArray(value)) {
27
+ return value.map((entry) => sanitizeNode(entry, parentKey));
28
+ }
29
+ if (typeof value !== 'object' || value === null) {
30
+ return value;
31
+ }
32
+ const obj = { ...value };
33
+ for (const nestKey of ['$defs', 'definitions', 'properties']) {
34
+ const nested = obj[nestKey];
35
+ if (nested && typeof nested === 'object' && !Array.isArray(nested)) {
36
+ const next = {};
37
+ for (const [key, child] of Object.entries(nested)) {
38
+ next[key] = sanitizeNode(child, key);
39
+ }
40
+ obj[nestKey] = next;
41
+ }
42
+ }
43
+ for (const nestKey of ['items', 'additionalProperties', 'not']) {
44
+ if (obj[nestKey] !== undefined) {
45
+ obj[nestKey] = sanitizeNode(obj[nestKey], parentKey);
46
+ }
47
+ }
48
+ for (const nestKey of ['anyOf', 'oneOf', 'allOf']) {
49
+ if (Array.isArray(obj[nestKey])) {
50
+ obj[nestKey] = obj[nestKey].map((entry) => sanitizeNode(entry, parentKey));
51
+ }
52
+ }
53
+ if (typeof obj.pattern === 'string' && LOOKAROUND_PATTERN.test(obj.pattern)) {
54
+ const emailShaped = obj.format === 'email' ||
55
+ parentKey === 'email' ||
56
+ (typeof obj.description === 'string' && /email/i.test(obj.description));
57
+ const withoutPattern = Object.fromEntries(Object.entries(obj).filter(([key]) => key !== 'pattern'));
58
+ if (emailShaped) {
59
+ return { ...withoutPattern, format: 'email' };
60
+ }
61
+ return withoutPattern;
62
+ }
63
+ return obj;
64
+ }
@@ -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,4DAA4D;AAC5D,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;AAGpF,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;CAqB9E;AAED,4DAA4D;AAC5D,eAAO,MAAM,yBAAyB,2BAAkC,CAAC"}
@@ -5,6 +5,7 @@
5
5
  * Extends the existing createLLMClientForUser() BYOK pattern.
6
6
  */
7
7
  import { LLMClient } from './client.js';
8
+ import { resolveInferenceRoute } from './inference-route.js';
8
9
  /**
9
10
  * In-memory registry of workspace-level LLM provider overrides.
10
11
  * In production, these should be loaded from the database on startup
@@ -32,11 +33,17 @@ export class WorkspaceProviderRegistry {
32
33
  const config = this.configs.get(workspaceId);
33
34
  if (!config)
34
35
  return fallback;
35
- const clientConfig = {
36
+ const route = resolveInferenceRoute({
36
37
  provider: config.provider,
37
- apiKey: config.apiKey,
38
38
  model: config.model,
39
39
  baseURL: config.baseURL,
40
+ groqCredentialAvailable: config.provider === 'groq',
41
+ });
42
+ const clientConfig = {
43
+ provider: route.provider,
44
+ apiKey: config.apiKey,
45
+ model: route.model,
46
+ baseURL: route.baseURL,
40
47
  temperature: config.temperature,
41
48
  maxTokens: config.maxTokens,
42
49
  };
@@ -7,7 +7,7 @@ import type { LLMClient } from '../llm/client.js';
7
7
  import type { ReasoningEffort } from '../llm/providers/base.js';
8
8
  import type { AgentSkillProvider } from '../skills/integration/agent-skill-provider.js';
9
9
  import type { ApprovalCallback } from '../tools/base.js';
10
- import type { MCPToolSource, McpClientLike } from '../tools/mcp-adapter.js';
10
+ import { type McpClientLike } from '../tools/mcp-adapter.js';
11
11
  import type { McpToolCallEvent } from '../tools/mcp-events.js';
12
12
  import type { Agent, AgentResult, Task } from './agent.js';
13
13
  /**
@@ -30,20 +30,6 @@ export interface RuntimeConfig {
30
30
  * Defaults to 'off'. Trade cost for quality on complex tasks.
31
31
  */
32
32
  thinkingLevel?: ThinkingLevel;
33
- /**
34
- * Optional MCP Hypervisor (or any MCPToolSource). When provided, tools from
35
- * all healthy MCP servers are merged into the agent's tool set before each
36
- * task execution. Pass an MCPHypervisor from @revealui/mcp.
37
- *
38
- * @deprecated Prefer `mcpClients` (Stage 5.1a). The hypervisor path doesn't
39
- * expose the full MCP protocol surface (resources, prompts, sampling,
40
- * elicitation). Standard `McpClient` instances do.
41
- *
42
- * **Removal owner:** product AI runtime. **REMOVE-BY:** `@revealui/ai` 1.0.0
43
- * (with `MCPToolSource` / `discoverMCPTools`). Product agent-stream already
44
- * mounts via `createToolsFromMcpClient` only; this field is external-compat.
45
- */
46
- mcpToolSource?: MCPToolSource;
47
33
  /**
48
34
  * Optional set of standard MCP clients (Stage 5.1a). When provided, each
49
35
  * client's tools are listed and merged into the agent's tool set before
@@ -70,8 +56,8 @@ export interface RuntimeConfig {
70
56
  }>;
71
57
  /**
72
58
  * GAP-355 integrity audit for MCP tools discovered at run time.
73
- * Passed into `createToolsFromMcpClient` and `discoverMCPTools` so library
74
- * consumers (not only agent-stream) fail closed when a receipt cannot land.
59
+ * Passed into `createToolsFromMcpClient` so library consumers (not only
60
+ * agent-stream) fail closed when a receipt cannot land.
75
61
  */
76
62
  onToolAudit?: (event: McpToolCallEvent) => void | Promise<void>;
77
63
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/orchestration/runtime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAW,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,kBAAkB,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAM5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC;AAE5C,MAAM,WAAW,aAAa;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC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AAkB,CAAC;IACnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,gCAAgC,EAAE,SAAS,CAAC;IAC/D;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAED,qBAAa,YAAY;IACvB,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC;IAChC,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,cAAc,CAAgD;IACtE,OAAO,CAAC,cAAc,CAAS;gBAEnB,MAAM,GAAE,aAAkB;IA0BtC;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;YAqBzE,OAAO;IA6OrB;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAI7B;;OAEG;IACG,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAc9E;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B9B;;OAEG;IACH,SAAS,IAAI;QACX,cAAc,EAAE,OAAO,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;KACxB;CAOF"}
@@ -4,10 +4,10 @@
4
4
  * Executes agent tasks with tool execution, memory management, and error handling
5
5
  */
6
6
  import { registerCleanupHandler } from '@revealui/core/monitoring';
7
- import { z } from 'zod/v4';
8
7
  import { estimateCost } from '../llm/token-counter.js';
8
+ import { toolParametersToJsonSchema } from '../llm/tool-json-schema.js';
9
9
  import { ToolCallDeduplicator } from '../tools/deduplicator.js';
10
- import { createToolsFromMcpClient, discoverMCPTools, warnHypervisorMcpPathDeprecated, } from '../tools/mcp-adapter.js';
10
+ import { createToolsFromMcpClient } from '../tools/mcp-adapter.js';
11
11
  import { createWebSearchTool } from '../tools/web/duck-duck-go.js';
12
12
  export class AgentRuntime {
13
13
  config;
@@ -15,16 +15,12 @@ export class AgentRuntime {
15
15
  executingTasks = new Map();
16
16
  isShuttingDown = false;
17
17
  constructor(config = {}) {
18
- if (config.mcpToolSource) {
19
- warnHypervisorMcpPathDeprecated('AgentRuntime mcpToolSource');
20
- }
21
18
  this.config = {
22
19
  maxIterations: config.maxIterations ?? 10,
23
20
  timeout: config.timeout ?? 60000, // 60 seconds
24
21
  retryOnError: config.retryOnError ?? true,
25
22
  maxRetries: config.maxRetries ?? 3,
26
23
  enableCache: config.enableCache ?? true, // Enable by default for cost savings
27
- mcpToolSource: config.mcpToolSource,
28
24
  mcpClients: config.mcpClients,
29
25
  onToolAudit: config.onToolAudit,
30
26
  skillProvider: config.skillProvider,
@@ -64,16 +60,9 @@ export class AgentRuntime {
64
60
  let iterations = 0;
65
61
  let totalTokens = 0;
66
62
  let totalCostUsd = 0;
67
- // Merge MCP-discovered tools into the agent's tool set. Two paths:
68
- // - Standard `McpClient` instances (Stage 5.1a, preferred)
69
- // - `MCPToolSource` / hypervisor (legacy, deprecated but supported)
63
+ // Merge MCP-discovered tools into the agent's tool set via `McpClient`.
70
64
  const mcpTools = [];
71
65
  const onToolAudit = this.config.onToolAudit;
72
- if (this.config.mcpToolSource) {
73
- mcpTools.push(...discoverMCPTools(this.config.mcpToolSource, {
74
- ...(onToolAudit !== undefined ? { onToolAudit } : {}),
75
- }));
76
- }
77
66
  if (this.config.mcpClients && this.config.mcpClients.length > 0) {
78
67
  for (const { name, client } of this.config.mcpClients) {
79
68
  try {
@@ -139,7 +128,7 @@ export class AgentRuntime {
139
128
  function: {
140
129
  name: tool.name,
141
130
  description: tool.description,
142
- parameters: z.toJSONSchema(tool.parameters),
131
+ parameters: toolParametersToJsonSchema(tool.parameters),
143
132
  },
144
133
  })),
145
134
  cacheHint: this.config.enableCache,
@@ -1 +1 @@
1
- {"version":3,"file":"streaming-runtime.d.ts","sourceRoot":"","sources":["../../src/orchestration/streaming-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EACA,MAAM,GACN,iBAAiB,GACjB,kBAAkB,GAClB,OAAO,GACP,MAAM,GACN,cAAc,GACd,kBAAkB,GAClB,qBAAqB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE;QACT,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,uDAAuD;IACvD,WAAW,CAAC,EAAE;QACZ,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;QACzB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,qBAAa,qBAAsB,SAAQ,YAAY;gBACzC,MAAM,GAAE,aAAkB;IAItC;;;OAGG;IACI,UAAU,CACf,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,MAAM,CAAC,EAAE,WAAW,GACnB,cAAc,CAAC,gBAAgB,CAAC;CAsLpC"}
1
+ {"version":3,"file":"streaming-runtime.d.ts","sourceRoot":"","sources":["../../src/orchestration/streaming-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EACA,MAAM,GACN,iBAAiB,GACjB,kBAAkB,GAClB,OAAO,GACP,MAAM,GACN,cAAc,GACd,kBAAkB,GAClB,qBAAqB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE;QACT,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,uDAAuD;IACvD,WAAW,CAAC,EAAE;QACZ,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;QACzB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,qBAAa,qBAAsB,SAAQ,YAAY;gBACzC,MAAM,GAAE,aAAkB;IAItC;;;OAGG;IACI,UAAU,CACf,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,MAAM,CAAC,EAAE,WAAW,GACnB,cAAc,CAAC,gBAAgB,CAAC;CAsLpC"}
@@ -7,8 +7,8 @@
7
7
  * AnythingLLM lesson: SSE is the correct approach for unidirectional LLM output.
8
8
  * EventSource is not used client-side because it doesn't support POST - use fetch + ReadableStream.
9
9
  */
10
- import { z } from 'zod/v4';
11
10
  import { compressToolResult } from '../inference/tool-result-compressor.js';
11
+ import { toolParametersToJsonSchema } from '../llm/tool-json-schema.js';
12
12
  import { ToolCallDeduplicator } from '../tools/deduplicator.js';
13
13
  import { AgentRuntime } from './runtime.js';
14
14
  export class StreamingAgentRuntime extends AgentRuntime {
@@ -64,7 +64,7 @@ export class StreamingAgentRuntime extends AgentRuntime {
64
64
  function: {
65
65
  name: tool.name,
66
66
  description: tool.description,
67
- parameters: z.toJSONSchema(tool.parameters),
67
+ parameters: toolParametersToJsonSchema(tool.parameters),
68
68
  },
69
69
  })),
70
70
  })) {
@@ -86,6 +86,12 @@ export interface AdminToolsConfig {
86
86
  * successful results fail closed if the audit write throws.
87
87
  */
88
88
  onToolAudit?: ToolIntegrityAuditHandler;
89
+ /**
90
+ * When set, only these tool names are returned. Built-in agents (ticket,
91
+ * creator) pass a profile so Watch live does not ship create_user to Groq
92
+ * for a "list tickets" run.
93
+ */
94
+ include?: readonly string[];
89
95
  }
90
96
  /**
91
97
  * Create admin tools with API client injected
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/tools/admin/factory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAyB/B;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC;QACV,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IAEH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3D,MAAM,CAAC,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzF,MAAM,CAAC,OAAO,EAAE;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAErB,MAAM,CAAC,OAAO,EAAE;QAAE,U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,10 @@ export function createAdminTools(config) {
459
459
  }
460
460
  },
461
461
  });
462
- return maybeWrapToolsWithIntegrityAudit(tools, onToolAudit);
462
+ const wrapped = maybeWrapToolsWithIntegrityAudit(tools, onToolAudit);
463
+ if (!config.include) {
464
+ return wrapped;
465
+ }
466
+ const allowed = new Set(config.include);
467
+ return wrapped.filter((tool) => allowed.has(tool.name));
463
468
  }
@@ -59,7 +59,7 @@ export const createUserTool = {
59
59
  name: 'create_user',
60
60
  description: 'Create a new user account. Typically requires admin permissions.',
61
61
  parameters: z.object({
62
- email: z.string().email().describe('User email address'),
62
+ email: z.email().describe('User email address'),
63
63
  password: z.string().min(8).describe('User password (minimum 8 characters)'),
64
64
  name: z.string().optional().describe('User full name'),
65
65
  role: z
@@ -90,7 +90,7 @@ export const updateUserTool = {
90
90
  description: 'Update a user account. Users can update their own account, admins can update any.',
91
91
  parameters: z.object({
92
92
  id: z.string().describe('User ID to update'),
93
- email: z.string().email().optional().describe('New email address'),
93
+ email: z.email().optional().describe('New email address'),
94
94
  name: z.string().optional().describe('New full name'),
95
95
  role: z.string().optional().describe('New role (admin only)'),
96
96
  password: z.string().min(8).optional().describe('New password'),