@pithosai/pithosai 1.0.10 → 1.0.33

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,784 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.32] - 2026-09-22
9
+
10
+ ### Changed
11
+
12
+ - **Krouter models** — Removed curated `handCrafted.krouter.families` (`kr/glm-5*`, `kr/minimax-*`, `kr/deepseek-*`). Catalog lists only dashboard combos `RD` / `ARCH` / `PM` / `QA` as `krouter-*` CLI keys. Other gateway ids resolve via composite `krouter/<id>` (alias `kiro/<id>`).
13
+ - Lazy `GET /v1/models` fetch caches `context_length` / `max_completion_tokens` without blocking sync `resolveModelConfig`.
14
+ - NL classify default model is `RD` (was `kr/glm-5-agentic`).
15
+ - Shell NL fallback (`scripts/pithosai-nl-fallback.sh`) default `PITHOSAI_NL_MODEL` is `krouter-rd` (was `krouter-glm-5-agentic`).
16
+
17
+ ### Added
18
+
19
+ - **`pithosai models`** — Lists public `KEY_TO_MODEL` keys plus discovered krouter composites (`krouter/<id>`), skipping composites that already have a combo shortcut. Default stdout is JSON; `--table` prints aligned columns (mutually exclusive with `--json`).
20
+
21
+ ### Docs
22
+
23
+ - README, `docs/KROUTER.md`, `src/models/krouter.README.md`, and locale CLI examples updated for combos + composites.
24
+
25
+ ## [1.0.31] - 2026-09-18
26
+
27
+ ### Added
28
+
29
+ - **`pithosai role-template init`** — Seed built-in Role Market templates (RD, PM, QA, WR, CO, MKT, SRE) for `en` and `zh` into an empty `pithosai_role_prompts` table. Catalog JSON and prompt markdown are fetched first; a non-empty table or a failed CDN fetch leaves the table unchanged.
30
+ - **CLI auto-seed** — When `pithosai.js` starts (except `--help`/`-V`, `migrate-db`, and explicit `role-template init`), an empty `pithosai_role_prompts` table is seeded from the Role Market using the same init path. Auto-seed is best-effort: a CDN/offline failure prints a localized hint to run `pithosai role-template init` later and never blocks the CLI.
31
+ - **`pithosai role-template update --from-remote`** — Refresh one installed role/lang from the Role Market catalog. Users do not pass CDN URLs.
32
+
33
+ ### Changed
34
+
35
+ - Local `role-template update` sources (`--content`, `--file`, `--from-dir`) stay valid and are mutually exclusive with `--from-remote`.
36
+ - **`pithosai role-template init`** prints download progress (catalog, each role/lang pack, persist) so the command does not sit silent for 1–2 minutes.
37
+ - CLI request command follows the same model env-walk as `resolveModelConfig` when `--model` is omitted, then sets that `provider/id`. An explicit `--model` still requires that provider's API key or exits with a localized missing-key message.
38
+ - Krouter env-walk default is the `RD` combo (`krouter-rd`), not `kr/glm-5`. `--reasoner` / `--pro` no longer switch the Krouter default.
39
+
40
+ ### Docs
41
+
42
+ - README role-template table, ARCHITECTURE command list, and locale strings for init / remote update.
43
+ - npm tarball includes `CHANGELOG.md` next to `LICENSE`, plus markdown files linked from README (`docs/hooks-usage.md`, `docs/KROUTER.md`, `src/models/README.md`, `src/models/krouter.README.md`, `src/agent-orch/READEM.md`).
44
+
45
+ ### Fixed
46
+
47
+ - **bash NL fallback now works** — the previous bash `bind -x` handler read the line from the terminal (`read -e`), which collided with readline and made the NL path unusable. The bash intercept now rewrites `READLINE_LINE`/`READLINE_POINT` into the quoted pithosai CLI call and lets the shell's native `accept-line` run it, so `TAB` completion keeps working. Because bash reserves plain Enter for `accept-line` (it consumes `\C-m`, and `bind -x` refuses to bind `accept-line`), the intercept is bound to **`Ctrl-J`**; lines bash cannot parse (e.g. `for these files: …`) therefore need `Ctrl-J`, while parseable-but-unknown commands still reach the NL fallback through `command_not_found` on plain Enter.
48
+
49
+ ### Tests
50
+
51
+ - bash handler rewrites `READLINE_LINE` without executing pithosai, the rewritten line invokes pithosai when evaluated, non-NL input is left untouched, and `\C-m` is not bound.
52
+ - Empty-table init, non-empty guard, catalog/file fetch failure, `--from-remote`, mixed-source rejection, local update regression. CLI auto-seed when `pithosai_role_prompts` is empty. Market fetch is mocked.
53
+
54
+ ## [1.0.30] - 2026-09-16
55
+
56
+ ### Added
57
+
58
+ - **`/skill-<name>` activation** — Embeddable slash tokens activate installed catalog skills on the current agent session (`AgentSessionEntry.activeSkillNames`). Tokens strip like `/image`; multiple names union into an ordered set. Follow-up turns keep a `<forced_skills>` system-prompt block (re-applied after cached-agent reuse). Agent mode only.
59
+ - **`/skill-done`** — Clear all active skills or one name without running the agent.
60
+ - **Skill completion marker** — Assistant `[PITHOS_SKILL_COMPLETE:<name>]` removes that skill from the session set and is stripped from transcript display and persisted messages.
61
+ - **Completer** — Tab completion offers `/skill-<name>` from `getScopedSkills` at complete time (rescans after install/remove).
62
+
63
+ ### Docs
64
+
65
+ - README slash table, ARCHITECTURE session + forced-skills notes, and locale strings for activation / done / forced-skills prompt copy.
66
+
67
+ ### Tests
68
+
69
+ - Parse/strip (longest name, unknown, not `/list-skill`), session union/remove, forced-skills replace after reuse, marker strip, `/skill-done`, unknown skill / non-agent reject, completer catalog scan.
70
+
71
+ ## [1.0.29] - 2026-09-15
72
+
73
+ ### Added
74
+
75
+ - **JSON command hooks** — Load `~/.pithosai/hooks/*.json` and `<cwd>/.pithosai/hooks/*.json` (project wins by filename). `hookType` uses pithos names (`beforeToolExecute`, `afterToolExecute`; `postToolExecute` aliases `afterToolExecute`). A `command` runs with tool-hook JSON on stdin. `beforeToolExecute` exit `2` blocks the tool; other failures never block.
76
+ - **Git AI checkpoints** — Bundled `git-ai.json` spawns the shipped `pithosai-git-ai-adapter` CLI (`scripts/pithosai-git-ai-adapter.js`, published as a release bin) for `write`/`edit`/`read`. Override or disable via a same-name JSON file. Adapter still respects `PITHOSAI_GIT_AI=0`. Failures are logged and do not block the tool.
77
+ - **Built-in hook plugins** — Bundled integrations register through `registerBuiltinHookPlugins()` (system prompt rebuild + JSON command hooks) instead of being wired inside `wrapAgentWithHooks`.
78
+
79
+ ### Changed
80
+
81
+ - **Agent run context** — Per-run ALS context (`cwd`, `role`, `lang`, `taskId`, `model`, `messages`) is bound around `agent.prompt` and copied onto tool-hook payloads so plugins can read session fields without patching the wrapper. Bootstrap passes `taskId` and `model` into `wrapAgentWithHooks`.
82
+ - **Command-hook adapters** — In-process adapters live on `CORE_COMMAND_HOOK_ADAPTERS` (empty by default; Git AI is not listed). Agent bootstrap passes that map into JSON command hooks. See [`docs/hooks-usage.md`](docs/hooks-usage.md#add-a-pithosai-core-agent-hook).
83
+
84
+ ### Fixed
85
+
86
+ - **TUI input clipped by the right border** — A nearly-full first line in the framed editor no longer loses characters under the right `│`. Wrap width now reserves the `→` marker; wrapped rows indent to stay aligned under the typed text.
87
+ - **macOS trackpad scroll froze the TUI** — pi-tui's all-motion mouse mode (1003h) plus leftover SGR wheel/motion bytes could stall stdin so the CLI ignored further keys. Pithos now disables 1003h, keeps button-event + SGR wheel reporting, and consumes leftover mouse sequences instead of feeding them to the editor.
88
+ - **macOS trackpad wheel froze a long transcript** — Each two-finger-scroll tick re-wrapped the full transcript and redrew the TUI, starving the event loop. Wheel ticks now coalesce (~16ms) into one scroll, and wrapped rows are cached until transcript content or width changes.
89
+
90
+ ### Tests
91
+
92
+ - Added coverage for JSON command-hook parse/load/run (`beforeToolExecute` / `afterToolExecute`), in-process core adapters vs shell CLIs, `{pithosaiCli:…}` expansion, git-ai adapter from hook events, PATH detection, skip when not installed, `PITHOSAI_GIT_AI` disable, agent-run-context ALS, and builtin plugin registration.
93
+ - Added framed-editor wrap coverage so a nearly-full first input line stays fully visible instead of being truncated under the right border.
94
+ - Added TUI mouse-reporting coverage so all-motion tracking (1003h) stays off, leftover SGR mouse bytes never reach the editor, and batched/modifier wheel reports still scroll the transcript.
95
+ - Added coverage so trackpad wheel bursts coalesce into one transcript scroll and wrapped transcript rows are reused until content or width changes.
96
+
97
+ ## [1.0.28] - 2026-09-08
98
+
99
+ ### Added
100
+
101
+ - **`/show-task` tool runs** — Task Q&A preview now includes tool requests (name + arguments) and tool results in the answer body, not only assistant text. Result bodies are truncated for display (first three non-empty lines). Localized section labels across locales.
102
+
103
+ ### Changed
104
+
105
+ - **pi libs 0.78 → 0.85.1** — Upgraded `@earendil-works/pi-ai`, `pi-agent-core`, `pi-coding-agent`, and `pi-tui` (root and npc-platform client). Legacy catalog/stream helpers now import from `@earendil-works/pi-ai/compat`; `convertMessages` from `@earendil-works/pi-ai/api/openai-completions`. Agent TUI extends `TuiAltScreen` (replaces removed `TUI` class). `messages-pi-ai-compat.js` aligned with pi-ai 0.85.1 `detectCompat`. Node engine raised to `>=22.19.0` to match pi package requirements.
106
+ - **TUI alt-screen ownership** — `TuiAltScreen.start()` / `stop()` own alternate-screen enter/exit. Removed nested manual `\x1b[?1049h` before start. `restoreMainScreenBuffer()` is a safety net that only sends `\x1b[?1049l` (no clear).
107
+
108
+ ### Fixed
109
+
110
+ - **Blank terminal after TUI exit** — Leaving the full-screen TUI (`/exit`, `/quit`, Ctrl+D, SIGINT/SIGTERM) no longer clears the restored main buffer. Nested alt-screen enter plus post-stop `\x1b[2J\x1b[H` had left an empty block and lost shell scrollback.
111
+ - **Fuzzy escape codes after Vitest** — Added `vitest.terminal-teardown.js` and hardened TUI exit helpers so unit test runs do not leave alternate-screen / mouse-reporting garbage in the developer terminal.
112
+ - **Skills tests network calls** — Skills-related tests mock `fetch` so CI/local runs do not hit the network.
113
+ - **Mouse-wheel transcript scroll** — Wheel events are intercepted in `handleViewportInput` so pi-tui 0.85.1 cannot consume SGR sequences for its empty implicit `ScrollView`. The mouse wheel again scrolls the pithos transcript.
114
+
115
+ ### Tests
116
+
117
+ - Updated `tui-exit-utils` and `agent-tui-repl` exit/start coverage: no post-exit clear, no double alt-screen enter; expanded `/show-task` unit tests for tool call/result segments; mouse-wheel SGR now asserted through the TUI input pipeline.
118
+
119
+ ## [1.0.27] - 2026-09-07
120
+
121
+ ### Fixed
122
+
123
+ - **Terminal clearing on TUI exit** — The terminal is now properly cleared when exiting the full-screen TUI, leaving only the TUI session data visible. Previously, escape sequences (`\x1b[2J\x1b[H\x1b[?1049l`) could appear in the terminal after exit.
124
+
125
+ ### Changed
126
+
127
+ - **Shared TUI exit utility** — Extracted `restoreMainScreenBuffer()` and `gracefulTuiExit()` into `src/cli/request/tui-exit-utils.js` for consistent terminal cleanup across TUI components.
128
+ - **TTY guard for screen restoration** — `restoreMainScreenBuffer()` now checks `process.stdout.isTTY` before writing escape sequences, preventing garbled output in non-terminal environments (piped output, CI/CD, scripts).
129
+ - **Safe `isPaused()` check** — Added `typeof process.stdin.isPaused === "function"` guard to prevent runtime errors when stdin properties are undefined.
130
+
131
+ ### Tests
132
+
133
+ - Added 10 unit tests for `tui-exit-utils.js` covering TTY true/false/undefined cases, error handling, stdin resume logic, and the `restoreScreen` option.
134
+
135
+ ## [1.0.26] - 2026-09-04
136
+
137
+ ### Added
138
+
139
+ - **TUI job control** — **Ctrl+Z** or **`/bg`** suspends the full-screen TUI (restores the terminal and stops the process) so you can run commands in the parent shell; **`fg`** brings the TUI back. The agent freezes while suspended (same as `vim`/`less`). Unsupported on Windows.
140
+ - **System prompt rebuild hook** — New hook type `BEFORE_CACHED_AGENT_REUSE` triggers before reusing a cached agent, rebuilding the system prompt and initial messages from DB to ensure fresh task context, skills, and role prompts. Hook registration and configuration via `registerSystemPromptRebuildHook`, `configureSystemPromptRebuild`, `getSystemPromptRebuildConfig`. Includes unit tests for hook lifecycle and behavior.
141
+
142
+ ### Fixed
143
+
144
+ - **`/show-prompt` skills and tools formatting** — Interactive `/show-prompt` and `pithosai show-prompt` fence the `<available_skills>` XML in a code block for the markdown viewer, and skip soft-wrap rejoining on that path. Skill descriptions with unbalanced `` ` `` / `**` / `*` no longer collapse the tools list into one paragraph; tools stay as a readable markdown list. Live agent prompts are unchanged.
145
+
146
+ ## [1.0.25] - 2026-09-01
147
+
148
+ ### Added
149
+
150
+ - **TUI multi-line input** — **Shift+Enter** inserts a newline in the framed editor; **Enter** still submits. On macOS, Shift is detected even when the terminal sends the same CR as Enter (Cursor / VS Code / iTerm). **Ctrl+J** and **`\` then Enter** remain fallbacks. When the input box grows or shrinks, the TUI does a full redraw so the framed prompt, task-status line, and cwd/git footer stay intact.
151
+
152
+ ### Fixed
153
+
154
+ - **Unknown `--model` exits with an error** — A bad key such as `kr-MKT` used to start (or immediately tear down) the session with no terminal message because failures were log-file-only and `process.exit` skipped stderr. The CLI now rejects unknown keys up front, prints the localized unknown-key message on stderr, and exits with code 2.
155
+
156
+ ## [1.0.24] - 2026-09-01
157
+
158
+ ### Added
159
+
160
+ - **CLI slogan version** — The startup ASCII banner now prints a localized, centered package version line under the art (`cli.sloganVersion` in all locales), read from `package.json`. Language follows `--lang`/`-l` or the default locale (`src/cli/shared/slogan.js`).
161
+
162
+ ### Changed
163
+
164
+ - **Task / `code_review` tool display** — The terminal still previews the first three non-empty lines of a tool result. For `task` and `code_review`, the full subagent summary (`result` or `findings`) is appended so findings are not hidden behind the JSON metadata wrapper.
165
+
166
+ ## [1.0.23] - 2026-08-31
167
+
168
+ ### Added
169
+
170
+ - **SEC role** — New Security / AppSec agent role (`--role SEC`) for threat modeling, secure code review, vulnerability triage, dependency and secret hygiene, and security design review. Prompt templates live under `templates/SEC/` (IDENTITY, ABILITIES, AGENTS, TOOLS) in English and Chinese (`-zh`). Init with `pithosai init --type js --role SEC`; run with `pithosai -r SEC`. Outputs go under `pro-product/SEC/`. Role naming notes: `docs/roles/Sec-definition.md`.
171
+
172
+ ## [1.0.22] - 2026-08-28
173
+
174
+ ### Fixed
175
+
176
+ - **TUI transcript wrapping** — Interactive content is wrapped at the live terminal width when the viewport is painted, instead of permanently splitting lines at a construction-time 80-column snapshot. Eager wrap fragments (e.g. `Find` / `ings`) are coalesced before reflow so prose stays readable at the current TUI width.
177
+ - **Assistant markdown streaming** — Incremental markdown no longer flushes on every single newline (which split headings like `Test` / `Results:` and renumbered every list item as `1.`). Flush waits for paragraph boundaries and holds trailing ordered lists until the list ends. Flush also holds while inline `` ` `` / `**` / `*` markers are unclosed, so soft-wrapped list items like `- **\`\npath\`**` and emphasis spans like `*Note: … ~6\n32K lines)*` are not rendered as raw markers or split mid-token. Bare `1.\nBody` markers, soft-wrapped GFM table headers (`| Files |\nLines |`), soft-wrapped table separators (`|---|---|---\n---|`, rejoined without a space so GFM still recognizes the table), and mid-inline soft wraps are rejoined before parse; colon-based plain-text newline heuristics were removed. Tool dumps keep single newlines (`breaks: true`) so git log / find output stays line-oriented.
178
+ - **TUI markdown final re-render** — When an assistant message finishes streaming, the TUI now re-renders the entire message as one markdown document and replaces the streamed fragments in the transcript with that single coherent render. This eliminates the segment-concatenation artifact where a line that should be one row rendered as two (independent per-segment `marked.parse` calls plus transcript line-coalescing heuristics could not perfectly reconstruct a single full-document render). Streaming still shows formatted markdown segment-by-segment for live feedback; only the completed message is replaced. The console (non-TUI) sink keeps incremental writes since it cannot un-print. The reasoner handler applies the same finalize to its reply body (after the reply header). Added optional `beginAssistantBody` / `finalizeAssistantBody` / `resetAssistantBody` to the `AgentOutputSink` interface.
179
+ - **Multi-line fenced code blocks** — `renderMarkdownToAnsi` no longer collapses a fenced code block into one line. The soft-wrap joiner previously saw the opening fence (odd backtick count) as unclosed inline markdown and glued every code line onto it until the closing fence. Fenced blocks (``` / `~~~`) are now passed through untouched, so each code line keeps its own row and code containing unbalanced markers (e.g. a lone `` ` `` or `**`) is not rewritten.
180
+
181
+ ## [1.0.21] - 2026-08-27
182
+
183
+ ### Changed
184
+
185
+ - **Default run command internals** — Split `src/cli/request-command.js` into `src/cli/request/` (slash-command registry, run guards, REPL/TUI loops, Commander install). Public CLI flags, slash commands, and the `request-command.js` export surface are unchanged.
186
+ - **CLI folder layout** — Top-level `src/cli` keeps thin `*-command.js` facades (`skills-command.js`, `skill-convert-command.js`, …), `index.js`, and `program.js`. Implementations live under per-command folders (`request/`, `skills/`, `shell/`, `task/`, …). Cross-cutting helpers live under `src/cli/shared/` (`shell`, `log-path`, `agent-control`, `repl-completer`, `auto-upgrade`, `slogan`, `cli-option-coerce`, `nl-fallback/`).
187
+
188
+ ## [1.0.20] - 2026-08-21
189
+
190
+ ### Changed
191
+
192
+ - **User model catalog (`~/.pithosai/models.json5`)** — Runtime model lists load from JSON5 at `~/.pithosai/models.json5` (override with `PITHOSAI_MODELS_PATH`). If the file is missing, it is seeded from bundled `src/models/catalog.json`. Invalid JSON5 falls back to the bundled catalog. Vitest keeps using the bundled JSON unless the override path is set.
193
+ - **Bundled model catalog** — Static model data (CLI keys, ids, China-direct prefixes/env vars, OpenRouter China slugs, default URLs) lives in `src/models/catalog.json` and is loaded by `catalog.js`. Add an OpenRouter China slug, a direct provider row, a Krouter family, a Krouter combo, or a hand-crafted model in that file; `/model` listing and `--model` lookup do not need new JS exports. Resolver logic, Cursor CLI streaming, and OpenRouter compat stay in JS.
194
+ - **Krouter dashboard combos** — `handCrafted.krouter.combos` lists gateway combos as `--model krouter-rd` / `krouter-arch` / `krouter-pm` with ids `RD`, `ARCH`, `PM` (the names kRouter advertises on `/v1/models`, not `kr/RD`). Only `id` and `name` are stored; CLI keys are derived from the id. Fallback chains stay in the kRouter dashboard. Combos are not expanded into Kiro `-agentic` / `-thinking` variants.
195
+ - **Krouter on by default** — Curated `krouter-*` keys are listed and used in the env-walk without `KROUTER_ENABLED`. Opt out with `KROUTER_DISABLED=1` (legacy `KIRO_DISABLED`). `KROUTER_API_BASE` still overrides the default `http://localhost:20128/v1`.
196
+
197
+ ## [1.0.19] - 2026-08-20
198
+
199
+ ### Added
200
+
201
+ - **Shell natural-language fallback classifier** — Source `scripts/pithosai-nl-fallback.sh` from zsh (`command_not_found_handler`) or bash 4+ (`command_not_found_handle`). The hook stays thin: Node (`lookpath` + `tinyld` in `nl-fallback-classify`) scores how much the line looks like a shell command (0–100). A score of 50 or more keeps the normal "command not found" (or runs the real command). Uncertain scores below 50 ask a short LLM call for only `shell` or `natural`. Clear natural-language heuristics skip that call so Enter does not wait on Krouter. Matches run `pithosai --no-interactive --model krouter-glm-5-agentic "$input"`. Paths (`foo/bar`), flags (`foo --help`), PATH commands, and single-token typos keep "command not found". Hyphens inside words or file paths are not treated as flags. `finalize-dist` copies the script to `dist/pithosai-nl-fallback.sh`; rspack also emits `dist/nl-fallback-classify.mjs`. zsh sourcing sets `NO_NOMATCH` so `?`/`*` in questions is not treated as a glob.
202
+ - **NL fallback env vars** — `PITHOSAI_NL_FALLBACK=0` disables all interception; `PITHOSAI_NL_ZLE=0` disables the Enter intercept only; `PITHOSAI_NL_MODEL` (default `krouter-glm-5-agentic`); `PITHOSAI_NL_CLASSIFY_LLM=0` skips the classify LLM; `PITHOSAI_NL_DEBUG_LOG=1` prints classify/LLM/hook debug on stderr; `PITHOSAI_BIN` (default `pithosai`); `PITHOSAI_LANG` overrides locale for hook messages and `--lang`; `PITHOSAI_NODE` (default `node`). Tune the classify LLM with `PITHOSAI_NL_CLASSIFY_TIMEOUT_MS` (default 4000 ms), `PITHOSAI_NL_CLASSIFY_MODEL`, `PITHOSAI_NL_CLASSIFY_API_BASE`, and `PITHOSAI_NL_CLASSIFY_API_KEY`.
203
+
204
+ ### Fixed
205
+
206
+ - **NL fallback skipped hyphenated paths** — `please update … src/api-plugins/api-cettire-orders/…` was treated as a flag-like command because the line contained a space and a hyphen. Skip only tokens that start with `-` (`foo --help`), not hyphens inside words or paths. Re-sourcing the script reloads the skip logic.
207
+ - **zsh `parse error near 'files:'` / bash keyword parse error** — Interactive zsh (ZLE) and bash 4+ (readline `bind -x` on Enter) intercept Enter before parse so `for these files: …` / `for thest files: …` go to pithosai. The prompt is not rewritten to `pithosai --no-interactive …`. Real `PATH` commands are left alone. `PITHOSAI_NL_ZLE=0` disables the intercept.
208
+ - **NL classify overlong input** — Lines longer than 300 characters or more than 200 words score 10 and are treated as natural language with no LLM call. Typical interactive shell commands are never that long.
209
+ - **Overlong shell lines hijacked by NL fallback** — The overlong rule ran before path/flag/PATH checks, so a 300+ char `./script.sh …` or `git log --format=…` launched pithosai. Shell-looking lines now win over the length rule.
210
+ - **ZLE/readline ignored classifier failure** — When the classifier cannot run (missing node), the Enter intercept now prints the localized `classifyUnavailable` message instead of failing silently before the parse error.
211
+ - **NL fallback Enter hang** — Empty Enter no longer spawns Node. Strong NL lines (`for these files: …`, `add tests …`) skip the classify LLM. When the LLM *is* asked, zsh `zle -I` unfreezes the editor; no extra status text is printed.
212
+
213
+ ## [1.0.18] - 2026-08-20
214
+
215
+ ### Added
216
+
217
+ - **Shell natural-language fallback** — Source `scripts/pithosai-nl-fallback.sh` from zsh (`command_not_found_handler`) or bash 4+ (`command_not_found_handle`). Unknown commands that look like English/Chinese (or other natural language) run `pithosai --no-interactive --model krouter-glm-5-agentic "$input"`. Paths (`foo/bar`) and flag-like lines (space + hyphen) keep the normal "command not found" error. Disable with `PITHOSAI_NL_FALLBACK=0`. `finalize-dist` copies the script to `dist/pithosai-nl-fallback.sh` so global installs can source it from the package `dist/` directory. zsh sourcing sets `NO_NOMATCH` so `?`/`*` in questions is not treated as a glob.
218
+
219
+ ### Fixed
220
+
221
+ - **`--no-interactive` loading spinner** — One-shot runs no longer draw the stderr `Running…` spinner, which was splitting streamed assistant text across lines.
222
+ - **Duplicate TUI `Running…` when a follow-up is queued** — Showing or clearing the queued-follow-up footer row now dirty-marks one extra chrome line so the old spinner cannot remain above the `Queued:` line.
223
+ - **Duplicate `request: …` after submit** — The run header no longer reprints the user request in the CLI (the TUI already shows `You:`). The request is still written to the log file.
224
+ - **Duplicate `cwd …` in the TUI transcript** — The run header no longer prints the working directory in the CLI; the footer cwd/git line already shows it. Cwd is still written to the log file.
225
+ - **Stale transcript on the first TUI prompt** — The first `Running…` row grows the footer by one reserved line. That redraw now dirty-marks the extra chrome row so leftover startup text cannot sit above the footer. Later prompts keep the reserved row, so layout height stays stable.
226
+ - **TUI request-command logging** — cwd/git refresh failures in the interactive session are written with `logErrorToFile` instead of `console.error`, so they cannot desync the full-screen TUI.
227
+
228
+ ## [1.0.17] - 2026-08-19
229
+
230
+ ### Added
231
+
232
+ - **Extensible `/shell` TTY denylist** — Extra full-screen programs can be named in `PITHOSAI_TTY_COMMANDS` (comma/space-separated basenames) so they inherit the terminal like `tig`/`vim`. Built-in list also includes `hx`, `helix`, `micro`, `kak`, `ranger`, `lf`, `yazi`, `nnn`, `vifm`, `lazydocker`, `k9s`, and `btm`. Dual-mode CLIs (`git`, `python`, `node`) stay piped; use `/shell -i` to force a TTY.
233
+
234
+ ## [1.0.16] - 2026-08-18
235
+
236
+ ### Fixed
237
+
238
+ - **Git tools on reftable repositories** — `git_status`, `git_add`, `git_commit`, `git_log`, and `git_rollback` prefer the system `git` CLI so repos with `extensions.refstorage=reftable` no longer report every file as added or fail to resolve HEAD. Falls back to isomorphic-git only when `git` is not installed.
239
+ - **`/shell` interactive TTY programs** — `tig`, `vim`, `less`, and similar take over the terminal (the agent TUI is suspended) instead of running with piped stdio, which caused “no tty” failures or hangs. Use `/shell -i <command>` to force that for other programs.
240
+
241
+ ## [1.0.15] - 2026-08-13
242
+
243
+ ### Added
244
+
245
+ - **Live session skill refresh** — `/install-skill` and `/remove-skill` update the running interactive agent's `read_skill` tool and system-prompt skills list in place (no CLI restart or `/new` required).
246
+
247
+ ### Fixed
248
+
249
+ - **Interactive TUI chrome hidden while agent runs** — Stream/stderr updates use differential redraw with footer rows marked dirty in pi-tui `previousLines` (no full-screen clear/flash). Keeps task status, framed input, and cwd/git visible without `\x1b[2J`. Transcript scroll uses the same dirty-mark path and skips redraw when already at top/bottom.
250
+ - **Incomplete OpenAI-compatible streams** — When a provider closes the SSE stream without `finish_reason` (`Stream ended without finish_reason`), the agent continues instead of aborting the run. Partial text/tool calls are used as-is. Empty drops (common right after a tool result) retry the LLM turn; if retries still fail, the turn ends as a normal stop rather than an API error.
251
+ - **Invalid tool names (krouter 400 REQUEST_BODY_INVALID)** — When a model emits a garbled `toolCall` name (prose, XML tags, spaces), that name is stripped before the next LLM request so OpenAI-compatible gateways do not reject the body. Matching tool results are dropped as orphans.
252
+ - **Interactive TUI input box collapsing after submit** — Stream-recovery logging no longer writes to stdout/stderr (file-only), which was corrupting the alternate-screen prompt. Agent stream/stderr updates also repaint the footer after differential render so the framed input border stays intact.
253
+ - **Interactive TUI input top border cleared on mouse-wheel scroll** — Transcript scroll uses differential footer dirty-mark (same as stream updates) and skips redraw at top/bottom; chrome stays visible without a full-screen clear.
254
+ - **Interactive TUI bottom cwd/git line** — Under the framed input, show `<cwd> - git <branch>` (path ≤50% width, branch ≤40%, `...`+tail truncation; path-only when not a git repo). Refreshes on session start, project cwd changes, before/after each agent turn, after `/shell` (non-cd) commands, and every ~2s while an agent run is active so same-directory `git switch`/`checkout` updates the footer mid-run. Redraws only when cwd or branch changed, using differential footer dirty-mark (no flash). Branch resolution prefers system `git` (reftable-aware) so repos with `.git/HEAD` → `refs/heads/.invalid` show the real branch.
255
+
256
+ ## [1.0.15] - 2026-08-10
257
+
258
+ ### Added
259
+
260
+ - **Krouter (Kiro provider)** — CLI models can call a local OpenAI-compatible Krouter gateway (default `http://localhost:20128/v1`) via `krouter.js`. Enable with `KROUTER_API_BASE` or `KROUTER_ENABLED=1` (legacy `KIRO_*` still accepted); API key optional. Curated keys cover working Kiro-provider families: `krouter-glm-5*`, `krouter-minimax-*`, `krouter-deepseek-*` (composite `krouter/<model_id>` / `kiro/<model_id>`). Env-walk default is `kr/glm-5`, after Ollama and before OpenRouter.
261
+
262
+ ## [1.0.14] - 2026-07-18
263
+
264
+ ### Added
265
+
266
+ - **Desktop auto-update (electron-updater)** — NPC platform Electron app checks a generic HTTPS CDN feed (`NPC_PLATFORM_UPDATE_URL`) for newer installers. Throttled background check on launch (24h, `~/.pithosai/desktop-auto-upgrade-check.json`); Settings → About for manual check / progress / restart-and-install; tray **Restart to update** when ready. `NPC_PLATFORM_AUTO_UPGRADE=0` disables background checks only. Clean `AppDaemon.shutdown` before `quitAndInstall`.
267
+
268
+ ## [1.0.14] - 2026-07-10
269
+
270
+ ### Added
271
+
272
+ - **Dual-mode project file browser** — Sidebar browser supports **Docs**, **Source**, and **All** modes. **Docs** is markdown-only. **Source** includes markdown docs plus code/config files (`.js`, `.py`, `.json`, etc.); ARCH/RD/QA/SRE NPCs default here. **All** is reserved for manual use. Markdown uses Vditor preview; source text files use CodeMirror 6. New scopes: `projects.browse_source` (L3), `chat.source_preview` (L3), `chat.source_edit` (L5). New WebSocket handlers: `read_source_file`, `write_source_file`. Shared modules: `project-file-kinds.js`, `project-file-path.js`.
273
+ - **Git tooling (`isomorphic-git`)** — New dependency and `src/agent/tools/git/` module consolidates project versioning, `.gitignore` patterns, workspace snapshots, and agent function-call tools. On **create project** or **switch project** (CLI `/create-project`, `/switch-project`, and npc-platform WebSocket handlers), the app checks whether the workspace is versionized; if not, it runs `git init`, ensures a standard `.gitignore` (JavaScript, Python, Java, Go, Rust, Dart, C/C++, PHP), and creates an initial commit with a summarized message. Agent tools: `git_status`, `git_init`, `git_add`, `git_commit`, `git_log`, `git_rollback` (soft/mixed/hard local rollback; refuses root commit). CLI output for git tool runs is localized (`tools.gitStatus`, `tools.gitInit`, etc.).
274
+
275
+ - **Code review tool (`code_review`)** — After generating docs or code, NPCs call `code_review` to spawn a read-only `deepseek-v4-pro` subagent over uncommitted changes (default all; optional `path` / `filepaths` / `focus`). Returns findings only; the parent agent applies fixes then commits via `git_commit` with an AI-generated message. Wired like `task` via SubagentRegistry (main agent only; not nested).
276
+
277
+ - **WeChat Pay (China market)** — New `src/payments/` server module integrates the Circle order gateway (`get-new-order-id`, `prepay-qrcode`, `query-order-status`). NPC platform WebSocket handlers: `create_wechat_payment`, `query_payment_status`. **Upgrade Your Plan** dialog (China build) renders a live WeChat Pay QR code, polls payment status, and refreshes account level after success.
278
+
279
+ ### Changed
280
+
281
+ - **Git snapshot without shell `git`** — `workspace-snapshot.js` now uses isomorphic-git `statusMatrix` instead of `git rev-parse` / `git status --porcelain` subprocess calls. Run-report git diffs (`session-run-report.js`, `request-command.js`) use the same path.
282
+
283
+ - **`.gitignore` merge on existing projects** — When `.gitignore` already exists, missing standard patterns are appended (existing lines preserved) before the initial commit.
284
+
285
+ ### Tests
286
+
287
+ - Unit tests for `project-git-init`, `gitignore-patterns`, `workspace-snapshot` (statusMatrix mapping), `git-operations`, `git-tools`, `code-review-tool`, and core tool registration (`index.test.js`).
288
+
289
+ ## [1.0.14] - 2026-07-05
290
+
291
+ ### Fixed
292
+
293
+ - **Ollama native `/api/chat` for `ollama-qwythos-9b-q8`** — The `qwythos-9b-q8` model previously used the OpenAI-compatible endpoint (`/v1/chat/completions`), which caused the `edit` tool to consistently fail. Switched this model to a custom `ollama-native` pi-ai provider that calls Ollama's native `/api/chat` via the official `ollama` JS SDK. The provider stream adapter (`ollamaNativeStream`) maps native response chunks to `AssistantMessageEventStream` events compatible with the existing agent pipeline. Added `registerOllamaNativeProvider()` in `config.js` (triggered when resolving `ollama-qwythos-9b-q8` or `ollama/qwythos-9b-q8` keys). Updated model definition (`ollama.js`), unit tests (`ollama-native-provider.test.js`, `ollama.test.js`, `config.test.js`), and docs (`src/models/README.md`).
294
+
295
+ ### Added
296
+
297
+ - **Market research report** — `pre-product/MKT/pithosai-market-research-report.md`: Comprehensive product and competitive analysis based on full source code audit (agent-orch, agent, npc-platform, models, storage, i18n, skills, hooks), document review (README, CHANGELOG, ARCHITECTURE, pro-product, pre-product), and competitive landscape mapping (Claude CLI, Cursor, Copilot, CrewAI, Dify, Coze, LangFlow, Cherry Studio, Warp, AutoGPT). Covers technical maturity assessment, code asset inventory, competitive matrix, ICP refinement, market sizing validation, narrative optimization, and prioritized action recommendations.
298
+
299
+ ## [1.0.14] - 2026-07-04
300
+
301
+ ### Added
302
+
303
+ - **Agent orchestration shell scripts (`src/agent-orch/`)** — Revamped `run.sh` to accept `--roles` (comma-separated list) and `--request` arguments, auto-dispatching the request to each role sequentially. Each role receives the previous role's report JSON as context, enabling multi-step agent chains. Added `dispatch_roles()` to `base.sh` for reuse in other shell scripts. Updated README and CHANGELOG. (`src/agent-orch/run.sh`, `src/agent-orch/base.sh`, `src/agent-orch/READEM.md`, `README.md`, `CHANGELOG.md`)
304
+
305
+ - **Marketing deliverables (v2.1)** — Consolidated and evolved all marketing strategy materials:
306
+ - `pre-product/MKT/pithosai-market-strategy-v2.1.md` — Unified market strategy doc merging whitepaper v2.0, product intelligence v1.1, and orchestration platform analysis; includes updated competitive matrix (with orchestration/code-generation dimensions), unified message architecture (3-layer narrative + 4 pillars), channel-to-message mapping, orchestration platform MVP scope, measurement framework, and 90-day GTM roadmap.
307
+ - `pre-product/MKT/pithosai-orchestration-platform-brief.md` — Product brief for orchestration platform MVP (MKT↔PM alignment): scope, tech feasibility, ROI, demo script, success criteria.
308
+ - `pre-product/MKT/pithosai-mkt-cheat-sheet.md` — Updated to v2.1 (two positioning variants, new competitive sound bites for Dify/Coze/CrewAI, updated file index).
309
+
310
+ ## [1.0.14] - 2026-07-04
311
+
312
+ ### Fixed
313
+
314
+ - **CLI `/model` command uses wrong API key for OpenRouter DeepSeek models** — When typing `/model deepseek-deepseek-v4-flash` in the CLI REPL, `resolveModelConfigByKey()` unconditionally routed all `deepseek-*` keys to the direct DeepSeek API (`DEEPSEEK_API_KEY`), even when the key-to-model entry had `provider: "openrouter"`. Now it checks `model?.provider === "deepseek"` before using the direct DeepSeek API key, so OpenRouter DeepSeek models correctly fall through to `OPENROUTER_API_KEY`. This matches the NPC client behavior where the model was already specified as `openrouter/deepseek/deepseek-chat`. (`config.js`, `config.test.js`)
315
+
316
+ - **Skills sidebar authorization error** — `skills.installed` and `skills.toggle` were gated at L4 while `skills.market`, `skills.install`, and `skills.remove` required L5, causing an account authorization mismatch. Unified all skills scopes to L5 minimum so the Settings sidebar now disables the Skills nav item consistently when the account level is below L5. Updated `account-level-features.json` across all 12 locales to reflect that skills (installed + market) begin at L5. (`account-scopes-config.js`, `account-level-features.json`, `SettingsPage.test.jsx`, `account-level-utils.test.js`)
317
+
318
+ - **Infinite WebSocket loop in Account Level panel** — Fixed a bug where `requestAccountLevelFees` in `App.jsx` was a plain function (recreated on every render), causing `SettingsAccountLevelPanel`'s `useEffect` to fire repeatedly and trigger an infinite loop of `get_account_level_fees` requests. Wrapped with `useCallback` with an empty dependency array to stabilize the function reference. (npc-platform/client)
319
+
320
+ ## [1.0.14] - 2026-06-30
321
+
322
+ ### Added
323
+
324
+ - **Account Level in Settings** — The Settings panel now includes an **Account → Account Level** section showing current plan (FREE / L1 / L2), fee structures (CNY for China mainland, USD for global), and upgrade/downgrade controls with a two-tab L1/L2 comparison dialog. Level changes are applied immediately. (`README.md`)
325
+
326
+ - **Global OpenRouter models** — When `OPENROUTER_API_KEY` is set, non-China models from the OpenRouter catalog are now indexed in `KEY_TO_MODEL`. CLI keys follow the same `{provider-slug}-{model-id}` pattern: `anthropic-claude-sonnet-4`, `openai-o4-mini`, `google-gemini-2-5-pro`, `meta-llama-4-maverick`, `mistral-mistral-large-2411`, `cohere-command-a`, and more. Self-referential `openrouter/…` slug models are skipped (they don't produce usable key entries). (`key-to-model.js`)
327
+
328
+ - **Anthropic reasoning compat** — Claude Sonnet 4, Claude Opus 4, and other Anthropic reasoning models are flagged as mandatory-thinking models via `openrouter-reasoning.js`. pi-ai no longer sends `reasoning: { effort: "none" }` for these models (OpenRouter requires `reasoning` in the request even when effort is optional). (`openrouter-reasoning.js`)
329
+
330
+ - **Unified `enhanceOpenRouterModel()`** — Refactored to handle both China and global OpenRouter models in one function. China-only slugs (Qwen, Moonshot, Baidu, …) disable developer role via `compat.supportsDeveloperRole: false`; Anthropic reasoning models also get this compat. Old `enhanceOpenRouterChinaModel()` preserved as an alias. (`openrouter-reasoning.js`)
331
+
332
+ - **Global provider examples in README** — Both `src/models/README.md` and `README.md` updated with global OpenRouter usage examples, slug tables, and merge-order documentation.
333
+
334
+ ### Changed
335
+
336
+ - **`key-to-model.js`** — Non-China OpenRouter models now pass through to `KEY_TO_MODEL` instead of being excluded. Self-referential `openrouter/…` slug models are filtered out to avoid duplicate entries. (`key-to-model.js`)
337
+ - **`openrouter-reasoning.js`** — `enhanceOpenRouterChinaModel()` generalized to `enhanceOpenRouterModel()` (alias kept). `isMandatoryOpenRouterReasoningModel` now handles all OpenRouter reasoning models uniformly (including Anthropic) via the catalog `reasoning: true` flag.
338
+
339
+ ### Tests
340
+
341
+ - Unit tests added for `key-to-model.js` global OpenRouter filtering, `openrouter-reasoning.js` with Anthropic models, and `enhanceOpenRouterModel()` edge cases (self-referential slugs, hybrid reasoning, developer role suppression).
342
+
343
+ ## [1.0.14] - 2026-06-29
344
+
345
+ ### Added
346
+
347
+ - **Embedded `/image <path>` in idle REPL / script requests** — Initial single-image support via `parseEmbeddedImageFromRequest`. (Deprecated by 1.1.4 multi-image support.)
348
+
349
+ ## [1.0.14] - 2026-06-10
350
+
351
+ ### Added
352
+
353
+ - **`@` file and directory completion** — Shared modules under `src/completion/`: `at-mention-utils.js` (token parse/apply), `at-path-suggestions.js` (project file listing via `fd` with `readdir` fallback), and `project-path-sandbox.js` (path confinement under project root). Suggestions include all project files; `.git`, `node_modules`, `dist`, and `.pithosai` are excluded. **TUI / readline:** `createPithosReplAutocompleteProvider` in `repl-completer.js` triggers on `@` before `/`; Tab uses sync suggestions. **NPC platform web:** main and thread composers request completions over WebSocket (`complete_at_path` → `at_path_completion_result`) via `use-at-path-completion.js` and `AtPathSuggestionList.jsx` (`ChatMainComposer.jsx`, `ThreadSidePanel.jsx`, `App.jsx`). Completion only — selecting a path does not inject file contents into the prompt on send.
354
+
355
+ - **Integration test suite** — `vitest.integration.config.js` with `npm run test:integration` and `test:all`; shared harness under `test/helpers/` (`temp-db`, `temp-project`, `ws-client`, `run-cli`, `stub-agent-runner`). Cross-module tests: WebSocket server (`server.integration.test.js`, replaces `server.test.js`), `@` completion (`at-path.integration.test.js`), task persistence (`task-persistence.integration.test.js`), and CLI subprocess smoke (`test/integration/cli-smoke.integration.test.js`). `PITHOSAI_AGENT_STUB=1` skips LLM calls for deterministic `--no-interactive` CLI runs (`run.js`).
356
+
357
+ ### Changed
358
+
359
+ - **Vitest layout** — `npm test` runs unit tests only (excludes `*.integration.test.js` and `test/integration/**`); integration tests use a separate config with 60s timeout and `fileParallelism: false` for SQLCipher / port binding stability (`vitest.config.js`, `vitest.integration.config.js`).
360
+
361
+ ### Tests
362
+
363
+ - Added unit tests for `at-mention-utils`, `at-path-suggestions`, `project-path-sandbox`, `use-at-path-completion`, and `server-handler` `complete_at_path` handling; extended `repl-completer.test.js` and `ChatMainComposer.test.jsx`. Added `PITHOSAI_AGENT_STUB` cases in `run.test.js`.
364
+
365
+ ---
366
+
367
+ ## [1.1.14] - 2026-06-29
368
+
369
+ ### Added
370
+
371
+ - **Multiple `/image <path>` directives per request** — `parseEmbeddedImageFromRequest` now supports multiple embedded image directives at any position (start, middle, end of request text). Each is extracted, read from disk, and removed from the cleaned request. The API changed to return `imagesWithPaths: Array<{image, rawPath}>` and `errors: Array<{rawPath, resolvedPath}>` for accurate path reporting in partial failure cases. (`runtime-input.js`, `request-command.js`)
372
+
373
+ ### Changed
374
+
375
+ - **Refined `/image` regex** — Uses `(?:^|\s)/image\s+(\S+)` with word-boundary matching to avoid false positives (e.g., `some/image path` mid-word). Uses `String.matchAll()` instead of mutable module-level RegExp with `lastIndex`. (`runtime-input.js`)
376
+
377
+ - **Partial failure handling** — When some images succeed and some fail, the request proceeds with the successful images. When all images fail but the request still contains text, the text is submitted without images (instead of silently discarding it). (`request-command.js`)
378
+
379
+ - **Readline layer integration** — When `/image <path>` is typed before the runtime has a running agent (idle REPL or script request), it is now handled in the `executeRunWithGuard` flow alongside request submission, enabling multi-image support in both modes. (`request-command.js`)
380
+
381
+ ### Fixed
382
+
383
+ - **Wrong path labeling on partial failures** — `rawPaths` indexing in the reporting loop used `attachedCount` vs. `rawPaths` match position, causing successful images to be labeled with the wrong file path when some images failed. Now raw paths are paired with each image from the parse step. (`request-command.js`)
384
+
385
+ - **Complete i18n translation for account-level features** — Fixed remaining untranslated strings in `account-level-features.json` (NPC Platform Client). Added translation dicts and script for zh, zh-Hant, ja, ko, ar, de, es, fr, it, nl, pt locales covering plan names, feature labels, subtitles, planDetails, and free-plan details. (`src/npc-platform/client/shared/json/account-level-features.json`, `scripts/translate-*.mjs`)
386
+
387
+ ## [1.0.13] - 2026-06-10
388
+
389
+ ### Added
390
+
391
+ - **Script-mode JSON reports** — `--report-json <path>` writes a v1 JSON array (one object per agent run: `taskId`, `role`, `mode`, `files`, exit metadata, git/tool file buckets). `--json` prints the same array on stdout; banner and agent output are suppressed in one-shot script mode. Interactive sessions with `--report-json` append per turn and flush on `/exit`, `/role`, or `/mode` (`run-report.js`, `session-run-report.js`, `workspace-snapshot.js`, `run-outcome.js`).
392
+
393
+ - **`--task-id <id>`** — Main `pithosai` command accepts an explicit task id (default: new UUID per invocation). Stable across script orchestration and cron jobs with `taskIdStrategy: reuse` (`request-command.js`).
394
+
395
+ - **`/mode` REPL command** — Show current run mode, list `agent` / `dialog` / `plan`, or switch mode in-session. Autocomplete excludes the active mode (`request-command.js`, `repl-completer.js`, all locale files).
396
+
397
+ - **`/model` REPL inspect** — No arg or `list` shows the current model label and available `KEY_TO_MODEL` keys before switching (`request-command.js`).
398
+
399
+ - **Scheduled cron tasks** — New `pithosai_cron_task` SQLite table, agent tools (`create_cron_task`, `list_cron_tasks`, `update_cron_task`, `delete_cron_task`), and `pithosai cron-daemon` to load schedules from the DB and run agents on `CommandLane.Cron` via `node-cron`. Optional `model` key per job; configurable `taskIdStrategy` (`reuse` or `new_each_run`) (`cron-task-model.js`, `cron-tools.js`, `cron-daemon.js`, `cron-daemon-command.js`).
400
+
401
+ - **Agent orchestration scripts** — `src/agent-orch/` shell helpers chain multi-role `pithosai --no-interactive --report-json` runs with a shared `--task-id`.
402
+
403
+ - **NPC platform cron daemon** — Starting the NPC platform server also starts the cron daemon in the background (`server.js`).
404
+
405
+ ### Changed
406
+
407
+ - **One-shot agent runs** — `--no-interactive` uses a dedicated execution path with process exit codes 0 (success), 1 (failure), and 2 (stopped) for shell automation (`request-command.js`, `run-outcome.js`).
408
+
409
+ - **Skills directory** — `--skills-dir` is preferred when set; otherwise falls back to the default skills path (`request-command.js`).
410
+
411
+ - **Models documentation** — `src/models/README.md` updated for 1.0.13: REPL `/model` and `/mode`, script-mode reports, `--task-id`, cron model keys, and orchestration examples.
412
+
413
+ ### Fixed
414
+
415
+ - **`writeRunReport` nested paths** — Creates parent directories before writing `--report-json` output (`run-report.js`).
416
+
417
+ - **`proxy_download` tool** — Truncated response body when downloading large files (`pi-agent-tools.js`).
418
+
419
+ ## [1.0.12] - 2026-06-04
420
+
421
+ ### Added
422
+
423
+ - **China-mainland model providers** — `KEY_TO_MODEL` now merges OpenRouter China slugs (qwen, baidu, stepfun, tencent, …) with pi-ai direct catalogs when env keys are set: Kimi Code (`KIMI_API_KEY`), Moonshot (`MOONSHOT_API_KEY`), MiniMax (`MINIMAX_API_KEY`, `MINIMAX_CN_API_KEY`), Z.ai (`ZAI_API_KEY`), Xiaomi (`XIAOMI_API_KEY`). New modules: `china-pi-ai-providers.js`, `provider-env.js`, `openrouter-reasoning.js`; hand-crafted `kimi.js` removed in favor of pi-ai catalogs (`key-to-model.js`, `config.js`).
424
+
425
+ - **Models documentation** — `src/models/README.md` documents provider categories, env var table, OpenRouter CLI key patterns, resolution order, and OpenRouter compat notes (mandatory thinking, developer role).
426
+
427
+ - **Ollama Qwen tool calling** — `ollama-qwen25` and `ollama-qwen25-coder` set `supportsTools: true` so agent mode exposes the full toolset over local Ollama (`ollama.js`).
428
+
429
+ ### Changed
430
+
431
+ - **Agent session cache key** — `buildAgentSessionCacheKey` resolves the active model via `resolveModelConfigForAgentOpts` (e.g. `resolved:kimi-coding:kimi-for-coding`) so env-only provider switches and `/model` changes invalidate the cached agent correctly (`agent-session.js`).
432
+
433
+ - **OpenRouter China compat** — Mandatory-thinking models (ids/names containing `thinking`) default agent `thinkingLevel` to `medium` and avoid `reasoning: { effort: "none" }`. China OpenRouter slugs set `compat.supportsDeveloperRole: false` so Qwen and similar APIs receive `system` instead of `developer` for the system prompt (`openrouter-reasoning.js`, `bootstrap.js`, `messages-pi-ai-compat.js`).
434
+
435
+ - **Task message restore (`PHI_MESSAGES_DISABLED`)** — When `PHI_MESSAGES_DISABLED=true`, the agent no longer applies phi user-turn trimming while loading persisted task messages; it restores full chronological history instead. Default behavior is unchanged when the variable is unset or not `"true"`.
436
+
437
+ - **`/model` autocomplete** — Ollama Qwen keys with `supportsTools: true` appear in REPL model switch suggestions; `ollama-deepseek-r1` remains excluded (chat-only) (`repl-completer.js`).
438
+
439
+ ### Fixed
440
+
441
+ - **OpenRouter Qwen thinking models** — HTTP 400 “Reasoning is mandatory for this endpoint and cannot be disabled” when using keys such as `qwen-qwen3-vl-235b-a22b-thinking` or `qwen-qwen-plus-2025-07-28:thinking`.
442
+
443
+ - **OpenRouter China reasoning models** — HTTP 400 “developer is not one of ['system', 'assistant', 'user', …]” when `reasoning: true` models received a `developer` system prompt.
444
+
445
+ - **Unit tests** — `run.test.js`, `config.test.js`, `bootstrap.test.js`, `repl-completer.test.js`, and model module tests updated for pi-ai env helpers and Ollama tool flags.
446
+
447
+ ## [1.0.11] - 2026-05-28
448
+
449
+ ### Added
450
+
451
+ - **Runtime input (steer & follow-up) while agent runs** — In the TUI, submit plain text to **queue a follow-up** for the current run; type `/note <body>` to **steer** the agent after the current turn. Queued messages display on a dimmed row below the running indicator. An `AgentSessionRef` caches the bootstrapped agent per interactive session (cleared on `/new` or project switch) so sequential requests reuse the same agent instance (`agent-controller.js`, `agent-runtime-messages.js`, `agent-session.js`, `runtime-input.js`, `queued-follow-up-format.js`, `agent-tui-repl.js`, `request-command.js`, `repl-completer.js`, all 12 locale files).
452
+
453
+ - **TUI text wrapping at startup** — Long startup hint text (descriptions, URLs) now wraps to terminal width via `wrapTextToTerminalLines()`; the old complex `note.js` display is replaced by a simple word-wrap utility (`wrap-text.js`, `agent-tui-repl.js`, `request-command.js`).
454
+
455
+ - **Skills: read skill tools** — Skills installed via ClawHub can now expose their tool definitions. `readSkillTools(path)` reads tool metadata from a skill package; tools are included in the system prompt during agent bootstrapping (`skills/loader.js`, `skills/index.js`, `bootstrap.js`, `system-prompt-builder.js`, `skills-operations.js`).
456
+
457
+ - **NPC platform mobile/responsive UI** — The web client (`App.jsx`, `AppHeader.jsx`, `index.css`) now supports responsive/mobile layouts. Added 10 new React component test files covering ChatHeader, ChatMainComposer, CreateProjectModal, MessageRow, MessagesTimeline, NpcWorkingInlineSign, ProjectPanel, TeamPanel, ThreadGroupSection, and ThreadSidePanel.
458
+
459
+ - **ARCH NPC role** — New `ARCH` (Architecture Design) role with full template set (`templates/ARCH/IDENTITY.md`, `ABILITIES.md`, `AGENTS.md`, `TOOLS.md`, `README.md`, plus Chinese variants). All NPC templates (CO, MKT, PM, QA, SRE, WR, RD) updated to reference ARCH. Database schema (`pithosai.sql`) updated with ARCH role and permissions.
460
+
461
+ - **Sub Agent** — Sug Agent module added
462
+
463
+ ### Changed
464
+
465
+ - **`jsconfig.json`** — Added `"ignoreDeprecations": "5.0"` to silence deprecation warnings.
466
+
467
+ ### Fixed
468
+
469
+ - **TUI scroll transcript hint** — Simplified the i18n hint text to remove scroll-specific verbiage; startup text no longer overflows terminal width.
470
+
471
+ ### Tests
472
+
473
+ - Added 16 new test files: `agent-runtime-messages.test.js`, `agent-session.test.js`, `runtime-input.test.js`, `queued-follow-up-format.test.js`, `wrap-text.test.js`, plus 10 NPC platform React component test files. Updated existing tests for bootstrap, skills-loader, system-prompt-builder, skills-operations, agent-tui-repl, repl-completer, App, and AppHeader.
474
+
475
+ ## [1.0.11] - 2026-05-09
476
+
477
+ ### Changed
478
+
479
+ - **NPC platform client frontend stack** — Replaced the legacy jQuery + classic-script runtime entry in `src/npc-platform/client/index.html` with a Vite + React entrypoint (`main.jsx`, `App.jsx`) while preserving the existing WebSocket protocol (`ws://localhost:3001`) and key UI behaviors (projects/team/chat/thread panel/create project modal/autopilot).
480
+
481
+ - **Frontend packaging/runtime** — Added Vite build/dev/preview scripts (`dev:npc-platform-client`, `build:npc-platform-client`, `preview:npc-platform-client`), React dependencies, and a dedicated Vite config at `src/npc-platform/client/vite.config.js`. Production assets now build to `dist/npc-platform-client/`.
482
+
483
+ - **Client rendering utilities** — Added module-based markdown and state helpers (`markdown-utils.js`, `state-utils.js`) for safe message rendering and thread timeline metadata logic used by the React client.
484
+
485
+ - **Frontend module split** — Moved NPC platform frontend dependencies into a dedicated package at `src/npc-platform/client/package.json`; root scripts now proxy to the frontend module via `npm --prefix ./src/npc-platform/client ...` so backend/CLI package dependencies stay focused on Node runtime concerns.
486
+
487
+ - **NPC platform web UI theme** — Unified **cyan / ice** palette for chrome, selections (team, project, active thread), buttons, and hover fills; removed bright red/pink/orange emphasis (`index.css` CSS variables).
488
+
489
+ - **NPC platform chat bubbles** — Distinct **`--user-bubble-bg`** (lighter slate-teal for client) vs **`--npc-bubble-bg`** (deeper navy-cyan for assistant) on the main timeline (`index.css`).
490
+
491
+ - **NPC platform web UI layout** — The projects/team sidebar and the thread reply panel widths are adjustable by dragging vertical splitters; sizes persist in cookies across reloads (`npc-platform-layout-prefs.js`, `App.jsx`, `index.css`).
492
+
493
+ - **NPC platform team roster** — Added a filter field above the team member list (name, id, role, personality, last-chat snippet); state lives in `App.jsx` (`teamFilter`), filtering in `team-member-filter.js`.
494
+
495
+ - **NPC platform message timestamps** — Main timeline and thread side panel show message creation time; history loads `created_at` from SQLite via `listNpcMessages` / `listNpcMessagesByTaskId` (`createdAt` on rows). Live `{ type: 'message' }` WebSocket frames include **`created_at`** / **`createdAt`** from `insertNpcMessage` (assistant row); client falls back to local time if missing (`npc-factory.js`, `App.jsx`).
496
+
497
+ - **NPC platform pending reply hint** — After you send a message, a **separate NPC-styled bubble** (not inside your user bubble) shows **who** is replying and a **role-specific activity** line with lightweight CSS motion until the assistant reply arrives (`npc-role-working-status.js`, `NpcWorkingInlineSign.jsx`, `MessageRow.jsx`, `ThreadSidePanel.jsx`, `App.jsx`). Activity **cycles through several phrases per role**, switching on a **random 1–3s** interval.
498
+
499
+ - **NPC platform project switching** — Avoid redundant `switch_project` calls and “Switched to project…” system noise when the workspace path already matches (normalized comparison trims and ignores trailing slashes). Re-clicking the active project card does nothing (`project-selection-utils.js`, `App.jsx`, legacy `index.js`).
500
+
501
+ ### Documentation
502
+
503
+ - **README and npc-platform docs** — Documented the new two-terminal workflow (backend WebSocket server + Vite frontend server), HTTP URL, and build/preview commands for the NPC platform web client.
504
+
505
+ ### Fixed
506
+
507
+ - **Vitest + NPC web client** — Root `vitest` excludes the whole `src/npc-platform/client/` tree from test discovery (separate npm package). `npm test` / `npm run test:watch` pass `--config vitest.config.js` so the exclude always applies. Run `npm run test:npc-platform-client` for the web UI suite. Root `devDependencies` include `dompurify` and `jsdom` for editors/tooling that resolve modules from the repo root.
508
+
509
+ - **NPC platform chat persistence on reload** — User/client chat lines were inserted only after the model run finished, so refreshing the browser during a slow reply dropped the sent message from history. `processChatMessage` now persists the inbound row before awaiting `agentRunner` (`npc-factory.js`).
510
+
511
+ - **NPC platform legacy SQLite** — Older `messages` tables without a **`created_at`** column caused history queries (`SELECT … created_at`) to fail so reload showed an empty timeline. `initNpcPlatformSchema` now adds and backfills **`created_at`** when missing; **`insertNpcMessage`** sets it explicitly via `datetime('now')` (`npc-platform-model.js`). Restart the NPC platform server once so migration runs on your DB.
512
+
513
+ ### Fixed
514
+
515
+ - **NPC platform `notify_npc`** — Delegation shares **one task id** with the current agent run: the active `task.id` is stored in the tool context (`agentTaskId`), so LDR does not need to pass `taskId` manually; recipients continue that task (`newTask: false`) unless you override. If there is no running task id (e.g. tools invoked outside a normal agent run), behavior falls back to minting a new session when needed so cold teammates still run; the npc-platform deliver path also defaults sensibly when `taskId`/`newTask` are omitted.
516
+
517
+ ## [1.0.10] - 2026-05-04
518
+
519
+ ### Changed
520
+
521
+ - **Build scripts revamped** — Removed `scripts/sync-vendor-pi-mono.js` and its test. The pi-mono vendor sync step is eliminated from the publish pipeline; development and release builds no longer copy `@mariozechner/*` packages from `lib/pi-mono` into `vendor/`. The `vendor:sync`, `build:pi-mono-for-release`, and `prepublishOnly` npm scripts were cleaned up.
522
+
523
+ - **Rollback to published `@mariozechner` libs** — Dependencies switched from `file:lib/pi-mono/packages/*` to the published npm versions (`@mariozechner/pi-coding-agent`, `@mariozechner/pi-ai`, etc.) in `dependencies` and `optionalDependencies`. The `vendor/` directory is removed from `.gitignore` (no longer used) and from `files` in `package.json`.
524
+
525
+ - **Role binary shims consolidated** — Removed root-level entry shims (`cosai.js`, `mktai.js`, `pmsai.js`, `qasai.js`, `rdsai.js`, `wrsai.js`). Role binaries now ship as POSIX shell wrappers under `scripts/bin-shims/`, copied to `dist/` by `scripts/copy-role-bin-shims.js` during `finalize-dist`.
526
+
527
+ - **npm release configuration** — `.npmignore` added; `package.json` `files` narrowed to only the needed distribution entries. Publish script (`npm-publish-package-json.js`) updated to handle the simplified layout.
528
+
529
+ ### Fixed
530
+
531
+ - **Role binary shebang/entry resolution** — Shell wrappers (`scripts/bin-shims/*`) now reference the correct path to `pithosai.mjs` after the dist layout change.
532
+
533
+ - **Missing description column for v1.0.8** — The `description` field in `package.json` was missing during the 1.0.8 release cycle; restored.
534
+
535
+ ### Removed
536
+
537
+ - **`cosai.js`, `mktai.js`, `pmsai.js`, `qasai.js`, `rdsai.js`, `wrsai.js`** — Root-level entry shims replaced by `scripts/bin-shims/`.
538
+
539
+ ## [1.0.9] - 2026-05-04
540
+
541
+ ### Fixed
542
+
543
+ - **Global `npm install -g`** — Development continues to depend on **`file:lib/pi-mono/packages/...`**. **`prepublishOnly`** runs **`build:pi-mono-for-release`** (build pi-mono packages and **`vendor:sync`**). On **`npm pack` / `npm publish`**, **`prepack`** rewrites **`@mariozechner/*`** to **`file:vendor/...`**, adds **`vendor`** to **`files`**, and merges transitive **`dependencies` / `optionalDependencies`** from **`vendor/@mariozechner/*/package.json`** into the root manifest (skipping the four shipped **`@mariozechner/*`** names) so global installs resolve modules that nested **`file:`** installs omit.
544
+
545
+ ### Changed
546
+
547
+ - **Role CLI binaries** — **`pmsai`**, **`qasai`**, **`cosai`**, **`rdsai`**, **`mktai`**, and **`wrsai`** are no longer separate rspack bundles; they ship as POSIX shell wrappers copied into **`dist/`** during **`finalize-dist`** that exec **`node …/pithosai.mjs`** with the appropriate role flags.
548
+
549
+ - **`uuid`** — Bumped to **`^14.0.0`** to align with **`@mariozechner/pi-coding-agent`**.
550
+
551
+ - **`prepublishOnly`** — Runs **`npm run build:pi-mono-for-release && npm run build`** again so releases always sync **`vendor/`** from local **`lib/pi-mono`** before the rspack bundle.
552
+
553
+ - **`scripts/npm-publish-package-json.js`** — Restored **`rewriteDepsAndFilesForPublish`**, **`mergeVendorTransitiveDependencies`**, and **`semver`** for range merging; **`preparePackageJsonForPublish`** applies script stripping plus vendor rewrite plus merge.
554
+
555
+ ## [1.0.8] - 2026-05-02
556
+
557
+ ### Added
558
+
559
+ - **Interactive `/grill-me`** — The REPL recognizes **`/grill-me`** (optional focus line) and sends the Matt Pocock-style alignment user prompt from **`src/cli/grill-me-prompt.js`** (English, Simplified Chinese for **`zh`** / **`zh-cn`**, Traditional Chinese for **`zh-Hant`** / **`zh-tw`** / **`zh-hk`** according to **`--lang`** or settings), with localized ack lines **`cli.grillMeAck`** / **`cli.grillMeTopic`**. **`.cursor/skills/grill-me/SKILL.md`** mirrors the English instructions for Cursor agents. Tab completion includes `/grill-me`.
560
+
561
+ - **Virtual project slash commands** — **`/create-project`** registers `{ name, path, lang, description }` in **`~/.pithosai/projects.json`**, creates the directory if needed, **`chdir`** to it, and starts a **new task id** (and clears cached persisted-task **`/list`**). With **no text after the command**, the current directory is used: if already registered, the same output as **`/show-project`**; otherwise it registers with the folder name, **`lang`** matching the **CLI locale**, and a default description. **`/list-project`** prints index / name / path. **`/show-project`** prints cwd and matching registry metadata when the cwd equals a saved **`path`**. **`/switch-project <index>`** selects from that list and **`chdir`** (also new task id). Persisted-task **`/list`** no longer matches **`/list-project`** / **`/list-skill`** by prefix.
562
+
563
+ - **`/shell cd` command** — The interactive REPL supports **`/shell cd <dir>`** to change the working directory in-process. Subsequent `/shell` commands and project resolution use the new directory. Supports `~` (home directory) expansion. Includes localized error messages.
564
+
565
+ - **`cd` / `ls` directory history** — Directory navigation is tracked via **`src/utils/history.js`**. Commands that change or list the working directory store visited paths, enabling recall of recent directories.
566
+
567
+ - **NPC Autopilot** — The NPC platform now supports an **autopilot** mode: after replying to a message, an NPC can autonomously continue for a configurable number of iterations, deciding what to do next based on its persona, tasks, and memory. Clients send **`{ type: "autopilot_set", npcId, enabled, maxIters }`** to toggle the feature; the NPC emits **`"[autopilot idle]"`** when it has nothing left to do. Supported by i18n keys for all locales.
568
+
569
+ - **NPC platform tools** — The NPC platform gains three new agent tools: **notify_npc** (cross-NPC messaging), **pithosai_db** (query the Pithosai global DB inside NPC sessions), and **npc_db** (query the NPC platform DB). Tools are registered via **`src/tools/npc-resolve/npc-tool-resolver.js`**.
570
+
571
+ - **Connection-lost auto-retry** — The error classifier now treats **`"network connection lost"`** as a timeout-eligible error, so the CLI automatically retries when the API connection drops (previously only explicit timeout messages triggered retries).
572
+
573
+ ### Fixed
574
+
575
+ - **OpenRouter API regression** — Fixed a regression affecting OpenRouter API calls.
576
+ - **`taskRef.projectPath` sync after `/shell cd`** — After `cd` in the REPL loop, `taskRef.projectPath` is now updated alongside `runOpts.cwd`, so bare `/create-project` resolves to the correct directory instead of a stale one.
577
+ - **`taskRef.projectPath` on startup** — The session `taskRef` now includes a `projectPath` property initialized to the startup cwd, and is updated on virtual project create/switch.
578
+ - **ANSI color in tool results** — The first line of tool results no longer breaks group background colors due to an ANSI reset sequence in the sign prefix.
579
+ - **`cd ~` expansion** — Fixed a bug in the `/shell cd` handling of home-directory expansion (`~`).
580
+
581
+ ### Documentation
582
+
583
+ - **README** — Documents `/grill-me` and points to the skill and prompt module; documents virtual project commands, `/shell cd`, and **`projects.json`**.
584
+
585
+ ### Changed
586
+
587
+ - **npm package layout** — Built **`@mariozechner/*`** packages are copied to **`vendor/@mariozechner/*`** by **`scripts/sync-vendor-pi-mono.js`** (only each package’s **`package.json`** and **`dist/`** tree, no `src/`, `test/`, `docs/`, or `examples/`; **`*.map`** under **`dist/`** is omitted). Run from **`build:pi-mono-for-release`** / **`vendor:sync`**. Development dependencies stay **`file:lib/pi-mono/...`**. On **`npm pack` / `npm publish`**, **`prepack`** rewrites dependencies to **`file:vendor/...`**, adds **`vendor`** to **`package.json` `files`**, and drops **`lib/pi-mono`** file entries (see **`scripts/npm-publish-package-json.js`**), so the tarball ships **`vendor/`** only and **`lib/pi-mono` can keep normal `packages/*/dist/` ignores** without un-ignore hacks. Root **`.gitignore`** includes **`/vendor/`**.
588
+
589
+ ---
590
+
591
+ ## [1.0.7] - 2026-04-26
592
+
593
+ Note: 1.0.6 was abandoned, use 1.0.7 for it.
594
+
595
+ ### Added
596
+
597
+ - **Startup auto-upgrade** — On launch, the CLI can check npm for a newer `@pithosai/pithosai` and run `npm install -g @pithosai/pithosai@latest` when appropriate. Checks are **throttled to once per 24 hours** (state in `~/.pithosai/auto-upgrade-check.json`). Set **`PITHOSAI_AUTO_UPGRADE=0`** (or `false` / `no` / `off`) to disable. After a successful install, the CLI reminds you that **this process is still the old build** until you run `pithosai` again. When **stdin and stdout are TTYs** and **`PITHOSAI_NO_TUI` is not `1`**, it **waits for Enter** before continuing so upgrade lines are not lost under the agent TUI. Upgrade **stdout/stderr** uses **`cli.autoUpgrade*`** i18n keys (same language resolution as the rest of the CLI).
598
+
599
+ ### Changed
600
+
601
+ - **DeepSeek V4 defaults** — Native definitions in **`src/models/deepseek.js`** use **`deepseek-v4-pro`** (coder and reasoner entries) and **`deepseek-v4-flash`** (chat entry), with **1M-token** context metadata. OpenRouter fallback in **`src/models/config.js`** uses **`deepseek/deepseek-v4-pro`** and **`deepseek/deepseek-v4-flash`**. Retired provider ids **`deepseek-chat`** / **`deepseek-reasoner`** are no longer bundled defaults (see [DeepSeek API news](https://api-docs.deepseek.com/news/news260424)).
602
+
603
+ - **Cost-first default path** — Regular runs prefer **`deepseek-v4-flash`**; **`--pro`** selects **`deepseek-v4-pro`**; **`--reasoner`** uses the pro model with reasoning enabled. **`--chat`** explicitly selects the flash path. Interactive **`/model`** lists and switches available model keys. **Aliases:** `deepSeekPro` → `deepSeekCoder`, `deepSeekFlash` → `deepSeekChat`.
604
+
605
+ - **Interactive REPL exit** — Leaving the default `pithosai` REPL requires **`/exit`** or **`/quit`**; plain `exit` / `quit` are sent to the agent as normal input.
606
+
607
+ - **DeepSeek native “chat/coder” API shape** — For **`provider === "deepseek"`** when **`model.reasoning` is not `true`**, outgoing chat-completions requests set **`thinking: { type: "disabled" }`** so provider default [thinking mode](https://api-docs.deepseek.com/guides/thinking_mode) does not require replaying **`reasoning_content`** on tool-heavy turns (avoids **400** when the client pipeline omits it). **`deepSeekReasoner`** (`reasoning: true`) is unchanged.
608
+
609
+ ### Fixed
610
+
611
+ - **`render-markdown` dist entry** — Running **`dist/render-markdown.mjs`** directly could exit with no output because the entry check used a bundled-invalid `import.meta.url`. Detection now uses the entry **filename** (`render-markdown.js` / `render-markdown.mjs`) so the built binary runs correctly.
612
+
613
+ - **`zh-Hant` locale resolution** — **`src/i18n/index.js`** normalizes and resolves **Traditional Chinese** (`zh-Hant` / `zh-hant`) so the correct locale bundle loads (tests in **`src/i18n/index.test.js`**).
614
+
615
+ ### Documentation
616
+
617
+ - **README** — DeepSeek V4 tables, OpenRouter slugs, **`/model`** and role binaries (**`rdsai`**, **`pmsai`**, **`qasai`**, **`cosai`**, **`mktai`**, **`wrsai`**), auto-upgrade behavior, and **`PITHOSAI_AUTO_UPGRADE`**.
618
+
619
+ ---
620
+
621
+ ## [1.0.5] - 2026-04-22
622
+
623
+ ### Added
624
+
625
+ - **`pithosai migrate-db`** — Optional CLI to rewrite a legacy plaintext `pithosai.db` to SQLCipher using the same device-bound key as runtime; **`migratePlaintextDbFileToSqlcipher`** is exported from `src/storage/index.js` for programmatic use. Upgrades from **1.0.4** still migrate **automatically** on the first `getDb()` when SQLCipher loads (see README).
626
+
627
+ - **Device-bound SQLCipher key** — `src/storage/models/device-db-key-model.js` derives the storage passphrase from machine fingerprint + `.device_key` salt in the database file’s directory (see `docs/device-id.md`).
628
+
629
+ ### Changed
630
+
631
+ - **Init CLI naming and paths** — The DB init entry is now built from **`scripts/init.js`** as rspack entry **`init`**, producing **`dist/init.mjs`**. Package bin is now **`init`** (instead of `pithosai-init-db`), and global-install postinstall bootstrap executes that output.
632
+
633
+ - **Postinstall helper rename** — **`scripts/postinstall-init-db.js`** was renamed to **`scripts/postinstall-init.js`** and `package.json` references (`files` and `postinstall`) were updated accordingly.
634
+
635
+ - **Publish script filtering** — `scripts/npm-publish-package-json.js` now keeps only `postinstall` and `playwright:install` in the packed `package.json` `scripts` field.
636
+
637
+ - **SQLCipher passphrase env overrides removed** — `PITHOSAI_DB_KEY`, `DB_ENCRYPTION_KEY`, and `PITHOSAI_DB_KEY_FILE` are no longer read; storage uses only the device-bound key from `deriveDeviceBoundDatabaseKey`.
638
+
639
+ - **`PITHOSAI_DEVICE_KEY_DIR` removed** — `.device_key` is always read and written next to `pithosai.db` (the parent directory of `PITHOSAI_DB_PATH` / the resolved DB file).
640
+
641
+ - **Legacy SQLCipher built-in key removed** — databases encrypted only with the old hard-coded `pithosai-default-key` are no longer opened automatically; use a backup and migrate, or recreate the DB with the current device-bound key.
642
+
643
+ - **Storage module revamp + extracted models** — `src/storage/index.js` is now a model barrel with extracted entity modules under `src/storage/models/` (`process-model`, `email-model`, `role-prompt-model`, `task-model`) to separate table concerns and simplify maintenance.
644
+
645
+ - **SQLCipher-ready storage adapter** — `src/storage/db.js` now supports SQLCipher integration (`@journeyapps/sqlcipher`) with `PRAGMA key` from the device-bound derived key and keeps a compatibility fallback path for existing environments.
646
+
647
+ - **Async storage operations** — Runtime callsites now await storage APIs (heartbeat, request/memorize commands, prompt loaders, bootstrap/task persistence), aligning with SQLCipher sqlite3-style DB access.
648
+
649
+ ---
650
+
651
+ ## [1.0.4] - 2026-04-19
652
+
653
+ ### Fixed
654
+
655
+ - **Global install on Linux and other machines** — The CLI could fail with **`ENOENT`** when opening paths such as **`.../@mariozechner/pi-coding-agent/dist/package.json`** on the **install** host (bundling had inlined **build-machine** `import.meta.url` / `__dirname` from **`@mariozechner/pi-coding-agent`**). **`@mariozechner/pi-coding-agent`** is **no longer bundled** (removed from **`webpack-node-externals`** allowlist) so it loads from **`node_modules`** at runtime with correct paths.
656
+
657
+ - **Bundled `import.meta.url`** — **`src/utils/paths.js`** and **`scripts/init-pithosai-db.js`** now fall back to **`dirname(realpathSync(process.argv[1]))`** and anchor **`createRequire`** to the running **`dist/*.mjs`** entry when the inlined module URL does not exist on disk (e.g. after publishing from another OS).
658
+
659
+ ### Changed
660
+
661
+ - **License** — The project is **proprietary**, not open source. A **`LICENSE`** file (all-rights-reserved style) ships in the npm tarball; **`package.json`** **`license`** is **`UNLICENSED`** (npm SPDX for no public license grant).
662
+
663
+ - **README** — **Docker** and **Contributing** sections removed (Dockerfiles are not part of the npm package; no public contribution workflow). License section updated for proprietary terms.
664
+
665
+ ### Removed
666
+
667
+ - **`shims/chalk-cjs-shim.cjs`** — No longer used (ESM bundle loads **`chalk`** as a normal dependency). **`shims/package-root.cjs`** remains for **`getPackageRoot()`**.
668
+
669
+ ---
670
+
671
+ ## [1.0.3] - 2026-04-19
672
+
673
+ ### Changed
674
+
675
+ - **Bundled CLI (ESM)** — The Rspack production build emits **ESM** under **`dist/*.mjs`** (not CommonJS `*.cjs`). **`package.json`** **`main`** and all **`bin`** entries point to those files. Node dependencies are externalized with ESM-style loading; the previous chalk CommonJS shim path in the bundle is no longer used.
676
+
677
+ - **Postinstall** — **`postinstall`** runs only **`node scripts/postinstall-init.js`** (global-install DB bootstrap). **`patch-package`** is no longer part of the install lifecycle.
678
+
679
+ - **Repository scripts** — **`scripts/npm-global-install.js`**, **`postinstall-init.js`**, and **`prefix-bin-shebang.js`** are plain **ESM** **`.js`** modules (the package has **`"type": "module"`**), replacing the former **`.cjs`** helpers.
680
+
681
+ ### Removed
682
+
683
+ - **`patch-package`** and the **`patches/`** directory — The removed **`@mariozechner+pi-ai`** patch matched behavior already present in **`@mariozechner/pi-ai@0.52.7`** (`parseStreamingJson` in OpenAI provider streams). See **`docs/WRITE-TOOL-JSON-FIX.md`** for context.
684
+
685
+ ---
686
+
687
+ ## [1.0.2] - 2026-04-20
688
+
689
+ ### Fixed
690
+
691
+ - **Package root without `templates/`** — `getPackageRoot()` in **`src/utils/paths.js`** no longer requires a `templates/` directory next to `package.json`. The npm tarball omits `templates/` from **`files`**, which previously caused *could not find package root (templates/)* at runtime. Resolution now treats the install root as valid when **`package.json`** has **`name`** `@pithosai/pithosai` (or `pithosai`).
692
+
693
+ ### Changed
694
+
695
+ - **README** — Rewritten for npm readers: no pinned version string (version remains **`package.json` only**); **Gitee URLs removed** (not public) in favor of local **`docs/`** paths for those who have the full source tree.
696
+
697
+ ---
698
+
699
+ ## [1.0.1] - 2026-04-19
700
+
701
+ ### Added
702
+
703
+ - **npm distribution** — Package tarball includes `pithosai.sql` (templates are no longer shipped in `files`). **`init`** binary initializes `~/.pithosai/pithosai.db` from that schema; **`postinstall`** runs this automatically on **`npm install -g`** when the DB file is missing. Registry metadata: **keywords** (`ai`, `pithosai`, `agent`, `automation`) and **author** in `package.json`.
704
+
705
+ - **`pithosai memorize`** — `--start` / `--end` (date or ISO) and `-r/--role` build **`.pithosai/<role>/memory.md`** from persisted `pithosai_task` / `pithosai_task_message` rows in the local SQLite DB (messages in range for that role). After building structured markdown, the command optionally tightens it via the same **model resolution** as the default **`pithosai`** run (**`resolveModelConfigForAgentOpts`**: **`--reasoner`**, **`--chat`**, **`--cursor`**, **`--model`**). Use **`--no-llm`** or **`PITHOSAI_MEMORIZE_SKIP_LLM=1`** to skip, or on API failure the file is still written from structured content. Implementation: **`src/cli/memorize-command.js`**, **`src/memory/build-memory-md.js`**, **`src/memory/summarize-memory-md.js`**, **`src/memory/parse-memorize-dates.js`**, storage helpers **`listTaskIdsForRoleMessagesInDateRange`** / **`queryTaskMessageForRole`**.
706
+
707
+ - **Interactive skill slash commands** — In the default run REPL (readline and pi-tui), **`/list-skill`**, **`/install-skill [--force] [skill-name]`**, and **`/remove-skill <skill-name>`** call the same logic as **`pithosai skills` list/install/remove** (shared **`src/cli/skills-operations.js`**). Parsing lives in **`src/cli/skill-slash-command.js`**; **`tryHandleSkillCommand`** in **`request-command.js`** dispatches to dedicated handlers. Tab completion includes the new commands. New i18n: **`run.skillSlash.*`** (all locales).
708
+
709
+ - **Custom log file path** — New `--log-path <file>` global option to specify a custom log file path (default: `<project>/logs/pithosai.log`). The `ensureLogFilePath` utility function creates parent directories and returns the resolved path, used consistently across all CLI commands (`init`, `add-role`, `heartbeat`, `task`, and default request runs).
710
+
711
+ - **SQLite-based role prompts** — Role prompts (AGENTS.md, TOOLS.md, IDENTITY.md, ABILITIES.md) are now loaded from a SQLite database at runtime, with optional fallback to `.pithosai/<role>/*.md` files. This centralizes prompt management and enables easier updates across projects. The database is automatically created and populated with default prompts on first run.
712
+
713
+ - **Agent TUI transcript scrolling** — Enables **xterm mouse reporting** so the **mouse wheel** scrolls the transcript; **↑/↓** line scroll; **Page Up / Page Down** still page the view. Scrolling works **while the agent is running** (previously blocked). i18n **`run.tuiScrollTranscriptHint`** updated.
714
+
715
+ - **Interactive pi-tui session** — On a real TTY, the default **`pithosai`** interactive loop uses **`@mariozechner/pi-tui`**: bottom **Editor** in a **Unicode box** (┌─┐│└┘) with **Tab** / **`/`** autocomplete (same slash and `exit`/`quit` strings as readline), **streaming transcript** filling the middle, **spinner row** **above the prompt** while waiting; agent output is routed through the existing **output sink**. **`PITHOSAI_NO_TUI=1`** forces the previous readline UI. **`run.tuiYouLabel`** remains for **transcript echoes** of submitted input, not on the prompt line.
716
+
717
+ - **Interactive REPL Tab completion** — readline **Tab** completes task commands (`/list`, `/select `, `/show`, `/show-prompt`, `/show-task`, `/new`, `exit`, `quit`) and **`/shell`** in **agent** mode only; pause sub-prompt completes `continue` / `c` / `exit` / `e`.
718
+
719
+ - **Terminal result preview** — **dialog** / **plan** / `/show-task` / `/show-prompt` markdown preview uses **`@mariozechner/pi-tui`** (`Markdown` + scroll) with **`@mariozechner/pi-coding-agent`** `getMarkdownTheme` (replaces **`@muxik/md-viewer`**). New i18n key **`cli.resultPreviewTerminalHint`** for the footer line.
720
+
721
+ - **Dialog / plan browser preview** — After a **dialog** or **plan** run finishes, opens a browser with the assistant/plan markdown converted to **WeChat-oriented HTML** (`convertMarkdownToHtml` with `forWechat: true`). Defaults to **Google Chrome stable** when installed (`channel: chrome`); falls back to Playwright's bundled **Chrome for Testing** Chromium. Env: `PITHOSAI_SKIP_RESULT_BROWSER=1`, `PITHOSAI_PLAYWRIGHT_CHANNEL` (e.g. `bundled`, `msedge`). Script: `npm run playwright:install` for the bundled browser.
722
+
723
+ - **Show-prompt command** — New `pithosai show-prompt` command to display the system prompt that would be used for a run. Options: `--mode <agent|dialog|plan>`, `--raw` (show before truncation), `--truncated` (show truncated version). Useful for debugging and understanding the agent's context.
724
+
725
+ - **Interactive `/show-prompt`** — In the interactive REPL, `/show-prompt` builds the system prompt with `buildSystemPrompt` (same inputs as `show-prompt` for cwd, lang, role, and current `--mode`) and opens it in the configured markdown result viewer (`showMarkdownResult`), or prints markdown when `PITHOSAI_SKIP_RESULT_BROWSER=1`.
726
+
727
+ ### Changed
728
+
729
+ - **MKT prompt templates** — `templates/MKT` copy revamped for **senior marketing practitioner** workflows: strategy-before-tactics, ICP/positioning/message architecture, channel-native execution, measurement and governance, with matching **zh** variants.
730
+
731
+ - **Marketing role rename** — Templates and seed data use role **`MKT`** and `templates/MKT/`; CLI **`mktai`** replaces **`msai`**. Duplicate legacy marketing seed rows were removed from `pithosai.sql`.
732
+
733
+ - **Agent TUI transcript scroll** — **Page down** for the log is **Ctrl+F** (not Ctrl+D) so **Ctrl+D** stays available for EOF / exit on an empty line and delete-forward in the boxed **Editor**, consistent with the default pi-tui keybindings.
734
+
735
+ - **Role TOOLS.md → tool registration** — In **agent** mode, the agent only registers tools named in `.pithosai/<role>/TOOLS.md` (sections `# pi-agent-tools` and `# pithosai tools`). If the file is missing or those sections yield no ids, the full toolset is kept. **Dialog** / **plan** modes ignore this list. Custom tools are included when the allowlist contains `customer_tools` or `custom_tools`, or when a custom tool’s id is listed. **Pi coding tools** include `find` when listed (previously `grep` / `ls` were always added without `find`).
736
+
737
+ - **TUI loading placement** — The **awaitWithLoadingUi** Braille line is rendered **immediately above the boxed input** (between transcript and prompt), not at the top of the screen.
738
+
739
+ - **Interactive TUI prompt** — No **You:** prefix on the bottom **Editor**; input is wrapped in a **cyan Unicode frame** (┌─┐│└┘) with **`paddingX: 1`** inside the box. **`run.tuiYouLabel`** is still used when echoing submitted lines into the transcript.
740
+
741
+ - **Interactive pi-tui `/list` (and other multi-line slash output)** — `writeLn` now **splits on newlines** into transcript rows (fixes one-line truncation), **pins the viewport** to the start of blocks with 4+ lines, and **Page Up / Page Down** scroll the transcript when idle. New i18n: **`run.tuiScrollTranscriptHint`**.
742
+
743
+ - **Dialog / plan preview** — uses **`launchPersistentContext`** with app-mode flags so Chrome does not fall back to a normal window with omnibox/tabs (which happened with `browser.newPage()` after `chromium.launch`).
744
+
745
+ - **Agent loading → running indicator** — After the first **stdout** (non-TUI) or when **agent / slash-command output** hits the pi-tui transcript, the spinner **switches to a simpler running symbol** (`|`, `/`, `-`, `\`) until the run completes, instead of clearing immediately. **Non-TTY** stderr still **stops** the spinner on first stdout.
746
+
747
+ ### Fixed
748
+
749
+ - **Pi-tui markdown preview** — While the full-screen result viewer is open, the interactive agent TUI is **suspended** (same as the pause readline handoff) so **q** / **Esc** / **Ctrl+C** close only the viewer instead of reaching the REPL (`exit`/`quit` / **Ctrl+C** exit). Added **j**/**k** line scroll and **Ctrl+U**/**Ctrl+D** page scroll (plus existing arrows and PgUp/PgDn). Vim-style **gg** (top) and **G** (bottom).
750
+
751
+ ### Removed
752
+
753
+ - **Dependency** — **`@muxik/md-viewer`** (terminal markdown preview).
754
+
755
+ ---
756
+
757
+ ## [1.0.0] - 2026-03-27
758
+
759
+ First stable release of **Pithosai** (`pi-agent`): a CLI that turns natural-language requests into code and project changes using pluggable models and role-based prompts from SQLite (with optional `.pithosai/` file fallbacks).
760
+
761
+ ### Added
762
+
763
+ - **Core CLI** — `pithosai` entry point with `init`, `add-role`, interactive (`-i`) and one-shot runs, `--no-interactive`, project cwd (`-C`), language (`-l`), role (`-r`), reasoner/chat model flags, and `--cursor` integration with Cursor CLI models.
764
+ - **Run modes** — `agent` (default), `dialog` (read-only tools), and `plan` (writes plan markdown to project root; spinner/progress behavior documented).
765
+ - **Role-specific binaries** — `rdsai`, `pmsai`, `qasai`, `cosai`, `mktai`, and related commands sharing the same CLI surface with different default roles/models.
766
+ - **Task runner** — `pithosai task` watches markdown task files, processes tasks one at a time, supports pause/stop controls, task persistence and search (including `/show` and task-related UX), and localized task command output.
767
+ - **Agent controls** — stop (`Ctrl+S`) and pause (`Ctrl+P`) during runs; `agent-output-sink` for output routing; loading indicators for long requests.
768
+ - **Markdown** — task command markdown rendering and incremental (“delta”) markdown handling where applicable.
769
+ - **Providers** — DeepSeek, OpenRouter, and Cursor CLI (`cursor-agent`) with documented env vars and precedence.
770
+ - **Project layout** — `.pithosai/sessions/`, `.settings.json`, role templates under `.pithosai/<role>/`, scaffold by project type (`js` / `ts` / `python`).
771
+ - **Internationalization** — `i18next`-based locales for CLI strings (English plus additional languages in `src/i18n/locales/`).
772
+ - **Skills** — install/list/remove from Clawhub-style sources; `read_skill` tool; optional skill-to-tool conversion workflow (`skill-convert`).
773
+ - **Heartbeat** — IMAP-driven task email polling, queue/state file, `heartbeat` CLI and programmatic API.
774
+ - **Extras** — email-related tools, `render-markdown` utility, logging and timeout/error handling, Vitest unit tests, Rspack build for bundled assets.
775
+
776
+ ### Changed
777
+
778
+ - Ongoing refinements to task manager, prompts, logging, and CLI UX across the pre-1.0 development period (see git history for detail).
779
+
780
+ ### Fixed
781
+
782
+ - Various task-command, session, and validation fixes during development (see git history).
783
+
784
+ <!-- Optional: add `repository` to package.json, then append compare/release links per https://keepachangelog.com -->