@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
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// Claude Code, as a workpad plugin: an agent session is subscribed to the pages it makes, a
|
|
2
|
+
// channel pushes the reader's answers on them into it (channel.ts), and a turn that ends with
|
|
3
|
+
// something left on them goes on once. In a config:
|
|
4
|
+
//
|
|
5
|
+
// import claude from '@bigmistqke/workpad/claude'
|
|
6
|
+
// export default defineConfig({ plugins: [claude()] })
|
|
7
|
+
//
|
|
8
|
+
// `workpad claude install` sets it up for the project, in one (`uninstall` takes it out again):
|
|
9
|
+
// - the channel: the MCP server in its .mcp.json, which pushes each answer into the session;
|
|
10
|
+
// - two hooks in its .claude/settings.json, each running `workpad claude hook <mode>`, and each
|
|
11
|
+
// first recording the session for the channel, since a resume leaves it with another id
|
|
12
|
+
// (session.ts). Then:
|
|
13
|
+
// - session (a session starts): nothing more;
|
|
14
|
+
// - stop (a turn ends): when the session's pages have something left for the agent (a question
|
|
15
|
+
// nobody listens for, an answer it didn't handle, a chat waiting for its reply), its turn goes
|
|
16
|
+
// on once, told what to do; a turn a hook already continued ends, and the reader sees what is
|
|
17
|
+
// open.
|
|
18
|
+
//
|
|
19
|
+
// Claude Code gives each conversation an id, in the environment of the commands it runs
|
|
20
|
+
// (`CLAUDE_CODE_SESSION_ID`) and on the standard input of a hook (`session_id`). That id is who the
|
|
21
|
+
// session is on the boards, unless `WORKPAD_AGENT` names it otherwise: `workpad new` subscribes
|
|
22
|
+
// it to the page it makes.
|
|
23
|
+
import fs from 'node:fs'
|
|
24
|
+
import path from 'node:path'
|
|
25
|
+
import type { CommandContext, Plugin } from '../../src/define.ts'
|
|
26
|
+
import { identity, stopReminder, workpadCommand } from '../../src/agents.ts'
|
|
27
|
+
import { read, receivedBy } from '../../src/events.ts'
|
|
28
|
+
import { channel } from './channel.ts'
|
|
29
|
+
import { doctor } from './doctor.ts'
|
|
30
|
+
import { recordSession } from './session.ts'
|
|
31
|
+
|
|
32
|
+
type Mode = 'session' | 'stop'
|
|
33
|
+
|
|
34
|
+
/** Claude Code's settings file, as far as hooks go. */
|
|
35
|
+
interface Settings {
|
|
36
|
+
hooks?: Record<string, { hooks?: { type?: string; command?: string }[] }[]>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The hooks install adds: each mode, and the event it runs on. */
|
|
40
|
+
const MODES: Record<Mode, string> = { session: 'SessionStart', stop: 'Stop' }
|
|
41
|
+
|
|
42
|
+
/** A hook command of this plugin's, also one that runs workpad another way (`node …/workpad.ts`). */
|
|
43
|
+
const OURS = /\bworkpad(?:\.ts"?)? claude hook \w+/
|
|
44
|
+
const ours = (command = '') => OURS.test(command)
|
|
45
|
+
|
|
46
|
+
export default function claude(): Plugin {
|
|
47
|
+
return {
|
|
48
|
+
name: 'claude',
|
|
49
|
+
session: () => process.env.CLAUDE_CODE_SESSION_ID || null,
|
|
50
|
+
commands: {
|
|
51
|
+
hook: {
|
|
52
|
+
description:
|
|
53
|
+
"what Claude Code runs on an event: record the session for the channel; then session says nothing, and stop, when the session's pages have something left for the agent, continues the turn once",
|
|
54
|
+
args: '<session|stop>',
|
|
55
|
+
async run(ctx) {
|
|
56
|
+
const mode = ctx.positionals[0] as Mode
|
|
57
|
+
if (!mode || !(mode in MODES))
|
|
58
|
+
throw new Error(`usage: workpad claude hook <${Object.keys(MODES).join('|')}>`)
|
|
59
|
+
// a hook that fails must not get in the way of the session it runs in: say why, and exit cleanly
|
|
60
|
+
try {
|
|
61
|
+
await hook(ctx, mode)
|
|
62
|
+
} catch (err) {
|
|
63
|
+
console.error(`workpad claude hook ${mode}: ${(err as Error).message}`)
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
channel: {
|
|
68
|
+
description:
|
|
69
|
+
"the MCP channel Claude Code starts with each session (with the development-channels flag): pushes the reader's answers on the session's pages into it",
|
|
70
|
+
run: channel,
|
|
71
|
+
},
|
|
72
|
+
doctor: {
|
|
73
|
+
description:
|
|
74
|
+
"check what the channel needs, a line each with what to do: the .mcp.json entry and its command, the server approved and disabled in no settings file, the session started with the channels flag in the project's folder, the server up at the project's version, a channel for this session, its ping confirmed",
|
|
75
|
+
run: doctor,
|
|
76
|
+
},
|
|
77
|
+
install: {
|
|
78
|
+
description: "add the channel to this project's .mcp.json and its hooks to .claude/settings.json",
|
|
79
|
+
run: ctx => {
|
|
80
|
+
installChannel(ctx.project.dir)
|
|
81
|
+
installHooks(ctx.project.dir)
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
uninstall: {
|
|
85
|
+
description: "take the channel and its hooks out of this project's settings again; other hooks, servers and settings stay",
|
|
86
|
+
run: ctx => {
|
|
87
|
+
uninstallChannel(ctx.project.dir)
|
|
88
|
+
uninstallHooks(ctx.project.dir)
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** The JSON Claude Code passes a hook on its standard input, or nothing. */
|
|
96
|
+
function hookInput(): { session_id?: string; stop_hook_active?: boolean; transcript_path?: string } {
|
|
97
|
+
if (process.stdin.isTTY) return {}
|
|
98
|
+
try {
|
|
99
|
+
return JSON.parse(fs.readFileSync(0, 'utf8') || '{}')
|
|
100
|
+
} catch {
|
|
101
|
+
return {}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function hook(ctx: CommandContext, mode: Mode) {
|
|
106
|
+
const input = hookInput()
|
|
107
|
+
// the channel's environment can hold an id the conversation left (a resume): tell it the current one
|
|
108
|
+
if (input.session_id) recordSession(ctx.dataDir, input.session_id)
|
|
109
|
+
if (mode === 'session') return
|
|
110
|
+
// A turn ends with something on the session's pages left: its turn goes on once, with that as the
|
|
111
|
+
// reason; Claude Code marks a turn a hook continued (stop_hook_active), and that one ends, with
|
|
112
|
+
// what is open shown to the reader instead.
|
|
113
|
+
const agent = identity(input.session_id ?? process.env.CLAUDE_CODE_SESSION_ID ?? null)
|
|
114
|
+
const left = await stopReminder(ctx, agent, inFlight(ctx, agent, input.transcript_path))
|
|
115
|
+
if (!left) return
|
|
116
|
+
if (input.stop_hook_active) return void console.log(JSON.stringify({ systemMessage: left.shown }))
|
|
117
|
+
// As context for the turn, not a block: the turn goes on all the same (with the same guard,
|
|
118
|
+
// stop_hook_active), but Claude Code shows it as "Stop hook feedback", not as a hook error with
|
|
119
|
+
// every Stop hook's command listed above it (other tools' hooks can be long scripts). The reason
|
|
120
|
+
// alone: Claude Code shows it to the reader too, so a systemMessage beside it said it twice.
|
|
121
|
+
console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: 'Stop', additionalContext: left.reason } }))
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The answers this agent received that its conversation doesn't hold yet: its channel sent them
|
|
126
|
+
* (marked received as it does), and Claude Code keeps a channel's message until the turn ends. Told
|
|
127
|
+
* apart by the transcript: an answer that reached the agent is in it, by its id (the channel's
|
|
128
|
+
* message names it). Without a transcript, none: better a reminder too many than one missed.
|
|
129
|
+
*/
|
|
130
|
+
function inFlight(ctx: CommandContext, agent: string | null, transcript: string | undefined): Set<string> {
|
|
131
|
+
if (!agent || !transcript) return new Set()
|
|
132
|
+
let text: string
|
|
133
|
+
try {
|
|
134
|
+
text = fs.readFileSync(transcript, 'utf8')
|
|
135
|
+
} catch {
|
|
136
|
+
return new Set()
|
|
137
|
+
}
|
|
138
|
+
const received = receivedBy(read(ctx.eventsFile).events, agent)
|
|
139
|
+
return new Set([...received].filter(id => !text.includes(id)))
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** A JSON file of Claude Code's settings ({} when there is none). */
|
|
143
|
+
function readJson<T extends object>(file: string): T {
|
|
144
|
+
if (!fs.existsSync(file)) return {} as T
|
|
145
|
+
try {
|
|
146
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
147
|
+
} catch {
|
|
148
|
+
throw new Error(`${file} is not valid JSON; fix it first`)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Write it in one rename; one left empty goes. */
|
|
153
|
+
function writeJson(file: string, value: object) {
|
|
154
|
+
if (!Object.keys(value).length) return void fs.rmSync(file, { force: true })
|
|
155
|
+
fs.mkdirSync(path.dirname(file), { recursive: true })
|
|
156
|
+
fs.writeFileSync(`${file}.tmp`, JSON.stringify(value, null, 2) + '\n')
|
|
157
|
+
fs.renameSync(`${file}.tmp`, file)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
/** The hook groups of one event without ours, and without the groups that leaves empty. */
|
|
162
|
+
const without = (groups: NonNullable<Settings['hooks']>[string]) =>
|
|
163
|
+
groups.map(g => ({ ...g, hooks: (g.hooks ?? []).filter(h => !ours(h.command)) })).filter(g => g.hooks.length)
|
|
164
|
+
|
|
165
|
+
const settingsFile = (dir: string) => path.join(dir, '.claude', 'settings.json')
|
|
166
|
+
|
|
167
|
+
/** Add the hooks to the project's .claude/settings.json, in place of ours that run another command. */
|
|
168
|
+
function installHooks(dir: string) {
|
|
169
|
+
const file = settingsFile(dir)
|
|
170
|
+
const settings = readJson<Settings>(file)
|
|
171
|
+
const bin = workpadCommand(dir).join(' ')
|
|
172
|
+
const hooks = (settings.hooks ??= {})
|
|
173
|
+
const changed: string[] = []
|
|
174
|
+
for (const [mode, event] of Object.entries(MODES)) {
|
|
175
|
+
const command = `${bin} claude hook ${mode}`
|
|
176
|
+
const groups = hooks[event] ?? []
|
|
177
|
+
const now = groups.flatMap(g => g.hooks ?? []).filter(h => ours(h.command))
|
|
178
|
+
if (now.length === 1 && now[0].command === command) continue
|
|
179
|
+
hooks[event] = [...without(groups), { hooks: [{ type: 'command', command }] }]
|
|
180
|
+
changed.push(event)
|
|
181
|
+
}
|
|
182
|
+
// ours on an event install doesn't use any more
|
|
183
|
+
for (const [event, groups] of Object.entries(hooks))
|
|
184
|
+
if (!(Object.values(MODES) as string[]).includes(event) && groups.some(g => g.hooks?.some(h => ours(h.command)))) {
|
|
185
|
+
const kept = without(groups)
|
|
186
|
+
if (kept.length) hooks[event] = kept
|
|
187
|
+
else delete hooks[event]
|
|
188
|
+
changed.push(event)
|
|
189
|
+
}
|
|
190
|
+
if (!changed.length) return console.log(`hooks already installed: ${file}`)
|
|
191
|
+
writeJson(file, settings)
|
|
192
|
+
console.log(`hooks set in ${file}: ${changed.join(', ')}`)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Take our hooks out of the project's .claude/settings.json, and nothing else: other hooks and
|
|
197
|
+
* settings stay. A file that held only ours goes.
|
|
198
|
+
*/
|
|
199
|
+
function uninstallHooks(dir: string) {
|
|
200
|
+
const file = settingsFile(dir)
|
|
201
|
+
const settings = readJson<Settings>(file)
|
|
202
|
+
const removed: string[] = []
|
|
203
|
+
for (const [event, groups] of Object.entries(settings.hooks ?? {})) {
|
|
204
|
+
if (!groups.some(g => g.hooks?.some(h => ours(h.command)))) continue
|
|
205
|
+
const kept = without(groups)
|
|
206
|
+
removed.push(event)
|
|
207
|
+
if (kept.length) settings.hooks![event] = kept
|
|
208
|
+
else delete settings.hooks![event]
|
|
209
|
+
}
|
|
210
|
+
if (!removed.length) return console.log(`no workpad hooks in ${file}`)
|
|
211
|
+
if (settings.hooks && !Object.keys(settings.hooks).length) delete settings.hooks
|
|
212
|
+
writeJson(file, settings)
|
|
213
|
+
console.log(`hooks removed from ${file}: ${removed.join(', ')}`)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** The project's MCP servers, as far as the channel goes. */
|
|
217
|
+
interface McpConfig {
|
|
218
|
+
mcpServers?: Record<string, { command?: string; args?: string[] }>
|
|
219
|
+
}
|
|
220
|
+
const mcpFile = (dir: string) => path.join(dir, '.mcp.json')
|
|
221
|
+
|
|
222
|
+
/** Register the channel (channel.ts) in the project's .mcp.json, as the server `workpad`. */
|
|
223
|
+
function installChannel(dir: string) {
|
|
224
|
+
const file = mcpFile(dir)
|
|
225
|
+
const config = readJson<McpConfig>(file)
|
|
226
|
+
const [command, ...args] = [...workpadCommand(dir), 'claude', 'channel']
|
|
227
|
+
const servers = (config.mcpServers ??= {})
|
|
228
|
+
const now = servers.workpad
|
|
229
|
+
if (now?.command === command && JSON.stringify(now.args) === JSON.stringify(args))
|
|
230
|
+
return console.log(`channel already installed: ${file}`)
|
|
231
|
+
servers.workpad = { command, args }
|
|
232
|
+
writeJson(file, config)
|
|
233
|
+
console.log(
|
|
234
|
+
`channel added to ${file}; a session loads it when started with: claude --dangerously-load-development-channels server:workpad`,
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Take the channel out of the project's .mcp.json; other servers stay. A file that held only it goes. */
|
|
239
|
+
function uninstallChannel(dir: string) {
|
|
240
|
+
const file = mcpFile(dir)
|
|
241
|
+
const config = readJson<McpConfig>(file)
|
|
242
|
+
const ours = config.mcpServers?.workpad
|
|
243
|
+
if (!ours?.args?.includes('channel')) return console.log(`no workpad channel in ${file}`)
|
|
244
|
+
delete config.mcpServers!.workpad
|
|
245
|
+
if (!Object.keys(config.mcpServers!).length) delete config.mcpServers
|
|
246
|
+
writeJson(file, config)
|
|
247
|
+
console.log(`channel removed from ${file}`)
|
|
248
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Which conversation a Claude Code process is on now. Claude Code puts the id in the environment
|
|
2
|
+
// of what it starts (`CLAUDE_CODE_SESSION_ID`), but an MCP server keeps the environment it was
|
|
3
|
+
// started with: on an interactive resume Claude Code starts its servers with a provisional id and
|
|
4
|
+
// then switches the conversation to the resumed one, so the channel would follow nobody's pages.
|
|
5
|
+
// A hook always gets the current id on its standard input (`session_id`), and it runs under the
|
|
6
|
+
// same claude process as the channel. So each hook records the id under that process, and the
|
|
7
|
+
// channel reads it back every round.
|
|
8
|
+
import fs from 'node:fs'
|
|
9
|
+
import path from 'node:path'
|
|
10
|
+
import { spawnSync } from 'node:child_process'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The pid of the claude process this one runs under: the nearest ancestor named `claude`, or null
|
|
14
|
+
* when there is none (a claude run through node, a test, a terminal). One wrapper in between
|
|
15
|
+
* (`npx workpad`) is looked past by name.
|
|
16
|
+
*/
|
|
17
|
+
export function claudePid(): number | null {
|
|
18
|
+
const ps = spawnSync('ps', ['-A', '-o', 'pid=,ppid=,comm='], { encoding: 'utf8' })
|
|
19
|
+
if (ps.status !== 0) return null
|
|
20
|
+
const parent = new Map<number, [number, string]>()
|
|
21
|
+
for (const line of ps.stdout.split('\n')) {
|
|
22
|
+
const m = line.trim().match(/^(\d+)\s+(\d+)\s+(.*)$/)
|
|
23
|
+
if (m) parent.set(Number(m[1]), [Number(m[2]), path.basename(m[3])])
|
|
24
|
+
}
|
|
25
|
+
for (let p = process.ppid; p > 1 && parent.has(p); p = parent.get(p)![0]) if (parent.get(p)![1] === 'claude') return p
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The claude process this one runs under, as `<pid>-<start time>` (a pid is reused, its start time
|
|
31
|
+
* tells the two apart): claudePid, or the parent when there is none.
|
|
32
|
+
*/
|
|
33
|
+
export function claudeProcess(): string {
|
|
34
|
+
const pid = claudePid() ?? process.ppid
|
|
35
|
+
const started = spawnSync('ps', ['-o', 'lstart=', '-p', String(pid)], { encoding: 'utf8' })
|
|
36
|
+
const at = started.status === 0 ? Date.parse(started.stdout.trim()) : NaN
|
|
37
|
+
return Number.isNaN(at) ? String(pid) : `${pid}-${at / 1000}`
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const sessionsDir = (dataDir: string) => path.join(dataDir, 'sessions')
|
|
41
|
+
|
|
42
|
+
/** The conversation a hook says this claude process is on; records of processes that ended go. */
|
|
43
|
+
export function recordSession(dataDir: string, session: string) {
|
|
44
|
+
const dir = sessionsDir(dataDir)
|
|
45
|
+
const file = path.join(dir, claudeProcess())
|
|
46
|
+
if (fs.existsSync(file) && fs.readFileSync(file, 'utf8') === session) return
|
|
47
|
+
fs.mkdirSync(dir, { recursive: true })
|
|
48
|
+
for (const name of fs.readdirSync(dir)) if (!alive(Number(name.split('-')[0]))) fs.rmSync(path.join(dir, name))
|
|
49
|
+
fs.writeFileSync(`${file}.tmp`, session)
|
|
50
|
+
fs.renameSync(`${file}.tmp`, file)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The conversation the hooks last recorded for this claude process, or null when none ran yet. */
|
|
54
|
+
export function recordedSession(dataDir: string, claude: string): string | null {
|
|
55
|
+
try {
|
|
56
|
+
return fs.readFileSync(path.join(sessionsDir(dataDir), claude), 'utf8') || null
|
|
57
|
+
} catch {
|
|
58
|
+
return null
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function alive(pid: number) {
|
|
63
|
+
if (!pid) return false
|
|
64
|
+
try {
|
|
65
|
+
process.kill(pid, 0)
|
|
66
|
+
return true
|
|
67
|
+
} catch (err) {
|
|
68
|
+
return (err as NodeJS.ErrnoException).code === 'EPERM'
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Syntax highlighting for code blocks. [Shiki](https://shiki.style) runs on the server, so no script
|
|
2
|
+
runs on the page, and the colours follow the page theme. It applies to every
|
|
3
|
+
fence that no other block claims by name, and to the code view of
|
|
4
|
+
repository files. Write an ordinary fence with a language:
|
|
5
|
+
|
|
6
|
+
````markdown
|
|
7
|
+
```ts
|
|
8
|
+
const page = await workpad.show('plan')
|
|
9
|
+
```
|
|
10
|
+
````
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const page = await workpad.show('plan')
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
A `diff` fence (what `git diff` or `diff -u` prints) is shown for reading:
|
|
17
|
+
each file's headers become its name, a hunk's `@@ … @@` line becomes a `⋯`
|
|
18
|
+
where lines are skipped, lines have their numbers in a gutter and are tinted
|
|
19
|
+
when added or removed. Each line in a hunk also says where it is from
|
|
20
|
+
(`src/a.ts:12`), and a comment on it records that. A hunk can start with a
|
|
21
|
+
bare `@@`: its lines show without numbers. `---` and `+++` lines name the file
|
|
22
|
+
without a `diff --git` above them. Use four backticks around it, since a diff
|
|
23
|
+
can hold three.
|
|
24
|
+
|
|
25
|
+
A line longer than the block scrolls it sideways, on a page and in a chat
|
|
26
|
+
message alike. A fence that says `{wrap}` wraps its long lines at the block's
|
|
27
|
+
edge instead, a diff's rows too:
|
|
28
|
+
|
|
29
|
+
````markdown
|
|
30
|
+
```sh {wrap}
|
|
31
|
+
workpad append --page plan --type chat:message --data '{"chat":"notes","text":"a long line"}'
|
|
32
|
+
```
|
|
33
|
+
````
|
|
34
|
+
|
|
35
|
+
A missing or unknown language renders as plain text. Fences named after
|
|
36
|
+
another block, such as `mermaid`, still go to that block.
|
|
37
|
+
|
|
38
|
+
It's a built-in plugin. For options, replace it in the config with your own
|
|
39
|
+
`code(…)`:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import code from '@bigmistqke/workpad/code'
|
|
43
|
+
|
|
44
|
+
export default defineConfig({
|
|
45
|
+
plugins: [code({
|
|
46
|
+
themes: { light: 'github-light', dark: 'github-dark' }, // any Shiki theme names
|
|
47
|
+
colorReplacements: { 'github-light': { '#e36209': '#0f766e' } }, // per theme
|
|
48
|
+
})],
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Without options it uses the GitHub themes, with their oranges swapped for a
|
|
53
|
+
teal that fits the default palette. If you pass `themes`, nothing is swapped
|
|
54
|
+
unless you also pass `colorReplacements`.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Whether each code block overflows sideways, measured, so style.css can choose its scrollbar in
|
|
2
|
+
// advance: `data-overflow="true"` gives the code `overflow-x: scroll`, `"false"` `overflow-x: hidden`.
|
|
3
|
+
//
|
|
4
|
+
// Why: WebKit defers the scrollbar of an `overflow-x: auto` element while a flex or grid ancestor
|
|
5
|
+
// is laid out. Once the outermost flex/grid layout is done, it adds the scrollbar and lays out only
|
|
6
|
+
// the scroller again, so every ancestor keeps the height it had without the bar: the bar hangs
|
|
7
|
+
// below the block's background, over what follows. Workpad's chat (flex), forms and grid cards
|
|
8
|
+
// (grid) put code blocks right there. Reading a size afterwards doesn't fix it (to WebKit the
|
|
9
|
+
// ancestors are laid out already), nor does a wrapper (it is one more ancestor that keeps its
|
|
10
|
+
// height). A scrollbar chosen in style is laid out with the ancestors.
|
|
11
|
+
//
|
|
12
|
+
// - block/buzz-app#1677, the same bug for tables in chat messages, traced into WebKit's source
|
|
13
|
+
// (RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction →
|
|
14
|
+
// relayoutRenderBlockForScrollbarChange, MarkOnlyThis), and this fix:
|
|
15
|
+
// https://github.com/block/buzz-app/pull/1677
|
|
16
|
+
// - WebKit bug 51148, overflow: auto not accounting for its scrollbars after a size change:
|
|
17
|
+
// https://bugs.webkit.org/show_bug.cgi?id=51148
|
|
18
|
+
// - WebKit source, where the deferred scrollbar update is committed:
|
|
19
|
+
// https://github.com/WebKit/WebKit/blob/main/Source/WebCore/rendering/RenderBlock.cpp
|
|
20
|
+
//
|
|
21
|
+
// Always `overflow-x: scroll` would do without measuring, but leaves an empty scrollbar track
|
|
22
|
+
// under every block that fits wherever scrollbars take space (macOS set to always show them).
|
|
23
|
+
//
|
|
24
|
+
// Measured when a block arrives (before the browser lays it out: a MutationObserver's callback
|
|
25
|
+
// runs before the next layout), when it changes size, and when its text changes: a block at its
|
|
26
|
+
// widest can start or stop overflowing without changing size. Blocks nothing measured (a page
|
|
27
|
+
// without scripts) keep `overflow-x: auto`.
|
|
28
|
+
import type { PluginMount } from '../../src/define.ts'
|
|
29
|
+
|
|
30
|
+
const CODE = 'pre.shiki > code'
|
|
31
|
+
|
|
32
|
+
const mount: PluginMount = root => {
|
|
33
|
+
const measure = (code: HTMLElement) => {
|
|
34
|
+
// a scrollbar of its own leaves clientWidth as it was: this reads the same either way
|
|
35
|
+
const overflow = String(code.scrollWidth > code.clientWidth)
|
|
36
|
+
if (code.dataset.overflow !== overflow) code.dataset.overflow = overflow
|
|
37
|
+
}
|
|
38
|
+
const sizes = new ResizeObserver(entries => {
|
|
39
|
+
for (const { target } of entries) measure(target as HTMLElement)
|
|
40
|
+
})
|
|
41
|
+
const known = new WeakSet<HTMLElement>()
|
|
42
|
+
const arrive = (within: Element) => {
|
|
43
|
+
const codes = within.matches(CODE) ? [within as HTMLElement] : within.querySelectorAll<HTMLElement>(CODE)
|
|
44
|
+
for (const code of codes) {
|
|
45
|
+
measure(code)
|
|
46
|
+
if (known.has(code)) continue
|
|
47
|
+
known.add(code)
|
|
48
|
+
sizes.observe(code)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
arrive(root)
|
|
52
|
+
// a font that loads after a block was measured widens its text without resizing the block or
|
|
53
|
+
// changing its content: measured again, else one marked as fitting would clip what it can't show
|
|
54
|
+
document.fonts?.addEventListener('loadingdone', () => {
|
|
55
|
+
for (const code of root.querySelectorAll<HTMLElement>(CODE)) measure(code)
|
|
56
|
+
})
|
|
57
|
+
// what arrives later (a chat message, a page's update), and text changing inside a block; the
|
|
58
|
+
// attribute itself is not watched, so setting it never comes back here
|
|
59
|
+
new MutationObserver(records => {
|
|
60
|
+
for (const r of records) {
|
|
61
|
+
if (r.type === 'characterData') {
|
|
62
|
+
const code = r.target.parentElement?.closest<HTMLElement>(CODE)
|
|
63
|
+
if (code) measure(code)
|
|
64
|
+
continue
|
|
65
|
+
}
|
|
66
|
+
for (const n of r.addedNodes) if (n instanceof Element) arrive(n)
|
|
67
|
+
const code = r.target instanceof Element ? r.target.closest<HTMLElement>(CODE) : null
|
|
68
|
+
if (code) measure(code)
|
|
69
|
+
}
|
|
70
|
+
}).observe(root, { childList: true, characterData: true, subtree: true })
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default mount
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// What each line of a diff fence is, for showing it to a reader rather than a tool: added, removed,
|
|
2
|
+
// unchanged, a gap between hunks, a file's name, or a header line nobody needs to read (`diff --git`,
|
|
3
|
+
// `index`, `---`, modes), which the block leaves out. A line in a hunk has its number (`n`) and
|
|
4
|
+
// where it is (`at`: `file:line` in the new file; a removed line counts in the old one,
|
|
5
|
+
// `file (old):line`). Reads unified diffs, as `git diff` and `diff -u` print them, and snippets of
|
|
6
|
+
// only +, - and unchanged lines. An agent often writes a hunk's start as a bare `@@`, without the
|
|
7
|
+
// line numbers: that starts a hunk too, whose lines have no numbers, and a `---` line followed by a
|
|
8
|
+
// `+++` line names the file, with or without a `diff --git` above them.
|
|
9
|
+
|
|
10
|
+
export type DiffKind = 'add' | 'del' | 'context' | 'hunk' | 'file' | 'meta'
|
|
11
|
+
|
|
12
|
+
export interface DiffLineInfo {
|
|
13
|
+
kind: DiffKind
|
|
14
|
+
/** a line in a hunk: its number, in the new file (a removed line: in the old one) */
|
|
15
|
+
n?: number
|
|
16
|
+
/** `file:line`, for a line in a hunk of a known file */
|
|
17
|
+
at?: string
|
|
18
|
+
/** what to show instead of the line: a file's name, a hunk's start */
|
|
19
|
+
label?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const unprefix = (p: string) =>
|
|
23
|
+
p
|
|
24
|
+
.replace(/\t.*$/, '')
|
|
25
|
+
.replace(/^"|"$/g, '')
|
|
26
|
+
.replace(/^[ab]\//, '')
|
|
27
|
+
|
|
28
|
+
export function diffLines(text: string): DiffLineInfo[] {
|
|
29
|
+
// a snippet without hunks or file headers (only +, - and unchanged lines, as people paste them):
|
|
30
|
+
// every line is one of those, without numbers, as no header says where it is
|
|
31
|
+
if (!/^(@@|diff --git )/m.test(text) && !/^--- .*\n\+\+\+ /m.test(text)) {
|
|
32
|
+
return text
|
|
33
|
+
.split('\n')
|
|
34
|
+
.map((line): DiffLineInfo => ({ kind: line[0] === '+' ? 'add' : line[0] === '-' ? 'del' : 'context' }))
|
|
35
|
+
}
|
|
36
|
+
let file = '',
|
|
37
|
+
oldFile = '',
|
|
38
|
+
oldN = 0,
|
|
39
|
+
newN = 0,
|
|
40
|
+
// a hunk started by a bare @@ says no line numbers: its lines have none
|
|
41
|
+
numbered = false,
|
|
42
|
+
inHunk = false
|
|
43
|
+
let status = '',
|
|
44
|
+
renamedFrom = ''
|
|
45
|
+
return text.split('\n').map((line): DiffLineInfo => {
|
|
46
|
+
const at = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(line)
|
|
47
|
+
if (at) {
|
|
48
|
+
oldN = Number(at[1])
|
|
49
|
+
newN = Number(at[2])
|
|
50
|
+
inHunk = true
|
|
51
|
+
numbered = true
|
|
52
|
+
// only a mark that lines were skipped: the numbers are in the gutter, and the text git adds
|
|
53
|
+
// after them is a guess at the enclosing line, often just the one before
|
|
54
|
+
return { kind: 'hunk', label: '' }
|
|
55
|
+
}
|
|
56
|
+
// a bare @@ (or one whose numbers don't read): a hunk all the same, without numbers
|
|
57
|
+
if (line.startsWith('@@')) {
|
|
58
|
+
inHunk = true
|
|
59
|
+
numbered = false
|
|
60
|
+
return { kind: 'hunk', label: '' }
|
|
61
|
+
}
|
|
62
|
+
if (inHunk) {
|
|
63
|
+
const sign = line[0]
|
|
64
|
+
const where = (side: 'old' | 'new', n: number): DiffLineInfo | {} => {
|
|
65
|
+
if (!numbered) return {}
|
|
66
|
+
const name = side === 'old' ? oldFile || file : file || oldFile
|
|
67
|
+
return name ? { n, at: side === 'old' ? `${name} (old):${n}` : `${name}:${n}` } : { n }
|
|
68
|
+
}
|
|
69
|
+
if (sign === '+') return { kind: 'add', ...where('new', newN++) }
|
|
70
|
+
if (sign === '-') return { kind: 'del', ...where('old', oldN++) }
|
|
71
|
+
if (sign === ' ') {
|
|
72
|
+
oldN++
|
|
73
|
+
return { kind: 'context', ...where('new', newN++) }
|
|
74
|
+
}
|
|
75
|
+
// "" belongs to the hunk; anything else ends it
|
|
76
|
+
if (sign === '\\') return { kind: 'meta' }
|
|
77
|
+
inHunk = false
|
|
78
|
+
}
|
|
79
|
+
if (line.startsWith('diff --git ')) {
|
|
80
|
+
file = ''
|
|
81
|
+
oldFile = ''
|
|
82
|
+
status = ''
|
|
83
|
+
renamedFrom = ''
|
|
84
|
+
} else if (line.startsWith('new file mode')) status = 'new'
|
|
85
|
+
else if (line.startsWith('deleted file mode')) status = 'deleted'
|
|
86
|
+
else if (line.startsWith('rename from ')) renamedFrom = line.slice('rename from '.length)
|
|
87
|
+
else if (line.startsWith('--- ')) oldFile = line === '--- /dev/null' ? '' : unprefix(line.slice(4))
|
|
88
|
+
else if (line.startsWith('+++ ')) {
|
|
89
|
+
// the file's name, once its headers are read: what the reader sees of them
|
|
90
|
+
file = line === '+++ /dev/null' ? '' : unprefix(line.slice(4))
|
|
91
|
+
const name = renamedFrom ? `${renamedFrom} → ${file}` : file || oldFile
|
|
92
|
+
return { kind: 'file', label: status ? `${name} (${status})` : name }
|
|
93
|
+
}
|
|
94
|
+
return { kind: 'meta' }
|
|
95
|
+
})
|
|
96
|
+
}
|