@bigmistqke/workpad 0.18.1 → 0.20.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/README.md +18 -9
- package/bin/workpad.ts +412 -58
- package/dist/bin/workpad.js +336 -46
- package/dist/client/runtime.js +141 -18
- package/dist/plugins/badge/README.md +59 -10
- package/dist/plugins/badge/index.js +130 -8
- package/dist/plugins/badge/public/style.css +132 -12
- package/dist/plugins/chat/README.md +7 -3
- package/dist/plugins/chat/index.js +8 -1
- package/dist/plugins/chat/public/client.js +2 -2
- package/dist/plugins/chat/public/style.css +10 -0
- package/dist/plugins/claude/README.md +13 -5
- package/dist/plugins/claude/channel.js +47 -6
- package/dist/plugins/claude/doctor.js +43 -47
- package/dist/plugins/claude/index.js +24 -8
- package/dist/plugins/claude/session.js +46 -1
- package/dist/plugins/comments/README.md +2 -1
- package/dist/plugins/comments/index.js +2 -0
- package/dist/plugins/comments/public/client.js +6 -5
- package/dist/plugins/comments/public/style.css +9 -0
- package/dist/plugins/form/README.md +1 -1
- package/dist/plugins/index.js +3 -1
- package/dist/plugins/opencode/channel.js +43 -7
- package/dist/plugins/opencode/index.js +2 -0
- package/dist/plugins/progress/README.md +41 -0
- package/dist/plugins/progress/index.js +117 -0
- package/dist/plugins/progress/public/client.js +1 -0
- package/dist/plugins/progress/public/style.css +85 -0
- package/dist/plugins/progress/state.js +210 -0
- package/dist/solid/index.js +3 -1
- package/dist/src/agents.js +13 -4
- package/dist/src/anchors.js +25 -1
- package/dist/src/build.js +1 -1
- package/dist/src/client/page/base.css +48 -2
- package/dist/src/client/page/main.js +58 -30
- package/dist/src/document.js +6 -4
- package/dist/src/events.js +22 -11
- package/dist/src/help.js +59 -12
- package/dist/src/hub.js +69 -3
- package/dist/src/listen.js +36 -4
- package/dist/src/listeners.js +14 -4
- package/dist/src/loader.js +7 -2
- package/dist/src/migrate.js +1 -1
- package/dist/src/pages/board.js +9 -4
- package/dist/src/pages/index.js +2 -4
- package/dist/src/pages/markdown.js +50 -19
- package/dist/src/pages/render.js +17 -1
- package/dist/src/server.js +94 -18
- package/dist/src/set.js +99 -0
- package/dist/src/state.js +2 -1
- package/dist/src/status.js +57 -9
- package/dist/src/turns.js +41 -0
- package/package.json +11 -1
- package/plugins/README.md +3 -1
- package/plugins/badge/README.md +59 -10
- package/plugins/badge/index.ts +141 -8
- package/plugins/badge/public/style.css +132 -12
- package/plugins/chat/README.md +7 -3
- package/plugins/chat/client.tsx +20 -3
- package/plugins/chat/index.ts +10 -1
- package/plugins/chat/public/style.css +10 -0
- package/plugins/claude/README.md +13 -5
- package/plugins/claude/channel.ts +45 -7
- package/plugins/claude/doctor.ts +58 -39
- package/plugins/claude/index.ts +30 -8
- package/plugins/claude/session.ts +32 -0
- package/plugins/comments/README.md +2 -1
- package/plugins/comments/client.ts +19 -0
- package/plugins/comments/index.ts +7 -1
- package/plugins/comments/public/style.css +9 -0
- package/plugins/form/README.md +1 -1
- package/plugins/index.ts +2 -0
- package/plugins/opencode/channel.ts +44 -8
- package/plugins/opencode/index.ts +4 -0
- package/plugins/progress/README.md +41 -0
- package/plugins/progress/client.ts +172 -0
- package/plugins/progress/index.ts +166 -0
- package/plugins/progress/public/style.css +85 -0
- package/plugins/progress/state.ts +278 -0
- package/skills/workpad/SKILL.md +149 -18
- package/solid/index.tsx +6 -2
- package/src/agents.ts +24 -2
- package/src/anchors.ts +32 -0
- package/src/build.ts +1 -1
- package/src/client/delivery.ts +49 -0
- package/src/client/forms.ts +18 -11
- package/src/client/page/base.css +48 -2
- package/src/client/page/waiting.ts +45 -25
- package/src/client/read.ts +9 -5
- package/src/client/runtime.ts +7 -3
- package/src/client/toast.ts +27 -3
- package/src/define.ts +120 -9
- package/src/document.ts +19 -5
- package/src/events.ts +47 -6
- package/src/help.ts +58 -11
- package/src/hub.ts +80 -2
- package/src/listen.ts +47 -4
- package/src/listeners.ts +22 -1
- package/src/loader.ts +14 -4
- package/src/migrate.ts +1 -1
- package/src/pages/board.ts +12 -3
- package/src/pages/index.ts +8 -10
- package/src/pages/markdown.ts +59 -12
- package/src/pages/render.ts +20 -2
- package/src/server.ts +127 -19
- package/src/set.ts +118 -0
- package/src/state.ts +3 -0
- package/src/status.ts +115 -14
- package/src/turns.ts +56 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigmistqke/workpad",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "A workpad for you and your agent: it writes markdown pages you read live in the browser, you answer through forms it waits on",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -84,6 +84,16 @@
|
|
|
84
84
|
"source": "./plugins/code/index.ts",
|
|
85
85
|
"types": "./plugins/code/index.ts",
|
|
86
86
|
"default": "./dist/plugins/code/index.js"
|
|
87
|
+
},
|
|
88
|
+
"./badge": {
|
|
89
|
+
"source": "./plugins/badge/index.ts",
|
|
90
|
+
"types": "./plugins/badge/index.ts",
|
|
91
|
+
"default": "./dist/plugins/badge/index.js"
|
|
92
|
+
},
|
|
93
|
+
"./progress": {
|
|
94
|
+
"source": "./plugins/progress/index.ts",
|
|
95
|
+
"types": "./plugins/progress/index.ts",
|
|
96
|
+
"default": "./dist/plugins/progress/index.js"
|
|
87
97
|
}
|
|
88
98
|
},
|
|
89
99
|
"files": [
|
package/plugins/README.md
CHANGED
|
@@ -147,7 +147,9 @@ export default function mount(root, page, api) {
|
|
|
147
147
|
`compose` attribute, that block's HTML as `ctx.children` (see below).
|
|
148
148
|
- **`events`**, by type (`<plugin>:<what>`): a description each, and
|
|
149
149
|
`handOut: true` for those an agent should get unasked, like a chat
|
|
150
|
-
message
|
|
150
|
+
message, and `requires: ['chat', 'text']` for the `data` fields one can't
|
|
151
|
+
be without (each a non-empty string): `workpad append` and the API refuse
|
|
152
|
+
an event that lacks one. `workpad docs` lists them.
|
|
151
153
|
- **`style`**: a stylesheet on every page.
|
|
152
154
|
- **`docs`**: markdown for agents: how to write its blocks, what its events
|
|
153
155
|
mean, how to answer.
|
package/plugins/badge/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
A status as a
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
`blocked no bad error` red; any other word is grey.
|
|
1
|
+
A status as a word, small and inline wherever text goes: in a heading, a
|
|
2
|
+
table cell, a list item, a sentence. A grey dot before it, unless it says
|
|
3
|
+
otherwise.
|
|
5
4
|
|
|
6
5
|
```markdown
|
|
7
6
|
### Parser :badge[done]
|
|
@@ -15,12 +14,6 @@ green, `active new info` blue, `open todo maybe warning` amber,
|
|
|
15
14
|
The release is :badge[blocked] on review.
|
|
16
15
|
```
|
|
17
16
|
|
|
18
|
-
A badge that ends a heading sits at its right edge: a page's heading, a grid
|
|
19
|
-
card's, a timeline step's. A block of your own can have the same for a title
|
|
20
|
-
that isn't a heading, with a `data-wp-title` attribute on it. A badge is not
|
|
21
|
-
in a heading's anchor, nor in an item's: `### Parser :badge[done]` is
|
|
22
|
-
`#parser`, so a link to it holds while the badge changes.
|
|
23
|
-
|
|
24
17
|
### Parser :badge[done]
|
|
25
18
|
|
|
26
19
|
| step | state |
|
|
@@ -30,3 +23,59 @@ in a heading's anchor, nor in an item's: `### Parser :badge[done]` is
|
|
|
30
23
|
| docs | :badge[todo] |
|
|
31
24
|
|
|
32
25
|
The release is :badge[blocked] on review.
|
|
26
|
+
|
|
27
|
+
Its look, each attribute off unless set, each colour a name from the
|
|
28
|
+
palette `red orange yellow green blue violet pink grey` (tuned per theme, so
|
|
29
|
+
the text reads on the page and on a fill):
|
|
30
|
+
|
|
31
|
+
- `color`: the dot and the text.
|
|
32
|
+
- `background`: a fill behind them; the text takes the palette's readable
|
|
33
|
+
shade for it, so `{background=red}` alone is a red pill.
|
|
34
|
+
- `border`: an outline.
|
|
35
|
+
- `live`: the dot pulses (still for a reader who asks for less motion).
|
|
36
|
+
|
|
37
|
+
A fill or an outline stands without the dot, unless it is `live`.
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
:badge[busy]{color=green live} :badge[you]{background=red} :badge[on hold]{color=orange border=orange}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
:badge[busy]{color=green live} :badge[you]{background=red} :badge[on hold]{color=orange border=orange}
|
|
44
|
+
|
|
45
|
+
**Presets** name looks, in the config: a badge whose word is the name takes
|
|
46
|
+
its preset (`:badge[you]`, the word as its text lowercased, other characters
|
|
47
|
+
a `-`), and so does one that names it (`:badge[Jonathan]{preset=person}`). A
|
|
48
|
+
preset sets any of the badge's own attributes, and nothing else.
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
// .workpad/config.ts
|
|
52
|
+
import badge from '@bigmistqke/workpad/badge'
|
|
53
|
+
|
|
54
|
+
export default defineConfig({
|
|
55
|
+
plugins: [
|
|
56
|
+
badge({
|
|
57
|
+
presets: {
|
|
58
|
+
you: { background: 'red' },
|
|
59
|
+
'on hold': { color: 'orange', border: 'orange' },
|
|
60
|
+
busy: { color: 'green', live: true },
|
|
61
|
+
person: { color: 'violet' },
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The built-in words are presets too: `done ok yes good` green,
|
|
69
|
+
`active new info` blue, `open todo maybe warning` orange,
|
|
70
|
+
`blocked no bad error` red. A project's preset of the same word replaces one.
|
|
71
|
+
|
|
72
|
+
Most specific wins, attribute by attribute: the badge's own attributes, then
|
|
73
|
+
its `preset=`, then its word's preset. An unknown colour, preset or attribute
|
|
74
|
+
is listed by `workpad check` and shown above the page; a bad preset stops the
|
|
75
|
+
config from loading, saying which.
|
|
76
|
+
|
|
77
|
+
A badge that ends a heading sits at its right edge: a page's heading, a grid
|
|
78
|
+
card's, a timeline step's. A block of your own can have the same for a title
|
|
79
|
+
that isn't a heading, with a `data-wp-title` attribute on it. A badge is not
|
|
80
|
+
in a heading's anchor, nor in an item's: `### Parser :badge[done]` is
|
|
81
|
+
`#parser`, so a link to it holds while the badge changes.
|
package/plugins/badge/index.ts
CHANGED
|
@@ -4,7 +4,43 @@ import { definePlugin, type Plugin } from '@bigmistqke/workpad'
|
|
|
4
4
|
import { html, raw, type DirectiveContext } from '@bigmistqke/workpad'
|
|
5
5
|
import { builtinPublic } from '../../src/package.ts'
|
|
6
6
|
|
|
7
|
-
/** The
|
|
7
|
+
/** The colours a badge takes, by name; each tuned per theme for readable text (style.css). */
|
|
8
|
+
export const PALETTE = ['red', 'orange', 'yellow', 'green', 'blue', 'violet', 'pink', 'grey'] as const
|
|
9
|
+
export type Colour = (typeof PALETTE)[number]
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* How a badge looks, each part off unless set: `color` the dot and the text, `background` a fill
|
|
13
|
+
* (its text then the palette's readable shade for it), `border` an outline, `live` a pulsing dot.
|
|
14
|
+
* What a badge's attributes say, and what a preset sets.
|
|
15
|
+
*/
|
|
16
|
+
export interface Look {
|
|
17
|
+
color?: Colour
|
|
18
|
+
background?: Colour
|
|
19
|
+
border?: Colour
|
|
20
|
+
live?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface BadgeOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Looks by name: a badge whose word is the name takes it (`:badge[you]`), and so does one that
|
|
26
|
+
* names it (`:badge[Jonathan]{preset=person}`). They replace the built-in words of the same name.
|
|
27
|
+
*/
|
|
28
|
+
presets?: Record<string, Look>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const COLOURED = ['color', 'background', 'border'] as const
|
|
32
|
+
const KEYS = [...COLOURED, 'live']
|
|
33
|
+
const palette = PALETTE.join(', ')
|
|
34
|
+
|
|
35
|
+
/** The built-in words: default presets, which a project's presets replace word by word. */
|
|
36
|
+
export const BUILTIN_PRESETS: Record<string, Look> = Object.fromEntries([
|
|
37
|
+
...['done', 'ok', 'yes', 'good'].map(w => [w, { color: 'green' }]),
|
|
38
|
+
...['active', 'new', 'info'].map(w => [w, { color: 'blue' }]),
|
|
39
|
+
...['open', 'todo', 'maybe', 'warning'].map(w => [w, { color: 'orange' }]),
|
|
40
|
+
...['blocked', 'no', 'bad', 'error'].map(w => [w, { color: 'red' }]),
|
|
41
|
+
])
|
|
42
|
+
|
|
43
|
+
/** The word a badge's preset is found by: its text, lowercased, runs of other characters a `-`. */
|
|
8
44
|
export const tone = (s: string) =>
|
|
9
45
|
s
|
|
10
46
|
.toLowerCase()
|
|
@@ -12,25 +48,122 @@ export const tone = (s: string) =>
|
|
|
12
48
|
.replace(/[^a-z0-9]+/g, '-')
|
|
13
49
|
.replace(/^-|-$/g, '')
|
|
14
50
|
|
|
15
|
-
|
|
16
|
-
|
|
51
|
+
const isColour = (v: unknown): v is Colour => typeof v === 'string' && (PALETTE as readonly string[]).includes(v)
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A config's presets, checked, by their words (tone()), over the built-in words: what is wrong
|
|
55
|
+
* throws, so the config fails to load and says why.
|
|
56
|
+
*/
|
|
57
|
+
export function presetsOf(given: Record<string, Look> = {}): Record<string, Look> {
|
|
58
|
+
if (typeof given !== 'object' || given === null || Array.isArray(given))
|
|
59
|
+
throw new Error('badge: `presets` is an object of looks by name: `{ you: { background: "red" } }`')
|
|
60
|
+
const own: Record<string, Look> = {}
|
|
61
|
+
const named: Record<string, string> = {}
|
|
62
|
+
for (const [name, look] of Object.entries(given)) {
|
|
63
|
+
const word = tone(name)
|
|
64
|
+
const where = `badge: preset "${name}"`
|
|
65
|
+
if (!word) throw new Error(`${where} has no letter or digit: a badge's word couldn't reach it`)
|
|
66
|
+
if (word in named) throw new Error(`${where} is the same word as "${named[word]}" (${word})`)
|
|
67
|
+
named[word] = name
|
|
68
|
+
if (typeof look !== 'object' || look === null || Array.isArray(look))
|
|
69
|
+
throw new Error(`${where} is a look: an object such as \`{ color: 'green' }\``)
|
|
70
|
+
for (const [k, v] of Object.entries(look)) {
|
|
71
|
+
if (!KEYS.includes(k))
|
|
72
|
+
throw new Error(`${where} sets \`${k}\`, which a badge hasn't: a preset sets ${KEYS.join(', ')}`)
|
|
73
|
+
if (k === 'live' ? typeof v !== 'boolean' : !isColour(v))
|
|
74
|
+
throw new Error(
|
|
75
|
+
k === 'live'
|
|
76
|
+
? `${where} has \`live: ${JSON.stringify(v)}\`: it is true or false`
|
|
77
|
+
: `${where} has no colour ${JSON.stringify(v)} for \`${k}\`: the palette is ${palette}`,
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
own[word] = { ...look }
|
|
81
|
+
}
|
|
82
|
+
return { ...BUILTIN_PRESETS, ...own }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The look of a badge of `text` with `attrs`, attribute by attribute the most specific: its own
|
|
87
|
+
* attributes, then the preset it names (`preset=`), then its word's preset (the built-in words
|
|
88
|
+
* among them). A value it doesn't know is reported, and the next one down holds.
|
|
89
|
+
*/
|
|
90
|
+
export function lookOf(
|
|
91
|
+
text: string,
|
|
92
|
+
attrs: Record<string, string>,
|
|
93
|
+
presets: Record<string, Look>,
|
|
94
|
+
report: (problem: string) => void = () => {},
|
|
95
|
+
): Look {
|
|
96
|
+
const written = `\`:badge[${text}]\``
|
|
97
|
+
const own: Look = {}
|
|
98
|
+
for (const k of COLOURED) {
|
|
99
|
+
const v = attrs[k]
|
|
100
|
+
if (v === undefined) continue
|
|
101
|
+
if (isColour(v)) own[k] = v
|
|
102
|
+
else report(`${written} has no colour \`${v}\` for \`${k}\`: the palette is ${palette}`)
|
|
103
|
+
}
|
|
104
|
+
if (attrs.live !== undefined) {
|
|
105
|
+
if (attrs.live === '' || attrs.live === 'true') own.live = true
|
|
106
|
+
else if (attrs.live === 'false') own.live = false
|
|
107
|
+
else report(`${written} has \`live=${attrs.live}\`: it is \`{live}\` or \`{live=false}\``)
|
|
108
|
+
}
|
|
109
|
+
let named: Look = {}
|
|
110
|
+
if (attrs.preset !== undefined) {
|
|
111
|
+
const found = presets[tone(attrs.preset)]
|
|
112
|
+
if (found) named = found
|
|
113
|
+
else
|
|
114
|
+
report(
|
|
115
|
+
`${written} names no preset \`${attrs.preset}\`: there are ${Object.keys(presets)
|
|
116
|
+
.map(p => `\`${p}\``)
|
|
117
|
+
.join(', ')}`,
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
const look: Look = {}
|
|
121
|
+
for (const layer of [presets[tone(text)] ?? {}, named, own])
|
|
122
|
+
for (const [k, v] of Object.entries(layer)) if (v !== undefined) (look as any)[k] = v
|
|
123
|
+
return look
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** `:badge[done]`: a word, with a coloured dot, a fill or an outline, inline wherever text goes. */
|
|
127
|
+
export function render(ctx: DirectiveContext, presets: Record<string, Look> = BUILTIN_PRESETS) {
|
|
17
128
|
const text = ctx.labelText?.trim()
|
|
18
129
|
if (!text) return html``
|
|
19
|
-
|
|
20
|
-
|
|
130
|
+
const look = lookOf(text, ctx.attrs, presets, p => ctx.problem(p))
|
|
131
|
+
// a built-in word's colour is its dot's only, its text stays grey; a colour written on the
|
|
132
|
+
// badge, or by a preset of the project's, colours the text too
|
|
133
|
+
const word = tone(text)
|
|
134
|
+
const builtin =
|
|
135
|
+
presets[word] !== undefined &&
|
|
136
|
+
presets[word] === BUILTIN_PRESETS[word] &&
|
|
137
|
+
ctx.attrs.color === undefined &&
|
|
138
|
+
(ctx.attrs.preset === undefined || presets[tone(ctx.attrs.preset)]?.color === undefined)
|
|
139
|
+
// what it shows, as data-* the stylesheet reads: only what is set
|
|
140
|
+
const shows = html`${COLOURED.map(k => look[k] && html` data-${k}="${look[k]}"`)}${look.live && html` data-live`}${builtin && look.color && html` data-dot`}`
|
|
141
|
+
// the label is HTML already; its plain text picks the preset
|
|
142
|
+
const label = raw(ctx.label ?? '')
|
|
143
|
+
// unformatted: prettier would put a space before ${shows}, which brings its own
|
|
144
|
+
// prettier-ignore
|
|
145
|
+
return html`<span class="wp-badge" data-badge="${tone(text)}"${shows}>${label}</span>`
|
|
21
146
|
}
|
|
22
147
|
|
|
23
|
-
export default function badge(): Plugin {
|
|
148
|
+
export default function badge(options: BadgeOptions = {}): Plugin {
|
|
149
|
+
const presets = presetsOf(options.presets)
|
|
150
|
+
const own = Object.keys(options.presets ?? {})
|
|
24
151
|
return definePlugin({
|
|
25
152
|
name: 'badge',
|
|
26
153
|
public: builtinPublic('badge'),
|
|
27
154
|
blocks: {
|
|
28
155
|
badge: {
|
|
29
156
|
menu: { group: 'mark', summary: 'a status in a word: done, todo, waiting' },
|
|
30
|
-
|
|
157
|
+
attrs: ['color', 'background', 'border', 'live', 'preset'],
|
|
158
|
+
html: ctx => render(ctx as DirectiveContext, presets),
|
|
31
159
|
style: 'style.css',
|
|
32
160
|
},
|
|
33
161
|
},
|
|
34
|
-
docs: () =>
|
|
162
|
+
docs: () => {
|
|
163
|
+
const readme = fs.readFileSync(new URL('./README.md', import.meta.url), 'utf8')
|
|
164
|
+
if (!own.length) return readme
|
|
165
|
+
const list = own.map(name => `- \`${name}\`: ${JSON.stringify(options.presets![name])}`).join('\n')
|
|
166
|
+
return `${readme}\nThis project's presets:\n\n${list}\n`
|
|
167
|
+
},
|
|
35
168
|
})
|
|
36
169
|
}
|
|
@@ -1,30 +1,150 @@
|
|
|
1
|
-
/* a
|
|
1
|
+
/* A word, small, with a dot before it; a colour, a fill, an outline and a pulse when it says so
|
|
2
|
+
(data-color, data-background, data-border, data-live, from its attributes and presets).
|
|
3
|
+
|
|
4
|
+
The palette, per theme: each colour (--wp-badge-<name>) as text and dot at least 4.5:1 on the
|
|
5
|
+
page and the surfaces a badge sits on (cards, tables, code), and as a fill under its readable
|
|
6
|
+
text (--wp-badge-ink) at least 4.5:1 (test/browser/badge.test.ts measures both). A project can
|
|
7
|
+
retune one in its own stylesheet, both themes at once: `--wp-badge-orange: light-dark(#9a4a06, #ffa462)`. */
|
|
8
|
+
:root {
|
|
9
|
+
--wp-badge-red: light-dark(#c4352b, #ff6f66);
|
|
10
|
+
--wp-badge-orange: light-dark(#a84d08, #ff9a4d);
|
|
11
|
+
--wp-badge-yellow: light-dark(#8a6500, #e8c547);
|
|
12
|
+
--wp-badge-green: light-dark(#1a7a49, #57c48c);
|
|
13
|
+
--wp-badge-blue: light-dark(#1d5bbf, #82aaff);
|
|
14
|
+
--wp-badge-violet: light-dark(#6b4fc0, #b4a0ff);
|
|
15
|
+
--wp-badge-pink: light-dark(#be185d, #f78fc0);
|
|
16
|
+
--wp-badge-grey: light-dark(#696e76, #979ca5);
|
|
17
|
+
/* a fill is the colour itself; the text on it this: white on the light theme's dark shades,
|
|
18
|
+
near-black on the dark theme's light ones */
|
|
19
|
+
--wp-badge-ink: light-dark(#ffffff, #131417);
|
|
20
|
+
}
|
|
21
|
+
|
|
2
22
|
.wp-badge {
|
|
3
|
-
--c: var(--muted);
|
|
4
23
|
display: inline-flex;
|
|
5
24
|
align-items: center;
|
|
6
25
|
gap: var(--space-sm);
|
|
7
26
|
font: 500 var(--ui-tiny)/1 var(--sans);
|
|
8
|
-
|
|
27
|
+
/* on a fill, its ink; else the colour; else as text beside the page's */
|
|
28
|
+
color: var(--wp-badge-on, var(--wp-badge-c, var(--muted)));
|
|
29
|
+
background: var(--wp-badge-fill, none);
|
|
9
30
|
white-space: nowrap;
|
|
10
31
|
vertical-align: 0.1em;
|
|
11
32
|
}
|
|
12
33
|
.wp-badge::before {
|
|
13
34
|
content: '';
|
|
35
|
+
flex: none;
|
|
14
36
|
width: 7px;
|
|
15
37
|
height: 7px;
|
|
16
38
|
border-radius: 50%;
|
|
17
|
-
|
|
39
|
+
--wp-badge-dot: var(--wp-badge-c, var(--wp-badge-on, var(--muted)));
|
|
40
|
+
background: var(--wp-badge-dot);
|
|
41
|
+
}
|
|
42
|
+
/* a built-in word (done, todo, …): the colour is its dot's, the text stays grey */
|
|
43
|
+
.wp-badge[data-dot]:not([data-background]) {
|
|
44
|
+
color: var(--muted);
|
|
45
|
+
}
|
|
46
|
+
/* a fill or an outline makes it a pill, which stands without a dot, unless the dot is live */
|
|
47
|
+
.wp-badge:is([data-background], [data-border]) {
|
|
48
|
+
padding: 2px 7px;
|
|
49
|
+
border: var(--hairline) solid var(--wp-badge-line, transparent);
|
|
50
|
+
border-radius: var(--radius-pill);
|
|
51
|
+
}
|
|
52
|
+
.wp-badge:is([data-background], [data-border]):not([data-live])::before {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.wp-badge[data-color='red'] {
|
|
57
|
+
--wp-badge-c: var(--wp-badge-red);
|
|
58
|
+
}
|
|
59
|
+
.wp-badge[data-color='orange'] {
|
|
60
|
+
--wp-badge-c: var(--wp-badge-orange);
|
|
61
|
+
}
|
|
62
|
+
.wp-badge[data-color='yellow'] {
|
|
63
|
+
--wp-badge-c: var(--wp-badge-yellow);
|
|
64
|
+
}
|
|
65
|
+
.wp-badge[data-color='green'] {
|
|
66
|
+
--wp-badge-c: var(--wp-badge-green);
|
|
67
|
+
}
|
|
68
|
+
.wp-badge[data-color='blue'] {
|
|
69
|
+
--wp-badge-c: var(--wp-badge-blue);
|
|
70
|
+
}
|
|
71
|
+
.wp-badge[data-color='violet'] {
|
|
72
|
+
--wp-badge-c: var(--wp-badge-violet);
|
|
73
|
+
}
|
|
74
|
+
.wp-badge[data-color='pink'] {
|
|
75
|
+
--wp-badge-c: var(--wp-badge-pink);
|
|
76
|
+
}
|
|
77
|
+
.wp-badge[data-color='grey'] {
|
|
78
|
+
--wp-badge-c: var(--wp-badge-grey);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.wp-badge[data-background] {
|
|
82
|
+
--wp-badge-on: var(--wp-badge-ink);
|
|
83
|
+
}
|
|
84
|
+
.wp-badge[data-background='red'] {
|
|
85
|
+
--wp-badge-fill: var(--wp-badge-red);
|
|
86
|
+
}
|
|
87
|
+
.wp-badge[data-background='orange'] {
|
|
88
|
+
--wp-badge-fill: var(--wp-badge-orange);
|
|
89
|
+
}
|
|
90
|
+
.wp-badge[data-background='yellow'] {
|
|
91
|
+
--wp-badge-fill: var(--wp-badge-yellow);
|
|
92
|
+
}
|
|
93
|
+
.wp-badge[data-background='green'] {
|
|
94
|
+
--wp-badge-fill: var(--wp-badge-green);
|
|
95
|
+
}
|
|
96
|
+
.wp-badge[data-background='blue'] {
|
|
97
|
+
--wp-badge-fill: var(--wp-badge-blue);
|
|
98
|
+
}
|
|
99
|
+
.wp-badge[data-background='violet'] {
|
|
100
|
+
--wp-badge-fill: var(--wp-badge-violet);
|
|
101
|
+
}
|
|
102
|
+
.wp-badge[data-background='pink'] {
|
|
103
|
+
--wp-badge-fill: var(--wp-badge-pink);
|
|
104
|
+
}
|
|
105
|
+
.wp-badge[data-background='grey'] {
|
|
106
|
+
--wp-badge-fill: var(--wp-badge-grey);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.wp-badge[data-border='red'] {
|
|
110
|
+
--wp-badge-line: var(--wp-badge-red);
|
|
111
|
+
}
|
|
112
|
+
.wp-badge[data-border='orange'] {
|
|
113
|
+
--wp-badge-line: var(--wp-badge-orange);
|
|
114
|
+
}
|
|
115
|
+
.wp-badge[data-border='yellow'] {
|
|
116
|
+
--wp-badge-line: var(--wp-badge-yellow);
|
|
117
|
+
}
|
|
118
|
+
.wp-badge[data-border='green'] {
|
|
119
|
+
--wp-badge-line: var(--wp-badge-green);
|
|
120
|
+
}
|
|
121
|
+
.wp-badge[data-border='blue'] {
|
|
122
|
+
--wp-badge-line: var(--wp-badge-blue);
|
|
123
|
+
}
|
|
124
|
+
.wp-badge[data-border='violet'] {
|
|
125
|
+
--wp-badge-line: var(--wp-badge-violet);
|
|
126
|
+
}
|
|
127
|
+
.wp-badge[data-border='pink'] {
|
|
128
|
+
--wp-badge-line: var(--wp-badge-pink);
|
|
18
129
|
}
|
|
19
|
-
.wp-badge
|
|
20
|
-
--
|
|
130
|
+
.wp-badge[data-border='grey'] {
|
|
131
|
+
--wp-badge-line: var(--wp-badge-grey);
|
|
21
132
|
}
|
|
22
|
-
|
|
23
|
-
|
|
133
|
+
|
|
134
|
+
/* live: the dot pulses, a ring growing out of it and fading; still under reduced motion */
|
|
135
|
+
.wp-badge[data-live]::before {
|
|
136
|
+
animation: wp-badge-pulse 1.6s ease-out infinite;
|
|
24
137
|
}
|
|
25
|
-
|
|
26
|
-
|
|
138
|
+
@keyframes wp-badge-pulse {
|
|
139
|
+
0% {
|
|
140
|
+
box-shadow: 0 0 0 0 color-mix(in srgb, var(--wp-badge-dot) 55%, transparent);
|
|
141
|
+
}
|
|
142
|
+
100% {
|
|
143
|
+
box-shadow: 0 0 0 5px transparent;
|
|
144
|
+
}
|
|
27
145
|
}
|
|
28
|
-
|
|
29
|
-
|
|
146
|
+
@media (prefers-reduced-motion: reduce) {
|
|
147
|
+
.wp-badge[data-live]::before {
|
|
148
|
+
animation: none;
|
|
149
|
+
}
|
|
30
150
|
}
|
package/plugins/chat/README.md
CHANGED
|
@@ -19,7 +19,7 @@ its answers are events of that type, and a link to it is
|
|
|
19
19
|
chat. A form on the page can't have a `/` in its name.
|
|
20
20
|
|
|
21
21
|
To rework a message (an option more, a typo), edit it in place:
|
|
22
|
-
`workpad edit <its id> --
|
|
22
|
+
`workpad edit <its id> --text-file -` with the new text on standard input. It updates in the reader's
|
|
23
23
|
tab, marked new until they've seen it, and a form in it that keeps its name
|
|
24
24
|
keeps its answers.
|
|
25
25
|
|
|
@@ -41,10 +41,14 @@ message `#message:<its event id>`; a folded form's chat opens for it.
|
|
|
41
41
|
|
|
42
42
|
A message is a `chat:message` event, `{ "chat": "<name>", "text": "…" }`,
|
|
43
43
|
never an answer: under a form it never makes a choice (only the reader can,
|
|
44
|
-
with a message of yours marked `answer`, below). Answer in the same chat
|
|
44
|
+
with a message of yours marked `answer`, below). Answer in the same chat, the
|
|
45
|
+
text from standard input (a quoted heredoc: no shell quoting in the markdown)
|
|
46
|
+
or a file (`--text-file reply.md`):
|
|
45
47
|
|
|
46
48
|
```sh
|
|
47
|
-
workpad append --page <file> --type chat:message --data '{"chat":"<name>"
|
|
49
|
+
workpad append --page <file> --type chat:message --data '{"chat":"<name>"}' --text-file - <<'EOF'
|
|
50
|
+
your answer, in markdown
|
|
51
|
+
EOF
|
|
48
52
|
```
|
|
49
53
|
|
|
50
54
|
Two more fields, both optional:
|
package/plugins/chat/client.tsx
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
// is a `chat:message` event, never an answer, so talking about a form's choice never makes it. But
|
|
4
4
|
// under a form, an agent's message marked `answer` has a button that answers the form with its
|
|
5
5
|
// text, for an answer the two settled on in the chat that is none of the form's options.
|
|
6
|
-
import { createEffect, createMemo, For, Loading } from 'solid-js'
|
|
6
|
+
import { createEffect, createMemo, For, Loading, Show } from 'solid-js'
|
|
7
7
|
import { solid, useWorkpad } from '@bigmistqke/workpad/solid'
|
|
8
8
|
import type { ChatProps } from './index'
|
|
9
|
-
import type { WpEvent } from '@bigmistqke/workpad'
|
|
9
|
+
import type { Delivery, WpEvent } from '@bigmistqke/workpad'
|
|
10
10
|
import { autosize } from './autosize'
|
|
11
11
|
|
|
12
12
|
/** A message in a chat: the chat block's own event type. */
|
|
@@ -20,6 +20,8 @@ interface Message {
|
|
|
20
20
|
sending?: boolean
|
|
21
21
|
/** the agent's message as it is in the log: it shows as a small page (Api.message) */
|
|
22
22
|
event?: WpEvent
|
|
23
|
+
/** the reader's message: where it went, said under it (see `messages`) */
|
|
24
|
+
delivery?: Delivery
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
/**
|
|
@@ -63,7 +65,15 @@ function Chat(props: ChatProps) {
|
|
|
63
65
|
event: e.from === 'cli' ? e : undefined,
|
|
64
66
|
})
|
|
65
67
|
}
|
|
66
|
-
|
|
68
|
+
// Where the reader's messages went, said quietly under the one it is about: their latest, while
|
|
69
|
+
// the agent hasn't answered after it (an answer says it all), and any no agent received for long
|
|
70
|
+
const delivery = wp.delivery()
|
|
71
|
+
const lastAgent = out.findLastIndex(m => m.from === 'agent')
|
|
72
|
+
const lastOwn = out.findLastIndex(m => m.from === 'you' && !m.sending)
|
|
73
|
+
return out.map((m, i) => {
|
|
74
|
+
const d = m.from === 'you' && !m.sending ? delivery.get(m.id) : undefined
|
|
75
|
+
return d && (d.state === 'late' || (i === lastOwn && i > lastAgent)) ? { ...m, delivery: d } : m
|
|
76
|
+
})
|
|
67
77
|
})
|
|
68
78
|
let box: HTMLTextAreaElement | undefined
|
|
69
79
|
// what the reader is typing, kept until it is sent: a reload, the page's tab sent elsewhere or the
|
|
@@ -135,6 +145,13 @@ function Chat(props: ChatProps) {
|
|
|
135
145
|
>
|
|
136
146
|
<span class="wp-chat-who">{m().from}</span>
|
|
137
147
|
<Bubble text={m().text} event={m().event} />
|
|
148
|
+
<Show when={m().delivery}>
|
|
149
|
+
{d => (
|
|
150
|
+
<span class="wp-chat-delivery" role="status" data-wp-delivery={d().state}>
|
|
151
|
+
{d().text}
|
|
152
|
+
</span>
|
|
153
|
+
)}
|
|
154
|
+
</Show>
|
|
138
155
|
</div>
|
|
139
156
|
)}
|
|
140
157
|
</For>
|
package/plugins/chat/index.ts
CHANGED
|
@@ -69,6 +69,14 @@ const chat: Block = {
|
|
|
69
69
|
/** The chat at the bottom of every page (see `end`): for what is about none of its questions. */
|
|
70
70
|
export const PAGE_CHAT = 'page'
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Whether a page's text could name a chat (or a form, whose chat it is) `name`: a `name=` or `id=`
|
|
74
|
+
* of it, or `#name`. Without one it names none, and the page needs no parse to say so: most pages,
|
|
75
|
+
* whose status asks this for every page.
|
|
76
|
+
*/
|
|
77
|
+
const mayName = (body: string, name: string) =>
|
|
78
|
+
new RegExp(`(?:\\bname|\\bid)\\s*=\\s*["']?${name}(?![\\w-])|#${name}(?![\\w-])`).test(body)
|
|
79
|
+
|
|
72
80
|
/** `page: false`: no chat at the bottom of every page. */
|
|
73
81
|
export interface ChatOptions {
|
|
74
82
|
page?: boolean
|
|
@@ -83,7 +91,7 @@ export default function chatPlugin({ page: pageChat = true }: ChatOptions = {}):
|
|
|
83
91
|
end(page) {
|
|
84
92
|
if (!pageChat || page.id.startsWith('-/')) return null
|
|
85
93
|
const own = (page.frontmatter.plugins as Record<string, unknown> | undefined)?.chat
|
|
86
|
-
if (own === false || chatNames(page.body).includes(PAGE_CHAT)) return null
|
|
94
|
+
if (own === false || (mayName(page.body, PAGE_CHAT) && chatNames(page.body).includes(PAGE_CHAT))) return null
|
|
87
95
|
return `:::chat{name=${PAGE_CHAT}}\nQuestions or remarks about this page:\n:::`
|
|
88
96
|
},
|
|
89
97
|
public: builtinPublic('chat'),
|
|
@@ -92,6 +100,7 @@ export default function chatPlugin({ page: pageChat = true }: ChatOptions = {}):
|
|
|
92
100
|
'chat:message': {
|
|
93
101
|
handOut: true,
|
|
94
102
|
forReader: true,
|
|
103
|
+
requires: ['chat', 'text'],
|
|
95
104
|
description: 'a message in a chat: `{ chat, text }`, and `replaces` or `replyTo` (see below)',
|
|
96
105
|
},
|
|
97
106
|
},
|
|
@@ -69,6 +69,16 @@
|
|
|
69
69
|
.wp-chat-message[data-from='agent'] .wp-chat-who {
|
|
70
70
|
color: var(--accent);
|
|
71
71
|
}
|
|
72
|
+
/* where the reader's message went (api.delivery), quietly under it; not received for long: the warning colour */
|
|
73
|
+
.wp-chat-delivery {
|
|
74
|
+
padding: 0 var(--space-xs);
|
|
75
|
+
font: var(--ui-tiny)/1.3 var(--sans);
|
|
76
|
+
color: var(--muted);
|
|
77
|
+
}
|
|
78
|
+
.wp-chat-delivery[data-wp-delivery='late'] {
|
|
79
|
+
color: var(--warn);
|
|
80
|
+
font-weight: var(--weight-strong);
|
|
81
|
+
}
|
|
72
82
|
.wp-chat-bubble {
|
|
73
83
|
max-width: 100%;
|
|
74
84
|
min-width: 0;
|
package/plugins/claude/README.md
CHANGED
|
@@ -97,11 +97,19 @@ command answers; the server approved and disabled in no settings file
|
|
|
97
97
|
(`.claude/settings.json`, `settings.local.json`, `~/.claude/settings.json`,
|
|
98
98
|
the project in `~/.claude.json`, and in a git worktree without its own
|
|
99
99
|
`settings.local.json`, the main checkout's, where Claude Code writes an Esc
|
|
100
|
-
on "New MCP server found"); the session started with the flag above
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
on "New MCP server found"); the session started with the flag above; the
|
|
101
|
+
server up at the project's version; a channel for this session; and its
|
|
102
|
+
ping confirmed. `/mcp` doesn't list a disabled server at all, so this is
|
|
103
|
+
where to look. It changes nothing, and exits 1 when something is to fix.
|
|
104
|
+
|
|
105
|
+
`.mcp.json` and the settings are read where Claude Code runs, which need
|
|
106
|
+
not be the pages' project: a wrapper can start a session in one folder (a
|
|
107
|
+
git worktree) with the pages of another. That folder is
|
|
108
|
+
`CLAUDE_PROJECT_DIR` when set, else the one the session's claude process
|
|
109
|
+
runs in, else the project's. When it differs, the doctor names both
|
|
110
|
+
(`pages: …; Claude's project: …`), and its fixes point at Claude's:
|
|
111
|
+
`workpad claude install --claude-dir <folder>` writes `.mcp.json` and the
|
|
112
|
+
hooks there.
|
|
105
113
|
|
|
106
114
|
## The turn-end check
|
|
107
115
|
|