@wwwfz/dsh-agent-bridge 0.8.2 → 0.9.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/README.md +105 -91
- package/THIRD_PARTY_NOTICES.md +67 -0
- package/package.json +2 -2
- package/src/assets.js +70 -13
- package/src/catalog.js +328 -27
- package/src/client.js +317 -4
- package/src/export.js +238 -9
- package/src/index.js +24 -0
- package/src/projects.js +232 -23
- package/src/session-import.js +14 -0
- package/src/session-trace.js +121 -0
- package/src/skill-handoff.js +1327 -0
- package/src/skill-package.js +417 -0
- package/src/skill-provider.js +249 -0
- package/web/markdown.js +225 -0
- package/web/panel.css +111 -6
- package/web/panel.html +32 -1
- package/web/panel.js +819 -44
- package/web/vendor/markdown-it-LICENSE.txt +156 -0
- package/web/vendor/markdown-it.mjs +3064 -0
package/README.md
CHANGED
|
@@ -2,153 +2,162 @@
|
|
|
2
2
|
|
|
3
3
|
# Agent Bridge
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**换个 Agent,接着做。**
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
[](https://awesome-dsh-plugin.com/)
|
|
9
|
-
[](#卸载与构建)
|
|
7
|
+
把本机其他 Agent 的旧对话、项目记忆和 Skills 带进 DeepSeek Harness,在原工作目录继续开发。
|
|
10
8
|
|
|
11
|
-
[
|
|
9
|
+
[下载 Desktop 安装包](https://github.com/wfz2006/dsh-agent-bridge/releases/latest/download/dsh-agent-bridge.tgz) · [快速开始](#快速开始) · [看上手演示](#使用) · [图文介绍](https://wfz2006.github.io/dsh-agent-bridge/)
|
|
12
10
|
|
|
13
|
-
<a href="https://
|
|
11
|
+
<a href="https://raw.githubusercontent.com/wfz2006/dsh-agent-bridge/main/docs/screenshots/v0.9.0/workspace.png">
|
|
12
|
+
<img src="https://raw.githubusercontent.com/wfz2006/dsh-agent-bridge/main/docs/screenshots/v0.9.0/workspace.png" width="900" alt="Agent Bridge 的项目首屏。左侧可筛选项目,右侧可选最近对话或用项目资料开新对话。">
|
|
13
|
+
</a>
|
|
14
|
+
|
|
15
|
+
<sub>示例项目「接口调试台」 · v0.9.0 实际界面 · 点击查看大图</sub>
|
|
14
16
|
|
|
15
17
|
</div>
|
|
16
18
|
|
|
17
|
-
##
|
|
19
|
+
## 快速开始
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
| :--- | :--- | :--- |
|
|
21
|
-
| 按 Agent、项目名、路径和状态筛选;置顶常用项目,归档不再使用的项目。 | 勾选项目记忆、Skills 和近期会话,先预览再交接。 | 在原工作目录创建 DSH 会话,并填入可编辑的交接草稿。 |
|
|
21
|
+
### DSH Desktop
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
1. 下载 [GitHub 安装包 v0.9.0](https://github.com/wfz2006/dsh-agent-bridge/releases/latest/download/dsh-agent-bridge.tgz)。
|
|
24
|
+
2. 在 DSH 的 **插件 → 安装插件** 选择下载的 `.tgz`。
|
|
25
|
+
3. 完全退出再打开 DSH,从侧栏进入 **Agent 工作接续**。
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
### DSH Web
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
- **项目资料按用途分组**:上次做到哪、项目约定、会话中提到的 Skills 和其他笔记分开显示;全局资料默认折叠且不自动勾选,每个项目的选择会独立保留。
|
|
31
|
-
- **真实数据更可靠**:自动发现 Codex `.jsonl.zst` 会话及索引中仍指向旧路径的压缩记录,大型历史按流式方式读取;运行环境包装信息不会覆盖同一消息里的真实提问。
|
|
32
|
-
- **权限和失败恢复更明确**:面板仅接受本机 DSH 所有者身份。草稿初始化失败时会归档空白会话并复用同一会话重试;已有草稿保持原样,可打开原会话手动恢复。
|
|
29
|
+
在已安装 DSH CLI 的环境里运行。当前 npm 版本为 [v0.9.0](https://www.npmjs.com/package/@wwwfz/dsh-agent-bridge)。
|
|
33
30
|
|
|
34
|
-
|
|
31
|
+
~~~sh
|
|
32
|
+
dsh plugin --profile web add @wwwfz/dsh-agent-bridge
|
|
33
|
+
dsh web
|
|
34
|
+
~~~
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
| <img src="docs/screenshots/v0.8.2/02-conversation-preview.png" width="440" alt="继续旧对话预览"> | <img src="docs/screenshots/v0.8.2/03-project-materials.png" width="440" alt="项目资料分组"> |
|
|
39
|
-
| 选一条最近对话,核对消息后迁入并继续。 | 资料按进度、项目约定和 Skills 分组,全局资料库默认折叠。 |
|
|
36
|
+
> [!NOTE]
|
|
37
|
+
> 下方演示的原对话统计、项目级原生 Skills 和新版 Markdown 预览来自 v0.9.0。
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
| :---: | :---: |
|
|
43
|
-
| <img src="docs/screenshots/v0.8.2/04-draft-preview.png" width="440" alt="交接草稿预览"> | <img src="docs/screenshots/v0.8.2/06-black-theme.png" width="440" alt="黑色主题"> |
|
|
44
|
-
| 核对记忆、Skills 和来源,打开新对话或导出 Markdown。 | 蓝、白、黑三套主题,选择会记住。 |
|
|
39
|
+
Windows DSH Desktop 0.2.2-rc.3 和 DSH Web 已完成隔离验收。原生会话和 Skills 需要宿主提供对应服务。macOS 和 Linux 的数据路径规则有测试覆盖。 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
<summary>更多界面:项目归档、全局资料库和 Agent 图标</summary>
|
|
41
|
+
## 使用
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
| --- | --- |
|
|
51
|
-
|  |  |
|
|
43
|
+
从侧栏打开 **Agent 工作接续**,按 Agent、项目名或路径找到原项目。不同 Git worktree 会独立显示。
|
|
52
44
|
|
|
53
|
-
|
|
45
|
+
### 继续旧对话
|
|
54
46
|
|
|
55
|
-
|
|
47
|
+
1. 在项目首屏点开一条最近对话,或用 **查看全部对话** 搜索。
|
|
48
|
+
2. 核对用户和助手的消息,再点 **迁入并继续**。
|
|
49
|
+
3. DSH 会在原工作目录打开一条带历史的新会话,输入下一句就能接着聊。
|
|
56
50
|
|
|
57
|
-
|
|
51
|
+
#### 在哪里看原对话统计
|
|
58
52
|
|
|
59
|
-
|
|
60
|
-
2. 打开 **DSH Desktop → 插件 → 安装插件**,选择这个文件。
|
|
61
|
-
3. **完全退出 DSH 后再打开**,侧栏会出现 **Agent 工作接续**。
|
|
53
|
+
点新会话头部的 **来源记录**。顶部显示已读轮次、消息数和已保存的工具调用。原日志有足够的时间戳或累计 Token 时,也会显示相应数据。继续聊天后仍可查阅迁入时保存的统计。
|
|
62
54
|
|
|
63
|
-
<
|
|
64
|
-
<
|
|
55
|
+
<a href="https://raw.githubusercontent.com/wfz2006/dsh-agent-bridge/main/docs/screenshots/v0.9.0/source-record.png">
|
|
56
|
+
<img src="https://raw.githubusercontent.com/wfz2006/dsh-agent-bridge/main/docs/screenshots/v0.9.0/source-record.png" width="700" alt="原对话统计显示轮次、消息、工具调用、时间跨度与 Token。第二轮展开后可见失败和未记录结果的工具条目。">
|
|
57
|
+
</a>
|
|
65
58
|
|
|
66
|
-
|
|
59
|
+
*逐轮记录默认折叠。图中展开了第二轮,便于核对哪些工具失败或缺少结果。*
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
<details>
|
|
62
|
+
<summary>可迁入的历史范围</summary>
|
|
63
|
+
|
|
64
|
+
- 文字保留可读取的顺序和角色。较长历史按预算保留近期问答,预览会标记截取。Codex 的压缩会话 `.jsonl.zst` 也可发现和读取。
|
|
65
|
+
- 来源记录可保存 Codex 的可见思考摘要和工具调用,以及 Claude Code 的工具调用与结果。结果按调用 ID 归到原回合。历史工具数据以只读记录保存,后续请求按 DSH 当前权限执行。
|
|
66
|
+
- 宿主没有会话头部入口时,可在 Agent Bridge 的 **导出 DSH 会话** 中查看已保存的来源记录。旧版迁入的会话按当时保存的内容显示。
|
|
72
67
|
|
|
73
68
|
</details>
|
|
74
69
|
|
|
75
|
-
|
|
70
|
+
### 用项目资料开新对话
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
展开 **用项目资料开新对话**,从「上次做到哪」「项目约定」「Skills」等分组挑选资料。**全局资料库**默认折叠。打开 **接续清单** 可核对勾选,再用 **预览草稿** 打开一条新对话或导出交接。
|
|
78
73
|
|
|
79
|
-
|
|
80
|
-
2. 要接着聊,直接在 **继续旧对话** 里选一条最近对话,或用 **查看全部对话** 搜索。核对消息后点 **迁入并继续**。
|
|
81
|
-
3. 要从现有资料开始一段新对话,展开 **用项目资料开新对话**。按进度、项目约定和 Skills 等用途挑选资料。**全局资料库** 默认折叠,也不会自动勾选;展开 **接续清单** 可核对选中内容或加入近期对话摘录。点 **预览草稿** 后可以打开新对话或导出。
|
|
74
|
+
#### 为本项目启用原生 Skill
|
|
82
75
|
|
|
83
|
-
|
|
76
|
+
看到 **可为此项目启用** 时,可点 **启用** 核对目标项目和包内容。在会话预览里也可以通过 **沿用技能(可选)** 勾选本次要带入的技能。在确认界面核对范围、脚本和同名冲突后,才会保存完整包。
|
|
84
77
|
|
|
85
|
-
|
|
78
|
+
<a href="https://raw.githubusercontent.com/wfz2006/dsh-agent-bridge/main/docs/screenshots/v0.9.0/skill-review.png">
|
|
79
|
+
<img src="https://raw.githubusercontent.com/wfz2006/dsh-agent-bridge/main/docs/screenshots/v0.9.0/skill-review.png" width="509" alt="verify-endpoint 启用前的核对界面,列出目标项目、来源与四个包内文件。">
|
|
80
|
+
</a>
|
|
86
81
|
|
|
87
|
-
|
|
82
|
+
*脚本、参考资料和资源随包保存。打开「已启用的项目 Skills」可管理和停用技能,有上一版时也可恢复。*
|
|
88
83
|
|
|
89
|
-
|
|
84
|
+
<details>
|
|
85
|
+
<summary>各类 Skill 状态和生效范围</summary>
|
|
90
86
|
|
|
91
|
-
|
|
87
|
+
- **DSH 已发现**表示当前项目能读到原生定义。入口的可用状态以实际生效副本和 DSH 调用策略为准。「待确认」「当前模式不可调用」表示当前检查结果。
|
|
88
|
+
- **可为此项目启用**表示可以为项目保存私有快照。快照位于 DSH 主目录的 `agent-bridge-skills/`,登记写入 `state.sqlite`。项目范围取最近的 `.git` 祖先,找不到时用原工作目录。
|
|
89
|
+
- **同名,待核对**时保留原技能,内容指纹一致才复用。预览后来源或项目位置改变,需要重新核对。
|
|
90
|
+
- **仅可带入说明**时使用 `SKILL.md` 正文摘录。指向包外的链接、包内特殊文件或疑似凭证文件会阻止整包启用。
|
|
91
|
+
- 启用确认的是快照和项目登记。执行脚本、使用专有工具、加载外部依赖仍取决于当前 DSH 环境。来源消失后,已有快照仍可管理。
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
</details>
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
## 导出交接
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
- **导出项目资料**。在 **预览草稿** 中选择 **导出本机版** 或 **导出分享版**。
|
|
98
|
+
- **导出 DSH 会话**。在面板右上角选择会话。需要工具名和结果摘录时,再勾选 **附带来源记录**。
|
|
99
|
+
- **接收一份交接**。把下载的 Markdown 放进接收项目的 `.agent-bridge/handoffs/`,刷新后从「上次做到哪」选用。
|
|
98
100
|
|
|
99
|
-
|
|
101
|
+
<a href="https://raw.githubusercontent.com/wfz2006/dsh-agent-bridge/main/docs/screenshots/v0.9.0/markdown-preview.png">
|
|
102
|
+
<img src="https://raw.githubusercontent.com/wfz2006/dsh-agent-bridge/main/docs/screenshots/v0.9.0/markdown-preview.png" width="509" alt="Markdown 预览保留标题、编号列表和检查项表格,可点开文档内的接口检查清单。">
|
|
103
|
+
</a>
|
|
100
104
|
|
|
101
|
-
|
|
105
|
+
*预览可打开经过核对的项目内文件,也可以复制路径。*
|
|
102
106
|
|
|
103
|
-
|
|
107
|
+
<details>
|
|
108
|
+
<summary>本机版、分享版和路径规则</summary>
|
|
104
109
|
|
|
105
|
-
|
|
110
|
+
- 本机版将核实的本机来源写为 `file:` 链接,由阅读器决定能否打开。分享版使用文件名或项目相对路径,也可根据 Markdown 保存位置生成相对链接。
|
|
111
|
+
- 预览从原文档目录解析相对链接,Host 核对项目范围和文件身份后让 DSH 打开。脚本等可执行文件提供定位。失效路径以文字保留。Markdown 的标题、代码块、表格和引用会排版,原始 HTML 按文字展示。
|
|
112
|
+
- 原工作目录离线时,可导出仍能读取的归档资料。
|
|
106
113
|
|
|
107
|
-
|
|
114
|
+
</details>
|
|
108
115
|
|
|
109
|
-
##
|
|
116
|
+
## 支持来源
|
|
110
117
|
|
|
111
|
-
|
|
112
|
-
- **导出 DSH 会话**:用面板右上方的 **导出 DSH 会话** 选择本机 DSH 会话。文件包含原工作目录和最近的用户与助手消息;较长的会话会标记截取。
|
|
118
|
+
打开面板底部的 **本机来源** 查看可读取的数据。扫描会监听文件变化,也可点 **刷新来源** 立即复扫。
|
|
113
119
|
|
|
114
|
-
|
|
120
|
+
| 来源 | 常见可读取内容 |
|
|
121
|
+
| --- | --- |
|
|
122
|
+
| Codex、Claude Code、OpenCode、Qoder、WorkBuddy、Gemini CLI、Qwen Code | 本地工作目录和可识别的会话,含有记录的 Skill 使用 |
|
|
123
|
+
| VS Code 系列的 Copilot | 可识别的工作区和工作区会话 |
|
|
124
|
+
| Antigravity、TRAE | 本机工作区与可关联记录,另外可读配置的 AgentsView 归档 |
|
|
125
|
+
| 项目资料、WorkspaceHub、手动来源 | 可读 Markdown、共享记忆、交接和 Skill 目录 |
|
|
115
126
|
|
|
116
|
-
|
|
127
|
+
插件通过本机 DSH 所有者身份读取。源文件和 Agent 数据库以只读方式访问,加密或服务端记忆可先导出为 Markdown。
|
|
117
128
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
| Codex、Claude Code、OpenCode、Qoder、WorkBuddy、Gemini CLI、Qwen Code | 可识别的本地工作目录和会话,以及会话中有记录的 Skill 使用 |
|
|
121
|
-
| Antigravity | 本地工作区信息和可关联的 CLI 提示记录 |
|
|
122
|
-
| VS Code 系列中的 Copilot | 可识别的工作区和工作区会话 |
|
|
123
|
-
| TRAE | 本地工作区元数据,以及可选 AgentsView 归档中的会话 |
|
|
124
|
-
| 记忆与 Skills | 项目内共享笔记与交接、相关 Agent 的可读 Markdown、共享和手动配置的 Skill 目录 |
|
|
125
|
-
| Agent Workspace Manager / AgentsView | 可选来源。读取 WorkspaceHub 项目档案与共享 Markdown、已有会话归档 |
|
|
129
|
+
<details>
|
|
130
|
+
<summary>搜索、归档和主题</summary>
|
|
126
131
|
|
|
127
|
-
|
|
132
|
+
- 按 <kbd>/</kbd> 定位项目搜索,按 <kbd>↓</kbd> 选中首项,按 <kbd>Enter</kbd> 打开。项目的勾选和近期对话选项会分别保存。
|
|
133
|
+
- **置顶**常用项目。在 **最近接续** 可找回刚打开的项目。用 **整理 → 归档所选** 批量整理,在 **已归档** 恢复或撤销操作。
|
|
134
|
+
- 支持蓝、白、黑三套主题,自动记住选择。正在预览时,列表会等预览关闭后再更新。 [Agent 图标来源](web/agent-icons/NOTICE.md)
|
|
135
|
+
|
|
136
|
+
</details>
|
|
128
137
|
|
|
129
138
|
## 在项目里存放共享记忆
|
|
130
139
|
|
|
131
|
-
|
|
140
|
+
在已发现的项目目录里放入 Markdown,刷新后即可选择。
|
|
132
141
|
|
|
133
|
-
|
|
142
|
+
~~~text
|
|
134
143
|
my-project/
|
|
135
144
|
.agent-bridge/
|
|
136
145
|
memory/
|
|
137
146
|
current-state.md
|
|
138
147
|
handoffs/
|
|
139
148
|
latest-handoff.md
|
|
140
|
-
|
|
149
|
+
~~~
|
|
141
150
|
|
|
142
|
-
`current-state.md`
|
|
151
|
+
用 `current-state.md` 记当前目标、分支状态与待办,用 `latest-handoff.md` 记已完成事项、验证结果和下一步。两个目录的第一层 Markdown 会进入项目资料。
|
|
143
152
|
|
|
144
153
|
## 自定义来源
|
|
145
154
|
|
|
146
155
|
<details>
|
|
147
156
|
<summary>配置 agent-bridge.json</summary>
|
|
148
157
|
|
|
149
|
-
|
|
158
|
+
在 DSH 主目录创建 `agent-bridge.json`。Windows 默认为 `%USERPROFILE%\.dsh`,macOS 和 Linux 默认为 `~/.dsh`。也可用 `DSH_HOME` 指定主目录,或用 `DSH_AGENT_BRIDGE_CONFIG` 指向配置文件。保存后点 **刷新来源**。
|
|
150
159
|
|
|
151
|
-
|
|
160
|
+
~~~json
|
|
152
161
|
{
|
|
153
162
|
"projectRoots": ["~/projects/example"],
|
|
154
163
|
"agentRoots": {
|
|
@@ -163,22 +172,27 @@ my-project/
|
|
|
163
172
|
"workspaceHubRoots": ["~/workspace-manager-data/workspacehub"],
|
|
164
173
|
"archiveFiles": ["~/workspace-manager-data/sessions.db"]
|
|
165
174
|
}
|
|
166
|
-
|
|
175
|
+
~~~
|
|
167
176
|
|
|
168
|
-
|
|
177
|
+
只需填写要改的项。相对路径以配置所在目录为准。`agentRoots` 会替换对应 Agent 的自动路径,用空数组跳过该 Agent。OpenCode 可配置数据目录或数据库文件,AgentsView 也接受 `AGENTSVIEW_DATA_DIR`。
|
|
178
|
+
|
|
179
|
+
默认扫描会使用 `CODEX_HOME`、`CLAUDE_CONFIG_DIR`、`XDG_DATA_HOME`、`XDG_CONFIG_HOME`、`OPENCODE_DB` 和 `OPENCODE_CONFIG_DIR`。 [Claude Code 配置](https://code.claude.com/docs/en/settings) · [OpenCode 数据路径](https://opencode.ai/docs/cli/providers/#storage)
|
|
169
180
|
|
|
170
181
|
</details>
|
|
171
182
|
|
|
172
183
|
## 卸载与构建
|
|
173
184
|
|
|
174
|
-
Desktop
|
|
185
|
+
在 Desktop 插件管理页卸载 **dsh-agent-bridge**。Web 版运行 `dsh plugin --profile web remove dsh-agent-bridge`。贡献者可从仓库目录运行 `npm test` 和 `npm pack`。 [第三方声明](THIRD_PARTY_NOTICES.md)
|
|
186
|
+
|
|
187
|
+
<details>
|
|
188
|
+
<summary>草稿失败时如何继续</summary>
|
|
175
189
|
|
|
176
|
-
|
|
177
|
-
dsh plugin --profile web remove dsh-agent-bridge
|
|
178
|
-
```
|
|
190
|
+
初始化失败时,尚未使用的空白会话会归档,重试可复用原会话。若已有草稿,打开相同会话,可把接续资料补到已有内容里。
|
|
179
191
|
|
|
180
|
-
|
|
192
|
+
</details>
|
|
181
193
|
|
|
182
194
|
<div align="center">
|
|
183
|
-
<
|
|
195
|
+
<a href="https://wfz2006.github.io/dsh-agent-bridge/">项目介绍</a> ·
|
|
196
|
+
<a href="https://github.com/wfz2006/dsh-agent-bridge/releases">历史版本</a> ·
|
|
197
|
+
<a href="https://github.com/wfz2006/dsh-agent-bridge/issues">问题反馈</a>
|
|
184
198
|
</div>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
Agent Bridge includes small, adapted portions of the following MIT-licensed
|
|
4
|
+
projects. The adapted code is limited to skill package enumeration, stable
|
|
5
|
+
content fingerprints, safe copying, and isolated provider wiring.
|
|
6
|
+
|
|
7
|
+
The independent Markdown preview also bundles the upstream `markdown-it`
|
|
8
|
+
15.0.3 browser ESM distribution. Its license and the bundled dependency
|
|
9
|
+
licenses are in `web/vendor/markdown-it-LICENSE.txt`.
|
|
10
|
+
|
|
11
|
+
## dsh-mode-skills
|
|
12
|
+
|
|
13
|
+
- Source: <https://github.com/xiaohai-78/dsh-mode-skills>
|
|
14
|
+
- Revision: `706595127984c9bc87627f77d2a8e288b8dcbbbb`
|
|
15
|
+
- Used for: package file limits, frontmatter parsing, link containment,
|
|
16
|
+
fingerprints, and copy verification in `src/skill-package.js`.
|
|
17
|
+
|
|
18
|
+
MIT License
|
|
19
|
+
|
|
20
|
+
Copyright (c) 2026 xiaohai-78
|
|
21
|
+
|
|
22
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
23
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
24
|
+
in the Software without restriction, including without limitation the rights
|
|
25
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
26
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
27
|
+
furnished to do so, subject to the following conditions:
|
|
28
|
+
|
|
29
|
+
The above copyright notice and this permission notice shall be included in all
|
|
30
|
+
copies or substantial portions of the Software.
|
|
31
|
+
|
|
32
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
33
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
34
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
35
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
36
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
37
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
38
|
+
SOFTWARE.
|
|
39
|
+
|
|
40
|
+
## dsh-skill-import
|
|
41
|
+
|
|
42
|
+
- Source: <https://github.com/Trank-DTK/dsh-skill-import>
|
|
43
|
+
- Revision: `68b56106e232aa15e206483d184150b144c13180`
|
|
44
|
+
- Used for: the isolated `FileSystemSkillProvider` registration pattern that
|
|
45
|
+
lets a plugin supply skills from its own DSH-private directory.
|
|
46
|
+
|
|
47
|
+
MIT License
|
|
48
|
+
|
|
49
|
+
Copyright (c) 2026 dsh-skill-import contributors
|
|
50
|
+
|
|
51
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
52
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
53
|
+
in the Software without restriction, including without limitation the rights
|
|
54
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
55
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
56
|
+
furnished to do so, subject to the following conditions:
|
|
57
|
+
|
|
58
|
+
The above copyright notice and this permission notice shall be included in all
|
|
59
|
+
copies or substantial portions of the Software.
|
|
60
|
+
|
|
61
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
62
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
63
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
64
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
65
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
66
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
67
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wwwfz/dsh-agent-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Standalone DeepSeek Harness plugin for live local agent discovery, context import, and Markdown handoff export.",
|
|
5
5
|
"keywords": ["dsh", "dsh-plugin", "deepseek-harness", "agent", "handoff", "skills"],
|
|
6
6
|
"repository": { "type": "git", "url": "git+https://github.com/wfz2006/dsh-agent-bridge.git" },
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
16
16
|
"./package.json": "./package.json"
|
|
17
17
|
},
|
|
18
|
-
"files": ["src", "web", "cordis.patch.yml", "README.md"],
|
|
18
|
+
"files": ["src", "web", "cordis.patch.yml", "README.md", "THIRD_PARTY_NOTICES.md"],
|
|
19
19
|
"engines": { "node": ">=22.13" },
|
|
20
20
|
"scripts": {
|
|
21
21
|
"test": "node --disable-warning=ExperimentalWarning --test",
|
package/src/assets.js
CHANGED
|
@@ -7,6 +7,7 @@ const MAX_ASSET_BYTES = 96 * 1024;
|
|
|
7
7
|
const MAX_ASSETS_PER_ROOT = 320;
|
|
8
8
|
const proof = Symbol('asset location');
|
|
9
9
|
const sensitiveName = /(?:^|[._ -])(?:api[-_ ]?keys?|access[-_ ]?tokens?|auth|credentials?|passwords?|secrets?|oauth)(?:[._ -]|$)/i;
|
|
10
|
+
const openableReference = /\.(?:md|markdown|mdx|txt|rst|log|csv|tsv|jsonc?|ya?ml|toml|xml|css|tsx?|jsx|rs|go|java|kt|cs|c|cc|cpp|h|hh|hpp|swift|sql|pdf|png|jpe?g|gif|webp)$/i;
|
|
10
11
|
const hubFolders = ['决策', '经验', '资料', '交接', '笔记'];
|
|
11
12
|
const agentHomes = {
|
|
12
13
|
antigravity: ['.gemini/antigravity', '.gemini/antigravity-cli'],
|
|
@@ -55,6 +56,10 @@ function sameFile(first, second) {
|
|
|
55
56
|
return first.dev === second.dev && first.ino === second.ino;
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
function sourceChanged(message) {
|
|
60
|
+
return Object.assign(new Error(message), { code: 'ASSET_SOURCE_CHANGED' });
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
async function directory(file) {
|
|
59
64
|
if (typeof file !== 'string' || !path.isAbsolute(file) || file === path.parse(file).root) return null;
|
|
60
65
|
try {
|
|
@@ -76,36 +81,88 @@ async function children(root, child = '.') {
|
|
|
76
81
|
}
|
|
77
82
|
}
|
|
78
83
|
|
|
79
|
-
async function
|
|
84
|
+
async function locateSource(file, root) {
|
|
85
|
+
if (typeof file !== 'string' || !path.isAbsolute(file)
|
|
86
|
+
|| typeof root !== 'string' || !path.isAbsolute(root)) {
|
|
87
|
+
throw sourceChanged('Asset source is not an absolute path');
|
|
88
|
+
}
|
|
80
89
|
const resolved = await realpath(file);
|
|
81
90
|
if (!inside(root, resolved) || canonicalKey(file) !== canonicalKey(resolved)) {
|
|
82
|
-
throw
|
|
91
|
+
throw sourceChanged('Asset path changed or is outside its source root');
|
|
92
|
+
}
|
|
93
|
+
const directory = path.dirname(file);
|
|
94
|
+
const resolvedDirectory = await realpath(directory);
|
|
95
|
+
if (!inside(root, resolvedDirectory) || canonicalKey(directory) !== canonicalKey(resolvedDirectory)) {
|
|
96
|
+
throw sourceChanged('Asset directory changed or is outside its source root');
|
|
97
|
+
}
|
|
98
|
+
const directoryInfo = await lstat(directory, { bigint: true });
|
|
99
|
+
if (!directoryInfo.isDirectory() || directoryInfo.isSymbolicLink()) {
|
|
100
|
+
throw sourceChanged('Asset directory is not a regular directory');
|
|
83
101
|
}
|
|
84
102
|
const info = await lstat(file, { bigint: true });
|
|
85
|
-
if (!info.isFile() || info.nlink > 1n) throw
|
|
86
|
-
return info;
|
|
103
|
+
if (!info.isFile() || info.nlink > 1n) throw sourceChanged('Asset is not a regular, unlinked file');
|
|
104
|
+
return { root, file, directory, fileInfo: info, directoryInfo };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export async function authorizeProjectReference(root, documentFile, href) {
|
|
108
|
+
let relative;
|
|
109
|
+
try { relative = decodeURIComponent(href.split(/[?#]/, 1)[0]); } catch { /* Invalid URL encoding. */ }
|
|
110
|
+
if (!relative || /^[\/]/.test(relative) || /[\\:\u0000-\u001f]/.test(relative)) {
|
|
111
|
+
return { path: href, error: '文件链接格式无效。' };
|
|
112
|
+
}
|
|
113
|
+
const target = path.resolve(path.dirname(documentFile), relative);
|
|
114
|
+
if (!inside(root, documentFile) || !inside(root, target)) {
|
|
115
|
+
return { path: target, error: '文件不在项目范围内。' };
|
|
116
|
+
}
|
|
117
|
+
const name = path.basename(target);
|
|
118
|
+
if (sensitiveName.test(name)) {
|
|
119
|
+
return { path: target, error: '当前文件类型无法从正文链接打开。' };
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
const revealOnly = !openableReference.test(name);
|
|
123
|
+
return { path: target, authorization: await locateSource(target, root), revealOnly };
|
|
124
|
+
} catch {
|
|
125
|
+
return { path: target, error: '文件已移动、不可访问或指向项目范围外。' };
|
|
126
|
+
}
|
|
87
127
|
}
|
|
88
128
|
|
|
89
129
|
async function recordAsset(root, file, meta) {
|
|
90
130
|
try {
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
|
|
131
|
+
const source = await locateSource(file, root);
|
|
132
|
+
const { fileInfo } = source;
|
|
133
|
+
const revision = `${fileInfo.ino}:${fileInfo.mtimeNs}:${fileInfo.size}`;
|
|
134
|
+
return { ...meta, file, revision, [proof]: source };
|
|
94
135
|
} catch {
|
|
95
136
|
return null;
|
|
96
137
|
}
|
|
97
138
|
}
|
|
98
139
|
|
|
99
|
-
export async function
|
|
140
|
+
export async function verifyAssetSource(item) {
|
|
100
141
|
const source = item?.[proof];
|
|
101
|
-
if (!source || source.file !== item.file) throw
|
|
102
|
-
|
|
103
|
-
|
|
142
|
+
if (!source || source.file !== item.file) throw sourceChanged('Asset source is unavailable');
|
|
143
|
+
return verifySourceAuthorization(source);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export async function verifySourceAuthorization(authorization) {
|
|
147
|
+
if (!authorization || typeof authorization !== 'object') throw sourceChanged('Asset authorization is unavailable');
|
|
148
|
+
const current = await locateSource(authorization.file, authorization.root);
|
|
149
|
+
if (!sameFile(authorization.fileInfo, current.fileInfo)
|
|
150
|
+
|| !sameFile(authorization.directoryInfo, current.directoryInfo)) {
|
|
151
|
+
throw sourceChanged('Asset changed since discovery');
|
|
152
|
+
}
|
|
153
|
+
return current;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export async function readAsset(item) {
|
|
157
|
+
const source = await verifyAssetSource(item);
|
|
104
158
|
const handle = await open(source.file, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
105
159
|
try {
|
|
106
160
|
const opened = await handle.stat({ bigint: true });
|
|
107
|
-
const confirmed = await
|
|
108
|
-
if (!sameFile(
|
|
161
|
+
const confirmed = await verifySourceAuthorization(source);
|
|
162
|
+
if (!sameFile(source.fileInfo, opened) || !sameFile(source.directoryInfo, confirmed.directoryInfo)
|
|
163
|
+
|| !sameFile(opened, confirmed.fileInfo)) {
|
|
164
|
+
throw new Error('Asset changed while opening');
|
|
165
|
+
}
|
|
109
166
|
const bytes = Buffer.alloc(MAX_ASSET_BYTES + 1);
|
|
110
167
|
let length = 0;
|
|
111
168
|
while (length < bytes.length) {
|