@kitionstage/dsh-kits 0.0.0-stage → 0.1.1-stage.8
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 +405 -2
- package/bin/kits-mcp.mjs +70 -0
- package/cordis.patch.yml +27 -0
- package/lib/client.js +2252 -0
- package/lib/forward.mjs +81 -0
- package/lib/freshness.mjs +79 -0
- package/lib/gateways.mjs +208 -0
- package/lib/host.mjs +170 -0
- package/lib/kition.mjs +222 -0
- package/lib/live.mjs +127 -0
- package/lib/mcp.mjs +151 -0
- package/lib/reviews.mjs +49 -0
- package/lib/routes.mjs +152 -0
- package/lib/tools.mjs +364 -0
- package/lib/workspaces.mjs +66 -0
- package/package.json +66 -4
- package/skills/board-editing/SKILL.md +683 -0
- package/skills/cad-editing/SKILL.md +463 -0
- package/skills/design-editing/SKILL.md +356 -0
- package/skills/doc-editing/SKILL.md +312 -0
- package/skills/drafts-compare/SKILL.md +16 -0
- package/skills/drafts-discard/SKILL.md +15 -0
- package/skills/drafts-list/SKILL.md +16 -0
- package/skills/drafts-merge/SKILL.md +16 -0
- package/skills/film-editing/SKILL.md +541 -0
- package/skills/html-editing/SKILL.md +149 -0
- package/skills/layout-editing/SKILL.md +322 -0
- package/skills/motion-editing/SKILL.md +682 -0
- package/skills/note-editing/SKILL.md +256 -0
- package/skills/pdf-editing/SKILL.md +265 -0
- package/skills/photo-editing/SKILL.md +316 -0
- package/skills/scene-editing/SKILL.md +722 -0
- package/skills/sheet-editing/SKILL.md +364 -0
- package/skills/slide-editing/SKILL.md +447 -0
- package/skills/table-editing/SKILL.md +402 -0
- package/skills/vector-editing/SKILL.md +255 -0
package/README.md
CHANGED
|
@@ -1,3 +1,406 @@
|
|
|
1
|
-
#
|
|
1
|
+
# kition-kits: the Kition kits in DeepSeek Harness
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@kitionstage/dsh-kits` is a [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) plugin
|
|
4
|
+
(a bundle) for the 16 Kition kits: Note, for Markdown notes; Table, for `.ktable` tables; Board,
|
|
5
|
+
for whiteboards; Doc, for word-processing documents (`.docx`); Sheet, for spreadsheets; Slide, for presentations; PDF;
|
|
6
|
+
HTML, for `.html` pages; Photo, for layered images; Vector, for vector drawings; Layout, for page
|
|
7
|
+
layouts; Design, for interface designs; Film, for video projects; Motion, for motion graphics; CAD,
|
|
8
|
+
for `.dxf` drawings; and Scene, for 3D scenes. A kit's file opens in the kit's own editor in
|
|
9
|
+
DeepSeek Harness's right sidebar, where you edit it; DeepSeek Harness's agents create, inspect,
|
|
10
|
+
edit and check the same files with the kits' Kit Harness Protocol (KHP) tools, and an agent's edit
|
|
11
|
+
of a file open in the editor appears there as it happens. No Kition app needs to run: the plugin
|
|
12
|
+
starts `kition gateway` (`@kitionstage/cli`) for each workspace folder that needs it. It is the DeepSeek
|
|
13
|
+
Harness counterpart of the Claude Code plugin in `plugins/claude-code/kition-kits`.
|
|
14
|
+
|
|
15
|
+
What it adds:
|
|
16
|
+
|
|
17
|
+
- **The kits' editors in the right sidebar.** Click a file of a type only Kition opens (`.ktable`,
|
|
18
|
+
`.kboard`, `.kslide`, `.kdesign`, `.psd`, `.dxf`, ...) in the file tree, and it opens in its
|
|
19
|
+
kit's editor in a tab. A type DeepSeek Harness previews itself (`.md`, `.markdown`, `.html`,
|
|
20
|
+
`.htm`, `.pdf`, `.docx`, `.xlsx`, `.pptx`, `.csv`, `.svg`, `.xls`) keeps DeepSeek Harness's
|
|
21
|
+
preview; the kit is under **Open with** in the preview's toolbar ("Kition Note", "Kition Doc",
|
|
22
|
+
...), or first when you set it so (Settings, below). A type a kit only views (Sheet's `.csv`,
|
|
23
|
+
`.ods`, `.xls`; Vector's `.svg`, `.ai`, `.eps`; Design's `.fig`, `.sketch`; Layout's `.idml`)
|
|
24
|
+
opens read-only, marked so, whether or not the kit is installed yet. Saving is the editor's own
|
|
25
|
+
(Cmd+S, its Save button). The tab's title shows `●` while it has unsaved edits and a Draft mark
|
|
26
|
+
while an agent's draft waits (before the name, which a narrow tab cuts), and closing it with
|
|
27
|
+
unsaved edits asks first, for a Kition tab and an Open with preview alike; so does leaving or
|
|
28
|
+
reloading the web UI. DeepSeek Harness's keyboard shortcuts work with the keyboard in the editor.
|
|
29
|
+
The editor follows DeepSeek Harness's theme and its language (English and Chinese).
|
|
30
|
+
- **The agent's edits, live.** The KHP tools `mcp__kition__kit_inspect`, `_commands`, `_run`,
|
|
31
|
+
`_check`, `_query`, `_batch`, `_export`, `_create`, `_draft_ready` and `_draft_reopen` (those the
|
|
32
|
+
installed kits offer), routed to the right kit by the file's extension, and the kits' resources
|
|
33
|
+
(each kit's manifest, a document's objects) through DeepSeek Harness's resource tools. A
|
|
34
|
+
session's calls act on that session's own workspace folder and go to its gateway: a file open in
|
|
35
|
+
the editor is edited there, as a step in the editor's history; any other file through the kit's
|
|
36
|
+
headless engine. Paths outside the folder are refused (KHP A29). When an agent is about to edit a
|
|
37
|
+
file that is not open, a live window opens it first, so that edit and the turn's next ones run in
|
|
38
|
+
its editor as you watch, without taking the keyboard from where you type (Settings). The window is
|
|
39
|
+
small and floats at the top right, beside the conversation where the page has room, else over its
|
|
40
|
+
right side, so the conversation keeps its width; it shows the document in the editor's Menus
|
|
41
|
+
display mode (a menu bar, no ribbon), and its Open in editor button opens the full editor in
|
|
42
|
+
the right sidebar. A file the agent only created opens with its first content, not as an empty
|
|
43
|
+
page. In a page too small for the window, the file is a tab in the right sidebar. You close it,
|
|
44
|
+
and it stays closed for that turn.
|
|
45
|
+
- **A review card at the end of each turn.** Each kit file the turn changed gets a card in the chat:
|
|
46
|
+
its name and kit, a picture of the draft, what changed (objects created, changed, deleted), and
|
|
47
|
+
where it stands: edited live in the open editor, edited, created, a draft for your review (ready,
|
|
48
|
+
or stale when the file changed since it began), merged, discarded, the draft gone, the file
|
|
49
|
+
deleted; or that Kition is not installed or does not answer, with Try again. Open opens the file
|
|
50
|
+
in the sidebar; Review opens the editor's review of the draft in the right sidebar's tab (a live
|
|
51
|
+
window moves there). Merge, Discard and, for a stale draft, Merge and overwrite are yours: buttons
|
|
52
|
+
in the card, never an agent's tool (KHP A14). The card follows the draft as it changes, the open
|
|
53
|
+
editor takes a merge, and a conversation opened again shows its cards. What you did to a draft
|
|
54
|
+
(merged, discarded, by you, when) is recorded with the workspace, in `.kition/dsh-reviews.json`,
|
|
55
|
+
so every browser shows it; a draft merged or
|
|
56
|
+
discarded elsewhere (the CLI, another editor) shows as no longer there, which is all the plugin
|
|
57
|
+
knows of it.
|
|
58
|
+
- **The agent's drafts, for you to review.** An agent's draft (`draft: true`) leaves the file as it
|
|
59
|
+
is; the editor shows a banner ("An agent drafted changes to this file — Review") with the
|
|
60
|
+
comparison and the pictures before and after, and Merge and Discard. `/drafts-list`,
|
|
61
|
+
`/drafts-compare <file>`, `/drafts-merge <file>` and `/drafts-discard <file>` do the same from the
|
|
62
|
+
chat; merge and discard are not in the agent's catalog and only start when you type them.
|
|
63
|
+
- **A skill per kit, `<kit>-editing`**: the kit's own model guide (`agent/guide.md` in its
|
|
64
|
+
repository): how its documents are built, how objects are addressed, the workflow (inspect,
|
|
65
|
+
find commands, run in small steps, check, fix) and worked examples. They are in every agent's
|
|
66
|
+
skill catalog; the agent loads one with the `skill` tool when it works with that kit's files.
|
|
67
|
+
|
|
68
|
+
## Install
|
|
69
|
+
|
|
70
|
+
One package: the plugin brings its own `kition`. It depends on `@kitionstage/cli` at its own version,
|
|
71
|
+
whose package for your platform, `@kitionstage/cli-<platform>`, carries the `kition` executable; adding
|
|
72
|
+
the plugin by name or from its `.tgz` installs both with it. Nothing else is installed by hand.
|
|
73
|
+
|
|
74
|
+
The plugin has a kition for: `darwin-arm64` (macOS, Apple silicon), `darwin-x64` (macOS, Intel),
|
|
75
|
+
`linux-arm64` and `linux-x64` (Linux with glibc), and `win32-x64` (Windows).
|
|
76
|
+
|
|
77
|
+
On disk the plugin takes about 0.7 MB and its kition about 14 MB (measured on macOS, Apple
|
|
78
|
+
silicon). `kition` downloads each kit with its editor the first time a file of it is opened (the
|
|
79
|
+
tab shows the download's progress, and "Try again" when it fails), into `~/.kition/kits`: about 40
|
|
80
|
+
to 70 MB per kit on disk (measured: Note, Table, Sheet, Vector's editor). The download is the kit's
|
|
81
|
+
two npm packages, smaller: Note's is 14.0 MB for its `darwin-arm64` package and 13.0 MB for its
|
|
82
|
+
editor; Table's editor is 22.2 MB. They come from npm, as the plugin does: `KITION_NPM_REGISTRY`
|
|
83
|
+
when set, else the registry your `~/.npmrc` names, else registry.npmjs.org, else its mirror
|
|
84
|
+
registry.npmmirror.com, each checked against the integrity the kit index gives (kition-sdk's
|
|
85
|
+
`docs/sdk/cli.md`, "The registries"). Nothing is downloaded from GitHub.
|
|
86
|
+
|
|
87
|
+
Which `kition` runs, in this order:
|
|
88
|
+
|
|
89
|
+
1. `KITION_BIN`, when you set it (a development build, for one);
|
|
90
|
+
2. `KITION_KITS_MCP`, when it names a `kition` (then the draft skills' server is the gateways' too);
|
|
91
|
+
3. the plugin's own, from `@kitionstage/cli-<platform>` beside it;
|
|
92
|
+
4. a `kition` you installed (on the `PATH`, else in `~/.kition/bin`, `~/.cargo/bin`,
|
|
93
|
+
`/usr/local/bin`, `/opt/homebrew/bin`).
|
|
94
|
+
|
|
95
|
+
Elsewhere (a platform without a package, such as Linux with musl or FreeBSD; an install with
|
|
96
|
+
optional dependencies left out, `--omit=optional` or `--no-optional`; a plugin added from a folder,
|
|
97
|
+
below), a Kition tab and a card say why and what to do, and agents have one tool, `kition_setup`,
|
|
98
|
+
that answers the same; set `KITION_BIN` to a `kition` you built (`cargo build -p kition-cli` in
|
|
99
|
+
kition-sdk). The kit tools appear without a restart once a kition can run: the plugin looks again
|
|
100
|
+
every 15 seconds and whenever you open a kit file.
|
|
101
|
+
|
|
102
|
+
Every `kition` shares your kit store and index, `~/.kition` (`KITION_HOME`, `KITION_INDEX`): the
|
|
103
|
+
plugin's and one you installed for another agent (the Claude Code plugin, `npm install -g
|
|
104
|
+
@kitionstage/cli`) install kits once for both. Two versions do not mix on one workspace: a `kition mcp`
|
|
105
|
+
of another version beside the plugin's gateway serves in its own process (its edits of a file open
|
|
106
|
+
in the plugin's editors are then not live, and the editor's save is refused over a change it did
|
|
107
|
+
not see), and the
|
|
108
|
+
plugin uses no gateway of another version, saying which one runs and how to stop it.
|
|
109
|
+
|
|
110
|
+
kition-sdk's release publishes the plugin with the `@kitionstage/cli` it depends on, at the same
|
|
111
|
+
version, after it. A release rehearsal publishes it as `<scope>/dsh-kits` (such as
|
|
112
|
+
`@kitionstage/dsh-kits`), depending on `<scope>/cli`; its kition then installs that scope's kits
|
|
113
|
+
(`KITION_NPM_SCOPE`, unless you set it). Until they are published, pack them from a kition-sdk
|
|
114
|
+
checkout and install the plugin's `.tgz` with `@kitionstage/cli` reachable, or set `KITION_BIN`:
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
npm pack ./plugins/deepseek-harness/kition-kits # kition-dsh-kits-<version>.tgz
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**DeepSeek Harness (web).** DeepSeek Harness 0.2.2-rc.5 needs Node.js 24.9 or later, and
|
|
121
|
+
`dsh plugin` needs `pnpm` on the `PATH`. Install into the profile you run, `web` for the browser UI:
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
dsh plugin --profile web add ./kition-dsh-kits-<version>.tgz # by name, @kitionstage/dsh-kits, after the package is published
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`dsh plugin` creates a profile it does not know with DeepSeek Harness's base bundle only, which has
|
|
128
|
+
no browser UI; the shipped profile names (`web`, `headless`, ...) start from their own template.
|
|
129
|
+
For the browser UI under another name, create the profile from the `web` template first:
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
dsh --profile <profile> --from-default-profile web --dump-config
|
|
133
|
+
dsh plugin --profile <profile> add ./kition-dsh-kits-<version>.tgz
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`dsh --profile <profile> --dump-config` then shows the plugin's layer, `# == @kitionstage/dsh-kits`.
|
|
137
|
+
Restart a running profile after adding the plugin. `dsh plugin --profile <profile> remove
|
|
138
|
+
@kitionstage/dsh-kits` removes it. In the `headless` profile, which has no browser UI, the plugin gives
|
|
139
|
+
the agents the tools and the skills.
|
|
140
|
+
|
|
141
|
+
**DeepSeek Harness Desktop.** Its profile, `desktop`, takes plugins only through the app's Plugins
|
|
142
|
+
page or its own command line (the npm `dsh` refuses it). Quit the app, then:
|
|
143
|
+
|
|
144
|
+
```sh
|
|
145
|
+
"/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh" plugin --profile desktop add ./kition-dsh-kits-<version>.tgz
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
and start the app again. After the package is published, the Plugins page installs it by name:
|
|
149
|
+
**Add plugin**, type `@kitionstage/dsh-kits`, **Install**, then **Enable now**, and start the app
|
|
150
|
+
again; the page installs from the registry it shows (by default a mirror of npm in mainland China,
|
|
151
|
+
which copies new npm versions within minutes), and its own command line takes the name in place of
|
|
152
|
+
the `.tgz`.
|
|
153
|
+
|
|
154
|
+
**A folder.** `dsh plugin add <folder>` and the Plugins page's local folder link the folder as it
|
|
155
|
+
is: neither installs its dependencies (pnpm `add <folder>`, seen on 0.2.2-rc.5 and Desktop's
|
|
156
|
+
0.2.2-rc.2), so the plugin has no kition of its own until you run `npm install --omit=dev` in the
|
|
157
|
+
folder; a tab says so. It is for a checkout; add the plugin's `.tgz` otherwise (or, once it is
|
|
158
|
+
published, its name).
|
|
159
|
+
|
|
160
|
+
## Settings
|
|
161
|
+
|
|
162
|
+
On the plugin's own page in DeepSeek Harness (Plugins, `@kitionstage/dsh-kits`), kept in the profile:
|
|
163
|
+
|
|
164
|
+
| Setting | Default | What it does |
|
|
165
|
+
| --- | --- | --- |
|
|
166
|
+
| Live window | on | While an agent edits a kit file that is not open, show it in a floating window |
|
|
167
|
+
| Open after the agent's first edit | off | Open a file in the right sidebar after an agent's first edit of it in a turn (instead of the floating window) |
|
|
168
|
+
| Open first in | DeepSeek Harness's preview | Which opens a `.md`, `.html`, `.pdf`, `.docx`, `.xlsx`, `.pptx`, `.csv` or `.svg` file first: DeepSeek Harness's preview, or the Kition editor (the other stays under Open with) |
|
|
169
|
+
|
|
170
|
+
They are the host row's settings (`kition-kits-host`, its `Config`), which the browser module reads
|
|
171
|
+
through DeepSeek Harness's settings service. The page shows them in DeepSeek Harness's language
|
|
172
|
+
(English or Chinese); the schema's own descriptions carry both (`Schema.i18n`), for any other
|
|
173
|
+
place that shows the schema.
|
|
174
|
+
|
|
175
|
+
## Options
|
|
176
|
+
|
|
177
|
+
DeepSeek Harness bundles have no settings form, so the options are environment variables of the
|
|
178
|
+
`dsh` process (of the app, for Desktop):
|
|
179
|
+
|
|
180
|
+
| Variable | What it is |
|
|
181
|
+
| --- | --- |
|
|
182
|
+
| `KITION_BIN` | The `kition` executable, before the plugin's own (such as `target/debug/kition` from `cargo build -p kition-cli`). Unset: as in Install, above |
|
|
183
|
+
| `KITION_KITS_DIR` | A folder with one folder per kit, each holding its `kit.json` and headless executable. Unset: the kits `kition` installs in `~/.kition/kits` |
|
|
184
|
+
| `KITION_KIT_REPOS` | A folder of kit checkouts, `kition-<kit>/`. Every kit built there with `cargo build -p kition-<kit>` is served from `target/debug/kition-<kit>` with its repository's `kit.json` |
|
|
185
|
+
| `KITION_KITS_UNIFIED` | `true` (the default): `mcp__kition__kit_<action>` tools routed by file extension. Anything else: `mcp__kition__<prefix>_<action>` per installed kit, such as `mcp__kition__note_run` |
|
|
186
|
+
| `KITION_LIVE_WAIT_MS` | How long an agent's edit of a file not open waits, at most, for a watching browser to answer that it opens the file's live window (default 3000, at most 10000; `0` never waits). A browser that answered it is opening the editor gets until 8 seconds after the edit was announced for the editor to attach (a kit's editor loaded for the first time takes about 3 seconds). An edit never waits when no browser shows the session, or the live window is off |
|
|
187
|
+
| `KITION_KITS_MCP` | The draft skills' server, as `bin/kits-mcp.mjs` starts it: `kition` (started as `kition mcp`) or a `kition-kits-mcp`. Unset: `kition` as above, else `kition-kits-mcp` on the `PATH`, else `npx -y @kitionstage/cli mcp`. A `kition` named here is also the one the gateways use, unless `KITION_BIN` is set; it must have the `gateway` command |
|
|
188
|
+
|
|
189
|
+
`KITION_HOME`, `KITION_INDEX` and `KITION_NPM_SCOPE` are `kition`'s own (its kit store and lockfiles, its kit index, and the npm scope of the kits and the index; a release rehearsal's plugin sets the scope to its own when it is not set).
|
|
190
|
+
|
|
191
|
+
## How it fits together
|
|
192
|
+
|
|
193
|
+
- `package.json` declares the bundle (`dsh.bundle.patch`, `cordis.patch.yml`), its browser module
|
|
194
|
+
(`dsh.client`, `exports["./client"]`, `lib/client.js`), its host module (`main`,
|
|
195
|
+
`lib/host.mjs`), and the DeepSeek Harness releases it supports, `engines.dsh`
|
|
196
|
+
`>=0.2.2-rc.2 <0.3.0-0`. DeepSeek Harness compares the range with prereleases included: it
|
|
197
|
+
accepts 0.2.2-rc.2 and every later 0.2.x, prereleases too, and refuses 0.3.0 and its
|
|
198
|
+
prereleases (a plain `<0.3.0` would let 0.3.0-rc.1 in). `dsh plugin add` refuses a plugin whose
|
|
199
|
+
range the running DeepSeek Harness is outside, and installs nothing.
|
|
200
|
+
- `cordis.patch.yml` inserts two rows on the host. `kition-kits-host` loads the package by its name:
|
|
201
|
+
its host module, and, in a profile with the browser UI, its browser module. `kition-kits-skills`,
|
|
202
|
+
a `@deepseek-ai/dsh-skill-filesystem` row (`includeDefaultRoots: false`), adds the plugin's
|
|
203
|
+
`skills/` folder to the host's global skill layer, which every agent's catalog merges (in the
|
|
204
|
+
`web` profile beside each agent preset's own skills). In a bundle's patch, `baseUrl` is the
|
|
205
|
+
profile's folder (`$DSH_HOME/profiles/<profile>/`), not the bundle's, so the row finds the
|
|
206
|
+
plugin's folder where the profile resolves `@kitionstage/dsh-kits/package.json`.
|
|
207
|
+
- **The gateways** (`lib/gateways.mjs`, `lib/kition.mjs`). The host module starts one
|
|
208
|
+
`kition gateway --workspace <folder> --stdin-lifetime` per workspace folder, with the `kition`
|
|
209
|
+
found as in Install (the plugin's own: `@kitionstage/cli-<platform>`'s executable, found from
|
|
210
|
+
`@kitionstage/cli`'s folder, started directly) and the kit options above, the first time a tab or a
|
|
211
|
+
tool call needs it, and reuses it. A gateway that another process already runs for the folder
|
|
212
|
+
is used through its lockfile (`kition gateway` exits 3 and names it) when it is the same
|
|
213
|
+
`kition` version; one of another version is not, and the tab says which runs. A gateway that stops is started again on the next request, with its new token. The
|
|
214
|
+
gateways the host started stop with it (their stdin closes).
|
|
215
|
+
- **The kit tools** (`lib/tools.mjs`, `lib/mcp.mjs`). The host module registers the kits' tools with
|
|
216
|
+
DeepSeek Harness's tool registry under the names its MCP client would give them,
|
|
217
|
+
`mcp__kition__<tool>`, and the kits' instructions as the MCP server section of the system prompt.
|
|
218
|
+
The tools and the instructions come from a `kition mcp` for an empty folder of its own, run once
|
|
219
|
+
at start, and are listed again after calls (a kit installed on first use can add tools). That
|
|
220
|
+
first list can take seconds, and DeepSeek Harness offers a step the tools registered when the
|
|
221
|
+
step begins, so the unified tools' names (`kit_inspect`, ..., known beforehand) are registered at
|
|
222
|
+
start, each with a condition (`when`) that DeepSeek Harness waits for while it prepares a step:
|
|
223
|
+
it holds until the first list (at most 30 seconds) and admits the tool only if the kits listed
|
|
224
|
+
it, its definition filled in from the list. A call
|
|
225
|
+
goes to the kits' MCP server of the gateway of the calling session's workspace folder
|
|
226
|
+
(`POST /api/v1/mcp/kits`, one connection per agent). DeepSeek Harness's own MCP client cannot do
|
|
227
|
+
this: it runs one server per host, on one folder (in Desktop the host's folder is the profile's),
|
|
228
|
+
and a tool call carries nothing that names the session it comes from; a registered tool is
|
|
229
|
+
given its calling agent and session. A result's preview images are saved as attachments when the
|
|
230
|
+
model takes images, else replaced by a note, as the MCP client does. Each call's outcome (the
|
|
231
|
+
file, its kit, live or draft) is kept with its result in the session log (`presentationMeta`),
|
|
232
|
+
where the browser module's turn projection reads it. The kits' MCP resources go the same way,
|
|
233
|
+
registered with DeepSeek Harness's resource service as server `kition`. While `kition` is missing
|
|
234
|
+
there is only `kition_setup`; `lib/freshness.mjs` lists the tools again when it appears or its
|
|
235
|
+
executable changes (an upgrade also stops the gateways of the old one).
|
|
236
|
+
- **The proxy** (`lib/routes.mjs`, `lib/forward.mjs`). The host module serves each gateway under
|
|
237
|
+
`/kition/w/<key>/` on DeepSeek Harness's own web server (and, in Desktop, through its
|
|
238
|
+
`dsh-app://` forwarding), where `<key>` names a workspace folder. Every request passes DeepSeek
|
|
239
|
+
Harness's own login check first (its connection service's Host and Origin fence and browser
|
|
240
|
+
cookie; plugin routes are not guarded otherwise), and nothing reaches a gateway for a folder no
|
|
241
|
+
DeepSeek Harness session or project works in. `/kition/api/open?session=<id>&path=<file>` gives a
|
|
242
|
+
session's file's editor address, the file inside the session's folder, and starts its gateway.
|
|
243
|
+
The proxy adds the gateway's token, which never reaches the browser, drops the browser's
|
|
244
|
+
`Origin`, `Cookie`, `Referer` and any `Kition-Token`, and streams the bridge's events, ranges and
|
|
245
|
+
large saves as they come (kition-sdk `docs/sdk/gateway-page.md`).
|
|
246
|
+
- **The browser module** (`lib/client.js`, built by `build-client.mjs` from `src/client/`). It
|
|
247
|
+
registers a right sidebar tab type for the extensions only Kition opens and a document preview
|
|
248
|
+
for each kit whose extensions DeepSeek Harness previews (the extensions each published kit edits
|
|
249
|
+
or only views come from the kits' manifests at build time). A tab frames the gateway's editor
|
|
250
|
+
page, same-origin, in a frame named `dsh-sidebar-html-<tab id>` with a `data-html-preview`
|
|
251
|
+
attribute, the frames DeepSeek Harness Desktop hands its shortcuts to, and speaks the page's
|
|
252
|
+
`postMessage` protocol: theme and language, title, unsaved mark, read-only, draft, review, close
|
|
253
|
+
requests. In the web UI it gives the page DeepSeek Harness's own shortcut bindings (`keys=`), so
|
|
254
|
+
the editor hands them back. The document preview's title is the plugin's (it stands in for
|
|
255
|
+
DeepSeek Harness's, drawn the same way) and both tab kinds have its close guard.
|
|
256
|
+
- **The review cards** (`src/client/turn.ts`, `src/client/gateway.ts`). A projection registered
|
|
257
|
+
with DeepSeek Harness's conversation engine (`uiConversation.events.register`, `kitionTurn`) reads
|
|
258
|
+
each turn's kit tool calls and results; the turn's tail (`conversation.chat.turnTail`) shows a
|
|
259
|
+
card per file the turn changed, with the gateway's drafts (followed through its bridge's
|
|
260
|
+
`kit/draftsChanged`, the pages' messages, and every 10 seconds) and their comparison. Merge and
|
|
261
|
+
Discard go through the proxy from the person's click in the card, which records them
|
|
262
|
+
(`lib/reviews.mjs`, `GET /kition/api/reviews?session=<id>`); the card shows the record of its
|
|
263
|
+
session and turn, else the latest of the file's records made after its draft. The settings card
|
|
264
|
+
is on the plugin's page (`plugins.bundle.config`), bound to the host row's settings
|
|
265
|
+
(`configForms`). Questions (closing unsaved edits, discarding a draft) are a small dialog in the
|
|
266
|
+
page, not the browser's `confirm`, which stops the page (in Desktop it is a native window).
|
|
267
|
+
- **The live window** (`lib/live.mjs`, `src/client/placement.ts`). A watcher in the composer's dock
|
|
268
|
+
(`conversation.input.dock`) keeps an event stream open on `/kition/api/live?session=<id>`. Before
|
|
269
|
+
the host forwards a session's `run` or `batch` of a file (not a draft), it announces the file
|
|
270
|
+
there and waits (`KITION_LIVE_WAIT_MS`, above) for an answer: the editor is open already, it is
|
|
271
|
+
opening (then attached, or not), or none opens. The watcher opens the file docked
|
|
272
|
+
(`sidebarRight.openResource`), floats it right of the conversation column
|
|
273
|
+
(`sidebarRight.float`, at least 420 by 360, at most 640 by 760) when the page has room, and keeps
|
|
274
|
+
the keyboard where it was. Edits the host does not announce (drafts, new files) open the window
|
|
275
|
+
once they show in the turn.
|
|
276
|
+
- `bin/kits-mcp.mjs` starts `kition mcp` with the options; the draft skills run its
|
|
277
|
+
`drafts <command> ...` passthrough on the session's folder.
|
|
278
|
+
- A `/name` token anywhere in your message injects that skill's instructions into the turn; the
|
|
279
|
+
rest of your message stays as you wrote it, and the skill reads the file from it (DeepSeek
|
|
280
|
+
Harness replaces no `$ARGUMENTS`). A skill with `disable-model-invocation: true` is never in the
|
|
281
|
+
agent's catalog and the `skill` tool refuses it, so `/drafts-merge` and `/drafts-discard` only
|
|
282
|
+
start from your own message.
|
|
283
|
+
- `skills/<kit>-editing/SKILL.md` is generated by `node tools/agent-plugin-skills.mjs` (in
|
|
284
|
+
kition-sdk) from each published kit's `agent/guide.md` and `kit.json`, with the same guides as
|
|
285
|
+
the Claude Code plugin's; only the opening paragraph, which names the tools as each harness
|
|
286
|
+
shows them, differs. The publication allowlist is `published-kits.json` at the SDK root. Edit
|
|
287
|
+
the guide in the kit's repository, never the skill; `node tools/agent-plugin-skills.mjs --check`
|
|
288
|
+
fails when they differ. The `drafts-*` skills are written by hand.
|
|
289
|
+
|
|
290
|
+
## Limits
|
|
291
|
+
|
|
292
|
+
- Of the view-only types, the tests open Sheet's `.csv` and Vector's `.svg`; the other kits'
|
|
293
|
+
view-only types (Vector's `.ai`, `.eps`; Design's `.fig`, `.sketch`; Layout's `.idml`; Sheet's
|
|
294
|
+
`.ods`, `.xls`, `.xlsb`, `.et` and templates) are offered as their kits declare them, untested:
|
|
295
|
+
the kit repositories have no sample files of them.
|
|
296
|
+
- A draft merged or discarded outside DeepSeek Harness (the CLI, another editor) leaves no record:
|
|
297
|
+
its card says the draft is no longer there, not what became of it. The records are kept per
|
|
298
|
+
workspace folder, the latest 1000.
|
|
299
|
+
- A card is there for each file the turn changed; a turn that only read kit files has none.
|
|
300
|
+
- The live window waits for no browser that is not showing the session: an agent's edit while
|
|
301
|
+
nobody watches runs in the headless engine. When the page has no room right of the conversation
|
|
302
|
+
(a narrow window, a wide right sidebar), the live window is the sidebar's tab.
|
|
303
|
+
- The kits' unified tools are offered from a session's first step, which waits for the kits'
|
|
304
|
+
first tool list (at most 30 seconds after DeepSeek Harness started). With
|
|
305
|
+
`KITION_KITS_UNIFIED` off, the per-kit tools' names are not known before that list, so a step
|
|
306
|
+
that begins sooner goes without them.
|
|
307
|
+
- DeepSeek Harness sends every tool definition with every request; the kits' tools are large (with
|
|
308
|
+
Note and Table installed, about 93,000 characters of definitions).
|
|
309
|
+
- The skill catalog shows at most 500 characters of a skill's description; the Scene kit's is
|
|
310
|
+
longer and is cut there.
|
|
311
|
+
- The draft skills work on the session's current folder; after the agent changed its working
|
|
312
|
+
folder to a subfolder, they look there.
|
|
313
|
+
- Merging and discarding are yours (KHP A14) as far as the cards, the editor and the skills go; an
|
|
314
|
+
agent with a shell could still run the launcher's `drafts merge` itself, as with any harness.
|
|
315
|
+
- Quitting DeepSeek Harness Desktop with unsaved edits in a Kition tab does not ask: Electron shows
|
|
316
|
+
no page's question (it refuses to close the window instead, which kept the app from quitting at
|
|
317
|
+
all), and the app offers plugins no question of their own at quit. Save first; closing the tab
|
|
318
|
+
asks.
|
|
319
|
+
- Tested on macOS (Apple silicon), with Chromium for the web UI (as a Windows browser, the test's
|
|
320
|
+
device): the plugin's own kition there is the one tested. Windows and Linux hosts have not been
|
|
321
|
+
run, nor a browser on another machine than DeepSeek Harness; their kition packages are built and
|
|
322
|
+
checked by the release, not run with DeepSeek Harness.
|
|
323
|
+
- The Plugins page of Desktop installs from the registry it shows; a new version reaches its default
|
|
324
|
+
mirror only once the mirror has copied it from npm.
|
|
325
|
+
|
|
326
|
+
## Test
|
|
327
|
+
|
|
328
|
+
- `tools/dsh-plugin.test.mjs` (in kition-sdk) checks the manifest, what the archive packs, the
|
|
329
|
+
patch, the browser module (built from its sources, the extensions it claims), the skills and the
|
|
330
|
+
launcher, the dependency on `@kitionstage/cli` at the plugin's version and the release's order and
|
|
331
|
+
platforms; `tools/dsh-plugin-host.test.mjs` the host module: finding `kition` (`KITION_BIN`, the
|
|
332
|
+
plugin's own in a hoisted and an isolated node_modules, a system one only with `gateway`, and why
|
|
333
|
+
there is none), the gateways (one per folder, reused, none of another kition version, started
|
|
334
|
+
again, stopped), the proxy (the login gate first, workspace keys,
|
|
335
|
+
paths, header hygiene, event streams, ranges, large bodies, an unreachable gateway), the kit tools
|
|
336
|
+
(each session's calls on its own folder's gateway, the setup tool while kition is missing, the
|
|
337
|
+
tools listed again when kition appears or changes, the resources) against a stand-in gateway
|
|
338
|
+
(`test/fake-kition.mjs`); `tools/dsh-plugin-client.test.ts` the turn projection and the review
|
|
339
|
+
card's states and actions.
|
|
340
|
+
- `test/e2e.sh` runs the published DeepSeek Harness runtime's `headless` profile, with the plugin
|
|
341
|
+
installed by `dsh plugin add` under a `DSH_HOME` of its own. A scripted model
|
|
342
|
+
(`test/scripted-model.mjs`, an OpenAI Chat Completions server reached through the route in
|
|
343
|
+
`test/scripted-route.cordis.patch.yml`) asks for `mcp__kition__kit_inspect` on a real note, then
|
|
344
|
+
runs the launcher's `drafts list` with the `bash` tool as the draft skills do. `test/check.mjs`
|
|
345
|
+
checks the session log's `tool/call` and `tool/result` events, the final answer, and the skill
|
|
346
|
+
catalog. No model account is needed.
|
|
347
|
+
|
|
348
|
+
```sh
|
|
349
|
+
test/e2e.sh <kition> <folder of kit repositories> <a .md file>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
`<kition>` is a `kition` executable, and the folder holds kit checkouts with a debug build of the
|
|
353
|
+
Note kit (`kition-note/target/debug/kition-note`). The first run installs the published
|
|
354
|
+
`@deepseek-ai/dsh` runtime into a cache folder (`DSH_KITS_CACHE`, about 1 GB) with
|
|
355
|
+
`npm install --global --prefix`, as people install it.
|
|
356
|
+
- `pnpm test:dsh:e2e` (in kition-sdk, `test/web.e2e.ts`) runs the web UI of that runtime in
|
|
357
|
+
Chromium, with the plugin installed into a profile from the `web` template from a local registry
|
|
358
|
+
that holds it with `@kitionstage/cli` and this platform's package made as the release makes them, no
|
|
359
|
+
`KITION_BIN` and no kition on the `PATH` (the gateway is the plugin's own kition), the real
|
|
360
|
+
Table, Note and Sheet kits, Vector's editor and a scripted model (one that takes images), under a
|
|
361
|
+
HOME of its own:
|
|
362
|
+
`/kition/` refuses a request without DeepSeek Harness's login, a foreign Host and a cross-site
|
|
363
|
+
Origin; a `.ktable` clicked in the file tree opens the Table editor, DeepSeek Harness's settings
|
|
364
|
+
shortcut pressed in it opens DeepSeek Harness's settings, its language reaches the page, an edit
|
|
365
|
+
marks the tab, reloading then asks (the browser's question) and closing the tab asks (a dialog in
|
|
366
|
+
the page), and Cmd+S saves it to disk; a `.md` keeps DeepSeek
|
|
367
|
+
Harness's preview and opens in Kition Note from Open with, which follows the theme, marks unsaved
|
|
368
|
+
edits on DeepSeek Harness's tab and asks before it closes; the agent's `mcp__kition__kit_run`
|
|
369
|
+
reaches the open editor live, its preview picture reaches the model as an image, the kits'
|
|
370
|
+
instructions are in the system prompt, a resource reads through `read_mcp_resource`, a gateway
|
|
371
|
+
killed and started again takes the next edit live, and its drafts show the banner and the tab's
|
|
372
|
+
mark; review cards, every action a real click: the first edit of a file not open runs live in
|
|
373
|
+
the live window, which covers neither the composer nor the cards and leaves the keyboard there;
|
|
374
|
+
Open, Review (in the sidebar's tab, filling it), Merge (the open editor following), Discard,
|
|
375
|
+
Merge and overwrite of a stale draft, a draft merged with the CLI shown as gone, the same cards
|
|
376
|
+
after a reload and in another browser; in Chinese, dark and a narrower window the cards, the
|
|
377
|
+
tab's Draft mark, the review and the settings card are whole and translated; the live window
|
|
378
|
+
turned off on the plugin's page opens nothing; a `.csv` opens read-only in Kition Sheet and a
|
|
379
|
+
`.svg` in Kition Vector, which is not installed; the gateway stops with DeepSeek Harness.
|
|
380
|
+
- `pnpm test:dsh:desktop` (`test/desktop.e2e.ts`, macOS) starts the installed DeepSeek Harness
|
|
381
|
+
Desktop with a HOME, a DSH_HOME and an Electron user data folder of its own, no `KITION_BIN` and
|
|
382
|
+
no kition on the `PATH`, installs the plugin's `.tgz` with the app's CLI from the same kind of
|
|
383
|
+
local registry (its own kition comes with it, and runs the gateway), opens a `.ktable` in the
|
|
384
|
+
Table editor, closes its tab with Cmd+W pressed in the editor, has a scripted agent add a record
|
|
385
|
+
in the open editor, live, merges the agent's draft of another from its review card, the open
|
|
386
|
+
editor following, has the agent's edit of a file not open run live in the live window, and keeps
|
|
387
|
+
a setting; then, in a profile of its own, installs the plugin by name from the Plugins page,
|
|
388
|
+
opens a `.ktable` with the plugin's kition, and closes the app with unsaved edits in it.
|
|
389
|
+
|
|
390
|
+
Both need Node.js 24.9 or later and `pnpm`, a built `kition` (`cargo build -p kition-cli`) and the
|
|
391
|
+
gateway e2e's kit index with editor packages (kition-sdk `examples/gateway-page`).
|
|
392
|
+
|
|
393
|
+
## Versions
|
|
394
|
+
|
|
395
|
+
| DeepSeek Harness | Where | Tested |
|
|
396
|
+
| --- | --- | --- |
|
|
397
|
+
| 0.2.2-rc.5 (upstream commit `2e39e704`) | the published npm runtime: `web` and `headless` profiles | `test/e2e.sh`, `pnpm test:dsh:e2e` |
|
|
398
|
+
| 0.2.2-rc.2 | bundled in DeepSeek Harness Desktop 0.2.2-rc.2 | `pnpm test:dsh:desktop` |
|
|
399
|
+
|
|
400
|
+
The pin (KitAgent D4) is `dsh` in `package.json`: the target `0.2.2-rc.5` and the versions tested.
|
|
401
|
+
Every DeepSeek Harness API the plugin uses (the tool registry and its presentation metadata, the
|
|
402
|
+
resource service, the system prompt, the web server, the connection service, the sessions, the
|
|
403
|
+
settings service, the right sidebar's tab types, close guards and floating panels, the document
|
|
404
|
+
previews, the conversation engine and the turn tail, the composer's dock, the plugin page's
|
|
405
|
+
configuration slot, the shortcuts, the theme and the locale) has the same source in both; what a
|
|
406
|
+
profile lacks (the web server in `headless`) is left out, never told apart by version.
|
package/bin/kits-mcp.mjs
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Starts the kits' MCP server for the kition-kits DeepSeek Harness plugin: the server (arguments
|
|
3
|
+
// `--workspace <folder>`) or the person's draft review (`drafts <command> ...`). The plugin's
|
|
4
|
+
// options are environment variables (DeepSeek Harness bundles have no settings form):
|
|
5
|
+
//
|
|
6
|
+
// KITION_KITS_MCP the server executable: `kition` (started as `kition mcp`) or a
|
|
7
|
+
// kition-kits-mcp; default: the kition the gateways run (lib/kition.mjs:
|
|
8
|
+
// KITION_BIN, else the one that came with the plugin, else a system
|
|
9
|
+
// kition), else kition-kits-mcp on the PATH, else
|
|
10
|
+
// `npx -y @kitionstage/cli mcp`. kition installs each kit in ~/.kition/kits on
|
|
11
|
+
// first use when no kits are given here
|
|
12
|
+
// KITION_KITS_DIR a folder with one folder per installed kit (kit.json beside its executable)
|
|
13
|
+
// KITION_KIT_REPOS a folder of kit repository checkouts, kition-<kit>/, whose debug builds
|
|
14
|
+
// (target/debug/kition-<kit>) are served with the kit.json above them; a
|
|
15
|
+
// kition-* folder without a kit.json is no kit and is passed over
|
|
16
|
+
// KITION_KITS_UNIFIED "true" (the default): one tool set for every kit (kit_<action>);
|
|
17
|
+
// anything else: <prefix>_<action> per kit
|
|
18
|
+
//
|
|
19
|
+
// An option set to an empty string, or to an unexpanded `${...}` reference, is unset.
|
|
20
|
+
import { spawn } from 'node:child_process'
|
|
21
|
+
|
|
22
|
+
import { executable, findKition, isKition, kitionEnv, kitOptions, missingMessage, onPath, unset, windows } from '../lib/kition.mjs'
|
|
23
|
+
|
|
24
|
+
function fail(message) {
|
|
25
|
+
process.stderr.write(`kition-kits: ${message}\n`)
|
|
26
|
+
process.exit(1)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const args = process.argv.slice(2)
|
|
30
|
+
const serving = args[0] !== 'drafts'
|
|
31
|
+
// A rehearsal's copy of the plugin has its kition install its own scope's kits (kitionEnv).
|
|
32
|
+
const env = { ...kitionEnv(process.env) }
|
|
33
|
+
|
|
34
|
+
let command = env.KITION_KITS_MCP
|
|
35
|
+
let prefix = []
|
|
36
|
+
if (unset(command)) {
|
|
37
|
+
// An unset option must not reach the server's environment as a path.
|
|
38
|
+
delete env.KITION_KITS_MCP
|
|
39
|
+
const found = findKition(env)
|
|
40
|
+
if (found.error) fail(found.error)
|
|
41
|
+
command = found.file ?? onPath('kition-kits-mcp')
|
|
42
|
+
if (!command) {
|
|
43
|
+
const npx = onPath('npx')
|
|
44
|
+
if (npx) {
|
|
45
|
+
command = npx
|
|
46
|
+
prefix = ['-y', '@kitionstage/cli', 'mcp']
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (!command) fail(`${missingMessage(found)} (No kition-kits-mcp and no npx on the PATH either.)`)
|
|
50
|
+
} else if (!executable(command)) {
|
|
51
|
+
fail(`KITION_KITS_MCP is ${command}, which is not an executable file. Set it to a kition or kition-kits-mcp executable, or leave it unset.`)
|
|
52
|
+
}
|
|
53
|
+
// kition serves the kits as `kition mcp`, with kition-kits-mcp's arguments.
|
|
54
|
+
if (prefix.length === 0 && isKition(command)) prefix = ['mcp']
|
|
55
|
+
|
|
56
|
+
const options = kitOptions(env, { unified: serving })
|
|
57
|
+
|
|
58
|
+
// npx is a .cmd script on Windows, which only a shell starts.
|
|
59
|
+
const shell = windows && /\.(cmd|bat)$/i.test(command)
|
|
60
|
+
const quote = (value) => (shell ? `"${String(value).replace(/"/g, '""')}"` : value)
|
|
61
|
+
const child = spawn(quote(command), [...prefix, ...args, ...options].map(quote), { stdio: 'inherit', env, shell })
|
|
62
|
+
const forwarded = ['SIGINT', 'SIGTERM', 'SIGHUP']
|
|
63
|
+
for (const signal of forwarded) process.on(signal, () => child.kill(signal))
|
|
64
|
+
child.on('error', (error) => fail(`could not start ${command}: ${error.message}`))
|
|
65
|
+
child.on('exit', (code, signal) => {
|
|
66
|
+
if (!signal) process.exit(code ?? 1)
|
|
67
|
+
// End the same way the server did.
|
|
68
|
+
for (const name of forwarded) process.removeAllListeners(name)
|
|
69
|
+
process.kill(process.pid, signal)
|
|
70
|
+
})
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @kitionstage/dsh-kits: the Kition kits in DeepSeek Harness.
|
|
2
|
+
#
|
|
3
|
+
# Two rows, both on the host:
|
|
4
|
+
#
|
|
5
|
+
# - kition-kits-host: this package's host module (lib/host.mjs). It starts a `kition gateway` for a
|
|
6
|
+
# session's workspace folder when something needs it, registers the kits' tools
|
|
7
|
+
# (mcp__kition__kit_<action>) so each session's calls reach its own folder's gateway, and, in a
|
|
8
|
+
# profile with the browser UI, serves the gateway's editor page same-origin under /kition/ behind
|
|
9
|
+
# DeepSeek Harness's login. Loading the package by its name also loads its browser module
|
|
10
|
+
# (`dsh.client`): kit files open in their Kition editor in the right sidebar.
|
|
11
|
+
# - kition-kits-skills: this package's skills (an editing skill per kit, and the person's draft
|
|
12
|
+
# review) in every agent's skill catalog, from the host's global skill layer.
|
|
13
|
+
#
|
|
14
|
+
# `baseUrl` is the profile's folder, so this package's folder is where the profile resolves it.
|
|
15
|
+
#
|
|
16
|
+
# dsh plugin --profile <profile> add @kitionstage/dsh-kits
|
|
17
|
+
|
|
18
|
+
- insert:
|
|
19
|
+
- id: kition-kits-host
|
|
20
|
+
name: '@kitionstage/dsh-kits'
|
|
21
|
+
- id: kition-kits-skills
|
|
22
|
+
name: '@deepseek-ai/dsh-skill-filesystem'
|
|
23
|
+
config:
|
|
24
|
+
providerName: kition-kits
|
|
25
|
+
includeDefaultRoots: false
|
|
26
|
+
customSkillDirs:
|
|
27
|
+
- !!js "process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('@kitionstage/dsh-kits/package.json')), 'skills')"
|