local-llm-gateway 0.1.0 → 0.1.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1 (2026-11-20)
4
+
5
+ - `npx local-llm-gateway` now starts the assistant (0.1.0 said "could not determine
6
+ executable to run"). Installing also adds a `local-llm-gateway` command, the same as
7
+ `llm-gateway`.
8
+ - `llm` commands typed into the chat (for example `llm profile use local`) are no longer
9
+ sent to the assistant; the chat says to type `/exit` first.
10
+ - Messages about a rejected key name the mode in plain words ("the single-user assistant")
11
+ instead of developer commands.
12
+ - Metrics use `@prometheus-io/client`, the new name of `prom-client`, so installing no longer
13
+ prints a deprecation warning. Metric names and output are unchanged.
14
+ - Built commands stay executable after a clean build (affected development links only).
15
+
16
+ ## 0.1.0 (2026-11-20)
17
+
18
+ First release: the gateway and the `llm` terminal app in one package. `llm start` runs the
19
+ assistant with no setup (single-user mode, SQLite); `llm chat`, `llm doctor`, `llm backup`,
20
+ `llm restore`. Server mode (Postgres, Redis) by environment variables.
package/README.md CHANGED
@@ -13,22 +13,24 @@ You need **Node.js 22 or newer** and **Ollama**. No Docker, no database to set u
13
13
  ```bash
14
14
  # 1. Start Ollama: open the Ollama app (or run `ollama serve` in its own window)
15
15
 
16
- # 2. The assistant
17
- git clone https://github.com/japp47/local-llm-gateway.git && cd local-llm-gateway
18
- npm ci && npm run build
19
- npm start
16
+ # 2. Install and start the assistant
17
+ npm install -g local-llm-gateway
18
+ llm start
20
19
  ```
21
20
 
22
21
  On first start it creates its data folder, picks a model for your memory size, and makes
23
22
  a key for the terminal app. If no model is downloaded yet, the log tells you which one to
24
- get, for example `ollama pull qwen3:8b`.
23
+ get, for example `ollama pull qwen3:8b`. `llm start` keeps running in that window; Ctrl+C
24
+ stops it.
25
25
 
26
26
  ```bash
27
- # 3. The terminal app, in a second window
28
- cd cli && npm ci && npm run build && npm install -g .
27
+ # 3. In a second window
29
28
  llm chat "hello"
30
29
  ```
31
30
 
31
+ To try it without installing: `npx local-llm-gateway` starts the assistant, and
32
+ `npx -p local-llm-gateway llm chat "hello"` chats from a second window.
33
+
32
34
  No key to copy: `llm` finds the one the assistant made. If anything doesn't work:
33
35
 
34
36
  ```bash
package/cli/dist/index.js CHANGED
File without changes
@@ -1,8 +1,8 @@
1
1
  // Explains a rejected API key in terms of what is actually running.
2
2
  //
3
- // The usual cause on one machine: single-user mode (npm run dev:single, SQLite) and server
4
- // mode (npm run dev, Postgres) both listen on localhost:3000 but have separate databases, so
5
- // a key made for one is unknown to the other. We ask the gateway which mode it runs in, and
3
+ // The usual cause on one machine: single-user mode (SQLite) and server mode (Postgres) both
4
+ // listen on localhost:3000 but have separate databases, so a key made for one is unknown
5
+ // to the other. We ask the gateway which mode it runs in, and
6
6
  // try the other keys saved for this same URL to name the profile that works.
7
7
  //
8
8
  // Safety rule kept: a saved key is only ever sent to the URL it was saved for.
@@ -11,8 +11,8 @@ import { listProfiles, loadConfig, sameGateway } from './config.js';
11
11
  import { describeError } from './errors.js';
12
12
  import { localCredentialsPath, readLocalCredentials, sameLocalGateway, } from './local-credentials.js';
13
13
  const MODE_LABEL = {
14
- single: 'the single-user gateway (npm run dev:single, SQLite)',
15
- server: 'the server-mode gateway (npm run dev, Postgres)',
14
+ single: 'the single-user assistant (SQLite)',
15
+ server: 'the server-mode gateway (Postgres)',
16
16
  };
17
17
  /** Older gateways don't report a mode; that is fine, the advice is just less specific. */
18
18
  export async function gatewayMode(baseUrl, fetchImpl = fetch, timeoutMs = 2000) {
@@ -87,10 +87,10 @@ export async function explainRejectedKey(input) {
87
87
  : "→ Use the gateway's own key: llm profile add local --local then llm profile use local");
88
88
  }
89
89
  else if (mode === 'single') {
90
- lines.push('→ This key is probably for server mode. Start that instead: npm run dev');
90
+ lines.push('→ This key is probably for a server-mode gateway (npm run dev in the repo, or llm start --env-file .env). Start that instead, or use a profile for this assistant.');
91
91
  }
92
92
  else if (mode === 'server') {
93
- lines.push('→ If you meant the single-user gateway, start it instead: npm run dev:single', ' Otherwise make a key on the server: npm run key:create -- you@example.com then llm config set apiKey');
93
+ lines.push('→ If you meant the single-user assistant, stop this one and start that: llm start (without DATABASE_URL)', ' Otherwise make a key on the server: npm run key:create -- you@example.com then llm config set apiKey');
94
94
  }
95
95
  else {
96
96
  lines.push('→ Save a valid key with: llm config set apiKey (you will be prompted)');
package/cli/dist/repl.js CHANGED
@@ -31,6 +31,9 @@ export function printSummary(res, quiet) {
31
31
  }
32
32
  return ok;
33
33
  }
34
+ const LLM_SUBCOMMANDS = 'profile|config|start|doctor|backup|restore|chat|resume|ls|conversations|show|fork|rename|rm|models|stats|whoami';
35
+ /** `llm profile use local` typed into the chat: a command for the terminal, not a question. */
36
+ export const looksLikeLlmCommand = (line) => new RegExp(`^llm\\s+(${LLM_SUBCOMMANDS})\\b`).test(line);
34
37
  export async function runRepl(opts) {
35
38
  const { client } = opts;
36
39
  let conversationId = opts.conversationId;
@@ -204,12 +207,19 @@ export async function runRepl(opts) {
204
207
  if (!(await slash(line)))
205
208
  break;
206
209
  }
210
+ else if (looksLikeLlmCommand(line)) {
211
+ // Not sent to the model: the user meant their terminal, not the chat.
212
+ console.error(errc.yellow(`That's a terminal command, so it wasn't sent to the assistant.\n → Type /exit, then run: ${line}`));
213
+ }
207
214
  else {
208
215
  await turn(line);
209
216
  }
210
217
  }
211
218
  catch (e) {
212
- console.error(errc.red(await describeErrorFully(e)));
219
+ const text = await describeErrorFully(e);
220
+ console.error(errc.red(text));
221
+ if (/→ .*\bllm /.test(text))
222
+ console.error(errc.dim(' (Those are terminal commands: type /exit first.)'));
213
223
  }
214
224
  rl.setPrompt(promptText());
215
225
  rl.prompt();
@@ -1,4 +1,4 @@
1
- import client from 'prom-client';
1
+ import client from '@prometheus-io/client';
2
2
  export function createMetrics(limiter) {
3
3
  const registry = new client.Registry();
4
4
  client.collectDefaultMetrics({ register: registry });
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "local-llm-gateway",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A private AI assistant on your own computer: a gateway in front of Ollama, with the `llm` terminal app.",
5
5
  "keywords": [
6
6
  "ollama",
@@ -21,7 +21,8 @@
21
21
  },
22
22
  "bin": {
23
23
  "llm": "cli/dist/index.js",
24
- "llm-gateway": "dist/src/server.js"
24
+ "llm-gateway": "dist/src/server.js",
25
+ "local-llm-gateway": "dist/src/server.js"
25
26
  },
26
27
  "files": [
27
28
  "dist/src",
@@ -29,12 +30,13 @@
29
30
  "drizzle",
30
31
  "cli/dist",
31
32
  "README.md",
32
- "LICENSE"
33
+ "LICENSE",
34
+ "CHANGELOG.md"
33
35
  ],
34
36
  "scripts": {
35
37
  "test": "vitest run --exclude \"**/*.int.test.ts\"",
36
38
  "dev": "tsx watch --env-file-if-exists=.env src/server.ts",
37
- "build": "tsc",
39
+ "build": "tsc && node -e \"require('fs').chmodSync('dist/src/server.js', 0o755)\"",
38
40
  "start": "node --env-file-if-exists=.env dist/src/server.js",
39
41
  "bench": "tsx --env-file-if-exists=.env scripts/bench.ts",
40
42
  "typecheck": "tsc -p tsconfig.check.json",
@@ -52,14 +54,14 @@
52
54
  },
53
55
  "dependencies": {
54
56
  "@fastify/rate-limit": "^11.2.0",
57
+ "@prometheus-io/client": "^0.16.1",
55
58
  "better-sqlite3": "^13.0.3",
59
+ "commander": "^15.0.0",
56
60
  "drizzle-orm": "^0.45.3",
57
61
  "fastify": "^5.12.5",
58
62
  "ioredis": "^6.0.0",
59
63
  "postgres": "^3.4.9",
60
- "prom-client": "^15.1.3",
61
- "zod": "^4.6.5",
62
- "commander": "^15.0.0"
64
+ "zod": "^4.6.5"
63
65
  },
64
66
  "devDependencies": {
65
67
  "@types/better-sqlite3": "^9.6.0",