wrkpanel 0.0.0-stage → 0.3.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/CHANGELOG.md ADDED
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0 — 2026-12-05
4
+
5
+ - **Try it with `npx wrkpanel`**, or keep it with `npm install -g wrkpanel` and run `wrkpanel`. No clone or
6
+ build, and on macOS no compiler (node-pty ships prebuilt). `wrkpanel --port <n>` and `--no-open`;
7
+ `--help` lists them. An old Node gets a clear message instead of a `node:sqlite` error.
8
+ - Sessions get `--settings` from a copy of `claude-hooks.json` in `~/.config/wrkpanel/claude-settings/`
9
+ also without a Claude theme, so clearing npm's cache never takes the hooks away from running sessions.
10
+ - **Sessions and todos are now one thing: a Task.** **+ Task** replaces both **+ Todo** and
11
+ **+ New session**. Its dialog's main button **▶ Start** (Enter) saves the task and starts a session
12
+ with it as Claude's first message, opening it in a new tab. **Save Draft** parks it as a draft card to
13
+ start later. Every session now starts from a task; a title alone is sent as the first message.
14
+ - **Continue last conversation in this folder** (`claude --continue`) moved into the Task dialog. It
15
+ applies to that start only.
16
+ - Todo types are now **Task types**. Cards, ⓘ, the project page ("Drafts · N") and messages say task
17
+ or draft instead of todo. The API, code and database keep the old names.
18
+ - `POST /api/sessions` (start a session without a task) is gone; `POST /api/todos/<id>/start` takes
19
+ `continue`.
20
+
21
+ ## 0.2.0 — 2026-12-02
22
+
23
+ - **The default port is now 8855** (was 7777). Open http://localhost:8855, or keep the old port with
24
+ `WRKPANEL_PORT=7777 npm start`.
25
+ - Appearance (◐ on the list page and in the terminal bar): terminal color presets that follow the
26
+ system's dark or light setting (wrkpanel Dark and Light, Warm Graphite, Solarized Dark and Light),
27
+ font size and cursor style, previewed live. New sessions start Claude Code with a theme that matches
28
+ the terminal, or with its ANSI theme, or with your own /theme.
29
+ - The terminal follows your system's light or dark setting by default. Before, it was always dark.
30
+ - View an ended session: its name on the project page opens what was said, read from Claude's transcript,
31
+ without starting anything. **Resume** (on the row or in the view) starts it again with
32
+ `claude --resume`, as the same card.
33
+ - Recurring todos: tick **Recurring** in the todo dialog and **▶ Start** leaves the todo in place (↻ on
34
+ its card), so it can start more sessions.
35
+ - New installs make Goal (plan, review, push) the default todo type instead of Goal (fire and forget).
36
+ Existing databases keep their current default.
37
+ - Session cards: a terminal icon with ×N shows how many terminals have the session open (wrkpanel tabs
38
+ and real terminals alike), instead of "open elsewhere". The status pill no longer shows how long; its
39
+ tooltip does. Pills don't wrap inside.
40
+
41
+ ## 0.1.0 — 2026-11-28
42
+
43
+ First public release.
44
+
45
+ - Sessions grouped by project; start one in any project folder, rename it or terminate it
46
+ - Each session opens as a full terminal in a browser tab (xterm.js); sessions keep running in tmux
47
+ - Status badges: working, waiting for you, needs approval, has a question
48
+ - Todos: park a session for later and start it with one click; todo types with prebuilt instructions
49
+ - Project page with running and ended sessions (terminated, exited, gone)
50
+ - Artifact links per session and per project, read from Claude's transcripts
51
+ - Plan usage meter: week and session limits as batteries
52
+ - Drag-and-drop card order
53
+ - Session records and all data in one SQLite file, `~/.config/wrkpanel/wrkpanel.db`
54
+ - Listens on 127.0.0.1 only, with Host and Origin checks
55
+
56
+ Tested on macOS with Claude Code 2.1.332, tmux 3.8 and Node 22. Linux is experimental.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sanjay Vamja
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,300 @@
1
- # Temporary Holding Version
1
+ # wrkpanel
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A browser panel for the Claude Code sessions on your machine. Start a session in any project folder,
4
+ see at a glance which ones are working, waiting for you or asking for approval, and open any of them as
5
+ a full terminal in a browser tab. Sessions run in tmux, so closing the tab or restarting wrkpanel never
6
+ stops Claude.
7
+
8
+ <img width="1111" height="619" alt="wrkpanel list: usage meter on top, projects with session and task cards" src="https://github.com/user-attachments/assets/73cc442b-96d7-4214-8c87-c59573557ef0" />
9
+
10
+
11
+ <img width="1703" height="843" alt="A Claude Code session open as a terminal in a browser tab" src="https://github.com/user-attachments/assets/92972322-8038-4848-970f-8957b59226f0" />
12
+
13
+
14
+ ```sh
15
+ npx wrkpanel # starts on http://localhost:8855 and opens the browser
16
+ ```
17
+
18
+ Needs Node.js 22.13+, tmux 3.2+ and the `claude` CLI ([Requirements](#requirements)). To keep it installed,
19
+ `npm install -g wrkpanel` and then run `wrkpanel`. `wrkpanel --help` lists the flags (`--port`, `--no-open`).
20
+ Ctrl+C stops the panel; your sessions keep running in tmux.
21
+
22
+ From source, to work on it:
23
+
24
+ ```sh
25
+ git clone https://github.com/svamja/wrkpanel && cd wrkpanel
26
+ npm install
27
+ npm start # builds, starts on http://localhost:8855 and opens the browser
28
+ ```
29
+
30
+ ```
31
+ browser (xterm.js) ──WebSocket──▶ wrkpanel server (Node) ──node-pty──▶ tmux attach ──▶ tmux -L wrkpanel ──▶ claude
32
+ ```
33
+
34
+ No login: it listens on `127.0.0.1:8855` only. Read [Trust model](#trust-model) before you change that.
35
+
36
+ wrkpanel is an independent project, not made by or affiliated with Anthropic.
37
+
38
+ ## Requirements
39
+
40
+ - macOS. Linux is experimental: it builds in CI but hasn't been used day to day. On Linux, `node-pty`
41
+ compiles from source and needs python3, make and a C++ compiler.
42
+ - Node.js 22.13 or newer (`.nvmrc` pins 22)
43
+ - tmux 3.2 or newer (`brew install tmux`)
44
+ - Claude Code CLI (`claude`) on your PATH. Tested with Claude Code 2.1.332; see [Compatibility](#compatibility).
45
+ - `curl` and `bash` (the hooks and status line that report to wrkpanel use them)
46
+
47
+ ## Scripts
48
+
49
+ In a clone:
50
+
51
+ | Script | Does |
52
+ | --- | --- |
53
+ | `npm run dev` | Server with auto-reload on :8855 + Vite dev page on http://localhost:5173 |
54
+ | `npm run build` | Build page to `dist/web` and server to `dist/server` |
55
+ | `npm run serve` | Start the built server without opening a browser |
56
+ | `npm run typecheck` | Typecheck server and page |
57
+
58
+ Set `WRKPANEL_PORT` to use a different port. `WRKPANEL_SOCKET` picks a different tmux socket and
59
+ `WRKPANEL_DATA` a different data folder, for running a test server next to your real one without touching
60
+ its sessions or project list.
61
+
62
+ ## Using it
63
+
64
+ - **Add project**: pick a folder (suggestions come from your recent Claude projects). Sessions are grouped
65
+ under their project. The list is kept in `~/.config/wrkpanel/wrkpanel.db` (`WRKPANEL_DATA` moves it).
66
+ **Remove** only drops it from wrkpanel; the folder and any running sessions are left alone, and those
67
+ sessions show under **Other folders**.
68
+ - **Project page**: click a project's name (the **›** next to it) for its own page: its cards (running
69
+ sessions and draft tasks, in the same order as on the list), and the sessions that ended (latest 100, with how many there are in all). An ended row shows
70
+ how it ended (**terminated** in wrkpanel, **exited** when Claude quit, **gone** when killed outside
71
+ wrkpanel), when, how long it ran, its artifacts and **ⓘ** with its task. Ended sessions in a nested project show only on that
72
+ project's page, like running ones.
73
+ - **+ Task** in a project: a title and a note for Claude. **▶ Start** (or Enter) starts a new session
74
+ named after the title, sends the title and note as Claude's first message, and opens it in a new tab.
75
+ A title alone is sent as the message. **Save Draft** parks the task instead: it shows as a dashed
76
+ **draft** card in the project; click it to edit, ✕ to delete, and its **▶ Start** starts it later
77
+ (without opening it: click its card for that). Every session starts from a task. Once started, the
78
+ task moves onto the session: an **ⓘ** on its card (and in the terminal bar) shows the original title
79
+ and note. Tick **Continue last conversation in this folder** to start with `claude --continue`, so
80
+ the task goes to the folder's last Claude conversation. This applies only to that **▶ Start** and is
81
+ not kept on a draft. Tasks are kept in `wrkpanel.db` (max 12 KB each: the prompt goes through tmux,
82
+ which refuses longer commands). Removing a project keeps its drafts; they show again if you add the
83
+ folder back. Tick **Recurring** in a task's dialog to keep it as a draft after **▶ Start** (its card
84
+ shows **↻**): each start opens a new session from it, for work you run again and again.
85
+ - **Task types**: prebuilt instructions that go with a task. A task's **Type** (in its dialog) adds the
86
+ type's instructions after the title and note when it starts, and starts Claude in the type's mode
87
+ (`--permission-mode plan`, `auto` or `acceptEdits`, or as usual). **Task types** (top of the page)
88
+ lists them: click one to edit it, **+ New type** adds one, ★ picks the type new tasks get (★ on
89
+ **None**: new tasks get no type, and Claude starts as usual). The first start seeds five: Goal (fire and forget) (auto mode),
90
+ Goal (plan, review, push) ★ (plan mode), Grilling session, Plan (plan mode) and Artifact creation. They
91
+ are ordinary types after that: edit or delete them as you like. A draft keeps only which type it has,
92
+ so editing a type changes the drafts not started yet; a started session keeps what it was sent (its
93
+ card shows the type, ⓘ the instructions). Deleting a type moves its drafts to None. The type's
94
+ instructions count toward the 12 KB limit.
95
+ - **Artifacts**: the claude.ai artifacts (pages and docs) a session published, updated, read or opened.
96
+ A card shows **N artifacts** (click for the links) and the terminal bar an **Artifacts · N** button.
97
+ Each project has an **Artifacts** list under its sessions: every artifact any session in its folder
98
+ ever touched, latest first. It keeps growing after the sessions end, and an artifact shows once per
99
+ project however many sessions touched it. Artifacts deleted with Claude's Artifact tool drop out.
100
+ The links are read from each session's Claude transcript (after every turn, while the page is open, and
101
+ before Terminate, and once more when a session ends) and kept in `wrkpanel.db`. Only sessions that report status
102
+ (started by wrkpanel since badges) have a transcript to read. Templates that Claude only looked at
103
+ (Artifact types, quickstart) are not listed.
104
+ - **Card order**: sessions and drafts share one order in each project, and nothing reorders them by
105
+ itself (not status, not activity). A new card goes last; a started task's session goes first (the
106
+ other cards keep their order). Drag a card onto another to move it there (left half: before it, right half: after it); Esc or
107
+ dropping outside the project puts it back. With a card focused, **Alt+←/→** (or ↑/↓) moves it one place.
108
+ The order is kept in `wrkpanel.db`.
109
+ - **Usage** (top of the page): your plan limits as four batteries that drain toward empty. **Week** and
110
+ **Session** sit side by side, each with its time battery over its quota battery so the bars line up.
111
+ **Week**: 7 bars of time (one a day) and 7 of quota left. **Session**: 5 bars of time (one an hour) and
112
+ 5 of quota left. The current bar fills partly; hover for exact numbers and the reset time. Quota bars are green on
113
+ pace, amber when usage runs ahead of elapsed time (it would run out before the reset), red at 90% used.
114
+ The numbers come from Claude Code's status-line input: `claude-hooks.json` sets a status line that
115
+ posts it to wrkpanel, then runs your own status line (from your settings, read when the session
116
+ starts), so it looks the same. They update while a session started by wrkpanel (after this was added)
117
+ talks to Claude; the last numbers are kept in `wrkpanel.db` and fade after 30 minutes without a report.
118
+ API-key sessions have no plan limits, so they report nothing.
119
+ - **Appearance** (◐ at the top of the page, or in a session's terminal bar): the terminal's colors,
120
+ font size and cursor, and Claude Code's theme for new sessions.
121
+ - **Terminal colors**: follow the system (the dark preset while your system is dark, the light one
122
+ while it is light), or always use one of them. Dark presets: wrkpanel Dark (the look before presets),
123
+ Warm Graphite, Solarized Dark. Light presets: wrkpanel Light, Solarized Light.
124
+ - **Preview**: in a session tab every change repaints the terminal behind the dialog; on the list page
125
+ the dialog shows a sample. **Cancel** puts back the saved look. **Save** keeps it in `wrkpanel.db` and
126
+ repaints every open session tab, as does your system switching between dark and light.
127
+ - **Claude Code colors**: *Match the terminal* (default) starts Claude with its `dark` or `light`
128
+ theme, whichever matches the terminal; *Use the preset's colors* starts it with `dark-ansi` or
129
+ `light-ansi`, so the preset's 16 colors color everything; *Leave it to your own /theme* passes no
130
+ theme, as before. The theme goes in the file wrkpanel passes to `claude --settings` (one per theme,
131
+ in `~/.config/wrkpanel/claude-settings/`); your `~/.claude/settings.json` is not touched. Claude
132
+ reads its theme when it starts, so this applies to sessions started after you save.
133
+ - A running session keeps the Claude theme it started with. When the terminal then switches between
134
+ dark and light, colors that would be too faint on the new background are adjusted to a 3:1
135
+ contrast (xterm.js `minimumContrastRatio`).
136
+ - **Rename** with ✎ on a card (shows on hover) or in the terminal bar. Only the shown name changes; the
137
+ session id and its URL stay the same.
138
+ - **Open** a card: the session opens in a new tab. **✕** in its bar (or closing the tab) detaches only
139
+ that view; Claude keeps working.
140
+ - **Terminate** runs `tmux kill-session`. Other open views show "Session ended".
141
+ - **View an ended session**: click its name on the project page. A new tab shows what was said, read from
142
+ Claude's transcript: your messages, Claude's replies, and each tool call with its output (collapsed).
143
+ This doesn't start anything. It isn't the terminal screen, because that is gone with the tmux
144
+ session. Claude deletes old transcripts after a while (`cleanupPeriodDays`, 30 days by default).
145
+ After that, an ended session can be neither viewed nor resumed.
146
+ - **Resume** (on an ended row, or in its view) starts the session again with `claude --resume` on its
147
+ last conversation, in the same folder. **Resume this conversation** in the view picks one when there
148
+ were several (after `/clear`). The row turns back into a running card with the same name, task and
149
+ artifacts, and the view's tab becomes its terminal.
150
+ - You can also attach from a real terminal: `tmux -L wrkpanel attach -t wp-<name>`.
151
+ - **Session records**: every session also gets a record in `wrkpanel.db` that outlives tmux: a stable uid
152
+ (`s-<hex>`, tmux option `@wp_uid`), name, folder, how it started (its task included), every Claude
153
+ conversation it ran (one per `/clear`), and how it ended: `terminated`, `exited` (Claude quit, with its
154
+ reason) or `gone` (killed outside wrkpanel). Sessions started before records existed are adopted on the
155
+ next list. The project page lists them; `GET /api/history[?project=<path>&limit=<n>]` returns them
156
+ (with `total`, and each one's artifacts),
157
+ `GET /api/history/<uid>` one record with its conversations' messages.
158
+ - **Data**: everything lives in one SQLite file, `~/.config/wrkpanel/wrkpanel.db` (Node's built-in
159
+ `node:sqlite`). The first start imports the old `projects.json`, `todos.json` and `artifacts.json`; they
160
+ are left in place and never read again.
161
+
162
+ ### Keyboard and mouse
163
+
164
+ - **Shift+Enter** inserts a newline (sent as `ESC CR`).
165
+ - **Mouse wheel** scrolls history (tmux copy-mode). Press `q` or `Esc` to leave copy-mode.
166
+ - **Select text**: hold **Option** and drag. Text selected in tmux copy-mode is copied to your clipboard (OSC 52).
167
+ - Browser shortcuts such as Cmd+W, Cmd+T and Ctrl+Tab never reach Claude. Installing the page as an app
168
+ window (Chrome: ⋮ → Cast, save and share → Install page as app) frees most of them.
169
+ - tmux has no prefix key on the wrkpanel socket, so Ctrl+B and friends go straight to Claude.
170
+
171
+ ### Status badges
172
+
173
+ Each card shows what its session is doing, and for how long:
174
+
175
+ | Badge | Means |
176
+ | --- | --- |
177
+ | **working** | Claude is busy |
178
+ | **waiting for you** | Claude finished its turn, or the session just started |
179
+ | **needs approval** / **has a question** | A permission prompt (hover for the tool) or a question is open |
180
+ | **no status** | Started before badges existed; new sessions report status |
181
+
182
+ wrkpanel starts Claude with `claude --settings` and a copy of `claude-hooks.json` (in
183
+ `~/.config/wrkpanel/claude-settings/`, so it outlives npm's cache under npx). Those hooks post each event to
184
+ `/api/hooks` with curl, and only for sessions wrkpanel starts. `~/.claude/settings.json` is never touched.
185
+ The state is stored as tmux options, so it survives a wrkpanel restart.
186
+
187
+ Two moments fire no hook, so the server fills them in each time the list refreshes:
188
+
189
+ - **Esc interrupts a turn.** It sees the interrupt in Claude's transcript, or, when Esc came before any
190
+ reply text, the missing `esc to interrupt` footer on screen for 3 s.
191
+ - **You approve a tool.** It sees `esc to interrupt` come back on screen, so the card says "working" while
192
+ the tool runs.
193
+
194
+ Both use Claude Code's internal transcript format and screen text. If a Claude update changes those, the
195
+ fallbacks stop working and a badge can stay on "working" after an Esc until your next prompt.
196
+
197
+ ## Trust model
198
+
199
+ In plain words: **anyone who can reach port 8855 as you can type into your Claude sessions**, and Claude
200
+ can run commands on your machine. wrkpanel only listens on `127.0.0.1` and checks every request so
201
+ that other websites in your browser can't get in. Don't expose it: no tunnels (ngrok, Cloudflare
202
+ Tunnel), no SSH port forwards for others, no reverse proxy on `0.0.0.0`. Remote access would need a
203
+ login, which wrkpanel doesn't have.
204
+
205
+ The details:
206
+
207
+ - Binds `127.0.0.1` only.
208
+ - Every request must carry `Host: localhost:8855` (or `127.0.0.1:8855`), which blocks DNS rebinding.
209
+ - A request with an `Origin` header must come from that same origin, and WebSocket upgrades and
210
+ POST/DELETE must send one. Other websites open in your browser can't read sessions or type into them.
211
+ - `POST /api/hooks` is the one mutating request allowed without `Origin`, because curl sends none. A browser
212
+ always sends `Origin` on a cross-site POST, so other websites still can't reach it. A local process could
213
+ set a wrong badge there, but it could also run tmux directly.
214
+ - tmux is always run with `execFile` and argument arrays. Session ids must match `^wp-[a-z0-9-]{1,40}$`, and the
215
+ folder must exist.
216
+
217
+ Anyone with a shell on your Mac as your user can still reach the port. That's the same trust level as tmux itself.
218
+
219
+ Found a hole? Please report it privately; see [SECURITY.md](SECURITY.md).
220
+
221
+ ## Compatibility
222
+
223
+ wrkpanel relies on parts of Claude Code that aren't a stable API: the hook events `PermissionRequest`,
224
+ `Elicitation`, `StopFailure` and `SessionEnd`, the status line's `rate_limits` field, the transcript
225
+ `.jsonl` format, and the `esc to interrupt` footer on screen. It was tested with Claude Code 2.1.332.
226
+
227
+ If a Claude update changes them, the terminal keeps working and what degrades is:
228
+
229
+ - **Badges** can stay on "working" after an Esc, or miss an approval, until your next prompt.
230
+ - **Artifact links** stop appearing for new sessions.
231
+ - **Usage** batteries fade out after 30 minutes without a report.
232
+
233
+ When you file a bug, include `claude --version`.
234
+
235
+ ## Troubleshooting
236
+
237
+ - **`posix_spawnp failed`** when opening a session: node-pty's `spawn-helper` lost its execute bit. The
238
+ `wrkpanel` command restores it at every start; in a clone, run `npm install` again (its postinstall
239
+ fixes it), or `chmod +x node_modules/node-pty/prebuilds/*/spawn-helper`.
240
+ - **`port 8855 is already in use`**: wrkpanel is probably already running. Open
241
+ http://localhost:8855, or start a second one with `npx wrkpanel --port 8856`
242
+ (`WRKPANEL_PORT=8856 npm start` in a clone).
243
+ - **`tmux … is too old`**: wrkpanel needs tmux 3.2 or newer (`brew upgrade tmux`).
244
+ - **`claude (Claude Code CLI) was not found`**: make sure `command -v claude` prints a path in the shell
245
+ you start wrkpanel from.
246
+ - **Badges say "no status"**: the session was started outside wrkpanel, or before badges existed. New
247
+ sessions report status.
248
+ - **`node:sqlite` errors at start**: your Node is older than 22.13 (`node -v`).
249
+
250
+ ## Uninstall
251
+
252
+ ```sh
253
+ tmux -L wrkpanel kill-server # ends every wrkpanel session (and the Claude in it)
254
+ rm -rf ~/.config/wrkpanel # projects, tasks, session records, artifact links
255
+ npm uninstall -g wrkpanel # if you installed it with -g (npx only keeps a copy in npm's cache)
256
+ rm -rf wrkpanel # or the clone
257
+ ```
258
+
259
+ wrkpanel never writes to `~/.claude`, so there's nothing to undo there.
260
+
261
+ ## Layout
262
+
263
+ ```
264
+ server/
265
+ index.ts HTTP + WebSocket routes, Origin/Host checks, static page, startup
266
+ tmux.ts tmux transport: list / create / rename / kill, binary lookup, folder suggestions
267
+ sessions.ts session records: start, terminate, hooks, reconcile (adopt / end), history
268
+ db.ts SQLite store (wrkpanel.db), migrations, one-time JSON import
269
+ projects.ts project list
270
+ todos.ts tasks (todos in code): a session to start or a draft per project, ▶ starts one
271
+ todoTypes.ts task types: instructions + start mode, the default one
272
+ todo-seeds.ts the task types a new database starts with
273
+ settings.ts Appearance setting; Claude's theme and its --settings file
274
+ order.ts card order per project
275
+ usage.ts plan usage from the status line, the user's own status line
276
+ artifacts.ts artifact links read from transcripts
277
+ attach.ts node-pty <-> WebSocket bridge
278
+ status.ts status badges: hook events -> state, interrupt / approval detection
279
+ config.ts port, socket name, paths
280
+ web/
281
+ main.ts router: "/" list, "/project?path=" project page, "/s/:id" terminal
282
+ list.ts sessions grouped by project, cards; the project page (running, drafts, ended)
283
+ dialogs.ts Add project / Task / Rename / Task types / Appearance dialogs
284
+ term.ts xterm.js view, ✕ / Terminate bar, reconnect
285
+ themes.ts terminal color presets; the saved Appearance, shared between tabs
286
+ usage.ts usage batteries
287
+ api.ts fetch helpers
288
+ tmux.conf config for the wrkpanel tmux socket only
289
+ claude-hooks.json Claude Code hooks passed to each session with --settings
290
+ bin/
291
+ wrkpanel.js the `wrkpanel` command (npx, npm -g): Node check, --port / --no-open, starts dist/server
292
+ scripts/
293
+ fix-node-pty.mjs postinstall and every start: restores node-pty's spawn-helper execute bit
294
+ ```
295
+
296
+ See [docs/design-notes.md](docs/design-notes.md) for why it works this way.
297
+
298
+ ## License
299
+
300
+ [MIT](LICENSE)
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ // The `wrkpanel` command (npx wrkpanel, or npm install -g wrkpanel). Checks Node, reads a few flags,
3
+ // then starts the built server in dist/server. Kept to syntax old Node versions can parse, so an old
4
+ // Node gets the version message instead of a syntax error.
5
+ import { readFileSync } from 'node:fs';
6
+
7
+ const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
8
+ const args = process.argv.slice(2);
9
+
10
+ function has(flag) {
11
+ return args.indexOf(flag) !== -1;
12
+ }
13
+
14
+ if (has('--version') || has('-v')) {
15
+ console.log(pkg.version);
16
+ process.exit(0);
17
+ }
18
+
19
+ if (has('--help') || has('-h')) {
20
+ console.log(`wrkpanel ${pkg.version}: a browser panel for your Claude Code sessions, running in tmux
21
+
22
+ Usage: wrkpanel [--port <n>] [--no-open]
23
+
24
+ --port <n> listen on 127.0.0.1:<n> instead of 8855 (or set WRKPANEL_PORT)
25
+ --no-open don't open the browser
26
+ --version print the version
27
+ --help print this
28
+
29
+ Needs tmux 3.2+ and the claude CLI on your PATH. Data lives in ~/.config/wrkpanel.
30
+ Stop it with Ctrl+C: your sessions keep running in tmux (tmux -L wrkpanel ls).
31
+ More: ${pkg.homepage}`);
32
+ process.exit(0);
33
+ }
34
+
35
+ const [major, minor] = process.versions.node.split('.').map(Number);
36
+ if (major < 22 || (major === 22 && minor < 13)) {
37
+ console.error(`wrkpanel: needs Node.js 22.13 or newer (for node:sqlite); this is ${process.version}.`);
38
+ process.exit(1);
39
+ }
40
+
41
+ const portAt = args.indexOf('--port');
42
+ if (portAt !== -1) {
43
+ const port = Number(args[portAt + 1]);
44
+ if (!Number.isInteger(port) || port < 1 || port > 65535) {
45
+ console.error('wrkpanel: --port needs a port number, e.g. --port 8856');
46
+ process.exit(1);
47
+ }
48
+ process.env.WRKPANEL_PORT = String(port);
49
+ }
50
+
51
+ // The server reads --open from argv.
52
+ if (!has('--no-open')) process.argv.push('--open');
53
+
54
+ await import('../scripts/fix-node-pty.mjs');
55
+ await import('../dist/server/index.js');
@@ -0,0 +1,132 @@
1
+ {
2
+ "statusLine": {
3
+ "type": "command",
4
+ "command": "input=$(cat); case \"$input\" in *'\"rate_limits\"'*) printf '%s' \"$input\" | curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/usage?id=$WRKPANEL_ID\" >/dev/null 2>&1 & ;; esac; if [ -n \"$WRKPANEL_STATUSLINE\" ]; then printf '%s' \"$input\" | bash -c \"$WRKPANEL_STATUSLINE\"; fi"
5
+ },
6
+ "hooks": {
7
+ "SessionStart": [
8
+ {
9
+ "hooks": [
10
+ {
11
+ "type": "command",
12
+ "command": "curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/hooks?id=$WRKPANEL_ID\" || true",
13
+ "timeout": 5
14
+ }
15
+ ]
16
+ }
17
+ ],
18
+ "UserPromptSubmit": [
19
+ {
20
+ "hooks": [
21
+ {
22
+ "type": "command",
23
+ "command": "curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/hooks?id=$WRKPANEL_ID\" || true",
24
+ "timeout": 5
25
+ }
26
+ ]
27
+ }
28
+ ],
29
+ "PermissionRequest": [
30
+ {
31
+ "matcher": "*",
32
+ "hooks": [
33
+ {
34
+ "type": "command",
35
+ "command": "curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/hooks?id=$WRKPANEL_ID\" || true",
36
+ "timeout": 5
37
+ }
38
+ ]
39
+ }
40
+ ],
41
+ "PostToolUse": [
42
+ {
43
+ "matcher": "*",
44
+ "hooks": [
45
+ {
46
+ "type": "command",
47
+ "command": "curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/hooks?id=$WRKPANEL_ID\" || true",
48
+ "timeout": 5
49
+ }
50
+ ]
51
+ }
52
+ ],
53
+ "PostToolUseFailure": [
54
+ {
55
+ "matcher": "*",
56
+ "hooks": [
57
+ {
58
+ "type": "command",
59
+ "command": "curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/hooks?id=$WRKPANEL_ID\" || true",
60
+ "timeout": 5
61
+ }
62
+ ]
63
+ }
64
+ ],
65
+ "Notification": [
66
+ {
67
+ "hooks": [
68
+ {
69
+ "type": "command",
70
+ "command": "curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/hooks?id=$WRKPANEL_ID\" || true",
71
+ "timeout": 5
72
+ }
73
+ ]
74
+ }
75
+ ],
76
+ "Elicitation": [
77
+ {
78
+ "hooks": [
79
+ {
80
+ "type": "command",
81
+ "command": "curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/hooks?id=$WRKPANEL_ID\" || true",
82
+ "timeout": 5
83
+ }
84
+ ]
85
+ }
86
+ ],
87
+ "ElicitationResult": [
88
+ {
89
+ "hooks": [
90
+ {
91
+ "type": "command",
92
+ "command": "curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/hooks?id=$WRKPANEL_ID\" || true",
93
+ "timeout": 5
94
+ }
95
+ ]
96
+ }
97
+ ],
98
+ "Stop": [
99
+ {
100
+ "hooks": [
101
+ {
102
+ "type": "command",
103
+ "command": "curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/hooks?id=$WRKPANEL_ID\" || true",
104
+ "timeout": 5
105
+ }
106
+ ]
107
+ }
108
+ ],
109
+ "StopFailure": [
110
+ {
111
+ "hooks": [
112
+ {
113
+ "type": "command",
114
+ "command": "curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/hooks?id=$WRKPANEL_ID\" || true",
115
+ "timeout": 5
116
+ }
117
+ ]
118
+ }
119
+ ],
120
+ "SessionEnd": [
121
+ {
122
+ "hooks": [
123
+ {
124
+ "type": "command",
125
+ "command": "curl -s -m 2 -o /dev/null -H 'content-type: application/json' --data-binary @- \"$WRKPANEL_URL/api/hooks?id=$WRKPANEL_ID\" || true",
126
+ "timeout": 5
127
+ }
128
+ ]
129
+ }
130
+ ]
131
+ }
132
+ }