@leanspec/chat-server 0.2.19-dev.21166357960

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 (3) hide show
  1. package/README.md +84 -0
  2. package/dist/index.js +7082 -0
  3. package/package.json +53 -0
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # @leanspec/chat-server
2
+
3
+ Standalone AI chat sidecar for LeanSpec UI.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ pnpm --filter @leanspec/chat-server dev
9
+ ```
10
+
11
+ ### Configuration
12
+
13
+ Chat server configuration is loaded from:
14
+
15
+ `~/.leanspec/chat-config.json`
16
+
17
+ The file is hot-reloaded on change (no server restart required).
18
+
19
+ Example config:
20
+
21
+ ```json
22
+ {
23
+ "version": "1.0",
24
+ "providers": [
25
+ {
26
+ "id": "openai",
27
+ "name": "OpenAI",
28
+ "apiKey": "${OPENAI_API_KEY}",
29
+ "models": [
30
+ { "id": "gpt-4o", "name": "GPT-4o", "maxTokens": 128000 }
31
+ ]
32
+ },
33
+ {
34
+ "id": "anthropic",
35
+ "name": "Anthropic",
36
+ "apiKey": "${ANTHROPIC_API_KEY}",
37
+ "models": [
38
+ { "id": "claude-sonnet-4-5", "name": "Claude Sonnet 4.5" }
39
+ ]
40
+ },
41
+ {
42
+ "id": "openrouter",
43
+ "name": "OpenRouter",
44
+ "baseURL": "https://openrouter.ai/api/v1",
45
+ "apiKey": "${OPENROUTER_API_KEY}",
46
+ "models": [
47
+ { "id": "google/gemini-2.0-flash-thinking-exp:free", "name": "Gemini 2.0 Flash (Free)" }
48
+ ]
49
+ }
50
+ ],
51
+ "settings": {
52
+ "maxSteps": 10,
53
+ "defaultProviderId": "openai",
54
+ "defaultModelId": "gpt-4o"
55
+ }
56
+ }
57
+ ```
58
+
59
+ ### Environment
60
+
61
+ - `LEANSPEC_CHAT_SOCKET` (default: `/tmp/leanspec-chat.sock`)
62
+ - `LEANSPEC_CHAT_TRANSPORT` (`socket` | `http`)
63
+ - `LEANSPEC_CHAT_PORT` (HTTP mode)
64
+ - `LEANSPEC_CHAT_PORT_FILE` (HTTP mode)
65
+ - `LEANSPEC_CHAT_URL` (explicit HTTP URL for proxying)
66
+ - `LEANSPEC_HTTP_URL` (default: `http://127.0.0.1:3030`) - used for LeanSpec tools + session persistence
67
+ - Provider keys referenced in config, e.g. `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `OPENROUTER_API_KEY`
68
+
69
+ ### Supported Providers
70
+
71
+ The server supports AI SDK providers via configuration:
72
+
73
+ - OpenAI (`openai`)
74
+ - Anthropic (`anthropic`)
75
+ - Google Generative AI (`google`)
76
+ - OpenRouter (`openrouter`)
77
+ - Deepseek (`deepseek`)
78
+ - Any OpenAI-compatible API (custom `baseURL`)
79
+
80
+ ### Troubleshooting
81
+
82
+ - Missing API key errors: ensure `${VAR_NAME}` in config matches an environment variable.
83
+ - Provider disabled in UI: the provider has no resolved API key.
84
+ - Config validation errors: check JSON syntax and required fields (`id`, `name`, `apiKey`, `models`).