dsh-pinwhy 0.0.0-stage → 0.5.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-pinwhy contributors
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.md CHANGED
@@ -1,3 +1,120 @@
1
- # Temporary Holding Version
1
+ # dsh-pinwhy
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
+ [Pinwhy](https://github.com/Fruit-Guardians/pinwhy) 的 DeepSeek Harness(DSH)插件,源码位于 `plugins/dsh-pinwhy/`。插件通过子进程调用独立安装的 `pinwhy` CLI,不内嵌内核或复制 Skill。
4
+
5
+ ## 环境要求
6
+
7
+ - DeepSeek Harness:`>=0.2.2-rc.2 <1.0.0`
8
+ - Node.js:`^22.19.0 || >=24.0.0`
9
+ - 已独立安装的 `pinwhy` CLI(通过 `pinwhy capabilities --json` 校验能力声明)
10
+
11
+ ## 功能概览
12
+
13
+ - **11 个原生工具**:覆盖诊断、状态读取、上下文恢复、节点读写、有向连边、游标移动、检查点、结构化检索(`pinwhy_search`)和原子批量写入(`pinwhy_batch`)。
14
+ - **内嵌只读画板**:在 DSH 左侧导航或会话顶部菜单打开「Pinwhy 画板」,通过临时只读服务(`serve --read-only --ephemeral`)加载通用(2D / 2.5D)、审计与 Ultra 覆盖面视图及历史检查点,跟随宿主主题和语言设置,并支持将选中节点作为引用插入当前会话草稿。
15
+ - **动态 Skill 加载**:直接读取 CLI 声明的 `resources.skill` 目录,不维护第二份 Skill 副本。
16
+ - **宿主写策略校验**:写入前校验 `capabilities.writeTargets` 真实路径与宿主 `sandboxPolicy`,不绕过只读或工作区边界。
17
+
18
+ ## 安装与配置
19
+
20
+ ### 1. 安装 Pinwhy CLI
21
+
22
+ 参考 [主仓库文档](https://github.com/Fruit-Guardians/pinwhy#quick-start) 安装 `pinwhy`(支持 `npm install -g pinwhy` 或 `release install`)。
23
+
24
+ ### 2. 安装 DSH 插件
25
+
26
+ ```sh
27
+ dsh plugin --profile web add /path/to/pinwhy/plugins/dsh-pinwhy
28
+ ```
29
+
30
+ 也可在 `plugins/dsh-pinwhy` 目录执行 `npm pack` 后从 `.tgz` 安装。
31
+
32
+ ### 3. 初始化并启用项目
33
+
34
+ 插件默认 `projects: []`,不会自动初始化任何目录。先初始化目标项目:
35
+
36
+ ```sh
37
+ pinwhy init --cwd /path/to/your-project --json
38
+ ```
39
+
40
+ 在 DSH「插件 → Pinwhy · 外置黑板 → 配置」中添加工作区,或通过 patch 文件应用:
41
+
42
+ ```yaml
43
+ - id: pinwhy
44
+ config:
45
+ projects:
46
+ - workspace: /path/to/your-project
47
+ boardRoot: /path/to/your-project
48
+ ```
49
+
50
+ ```sh
51
+ dsh web --patch /path/to/pinwhy-project.patch.yml
52
+ ```
53
+
54
+ ## 配置项
55
+
56
+ | 字段 | 默认值 | 说明 |
57
+ | --- | --- | --- |
58
+ | `projects` | `[]` | 显式启用的项目列表,每项包含 `workspace` 与可选 `boardRoot` |
59
+ | `autoDiscover` | `false` | 未配置 `projects` 时,是否向上查找已存在的 `.pinwhy` 目录(不自动初始化) |
60
+ | `runtimeCli` | 默认安装路径 | `pinwhy.js` 绝对路径 |
61
+ | `nodeExecutable` | `process.execPath` | Node 可执行文件路径 |
62
+ | `timeoutMs` | `10000` | 单次 CLI 调用超时(`50`–`120000` ms) |
63
+ | `maxOutputBytes` | `1048576` | 单次输出上限(`1024`–`16777216` bytes) |
64
+
65
+ 写入作者标识固定为 `dsh:<session.id>`。
66
+
67
+ ## 工具列表
68
+
69
+ | 工具 | 参数 | 说明 |
70
+ | --- | --- | --- |
71
+ | `pinwhy_diagnose` | 无 | 只读检查 CLI、黑板状态与宿主写策略,返回 `pinwhy.diagnostics.v1` |
72
+ | `pinwhy_status` | 无 | 查询黑板与查看器状态 |
73
+ | `pinwhy_context` | `budget`, `depth`, `focus`, `since`, `asOf`, `agentId`(可选) | 读取 `pinwhy.context.v2` 只读恢复上下文 |
74
+ | `pinwhy_node_get` | `id`, `asOf`(可选) | 读取单个节点与关联边 |
75
+ | `pinwhy_node_add` | `type`, `title`, `to`, `relateHere`, `relation`, `label`, `reason`, `requestId`, `rejectTruncation` 等 | 创建节点(默认不移动游标、不自动连边) |
76
+ | `pinwhy_node_patch` | `id`, `clear`, `requestId`, `rejectTruncation` 及待修改字段 | 更新或清空指定字段 |
77
+ | `pinwhy_link` | `from`, `to`, `relation`, `label`, `requestId`, `rejectTruncation` | 创建有向边 |
78
+ | `pinwhy_cursor` | `id`, `reason`, `requestId`(可选) | 移动当前会话游标或清空(`none`) |
79
+ | `pinwhy_checkpoint` | `summary`, `trigger`, `requestId`, `rejectTruncation` | 记录交接检查点 |
80
+ | `pinwhy_search` | `query`, `type`, `types`, `status`, `severity`, `confidence`, `relation`, `relatedTo`, `groupBy`, `asOf`, `tags`, `limit` | 只读搜索与分组检索 |
81
+ | `pinwhy_batch` | `operations`, `requestId`, `rejectTruncation`(可选) | 原子执行多条写入操作 |
82
+
83
+ ## 测试
84
+
85
+ 在 `plugins/dsh-pinwhy/` 目录下运行:
86
+
87
+ ```sh
88
+ npm run check
89
+ PINWHY_TEST_CLI=/path/to/pinwhy/bin/pinwhy.js npm test
90
+ ```
91
+
92
+ 需要本地 DSH 环境或浏览器环境的附加检查:
93
+
94
+ ```sh
95
+ npm run verify:profile
96
+ npm run verify:settings
97
+ PINWHY_TEST_CLI=/path/to/pinwhy/bin/pinwhy.js npm run verify:viewer
98
+ npm run verify:e2e # 会使用本地 DSH 配置发送真实模型请求
99
+ ```
100
+
101
+ 桌面端附带运行时验证(macOS 示例):
102
+
103
+ ```sh
104
+ DSH_RUNTIME_MANIFEST='/Applications/DeepSeek Harness.app/Contents/Resources/app.asar/dsh/package.json' \
105
+ ELECTRON_RUN_AS_NODE=1 \
106
+ '/Applications/DeepSeek Harness.app/Contents/MacOS/DeepSeek Harness' \
107
+ scripts/verify-dsh.mjs
108
+ ```
109
+
110
+ ## 卸载
111
+
112
+ ```sh
113
+ dsh plugin --profile web remove dsh-pinwhy
114
+ ```
115
+
116
+ 卸载插件不会删除项目内的 `.pinwhy/` 数据或独立安装的 `pinwhy` CLI。
117
+
118
+ ## 许可
119
+
120
+ [MIT](LICENSE)
@@ -0,0 +1,18 @@
1
+ <svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <style>
3
+ :root {
4
+ --pinwhy-bg: #F3F5F2;
5
+ --pinwhy-trace: #147453;
6
+ }
7
+ @media (prefers-color-scheme: dark) {
8
+ :root {
9
+ --pinwhy-bg: #090D0C;
10
+ --pinwhy-trace: #66E0AE;
11
+ }
12
+ }
13
+ </style>
14
+ <rect width="512" height="512" rx="112" fill="var(--pinwhy-bg, #F3F5F2)"/>
15
+ <path d="M280.75 135H184.5C157.162 135 135 157.162 135 184.5V327.5C135 354.838 157.162 377 184.5 377H327.5C354.838 377 377 354.838 377 327.5V258.75" stroke="var(--pinwhy-trace, #147453)" stroke-width="33" stroke-linecap="round" stroke-linejoin="round"/>
16
+ <path d="M206.5 300L289 217.5" stroke="var(--pinwhy-trace, #147453)" stroke-width="33" stroke-linecap="round"/>
17
+ <path d="M349.5 184.5C364.688 184.5 377 172.188 377 157C377 141.812 364.688 129.5 349.5 129.5C334.312 129.5 322 141.812 322 157C322 172.188 334.312 184.5 349.5 184.5Z" fill="var(--pinwhy-trace, #147453)"/>
18
+ </svg>