@voicethere/agent 0.16.0 → 0.18.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.
- package/README.md +122 -0
- package/dist/llm/agent/config.d.ts +122 -0
- package/dist/llm/agent/config.d.ts.map +1 -1
- package/dist/llm/agent/config.js +209 -0
- package/dist/llm/agent/config.js.map +1 -1
- package/dist/llm/agent/create-llm-agent.d.ts +12 -0
- package/dist/llm/agent/create-llm-agent.d.ts.map +1 -1
- package/dist/llm/agent/create-llm-agent.js +154 -2
- package/dist/llm/agent/create-llm-agent.js.map +1 -1
- package/dist/llm/agent/redact.d.ts +16 -0
- package/dist/llm/agent/redact.d.ts.map +1 -0
- package/dist/llm/agent/redact.js +154 -0
- package/dist/llm/agent/redact.js.map +1 -0
- package/dist/llm/agent/tool-call-log.d.ts +37 -0
- package/dist/llm/agent/tool-call-log.d.ts.map +1 -0
- package/dist/llm/agent/tool-call-log.js +74 -0
- package/dist/llm/agent/tool-call-log.js.map +1 -0
- package/dist/llm/bounded-embedder.d.ts +22 -0
- package/dist/llm/bounded-embedder.d.ts.map +1 -0
- package/dist/llm/bounded-embedder.js +150 -0
- package/dist/llm/bounded-embedder.js.map +1 -0
- package/dist/llm/gemini-provider.d.ts +8 -1
- package/dist/llm/gemini-provider.d.ts.map +1 -1
- package/dist/llm/gemini-provider.js +31 -0
- package/dist/llm/gemini-provider.js.map +1 -1
- package/dist/llm/gemini.d.ts +2 -2
- package/dist/llm/gemini.d.ts.map +1 -1
- package/dist/llm/gemini.js +3 -2
- package/dist/llm/gemini.js.map +1 -1
- package/dist/llm/index.d.ts +10 -4
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +4 -1
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/knowledge/chunk-markdown.d.ts +20 -0
- package/dist/llm/knowledge/chunk-markdown.d.ts.map +1 -0
- package/dist/llm/knowledge/chunk-markdown.js +90 -0
- package/dist/llm/knowledge/chunk-markdown.js.map +1 -0
- package/dist/llm/knowledge/index.d.ts +10 -0
- package/dist/llm/knowledge/index.d.ts.map +1 -0
- package/dist/llm/knowledge/index.js +6 -0
- package/dist/llm/knowledge/index.js.map +1 -0
- package/dist/llm/knowledge/redis-knowledge-base.d.ts +3 -0
- package/dist/llm/knowledge/redis-knowledge-base.d.ts.map +1 -0
- package/dist/llm/knowledge/redis-knowledge-base.js +498 -0
- package/dist/llm/knowledge/redis-knowledge-base.js.map +1 -0
- package/dist/llm/knowledge/search-knowledge-tool.d.ts +12 -0
- package/dist/llm/knowledge/search-knowledge-tool.d.ts.map +1 -0
- package/dist/llm/knowledge/search-knowledge-tool.js +44 -0
- package/dist/llm/knowledge/search-knowledge-tool.js.map +1 -0
- package/dist/llm/knowledge/supabase-knowledge-base.d.ts +35 -0
- package/dist/llm/knowledge/supabase-knowledge-base.d.ts.map +1 -0
- package/dist/llm/knowledge/supabase-knowledge-base.js +227 -0
- package/dist/llm/knowledge/supabase-knowledge-base.js.map +1 -0
- package/dist/llm/knowledge/types.d.ts +102 -0
- package/dist/llm/knowledge/types.d.ts.map +1 -0
- package/dist/llm/knowledge/types.js +9 -0
- package/dist/llm/knowledge/types.js.map +1 -0
- package/dist/llm/mcp/index.d.ts +1 -1
- package/dist/llm/mcp/index.d.ts.map +1 -1
- package/dist/llm/mcp/mcp-tool-source.d.ts +1 -1
- package/dist/llm/mcp/mcp-tool-source.d.ts.map +1 -1
- package/dist/llm/mcp/mcp-tool-source.js.map +1 -1
- package/dist/llm/mcp/tool-registry.d.ts +20 -0
- package/dist/llm/mcp/tool-registry.d.ts.map +1 -1
- package/dist/llm/mcp/tool-registry.js +76 -7
- package/dist/llm/mcp/tool-registry.js.map +1 -1
- package/dist/llm/openai-provider.d.ts +9 -1
- package/dist/llm/openai-provider.d.ts.map +1 -1
- package/dist/llm/openai-provider.js +36 -0
- package/dist/llm/openai-provider.js.map +1 -1
- package/dist/llm/openai.d.ts +2 -2
- package/dist/llm/openai.d.ts.map +1 -1
- package/dist/llm/openai.js +7 -2
- package/dist/llm/openai.js.map +1 -1
- package/dist/llm/providers.d.ts +5 -1
- package/dist/llm/providers.d.ts.map +1 -1
- package/dist/llm/providers.js +22 -0
- package/dist/llm/providers.js.map +1 -1
- package/dist/llm/types.d.ts +26 -1
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js.map +1 -1
- package/dist/templates/llm-agent/agent.js +12508 -213
- package/dist/templates/llm-mcp-service/agent.js +59459 -0
- package/dist/templates/registry.d.ts.map +1 -1
- package/dist/templates/registry.js +28 -0
- package/dist/templates/registry.js.map +1 -1
- package/eject/llm/loop.ts +214 -2
- package/package.json +2 -1
- package/schema/voicethere.llm.schema.json +108 -52
- package/templates/README.md +2 -0
- package/templates/llm-agent/README.md +11 -0
- package/templates/llm-agent/agent.ts +15 -1
- package/templates/llm-agent/knowledge/about.md +11 -0
- package/templates/llm-agent/voicethere.llm.json +10 -0
- package/templates/llm-mcp-service/README.md +112 -0
- package/templates/llm-mcp-service/agent.ts +31 -0
- package/templates/llm-mcp-service/hooks.ts +21 -0
- package/templates/llm-mcp-service/knowledge/about.md +11 -0
- package/templates/llm-mcp-service/md.d.ts +4 -0
- package/templates/llm-mcp-service/prompt.md +23 -0
- package/templates/llm-mcp-service/tools.ts +51 -0
- package/templates/llm-mcp-service/voicethere.llm.json +47 -0
package/README.md
CHANGED
|
@@ -424,6 +424,128 @@ Runners that do not advertise speak control (`isSpeakControlAvailable(ctx)` is `
|
|
|
424
424
|
|
|
425
425
|
`SessionSpeakController` implements the parent-side rules: speak results, cancellation, flushing queued speaks on barge-in, and the interruption report. It has no transport, so the VoiceThere runner and local tooling both drive it with the same code.
|
|
426
426
|
|
|
427
|
+
## Embeddings (`@voicethere/agent/llm`)
|
|
428
|
+
|
|
429
|
+
`createLlmEmbedder` returns an embedder for providers that publish an embeddings API: `openai`, `openrouter` and `gemini`. `anthropic` throws `LLM_EMBEDDINGS_UNSUPPORTED` (Anthropic has no embeddings API). Calls are bounded: 15 s per attempt, two retries on rate limits, 5xx and timeouts, 96 inputs per request. Returned vectors are L2-normalized (unit length) for every provider, so cosine similarity and inner product give the same ranking. Error messages never contain the input text.
|
|
430
|
+
|
|
431
|
+
```ts
|
|
432
|
+
import {
|
|
433
|
+
createLlmEmbedder,
|
|
434
|
+
DEFAULT_EMBEDDING_DIMS,
|
|
435
|
+
DEFAULT_EMBEDDING_MODEL,
|
|
436
|
+
} from "@voicethere/agent/llm";
|
|
437
|
+
import { openai } from "@voicethere/agent/llm/openai";
|
|
438
|
+
|
|
439
|
+
const embedder = createLlmEmbedder({ provider: "openai", apiKey }, [openai]);
|
|
440
|
+
const { vectors } = await embedder.embed({
|
|
441
|
+
model: DEFAULT_EMBEDDING_MODEL.openai,
|
|
442
|
+
inputs: ["hello"],
|
|
443
|
+
dimensions: DEFAULT_EMBEDDING_DIMS, // 512
|
|
444
|
+
});
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
## Knowledge base (RAG) on Project Redis (`@voicethere/agent/llm`)
|
|
448
|
+
|
|
449
|
+
`createRedisKnowledgeBase` indexes Markdown documents in the project's Redis (Redis 8 Query Engine, HNSW vector index, cosine) and returns the chunks closest to a question. It needs `ioredis` in your agent and an embedder from `createLlmEmbedder`. Redis 7 has no vector search: the call fails with `KB_REDIS_ERROR`.
|
|
450
|
+
|
|
451
|
+
```ts
|
|
452
|
+
import {
|
|
453
|
+
createLlmEmbedder,
|
|
454
|
+
createRedisKnowledgeBase,
|
|
455
|
+
DEFAULT_EMBEDDING_DIMS,
|
|
456
|
+
DEFAULT_EMBEDDING_MODEL,
|
|
457
|
+
} from "@voicethere/agent/llm";
|
|
458
|
+
import { openai } from "@voicethere/agent/llm/openai";
|
|
459
|
+
import pricing from "./knowledge/pricing.md";
|
|
460
|
+
|
|
461
|
+
const kb = createRedisKnowledgeBase({
|
|
462
|
+
redisUrl: process.env.AGENT_REDIS_URL,
|
|
463
|
+
documents: [{ id: "pricing.md", text: pricing }],
|
|
464
|
+
embedder: createLlmEmbedder({ provider: "openai", apiKey }, [openai]),
|
|
465
|
+
model: DEFAULT_EMBEDDING_MODEL.openai,
|
|
466
|
+
dims: DEFAULT_EMBEDDING_DIMS,
|
|
467
|
+
});
|
|
468
|
+
await kb.ensureIndexed(); // embeds only when the documents, model or dims changed
|
|
469
|
+
const hits = await kb.search("how much is the starter plan?", 4);
|
|
470
|
+
// [{ text, title: "Pricing › Plans", source: "pricing.md", score }]
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
- Documents are split on `#`..`###` headings into chunks of about 300 words with 50 words of overlap. The same content (documents, model, dimensions) is not embedded twice, also across workers: one worker builds, the others wait and report `built-by-other-worker`. Each content version has its own index (`kb:<namespace>:idx:<hash>`), so during a rolling deploy old and new workers each search their own version. Open knowledge bases keep their version alive with a heartbeat; an index whose workers stopped is dropped about 90 s later (`gc()` forces a pass).
|
|
474
|
+
- Vectors have no TTL, so `maxmemory-policy volatile-lru` never evicts them. The index refuses to grow past 80 % of `maxmemory` (`KB_MEMORY_LIMIT`). Plan on about 6.5 KB per 300-word chunk at 512 dimensions, which puts roughly 30,000 chunks in a 256 MB Project Redis (estimate; measured figures follow). Two versions side by side during a deploy both count.
|
|
475
|
+
- Use a namespace per knowledge set (`namespace` option). Keys are `kb:<namespace>:...`.
|
|
476
|
+
- Log lines carry the namespace, chunk count and durations, never chunk or query text.
|
|
477
|
+
|
|
478
|
+
### Config block and the `search_knowledge` tool
|
|
479
|
+
|
|
480
|
+
An LLM agent turns retrieval on with a `knowledge` block in `voicethere.llm.json`:
|
|
481
|
+
|
|
482
|
+
```json
|
|
483
|
+
{
|
|
484
|
+
"knowledge": {
|
|
485
|
+
"store": "redis",
|
|
486
|
+
"topK": 4,
|
|
487
|
+
"embeddings": { "provider": "openai", "dimensions": 512 },
|
|
488
|
+
"redis": { "namespace": "default" }
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
`store` is `redis`, `supabase` or `off`. `embeddings.provider` is `openai`, `gemini` or `openrouter` (Anthropic has no embeddings API); `apiKeySecret` defaults to the top-level one when the provider is the same, and must be an `AGENT_*` secret name. Register the embeddings provider module in `providers`. With `store: "redis"` pass the documents to `createLlmAgent({ knowledge: { documents: [{ id: "pricing.md", text: pricing }] } })`; the agent needs `AGENT_REDIS_URL` (Project Redis) and indexes in the background on start. The model gets one tool, `search_knowledge({ query, k })`, which returns numbered chunks with title and score.
|
|
494
|
+
|
|
495
|
+
The `llm-agent` template ships this block with `"store": "off"` and a sample `knowledge/about.md`, so turning retrieval on is one edit. The `llm-mcp-service` template adds a project service as an MCP tool source; its example server is the public image `ghcr.io/voicethere/mcp-example-service`.
|
|
496
|
+
|
|
497
|
+
### Your own Supabase pgvector table
|
|
498
|
+
|
|
499
|
+
With `store: "supabase"` the agent searches a table in **your** Supabase project; VoiceThere never stores your vectors. Run this SQL in your own project, then fill the table yourself:
|
|
500
|
+
|
|
501
|
+
```sql
|
|
502
|
+
create extension if not exists vector;
|
|
503
|
+
|
|
504
|
+
create table documents (
|
|
505
|
+
id bigint primary key generated always as identity,
|
|
506
|
+
content text not null,
|
|
507
|
+
embedding vector(512)
|
|
508
|
+
);
|
|
509
|
+
|
|
510
|
+
create or replace function match_documents (
|
|
511
|
+
query_embedding vector(512),
|
|
512
|
+
match_threshold float,
|
|
513
|
+
match_count int
|
|
514
|
+
)
|
|
515
|
+
returns table (id bigint, content text, similarity float)
|
|
516
|
+
language sql stable
|
|
517
|
+
as $$
|
|
518
|
+
select
|
|
519
|
+
documents.id,
|
|
520
|
+
documents.content,
|
|
521
|
+
1 - (documents.embedding <=> query_embedding) as similarity
|
|
522
|
+
from documents
|
|
523
|
+
where 1 - (documents.embedding <=> query_embedding) > match_threshold
|
|
524
|
+
order by documents.embedding <=> query_embedding asc
|
|
525
|
+
limit least(match_count, 200);
|
|
526
|
+
$$;
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
It is adapted from the two Supabase guides ([Semantic search](https://supabase.com/docs/guides/ai/semantic-search) and [Vector columns](https://supabase.com/docs/guides/ai/vector-columns)). The returns clause `table (id bigint, content text, similarity float)` is required, and the vector size must match `knowledge.embeddings.dimensions` (512 by default).
|
|
530
|
+
|
|
531
|
+
```json
|
|
532
|
+
{
|
|
533
|
+
"knowledge": {
|
|
534
|
+
"store": "supabase",
|
|
535
|
+
"embeddings": { "provider": "openai", "dimensions": 512 },
|
|
536
|
+
"supabase": {
|
|
537
|
+
"urlSecret": "AGENT_SUPABASE_URL",
|
|
538
|
+
"keySecret": "AGENT_SUPABASE_KEY",
|
|
539
|
+
"rpc": "match_documents",
|
|
540
|
+
"matchThreshold": 0.5,
|
|
541
|
+
"cacheTtlSeconds": 600
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
The agent calls `POST {AGENT_SUPABASE_URL}/rest/v1/rpc/match_documents` with the arguments `query_embedding`, `match_threshold` and `match_count` and reads `id`, `content` and `similarity` from each row. Use a key that may only execute that function (a restricted role), not a service-role key. With Project Redis enabled, identical questions are answered from a Redis cache for `cacheTtlSeconds` (10 minutes by default; cache entries have a TTL so they are evicted first when memory is full). `createSupabaseKnowledgeBase` and `searchKnowledgeTool` are exported for custom agents.
|
|
548
|
+
|
|
427
549
|
## Multiplayer / shared state
|
|
428
550
|
|
|
429
551
|
Each end-user connection must call **`startSession()`** once — one orchestrator session id per client (one signaling room per client). Do **not** join multiple browsers to the same session credentials.
|
|
@@ -60,6 +60,28 @@ export interface LlmAgentMcpSource {
|
|
|
60
60
|
deny?: string[];
|
|
61
61
|
}
|
|
62
62
|
export type LlmAgentToolSource = LlmAgentServiceSource | LlmAgentMcpSource;
|
|
63
|
+
export interface LlmAgentKnowledgeEmbeddings {
|
|
64
|
+
provider: Exclude<LlmProviderId, "anthropic">;
|
|
65
|
+
model?: string;
|
|
66
|
+
dimensions?: number;
|
|
67
|
+
/** Name of the environment variable that holds the embeddings API key. */
|
|
68
|
+
apiKeySecret: string;
|
|
69
|
+
}
|
|
70
|
+
export interface LlmAgentKnowledgeConfig {
|
|
71
|
+
store: "redis" | "supabase" | "off";
|
|
72
|
+
topK?: number;
|
|
73
|
+
embeddings?: LlmAgentKnowledgeEmbeddings;
|
|
74
|
+
redis?: {
|
|
75
|
+
namespace?: string;
|
|
76
|
+
};
|
|
77
|
+
supabase?: {
|
|
78
|
+
urlSecret: string;
|
|
79
|
+
keySecret: string;
|
|
80
|
+
rpc?: string;
|
|
81
|
+
matchThreshold?: number;
|
|
82
|
+
cacheTtlSeconds?: number;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
63
85
|
export interface LlmAgentConfig {
|
|
64
86
|
version: 1;
|
|
65
87
|
provider: LlmProviderId;
|
|
@@ -88,6 +110,10 @@ export interface LlmAgentConfig {
|
|
|
88
110
|
serviceWaitMs?: number;
|
|
89
111
|
fallbackText?: string;
|
|
90
112
|
speakChatReplies?: boolean;
|
|
113
|
+
/** Tool-call log lines: `redacted` (default), `full` (secrets still removed) or `off`. */
|
|
114
|
+
toolCallLogs?: "full" | "redacted" | "off";
|
|
115
|
+
/** Retrieval (RAG) behind a `search_knowledge` tool. */
|
|
116
|
+
knowledge?: LlmAgentKnowledgeConfig;
|
|
91
117
|
}
|
|
92
118
|
export declare const LLM_AGENT_CONFIG_DEFAULTS: {
|
|
93
119
|
readonly maxOutputTokens: 512;
|
|
@@ -110,6 +136,7 @@ export declare const LLM_AGENT_CONFIG_DEFAULTS: {
|
|
|
110
136
|
readonly serviceWaitMs: 20000;
|
|
111
137
|
readonly fallbackText: "Sorry, something went wrong. Please try again.";
|
|
112
138
|
readonly speakChatReplies: true;
|
|
139
|
+
readonly toolCallLogs: "redacted";
|
|
113
140
|
};
|
|
114
141
|
export interface LlmAgentConfigError {
|
|
115
142
|
path: string;
|
|
@@ -494,6 +521,101 @@ export declare const LLM_AGENT_CONFIG_JSON_SCHEMA: {
|
|
|
494
521
|
readonly type: "boolean";
|
|
495
522
|
readonly default: true;
|
|
496
523
|
};
|
|
524
|
+
readonly knowledge: {
|
|
525
|
+
readonly type: "object";
|
|
526
|
+
readonly additionalProperties: false;
|
|
527
|
+
readonly required: readonly ["store"];
|
|
528
|
+
readonly description: "Retrieval (RAG) behind a search_knowledge tool. store redis indexes knowledge/*.md into Project Redis; store supabase queries your own Supabase pgvector function.";
|
|
529
|
+
readonly properties: {
|
|
530
|
+
readonly store: {
|
|
531
|
+
readonly enum: readonly ["redis", "supabase", "off"];
|
|
532
|
+
};
|
|
533
|
+
readonly topK: {
|
|
534
|
+
readonly type: "integer";
|
|
535
|
+
readonly minimum: 1;
|
|
536
|
+
readonly maximum: 10;
|
|
537
|
+
readonly default: 4;
|
|
538
|
+
};
|
|
539
|
+
readonly embeddings: {
|
|
540
|
+
readonly type: "object";
|
|
541
|
+
readonly additionalProperties: false;
|
|
542
|
+
readonly required: readonly ["provider"];
|
|
543
|
+
readonly description: "Required unless store is off. apiKeySecret may be omitted when provider equals the top-level provider. Anthropic has no embeddings API.";
|
|
544
|
+
readonly properties: {
|
|
545
|
+
readonly provider: {
|
|
546
|
+
readonly enum: readonly ["openai", "gemini", "openrouter"];
|
|
547
|
+
};
|
|
548
|
+
readonly model: {
|
|
549
|
+
readonly type: "string";
|
|
550
|
+
readonly minLength: 1;
|
|
551
|
+
readonly maxLength: 200;
|
|
552
|
+
};
|
|
553
|
+
readonly dimensions: {
|
|
554
|
+
readonly type: "integer";
|
|
555
|
+
readonly minimum: 64;
|
|
556
|
+
readonly maximum: 3072;
|
|
557
|
+
readonly default: 512;
|
|
558
|
+
};
|
|
559
|
+
readonly apiKeySecret: {
|
|
560
|
+
type: string;
|
|
561
|
+
pattern: string;
|
|
562
|
+
description: string;
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
readonly redis: {
|
|
567
|
+
readonly type: "object";
|
|
568
|
+
readonly additionalProperties: false;
|
|
569
|
+
readonly properties: {
|
|
570
|
+
readonly namespace: {
|
|
571
|
+
readonly type: "string";
|
|
572
|
+
readonly pattern: "^[a-z0-9_-]{1,40}$";
|
|
573
|
+
readonly default: "default";
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
};
|
|
577
|
+
readonly supabase: {
|
|
578
|
+
readonly type: "object";
|
|
579
|
+
readonly additionalProperties: false;
|
|
580
|
+
readonly required: readonly ["urlSecret", "keySecret"];
|
|
581
|
+
readonly description: "Required when store is supabase.";
|
|
582
|
+
readonly properties: {
|
|
583
|
+
readonly urlSecret: {
|
|
584
|
+
type: string;
|
|
585
|
+
pattern: string;
|
|
586
|
+
description: string;
|
|
587
|
+
};
|
|
588
|
+
readonly keySecret: {
|
|
589
|
+
type: string;
|
|
590
|
+
pattern: string;
|
|
591
|
+
description: string;
|
|
592
|
+
};
|
|
593
|
+
readonly rpc: {
|
|
594
|
+
readonly type: "string";
|
|
595
|
+
readonly pattern: "^[a-z_][a-z0-9_]{0,62}$";
|
|
596
|
+
readonly default: "match_documents";
|
|
597
|
+
};
|
|
598
|
+
readonly matchThreshold: {
|
|
599
|
+
readonly type: "number";
|
|
600
|
+
readonly minimum: 0;
|
|
601
|
+
readonly maximum: 1;
|
|
602
|
+
readonly default: 0.5;
|
|
603
|
+
};
|
|
604
|
+
readonly cacheTtlSeconds: {
|
|
605
|
+
readonly type: "integer";
|
|
606
|
+
readonly minimum: 10;
|
|
607
|
+
readonly maximum: 86400;
|
|
608
|
+
readonly default: 600;
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
};
|
|
614
|
+
readonly toolCallLogs: {
|
|
615
|
+
readonly enum: readonly ["full", "redacted", "off"];
|
|
616
|
+
readonly default: "redacted";
|
|
617
|
+
readonly description: "Agent log line per tool call. redacted removes secret values, sensitive keys and common personal data; full removes only secret values; off writes nothing.";
|
|
618
|
+
};
|
|
497
619
|
};
|
|
498
620
|
};
|
|
499
621
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
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IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,oBAAoB,GAC5B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;CAAE,GACrE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,mBAAmB,EAAE,CAAA;CAAE,CAAC;AAidjD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CA+T3E;AAaD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiV/B,CAAC"}
|
package/dist/llm/agent/config.js
CHANGED
|
@@ -19,10 +19,13 @@ export const LLM_AGENT_CONFIG_DEFAULTS = {
|
|
|
19
19
|
serviceWaitMs: 20_000,
|
|
20
20
|
fallbackText: "Sorry, something went wrong. Please try again.",
|
|
21
21
|
speakChatReplies: true,
|
|
22
|
+
toolCallLogs: "redacted",
|
|
22
23
|
};
|
|
23
24
|
const PROVIDER_IDS = ["openai", "anthropic", "gemini", "openrouter"];
|
|
24
25
|
const ENV_NAME_RE = /^AGENT_[A-Z0-9_]{1,57}$/;
|
|
25
26
|
const ENV_NAME_MESSAGE = "must start with AGENT_ (only AGENT_* project secrets reach the agent)";
|
|
27
|
+
const KNOWLEDGE_NAMESPACE_RE = /^[a-z0-9_-]{1,40}$/;
|
|
28
|
+
const KNOWLEDGE_RPC_RE = /^[a-z_][a-z0-9_]{0,62}$/;
|
|
26
29
|
const SOURCE_NAME_RE = /^[a-z0-9-]{1,40}$/;
|
|
27
30
|
const MAX_SOURCES = 8;
|
|
28
31
|
function isRecord(v) {
|
|
@@ -300,7 +303,128 @@ const TOP_KEYS = [
|
|
|
300
303
|
"serviceWaitMs",
|
|
301
304
|
"fallbackText",
|
|
302
305
|
"speakChatReplies",
|
|
306
|
+
"toolCallLogs",
|
|
307
|
+
"knowledge",
|
|
303
308
|
];
|
|
309
|
+
function validateKnowledge(c, raw, provider, topSecret) {
|
|
310
|
+
const k = c.object(raw, "knowledge");
|
|
311
|
+
if (!k)
|
|
312
|
+
return undefined;
|
|
313
|
+
c.unknownKeys(k, ["store", "topK", "embeddings", "redis", "supabase"], "knowledge");
|
|
314
|
+
if (k.store !== "redis" && k.store !== "supabase" && k.store !== "off") {
|
|
315
|
+
c.err("knowledge.store", 'must be one of "redis", "supabase", "off"');
|
|
316
|
+
return undefined;
|
|
317
|
+
}
|
|
318
|
+
const out = { store: k.store };
|
|
319
|
+
if (k.topK !== undefined) {
|
|
320
|
+
const n = c.number(k.topK, "knowledge.topK", 1, 10, true);
|
|
321
|
+
if (n !== undefined)
|
|
322
|
+
out.topK = n;
|
|
323
|
+
}
|
|
324
|
+
if (k.store === "off")
|
|
325
|
+
return out;
|
|
326
|
+
const e = c.object(k.embeddings, "knowledge.embeddings");
|
|
327
|
+
if (e) {
|
|
328
|
+
c.unknownKeys(e, ["provider", "model", "dimensions", "apiKeySecret"], "knowledge.embeddings");
|
|
329
|
+
if (e.provider === "anthropic") {
|
|
330
|
+
c.err("knowledge.embeddings.provider", "anthropic has no embeddings API; use openai, gemini or openrouter");
|
|
331
|
+
}
|
|
332
|
+
else if (e.provider === "openai" ||
|
|
333
|
+
e.provider === "gemini" ||
|
|
334
|
+
e.provider === "openrouter") {
|
|
335
|
+
const emb = {
|
|
336
|
+
provider: e.provider,
|
|
337
|
+
};
|
|
338
|
+
if (e.model !== undefined) {
|
|
339
|
+
const m = c.string(e.model, "knowledge.embeddings.model", {
|
|
340
|
+
min: 1,
|
|
341
|
+
max: 200,
|
|
342
|
+
});
|
|
343
|
+
if (m !== undefined)
|
|
344
|
+
emb.model = m;
|
|
345
|
+
}
|
|
346
|
+
else if (e.provider === "openrouter") {
|
|
347
|
+
c.err("knowledge.embeddings.model", "is required when provider is openrouter");
|
|
348
|
+
}
|
|
349
|
+
if (e.dimensions !== undefined) {
|
|
350
|
+
const d = c.number(e.dimensions, "knowledge.embeddings.dimensions", 64, 3072, true);
|
|
351
|
+
if (d !== undefined)
|
|
352
|
+
emb.dimensions = d;
|
|
353
|
+
}
|
|
354
|
+
if (e.apiKeySecret !== undefined) {
|
|
355
|
+
const sec = c.string(e.apiKeySecret, "knowledge.embeddings.apiKeySecret", { re: ENV_NAME_RE, reMessage: ENV_NAME_MESSAGE });
|
|
356
|
+
if (sec !== undefined)
|
|
357
|
+
emb.apiKeySecret = sec;
|
|
358
|
+
}
|
|
359
|
+
else if (e.provider === provider && topSecret !== undefined) {
|
|
360
|
+
emb.apiKeySecret = topSecret;
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
c.err("knowledge.embeddings.apiKeySecret", "is required unless embeddings.provider equals the top-level provider");
|
|
364
|
+
}
|
|
365
|
+
if (emb.apiKeySecret !== undefined) {
|
|
366
|
+
out.embeddings = emb;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
c.err("knowledge.embeddings.provider", 'must be one of "openai", "gemini", "openrouter"');
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (k.redis !== undefined) {
|
|
374
|
+
const r = c.object(k.redis, "knowledge.redis");
|
|
375
|
+
if (r) {
|
|
376
|
+
c.unknownKeys(r, ["namespace"], "knowledge.redis");
|
|
377
|
+
out.redis = {};
|
|
378
|
+
if (r.namespace !== undefined) {
|
|
379
|
+
const ns = c.string(r.namespace, "knowledge.redis.namespace", {
|
|
380
|
+
re: KNOWLEDGE_NAMESPACE_RE,
|
|
381
|
+
});
|
|
382
|
+
if (ns !== undefined)
|
|
383
|
+
out.redis.namespace = ns;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if (k.store === "supabase") {
|
|
388
|
+
const sb = c.object(k.supabase, "knowledge.supabase");
|
|
389
|
+
if (sb) {
|
|
390
|
+
c.unknownKeys(sb, ["urlSecret", "keySecret", "rpc", "matchThreshold", "cacheTtlSeconds"], "knowledge.supabase");
|
|
391
|
+
const urlSecret = c.string(sb.urlSecret, "knowledge.supabase.urlSecret", {
|
|
392
|
+
re: ENV_NAME_RE,
|
|
393
|
+
reMessage: ENV_NAME_MESSAGE,
|
|
394
|
+
});
|
|
395
|
+
const keySecret = c.string(sb.keySecret, "knowledge.supabase.keySecret", {
|
|
396
|
+
re: ENV_NAME_RE,
|
|
397
|
+
reMessage: ENV_NAME_MESSAGE,
|
|
398
|
+
});
|
|
399
|
+
const cfg = {};
|
|
400
|
+
if (urlSecret !== undefined)
|
|
401
|
+
cfg.urlSecret = urlSecret;
|
|
402
|
+
if (keySecret !== undefined)
|
|
403
|
+
cfg.keySecret = keySecret;
|
|
404
|
+
if (sb.rpc !== undefined) {
|
|
405
|
+
const rpc = c.string(sb.rpc, "knowledge.supabase.rpc", {
|
|
406
|
+
re: KNOWLEDGE_RPC_RE,
|
|
407
|
+
});
|
|
408
|
+
if (rpc !== undefined)
|
|
409
|
+
cfg.rpc = rpc;
|
|
410
|
+
}
|
|
411
|
+
if (sb.matchThreshold !== undefined) {
|
|
412
|
+
const n = c.number(sb.matchThreshold, "knowledge.supabase.matchThreshold", 0, 1, false);
|
|
413
|
+
if (n !== undefined)
|
|
414
|
+
cfg.matchThreshold = n;
|
|
415
|
+
}
|
|
416
|
+
if (sb.cacheTtlSeconds !== undefined) {
|
|
417
|
+
const n = c.number(sb.cacheTtlSeconds, "knowledge.supabase.cacheTtlSeconds", 10, 86400, true);
|
|
418
|
+
if (n !== undefined)
|
|
419
|
+
cfg.cacheTtlSeconds = n;
|
|
420
|
+
}
|
|
421
|
+
if (urlSecret !== undefined && keySecret !== undefined) {
|
|
422
|
+
out.supabase = cfg;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return out;
|
|
427
|
+
}
|
|
304
428
|
export function validateLlmAgentConfig(input) {
|
|
305
429
|
const c = new Checker();
|
|
306
430
|
const root = c.object(input, "");
|
|
@@ -579,6 +703,21 @@ export function validateLlmAgentConfig(input) {
|
|
|
579
703
|
if (b !== undefined)
|
|
580
704
|
config.speakChatReplies = b;
|
|
581
705
|
}
|
|
706
|
+
if (root.toolCallLogs !== undefined) {
|
|
707
|
+
if (root.toolCallLogs === "full" ||
|
|
708
|
+
root.toolCallLogs === "redacted" ||
|
|
709
|
+
root.toolCallLogs === "off") {
|
|
710
|
+
config.toolCallLogs = root.toolCallLogs;
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
c.err("toolCallLogs", 'must be one of "full", "redacted", "off"');
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
if (root.knowledge !== undefined) {
|
|
717
|
+
const kn = validateKnowledge(c, root.knowledge, provider, config.apiKeySecret);
|
|
718
|
+
if (kn)
|
|
719
|
+
config.knowledge = kn;
|
|
720
|
+
}
|
|
582
721
|
if (c.errors.length > 0)
|
|
583
722
|
return { ok: false, errors: c.errors };
|
|
584
723
|
return { ok: true, config: config, warnings };
|
|
@@ -843,6 +982,76 @@ export const LLM_AGENT_CONFIG_JSON_SCHEMA = {
|
|
|
843
982
|
default: "Sorry, something went wrong. Please try again.",
|
|
844
983
|
},
|
|
845
984
|
speakChatReplies: { type: "boolean", default: true },
|
|
985
|
+
knowledge: {
|
|
986
|
+
type: "object",
|
|
987
|
+
additionalProperties: false,
|
|
988
|
+
required: ["store"],
|
|
989
|
+
description: "Retrieval (RAG) behind a search_knowledge tool. store redis indexes knowledge/*.md into Project Redis; store supabase queries your own Supabase pgvector function.",
|
|
990
|
+
properties: {
|
|
991
|
+
store: { enum: ["redis", "supabase", "off"] },
|
|
992
|
+
topK: { type: "integer", minimum: 1, maximum: 10, default: 4 },
|
|
993
|
+
embeddings: {
|
|
994
|
+
type: "object",
|
|
995
|
+
additionalProperties: false,
|
|
996
|
+
required: ["provider"],
|
|
997
|
+
description: "Required unless store is off. apiKeySecret may be omitted when provider equals the top-level provider. Anthropic has no embeddings API.",
|
|
998
|
+
properties: {
|
|
999
|
+
provider: { enum: ["openai", "gemini", "openrouter"] },
|
|
1000
|
+
model: { type: "string", minLength: 1, maxLength: 200 },
|
|
1001
|
+
dimensions: {
|
|
1002
|
+
type: "integer",
|
|
1003
|
+
minimum: 64,
|
|
1004
|
+
maximum: 3072,
|
|
1005
|
+
default: 512,
|
|
1006
|
+
},
|
|
1007
|
+
apiKeySecret: envName,
|
|
1008
|
+
},
|
|
1009
|
+
},
|
|
1010
|
+
redis: {
|
|
1011
|
+
type: "object",
|
|
1012
|
+
additionalProperties: false,
|
|
1013
|
+
properties: {
|
|
1014
|
+
namespace: {
|
|
1015
|
+
type: "string",
|
|
1016
|
+
pattern: "^[a-z0-9_-]{1,40}$",
|
|
1017
|
+
default: "default",
|
|
1018
|
+
},
|
|
1019
|
+
},
|
|
1020
|
+
},
|
|
1021
|
+
supabase: {
|
|
1022
|
+
type: "object",
|
|
1023
|
+
additionalProperties: false,
|
|
1024
|
+
required: ["urlSecret", "keySecret"],
|
|
1025
|
+
description: "Required when store is supabase.",
|
|
1026
|
+
properties: {
|
|
1027
|
+
urlSecret: envName,
|
|
1028
|
+
keySecret: envName,
|
|
1029
|
+
rpc: {
|
|
1030
|
+
type: "string",
|
|
1031
|
+
pattern: "^[a-z_][a-z0-9_]{0,62}$",
|
|
1032
|
+
default: "match_documents",
|
|
1033
|
+
},
|
|
1034
|
+
matchThreshold: {
|
|
1035
|
+
type: "number",
|
|
1036
|
+
minimum: 0,
|
|
1037
|
+
maximum: 1,
|
|
1038
|
+
default: 0.5,
|
|
1039
|
+
},
|
|
1040
|
+
cacheTtlSeconds: {
|
|
1041
|
+
type: "integer",
|
|
1042
|
+
minimum: 10,
|
|
1043
|
+
maximum: 86400,
|
|
1044
|
+
default: 600,
|
|
1045
|
+
},
|
|
1046
|
+
},
|
|
1047
|
+
},
|
|
1048
|
+
},
|
|
1049
|
+
},
|
|
1050
|
+
toolCallLogs: {
|
|
1051
|
+
enum: ["full", "redacted", "off"],
|
|
1052
|
+
default: "redacted",
|
|
1053
|
+
description: "Agent log line per tool call. redacted removes secret values, sensitive keys and common personal data; full removes only secret values; off writes nothing.",
|
|
1054
|
+
},
|
|
846
1055
|
},
|
|
847
1056
|
};
|
|
848
1057
|
//# sourceMappingURL=config.js.map
|