kaizenai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +246 -0
- package/bin/kaizen +15 -0
- package/dist/client/apple-touch-icon.png +0 -0
- package/dist/client/assets/index-D-ORCGrq.js +603 -0
- package/dist/client/assets/index-r28mcHqz.css +32 -0
- package/dist/client/favicon.png +0 -0
- package/dist/client/fonts/body-medium.woff2 +0 -0
- package/dist/client/fonts/body-regular-italic.woff2 +0 -0
- package/dist/client/fonts/body-regular.woff2 +0 -0
- package/dist/client/fonts/body-semibold.woff2 +0 -0
- package/dist/client/index.html +22 -0
- package/dist/client/manifest-dark.webmanifest +24 -0
- package/dist/client/manifest.webmanifest +24 -0
- package/dist/client/pwa-192.png +0 -0
- package/dist/client/pwa-512.png +0 -0
- package/dist/client/pwa-icon.svg +15 -0
- package/dist/client/pwa-splash.png +0 -0
- package/dist/client/pwa-splash.svg +15 -0
- package/package.json +103 -0
- package/src/server/acp-shared.ts +315 -0
- package/src/server/agent.ts +1120 -0
- package/src/server/attachments.ts +133 -0
- package/src/server/backgrounds.ts +74 -0
- package/src/server/cli-runtime.ts +333 -0
- package/src/server/cli-supervisor.ts +81 -0
- package/src/server/cli.ts +68 -0
- package/src/server/codex-app-server-protocol.ts +453 -0
- package/src/server/codex-app-server.ts +1350 -0
- package/src/server/cursor-acp.ts +819 -0
- package/src/server/discovery.ts +322 -0
- package/src/server/event-store.ts +1369 -0
- package/src/server/events.ts +244 -0
- package/src/server/external-open.ts +272 -0
- package/src/server/gemini-acp.ts +844 -0
- package/src/server/gemini-cli.ts +525 -0
- package/src/server/generate-title.ts +36 -0
- package/src/server/git-manager.ts +79 -0
- package/src/server/git-repository.ts +101 -0
- package/src/server/harness-types.ts +20 -0
- package/src/server/keybindings.ts +177 -0
- package/src/server/machine-name.ts +22 -0
- package/src/server/paths.ts +112 -0
- package/src/server/process-utils.ts +22 -0
- package/src/server/project-icon.ts +344 -0
- package/src/server/project-metadata.ts +10 -0
- package/src/server/provider-catalog.ts +85 -0
- package/src/server/provider-settings.ts +155 -0
- package/src/server/quick-response.ts +153 -0
- package/src/server/read-models.ts +275 -0
- package/src/server/recovery.ts +507 -0
- package/src/server/restart.ts +30 -0
- package/src/server/server.ts +244 -0
- package/src/server/terminal-manager.ts +350 -0
- package/src/server/theme-settings.ts +179 -0
- package/src/server/update-manager.ts +230 -0
- package/src/server/usage/base-provider-usage.ts +57 -0
- package/src/server/usage/claude-usage.ts +558 -0
- package/src/server/usage/codex-usage.ts +144 -0
- package/src/server/usage/cursor-browser.ts +120 -0
- package/src/server/usage/cursor-cookies.ts +390 -0
- package/src/server/usage/cursor-usage.ts +490 -0
- package/src/server/usage/gemini-usage.ts +24 -0
- package/src/server/usage/provider-usage.ts +61 -0
- package/src/server/usage/test-helpers.ts +9 -0
- package/src/server/usage/types.ts +54 -0
- package/src/server/usage/utils.ts +325 -0
- package/src/server/ws-router.ts +717 -0
- package/src/shared/branding.ts +83 -0
- package/src/shared/dev-ports.ts +43 -0
- package/src/shared/ports.ts +2 -0
- package/src/shared/protocol.ts +152 -0
- package/src/shared/tools.ts +251 -0
- package/src/shared/types.ts +1028 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jake Mor
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person other than Jacob
|
|
6
|
+
Eiting and RevenueCat, Inc. obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/icon.png" alt="Kaizen" width="80" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Kaizen</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>A beautiful web UI for Claude Code, Codex, Gemini, and Cursor</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/kaizenai"><img src="https://img.shields.io/npm/v/kaizenai.svg?style=flat&colorA=18181b&colorB=f472b6" alt="npm version" /></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<br />
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<picture>
|
|
19
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/screenshot.png" />
|
|
20
|
+
<source media="(prefers-color-scheme: light)" srcset="assets/screenshot-light.png" />
|
|
21
|
+
<img src="assets/screenshot.png" alt="Kaizen screenshot" width="800" />
|
|
22
|
+
</picture>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<br />
|
|
26
|
+
|
|
27
|
+
## Quickstart
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx kaizenai
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`kaizen` is already taken on npm, so the package name needs to stay `kaizenai` for now.
|
|
34
|
+
|
|
35
|
+
After install, the command is still:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
kaizen
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`npx kaizenai` still requires Bun to be installed locally because the Kaizen runtime executes on Bun.
|
|
42
|
+
|
|
43
|
+
If Bun isn't installed, install it first:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
curl -fsSL https://bun.sh/install | bash
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Then run from any project directory:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
kaizen
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
That's it. Kaizen opens in your browser at [`localhost:3210`](http://localhost:3210).
|
|
56
|
+
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
- **Multi-provider support** — switch between Claude, Codex, Gemini, and Cursor from the chat input, with per-provider model selection, plan mode support, and provider-specific controls
|
|
60
|
+
- **Project-first sidebar** — chats grouped under projects, with live status indicators (idle, running, waiting, failed)
|
|
61
|
+
- **Drag-and-drop project ordering** — reorder project groups in the sidebar with persistent ordering
|
|
62
|
+
- **Local project discovery** — auto-discovers projects from Claude and Codex local history
|
|
63
|
+
- **Rich transcript rendering** — hydrated tool calls, collapsible tool groups, plan mode dialogs, and interactive prompts with full result display
|
|
64
|
+
- **Quick responses** — lightweight structured queries (e.g. title generation) via Claude Haiku with automatic provider fallback
|
|
65
|
+
- **Plan mode** — review and approve agent plans before execution
|
|
66
|
+
- **Persistent local history** — refresh-safe routes backed by JSONL event logs and compacted snapshots
|
|
67
|
+
- **Auto-generated titles** — chat titles generated in the background via Claude Haiku
|
|
68
|
+
- **Session resumption** — resume agent sessions with full context preservation
|
|
69
|
+
- **WebSocket-driven** — real-time subscription model with reactive state broadcasting
|
|
70
|
+
|
|
71
|
+
## Architecture
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
Browser (React + Zustand)
|
|
75
|
+
↕ WebSocket
|
|
76
|
+
Bun Server (HTTP + WS)
|
|
77
|
+
├── WSRouter ─── subscription & command routing
|
|
78
|
+
├── AgentCoordinator ─── multi-provider turn management
|
|
79
|
+
├── ProviderCatalog ─── provider/model/effort normalization
|
|
80
|
+
├── QuickResponseAdapter ─── structured queries with provider fallback
|
|
81
|
+
├── EventStore ─── JSONL persistence + snapshot compaction
|
|
82
|
+
└── ReadModels ─── derived views (sidebar, chat, projects)
|
|
83
|
+
↕ stdio
|
|
84
|
+
Claude Code / Codex / Gemini CLI / Cursor Agent ACP (local processes)
|
|
85
|
+
↕
|
|
86
|
+
Local File System (~/.kaizen/data/, project dirs)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Key patterns:** Event sourcing for all state mutations. CQRS with separate write (event log) and read (derived snapshots) paths. Reactive broadcasting — subscribers get pushed fresh snapshots on every state change. Multi-provider agent coordination with tool gating for user-approval flows. Provider-agnostic transcript hydration for unified rendering.
|
|
90
|
+
|
|
91
|
+
## Requirements
|
|
92
|
+
|
|
93
|
+
- [Bun](https://bun.sh) v1.3.5+
|
|
94
|
+
- A working [Claude Code](https://docs.anthropic.com/en/docs/claude-code) environment
|
|
95
|
+
- _(Optional)_ [Codex CLI](https://github.com/openai/codex) for Codex provider support
|
|
96
|
+
- _(Optional)_ [Gemini CLI](https://github.com/google-gemini/gemini-cli) for Gemini provider support
|
|
97
|
+
- _(Optional)_ [Cursor CLI / Agent](https://cursor.com/downloads) for Cursor provider support (`agent acp`)
|
|
98
|
+
|
|
99
|
+
Embedded terminal support uses Bun's native PTY APIs and currently works on macOS/Linux.
|
|
100
|
+
|
|
101
|
+
## Install
|
|
102
|
+
|
|
103
|
+
Install Kaizen globally:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npm install -g kaizenai
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This installs the `kaizen` command globally.
|
|
110
|
+
|
|
111
|
+
Or run it without installing:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npx kaizenai
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Because the npm package name is `kaizenai`, `npx kaizen` is not available unless the `kaizen` package name becomes available in the registry. If Bun is missing, `kaizen` and `npx kaizenai` will print a setup message telling the user to install Bun first.
|
|
118
|
+
|
|
119
|
+
If Bun isn't installed, install it first:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
curl -fsSL https://bun.sh/install | bash
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Or clone and build from source:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
git clone https://github.com/jayleaton/kaizen.git
|
|
129
|
+
cd kaizen
|
|
130
|
+
bun install
|
|
131
|
+
bun run build
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Usage
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
kaizen # start with defaults (localhost only)
|
|
138
|
+
kaizen --port 4000 # custom port
|
|
139
|
+
kaizen --no-open # don't open browser
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Default URL: `http://localhost:3210`
|
|
143
|
+
|
|
144
|
+
### Network access (Tailscale / LAN)
|
|
145
|
+
|
|
146
|
+
By default Kaizen binds to `127.0.0.1` (localhost only). Use `--host` to bind a specific interface, or `--remote` as a shorthand for `0.0.0.0`:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
kaizen --remote # bind all interfaces — browser opens localhost:3210
|
|
150
|
+
kaizen --host dev-box # bind to a specific hostname — browser opens http://dev-box:3210
|
|
151
|
+
kaizen --host 192.168.1.x # bind to a specific LAN IP
|
|
152
|
+
kaizen --host 100.64.x.x # bind to a specific Tailscale IP
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
When `--host <hostname>` is given, the browser opens `http://<hostname>:3210` automatically. Other machines on your network can connect to the same URL:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
http://dev-box:3210
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Development
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
bun run dev
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The same `--remote` and `--host` flags can be used with `bun run dev` for remote development.
|
|
168
|
+
Use `bun run dev --port 4000` to run the Vite client on `4000` and the backend on `4001`.
|
|
169
|
+
|
|
170
|
+
Or run client and server separately:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
bun run dev:client # http://localhost:5174
|
|
174
|
+
bun run dev:server # http://localhost:5175
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Scripts
|
|
178
|
+
|
|
179
|
+
| Command | Description |
|
|
180
|
+
| -------------------- | ---------------------------- |
|
|
181
|
+
| `bun run build` | Build for production |
|
|
182
|
+
| `bun run check` | Typecheck + build |
|
|
183
|
+
| `bun run dev` | Run client + server together |
|
|
184
|
+
| `bun run dev:client` | Vite dev server only |
|
|
185
|
+
| `bun run dev:server` | Bun backend only |
|
|
186
|
+
| `bun run start` | Start production server |
|
|
187
|
+
|
|
188
|
+
## Project Structure
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
src/
|
|
192
|
+
├── client/ React UI layer
|
|
193
|
+
│ ├── app/ App router, pages, central state hook, socket client
|
|
194
|
+
│ ├── components/ Messages, chat chrome, dialogs, buttons, inputs
|
|
195
|
+
│ ├── hooks/ Theme, standalone mode detection
|
|
196
|
+
│ ├── stores/ Zustand stores (chat input, preferences, project order)
|
|
197
|
+
│ └── lib/ Formatters, path utils, transcript parsing
|
|
198
|
+
├── server/ Bun backend
|
|
199
|
+
│ ├── cli.ts CLI entry point & browser launcher
|
|
200
|
+
│ ├── server.ts HTTP/WS server setup & static serving
|
|
201
|
+
│ ├── agent.ts AgentCoordinator (multi-provider turn management)
|
|
202
|
+
│ ├── gemini-acp.ts Gemini ACP JSON-RPC client
|
|
203
|
+
│ ├── cursor-acp.ts Cursor ACP JSON-RPC client
|
|
204
|
+
│ ├── codex-app-server.ts Codex App Server JSON-RPC client
|
|
205
|
+
│ ├── provider-catalog.ts Provider/model/effort normalization
|
|
206
|
+
│ ├── quick-response.ts Structured queries with provider fallback
|
|
207
|
+
│ ├── ws-router.ts WebSocket message routing & subscriptions
|
|
208
|
+
│ ├── event-store.ts JSONL persistence, replay & compaction
|
|
209
|
+
│ ├── discovery.ts Auto-discover projects from Claude and Codex local state
|
|
210
|
+
│ ├── read-models.ts Derive view models from event state
|
|
211
|
+
│ └── events.ts Event type definitions
|
|
212
|
+
└── shared/ Shared between client & server
|
|
213
|
+
├── types.ts Core data types, provider catalog, transcript entries
|
|
214
|
+
├── tools.ts Tool call normalization and hydration
|
|
215
|
+
├── protocol.ts WebSocket message protocol
|
|
216
|
+
├── ports.ts Port configuration
|
|
217
|
+
└── branding.ts App name, data directory paths
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Data Storage
|
|
221
|
+
|
|
222
|
+
All state is stored locally at `~/.kaizen/data/`:
|
|
223
|
+
|
|
224
|
+
| File | Purpose |
|
|
225
|
+
| ---------------- | ----------------------------------------- |
|
|
226
|
+
| `projects.jsonl` | Project open/remove events |
|
|
227
|
+
| `chats.jsonl` | Chat create/rename/delete events |
|
|
228
|
+
| `messages.jsonl` | Transcript message entries |
|
|
229
|
+
| `turns.jsonl` | Agent turn start/finish/cancel events |
|
|
230
|
+
| `snapshot.json` | Compacted state snapshot for fast startup |
|
|
231
|
+
|
|
232
|
+
Event logs are append-only JSONL. On startup, Kaizen replays the log tail after the last snapshot, then compacts if the logs exceed 2 MB.
|
|
233
|
+
|
|
234
|
+
## Star History
|
|
235
|
+
|
|
236
|
+
<a href="https://www.star-history.com/?repos=jayleaton%2Fkaizen&type=date&legend=top-left">
|
|
237
|
+
<picture>
|
|
238
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/image?repos=jayleaton/kaizen&type=date&theme=dark&legend=top-left" />
|
|
239
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/image?repos=jayleaton/kaizen&type=date&legend=top-left" />
|
|
240
|
+
<img alt="Star History Chart" src="https://api.star-history.com/image?repos=jayleaton/kaizen&type=date&legend=top-left" />
|
|
241
|
+
</picture>
|
|
242
|
+
</a>
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
[MIT](LICENSE)
|
package/bin/kaizen
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
if ! command -v bun >/dev/null 2>&1; then
|
|
4
|
+
echo "Kaizen requires Bun 1.3.5+ to run." >&2
|
|
5
|
+
echo "Install Bun from https://bun.sh and then retry." >&2
|
|
6
|
+
exit 1
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
10
|
+
|
|
11
|
+
if [ "${KAIZEN_CLI_MODE:-}" = "child" ]; then
|
|
12
|
+
exec bun "$SCRIPT_DIR/src/server/cli.ts" "$@"
|
|
13
|
+
else
|
|
14
|
+
exec bun "$SCRIPT_DIR/src/server/cli-supervisor.ts" "$@"
|
|
15
|
+
fi
|
|
Binary file
|