@bigmistqke/workpad 0.0.0-stage → 0.18.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 +21 -0
- package/README.md +781 -2
- package/bin/workpad.ts +1509 -0
- package/dist/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/taggedTemplateLiteral.js +5 -0
- package/dist/bin/workpad.js +1190 -0
- package/dist/client/runtime.js +1194 -0
- package/dist/define.js +27 -0
- package/dist/plugins/alert/README.md +18 -0
- package/dist/plugins/alert/index.js +40 -0
- package/dist/plugins/alert/public/style.css +40 -0
- package/dist/plugins/ansi/README.md +36 -0
- package/dist/plugins/ansi/index.js +63 -0
- package/dist/plugins/ansi/public/style.css +28 -0
- package/dist/plugins/badge/README.md +32 -0
- package/dist/plugins/badge/index.js +28 -0
- package/dist/plugins/badge/public/style.css +30 -0
- package/dist/plugins/chat/README.md +81 -0
- package/dist/plugins/chat/index.js +96 -0
- package/dist/plugins/chat/public/client.js +3 -0
- package/dist/plugins/chat/public/style.css +143 -0
- package/dist/plugins/claude/README.md +116 -0
- package/dist/plugins/claude/channel.js +130 -0
- package/dist/plugins/claude/doctor.js +316 -0
- package/dist/plugins/claude/index.js +199 -0
- package/dist/plugins/claude/session.js +68 -0
- package/dist/plugins/code/README.md +54 -0
- package/dist/plugins/code/diff.js +75 -0
- package/dist/plugins/code/index.js +105 -0
- package/dist/plugins/code/public/client.js +1 -0
- package/dist/plugins/code/public/style.css +99 -0
- package/dist/plugins/comments/README.md +30 -0
- package/dist/plugins/comments/index.js +39 -0
- package/dist/plugins/comments/public/client.js +24 -0
- package/dist/plugins/comments/public/style.css +224 -0
- package/dist/plugins/details/README.md +24 -0
- package/dist/plugins/details/index.js +28 -0
- package/dist/plugins/details/public/style.css +7 -0
- package/dist/plugins/draft/README.md +14 -0
- package/dist/plugins/draft/index.js +27 -0
- package/dist/plugins/draft/public/style.css +21 -0
- package/dist/plugins/forge/README.md +22 -0
- package/dist/plugins/forge/index.js +83 -0
- package/dist/plugins/form/README.md +126 -0
- package/dist/plugins/form/index.js +179 -0
- package/dist/plugins/form/public/style.css +172 -0
- package/dist/plugins/grid/README.md +45 -0
- package/dist/plugins/grid/index.js +35 -0
- package/dist/plugins/grid/public/style.css +98 -0
- package/dist/plugins/iframe/README.md +18 -0
- package/dist/plugins/iframe/index.js +49 -0
- package/dist/plugins/iframe/public/style.css +28 -0
- package/dist/plugins/index.js +44 -0
- package/dist/plugins/lightbox/README.md +24 -0
- package/dist/plugins/lightbox/index.js +20 -0
- package/dist/plugins/lightbox/public/client.js +4 -0
- package/dist/plugins/lightbox/public/style.css +66 -0
- package/dist/plugins/mermaid/README.md +21 -0
- package/dist/plugins/mermaid/index.js +42 -0
- package/dist/plugins/mermaid/public/style.css +21 -0
- package/dist/plugins/opencode/README.md +48 -0
- package/dist/plugins/opencode/channel.js +92 -0
- package/dist/plugins/opencode/index.js +64 -0
- package/dist/plugins/opencode/shim.js +150 -0
- package/dist/plugins/quiet/README.md +26 -0
- package/dist/plugins/quiet/index.js +23 -0
- package/dist/plugins/tabs/README.md +44 -0
- package/dist/plugins/tabs/index.js +75 -0
- package/dist/plugins/tabs/public/client.js +1 -0
- package/dist/plugins/tabs/public/style.css +98 -0
- package/dist/plugins/terminal/README.md +63 -0
- package/dist/plugins/terminal/host.js +338 -0
- package/dist/plugins/terminal/index.js +170 -0
- package/dist/plugins/terminal/modes.js +32 -0
- package/dist/plugins/terminal/public/client.js +41 -0
- package/dist/plugins/terminal/public/style.css +511 -0
- package/dist/plugins/terminal/server.js +256 -0
- package/dist/plugins/terminal/sizes.js +58 -0
- package/dist/plugins/timeline/README.md +48 -0
- package/dist/plugins/timeline/index.js +83 -0
- package/dist/plugins/timeline/public/style.css +138 -0
- package/dist/plugins/toc/README.md +40 -0
- package/dist/plugins/toc/index.js +29 -0
- package/dist/plugins/toc/public/client.js +1 -0
- package/dist/plugins/toc/public/style.css +117 -0
- package/dist/plugins/window/README.md +51 -0
- package/dist/plugins/window/index.js +91 -0
- package/dist/solid/index.js +41 -0
- package/dist/src/agents.js +81 -0
- package/dist/src/anchors.js +52 -0
- package/dist/src/api.js +282 -0
- package/dist/src/archive.js +49 -0
- package/dist/src/auth.js +67 -0
- package/dist/src/build.js +159 -0
- package/dist/src/client/page/base.css +1762 -0
- package/dist/src/client/page/main.js +2098 -0
- package/dist/src/config.js +76 -0
- package/dist/src/document.js +93 -0
- package/dist/src/entries.js +264 -0
- package/dist/src/events.js +322 -0
- package/dist/src/files.js +47 -0
- package/dist/src/formstate.js +65 -0
- package/dist/src/help.js +211 -0
- package/dist/src/html.js +34 -0
- package/dist/src/hub.js +341 -0
- package/dist/src/icons.js +6 -0
- package/dist/src/listen.js +132 -0
- package/dist/src/listeners.js +64 -0
- package/dist/src/load.js +81 -0
- package/dist/src/loader.js +179 -0
- package/dist/src/migrate.js +314 -0
- package/dist/src/package.js +52 -0
- package/dist/src/pages/blocks.js +67 -0
- package/dist/src/pages/board.js +59 -0
- package/dist/src/pages/index.js +27 -0
- package/dist/src/pages/markdown.js +863 -0
- package/dist/src/pages/render.js +665 -0
- package/dist/src/pages/window.js +29 -0
- package/dist/src/plugins.js +283 -0
- package/dist/src/public.js +24 -0
- package/dist/src/rename.js +130 -0
- package/dist/src/running.js +146 -0
- package/dist/src/serve.js +188 -0
- package/dist/src/server.js +1105 -0
- package/dist/src/site.js +179 -0
- package/dist/src/state.js +155 -0
- package/dist/src/status.js +323 -0
- package/dist/src/thread.js +68 -0
- package/dist/src/watchdog.js +38 -0
- package/dist/src/ws.js +128 -0
- package/package.json +154 -4
- package/plugins/README.md +304 -0
- package/plugins/alert/README.md +18 -0
- package/plugins/alert/index.ts +50 -0
- package/plugins/alert/public/style.css +40 -0
- package/plugins/ansi/README.md +36 -0
- package/plugins/ansi/index.ts +95 -0
- package/plugins/ansi/public/style.css +28 -0
- package/plugins/badge/README.md +32 -0
- package/plugins/badge/index.ts +36 -0
- package/plugins/badge/public/style.css +30 -0
- package/plugins/chat/README.md +81 -0
- package/plugins/chat/autosize.ts +139 -0
- package/plugins/chat/client.tsx +187 -0
- package/plugins/chat/index.ts +146 -0
- package/plugins/chat/public/style.css +143 -0
- package/plugins/claude/README.md +116 -0
- package/plugins/claude/channel.ts +136 -0
- package/plugins/claude/doctor.ts +274 -0
- package/plugins/claude/index.ts +248 -0
- package/plugins/claude/session.ts +70 -0
- package/plugins/code/README.md +54 -0
- package/plugins/code/client.ts +73 -0
- package/plugins/code/diff.ts +96 -0
- package/plugins/code/index.ts +136 -0
- package/plugins/code/public/style.css +99 -0
- package/plugins/comments/README.md +30 -0
- package/plugins/comments/client.ts +723 -0
- package/plugins/comments/index.ts +48 -0
- package/plugins/comments/public/style.css +224 -0
- package/plugins/details/README.md +24 -0
- package/plugins/details/index.ts +30 -0
- package/plugins/details/public/style.css +7 -0
- package/plugins/draft/README.md +14 -0
- package/plugins/draft/index.ts +23 -0
- package/plugins/draft/public/style.css +21 -0
- package/plugins/forge/README.md +22 -0
- package/plugins/forge/index.ts +84 -0
- package/plugins/form/README.md +126 -0
- package/plugins/form/index.ts +199 -0
- package/plugins/form/public/style.css +172 -0
- package/plugins/grid/README.md +45 -0
- package/plugins/grid/index.ts +41 -0
- package/plugins/grid/public/style.css +98 -0
- package/plugins/iframe/README.md +18 -0
- package/plugins/iframe/index.ts +53 -0
- package/plugins/iframe/public/style.css +28 -0
- package/plugins/index.ts +49 -0
- package/plugins/lightbox/README.md +24 -0
- package/plugins/lightbox/client.ts +109 -0
- package/plugins/lightbox/index.ts +25 -0
- package/plugins/lightbox/public/style.css +66 -0
- package/plugins/mermaid/README.md +21 -0
- package/plugins/mermaid/index.ts +46 -0
- package/plugins/mermaid/public/style.css +21 -0
- package/plugins/opencode/README.md +48 -0
- package/plugins/opencode/channel.ts +112 -0
- package/plugins/opencode/index.ts +91 -0
- package/plugins/opencode/shim.ts +166 -0
- package/plugins/quiet/README.md +26 -0
- package/plugins/quiet/index.ts +28 -0
- package/plugins/tabs/README.md +44 -0
- package/plugins/tabs/client.ts +96 -0
- package/plugins/tabs/index.ts +103 -0
- package/plugins/tabs/public/style.css +98 -0
- package/plugins/terminal/README.md +63 -0
- package/plugins/terminal/client.ts +391 -0
- package/plugins/terminal/host.ts +434 -0
- package/plugins/terminal/index.ts +199 -0
- package/plugins/terminal/modes.ts +30 -0
- package/plugins/terminal/public/style.css +225 -0
- package/plugins/terminal/server.ts +266 -0
- package/plugins/terminal/sizes.ts +72 -0
- package/plugins/timeline/README.md +48 -0
- package/plugins/timeline/index.ts +82 -0
- package/plugins/timeline/public/style.css +138 -0
- package/plugins/toc/README.md +40 -0
- package/plugins/toc/client.ts +236 -0
- package/plugins/toc/index.ts +55 -0
- package/plugins/toc/public/style.css +117 -0
- package/plugins/window/README.md +51 -0
- package/plugins/window/index.ts +92 -0
- package/skills/workpad/SKILL.md +588 -0
- package/solid/index.tsx +80 -0
- package/src/agents.ts +133 -0
- package/src/anchors.ts +85 -0
- package/src/api.ts +444 -0
- package/src/archive.ts +75 -0
- package/src/auth.ts +99 -0
- package/src/build.ts +213 -0
- package/src/client/base.ts +19 -0
- package/src/client/forms.ts +420 -0
- package/src/client/markdown.ts +147 -0
- package/src/client/page/base.css +1762 -0
- package/src/client/page/board.ts +137 -0
- package/src/client/page/elsewhere.ts +153 -0
- package/src/client/page/fresh.ts +343 -0
- package/src/client/page/heading-link.ts +32 -0
- package/src/client/page/live.ts +134 -0
- package/src/client/page/main.ts +398 -0
- package/src/client/page/orphans.ts +64 -0
- package/src/client/page/place.ts +260 -0
- package/src/client/page/sort.ts +49 -0
- package/src/client/page/sticky.ts +58 -0
- package/src/client/page/theme.ts +36 -0
- package/src/client/page/view.ts +9 -0
- package/src/client/page/waiting.ts +278 -0
- package/src/client/page/window.ts +40 -0
- package/src/client/reactive.ts +19 -0
- package/src/client/read.ts +111 -0
- package/src/client/runtime.ts +499 -0
- package/src/client/scroll.ts +90 -0
- package/src/client/toast.ts +99 -0
- package/src/config.ts +111 -0
- package/src/define.ts +997 -0
- package/src/document.ts +191 -0
- package/src/entries.ts +352 -0
- package/src/events.ts +463 -0
- package/src/files.ts +74 -0
- package/src/formstate.ts +72 -0
- package/src/help.ts +238 -0
- package/src/html.ts +44 -0
- package/src/hub.ts +426 -0
- package/src/icons.ts +18 -0
- package/src/listen.ts +171 -0
- package/src/listeners.ts +89 -0
- package/src/load.ts +113 -0
- package/src/loader.ts +227 -0
- package/src/migrate.ts +352 -0
- package/src/package.ts +62 -0
- package/src/pages/blocks.ts +106 -0
- package/src/pages/board.ts +89 -0
- package/src/pages/index.ts +79 -0
- package/src/pages/markdown.ts +976 -0
- package/src/pages/render.ts +748 -0
- package/src/pages/window.ts +69 -0
- package/src/plugins.ts +319 -0
- package/src/public.ts +39 -0
- package/src/rename.ts +147 -0
- package/src/running.ts +171 -0
- package/src/serve.ts +221 -0
- package/src/server.ts +1385 -0
- package/src/site.ts +170 -0
- package/src/state.ts +327 -0
- package/src/status.ts +466 -0
- package/src/thread.ts +98 -0
- package/src/watchdog.ts +53 -0
- package/src/ws.ts +155 -0
package/README.md
CHANGED
|
@@ -1,3 +1,782 @@
|
|
|
1
|
-
#
|
|
1
|
+
# workpad
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A workpad for you and your agent.
|
|
4
|
+
|
|
5
|
+
Some things are too much for text in a terminal: a plan with open questions,
|
|
6
|
+
a comparison, the state of a long-running task. With workpad the agent
|
|
7
|
+
writes them as a markdown page, and you read the page live in your browser
|
|
8
|
+
next to the conversation. Every save updates the open page, and what changed
|
|
9
|
+
is marked until you've seen it. When the agent needs something from you, it
|
|
10
|
+
puts a form on the page. Your answer goes into a log the agent is waiting on.
|
|
11
|
+
|
|
12
|
+
It stays small: markdown files, one server per project, and one way to
|
|
13
|
+
interact (submitting a form). Everything else, from cards and diagrams to a
|
|
14
|
+
terminal at the bottom of the page, is a plugin.
|
|
15
|
+
|
|
16
|
+
> **Formerly whiteboard.** The package was `@bigmistqke/whiteboard`. To move a
|
|
17
|
+
> project over, install `@bigmistqke/workpad`, stop its server, and run
|
|
18
|
+
> `workpad migrate --write` in it: `.whiteboard/` becomes `.workpad/`, the
|
|
19
|
+
> log's events and the config's imports (`ctx.wb` → `ctx.wp`, `wb-` → `wp-`)
|
|
20
|
+
> take the new names, and the machine's folders move from `whiteboard` to
|
|
21
|
+
> `workpad`. Re-run `workpad claude doctor` for the MCP server and the skill.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
In the repository you work in:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm i -D @bigmistqke/workpad
|
|
29
|
+
npx workpad init # creates .workpad/ with a pages folder
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then give your agent the skill that tells it how to use the workpad
|
|
33
|
+
([below](#the-agent-skill)).
|
|
34
|
+
|
|
35
|
+
Requires Node 22.18 or later (it runs the TypeScript config itself).
|
|
36
|
+
|
|
37
|
+
<details>
|
|
38
|
+
<summary>Without npm in the repository, or for every project at once</summary>
|
|
39
|
+
|
|
40
|
+
Install the command globally instead and run it as `workpad`:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm i -g @bigmistqke/workpad
|
|
44
|
+
workpad init
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
A project needs no `node_modules` of its own: the server resolves the
|
|
48
|
+
package's imports in `.workpad/config.ts` itself, so a Rust or Go
|
|
49
|
+
repository can have a workpad too.
|
|
50
|
+
|
|
51
|
+
</details>
|
|
52
|
+
|
|
53
|
+
## Quick start
|
|
54
|
+
|
|
55
|
+
Write a page:
|
|
56
|
+
|
|
57
|
+
````sh
|
|
58
|
+
cat > .workpad/pages/plan.md <<'EOF'
|
|
59
|
+
# Release plan
|
|
60
|
+
|
|
61
|
+
::::grid{cols=2}
|
|
62
|
+
:::item[Parser :badge[done]]
|
|
63
|
+
Rewritten, all tests pass.
|
|
64
|
+
:::
|
|
65
|
+
|
|
66
|
+
:::item[Docs :badge[todo]]
|
|
67
|
+
Not started.
|
|
68
|
+
:::
|
|
69
|
+
::::
|
|
70
|
+
|
|
71
|
+
:::form{name=ship}
|
|
72
|
+
Ship it this week? :radio[this week]{name=when} :radio[next week]{name=when}
|
|
73
|
+
|
|
74
|
+
:button[Decide]
|
|
75
|
+
:::
|
|
76
|
+
EOF
|
|
77
|
+
npx workpad show plan # starts the server, prints http://localhost:4777/plan
|
|
78
|
+
````
|
|
79
|
+
|
|
80
|
+
Open the URL, then listen for the answer in another terminal:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
npx workpad listen --wait --page plan --type ship
|
|
84
|
+
# {"id":"…","ts":"…","page":"plan","type":"ship","action":"Decide","data":{"when":"this week"}}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
That round trip is the whole idea. In practice the agent writes the page and
|
|
88
|
+
runs `listen`; you read and answer.
|
|
89
|
+
|
|
90
|
+
Agents make their pages with `workpad new <name>`, which creates the file
|
|
91
|
+
under a name no other page has: `plan`, else `plan-2`, and so on, and
|
|
92
|
+
subscribes whoever runs it (`--agent`, `WORKPAD_AGENT`, or the session an
|
|
93
|
+
agent plugin names) to it. Several agents can work in one project without
|
|
94
|
+
writing into each other's pages, or on one page together: any number listen
|
|
95
|
+
on a page, and each hears the reader's answers and the other agents'
|
|
96
|
+
messages there.
|
|
97
|
+
|
|
98
|
+
## How it works
|
|
99
|
+
|
|
100
|
+
A project is a folder with a `.workpad/` folder in it. Everything workpad keeps of a project is there; outside a project it
|
|
101
|
+
writes only the shared server's state, when you run one
|
|
102
|
+
([below](#many-projects-one-server)).
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
.workpad/
|
|
106
|
+
config.ts optional: what differs from the defaults (plugins, a stylesheet, options)
|
|
107
|
+
pages/ the pages: pages/plan.md is served at /plan
|
|
108
|
+
events.ndjson the events, one JSON object per line: form submits, comments, replies,
|
|
109
|
+
and which ones an agent received and handled
|
|
110
|
+
token the secret for what runs code (the terminal)
|
|
111
|
+
server.json the port and process of the running server
|
|
112
|
+
server.log that server's output
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Pages, the event log and the server files are gitignored by default.
|
|
116
|
+
|
|
117
|
+
- **One server per project,** or one for many ([below](#many-projects-one-server)).
|
|
118
|
+
`workpad show` starts the project's server when it isn't running. It
|
|
119
|
+
takes the port it had last time, else 4777 (or `$WORKPAD_PORT`), else
|
|
120
|
+
the next free one.
|
|
121
|
+
- **Markdown, extended by plugins.** A page is markdown, and plugins add
|
|
122
|
+
blocks to it: `:::form`, `:::grid`, `:::chat`, ```` ```mermaid ```` and
|
|
123
|
+
the rest are built-in plugins, and a project can add its own.
|
|
124
|
+
- **Live pages.** Every save of a page updates the open tab in place, and
|
|
125
|
+
blocks that changed are marked until you've seen them.
|
|
126
|
+
- **Repository files render too.** `/-/README.md` shows that file as a page,
|
|
127
|
+
`/-/src/` lists a folder, and other text files show as highlighted code.
|
|
128
|
+
Relative links between documents work the way they do in the repository.
|
|
129
|
+
- **Markdown never breaks a page.** A block nobody brings renders its
|
|
130
|
+
content as plain markdown, and one that throws shows an error in place of
|
|
131
|
+
that block only. A config that fails to load leaves pages as their raw
|
|
132
|
+
text, with the error above it.
|
|
133
|
+
|
|
134
|
+
## Many projects, one server
|
|
135
|
+
|
|
136
|
+
With many checkouts at once (git worktrees, job folders), one server per
|
|
137
|
+
project means one port per project, and no place that shows them all. A
|
|
138
|
+
machine config gathers them under one server instead:
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
// ~/.config/workpad/config.json ($XDG_CONFIG_HOME/workpad, or $WORKPAD_HOME)
|
|
142
|
+
{
|
|
143
|
+
"port": 4777,
|
|
144
|
+
"entries": {
|
|
145
|
+
"rg": {
|
|
146
|
+
"include": ["~/rg/develop", "~/rg/develop/.claude/worktrees/*", "~/rg/worksite/jobs/*"],
|
|
147
|
+
"exclude": ["~/rg/worksite/archive/**"]
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Every folder an include matches, that no exclude matches and that has a
|
|
154
|
+
`.workpad/` folder, is a project of that entry. It is served at
|
|
155
|
+
`/<entry>/<path>/`, where `<path>` is the include's last plain folder and what
|
|
156
|
+
its wildcards matched: `/rg/develop/`, `/rg/worktrees/cmux/`,
|
|
157
|
+
`/rg/jobs/2026-11-19-solid-port/`. A second folder that would get the same path
|
|
158
|
+
gets `-2`. The server looks for projects again every few seconds, so a new
|
|
159
|
+
worktree with a `.workpad/` shows up, and a removed one goes, without a
|
|
160
|
+
restart.
|
|
161
|
+
|
|
162
|
+
An entry's `"files": false` makes each of its projects serve none of its own
|
|
163
|
+
files and watch only its `.workpad/`, as `files: false` in a project's
|
|
164
|
+
config does, for projects with a config and without; a project's config that
|
|
165
|
+
sets `files` still has its way. Left out, a project serves its files, as
|
|
166
|
+
without the machine config.
|
|
167
|
+
|
|
168
|
+
- **`/` is the overview of every project,** as a project's own overview is of
|
|
169
|
+
its pages, and it looks and updates the same: each project under its name
|
|
170
|
+
(`develop`, `worktrees › cmux`), its pages as its overview lists them, with
|
|
171
|
+
the inbox badge on those waiting for you, and its documents folded under them by folder, under its folder. Projects with something waiting
|
|
172
|
+
come first, and in each the pages waiting; projects without pages are folded
|
|
173
|
+
at the end, under the server's version and the folders it is boxed to.
|
|
174
|
+
- **Every page's menu of what waits elsewhere** (the inbox in its header)
|
|
175
|
+
lists the other projects of its entry too, under each project's name.
|
|
176
|
+
- **Commands work as before,** in the project's folder: `show`, `url`,
|
|
177
|
+
`listen`, `append`, `events`, `status` act on their own project and find the
|
|
178
|
+
shared server. Events stay in each project's own `.workpad/events.ndjson`.
|
|
179
|
+
A project outside every include runs its own server, as without the config.
|
|
180
|
+
- **A listen without a page covers the whole entry.** `workpad listen`
|
|
181
|
+
without `--page` in a project of an entry listens on every page of each of
|
|
182
|
+
the entry's projects, from each project's own log, and says where each
|
|
183
|
+
answer is from (`project`, its folder, and the page's `url`). So an agent
|
|
184
|
+
overseeing the others runs `workpad listen` once (it runs on) and hears
|
|
185
|
+
everything, also what the others hear.
|
|
186
|
+
- **Commands never start the shared server.** `show` without it says so; a
|
|
187
|
+
`listen` waits for it to appear, and the answers in the log reach it either
|
|
188
|
+
way; `status` and `docs` answer without it. A project outside every include
|
|
189
|
+
still starts its own, with `show`.
|
|
190
|
+
- **You start it, outside the agents' sandboxes:** `workpad serve` outside
|
|
191
|
+
any project, in a terminal or as a login service. It runs every project's
|
|
192
|
+
config and plugins (the terminal runs programs), so it can do whatever any
|
|
193
|
+
of them can; started from inside one agent's sandbox, it would be boxed in
|
|
194
|
+
there and miss the other folders. Box it on its own instead, with a
|
|
195
|
+
wrapper of your own, as you may do for your agent: `workpad paths
|
|
196
|
+
--write` and `--read` print what it needs (`:` between folders), so the
|
|
197
|
+
box follows the config:
|
|
198
|
+
```sh
|
|
199
|
+
safehouse --workdir= --add-dirs="$(workpad paths --write)" \
|
|
200
|
+
--add-dirs-ro="$(workpad paths --read)" \
|
|
201
|
+
-- WORKPAD_SANDBOX="$(workpad paths --write)" workpad serve
|
|
202
|
+
```
|
|
203
|
+
`$WORKPAD_SANDBOX`, when set, is what the overview says it is boxed to.
|
|
204
|
+
The server writes only its state folder (`~/.local/state/workpad`:
|
|
205
|
+
`server.json`, its log, the overview's project) and reads the config, so
|
|
206
|
+
nothing running inside it can change how it is served or boxed next time.
|
|
207
|
+
See [DESIGN.md](DESIGN.md#entries-one-server-for-many-projects).
|
|
208
|
+
- **Versions.** The server records its version (in `server.json` in its state
|
|
209
|
+
folder, and in the overview). `serve` from a newer workpad takes an older
|
|
210
|
+
server over: it asks it to exit and starts in its place. A command from a
|
|
211
|
+
newer workpad uses an older server and says to restart it; an older one
|
|
212
|
+
never replaces a newer one.
|
|
213
|
+
- **In a container.** A shared server in a container (Docker, OrbStack),
|
|
214
|
+
with every folder mounted at its own path, is reached from outside it.
|
|
215
|
+
These fields of the config say how; each one left out keeps the default:
|
|
216
|
+
- `"host": "0.0.0.0"` (or `$WORKPAD_HOST`): the address the servers
|
|
217
|
+
listen on, the shared one and a project's own. By default `127.0.0.1`:
|
|
218
|
+
this machine alone.
|
|
219
|
+
- `"origins": ["https://workpad.local"]`: where else a page may be
|
|
220
|
+
open, to follow its changes and use the project's token (the terminal).
|
|
221
|
+
By default only a page at `http://localhost` or `http://127.0.0.1` may;
|
|
222
|
+
one of any other site never can.
|
|
223
|
+
- `"url": "https://workpad.local"` (or `$WORKPAD_URL`): where the
|
|
224
|
+
shared server is reached, when not at `http://localhost:<port>`: a
|
|
225
|
+
scheme, a host and a port, no path. The server records it in its
|
|
226
|
+
`server.json`, and the commands reach it there and print it (`show`,
|
|
227
|
+
`url --full`). `$WORKPAD_URL` does the same for a project's own server
|
|
228
|
+
started with it. By default `http://localhost:<port>`.
|
|
229
|
+
- `"files": false` on an entry (see above) keeps its projects from
|
|
230
|
+
watching more than their `.workpad/`. A page's own folder is watched
|
|
231
|
+
besides, once it is opened, so a page in a folder made and written into
|
|
232
|
+
at once (which a container's mount may say nothing of) still goes live.
|
|
233
|
+
- **A project per checkout.** A folder is a project once it has a
|
|
234
|
+
`.workpad/`: have whatever makes worktrees and job folders run
|
|
235
|
+
`workpad init` in each, and every one appears on the index by itself, its
|
|
236
|
+
pages and answers its own.
|
|
237
|
+
|
|
238
|
+
## Forms and answers
|
|
239
|
+
|
|
240
|
+
A form with a `name` and no `action` attribute is recorded when submitted:
|
|
241
|
+
|
|
242
|
+
```json
|
|
243
|
+
{"id":"…","ts":"2026-…","page":"plan","type":"ship","action":"Decide","data":{"when":"this week"}}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
`type` is the form's name, `action` is the button that was pressed and
|
|
247
|
+
`data` holds the fields. The log is an event stream: a plugin can append
|
|
248
|
+
events of other types too, through `api.append(type, data)`. Those types
|
|
249
|
+
are named after their plugin, `<plugin>:<what>` (`chat:message`,
|
|
250
|
+
`comments:reply`, workpad's own `workpad:handled`), so a form's name
|
|
251
|
+
can't contain a colon and its answers never mix with them. Appending is
|
|
252
|
+
optimistic: the event is in `api.events()` at once, with `sending: true`
|
|
253
|
+
until the server has it, so show it then as on its way, not as done: in
|
|
254
|
+
`--wp-sending` (grey), as the core does for a form's button and the chat
|
|
255
|
+
for a message. A send that heard nothing back is tried again, without being
|
|
256
|
+
appended twice; only when none gets through does the event leave the
|
|
257
|
+
events again and the promise `api.append` returned reject. The built-in
|
|
258
|
+
`form` plugin writes forms as markdown with inputs inline
|
|
259
|
+
(`:::form{name=ship}` … `:radio[this week]{name=when}` … `:::`); a
|
|
260
|
+
hand-written `<form name="…">` works without it.
|
|
261
|
+
|
|
262
|
+
A plugin says which of its events are for an agent (`handOut: true`): chat
|
|
263
|
+
messages and comments are, so a `listen` on the page hands them out like
|
|
264
|
+
answers. Others, such as a vote, stay in the log, for `workpad events`
|
|
265
|
+
or a `listen --type` that asks for them.
|
|
266
|
+
|
|
267
|
+
Reading answers:
|
|
268
|
+
|
|
269
|
+
```sh
|
|
270
|
+
workpad listen --wait --page plan --type ship # the next answer to that form, then exits
|
|
271
|
+
workpad listen --page plan # streams them, never exits
|
|
272
|
+
workpad listen --channel --page plan # your session's channel brings them; exits at once
|
|
273
|
+
workpad events --page plan --last 1 # what was already submitted
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
`listen` never loses an answer. An answer goes through three states: *not
|
|
277
|
+
received* (nobody has it yet), *received* (someone has it: a listen printed
|
|
278
|
+
it, `workpad:received` in the log, saying by whom) and *handled* (someone
|
|
279
|
+
is done with it: replied in its chat or thread, or ran `workpad handled
|
|
280
|
+
<id>`, `workpad:handled` in the log). A log from 0.10 or older, with
|
|
281
|
+
`workpad:taken` and `workpad:picked`, is converted once, the first
|
|
282
|
+
time it is read. A listen prints everything on its page not handled yet,
|
|
283
|
+
including what came before it started and what it was handed before (marked
|
|
284
|
+
`"again": true`), so an answer an agent saw and forgot comes back. So an
|
|
285
|
+
agent can ask, do other work, and listen later. Any number listen on a
|
|
286
|
+
page, and each hears everything there but its own events; the page's green
|
|
287
|
+
dot lists who listens.
|
|
288
|
+
|
|
289
|
+
`listen` is built from smaller pieces that are commands too, for a script that
|
|
290
|
+
wants to use the log its own way:
|
|
291
|
+
|
|
292
|
+
```sh
|
|
293
|
+
workpad events --follow --page plan # every new event as it comes, marking nothing
|
|
294
|
+
workpad handled <event id> # the agent is done with it
|
|
295
|
+
workpad append --page plan --type <t> # write one
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
The same pieces are a module, `@bigmistqke/workpad/log`: `read`,
|
|
299
|
+
`follow`, `appendEvent`, `receive`, `handle`, and `handOut`, which is `listen` itself.
|
|
300
|
+
It works on a log on disk; [the API](#the-api-workpads-state-as-data) asks a server.
|
|
301
|
+
|
|
302
|
+
## The API: workpad's state as data
|
|
303
|
+
|
|
304
|
+
A script that builds boards of its own (every form waiting for you across
|
|
305
|
+
projects, open merge requests, a kanban) or acts on them reads workpad's
|
|
306
|
+
state through `@bigmistqke/workpad/api`, a typed client whose every call
|
|
307
|
+
is an HTTP request to a server: it works from another process, a container
|
|
308
|
+
or another machine as well as from the project's folder.
|
|
309
|
+
|
|
310
|
+
```ts
|
|
311
|
+
import { connect } from '@bigmistqke/workpad/api'
|
|
312
|
+
|
|
313
|
+
const wp = await connect() // this folder's project (its server, or the shared server's path for it), else the shared server
|
|
314
|
+
// or: connect('/path/to/project'), connect('http://localhost:4777'),
|
|
315
|
+
// connect('https://workpad.local/rg/develop'), connect({ shared: true, agent: 'mini' })
|
|
316
|
+
|
|
317
|
+
for (const form of await wp.forms({ state: 'open' }))
|
|
318
|
+
console.log(form.project, form.page, form.question, form.options.map(o => o.label), form.askedAt, form.url)
|
|
319
|
+
|
|
320
|
+
const merge = await wp.form({ project: '/rg/jobs', page: 'awaiting-you', name: 'merge-2152' })
|
|
321
|
+
await wp.hold(merge!, 'waits for !2145') // and later: wp.release(merge!)
|
|
322
|
+
|
|
323
|
+
for await (const e of wp.live({ kind: ['answer', 'chat'] }))
|
|
324
|
+
console.log(e.project, e.page, e.type, e.data)
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Connected to the shared server, the lists cover every project it serves,
|
|
328
|
+
each item with its project's path (`project`: `/rg/develop`; `''` on a
|
|
329
|
+
project's own server); name one with `project` (its path, folder or name).
|
|
330
|
+
A form as a list gave it is a reference to it (`wp.hold(form, …)`), as is
|
|
331
|
+
`'page#name'` on one project.
|
|
332
|
+
|
|
333
|
+
| call | what it gives or does |
|
|
334
|
+
| --- | --- |
|
|
335
|
+
| `projects()` | the projects: `base` (their path), `name`, `label`, `dir`, `entry` |
|
|
336
|
+
| `pages(scope?)` | each page: `title`, `url`, `file`, `modified`, `subscribers`, its questions (`forms`), how much `awaiting` the reader |
|
|
337
|
+
| `forms({ project?, page?, state?, name? })` | each question: `name`, `question` (its text), `options` (`field`, `label`, `value`, `kind`, `recommended`, `other`), `buttons`, `anchor` (`form:<name>`, or `message:<id>` for one in a chat message), `url`, `askedAt`, `state` (open, pending, received, handled, held, settled), `hold` (`reason`, `since`, `by`), the latest `answer`, its `chat` |
|
|
338
|
+
| `form(ref)` | one form, or null |
|
|
339
|
+
| `status(scope?)` | what `workpad status` reports, per page (`PageStatus`) |
|
|
340
|
+
| `chats({ project?, page?, chat? })` | each chat's `messages`, and whether it is `awaitingReply` |
|
|
341
|
+
| `events({ project?, page?, type?, kind?, since? })` | the log's events, each with its `project` and `kind` (answer, chat, comment, mark, other) |
|
|
342
|
+
| `live({ …the same, signal? })` | the events as they come, an async iterable; `since` replays what came after an event first |
|
|
343
|
+
| `subscriptions(scope?)`, `agents({ project? })`, `listeners(scope?)` | who is subscribed where; each agent's `name`, `subscribed`, `listening`, `lastSeen`; who listens now |
|
|
344
|
+
| `anchors(page, { project? })` | what a page can be linked to |
|
|
345
|
+
| `writePage(page, markdown, { project? })` | write a page whole; a page made is subscribed to by whoever writes (a form keeps its answers while it keeps its name) |
|
|
346
|
+
| `hold(form, reason)`, `release(form)`, `settle(form)` | a form's state, as `workpad hold`, `release` and `settle` |
|
|
347
|
+
| `handled(events, { project? })` | done with these answers, as `workpad handled` |
|
|
348
|
+
|
|
349
|
+
Writes send the project's token (`.workpad/token`): read from the
|
|
350
|
+
project's folder when the machine has it, else given, `connect({ token })`
|
|
351
|
+
(one, or a function of the project). Who writes is `agent` (default
|
|
352
|
+
`WORKPAD_AGENT`), the `by` of what is appended. A failed call throws a
|
|
353
|
+
`WorkpadError` with the server's `status` and message. Every type is
|
|
354
|
+
exported (`FormInfo`, `PageInfo`, `LiveEvent`, `FormState`, …).
|
|
355
|
+
|
|
356
|
+
A command gets the same client as `ctx.wp`, connected to its project's
|
|
357
|
+
server (started at its first call) and writing as whoever runs it:
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
commands: {
|
|
361
|
+
'': {
|
|
362
|
+
description: 'what waits for the reader here',
|
|
363
|
+
async run(ctx) {
|
|
364
|
+
for (const f of await ctx.wp.forms({ state: 'open' })) console.log(`${f.page}#${f.name}: ${f.question}`)
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### Over HTTP
|
|
371
|
+
|
|
372
|
+
The client is a thin layer on the server's endpoints, which any language
|
|
373
|
+
can call. A project's are at its path (`/rg/develop/api/…` under the
|
|
374
|
+
shared server); the shared server answers the lists and the stream at its
|
|
375
|
+
root for every project.
|
|
376
|
+
|
|
377
|
+
| endpoint | |
|
|
378
|
+
| --- | --- |
|
|
379
|
+
| `GET /api/projects` | the projects served |
|
|
380
|
+
| `GET /api/pages?page=` | the pages, `page` and those below it |
|
|
381
|
+
| `GET /api/forms?page=&state=open,held&name=` | the forms (`state` and `name` take several, comma-separated) |
|
|
382
|
+
| `GET /api/chats?page=&chat=` | the chats |
|
|
383
|
+
| `GET /api/subscriptions?page=&agent=`, `GET /api/agents` | subscriptions, agents |
|
|
384
|
+
| `GET /api/stream?page=&type=&kind=&since=` | the log as it grows, as server-sent events: `event: event`, its `data` a `LiveEvent` |
|
|
385
|
+
| `GET /api/status?page=`, `GET /api/events?page=&type=&kind=&since=`, `GET /api/listeners?page=`, `GET /api/anchors?page=` | one project's |
|
|
386
|
+
| `POST /api/forms/hold` `{ page, forms, reason, agent? }` | hold forms (token) |
|
|
387
|
+
| `POST /api/forms/release` `{ page, forms, agent? }` | release them (token) |
|
|
388
|
+
| `POST /api/forms/settle` `{ page, forms \| all: true, agent? }` | settle them (token) |
|
|
389
|
+
| `POST /api/handled` `{ ids, agent? }` | mark answers handled (token) |
|
|
390
|
+
| `POST /api/page` `{ page, markdown, agent? }` | write a page (token) |
|
|
391
|
+
|
|
392
|
+
The token goes in the header `x-workpad-token`; a write without it is
|
|
393
|
+
refused (403), one the state doesn't allow (holding an answered form,
|
|
394
|
+
releasing one not held) is a 400 with what is wrong. The stream is
|
|
395
|
+
server-sent events rather than the pages' WebSocket (`/api/live`): that one
|
|
396
|
+
only tells a page that something changed, and is for the server's own pages;
|
|
397
|
+
a script wants the events themselves, over plain HTTP that any proxy passes
|
|
398
|
+
and `fetch` reads, and picks up after a dropped connection where it was
|
|
399
|
+
(`since`, as the client does).
|
|
400
|
+
|
|
401
|
+
## A terminal on every page
|
|
402
|
+
|
|
403
|
+
The terminal plugin (`@bigmistqke/workpad/terminal`) puts a terminal
|
|
404
|
+
drawer at the bottom of every page, with tabs whose sessions outlive the
|
|
405
|
+
browser tab and the server; an agent can show you a page where your
|
|
406
|
+
drawer is. See [its README](plugins/terminal/README.md).
|
|
407
|
+
|
|
408
|
+
## Claude Code
|
|
409
|
+
|
|
410
|
+
The Claude Code plugin (`@bigmistqke/workpad/claude`) brings your
|
|
411
|
+
answers to an agent session without the agent having to listen for them,
|
|
412
|
+
through a channel that pushes them into the session, and sends a turn that
|
|
413
|
+
ends with something left on its pages on once, through a hook. See
|
|
414
|
+
[its README](plugins/claude/README.md).
|
|
415
|
+
|
|
416
|
+
## opencode
|
|
417
|
+
|
|
418
|
+
The opencode plugin (`@bigmistqke/workpad/opencode`) does the same for
|
|
419
|
+
an [opencode](https://opencode.ai) session, with a plugin opencode loads,
|
|
420
|
+
and needs no flag. See [its README](plugins/opencode/README.md).
|
|
421
|
+
|
|
422
|
+
## Commands
|
|
423
|
+
|
|
424
|
+
Every command works on the project of the current folder: the nearest folder
|
|
425
|
+
upward with a `.workpad/` folder.
|
|
426
|
+
`workpad <command> --help` (or `workpad help <command>`) says what a
|
|
427
|
+
command takes and does, its options included, and runs nothing; a plugin's
|
|
428
|
+
commands answer it too.
|
|
429
|
+
|
|
430
|
+
| command | does |
|
|
431
|
+
| --- | --- |
|
|
432
|
+
| `workpad init [name]` | make this folder a project |
|
|
433
|
+
| `workpad root` | print the folder pages go into |
|
|
434
|
+
| `workpad new <name>` | create a page under a name no other page has (`name`, else `name-2`, …), print its path |
|
|
435
|
+
| `workpad show <page\|file> [<anchor>]` | start the project's server if needed (never the shared one), print the page's URL; with an anchor, one that opens the page there |
|
|
436
|
+
| `workpad url <page\|file> [<anchor>] [--full]` | a link to a page or a place on it, from the server's root (`/rg/jobs/x/decisions#form:logger`), so it works however the board is opened; `--full` for the whole URL; checks the anchor |
|
|
437
|
+
| `workpad settle <page\|file> <form>… \| --all` | settle questions answered elsewhere (a chat, the design moving on): no longer unanswered; an answer opens one again |
|
|
438
|
+
| `workpad hold <page\|file> <form>… "<reason>"` | hold questions that wait on something else ("waits for !2145"): shown held with the reason, not waiting for the reader, not settled; an answer ends the hold |
|
|
439
|
+
| `workpad release <page\|file> <form>…` | release held questions: they wait for the reader again |
|
|
440
|
+
| `workpad check [<page\|file>…]` | what is wrong on pages as they render, a line each; exits 1 when there is any |
|
|
441
|
+
| `workpad migrate [<folder\|file>…] [--write]` | after updating workpad, pages written in an older syntax in the current one (0.15: items as `:::item`, `steps` → `tabs`, callouts → alerts, `:check` → `:checkbox`, an ansi fence's title window); code is left alone, a second run changes nothing. Before that, a project or machine still under the old name, whiteboard, moves to the new one (see above). A dry run lists each page and what would change, exiting 1 when any would; `--write` rewrites them. Default: `.workpad/pages` |
|
|
442
|
+
| `workpad anchors <page\|file>` | what a page can be linked to: `#open-questions` (a heading), `#form:logger`, `#chat:notes`, `#tab:intro`, `#details:why` |
|
|
443
|
+
| `workpad archive <page>` | a page that did its job: it leaves the pages and its events the log, kept in `.workpad/archive/` as markdown with what was answered on it |
|
|
444
|
+
| `workpad destroy <page>` | a throwaway page: remove its file, and all its events from the log |
|
|
445
|
+
| `workpad prune <page> [--type <t>] [--id <id>]` | remove a page's events from the log (all, one type, or one), keep the page |
|
|
446
|
+
| `workpad edit <event id> --data <json>` | change an agent's own event in place: merged into its data, its id kept |
|
|
447
|
+
| `workpad thread <event id>` | an answer or chat message with its question: the form as written (chosen options marked), its answers and its chat, in order |
|
|
448
|
+
| `workpad scroll <page\|file> <where>` | scroll the tabs that have the page open to a heading's text, a form's name or any text on it; exits 1 when nothing matches or no tab has it open |
|
|
449
|
+
| `workpad docs [<block\|plugin> \| --all]` | print how to write pages in this project: a line per block, grouped by what it is for (ask, show, arrange, mark); with a block's or plugin's name, that plugin's docs; with `--all`, every plugin's |
|
|
450
|
+
| `workpad events [filters] [--follow]` | print recorded events; with `--follow`, then each new one as it comes, marking nothing |
|
|
451
|
+
| `workpad listen [filters] [--wait \| --channel] [--agent <who>]` | print everything matching you haven't handled (the reader's answers, other agents' messages; one handed out before with `"again": true`), then each as it comes, never exiting; with `--wait`, exit once it printed what there is, or with nothing there the next; with `--channel`, make the pages yours and exit, your session's confirmed channel bringing their answers (without `--page`, every page, also later ones); any number listen on a page; with `--page`, subscribes you to it; without, every page (in a project of the machine config's entries, every page of the entry, each event with its `project` and `url`) |
|
|
452
|
+
| `workpad append --page <p> --type <t> [--data <json>]` | add an event to a page's log, such as a reply to a comment |
|
|
453
|
+
| `workpad handled <event id…>` | you handled these answers (a reply in their chat does it too): no listen hands them out again |
|
|
454
|
+
| `workpad agent [name <n> \| name --clear \| list \| unsubscribe <agent> [--page <p>…] \| ping [<code>]]` | who you are (your id, `--agent`): alone, your id and name; `name` names you (one per agent, shown in the list of who listens and in `status`); `list` everyone on the board, saying who is subscribed and not listening; `unsubscribe` takes an agent (id or name) off the pages named, else off all; `ping` checks that an agent plugin's channel reaches you (it pushes a pong with a code; with the code, confirms it, and the channel then brings the answers on your pages, as received) |
|
|
455
|
+
| `workpad status [--page <p>]` | per page: who is subscribed, questions without an answer, answers nobody received, answers received and not handled, chats waiting for a reply, who is listening |
|
|
456
|
+
| `workpad build [globs…] [--out <dir>] [--skip <a,b>]` | pages as a static site (see [Building a site](#building-a-site)) |
|
|
457
|
+
| `workpad serve` | run the server in the foreground; for a project of the machine config's entries, or outside any project, the shared server |
|
|
458
|
+
| `workpad skill [dir]` | print where the agent skill is, or link it into a skills folder |
|
|
459
|
+
| `workpad paths [--write\|--read]` | the folders the shared server needs, `:` between them, for a sandbox wrapper to grant (see [Many projects, one server](#many-projects-one-server)) |
|
|
460
|
+
|
|
461
|
+
Filters: `--page <page|file>` (includes pages below it), `--type <type>` (a form's type is its name).
|
|
462
|
+
`listen --wait` also takes `--timeout <seconds>` (exits 2 on timeout);
|
|
463
|
+
commands that act as someone take `--agent <who>` (else `WORKPAD_AGENT`, else the session an agent plugin names);
|
|
464
|
+
`events` takes `--since <time or event id>` and `--last <n>`.
|
|
465
|
+
|
|
466
|
+
## Configuration
|
|
467
|
+
|
|
468
|
+
A project needs no config. Without one it has the defaults: the built-in
|
|
469
|
+
plugins and the folder's name. Add `.workpad/config.ts` to change any of
|
|
470
|
+
that; it takes effect at once, also while the server runs. Every field is
|
|
471
|
+
optional:
|
|
472
|
+
|
|
473
|
+
```ts
|
|
474
|
+
// .workpad/config.ts
|
|
475
|
+
import { defineConfig } from '@bigmistqke/workpad'
|
|
476
|
+
import terminal from '@bigmistqke/workpad/terminal'
|
|
477
|
+
import code from '@bigmistqke/workpad/code'
|
|
478
|
+
|
|
479
|
+
export default defineConfig({
|
|
480
|
+
name: 'my-project', // shown in titles (default: the folder name)
|
|
481
|
+
plugins: [ // added to the built-in ones
|
|
482
|
+
terminal(),
|
|
483
|
+
code({ themes: { light: 'github-light', dark: 'github-dark' } }), // same name: replaces the built-in
|
|
484
|
+
],
|
|
485
|
+
style: new URL('./site.css', import.meta.url), // a stylesheet on every page, after the others
|
|
486
|
+
files: true, // serve and watch the rest of the project at /-/ (default: true, or its machine config entry's files)
|
|
487
|
+
build: { pages: ['docs/**/*.md'] }, // what `workpad build` makes (see Building a site)
|
|
488
|
+
commands: { // commands of the project's own: `workpad mr`
|
|
489
|
+
mr: {
|
|
490
|
+
description: 'the merge forms waiting for me',
|
|
491
|
+
async run(ctx) {
|
|
492
|
+
for (const f of await ctx.wp.forms({ state: 'open' })) console.log(f.url, f.question)
|
|
493
|
+
},
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
})
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
`commands` are the project's own commands, without writing a plugin around
|
|
500
|
+
them: `workpad mr` runs `mr`. Each is declared as a plugin's command is
|
|
501
|
+
(`description`, `args`, `options`, `rest`, `run`; see
|
|
502
|
+
[plugins/README.md](plugins/README.md)) and gets the same context: its
|
|
503
|
+
options and arguments, the project, its folder `.workpad/<name>/`, and
|
|
504
|
+
`ctx.wp`, [the API](#the-api-workpads-state-as-data) at the project's
|
|
505
|
+
server. `workpad help` lists them, and `workpad mr --help` says what
|
|
506
|
+
one takes. A name is letters, digits, `-` and `_`; one that is a built-in
|
|
507
|
+
command's (`status`), a folder of the core's (`pages`) or a plugin's
|
|
508
|
+
(`chat`) is refused, and the config with it, saying which. A command may
|
|
509
|
+
say `live: true`: reserved for a feature to come, where a page's own
|
|
510
|
+
inline scripts call such commands; it is accepted, and does nothing yet.
|
|
511
|
+
|
|
512
|
+
The page's look is CSS custom properties, set in the base stylesheet and
|
|
513
|
+
used by every built-in plugin, which a project's stylesheet overrides:
|
|
514
|
+
|
|
515
|
+
- colours: `--bg`, `--text`, `--muted`, `--border`, `--accent`,
|
|
516
|
+
`--accent-text`, `--ok`, `--warn`, `--bad`;
|
|
517
|
+
- type: `--serif`, `--sans`, `--mono`; `--text-size`, one size for the
|
|
518
|
+
article and the interface beside it (buttons, inputs, tables; `--ui-small`
|
|
519
|
+
and `--ui-text` follow it), with headings as multiples of it, never
|
|
520
|
+
smaller; the article's `--line-height` (its margins are in `em`, so they
|
|
521
|
+
follow); small labels' `--ui-tiny`, and `--ui-line-height`;
|
|
522
|
+
- space: the article's `--rhythm` (1.2 × `--text-size`) and the steps made
|
|
523
|
+
of it, from far to close: `--gap-section` (above a section's heading),
|
|
524
|
+
`--gap-subsection` (above a subsection's), `--gap-heading` (under a
|
|
525
|
+
heading), `--gap-block` (a set-off block: an alert, a form, a grid),
|
|
526
|
+
`--gap-prose` (around a list, code, a table among paragraphs),
|
|
527
|
+
`--gap-paragraph` (paragraph to paragraph),
|
|
528
|
+
`--gap-group` (things side by side) and `--gap-attach` (a part attached to
|
|
529
|
+
what is above it); inside a form, list item, card, details, alert or
|
|
530
|
+
timeline step, the block and prose steps are the attach step; the interface's `--space-2xs` … `--space-3xl` (2, 4,
|
|
531
|
+
6, 8, 10, 12, 16, 24px);
|
|
532
|
+
- shape: `--radius-sm`, `--radius`, `--radius-lg`, `--radius-pill`,
|
|
533
|
+
`--hairline`, `--shadow-pop`; tints `--tint-faint`, `--tint-soft`,
|
|
534
|
+
`--tint-strong`; `--speed`;
|
|
535
|
+
- widths: `--measure`, `--wide`; layers: `--layer-aside`,
|
|
536
|
+
`--layer-popover`, `--layer-window`, `--layer-top` (for a plugin's own
|
|
537
|
+
floating things).
|
|
538
|
+
|
|
539
|
+
Every colour is a `light-dark()` pair, so one line sets it for both themes:
|
|
540
|
+
|
|
541
|
+
```css
|
|
542
|
+
/* .workpad/site.css */
|
|
543
|
+
:root { --accent: light-dark(#c2410c, #fb923c); --serif: "Source Serif 4", Georgia, serif; }
|
|
544
|
+
/* denser: smaller text, tighter blocks */
|
|
545
|
+
:root { --text-size: 14px; --rhythm: 1em; }
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
The built-in plugins are alert, ansi, badge, chat, code, comments, details, draft,
|
|
549
|
+
forge, form, grid, iframe, lightbox, mermaid, quiet, tabs, timeline, toc and window: every
|
|
550
|
+
project has them, and `workpad docs` shows how to write each. A config's `plugins` add to
|
|
551
|
+
them, and one with a built-in's name replaces it. The table of contents (`toc`) shows on a page
|
|
552
|
+
that asks for it in its frontmatter (`plugins: { toc: true }`), or on every page with
|
|
553
|
+
`toc({ always: true })` in the config. The terminal and the agent plugins (Claude Code, opencode) are opt-in, since
|
|
554
|
+
they run code or are about one agent.
|
|
555
|
+
|
|
556
|
+
Named forms need nothing in the config: the core sends a submit of any
|
|
557
|
+
`<form name>` as an event, on any page.
|
|
558
|
+
|
|
559
|
+
Set `files: false` for a project whose folder is not a repository, such as
|
|
560
|
+
your home folder. Then only `.workpad/` is served and watched.
|
|
561
|
+
`workpad init` sets it when run in the home folder.
|
|
562
|
+
|
|
563
|
+
Or say which of the project's files are shown (listed, served at `-/…`,
|
|
564
|
+
linked to and watched), with globs relative to the project folder:
|
|
565
|
+
|
|
566
|
+
```ts
|
|
567
|
+
export default defineConfig({
|
|
568
|
+
files: { include: ['docs/**', '*.md'], exclude: ['docs/drafts'] },
|
|
569
|
+
})
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
Without `include`, all files are shown but what `exclude` names.
|
|
573
|
+
`node_modules` and `.git` are always left out, at any depth, and never
|
|
574
|
+
watched.
|
|
575
|
+
|
|
576
|
+
## Building a site
|
|
577
|
+
|
|
578
|
+
Docs can be written as pages: the agent drafts, you comment on passages, a
|
|
579
|
+
form settles a choice, a chat clears up a question. Kept in a folder of the
|
|
580
|
+
repository (`docs/`), they are live pages at `/-/docs/…` while you write
|
|
581
|
+
them. `workpad build` turns them into a site: plain HTML files with their
|
|
582
|
+
images and styles, links between them relative, for GitHub Pages or any
|
|
583
|
+
file host.
|
|
584
|
+
|
|
585
|
+
```ts
|
|
586
|
+
export default defineConfig({
|
|
587
|
+
build: {
|
|
588
|
+
pages: ['docs/**/*.md', '!docs/notes/**'], // which pages, as globs; ! leaves out
|
|
589
|
+
skip: ['form', 'chat', 'comments', 'draft'], // plugins or blocks left out (this is the default)
|
|
590
|
+
out: 'site', // where it goes (default: site)
|
|
591
|
+
},
|
|
592
|
+
})
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
```sh
|
|
596
|
+
workpad build # as configured
|
|
597
|
+
workpad build 'docs/guide/*.md' --out preview # or what is given, over the config
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
- **What is for writing is left out:** the live channel and the event log
|
|
601
|
+
(so no answers, chats or comments), new-content marks and toasts, and the
|
|
602
|
+
plugins and blocks in `skip`: their blocks render as nothing, their
|
|
603
|
+
stylesheets, browser modules and what they add to the page aren't included.
|
|
604
|
+
A plugin's `slots` is asked with no request, since no browser asked for the
|
|
605
|
+
page: the terminal's drawer, which is only for the project's own browser,
|
|
606
|
+
isn't there. Files a page names (its images, an iframe's page) are copied
|
|
607
|
+
beside it.
|
|
608
|
+
- **What is for reading stays:** tabs, the lightbox, ⤢ on
|
|
609
|
+
windows, the theme toggle, the contents, details. Code and diagrams were
|
|
610
|
+
rendered on the server, so the site loads no highlighter.
|
|
611
|
+
- **`:::draft`** is for what is there while you write and not after: a note
|
|
612
|
+
to check something, two versions of a paragraph. It shows marked as a
|
|
613
|
+
draft, and the build leaves it out.
|
|
614
|
+
- **Where pages land:** at their places below the folder they share, a
|
|
615
|
+
README.md or index.md as its folder's index.html (`docs/api/forms.md` →
|
|
616
|
+
`site/api/forms.html`). A link to a page outside the build, or to a file
|
|
617
|
+
outside that folder, stays as written, and the build says so.
|
|
618
|
+
- **The folder is the build's:** it is replaced on each build, and one that
|
|
619
|
+
holds files a build didn't write is refused.
|
|
620
|
+
|
|
621
|
+
Open the site through a web server (`npx serve site`) rather than as files:
|
|
622
|
+
browsers don't run JavaScript modules from `file://`. The pages read either
|
|
623
|
+
way, but tabs, the lightbox and the theme toggle need the server.
|
|
624
|
+
|
|
625
|
+
## Writing a plugin
|
|
626
|
+
|
|
627
|
+
Everything that extends workpad is a plugin: syntax for pages (blocks),
|
|
628
|
+
behaviour on every page, commands, routes, events, and what goes in the
|
|
629
|
+
page's slots (its header bar, a panel beside the text, a drawer, the corner).
|
|
630
|
+
A plugin is an object with a name, and everything it adds lives under that
|
|
631
|
+
name. Local plugins go in `.workpad/plugins/`.
|
|
632
|
+
|
|
633
|
+
How to write one, with examples, is in [plugins/README.md](plugins/README.md);
|
|
634
|
+
the plugins in that folder are the built-in ones.
|
|
635
|
+
|
|
636
|
+
## Pages
|
|
637
|
+
|
|
638
|
+
Each page is a conversation between you and the agent that writes it:
|
|
639
|
+
forms you answer, a chat under each form, comments on any passage, and a
|
|
640
|
+
page that shows at a glance what waits on whom.
|
|
641
|
+
|
|
642
|
+
````markdown
|
|
643
|
+
# Release plan
|
|
644
|
+
|
|
645
|
+
> [!NOTE] Status: one question open
|
|
646
|
+
> The parser is done; the docs wait on the question below.
|
|
647
|
+
|
|
648
|
+
::::grid{cols=2}
|
|
649
|
+
:::item[Parser :badge[done]]
|
|
650
|
+
Rewritten, all tests pass.
|
|
651
|
+
:::
|
|
652
|
+
|
|
653
|
+
:::item[Docs :badge[todo]]
|
|
654
|
+
Not started.
|
|
655
|
+
:::
|
|
656
|
+
::::
|
|
657
|
+
|
|
658
|
+
:::form{name=ship}
|
|
659
|
+
**When do we ship?**
|
|
660
|
+
|
|
661
|
+
- :radio[This week]{name=when recommended}
|
|
662
|
+
The docs are small; ship and follow up.
|
|
663
|
+
- :radio[Next week]{name=when}
|
|
664
|
+
Ship with the docs complete.
|
|
665
|
+
:::
|
|
666
|
+
````
|
|
667
|
+
|
|
668
|
+
- **Forms.** The writer's recommended option is tagged, never preselected,
|
|
669
|
+
so a choice is only made by picking it. What you type is kept until you
|
|
670
|
+
send it, across live updates and reloads. Sending confirms itself.
|
|
671
|
+
- **A chat under every form,** to ask about a question without answering
|
|
672
|
+
it: a message is never a submit. `:::chat{name=…}` puts one anywhere.
|
|
673
|
+
- **What waits for you.** Your to-do, not whether an agent's process runs:
|
|
674
|
+
a question you haven't answered (or one the agent asks again), and a
|
|
675
|
+
message from the agent you haven't read (a reply to your comment, a chat
|
|
676
|
+
message). A message is read once it has been in view, and that is
|
|
677
|
+
recorded in the log, so it holds in every browser. An answered form waits
|
|
678
|
+
for an agent to receive it; once one has it, the form folds into a card:
|
|
679
|
+
what you chose (several answers each on a line, under the button you
|
|
680
|
+
pressed), what you wrote, and "received · change" while the agent is on
|
|
681
|
+
it, "decided · change" once it handled it; a click opens it again. Its chat folds into "💬 n messages", and opens when the agent
|
|
682
|
+
writes there, or stays open while you are writing in it. The corner's
|
|
683
|
+
toasts go to the next question ("→ unanswered (n)") and the next
|
|
684
|
+
unread message ("→ unread (n)", whose ✕ puts it away until another
|
|
685
|
+
comes), and the tab title gets a `(!n)` prefix. An answer sent while nobody
|
|
686
|
+
listens says so in a toast; it stays in the log for whoever listens next.
|
|
687
|
+
- **Who listens.** The dot at the end of the header is green while the page
|
|
688
|
+
is live and someone listens for its answers, grey when nobody does
|
|
689
|
+
(answers wait in the log), and a ring while the page reconnects. A click
|
|
690
|
+
on it lists who listens, each by name (`--agent`, `WORKPAD_AGENT`, or an
|
|
691
|
+
agent's session).
|
|
692
|
+
- **What waits on other pages.** The header shows an inbox with how much
|
|
693
|
+
waits for you on other pages; it opens a list of those pages, and a page
|
|
694
|
+
in it opens at the first thing. The overview marks the same pages with
|
|
695
|
+
the inbox.
|
|
696
|
+
- **Messages are markdown.** Comments, replies and chat messages, yours
|
|
697
|
+
and the agent's: code, lists, links, `#12`, rendered like a page, but raw
|
|
698
|
+
HTML and blocks show as written.
|
|
699
|
+
- **Comments.** Select any passage and comment on it; the agent replies in
|
|
700
|
+
the thread or edits the page. Passages are found again after edits. A
|
|
701
|
+
thread with a reply you haven't read has a dot on its badge.
|
|
702
|
+
- **What changed.** A block you haven't seen gets a bar until it has been
|
|
703
|
+
in view a moment, remembered per page, so coming back shows what changed
|
|
704
|
+
since. `:::quiet` content never counts as new.
|
|
705
|
+
- **Reading.** Updates keep your place: focus, typed values, open
|
|
706
|
+
`<details>` and scroll. A frame with breadcrumbs, the time of the last
|
|
707
|
+
update and a theme toggle. Numbered headings. An overview of the
|
|
708
|
+
project's pages and markdown documents, and repository files rendered at
|
|
709
|
+
`/-/`.
|
|
710
|
+
|
|
711
|
+
## The agent skill
|
|
712
|
+
|
|
713
|
+
The package includes a skill: instructions that teach an agent where pages
|
|
714
|
+
go, how to write them, and how to wait for answers. It is a folder with a
|
|
715
|
+
`SKILL.md`, the format several coding agents read.
|
|
716
|
+
|
|
717
|
+
```sh
|
|
718
|
+
npx workpad skill # prints where the skill folder is
|
|
719
|
+
npx workpad skill ~/.claude/skills # links it into Claude Code's skills folder
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
Link it into whichever folder your agent reads skills from. The link points
|
|
723
|
+
into the installed package, so the skill updates when you update workpad.
|
|
724
|
+
Agents that don't read skills can be pointed at the `SKILL.md` file directly.
|
|
725
|
+
|
|
726
|
+
## Working on workpad
|
|
727
|
+
|
|
728
|
+
Workpad is TypeScript. An installed package runs its build from
|
|
729
|
+
`dist/`, because Node won't run TypeScript inside `node_modules`. A clone
|
|
730
|
+
can run from source instead, so a change needs no build:
|
|
731
|
+
|
|
732
|
+
```sh
|
|
733
|
+
git clone https://github.com/bigmistqke/workpad && cd workpad
|
|
734
|
+
npm install
|
|
735
|
+
ln -sf "$PWD/bin/workpad.ts" "$(npm prefix -g)/bin/workpad" # your global `workpad` runs the source
|
|
736
|
+
npm run dev # rebuilds the browser code as you change it
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
`workpad` then runs from source in every project on your machine. That
|
|
740
|
+
includes the server it starts, and what a project's config imports from
|
|
741
|
+
the package (the plugins), so a project needs nothing of its
|
|
742
|
+
own for this. What a change takes:
|
|
743
|
+
|
|
744
|
+
| what you change | what it takes |
|
|
745
|
+
| --- | --- |
|
|
746
|
+
| a plugin's server side (its blocks, commands, routes) | nothing: the server reloads open pages |
|
|
747
|
+
| browser code (a plugin's `client.ts`/`client.tsx`, `src/client/`) | `npm run dev` running; open pages reload |
|
|
748
|
+
| the core (`src/`, `bin/`, the markdown engine in `src/pages/`) | restart the project's server; commands pick it up on their next run |
|
|
749
|
+
|
|
750
|
+
Restarting a project's server: stop the process in
|
|
751
|
+
`.workpad/server.json` (`kill $(node -p "require('./.workpad/server.json').pid")`),
|
|
752
|
+
and the next `workpad show` starts it again from the current source.
|
|
753
|
+
Running commands that started before a change (a `listen`, the Claude
|
|
754
|
+
channel) keep the code they started with until they are started again;
|
|
755
|
+
they do pick up changes to the project's config and its local plugins.
|
|
756
|
+
|
|
757
|
+
Don't use `npm link` for this: it links `workpad` to the build, which
|
|
758
|
+
changes only when you run `npm run build`. Without a global command,
|
|
759
|
+
`node bin/workpad.ts <command>` works from inside the clone.
|
|
760
|
+
|
|
761
|
+
- `npm test`: the unit tests (`node:test`)
|
|
762
|
+
- `npm run test:browser`: forms, comments and the terminal in a real browser
|
|
763
|
+
(Playwright; `npx playwright install chromium` once). Each test runs a
|
|
764
|
+
throwaway project with its own server, from source
|
|
765
|
+
- `npm run check`: type-check everything
|
|
766
|
+
- `npm run build`: build `dist/`, what the package ships; `node
|
|
767
|
+
dist/bin/workpad.js` runs it as an installed copy would
|
|
768
|
+
- `npm run release`: type-check and test, then ask for the new version
|
|
769
|
+
([bumpp](https://github.com/antfu-collective/bumpp)), commit and tag it as
|
|
770
|
+
`Release vX.Y.Z`, push, and publish to npm. Publishing reads the token from
|
|
771
|
+
`NPM_TOKEN` (`.npmrc`); it needs a granular token that may publish without
|
|
772
|
+
a one-time password
|
|
773
|
+
|
|
774
|
+
## Design
|
|
775
|
+
|
|
776
|
+
[DESIGN.md](https://github.com/bigmistqke/workpad/blob/main/DESIGN.md)
|
|
777
|
+
records how workpad works and why: the principles, the engine, the
|
|
778
|
+
plugin contract and the page in the browser.
|
|
779
|
+
|
|
780
|
+
## License
|
|
781
|
+
|
|
782
|
+
MIT
|