@moikapy/lich 0.8.0 → 0.9.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 (35) hide show
  1. package/CHANGELOG.md +49 -1
  2. package/README.md +38 -19
  3. package/dist/{chunk-QOTECFCN.js → chunk-4N3S6ACI.js} +2 -2
  4. package/dist/{chunk-EDRUZF22.js → chunk-KOEZQUIX.js} +1207 -512
  5. package/dist/chunk-KOEZQUIX.js.map +1 -0
  6. package/dist/{chunk-W6JXZBUE.js → chunk-P2YEHNM4.js} +2 -2
  7. package/dist/chunk-P2YEHNM4.js.map +1 -0
  8. package/dist/{chunk-VKEOHUCB.js → chunk-TYRKVBWQ.js} +26 -8
  9. package/dist/chunk-TYRKVBWQ.js.map +1 -0
  10. package/dist/cli.js +82 -44
  11. package/dist/cli.js.map +1 -1
  12. package/dist/{gateway-WU5G4ODO.js → gateway-OSB7254F.js} +209 -47
  13. package/dist/gateway-OSB7254F.js.map +1 -0
  14. package/dist/index.d.ts +105 -60
  15. package/dist/index.js +12 -5
  16. package/dist/{store-COOLBAHB.js → store-YYLEB7JG.js} +2 -2
  17. package/dist/{tui-4BP3TI7J.js → tui-XXIU4W7K.js} +17 -5
  18. package/dist/tui-XXIU4W7K.js.map +1 -0
  19. package/docs/architecture/overview.md +2 -2
  20. package/docs/architecture/tools.md +3 -1
  21. package/docs/getting-started.md +6 -6
  22. package/docs/index.md +1 -1
  23. package/docs/user-guide/cli.md +9 -7
  24. package/docs/user-guide/games.md +2 -1
  25. package/docs/user-guide/library.md +1 -1
  26. package/docs/user-guide/redot.md +2 -2
  27. package/docs/user-guide/tui.md +2 -2
  28. package/package.json +1 -1
  29. package/dist/chunk-EDRUZF22.js.map +0 -1
  30. package/dist/chunk-VKEOHUCB.js.map +0 -1
  31. package/dist/chunk-W6JXZBUE.js.map +0 -1
  32. package/dist/gateway-WU5G4ODO.js.map +0 -1
  33. package/dist/tui-4BP3TI7J.js.map +0 -1
  34. /package/dist/{chunk-QOTECFCN.js.map → chunk-4N3S6ACI.js.map} +0 -0
  35. /package/dist/{store-COOLBAHB.js.map → store-YYLEB7JG.js.map} +0 -0
package/docs/index.md CHANGED
@@ -68,4 +68,4 @@ Working from a clone of the repository? `bun install`, then run the same command
68
68
 
69
69
  ## Version compatibility
70
70
 
71
- The published npm package is **0.7.0**. `lich --version` reads `package.json`. Editor MCP (`mcp_servers`, `lich mcp`) ships in 0.7.0. Node >= 20 (`engines` in `package.json`); Bun is the recommended runtime for development from a clone (`bun src/cli.ts ...`). The TUI needs a TTY; the gateway and library run headless on both runtimes.
71
+ The published npm package is **0.8.0**. `lich --version` reads `package.json`. Editor MCP (`mcp_servers`, `lich mcp`) has shipped since 0.7.0. Node >= 20 (`engines` in `package.json`); Bun is the recommended runtime for development from a clone (`bun src/cli.ts ...`). The TUI needs a TTY; the gateway and library run headless on both runtimes.
@@ -19,7 +19,7 @@ lich mcp enable <name> # set enabled true
19
19
  lich mcp disable <name>
20
20
  lich mcp remove <name>
21
21
  lich --help # usage text
22
- lich --version # package.json version (published package and this tree: 0.7.0)
22
+ lich --version # package.json version (published package and this tree: 0.8.0)
23
23
  ```
24
24
 
25
25
  - **Bare `lich`** opens the same TUI as `lich tui`. It does not print usage. On a TTY, if neither `.lich/config.json` nor `~/.config/lich/config.json` exists, a setup wizard runs first (name, provider, optional gateway env-var names, optional plugins) and writes `.lich/config.json` once. `LICH_MODEL` / `--model` prefills the model prompt; it does not skip the wizard. An existing config in that chain skips the wizard and is not replaced. Non-TTY stdin skips the wizard and prints guidance instead of hanging. `lich --help` still prints usage.
@@ -29,9 +29,9 @@ lich --version # package.json version (published package and this tree:
29
29
  - **TUI** launches the ink interface. See the [TUI guide](tui.md).
30
30
  - **Gateway** runs platform adapters (defaults to `webhook` when no platform is given). See the [Gateway guide](gateway.md). Unknown platform names are skipped with a warning; if none remain, the CLI exits `1`.
31
31
  - **Update** compares the installed version to the npm registry and, when a newer release exists, runs `npm install -g @moikapy/lich@latest`. Exit any running TUI or gateway first; npm cannot replace the package while those processes are running. A git clone is told to `git pull`. See [Updating](../getting-started.md#updating).
32
- - **MCP** ships in 0.7.0 (`lich mcp`). It edits only `mcp_servers` in `<work-dir>/.lich/config.json` through the same writer as `lich init` (`update` mode, so other keys stay). A missing file lists as empty; `add` creates the file if needed. New entries stay disabled until `enable`. Names must match `^[a-z][a-z0-9_]*$`. Catalog names use `optional-mcps/`; otherwise pass `--command` and repeatable `--arg`, or `--url` (loopback only), not both. Redot still needs `--project-path` for the catalog args, and the command basename must be `redot`. No prompts. See the [Redot guide](redot.md).
32
+ - **MCP** (`lich mcp`) edits only `mcp_servers` in `<work-dir>/.lich/config.json` through the same writer as `lich init` (`update` mode, so other keys stay). A missing file lists as empty; `add` creates the file if needed. New entries stay disabled until `enable`. Names must match `^[a-z][a-z0-9_]*$`. Catalog names use `optional-mcps/`; otherwise pass `--command` and repeatable `--arg`, or `--url` (loopback only), not both. Redot still needs `--project-path` for the catalog args, and the command basename must be `redot`. No prompts. See the [Redot guide](redot.md).
33
33
 
34
- A repository clone's `bun src/cli.ts` matches that checkout. The published 0.7.0 binary includes `lich mcp`.
34
+ A repository clone's `bun src/cli.ts` matches that checkout. The published 0.8.0 binary includes `lich mcp`.
35
35
 
36
36
  ## Flags
37
37
 
@@ -85,7 +85,7 @@ Validated by zod (top-level unknown keys are silently stripped; extra keys insid
85
85
  {
86
86
  "kind": "openai_compat",
87
87
  "name": "openrouter",
88
- "model": "anthropic/claude-sonnet-4",
88
+ "model": "anthropic/claude-sonnet-4-20250514",
89
89
  "base_url": "https://openrouter.ai/api/v1",
90
90
  "api_key_env": "OPENROUTER_API_KEY"
91
91
  },
@@ -128,7 +128,7 @@ Validated by zod (top-level unknown keys are silently stripped; extra keys insid
128
128
  | `theme` | string | `lich` | Display theme name. See [Themes](https://github.com/Moikapy/lich/blob/main/README.md#themes). |
129
129
  | `gateway` | object | omitted | Optional. `platforms` (`webhook` \| `telegram` \| `discord` \| `twitch`) and `token_envs` (platform → env-var name). Secrets stay in the environment. |
130
130
  | `plugins` | string array | `[]` | Module paths relative to `work_dir` or absolute. Bare `lich`, one-shot, chat, tui, and gateway load them through `create_agent_with_plugins`. `run_agent` does too. `create_agent` does not. See the [plugins guide](plugins.md). |
131
- | `mcp_servers` | object | omitted | Optional. Closed record of named servers. Each entry is stdio `{command, args, env?}` or loopback http `{url}`. `enabled` defaults to false. Unknown keys are rejected. Ships in 0.7.0. See the [Redot guide](redot.md). |
131
+ | `mcp_servers` | object | omitted | Optional. Closed record of named servers. Each entry is stdio `{command, args, env?}` or loopback http `{url}`. `enabled` defaults to false. Unknown keys are rejected. See the [Redot guide](redot.md). |
132
132
  | `system_prompt` | string | built-in | Replaces the default system prompt. |
133
133
  | `max_turns` | int >= 1 | `25` | Turn budget per run. |
134
134
  | `work_dir` | string | cwd | Root for all file tools; paths outside are rejected. |
@@ -138,7 +138,7 @@ Validated by zod (top-level unknown keys are silently stripped; extra keys insid
138
138
  | `context_budget_tokens` | positive int | `100000` | Estimated budget before compression triggers. |
139
139
  | `compress_threshold` | 0.1–0.95 | `0.8` | Compress when usage >= this fraction of the budget. |
140
140
  | `session_dir` | string | `<work_dir>/.lich/sessions` | Transcript directory. |
141
- | `terminal_timeout_ms` | positive int | `60000` | Default timeout injected into the `terminal` tool. |
141
+ | `terminal_timeout_ms` | positive int | `60000` | Written into tool context as `LICH_TERMINAL_TIMEOUT_MS`. The `terminal` tool does **not** read it yet; pass `timeout_ms` on the tool call (default 60000, max 300000). |
142
142
  | `log_level` | enum | `info` | Logger verbosity. |
143
143
 
144
144
  Minimal per-provider examples:
@@ -148,7 +148,7 @@ Minimal per-provider examples:
148
148
  ```
149
149
 
150
150
  ```json
151
- { "providers": [{ "kind": "anthropic", "name": "main", "model": "claude-sonnet-4", "api_key_env": "ANTHROPIC_API_KEY" }] }
151
+ { "providers": [{ "kind": "anthropic", "name": "main", "model": "claude-sonnet-4-20250514", "api_key_env": "ANTHROPIC_API_KEY" }] }
152
152
  ```
153
153
 
154
154
  Listed providers form a failover chain: the router walks them in order, retrying `rate_limit`/`network` errors (bounded backoff) on the current provider before moving on, and failing over immediately on `auth`, `overflow`, and `bad_request`.
@@ -163,6 +163,8 @@ never accepted as a config passthrough.
163
163
  | `LICH_ALLOW_SELF_COMMIT` | Set to `1` to allow one gated `git_commit` per run. Unset or any other value is fail-closed. Read at agent construction. |
164
164
  | `LICH_ALLOW_PRIVATE_URLS` | Set to exactly `1` to let `fetch_url` / `http_request` reach private or loopback URLs. Unset or any other value is fail-closed (they are blocked). |
165
165
  | `LICH_TEST_COMMAND` | Command `run_tests` runs in `work_dir` (default `node node_modules/vitest/vitest.mjs run`). An optional `filter` argument is appended. |
166
+ | `LICH_DOCS_DIR` | Optional docs root for `docs_read` / `docs_search` (dir with `index.md`, or a parent containing `docs/`). Else `<work_dir>/docs` or package docs. |
167
+ | `LICH_TERMINAL_TIMEOUT_MS` | Injected from config `terminal_timeout_ms` into tool context. Unused by `terminal` today — use the tool's `timeout_ms` arg. |
166
168
 
167
169
  Veto reasons, the terminal git denylist, skills, and `MEMORY.md` are in the
168
170
  [plugins guide](plugins.md#self-improvement-loop).
@@ -60,7 +60,8 @@ jq -r 'select(.kind=="message") | select(.message.role=="tool" and .message.is_e
60
60
  ```
61
61
 
62
62
  ```bash
63
- # (5) pacing
63
+ # (5) pacing (`.ts` is append/write time for each JSONL record — useful with
64
+ # incremental persistence; not a model-side event clock)
64
65
  jq -r 'select(.kind=="message") | select(.message.role=="user" or .message.role=="assistant")
65
66
  | [.ts, .message.role] | @tsv' .lich/sessions/<run>.jsonl
66
67
  ```
@@ -148,7 +148,7 @@ Listed providers form a failover chain tried in order: `rate_limit`/`network` er
148
148
 
149
149
  `tools_enabled` accepts `"all"` (default) or an array of tool names to register; everything else stays unregistered and invisible to the model. MCP tools, when a named server is `enabled`, use the same allowlist and stay off when the list is `[]` (that empty list does not connect). The filter does not apply to plugin tools: they register afterward, including the gatekeeper's `git_commit` (fail-closed unless `LICH_ALLOW_SELF_COMMIT=1`). `[]` strips every builtin and every MCP tool and does not throw.
150
150
 
151
- `mcp_servers` and `catalog_client_entry` ship in 0.7.0. See the [Redot guide](redot.md).
151
+ `mcp_servers` and `catalog_client_entry` ship in this package (since 0.7.0). See the [Redot guide](redot.md).
152
152
 
153
153
  ```ts
154
154
  const agent = create_agent({
@@ -22,13 +22,13 @@ The client is general, the same shape as Hermes and Claude: a named list you ext
22
22
  }
23
23
  ```
24
24
 
25
- stdio is a local binary you named, plus `args`, plus optional `env`. The process is spawned with those argv, never a shell. `npx`, `npm`, `bunx`, `uvx`, `curl`, `wget`, a URL, and shell metacharacters are refused. lich does not run `npx -y` or fetch an addon. Values in `env` are passed to the process and are never logged. `lich mcp add` has no flag for `env`; set that key in the file if you need it. On Bun, the spawned child is not `unref`'d, so one-shot and other short-lived runs wait for the MCP answer instead of exiting while the child is still working; `Agent.close()` (every CLI mode calls it) kills the child.
25
+ stdio is a local binary you named, plus `args`, plus optional `env`. The process is spawned with those argv, never a shell. Config validation refuses common downloader basenames (`npx`, `npm`, `bunx`, `uvx`, `curl`, `wget`), a URL in the command, and shell metacharacters — a footgun guard, not a sandbox (wrappers like `bash -c` or `env npx` are not covered). Treat an enabled server as trusted code. lich does not run `npx -y` or fetch an addon. Values in `env` are passed to the process and are never logged. `lich mcp add` has no flag for `env`; set that key in the file if you need it. On Bun, the spawned child is not `unref`'d, so one-shot and other short-lived runs wait for the MCP answer instead of exiting while the child is still working; `Agent.close()` (every CLI mode calls it) kills the child.
26
26
 
27
27
  HTTP is `{ "url": "http://127.0.0.1:9/mcp" }`. The host must be `127.0.0.1` or `localhost`. `0.0.0.0` and any other host are refused. There is no remote MCP in v1.
28
28
 
29
29
  On connect the client sends `initialize`, then `notifications/initialized`, then `tools/list`. `tools/call` runs only when the model invokes a registered tool. Registered names are `mcp_<server>_<tool>`, so two servers cannot collide. They appear only when that server is `enabled` and `tools_enabled` is `"all"` or lists the prefixed name. `tools_enabled: []` drops them even when the server is enabled, and does not connect. Plugin tools still register, including the gatekeeper's `git_commit`. The commander persona keeps `tools_enabled: []` and the `game_bridge` plugin only — `persona_config` does not copy `mcp_servers`.
30
30
 
31
- This client ships in 0.7.0 (`lich mcp`, `mcp_servers`). From a clone, use `bun src/cli.ts mcp ...`.
31
+ This client has shipped since 0.7.0 (`lich mcp`, `mcp_servers`; current package 0.8.0). From a clone, use `bun src/cli.ts mcp ...`.
32
32
 
33
33
  ## Add a server
34
34
 
@@ -9,12 +9,12 @@ lich # front door: TUI, plus a first-run setup wizard when no config exi
9
9
  lich tui # same TUI, no wizard. From a clone: bun src/cli.ts tui
10
10
  ```
11
11
 
12
- The TUI needs a TTY and a resolvable provider (same resolution as every mode). On startup it prints a dim header from the active theme welcome string, e.g. `⚱ lich v0.7.0 — the agent that will not stay dead · llama3.2 (ollama)`. `{version}` is `LICH_VERSION` from `package.json`. That banner is the only tagline placement. Quit with `/exit`, `/quit`, `/q`, or Ctrl+C.
12
+ The TUI needs a TTY and a resolvable provider (same resolution as every mode). On startup it prints a dim header from the active theme welcome string, e.g. `⚱ lich v0.8.0 — the agent that will not stay dead · llama3.2 (ollama)`. `{version}` is `LICH_VERSION` from `package.json`. That banner is the only tagline placement. Quit with `/exit`, `/quit`, `/q`, or Ctrl+C.
13
13
 
14
14
  ## Anatomy
15
15
 
16
16
  ```
17
- ⚱ lich v0.7.0 — the agent that will not stay dead · llama3.2 (ollama)
17
+ ⚱ lich v0.8.0 — the agent that will not stay dead · llama3.2 (ollama)
18
18
  mortal › list the files here <- your input, echoed into the transcript
19
19
  ⏺ list_dir({}) <- live tool-call row (name + args preview)
20
20
  ⏷ list_dir: ok (d src/ d test/ ...) <- result row (ok/error + output preview)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moikapy/lich",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Lich — a TypeScript AI agent harness (library + CLI) inspired by Hermes",
5
5
  "type": "module",
6
6
  "license": "MIT",