@zseven-w/qoder-openpencil 0.0.0-stage → 0.1.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/INSTALL.md +77 -0
- package/LICENSE +21 -0
- package/NOTICE +10 -0
- package/README.md +46 -2
- package/README.zh.md +38 -0
- package/THIRD_PARTY_NOTICES.md +69 -0
- package/bin/qoder-openpencil.mjs +90 -0
- package/package.json +71 -4
- package/platforms.json +65 -0
- package/plugins/openpencil/.mcp.json +10 -0
- package/plugins/openpencil/.qoder-plugin/plugin.json +19 -0
- package/plugins/openpencil/CONNECTORS.md +9 -0
- package/plugins/openpencil/LICENSE +21 -0
- package/plugins/openpencil/NOTICE +10 -0
- package/plugins/openpencil/assets/icon.png +0 -0
- package/plugins/openpencil/assets/logo.png +0 -0
- package/plugins/openpencil/mcp.json +11 -0
- package/plugins/openpencil/plugin.json +19 -0
- package/plugins/openpencil/scripts/browser-launch.mjs +37 -0
- package/plugins/openpencil/scripts/canvas-codegen.mjs +141 -0
- package/plugins/openpencil/scripts/canvas-controller.mjs +293 -0
- package/plugins/openpencil/scripts/canvas-images.mjs +93 -0
- package/plugins/openpencil/scripts/canvas-panel.mjs +82 -0
- package/plugins/openpencil/scripts/canvas-selection.mjs +61 -0
- package/plugins/openpencil/scripts/document-format.mjs +48 -0
- package/plugins/openpencil/scripts/editor-runtime.mjs +453 -0
- package/plugins/openpencil/scripts/editor-session.mjs +230 -0
- package/plugins/openpencil/scripts/launch-mcp +22 -0
- package/plugins/openpencil/scripts/launch-mcp.cmd +21 -0
- package/plugins/openpencil/scripts/mcp-bridge.mjs +70 -0
- package/plugins/openpencil/scripts/runtime-install.mjs +128 -0
- package/plugins/openpencil/scripts/transport.mjs +138 -0
- package/plugins/openpencil/skills/openpencil-design/SKILL.md +125 -0
- package/plugins/openpencil/skills/openpencil-design/references/codegen.md +34 -0
- package/plugins/openpencil/skills/openpencil-design/references/images.md +54 -0
- package/plugins/openpencil/skills/openpencil-design/references/node-schema.md +208 -0
- package/plugins/openpencil/skills/openpencil-setup/SKILL.md +59 -0
- package/plugins/openpencil/ui/app.html +226 -0
- package/plugins/openpencil/ui/codegen.js +80 -0
- package/plugins/openpencil/ui/panel.css +311 -0
- package/plugins/openpencil/ui/panel.html +11 -0
- package/plugins/openpencil/ui/panel.js +219 -0
- package/plugins/openpencil/ui/selection.js +19 -0
- package/scripts/build-editor-runtime.mjs +35 -0
- package/scripts/canvas.mjs +75 -0
- package/scripts/check-package.mjs +81 -0
- package/scripts/check-release-version.mjs +53 -0
- package/scripts/collab-bootstrap-config.mjs +66 -0
- package/scripts/configure-runtime.mjs +15 -0
- package/scripts/host-config.mjs +352 -0
- package/scripts/managed-handshake.mjs +23 -0
- package/scripts/node-registration.mjs +17 -0
- package/scripts/pack-package.mjs +41 -0
- package/scripts/pack-plugin.mjs +166 -0
- package/scripts/platforms.mjs +84 -0
- package/scripts/plugin-host-check.mjs +174 -0
- package/scripts/publish-release.mjs +294 -0
- package/scripts/registry-convergence.mjs +40 -0
- package/scripts/setup.mjs +147 -0
- package/scripts/stage-editor-runtime.mjs +189 -0
- package/scripts/sync-platform-versions.mjs +63 -0
- package/scripts/verify-platform-packages.mjs +270 -0
- package/scripts/verify-selective-install.mjs +219 -0
package/INSTALL.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Install OpenPencil Plugin for Qoder
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
- **Node.js 22+**
|
|
6
|
+
- **Qoder Desktop (`Qoder.app` on macOS / Windows)**, Qoder CN, or Qoder IDE / CLI
|
|
7
|
+
- No Rust toolchain or standalone OpenPencil desktop app is required when installing `@zseven-w/qoder-openpencil` from npm (its matching platform optional package carries `op-host-web-server`, WASM, and CanvasKit).
|
|
8
|
+
|
|
9
|
+
## Install from npm
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install -g @zseven-w/qoder-openpencil
|
|
13
|
+
qoder-openpencil setup
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Install from a monorepo checkout
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
git clone https://github.com/ZSeven-W/openpencil.git
|
|
20
|
+
cd openpencil/packages/op-qoder
|
|
21
|
+
npm run build:editor-runtime && npm run stage:editor-runtime
|
|
22
|
+
# Or point at an existing verified runtime root:
|
|
23
|
+
# npm run configure-runtime -- /absolute/path/to/runtime
|
|
24
|
+
npm run setup
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Supported Qoder Installation Flows
|
|
28
|
+
|
|
29
|
+
### Method 1: CLI `setup` — Canonical Qoder Plugin Install (Recommended)
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
qoder-openpencil setup
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`setup` performs all of the following safely:
|
|
36
|
+
1. Resolves and SHA-256 verifies the atomic Rust OpenPencil editor runtime (`op-host-web-server` + `web-bundle` + `canvaskit`).
|
|
37
|
+
2. Runs an isolated live verification: loads the local panel, performs a native `update_node` edit, saves to `.op`, and reopens the file.
|
|
38
|
+
3. Privately records your Node 22+ executable path in `~/.qoder-openpencil/node-path` so Qoder's GUI process works even when its `PATH` omits nvm/fnm/volta/Homebrew.
|
|
39
|
+
4. Copies the plugin into Qoder's canonical versioned local cache (`<QODER_CONFIG_DIR>/plugins/cache/local/openpencil/<version>/`), atomically registers `openpencil@local` in `plugins/installed_plugins_v2.json`, and enables `enabledPlugins["openpencil@local"] = true` in `settings.json` (respecting `QODER_CONFIG_DIR`, `QODERCN_CONFIG_DIR`, `QODER_CLI_HOME`, `~/.qoder`, `~/.qoder-cn`).
|
|
40
|
+
5. Runs `host-check` under a stripped GUI `PATH` to verify MCP `initialize`, `tools/list` (`qoder/ui` `global` + `thread` entrypoints), and the `ui://openpencil/canvas/...` MCP App resource.
|
|
41
|
+
|
|
42
|
+
Restart Qoder (or reload **Extensions → Installed**) to activate.
|
|
43
|
+
|
|
44
|
+
### Method 2: Import Local Plugin ZIP in Qoder Desktop
|
|
45
|
+
|
|
46
|
+
To import through Qoder Desktop's UI (or `qoder-settings.install_extension`):
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
qoder-openpencil pack-plugin --output ./openpencil-qoder-plugin.zip
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The generated ZIP places `.qoder-plugin/plugin.json` and `.mcp.json` directly at the ZIP root (per Qoder's archive specification). Import it in **Extensions → Import local plugin**.
|
|
53
|
+
|
|
54
|
+
### Method 3: Qoder IDE / CLI `settings.json` `mcpServers` Mode
|
|
55
|
+
|
|
56
|
+
If you prefer standalone `mcpServers` + `skills/` instead of the plugin cache:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
qoder-openpencil setup --mcp-settings
|
|
60
|
+
# Or print JSON to paste manually:
|
|
61
|
+
qoder-openpencil print-config
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Opening OpenPencil Canvas in Qoder Desktop
|
|
65
|
+
|
|
66
|
+
- **Global Fullscreen App**: Click **More → OpenPencil Canvas** at the bottom-left navigation bar.
|
|
67
|
+
- **Session Sidebar Tab**: Click **Open sidebar → + → Apps → OpenPencil Canvas** to keep the canvas side-by-side with chat.
|
|
68
|
+
- **In Chat**: Ask Qoder to design with OpenPencil (`open_canvas`).
|
|
69
|
+
|
|
70
|
+
## Diagnostics & Uninstall
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
qoder-openpencil host-check
|
|
74
|
+
qoder-openpencil doctor
|
|
75
|
+
qoder-openpencil canvas --file /absolute/path/design.op
|
|
76
|
+
qoder-openpencil uninstall
|
|
77
|
+
```
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ZSeven—W
|
|
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/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
The node and layout reference in plugins/openpencil/skills/openpencil-design/
|
|
2
|
+
references/node-schema.md is adapted from the MIT-licensed bundled design skill
|
|
3
|
+
in ZSeven-W/openpencil (crates/op-cli/assets/skill-bundle.json).
|
|
4
|
+
Copyright (c) 2026 ZSeven-W.
|
|
5
|
+
|
|
6
|
+
The managed editor protocol and structural image-reference visitor follow the
|
|
7
|
+
MIT-licensed Rust OpenPencil engine and OpenPencil connector packages by ZSeven-W.
|
|
8
|
+
The runtime is distributed separately via platform optional packages or a user-configured runtime root.
|
|
9
|
+
|
|
10
|
+
This is an independent OpenPencil plugin, not a Qoder-authored plugin.
|
package/README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Qoder OpenPencil Plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**OpenPencil plugin, native MCP Apps Rust canvas (Global + Session Sidebar tabs), and local MCP connector for Qoder (`@zseven-w/qoder-openpencil`).**
|
|
4
|
+
|
|
5
|
+
[English](./README.md) · [简体中文](./README.zh.md) · [Install Guide](./INSTALL.md) · [Architecture](./docs/architecture.md)
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Native Qoder MCP Apps (`2026-01-26` + `qoder/ui`)**:
|
|
10
|
+
- Declares `global` and `thread` entrypoints on `open_canvas`, so OpenPencil appears directly in Qoder's bottom-left **More** menu (fullscreen workspace tab) and each conversation's right-hand **+ → Apps** sidebar!
|
|
11
|
+
- Declares `_meta.ui.csp.frameDomains` for the local `127.0.0.1` panel origin (explicitly permitted by Qoder Desktop's CSP allowlist) and `availableDisplayModes: ["inline", "fullscreen"]` with `preferredDisplayMode: "fullscreen"`.
|
|
12
|
+
- Synchronizes light/dark theme, pushes selection context via `ui/update-model-context` (with `qoder/title` + `structuredContent`), and hands off Code panel requests via `ui/message`.
|
|
13
|
+
- **Canonical Qoder Plugin Registration & ZIP Import**:
|
|
14
|
+
- `qoder-openpencil setup` installs into `<QODER_CONFIG_DIR>/plugins/cache/local/openpencil/<version>/`, merges `plugins/installed_plugins_v2.json`, and enables `openpencil@local` in `settings.json` (auto-detecting `~/.qoder` and `~/.qoder-cn`).
|
|
15
|
+
- `qoder-openpencil pack-plugin` builds a zero-dependency ZIP with `.qoder-plugin/plugin.json` and `.mcp.json` (`${QODER_PLUGIN_ROOT}`) directly at the ZIP root for Qoder Desktop UI import or `qoder-settings.install_extension`.
|
|
16
|
+
- `qoder-openpencil setup --mcp-settings` / `print-config` also support Qoder IDE / CLI `settings.json` `mcpServers` setups.
|
|
17
|
+
- **Full Native Design Tools & Guarded Persistence**: Proxies all native Rust OpenPencil MCP tools into one serialized per-conversation session with recovery drafts under `~/.qoder-openpencil/sessions/` and SHA-256 verified saves.
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm install -g @zseven-w/qoder-openpencil
|
|
23
|
+
qoder-openpencil setup
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then restart Qoder (or reload **Extensions → Installed**) and open **More → OpenPencil Canvas** or **+ → Apps → OpenPencil Canvas**.
|
|
27
|
+
|
|
28
|
+
## CLI Commands
|
|
29
|
+
|
|
30
|
+
| Command | Purpose |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| `qoder-openpencil setup` | Verify runtime, install & enable `openpencil@local` in Qoder, run `host-check` |
|
|
33
|
+
| `qoder-openpencil pack-plugin [--output PATH]` | Build a Qoder local plugin `.zip` (`.qoder-plugin/plugin.json` at ZIP root) |
|
|
34
|
+
| `qoder-openpencil print-config` | Print copy-pasteable `mcpServers` JSON for Qoder IDE / CLI `settings.json` |
|
|
35
|
+
| `qoder-openpencil host-check` | Probe the registered launcher under a stripped GUI `PATH` |
|
|
36
|
+
| `qoder-openpencil canvas [--file PATH]` | Run the persistent terminal canvas |
|
|
37
|
+
| `qoder-openpencil doctor [--port PORT]` | Check a running OpenPencil desktop MCP server |
|
|
38
|
+
| `qoder-openpencil uninstall` | Cleanly remove `openpencil@local`, `mcpServers.openpencil`, and managed skills |
|
|
39
|
+
|
|
40
|
+
## Development & Verification
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
cd packages/op-qoder
|
|
44
|
+
npm run check
|
|
45
|
+
npm test
|
|
46
|
+
npm run verify:packages
|
|
47
|
+
```
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Qoder OpenPencil 插件与连接器
|
|
2
|
+
|
|
3
|
+
**面向 Qoder(Qoder Desktop / Qoder CN / Qoder IDE & CLI)的 OpenPencil 原生 MCP Apps 插件与交互式 Rust 画布(`@zseven-w/qoder-openpencil`)。**
|
|
4
|
+
|
|
5
|
+
[English](./README.md) · [**简体中文**](./README.zh.md) · [安装指南](./INSTALL.md) · [架构说明](./docs/architecture.md)
|
|
6
|
+
|
|
7
|
+
## 核心特性
|
|
8
|
+
|
|
9
|
+
- **原生适配 Qoder MCP Apps 2026-01-26(`qoder/ui`)**:
|
|
10
|
+
- 在 `open_canvas` 上声明 `global` 与 `thread` 入口,安装后可直接从左侧 **更多 → OpenPencil Canvas**(全屏独立工作区)或会话右侧栏 **+ → Apps → OpenPencil Canvas**(与对话并排)一键打开。
|
|
11
|
+
- 在 `_meta.ui.csp.frameDomains` 中声明本地 `127.0.0.1` 画布源(适配 Qoder Desktop 的本地回环白名单),并声明 `availableDisplayModes: ["inline", "fullscreen"]` 与 `preferredDisplayMode: "fullscreen"`。
|
|
12
|
+
- 支持明暗主题同步、通过 `ui/update-model-context`(带 `qoder/title` 与 `structuredContent`)同步选区上下文,以及代码面板 `ui/message` 交接。
|
|
13
|
+
- **完整覆盖 Qoder 插件注册与导入规范**:
|
|
14
|
+
- `qoder-openpencil setup`:自动识别 `~/.qoder` / `~/.qoder-cn`(兼容 `QODER_CONFIG_DIR` / `QODERCN_CONFIG_DIR`),写入版本化本地缓存 `plugins/cache/local/openpencil/<version>/`,原子合并 `plugins/installed_plugins_v2.json` 并在 `settings.json` 启用 `enabledPlugins["openpencil@local"] = true`。
|
|
15
|
+
- `qoder-openpencil pack-plugin`:零依赖生成符合 Qoder 规范的本地插件 `.zip`(`.qoder-plugin/plugin.json` 与 `${QODER_PLUGIN_ROOT}` 版 `.mcp.json` 直接位于 ZIP 根目录),支持界面 **扩展 → 导入本地插件** 或 `qoder-settings.install_extension`。
|
|
16
|
+
- `qoder-openpencil setup --mcp-settings` / `print-config`:同时兼容 Qoder IDE / CLI 的全局 `settings.json` `mcpServers` + `skills/` 模式。
|
|
17
|
+
- **完整原生设计工具与受保护保存**:单一串行控制器代理所有 OpenPencil Rust MCP 工具,会话恢复草稿保存在 `~/.qoder-openpencil/sessions/`,保存前校验 SHA-256 基线。
|
|
18
|
+
|
|
19
|
+
## 快速开始
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm install -g @zseven-w/qoder-openpencil
|
|
23
|
+
qoder-openpencil setup
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
重启 Qoder(或在 **扩展 → 已安装** 刷新)即可在左侧 **更多** 或会话右侧栏 **+ → Apps** 中打开 **OpenPencil Canvas**。
|
|
27
|
+
|
|
28
|
+
## 常用命令
|
|
29
|
+
|
|
30
|
+
| 命令 | 说明 |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| `qoder-openpencil setup` | 校验运行包、注册并启用 `openpencil@local` 插件并执行 `host-check` |
|
|
33
|
+
| `qoder-openpencil pack-plugin [--output PATH]` | 打包符合 Qoder 根目录规范的本地插件 `.zip` |
|
|
34
|
+
| `qoder-openpencil print-config` | 输出适用于 `settings.json` 的 `mcpServers` JSON |
|
|
35
|
+
| `qoder-openpencil host-check` | 模拟 GUI 精简 `PATH` 校验启动器、`qoder/ui` 入口与 MCP App 资源 |
|
|
36
|
+
| `qoder-openpencil canvas [--file PATH]` | 终端持久化画布模式 |
|
|
37
|
+
| `qoder-openpencil doctor [--port PORT]` | 诊断已运行的 OpenPencil 桌面端 MCP 服务 |
|
|
38
|
+
| `qoder-openpencil uninstall` | 安全卸载 `openpencil@local`、`mcpServers.openpencil` 及受管 Skill |
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
This distribution includes the following third-party components.
|
|
4
|
+
|
|
5
|
+
## OpenPencil 0.8.6
|
|
6
|
+
|
|
7
|
+
- Platform packages: `@zseven-w/qoder-openpencil-<platform>` distribute the native headless `op-host-web-server`, its matching editor web bundle, and CanvasKit directory together
|
|
8
|
+
- Source: https://github.com/ZSeven-W/openpencil
|
|
9
|
+
- License: MIT
|
|
10
|
+
|
|
11
|
+
The platform runtimes are built from the pinned OpenPencil 0.8.6 source. The OpenPencil and CanvasKit notices currently distributed by these packages are reproduced below; all other applicable third-party license terms continue to apply.
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
MIT License
|
|
15
|
+
|
|
16
|
+
Copyright (c) 2026 ZSeven—W
|
|
17
|
+
|
|
18
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
19
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
20
|
+
in the Software without restriction, including without limitation the rights
|
|
21
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
22
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
23
|
+
furnished to do so, subject to the following conditions:
|
|
24
|
+
|
|
25
|
+
The above copyright notice and this permission notice shall be included in all
|
|
26
|
+
copies or substantial portions of the Software.
|
|
27
|
+
|
|
28
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
29
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
31
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
32
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
33
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
34
|
+
SOFTWARE.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## CanvasKit (`canvaskit-wasm` 0.40.0)
|
|
38
|
+
|
|
39
|
+
- Files: the CanvasKit directory (`bin/web-bundle/canvaskit/canvaskit.js`, `bin/web-bundle/canvaskit/canvaskit.wasm`) distributed in each `@zseven-w/qoder-openpencil-<platform>` package
|
|
40
|
+
- Source: https://www.npmjs.com/package/canvaskit-wasm/v/0.40.0
|
|
41
|
+
- License: BSD-3-Clause
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
Copyright (c) 2011 Google Inc. All rights reserved.
|
|
45
|
+
|
|
46
|
+
Redistribution and use in source and binary forms, with or without
|
|
47
|
+
modification, are permitted provided that the following conditions are
|
|
48
|
+
met:
|
|
49
|
+
|
|
50
|
+
* Redistributions of source code must retain the above copyright
|
|
51
|
+
notice, this list of conditions and the following disclaimer.
|
|
52
|
+
* Redistributions in binary form must reproduce the above
|
|
53
|
+
copyright notice, this list of conditions and the following disclaimer
|
|
54
|
+
in the documentation and/or other materials provided with the
|
|
55
|
+
distribution.
|
|
56
|
+
* Neither the name of Google Inc. nor the names of its
|
|
57
|
+
contributors may be used to endorse or promote products derived from
|
|
58
|
+
this software without specific prior written permission.
|
|
59
|
+
|
|
60
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
61
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
62
|
+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
63
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
64
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
65
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
66
|
+
FROM,
|
|
67
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
68
|
+
SOFTWARE.
|
|
69
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
7
|
+
const pkg = JSON.parse(await readFile(join(packageRoot, 'package.json'), 'utf8'));
|
|
8
|
+
|
|
9
|
+
function printHelp() {
|
|
10
|
+
console.log(`qoder-openpencil v${pkg.version}
|
|
11
|
+
|
|
12
|
+
Usage: qoder-openpencil <command> [options]
|
|
13
|
+
|
|
14
|
+
Commands:
|
|
15
|
+
setup [options] Verify runtime and install OpenPencil plugin into Qoder
|
|
16
|
+
--runtime-only Verify runtime without editing Qoder plugin cache or settings
|
|
17
|
+
--repair-runtime Re-activate the atomic platform runtime package
|
|
18
|
+
--config-dir <path> Override Qoder config dir (default: auto-detect ~/.qoder or ~/.qoder-cn)
|
|
19
|
+
--mcp-settings Register via settings.json mcpServers + skills instead of plugin cache
|
|
20
|
+
--pack-plugin [path] Also generate a Qoder local plugin .zip (root .qoder-plugin/plugin.json)
|
|
21
|
+
uninstall [--config-dir <path>] Remove the OpenPencil plugin and managed skills from Qoder
|
|
22
|
+
print-config Print copy-pasteable mcpServers JSON for Qoder IDE/CLI settings.json
|
|
23
|
+
pack-plugin [--output <path.zip>] Build a Qoder-compatible local plugin .zip bundle
|
|
24
|
+
canvas [--file /abs/path.op] Open the persistent terminal canvas
|
|
25
|
+
host-check [--config-dir <path>] Verify Qoder MCP launcher, qoder/ui entrypoints, and registration
|
|
26
|
+
doctor [--port PORT] Check connectivity to an existing desktop OpenPencil MCP server
|
|
27
|
+
configure-runtime /abs/runtime/root Select a custom complete Rust editor runtime
|
|
28
|
+
--version, -v Show package version
|
|
29
|
+
--help, -h Show this help message`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function runCli(args = process.argv.slice(2)) {
|
|
33
|
+
const [command, ...rest] = args;
|
|
34
|
+
if (!command || command === '--help' || command === '-h' || command === 'help') {
|
|
35
|
+
printHelp();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (command === '--version' || command === '-v') {
|
|
39
|
+
console.log(pkg.version);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (command === 'setup') {
|
|
43
|
+
const { runSetup } = await import(pathToFileURL(join(packageRoot, 'scripts/setup.mjs')).href);
|
|
44
|
+
await runSetup(rest);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (command === 'uninstall') {
|
|
48
|
+
const { runSetup } = await import(pathToFileURL(join(packageRoot, 'scripts/setup.mjs')).href);
|
|
49
|
+
await runSetup(['--uninstall', ...rest]);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (command === 'print-config') {
|
|
53
|
+
const { runSetup } = await import(pathToFileURL(join(packageRoot, 'scripts/setup.mjs')).href);
|
|
54
|
+
await runSetup(['--print-config', ...rest]);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (command === 'pack-plugin') {
|
|
58
|
+
const { runPackPlugin } = await import(pathToFileURL(join(packageRoot, 'scripts/pack-plugin.mjs')).href);
|
|
59
|
+
await runPackPlugin(rest);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (command === 'host-check') {
|
|
63
|
+
const { runHostCheck } = await import(pathToFileURL(join(packageRoot, 'scripts/plugin-host-check.mjs')).href);
|
|
64
|
+
await runHostCheck(rest);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (command === 'canvas') {
|
|
68
|
+
const { runCanvas } = await import(pathToFileURL(join(packageRoot, 'scripts/canvas.mjs')).href);
|
|
69
|
+
await runCanvas(rest);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (command === 'configure-runtime') {
|
|
73
|
+
const { runConfigureRuntime } = await import(pathToFileURL(join(packageRoot, 'scripts/configure-runtime.mjs')).href);
|
|
74
|
+
await runConfigureRuntime(rest);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (command === 'doctor') {
|
|
78
|
+
const { spawnSync } = await import('node:child_process');
|
|
79
|
+
const bridge = join(packageRoot, 'plugins/openpencil/scripts/mcp-bridge.mjs');
|
|
80
|
+
const result = spawnSync(process.execPath, [bridge, '--doctor', ...rest], { stdio: 'inherit' });
|
|
81
|
+
process.exitCode = result.status ?? 1;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
console.error(`Unknown command: ${command}\nRun "qoder-openpencil --help" for usage.`);
|
|
85
|
+
process.exitCode = 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
89
|
+
await runCli(process.argv.slice(2));
|
|
90
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zseven-w/qoder-openpencil",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OpenPencil design plugin, interactive Rust MCP App canvas, and local MCP connector for Qoder.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"qoder",
|
|
8
|
+
"qoder-plugin",
|
|
9
|
+
"openpencil",
|
|
10
|
+
"connector",
|
|
11
|
+
"plugin",
|
|
12
|
+
"design",
|
|
13
|
+
"mcp",
|
|
14
|
+
"mcp-app"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/ZSeven-W/openpencil.git",
|
|
19
|
+
"directory": "packages/op-qoder"
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22"
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"qoder-openpencil": "./bin/qoder-openpencil.mjs"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"bin",
|
|
33
|
+
"plugins",
|
|
34
|
+
"scripts",
|
|
35
|
+
"platforms.json",
|
|
36
|
+
"INSTALL.md",
|
|
37
|
+
"README.md",
|
|
38
|
+
"README.zh.md",
|
|
39
|
+
"LICENSE",
|
|
40
|
+
"NOTICE",
|
|
41
|
+
"THIRD_PARTY_NOTICES.md"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"test": "node --test tests/*.test.mjs",
|
|
45
|
+
"check": "node scripts/check-package.mjs",
|
|
46
|
+
"doctor": "node plugins/openpencil/scripts/mcp-bridge.mjs --doctor",
|
|
47
|
+
"host-check": "node scripts/plugin-host-check.mjs",
|
|
48
|
+
"configure-runtime": "node scripts/configure-runtime.mjs",
|
|
49
|
+
"setup": "node scripts/setup.mjs",
|
|
50
|
+
"uninstall": "node scripts/setup.mjs --uninstall",
|
|
51
|
+
"print-config": "node scripts/setup.mjs --print-config",
|
|
52
|
+
"pack-plugin": "node scripts/pack-plugin.mjs",
|
|
53
|
+
"canvas": "node scripts/canvas.mjs",
|
|
54
|
+
"build:editor-runtime": "node scripts/build-editor-runtime.mjs",
|
|
55
|
+
"stage:editor-runtime": "node scripts/stage-editor-runtime.mjs",
|
|
56
|
+
"stage:runtime": "npm run stage:editor-runtime",
|
|
57
|
+
"verify:packages": "node scripts/verify-platform-packages.mjs",
|
|
58
|
+
"release:sync": "node scripts/sync-platform-versions.mjs",
|
|
59
|
+
"release:check": "node scripts/check-release-version.mjs",
|
|
60
|
+
"pack:artifact": "node scripts/pack-package.mjs",
|
|
61
|
+
"release:publish": "node scripts/publish-release.mjs",
|
|
62
|
+
"test:release-publish": "node --test tests/registry-convergence.test.mjs && node scripts/publish-release.mjs --self-test",
|
|
63
|
+
"verify:install": "node scripts/verify-selective-install.mjs"
|
|
64
|
+
},
|
|
65
|
+
"optionalDependencies": {
|
|
66
|
+
"@zseven-w/qoder-openpencil-darwin-arm64": "0.1.0",
|
|
67
|
+
"@zseven-w/qoder-openpencil-darwin-x64": "0.1.0",
|
|
68
|
+
"@zseven-w/qoder-openpencil-linux-arm64": "0.1.0",
|
|
69
|
+
"@zseven-w/qoder-openpencil-linux-x64": "0.1.0",
|
|
70
|
+
"@zseven-w/qoder-openpencil-win32-arm64": "0.1.0",
|
|
71
|
+
"@zseven-w/qoder-openpencil-win32-x64": "0.1.0"
|
|
72
|
+
}
|
|
73
|
+
}
|
package/platforms.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"openPencil": {
|
|
4
|
+
"version": "0.8.6",
|
|
5
|
+
"revision": "8c119f40fc58ad07c90f7b96147797a56c263fe7"
|
|
6
|
+
},
|
|
7
|
+
"platforms": [
|
|
8
|
+
{
|
|
9
|
+
"id": "darwin-arm64",
|
|
10
|
+
"os": "darwin",
|
|
11
|
+
"cpu": "arm64",
|
|
12
|
+
"rustTarget": "aarch64-apple-darwin",
|
|
13
|
+
"runner": "macos-15",
|
|
14
|
+
"packageName": "@zseven-w/qoder-openpencil-darwin-arm64",
|
|
15
|
+
"binaryName": "op-host-web-server"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "darwin-x64",
|
|
19
|
+
"os": "darwin",
|
|
20
|
+
"cpu": "x64",
|
|
21
|
+
"rustTarget": "x86_64-apple-darwin",
|
|
22
|
+
"runner": "macos-15-intel",
|
|
23
|
+
"packageName": "@zseven-w/qoder-openpencil-darwin-x64",
|
|
24
|
+
"binaryName": "op-host-web-server"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "linux-arm64",
|
|
28
|
+
"os": "linux",
|
|
29
|
+
"cpu": "arm64",
|
|
30
|
+
"libc": "glibc",
|
|
31
|
+
"rustTarget": "aarch64-unknown-linux-gnu",
|
|
32
|
+
"runner": "ubuntu-24.04-arm",
|
|
33
|
+
"packageName": "@zseven-w/qoder-openpencil-linux-arm64",
|
|
34
|
+
"binaryName": "op-host-web-server"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "linux-x64",
|
|
38
|
+
"os": "linux",
|
|
39
|
+
"cpu": "x64",
|
|
40
|
+
"libc": "glibc",
|
|
41
|
+
"rustTarget": "x86_64-unknown-linux-gnu",
|
|
42
|
+
"runner": "ubuntu-22.04",
|
|
43
|
+
"packageName": "@zseven-w/qoder-openpencil-linux-x64",
|
|
44
|
+
"binaryName": "op-host-web-server"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "win32-arm64",
|
|
48
|
+
"os": "win32",
|
|
49
|
+
"cpu": "arm64",
|
|
50
|
+
"rustTarget": "aarch64-pc-windows-msvc",
|
|
51
|
+
"runner": "windows-11-arm",
|
|
52
|
+
"packageName": "@zseven-w/qoder-openpencil-win32-arm64",
|
|
53
|
+
"binaryName": "op-host-web-server.exe"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "win32-x64",
|
|
57
|
+
"os": "win32",
|
|
58
|
+
"cpu": "x64",
|
|
59
|
+
"rustTarget": "x86_64-pc-windows-msvc",
|
|
60
|
+
"runner": "windows-2025",
|
|
61
|
+
"packageName": "@zseven-w/qoder-openpencil-win32-x64",
|
|
62
|
+
"binaryName": "op-host-web-server.exe"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "openpencil",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"displayName": "OpenPencil",
|
|
5
|
+
"description": "Editable Rust OpenPencil UI design canvas (MCP App with Global and Thread Sidebar entrypoints), native .op design tools, and code handoff for Qoder.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "ZSeven-W",
|
|
8
|
+
"url": "https://github.com/ZSeven-W/openpencil"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"qoder-plugin",
|
|
13
|
+
"openpencil",
|
|
14
|
+
"design",
|
|
15
|
+
"canvas",
|
|
16
|
+
"mcp-app",
|
|
17
|
+
"ui"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# OpenPencil Connector for Qoder
|
|
2
|
+
|
|
3
|
+
This plugin bundles the local `openpencil` stdio MCP server (`.mcp.json`) and exposes the interactive Rust OpenPencil canvas via Qoder's MCP Apps 2026-01-26 host protocol (`global` + `thread` sidebar entrypoints + `fullscreen` / `inline` display modes).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- **Node.js 22+** (run `qoder-openpencil setup` once so `~/.qoder-openpencil/node-path` is recorded for GUI launches)
|
|
8
|
+
- **OpenPencil Rust editor runtime** (`@zseven-w/qoder-openpencil-<platform>`, staged development runtime, or `OPENPENCIL_EDITOR_RUNTIME_DIR`)
|
|
9
|
+
- No API keys or external cloud tokens are required; all canvas traffic stays on `127.0.0.1` with per-session capability tokens.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ZSeven—W
|
|
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.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
The node and layout reference in plugins/openpencil/skills/openpencil-design/
|
|
2
|
+
references/node-schema.md is adapted from the MIT-licensed bundled design skill
|
|
3
|
+
in ZSeven-W/openpencil (crates/op-cli/assets/skill-bundle.json).
|
|
4
|
+
Copyright (c) 2026 ZSeven-W.
|
|
5
|
+
|
|
6
|
+
The managed editor protocol and structural image-reference visitor follow the
|
|
7
|
+
MIT-licensed Rust OpenPencil engine and OpenPencil connector packages by ZSeven-W.
|
|
8
|
+
The runtime is distributed separately via platform optional packages or a user-configured runtime root.
|
|
9
|
+
|
|
10
|
+
This is an independent OpenPencil plugin, not a Qoder-authored plugin.
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "openpencil",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"displayName": "OpenPencil",
|
|
5
|
+
"description": "Editable Rust OpenPencil UI design canvas (MCP App with Global and Thread Sidebar entrypoints), native .op design tools, and code handoff for Qoder.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "ZSeven-W",
|
|
8
|
+
"url": "https://github.com/ZSeven-W/openpencil"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"qoder-plugin",
|
|
13
|
+
"openpencil",
|
|
14
|
+
"design",
|
|
15
|
+
"canvas",
|
|
16
|
+
"mcp-app",
|
|
17
|
+
"ui"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
// Prepare a host-mediated opening request. This never launches an OS browser or
|
|
4
|
+
// navigates from the sandbox; the current chat owns the browser preview action.
|
|
5
|
+
export function prepareCanvasBrowser(controller, args = {}) {
|
|
6
|
+
if (Object.keys(args).some(key => key !== 'theme') || !['light', 'dark'].includes(args.theme)) {
|
|
7
|
+
throw new Error('Choose a light or dark theme; browser URLs cannot be supplied.');
|
|
8
|
+
}
|
|
9
|
+
controller.session.assertLive();
|
|
10
|
+
// Reuse an in-flight receipt while the host processes the chat request.
|
|
11
|
+
if (controller.browserLaunch?.state === 'pending' && Date.now() < controller.browserLaunch.expiresAt) {
|
|
12
|
+
return {
|
|
13
|
+
...browserLaunchStatus(controller, { launchId: controller.browserLaunch.launchId }),
|
|
14
|
+
panelUrl: controller.browserLaunch.panelUrl,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const launchId = randomBytes(16).toString('base64url');
|
|
18
|
+
const url = new URL(controller.panel.url);
|
|
19
|
+
url.hash = `theme=${args.theme}&launch=${launchId}`;
|
|
20
|
+
controller.browserLaunch = { launchId, panelUrl: url.href, state: 'pending', expiresAt: Date.now() + 120_000 };
|
|
21
|
+
return { ...browserLaunchStatus(controller, { launchId }), panelUrl: url.href };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function browserLaunchStatus(controller, args = {}, connected = false) {
|
|
25
|
+
const launch = controller.browserLaunch;
|
|
26
|
+
if (
|
|
27
|
+
Object.keys(args).some(key => key !== 'launchId')
|
|
28
|
+
|| typeof args.launchId !== 'string'
|
|
29
|
+
|| !launch
|
|
30
|
+
|| launch.launchId !== args.launchId
|
|
31
|
+
) {
|
|
32
|
+
throw new Error('Unknown browser launch.');
|
|
33
|
+
}
|
|
34
|
+
if (launch.state === 'pending' && Date.now() >= launch.expiresAt) launch.state = 'unconfirmed';
|
|
35
|
+
if (connected && launch.state === 'pending') launch.state = 'connected';
|
|
36
|
+
return { launchId: launch.launchId, state: launch.state };
|
|
37
|
+
}
|