dsh-visio 0.0.0-stage → 1.24.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SamyiHu
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,149 @@
1
+ # dsh-visio
2
+
3
+ [![CI](https://github.com/SamyiHu/dsh-visio/actions/workflows/ci.yml/badge.svg)](https://github.com/SamyiHu/dsh-visio/actions/workflows/ci.yml)
4
+
5
+ A native **Visio (.vsdx) viewer and editor for the DeepSeek Harness (DSH) Web UI**, with a
6
+ live preview, shape editing and a `visio` agent tool. The core engine is Python standard
7
+ library, with no Visio install and no Office dependency; PNG export, `snapshot` and stencil
8
+ previews additionally need [Pillow](https://pillow.readthedocs.io/) (`engine/vsdx_png.py`,
9
+ `engine/svg_raster.py`).
10
+
11
+ English · [简体中文](README.md)
12
+
13
+ ![status](https://img.shields.io/badge/status-beta-yellow)
14
+ ![license](https://img.shields.io/badge/license-MIT-blue)
15
+ ![engine](https://img.shields.io/badge/engine-python--stdlib--%2B--Pillow--for--PNG-green)
16
+
17
+
18
+ ## Screenshots
19
+
20
+ | Panel | Shape selected (editable) |
21
+ |---|---|
22
+ | ![panel](docs/panel-showcase.png) | ![shape editor](docs/editor-shape.png) |
23
+
24
+ Select a connector to change its end directions and line style:
25
+
26
+ ![connector editor](docs/editor-connector.png)
27
+
28
+ ## Showcase
29
+
30
+ | Sample | What it shows | Languages |
31
+ |---|---|---|
32
+ | [Global order fulfilment](examples/showcase/showcase-1-global-fulfilment.vsdx) | 4 swimlanes / 15 nodes / 3 gates / 3 rework loops | zh · en · ja |
33
+ | [Platform architecture](examples/showcase/showcase-2-platform-architecture.vsdx) | Edge / service / data layers plus external systems | zh · en · ru |
34
+
35
+ ![global fulfilment](examples/showcase/showcase-1-global-fulfilment.png)
36
+
37
+ ![platform architecture](examples/showcase/showcase-2-platform-architecture.png)
38
+
39
+ ## Features
40
+
41
+ - **Live preview** – the panel renders the `.vsdx` page to SVG and repaints after every edit.
42
+ - **Edit in place** – move / resize, text, fill, line, per-run text colour, shape data.
43
+ - **Shape library** – 16 built-in kinds (process, decision, terminator, …) plus
44
+ `.vssx`/`.vstx` stencil import; drawn from real Visio masters, not stacked lines.
45
+ - **Connectors** – add, label, delete; connectors keep their own line colour, weight and
46
+ arrow heads, and their labels are read from the 1-D shape text.
47
+ - **Relationship audit** – `validate` finds empty links (connectors with no `Connect` rows),
48
+ dangling ids, floating endpoints and zero-size shapes.
49
+ - **Multi-page, zoom, pan, grid, undo/redo**, external-change detection.
50
+ - **Agent tool** – the same operations are exposed to the model as a `visio` tool, including
51
+ stencil discovery (`stencil_info`, `stencil_sheet`), whole-drawing snapshots (`snapshot`)
52
+ and a self-describing `capabilities` action.
53
+
54
+ ## Install
55
+
56
+ **From the plugin market (recommended):** open Settings → Plugins in DSH, search `dsh-visio`, install. Or:
57
+
58
+ ```bash
59
+ dsh plugin --profile desktop add dsh-visio
60
+ ```
61
+
62
+ > No npm release yet? Install straight from GitHub:
63
+ > ```bash
64
+ > dsh plugin --profile desktop add github:SamyiHu/dsh-visio
65
+ > ```
66
+
67
+ **Local development:** add `"dsh-visio": "link:/absolute/path/to/dsh-visio"` to the profile
68
+ `package.json`, run `pnpm install`, then reload the app. The bundle patch
69
+ `cordis.patch.yml` inserts the plugin automatically.
70
+
71
+ Requires Python 3.9+ on `PATH` (or set `pythonPath` in the plugin config / `DSH_VISIO_PYTHON`). For PNG export / snapshots / stencil previews, install Pillow for that interpreter: `python -m pip install Pillow`.
72
+
73
+ ## Usage
74
+
75
+ - Sidebar → **Visio 图纸** opens the panel; the floating canvas button opens the same
76
+ drawing in a draggable window.
77
+ - Pick a folder, click a `.vsdx`; the left tree lists pages and shapes, the right pane edits
78
+ the selection.
79
+ - From the agent side: ask for a drawing and the model calls the `visio` tool
80
+ (`open`, `text`, `get_shape`, `list`, `create`, `add_shape`, `move`, `set_text`, `set_cell`,
81
+ `set_prop`, `connect`, `delete`, `validate`, `kinds`, `stencils`, `stencil_info`,
82
+ `stencil_sheet`, `stencil_add`, `snapshot`, `capabilities`, `undo`, `redo`, `normalize`,
83
+ `export`). `examples/basic-shapes.vssx` is a three-master stencil used by the tests.
84
+
85
+ ## Configuration
86
+
87
+ | key | default | meaning |
88
+ |---|---|---|
89
+ | `pythonPath` | `python` | interpreter used for the engine |
90
+ | `defaultFolder` | workspace dir | where the file browser starts |
91
+
92
+ ## Compatibility
93
+
94
+ | component | requirement | notes |
95
+ |---|---|---|
96
+ | Node.js | **>= 18** | Host half `index.js` uses ESM, `node:` imports and `import.meta.url`; CI runs on Node 20 |
97
+ | Python | **>= 3.9** | Engine interpreter: `python` on Windows, `python3` elsewhere; override with `pythonPath` / `DSH_VISIO_PYTHON`. CI runs on 3.12 |
98
+ | Pillow | optional | Only PNG export, `snapshot` and stencil previews need it; core read/write and SVG rendering are stdlib |
99
+ | DSH host | `>=0.1.7-rc.2` (`dsh.engines.dsh`); **guaranteed on `0.2.2-rc.1`** | desktop profile / Web UI plugin. The build it was first developed against (2026-10-28 first commit) works, but its exact version was not recorded; some earlier builds may work and are not guaranteed. `peerDependencies["@deepseek-ai/dsh"]` lists each prerelease branch explicitly so semver does not silently exclude prereleases |
100
+
101
+ Machine-readable declarations live in `package.json`: `engines.node`, `dsh.engines.dsh` (informational; pnpm only WARNs by default) and `peerDependencies["@deepseek-ai/dsh"]` (the range npm/pnpm actually validates). Python / Pillow are runtime prerequisites of the plugin itself, see above.
102
+
103
+ ## Architecture
104
+
105
+ ```
106
+ index.js Host half: `visio` tool + same-origin routes, bridge pool
107
+ client.js Client half: panel, floating window, inspector, i18n
108
+ engine/vsdx_core.py Reader/editor/renderer (OPC + XML, stdlib only; PNG paths use Pillow)
109
+ engine/visio_bridge.py JSON line protocol used by the Host
110
+ engine/blank_doc.py Creates a minimal valid .vsdx from scratch
111
+ engine/kinds.py 16 built-in shape kinds (real master geometry)
112
+ engine/stencil.py .vssx/.vstx import
113
+ tests/ engine, client-render, client-contract, host-contract
114
+ ```
115
+
116
+ The Host keeps one engine child process per interpreter and **restarts it when any
117
+ `engine/*.py` file changes** (mtime + size fingerprint), so edits never run on stale code.
118
+
119
+ ## Development
120
+
121
+ ```bash
122
+ python tests/test_engine.py # 15 engine cases (edit, connectors, stencils, snapshots)
123
+ node tests/test_client_render.mjs # renders panel/inspector/dialog headlessly
124
+ node tests/test_client_contract.mjs # i18n keys + slot contract
125
+ node tests/test_host_contract.mjs # tool schema + routes + bridge round trip
126
+ node tests/make_uicheck.mjs # inspector layout page, measurable in a real browser
127
+ ```
128
+
129
+ ## Limitations
130
+
131
+ - SVG preview approximates Visio typography (line breaking by width estimate).
132
+ - Themes/masters are honoured for geometry and colour, not for every style inheritance rule.
133
+ - `.vsdm` macros are not executed.
134
+
135
+ ## Licence
136
+
137
+ MIT — see [LICENSE](LICENSE). No third-party fixtures are bundled; tests build their own documents.
138
+
139
+ ## CI
140
+
141
+ `.github/workflows/ci.yml` runs on every push/PR across Linux and Windows:
142
+
143
+ - `node --check` on both halves, `py_compile` on the engine
144
+ - `tests/test_engine.py` (15 cases: edit, connectors, stencils, snapshots)
145
+ - `tests/test_client_render.mjs` and `tests/test_client_contract.mjs` (slots + 94 translations)
146
+ - `tests/test_host_contract.mjs` (tool schema, routes, bridge round trip)
147
+
148
+ `release.yml` publishes a zip on every `v*` tag, after the same test suite, and refuses a tag
149
+ that does not match `package.json` version.
package/README.md CHANGED
@@ -1,3 +1,129 @@
1
- # Temporary Holding Version
1
+ # dsh-visio
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/SamyiHu/dsh-visio/actions/workflows/ci.yml/badge.svg)](https://github.com/SamyiHu/dsh-visio/actions/workflows/ci.yml)
4
+
5
+ **在 DeepSeek Harness(DSH)Web 界面里直接看和改 Visio 图纸(.vsdx)的插件**:实时预览、形状编辑,外加一个给 Agent 用的 `visio` 工具。
6
+
7
+ 引擎主体(.vsdx 读写、渲染、编辑)只用 Python 标准库,**不需要装 Visio,也不依赖 Office**;PNG 导出、`snapshot` 快照和模具预览图额外需要 [Pillow](https://pillow.readthedocs.io/)(`engine/vsdx_png.py`、`engine/svg_raster.py`)。
8
+
9
+ [English](README.en.md) · 简体中文
10
+
11
+ ![status](https://img.shields.io/badge/status-beta-yellow)
12
+ ![license](https://img.shields.io/badge/license-MIT-blue)
13
+ ![engine](https://img.shields.io/badge/engine-python--stdlib--%2B--Pillow--for--PNG-green)
14
+
15
+ ## 截图
16
+
17
+ | 面板 | 选中形状(可编辑) |
18
+ |---|---|
19
+ | ![面板](docs/panel-showcase.png) | ![编辑形状](docs/editor-shape.png) |
20
+
21
+ 选中连接线后,可调起点/终点方向与线型:
22
+
23
+ ![编辑连接线](docs/editor-connector.png)
24
+
25
+ ## 展示案例
26
+
27
+ | 案例 | 内容 | 语言 |
28
+ |---|---|---|
29
+ | [全球订单履约](examples/showcase/showcase-1-global-fulfilment.vsdx) | 4 泳道 / 15 节点 / 3 决策门 / 3 条退回线 | 中 · 英 · 日 |
30
+ | [平台逻辑架构](examples/showcase/showcase-2-platform-architecture.vsdx) | 接入/服务/数据三层容器 + 外部系统 | 中 · 英 · 俄 |
31
+
32
+ ![全球订单履约](examples/showcase/showcase-1-global-fulfilment.png)
33
+
34
+ ![平台逻辑架构](examples/showcase/showcase-2-platform-architecture.png)
35
+
36
+ ## 功能
37
+
38
+ - **实时预览**:面板把 `.vsdx` 页面渲染成 SVG,每次改动后立即重绘。
39
+ - **就地编辑**:移动/缩放、文字、填充、线条、逐行文字颜色、形状数据。
40
+ - **形状库**:内置 16 种图形(流程、判定、起止……),支持导入 `.vssx` / `.vstx` 模具;图形用真实 Visio 母版几何绘制,不是几条线拼出来的。
41
+ - **连接线**:新增、加标签、删除;线自己的颜色/线宽/箭头都保留,标签从 1-D 形状的文字里读。
42
+ - **关系检查**:`validate` 能找出空连接(没有 `Connect` 行的线)、悬空 ID、漂移端点、零尺寸形状。
43
+ - **多页、缩放、平移、网格、撤销/重做**,以及文件被外部修改时的自动检测。
44
+ - **Agent 工具**:同一套能力以 `visio` 工具暴露给模型,含模具发现(`stencil_info`、`stencil_sheet`)、整图快照(`snapshot`)和自描述的 `capabilities`。
45
+
46
+ ## 安装
47
+
48
+ **从插件市场安装(推荐)**:DSH 里打开 Settings → Plugins,搜 `dsh-visio` 点安装;或命令行:
49
+
50
+ ```bash
51
+ dsh plugin --profile desktop add dsh-visio
52
+ ```
53
+
54
+ > 还没有 npm 包时,可直接从 GitHub 源安装:
55
+ > ```bash
56
+ > dsh plugin --profile desktop add github:SamyiHu/dsh-visio
57
+ > ```
58
+
59
+ **本地开发**:在 profile 的 `package.json` 里加 `"dsh-visio": "link:/absolute/path/to/dsh-visio"`,执行 `pnpm install`,再重载应用。插件自带 `cordis.patch.yml`,会自动插入。
60
+
61
+ 需要 `PATH` 里有 Python 3.9+(或在插件配置里设 `pythonPath`,或设环境变量 `DSH_VISIO_PYTHON`);若要用 PNG 导出 / 快照 / 模具预览,还需为该解释器安装 Pillow:`python -m pip install Pillow`。
62
+
63
+ ## 使用
64
+
65
+ - 侧栏 → **Visio 图纸** 打开面板;浮动画布按钮可以把同一张图放进可拖动的独立窗口。
66
+ - 选目录 → 点一个 `.vsdx`:左边树列页面和形状,右边改选中形状的属性。
67
+ - Agent 侧直接说需求即可,模型会调 `visio` 工具:
68
+ `open`、`text`、`get_shape`、`list`、`create`、`add_shape`、`move`、`set_text`、`set_cell`、
69
+ `set_prop`、`connect`、`delete`、`validate`、`kinds`、`stencils`、`stencil_info`、
70
+ `stencil_sheet`、`stencil_add`、`snapshot`、`capabilities`、`undo`、`redo`、`normalize`、`export`。
71
+ `examples/basic-shapes.vssx` 是测试用的三母版模具。
72
+
73
+ ## 配置
74
+
75
+ | 键 | 默认值 | 含义 |
76
+ |---|---|---|
77
+ | `pythonPath` | `python` | 引擎使用的解释器 |
78
+ | `defaultFolder` | 工作目录 | 文件浏览器起始目录 |
79
+
80
+ ## 兼容性
81
+
82
+ | 组件 | 要求 | 说明 |
83
+ |---|---|---|
84
+ | Node.js | **≥ 18** | 宿主半 `index.js` 用 ESM + `node:` 前缀导入 + `import.meta.url`;CI 在 Node 20 上跑 |
85
+ | Python | **≥ 3.9** | 引擎解释器,默认 Windows 用 `python`、其他系统用 `python3`;可用 `pythonPath` / `DSH_VISIO_PYTHON` 指定。CI 在 3.12 上跑 |
86
+ | Pillow | 可选 | 仅 PNG 导出、`snapshot`、模具预览需要;核心读写与 SVG 渲染是标准库 |
87
+ | DSH 宿主 | `>=0.1.7-rc.2`(`dsh.engines.dsh`);**保证 `0.2.2-rc.1`** | desktop profile / Web UI 插件。初制作期(2026-10-28 首版)的版本可用但仓库未记录确切号;更早的部分 0.2.x 之前版本可能可用、不保证。`peerDependencies["@deepseek-ai/dsh"]` 显式列出各预发布分支,避免 semver 静默排除 prerelease |
88
+
89
+ 机器可读声明在 `package.json`:`engines.node`、`dsh.engines.dsh`(声明性,pnpm 默认只 WARN)与 `peerDependencies["@deepseek-ai/dsh"]`(npm/pnpm 真正校验的范围)。Python / Pillow 为插件自身运行前置,见上表。
90
+
91
+ ## 结构
92
+
93
+ ```
94
+ index.js Host 侧:`visio` 工具 + 同源路由、引擎进程池
95
+ client.js Client 侧:面板、浮窗、属性检查器、i18n
96
+ engine/vsdx_core.py 读写渲染核心(OPC + XML,纯标准库)
97
+ engine/visio_bridge.py Host 调用的 JSON 行协议
98
+ engine/blank_doc.py 从零生成最小可用 .vsdx
99
+ engine/kinds.py 16 种内置图形(真实母版几何)
100
+ engine/stencil.py .vssx/.vstx 导入
101
+ tests/ 引擎、客户端渲染、客户端契约、Host 契约
102
+ ```
103
+
104
+ Host 按解释器各留一个引擎子进程,并**在任意 `engine/*.py` 变化时重启**(mtime + size 指纹),避免改完还跑旧代码。
105
+
106
+ ## 开发与测试
107
+
108
+ ```bash
109
+ python tests/test_engine.py # 15 例:编辑、连线、模具、快照
110
+ node tests/test_client_render.mjs # 无头渲染面板/检查器/新建对话框
111
+ node tests/test_client_contract.mjs # 翻译键 + 槽位契约
112
+ node tests/test_host_contract.mjs # 工具 schema + 路由 + 桥往返
113
+ node tests/make_uicheck.mjs # 生成右栏布局页,可在真浏览器里量尺寸
114
+ ```
115
+
116
+ ## 已知限制
117
+
118
+ - SVG 预览对排版是近似(按宽度估算换行),和 Visio 不保证逐像素一致。
119
+ - 主题/母版对几何和颜色的处理是有的,但不是每条样式继承规则都实现。
120
+ - `.vsdm` 宏不执行。
121
+
122
+ ## CI / CD
123
+
124
+ - `ci.yml`:push/PR 在 **Linux + Windows** 双矩阵跑语法检查、引擎 15 例、客户端契约、Host 契约,通过后产出整包 zip 附件。
125
+ - `release.yml`:打 `v*` tag 自动发 Release;**tag 与 `package.json` 版本不一致直接失败**。
126
+
127
+ ## 许可
128
+
129
+ MIT,见 [LICENSE](LICENSE)。仓库不含第三方样例文件,测试自己生成文档。