dsh-typst-plugin 0.0.0-stage → 0.1.0-alpha.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.en.md +87 -0
- package/README.md +86 -2
- package/cordis.patch.yml +6 -0
- package/docs/images/icon.png +0 -0
- package/docs/plugin-detail.en.md +2 -0
- package/docs/plugin-detail.md +2 -0
- package/lib/client.js +41044 -0
- package/lib/client.js.map +7 -0
- package/lib/config.d.ts +50 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +31 -0
- package/lib/config.js.map +7 -0
- package/lib/constants.d.ts +58 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/constants.js +62 -0
- package/lib/constants.js.map +7 -0
- package/lib/contract.d.ts +179 -0
- package/lib/contract.d.ts.map +1 -0
- package/lib/contract.js +1 -0
- package/lib/contract.js.map +7 -0
- package/lib/errors.d.ts +77 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +86 -0
- package/lib/errors.js.map +7 -0
- package/lib/host/facts.d.ts +31 -0
- package/lib/host/facts.d.ts.map +1 -0
- package/lib/host/facts.js +151 -0
- package/lib/host/facts.js.map +7 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +7 -0
- package/lib/remote.d.ts +69 -0
- package/lib/remote.d.ts.map +1 -0
- package/lib/remote.js +146 -0
- package/lib/remote.js.map +7 -0
- package/lib/service.d.ts +47 -0
- package/lib/service.d.ts.map +1 -0
- package/lib/service.js +110 -0
- package/lib/service.js.map +7 -0
- package/lib/skills/typst.d.ts +13 -0
- package/lib/skills/typst.d.ts.map +1 -0
- package/lib/skills/typst.js +72 -0
- package/lib/skills/typst.js.map +7 -0
- package/lib/status-codec.d.ts +11 -0
- package/lib/status-codec.d.ts.map +1 -0
- package/lib/status-codec.js +6 -0
- package/lib/status-codec.js.map +7 -0
- package/lib/tools/registration.d.ts +22 -0
- package/lib/tools/registration.d.ts.map +1 -0
- package/lib/tools/registration.js +525 -0
- package/lib/tools/registration.js.map +7 -0
- package/lib/tools/shared.d.ts +31 -0
- package/lib/tools/shared.d.ts.map +1 -0
- package/lib/tools/shared.js +70 -0
- package/lib/tools/shared.js.map +7 -0
- package/lib/typert.d.ts +23 -0
- package/lib/typert.d.ts.map +1 -0
- package/lib/typert.js +67 -0
- package/lib/typert.js.map +7 -0
- package/lib/typst/diagnostics.d.ts +58 -0
- package/lib/typst/diagnostics.d.ts.map +1 -0
- package/lib/typst/diagnostics.js +171 -0
- package/lib/typst/diagnostics.js.map +7 -0
- package/lib/typst/locate.d.ts +68 -0
- package/lib/typst/locate.d.ts.map +1 -0
- package/lib/typst/locate.js +194 -0
- package/lib/typst/locate.js.map +7 -0
- package/lib/typst/mainfile.d.ts +21 -0
- package/lib/typst/mainfile.d.ts.map +1 -0
- package/lib/typst/mainfile.js +64 -0
- package/lib/typst/mainfile.js.map +7 -0
- package/lib/typst/match.d.ts +59 -0
- package/lib/typst/match.d.ts.map +1 -0
- package/lib/typst/match.js +171 -0
- package/lib/typst/match.js.map +7 -0
- package/lib/typst/oneshot.d.ts +45 -0
- package/lib/typst/oneshot.d.ts.map +1 -0
- package/lib/typst/oneshot.js +76 -0
- package/lib/typst/oneshot.js.map +7 -0
- package/lib/typst/pdf-extract.d.ts +29 -0
- package/lib/typst/pdf-extract.d.ts.map +1 -0
- package/lib/typst/pdf-extract.js +87 -0
- package/lib/typst/pdf-extract.js.map +7 -0
- package/lib/typst/pdfjs-worker.d.js +1 -0
- package/lib/typst/pdfjs-worker.d.js.map +7 -0
- package/lib/typst/text.d.ts +65 -0
- package/lib/typst/text.d.ts.map +1 -0
- package/lib/typst/text.js +314 -0
- package/lib/typst/text.js.map +7 -0
- package/lib/typst/watcher.d.ts +77 -0
- package/lib/typst/watcher.d.ts.map +1 -0
- package/lib/typst/watcher.js +219 -0
- package/lib/typst/watcher.js.map +7 -0
- package/lib/wire-schemas.d.ts +578 -0
- package/lib/wire-schemas.d.ts.map +1 -0
- package/lib/wire-schemas.js +384 -0
- package/lib/wire-schemas.js.map +7 -0
- package/lib/workspace/session.d.ts +209 -0
- package/lib/workspace/session.d.ts.map +1 -0
- package/lib/workspace/session.js +1232 -0
- package/lib/workspace/session.js.map +7 -0
- package/locale/en.json +9 -0
- package/locale/zh.json +9 -0
- package/package.json +256 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Wenjie Xu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# dsh-typst
|
|
2
|
+
|
|
3
|
+
English · [简体中文](README.md)
|
|
4
|
+
|
|
5
|
+
The Typst plugin for DeepSeek Harness: a live typesetting preview in a right-sidebar panel while the agent writes and fixes your document, driven by **the Typst installed on your computer** — your fonts, your downloaded packages, your Typst version — so the preview matches what `typst compile` produces in your terminal. Each save (yours or the agent's) recompiles incrementally and redraws the visible pages in place, without flicker and without losing your place. The agent reads errors with file:line, the source line, `hint:` lines and the call trace, looks at rendered pages as images, points at places in the preview, and exports PDFs; you can select text in the preview and send it to the agent together with its source location.
|
|
6
|
+
|
|
7
|
+
The package ships built; nothing needs to be compiled at install time. It needs:
|
|
8
|
+
|
|
9
|
+
- Node.js 24+ and a DeepSeek Harness Web UI with the right docking sidebar;
|
|
10
|
+
- **Typst 0.12 or later** installed locally, for example `brew install typst` (macOS), `winget install --id Typst.Typst` (Windows), `cargo install --locked typst-cli`, or a release from <https://github.com/typst/typst/releases>.
|
|
11
|
+
|
|
12
|
+
The plugin looks for `typst` in this order: the path configured in the plugin settings → PATH → common install locations (Homebrew, Cargo, `~/.local/bin`, Nix, Snap, WinGet, Scoop) → your login shell (for version managers such as mise or asdf). If Typst lives somewhere else, set **Typst path** in the plugin settings.
|
|
13
|
+
|
|
14
|
+
## Use
|
|
15
|
+
|
|
16
|
+
Install and enable `dsh-typst-plugin`, then ask for example:
|
|
17
|
+
|
|
18
|
+
- "Start a two-column paper in Typst with a title block and an abstract."
|
|
19
|
+
- "Fix the errors in my thesis and show me what changed."
|
|
20
|
+
- "The table on page 3 overflows — make it fit."
|
|
21
|
+
- "Export `paper.pdf` as PDF/A-2b."
|
|
22
|
+
|
|
23
|
+
You can also open the **Typst** panel from the sidebar's "+" menu or the guide page.
|
|
24
|
+
|
|
25
|
+
### Panel
|
|
26
|
+
|
|
27
|
+
- **Live preview** of the main file. Each save recompiles incrementally with `typst watch` and the visible page is redrawn in place — no flicker. Zoom (fit width, fit page, or a percentage) and a page box.
|
|
28
|
+
- **Main file**: choose it explicitly using Preview main file, search indexed files or enter a relative path. The complete index can include hidden and build directories. Switching recompiles and the choice is remembered per workspace.
|
|
29
|
+
- **Status and problems**: compile phase, duration and diagnostic counts. Failures label the retained successful preview. The bottom Problems pane supports filtering, selection, source opening and repair review.
|
|
30
|
+
- **Text and region feedback**: selected text can be appended to the existing main composer draft. Ask opens an editable request with optional source candidates and explicit submission. Region feedback supports real screenshots, multiple pages, review, removal and retry.
|
|
31
|
+
- **Agent annotations**: location requests notify before navigation, with back and forward history. Full quotes and comments remain available, including stale annotations.
|
|
32
|
+
- **Setup**: detected facts, searched directories and platform-specific commands. Review setup requests before submitting; manual recheck and restart remain available.
|
|
33
|
+
|
|
34
|
+
### Tools
|
|
35
|
+
|
|
36
|
+
| Tool | Purpose |
|
|
37
|
+
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
|
38
|
+
| `typst_status` | Typst version and path, main file, other `.typ` files, latest compile result |
|
|
39
|
+
| `typst_set_main` | Choose the main `.typ` file (remembered per workspace) |
|
|
40
|
+
| `typst_check` | Wait until every saved change has compiled, then report errors and warnings with location, source line, hints and trace |
|
|
41
|
+
| `typst_render_pages` | Render up to 4 pages to PNG images for the agent to look at |
|
|
42
|
+
| `typst_show` | Request a page location, or highlight rendered text or source lines, with a comment |
|
|
43
|
+
| `typst_clear_highlights` | Remove agent highlights |
|
|
44
|
+
| `typst_export_pdf` | Compile a PDF into the workspace (optional PDF standard and page selection) |
|
|
45
|
+
|
|
46
|
+
The `typst` skill (model-invocable) teaches the agent the full loop: `typst_status` first, `typst_check` right after editing, `typst_render_pages` for layout, `typst_show` to point at things.
|
|
47
|
+
|
|
48
|
+
### Permissions, privacy and network
|
|
49
|
+
|
|
50
|
+
- The plugin runs your `typst` with the workspace as the working directory, exactly as you would in a terminal.
|
|
51
|
+
- The plugin never edits `.typ` files; only `typst_export_pdf` writes into the workspace, and only inside it. The preview PDF and rendered images live in the plugin's private cache directory (`~/.dsh/cache/typst`).
|
|
52
|
+
- The plugin itself makes no network requests; Typst downloads `@preview` packages on first use, as it does in a terminal.
|
|
53
|
+
|
|
54
|
+
## Documentation
|
|
55
|
+
|
|
56
|
+
### Usage
|
|
57
|
+
|
|
58
|
+
| Document | Content |
|
|
59
|
+
| --------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
60
|
+
| [Getting started](docs/getting-started.en.md) | Installation, prerequisites and the first task |
|
|
61
|
+
| [Product model](docs/product-model.en.md) | How the workbench, the panel and the agent tools divide the work, and the system's boundaries |
|
|
62
|
+
| [Features](docs/features.en.md) | Live preview, the bottom Problems pane, selection-to-source, agent highlights and export |
|
|
63
|
+
| [Troubleshooting](docs/troubleshooting.en.md) | Common symptoms, likely causes and what to do about them |
|
|
64
|
+
|
|
65
|
+
### Maintenance
|
|
66
|
+
|
|
67
|
+
| Document | Content |
|
|
68
|
+
| --------------------------------------------------- | ----------------------------------------------------------------------------- |
|
|
69
|
+
| [Architecture](docs/architecture.en.md) | Layer responsibilities, data flow, processes and lifecycle |
|
|
70
|
+
| [Tool reference](docs/tools.en.md) | The parameters and error codes of the 7 tools and of the panel's wire methods |
|
|
71
|
+
| [Configuration reference](docs/configuration.en.md) | Settings fields, the lookup order and the hot-reload behaviour |
|
|
72
|
+
| [Development guide](docs/development.en.md) | Build, debug, test and release |
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
npm install # also builds lib/ through prepare
|
|
78
|
+
npm test # the test-lint guards + the full suite (including the session integration against a simulated typst CLI)
|
|
79
|
+
npm run typecheck # harness pin + node/test/client tsc
|
|
80
|
+
npm run release:check
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Developed as a sibling checkout of `../deepseek-harness`: mount a local harness with `dev.cordis.yml.example`, and run `npm run link:local-harness` when the sibling is ahead of the registry. See [AGENTS.md](AGENTS.md).
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT — see [LICENSE](LICENSE).
|
package/README.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-typst
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](README.en.md) · 简体中文
|
|
4
|
+
|
|
5
|
+
DeepSeek Harness 的 Typst 插件:Agent 撰写、修复 Typst 文档时,右侧边栏实时排版预览——由**你本机的 Typst**驱动(你的字体、你下载的包、你的 Typst 版本),预览与终端里 `typst compile` 的结果一致。文件一保存(无论你改还是 Agent 改),预览即刻增量重编译、原地重绘,不闪烁、不丢位置。Agent 能读到带 `file:line`、源码行、`hint:` 与调用链的错误,把渲染页面当图看,在预览里为你标出位置,导出 PDF;你在预览中选中文字,可以连同对应源码位置一起发给 Agent。
|
|
6
|
+
|
|
7
|
+
安装包内含编译产物,无需构建。需要:
|
|
8
|
+
|
|
9
|
+
- Node.js 24+,以及一个带右侧停靠栏的 DeepSeek Harness Web 界面;
|
|
10
|
+
- 本机安装 **Typst 0.12 或更高**,例如 `brew install typst`(macOS)、`winget install --id Typst.Typst`(Windows)、`cargo install --locked typst-cli`,或从 <https://github.com/typst/typst/releases> 下载。
|
|
11
|
+
|
|
12
|
+
插件按顺序查找 `typst`:插件设置中的路径 → PATH → 常见安装位置(Homebrew、Cargo、`~/.local/bin`、Nix、Snap、WinGet、Scoop)→ 登录 shell(mise/asdf 等版本管理器)。装在别处时,在插件设置 **Typst 路径** 中填写完整路径。
|
|
13
|
+
|
|
14
|
+
## 使用
|
|
15
|
+
|
|
16
|
+
安装并启用 `dsh-typst-plugin` 后,可以试着让 Agent:
|
|
17
|
+
|
|
18
|
+
- "用 Typst 起一篇双栏论文,带标题块和摘要。"
|
|
19
|
+
- "修复我论文里的错误,然后告诉我改了什么。"
|
|
20
|
+
- "第 3 页的表格溢出了——让它排进去。"
|
|
21
|
+
- "把 `paper.pdf` 导出成 PDF/A-2b。"
|
|
22
|
+
|
|
23
|
+
也可以从右侧栏"+"菜单或引导页打开 **Typst** 面板。
|
|
24
|
+
|
|
25
|
+
### 面板
|
|
26
|
+
|
|
27
|
+
- **实时预览**主文件。每次保存经 `typst watch` 增量重编译,可见页面原地重绘——不闪烁,滚动位置不动。缩放(适宽、适页、百分比)、页码框。
|
|
28
|
+
- **主文件**:点击“预览主文件”主动选择,支持搜索、直接输入相对路径及包含隐藏目录的完整索引。切换会重新编译,选择按工作区记忆。
|
|
29
|
+
- **状态与问题**:显示编译阶段、耗时及诊断数量。失败时标记并保留上次成功预览;底部问题辅助区可筛选、选择、打开源码并审阅修复请求。
|
|
30
|
+
- **文字与区域反馈**:选中文字后可追加到主输入框现有草稿;询问先进入可编辑请求,可核对源码候选后明确提交。框选可截取真实页面图片,支持多页区域、审阅、移除和失败重试。
|
|
31
|
+
- **Agent 标注**:位置请求先通知,点击后导航,可返回原阅读位置;标注展示完整引文和备注,无法重新定位时保留过期状态。
|
|
32
|
+
- **安装引导**:显示检测事实、查找目录和对应平台的命令。安装请求先审阅再提交;手动检查和重启始终可用。
|
|
33
|
+
|
|
34
|
+
### 工具
|
|
35
|
+
|
|
36
|
+
| 工具 | 用途 |
|
|
37
|
+
| ------------------------ | --------------------------------------------------------------------- |
|
|
38
|
+
| `typst_status` | Typst 版本与路径、主文件、其余 `.typ` 文件、最近一次编译结果 |
|
|
39
|
+
| `typst_set_main` | 选择主 `.typ` 文件(按工作区记忆) |
|
|
40
|
+
| `typst_check` | 等到已保存的改动全部编译完,再报错误与警告(位置、源码行、hint、调用链) |
|
|
41
|
+
| `typst_render_pages` | 把至多 4 页渲染成 PNG 供 Agent 看排版 |
|
|
42
|
+
| `typst_show` | 请求查看预览某页,或高亮渲染文本/源码行,带备注 |
|
|
43
|
+
| `typst_clear_highlights` | 移除 Agent 高亮 |
|
|
44
|
+
| `typst_export_pdf` | 编译 PDF 写入工作区(可选 PDF 标准、页选择) |
|
|
45
|
+
|
|
46
|
+
技能 `typst`(模型可调用)教 Agent 完整的工作流:先 `typst_status` 定向,编辑后立即 `typst_check`,布局问题 `typst_render_pages` 看图,`typst_show` 指给用户。
|
|
47
|
+
|
|
48
|
+
### 权限、隐私与网络
|
|
49
|
+
|
|
50
|
+
- 插件以工作区为工作目录运行你的 `typst`,与你在终端里手动运行一致。
|
|
51
|
+
- 插件从不编辑 `.typ` 文件;只有 `typst_export_pdf` 会写工作区,且仅限工作区内。预览 PDF 与渲染图存放在插件私有缓存目录(`~/.dsh/cache/typst`)。
|
|
52
|
+
- 插件自身不联网;Typst 首次使用 `@preview` 包时会自行下载,与终端一致。
|
|
53
|
+
|
|
54
|
+
## 文档
|
|
55
|
+
|
|
56
|
+
### 使用
|
|
57
|
+
|
|
58
|
+
| 文档 | 内容 |
|
|
59
|
+
| ----------------------------------- | ---------------------------------------------------- |
|
|
60
|
+
| [快速入门](docs/getting-started.md) | 安装、前置条件与第一个任务 |
|
|
61
|
+
| [产品模型](docs/product-model.md) | 工作台、面板与 Agent 工具的分工,以及系统边界 |
|
|
62
|
+
| [功能概览](docs/features.md) | 实时预览、底部问题辅助区、选中定位、Agent 高亮与导出 |
|
|
63
|
+
| [故障排查](docs/troubleshooting.md) | 常见现象、可能原因与处理方式 |
|
|
64
|
+
|
|
65
|
+
### 维护
|
|
66
|
+
|
|
67
|
+
| 文档 | 内容 |
|
|
68
|
+
| --------------------------------- | -------------------------------------- |
|
|
69
|
+
| [系统架构](docs/architecture.md) | 分层职责、数据流、进程与生命周期 |
|
|
70
|
+
| [工具参考](docs/tools.md) | 7 个工具与面板 wire 方法的参数与错误码 |
|
|
71
|
+
| [配置参考](docs/configuration.md) | 设置字段、查找顺序与热重载行为 |
|
|
72
|
+
| [开发指南](docs/development.md) | 构建、调试、测试与发布流程 |
|
|
73
|
+
|
|
74
|
+
## 开发
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
npm install # 同时通过 prepare 构建 lib/
|
|
78
|
+
npm test # 测试规范守卫 + 全部测试(含对模拟 typst CLI 的 session 集成)
|
|
79
|
+
npm run typecheck # harness 引脚 + node/test/client 三套 tsc
|
|
80
|
+
npm run release:check
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
以兄弟目录 `../deepseek-harness` 开发时,用 `dev.cordis.yml.example` 挂本地 harness;`npm run link:local-harness` 在 sibling 领先于 registry 时同步声明。详见 [AGENTS.md](AGENTS.md)。
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT — 见 [LICENSE](LICENSE)。
|
package/cordis.patch.yml
ADDED
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
- **Core** (`dsh-typst`): local Typst discovery, watch lifecycle, exact snapshots, seven agent tools and the typst skill.
|
|
2
|
+
- **Preview panel**: explicit main-file selection, continuous or single-page reading, responsive zoom, and bottom Outline, Problems and Annotations views. Append text to the main composer; review text or screenshot requests before submission. Agent locations notify first; state and drafts follow each tab.
|