@michengai/dsh-codex-pet 0.1.1 → 0.1.2

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.zh-CN.md CHANGED
@@ -1,210 +1,220 @@
1
- <p align="center">
2
- <img src="assets/branding/dsh-codex-pet-banner.png" alt="DSH Codex Pet:任务在跑,宠物相伴" width="100%">
3
- </p>
4
-
5
- <div align="center">
6
-
7
- # DSH Codex Pet
8
-
9
- **任务在跑,宠物相伴。让 DeepSeek Harness 的任务进展触手可及。**
10
-
11
- [English](README.md) · [界面预览](#界面预览) · [功能概览](#功能概览) · [安装](#安装) · [使用](#使用) · [开发](#开发) · [更新日志](CHANGELOG.zh-CN.md)
12
-
13
- [![DSH Web Plugin](https://img.shields.io/badge/DSH%20Web-Plugin-0f766e.svg)](https://github.com/deepseek-ai/deepseek-harness)
14
- [![Node.js 22.19+](https://img.shields.io/badge/Node.js-22.19%2B-339933.svg?logo=node.js&logoColor=white)](https://nodejs.org/)
15
- [![开发预览版](https://img.shields.io/badge/Status-Development%20preview-d97706.svg)](#验证与当前边界)
16
-
17
- </div>
18
-
19
- DSH Codex Pet 为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 提供宠物库、任务通知和基于 Skill 的宠物创建功能。全部 9 只 Codex 内置宠物图集随插件提供,使用人员无需安装 Codex。
20
-
21
- ## 功能概览
22
-
23
- - **9 只内置宠物**:在宠物设置中选择伙伴、调整大小,资源随插件本地打包。
24
- - **页内陪伴**:插件在 DSH Web 页面内显示宠物,并提供消费者接口;外部宿主自行适配窗口与 IPC。
25
- - **多会话动态**:查看运行中、完成、错误和待处理请求;没有通知时只显示宠物。
26
- - **就近处理任务**:从通知打开对应会话、停止当前轮次,或处理支持的审批、问题和计划请求。
27
- - **按需安静**:关闭单条提醒不会停止任务;通过菜单或设置收起、恢复宠物。
28
- - **创建自己的伙伴**:在设置中描述宠物,通过随包 `hatch-pet` Skill 发起独立 DSH 创建任务。
29
- - **轻量互动**:拖动移动、双击跳跃、右键打开宠物菜单。
30
-
31
- ## 界面预览
32
-
33
- ### 多会话提醒
34
-
35
- 宠物旁集中展示运行中的任务,可分别打开会话、停止当前轮次或关闭提醒。
36
-
37
- <p align="center">
38
- <img src="assets/screenshots/pet-notifications.png" alt="宠物与两条运行中的任务通知" width="403">
39
- </p>
40
-
41
- ### 宠物设置
42
-
43
- 选择 9 只内置宠物、打开自定义宠物目录,并调整宠物大小。
44
-
45
- ![宠物库与外观设置](assets/screenshots/pet-settings.png)
46
-
47
- ### 会话内陪伴
48
-
49
- 在 DSH 中继续工作,宠物和任务通知显示在页面角落。
50
-
51
- ![DSH 会话中的宠物与任务通知](assets/screenshots/pet-conversation.png)
52
-
53
- ## DSH 产品生态
54
-
55
- 为已有 DeepSeek Harness 环境按需安装插件;外部消费者可独立接入宠物接口。
56
-
57
- | 插件 | 你可以用它做什么 |
58
- | --- | --- |
59
- | [Codex UI](https://github.com/MichengAI/dsh-codex-ui) | 整理项目与会话,导航任务 |
60
- | [IM Connect](https://github.com/MichengAI/dsh-im-connect) | 从消息平台下任务、收回复 |
61
- | [Automation](https://github.com/MichengAI/dsh-automation) | 按计划执行任务,查看运行结果 |
62
- | [Skills Manager](https://github.com/MichengAI/dsh-skills-manager) | 查找、启停、创建和导入本机技能 |
63
- | [Archive Manager](https://github.com/MichengAI/dsh-archive-manager) | 搜索、恢复和管理已归档会话 |
64
- | [Agency Agents](https://github.com/MichengAI/dsh-agency-agents) | 为任务选择专业角色 |
65
- | [BTW](https://github.com/MichengAI/dsh-btw) | 在当前上下文中临时旁问 |
66
- | [Simplify](https://github.com/MichengAI/dsh-simplify) | 整理 Git 改动范围内的代码 |
67
- | [Codex Pet](https://github.com/MichengAI/dsh-codex-pet) | 宠物陪伴,查看和处理任务通知 |
68
-
69
- ## 前置条件
70
-
71
- - 已安装 DeepSeek Harness,可使用 Web 界面和 `dsh` 命令。
72
- - 从源码构建需要 **Node.js 22.19 或更高版本**。
73
- - 创建自定义宠物需要在 DSH 中配置可用的图像生成工具。
74
-
75
- ## 安装
76
-
77
- 兼容要求:宿主必须提供 `locale` 客户端服务,并支持函数形式的 `settings.section` 标签。本地契约核验使用 `@deepseek-ai/cordis 4.0.2`、`@deepseek-ai/dsh-client-locale 0.1.2-rc.1` 及社区 DSH Codex UI 设置实现。这些是已核验组件版本,不代表已经验证的最低 DSH 版本;不支持缺少 locale 服务的宿主。
78
-
79
- 自动更新命令使用 `--config.minimumReleaseAge=0`,以便立即安装刚发布的版本;该参数仅对本次安装跳过 pnpm 的发布时间等待,不改写全局配置。包名、npm registry 和解析后的版本仍由服务端固定。
80
-
81
- v0.1.1 安装包包含本文描述的设置、本地化、npm 更新器和消费者接口改动,详见[更新日志](CHANGELOG.zh-CN.md)。
82
-
83
- 当前版本为 **0.1.1**,通过 [npm](https://www.npmjs.com/package/@michengai/dsh-codex-pet) 安装;版本记录见 [GitHub Releases](https://github.com/MichengAI/dsh-codex-pet/releases)。以下命令使用 `web` profile,请按实际环境替换。
84
-
85
- 执行 `dsh plugin --profile web add @michengai/dsh-codex-pet@latest --registry=https://registry.npmjs.org/ --ignore-scripts`,然后重新加载 DSH。也可按下面的步骤从源码构建。
86
-
87
- ### 让 Agent 帮你安装
88
-
89
- ```text
90
- 请从我的本地源码目录将 DSH Codex Pet 安装到 DSH 的 web profile。在源码目录依次执行 npm ci、npm run check、npm test 和 npm pack。检查通过后,执行 dsh plugin --profile web add .\michengai-dsh-codex-pet-0.1.1.tgz --ignore-scripts 安装生成的包,再执行 dsh --profile web --dump-config,确认包含 michengai-codex-pet。说明如何重新加载 DSH 并打开宠物设置,保留已有任务和用户数据。
91
- ```
92
-
93
- ### 手动构建并安装
94
-
95
- 在项目根目录执行:
96
-
97
- ```powershell
98
- [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
99
- $OutputEncoding = [System.Text.Encoding]::UTF8
100
-
101
- npm ci
102
- npm run check
103
- npm test
104
- npm pack
105
- dsh plugin --profile web add .\michengai-dsh-codex-pet-0.1.1.tgz --ignore-scripts
106
- dsh --profile web --dump-config
107
- ```
108
-
109
- 任一步骤失败时先停止并解决错误。`npm pack` 会构建插件并检查 9 只图集和创建 Skill,生成的安装包包含运行所需资源。
110
-
111
- ### 重新加载
112
-
113
- 等待正在执行的任务结束后,重启对应 DSH Web 服务并刷新页面。仅刷新浏览器不能替换已经加载的 Host 模块。
114
-
115
- ## 使用
116
-
117
- 打开 **设置 → 宠物**,也可从宠物右键菜单打开设置。
118
-
119
- | 目标 | 操作 |
120
- | --- | --- |
121
- | 选择伙伴 | 在设置中选择宠物并调整大小。 |
122
- | 移动与互动 | 拖动宠物移动,双击跳跃。 |
123
- | 查看任务动态 | 阅读通知气泡;多个任务需要关注时展开列表。 |
124
- | 继续会话 | 点击通知或回复按钮,打开对应的 DSH 任务。 |
125
- | 处理请求 | 展开请求详情,处理支持的审批、问题或计划。 |
126
- | 停止任务轮次 | 点击对应运行中通知的停止按钮。 |
127
- | 关闭提醒 | 点击通知关闭按钮,任务仍继续运行。 |
128
- | 收起或恢复宠物 | 使用右键菜单或宠物设置。 |
129
-
130
- 宠物承担通知和待处理操作。新建会话、输入后续消息仍在 DSH 主界面完成。
131
-
132
- ### 创建自定义宠物
133
-
134
- 1. 打开宠物设置,点击 **创建**,描述想要的伙伴。
135
- 2. 点击 **在 DSH 中创建**,插件会打开独立任务并发送随包 Skill 指令。
136
- 3. 在该任务中查看进展,创建使用 DSH 当前配置的模型和图像工具。
137
- 4. 宠物文件生成并保存后,刷新宠物库并选择新伙伴。
138
-
139
- 随包 `skills/hatch-pet/SKILL.md` 已针对 DSH 和兼容图集格式适配,创建流程不调用 Codex CLI。缺少生图工具时需要先完善 DSH 配置;成功打开创建任务不等于宠物已经生成。
140
-
141
- ## 数据与资源
142
-
143
- - 内置图集:`assets/codex/`,随插件提供。
144
- - 自定义宠物:`${DSH_HOME}\codex-pet\pets`;未设置 `DSH_HOME` 时,以用户目录下的 `.dsh` 为基础目录。
145
- - 不自动读取、移动或迁移原有 Codex 宠物。
146
- - 卸载插件会保留自定义宠物文件和配置。
147
-
148
- 插件代码独立实现、由社区维护。随包 Codex 宠物图集来源于 Codex,并非本项目原创素材。本项目不是 OpenAI 或 DeepSeek 官方产品。
149
-
150
- ## 插件更新
151
-
152
- 宠物设置页显示当前运行版本、GitHub 和问题反馈链接,以及**检查更新**入口。更新器查询 npm,通过已验证的 DSH CLI 安装到当前 profile;npm 尚未发布时会明确提示。宿主不支持在线安装时,可复制手动更新命令。请等待任务结束后更新,并按提示重新加载 DSH。
153
-
154
- ## 卸载
155
-
156
- ```powershell
157
- [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
158
- $OutputEncoding = [System.Text.Encoding]::UTF8
159
-
160
- dsh plugin --profile web remove @michengai/dsh-codex-pet
161
- ```
162
-
163
- 完成后重新加载 DSH。切换版本时保留 DSH 数据目录。
164
-
165
- ## 开发
166
-
167
- ```powershell
168
- [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
169
- $OutputEncoding = [System.Text.Encoding]::UTF8
170
-
171
- npm ci
172
- npm run check
173
- npm test
174
- npm run build
175
- ```
176
-
177
- - `src/`:Host 服务、宠物设置、动画和任务通知。
178
- - `skills/`:随包宠物创建 Skill。
179
- - `test/`:宠物库、创建和通知回归测试。
180
- - `scripts/`:构建、资源维护、安装包校验和隔离 Electron smoke 检查。
181
- - `lib/`:生成的运行产物,修改源码应在 `src/` 中进行。
182
-
183
- 项目不提供独立 HTML 预览页或原生窗口入口,请在 DSH 内验证。`assets:import` 仅供维护者更新原始资源,使用者安装时无需执行。
184
-
185
- 使用 CodeGraph 时,首次运行 `codegraph init .`,修改后运行 `codegraph sync .`,通过 `codegraph status .` 检查索引新鲜度。索引与 `docs/` 下的本地项目文档均不纳入 Git。
186
-
187
- ## 验证与当前边界
188
-
189
- 类型检查、25 项自动化测试、构建和受控浏览器客户端交互验证已通过,覆盖任务通知和创建请求流程。完整图像生成、真实模型任务联动及真实 npm 更新仍待端到端验收。
190
-
191
-
192
-
193
- ## 浏览器冒烟测试
194
-
195
- 执行 `npm ci` 后,运行 `npx playwright install chromium`,再执行 `npm run smoke`。Playwright 是本项目的开发依赖,测试使用无头 Chromium 和独立系统临时目录,测试进程退出后自动清理;不需要 Electron、相邻仓库、`.preview` 或 docs 输出。
196
-
197
- ## 消费者接口 v1
198
-
199
- 插件在 DSH 页面提供 `window.dshPet`,发布 `dsh-pet-ready` / `dsh-pet-disposed` 事件。消费者主动订阅和展示,插件不导入或探测消费者。旧原生窗口路由与窗口桥接已移除,已有原生适配需迁移到此接口。
200
-
201
- | 方法 | 约定 |
202
- | --- | --- |
203
- | `getSnapshot()` | 返回独立副本 `{pet, config, language, notifications}`;未加载或卸载后为 `null`。宠物资源相对 URL 按 DSH 页面 origin 解析。 |
204
- | `subscribe(listener)` | 内容变化时通知,卸载时收到 `null`;返回退订函数。初始状态另行调用 getSnapshot。 |
205
- | `command(value)` | 执行通知操作:open、stop、dismiss、restore、approve、reject、answer、sort。目标操作携带当前通知 id、token;请求回答另带 requestKey。校验和拒绝由插件执行。 |
206
- | `updateConfig(value)` | 通过现有 Host 校验接口更新宠物设置。 |
207
- | `openSettings()` | 在 DSH 打开宠物设置。 |
208
- | `acquireDisplay()` | 暂时隐藏页内浮层,返回幂等释放函数。消费者断开时必须释放,所有接管者释放后恢复页内显示,不改持久化可见性配置。 |
209
-
210
- 消费者负责自身渲染器、原生窗口、IPC 校验和断开清理;接口不携带原生窗口实现。用户标题、问题与回答选项保持原文,language 字段提供显示语言。
1
+ <p align="center">
2
+ <img src="assets/branding/dsh-codex-pet-banner.png" alt="DSH Codex Pet:任务在跑,宠物相伴" width="100%">
3
+ </p>
4
+
5
+ <div align="center">
6
+
7
+ # DSH Codex Pet
8
+
9
+ **任务在跑,宠物相伴。让 DeepSeek Harness 的任务进展触手可及。**
10
+
11
+ [English](README.md) · [界面预览](#界面预览) · [功能概览](#功能概览) · [安装](#安装) · [使用](#使用) · [开发](#开发) · [更新日志](CHANGELOG.zh-CN.md)
12
+
13
+ [![DSH Web Plugin](https://img.shields.io/badge/DSH%20Web-Plugin-0f766e.svg)](https://github.com/deepseek-ai/deepseek-harness)
14
+ [![Node.js 22.19+](https://img.shields.io/badge/Node.js-22.19%2B-339933.svg?logo=node.js&logoColor=white)](https://nodejs.org/)
15
+ [![开发预览版](https://img.shields.io/badge/Status-Development%20preview-d97706.svg)](#验证与当前边界)
16
+
17
+ </div>
18
+
19
+ DSH Codex Pet 为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 提供宠物库、任务通知和基于 Skill 的宠物创建功能。全部 9 只 Codex 内置宠物图集随插件提供,使用人员无需安装 Codex。
20
+
21
+ ## 功能概览
22
+
23
+ - **9 只内置宠物**:在宠物设置中选择伙伴、调整大小,资源随插件本地打包。
24
+ - **页内陪伴**:插件在 DSH Web 页面内显示宠物,并提供消费者接口;外部宿主自行适配窗口与 IPC。
25
+ - **多会话动态**:查看运行中、完成、错误和待处理请求;没有通知时只显示宠物。
26
+ - **就近处理任务**:从通知打开对应会话、停止当前轮次,或处理支持的审批、问题和计划请求。
27
+ - **按需安静**:关闭单条提醒不会停止任务;通过菜单或设置收起、恢复宠物。
28
+ - **创建自己的伙伴**:在设置中描述宠物,通过随包 `hatch-pet` Skill 发起独立 DSH 创建任务。
29
+ - **轻量互动**:拖动移动、双击跳跃、右键打开宠物菜单。
30
+
31
+ ## 界面预览
32
+
33
+ ### 多会话提醒
34
+
35
+ 宠物旁集中展示运行中的任务,可分别打开会话、停止当前轮次或关闭提醒。
36
+
37
+ <p align="center">
38
+ <img src="assets/screenshots/pet-notifications.png" alt="宠物与两条运行中的任务通知" width="403">
39
+ </p>
40
+
41
+ ### 宠物设置
42
+
43
+ 选择 9 只内置宠物、打开自定义宠物目录,并调整宠物大小。
44
+
45
+ ![宠物库与外观设置](assets/screenshots/pet-settings.png)
46
+
47
+ ### 会话内陪伴
48
+
49
+ 在 DSH 中继续工作,宠物和任务通知显示在页面角落。
50
+
51
+ ![DSH 会话中的宠物与任务通知](assets/screenshots/pet-conversation.png)
52
+
53
+ ## DSH 产品生态
54
+
55
+ 为已有 DeepSeek Harness 环境按需安装插件;外部消费者可独立接入宠物接口。
56
+
57
+ | 插件 | 你可以用它做什么 |
58
+ | --- | --- |
59
+ | [Codex UI](https://github.com/MichengAI/dsh-codex-ui) | 整理项目与会话,导航任务 |
60
+ | [IM Connect](https://github.com/MichengAI/dsh-im-connect) | 从消息平台下任务、收回复 |
61
+ | [Automation](https://github.com/MichengAI/dsh-automation) | 按计划执行任务,查看运行结果 |
62
+ | [Skills Manager](https://github.com/MichengAI/dsh-skills-manager) | 查找、启停、创建和导入本机技能 |
63
+ | [Archive Manager](https://github.com/MichengAI/dsh-archive-manager) | 搜索、恢复和管理已归档会话 |
64
+ | [Agency Agents](https://github.com/MichengAI/dsh-agency-agents) | 为任务选择专业角色 |
65
+ | [BTW](https://github.com/MichengAI/dsh-btw) | 在当前上下文中临时旁问 |
66
+ | [Simplify](https://github.com/MichengAI/dsh-simplify) | 整理 Git 改动范围内的代码 |
67
+ | [Codex Pet](https://github.com/MichengAI/dsh-codex-pet) | 宠物陪伴,查看和处理任务通知 |
68
+
69
+ ## 前置条件
70
+
71
+ - 已安装 DeepSeek Harness,可使用 Web 界面和 `dsh` 命令。
72
+ - 从源码构建需要 **Node.js 22.19 或更高版本**。
73
+ - 创建自定义宠物需要在 DSH 中配置可用的图像生成工具。
74
+
75
+ ## 安装
76
+
77
+ 兼容要求:宿主必须提供 `locale` 客户端服务,并支持函数形式的 `settings.section` 标签。本地契约核验使用 `@deepseek-ai/cordis 4.0.2`、`@deepseek-ai/dsh-client-locale 0.1.2-rc.1` 及社区 DSH Codex UI 设置实现。这些是已核验组件版本,不代表已经验证的最低 DSH 版本;不支持缺少 locale 服务的宿主。
78
+
79
+ 自动更新命令使用 `--config.minimumReleaseAge=0`,以便立即安装刚发布的版本;该参数仅对本次安装跳过 pnpm 的发布时间等待,不改写全局配置。包名、npm registry 和解析后的版本仍由服务端固定。
80
+
81
+ v0.1.2 安装包包含本文描述的设置、本地化、npm 更新器和消费者接口改动,详见[更新日志](CHANGELOG.zh-CN.md)。
82
+
83
+ 当前版本为 **0.1.2**,通过 [npm](https://www.npmjs.com/package/@michengai/dsh-codex-pet) 安装;版本记录见 [GitHub Releases](https://github.com/MichengAI/dsh-codex-pet/releases)。以下命令使用 `web` profile,请按实际环境替换。
84
+
85
+ 执行 `dsh plugin --profile web add @michengai/dsh-codex-pet@latest --registry=https://registry.npmjs.org/ --ignore-scripts`,然后重新加载 DSH。也可按下面的步骤从源码构建。
86
+
87
+ ### 让 Agent 帮你安装
88
+
89
+ ```text
90
+ 请从我的本地源码目录将 DSH Codex Pet 安装到 DSH 的 web profile。在源码目录依次执行 npm ci、npm run check、npm test 和 npm pack。检查通过后,执行 dsh plugin --profile web add .\michengai-dsh-codex-pet-0.1.2.tgz --ignore-scripts 安装生成的包,再执行 dsh --profile web --dump-config,确认包含 michengai-codex-pet。说明如何重新加载 DSH 并打开宠物设置,保留已有任务和用户数据。
91
+ ```
92
+
93
+ ### 手动构建并安装
94
+
95
+ 在项目根目录执行:
96
+
97
+ ```powershell
98
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
99
+ $OutputEncoding = [System.Text.Encoding]::UTF8
100
+
101
+ npm ci
102
+ npm run check
103
+ npm test
104
+ npm pack
105
+ dsh plugin --profile web add .\michengai-dsh-codex-pet-0.1.2.tgz --ignore-scripts
106
+ dsh --profile web --dump-config
107
+ ```
108
+
109
+ 任一步骤失败时先停止并解决错误。`npm pack` 会构建插件并检查 9 只图集和创建 Skill,生成的安装包包含运行所需资源。
110
+
111
+ ### 重新加载
112
+
113
+ 等待正在执行的任务结束后,重启对应 DSH Web 服务并刷新页面。仅刷新浏览器不能替换已经加载的 Host 模块。
114
+
115
+ ## 使用
116
+
117
+ 打开 **设置 → 宠物**,也可从宠物右键菜单打开设置。
118
+
119
+ | 目标 | 操作 |
120
+ | --- | --- |
121
+ | 选择伙伴 | 在设置中选择宠物并调整大小。 |
122
+ | 移动与互动 | 拖动宠物移动,双击跳跃。 |
123
+ | 查看任务动态 | 阅读通知气泡;多个任务需要关注时展开列表。 |
124
+ | 继续会话 | 点击通知或回复按钮,打开对应的 DSH 任务。 |
125
+ | 处理请求 | 展开请求详情,处理支持的审批、问题或计划。 |
126
+ | 停止任务轮次 | 点击对应运行中通知的停止按钮。 |
127
+ | 关闭提醒 | 点击通知关闭按钮,任务仍继续运行。 |
128
+ | 收起或恢复宠物 | 使用右键菜单或宠物设置。 |
129
+
130
+ 宠物承担通知和待处理操作。新建会话、输入后续消息仍在 DSH 主界面完成。
131
+
132
+ ### 创建自定义宠物
133
+
134
+ 1. 打开宠物设置,点击 **创建**,描述想要的伙伴。
135
+ 2. 点击 **在 DSH 中创建**,插件会打开独立任务并发送随包 Skill 指令。
136
+ 3. 在该任务中查看进展,创建使用 DSH 当前配置的模型和图像工具。
137
+ 4. 宠物文件生成并保存后,刷新宠物库并选择新伙伴。
138
+
139
+ 随包 `skills/hatch-pet/SKILL.md` 已针对 DSH 和兼容图集格式适配,创建流程不调用 Codex CLI。缺少生图工具时需要先完善 DSH 配置;成功打开创建任务不等于宠物已经生成。
140
+
141
+ ## 数据与资源
142
+
143
+ - 内置图集:`assets/codex/`,随插件提供。
144
+ - 自定义宠物:`${DSH_HOME}\codex-pet\pets`;未设置 `DSH_HOME` 时,以用户目录下的 `.dsh` 为基础目录。
145
+ - 不自动读取、移动或迁移原有 Codex 宠物。
146
+ - 卸载插件会保留自定义宠物文件和配置。
147
+
148
+ 插件代码独立实现、由社区维护。随包 Codex 宠物图集来源于 Codex,并非本项目原创素材。本项目不是 OpenAI 或 DeepSeek 官方产品。
149
+
150
+ 原创插件代码采用与同系列插件一致的 [Apache-2.0 许可证](LICENSE)。第三方宠物素材不属于本项目授予的许可范围,详见 [NOTICE](NOTICE)。
151
+
152
+ ## 插件更新
153
+
154
+ 宠物设置页显示当前运行版本、GitHub 和问题反馈链接,以及**检查更新**入口。更新器查询 npm,通过已验证的 DSH CLI 安装到当前 profile;npm 尚未发布时会明确提示。宿主不支持在线安装时,可复制手动更新命令。请等待任务结束后更新,并按提示重新加载 DSH。
155
+
156
+ ## 卸载
157
+
158
+ ```powershell
159
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
160
+ $OutputEncoding = [System.Text.Encoding]::UTF8
161
+
162
+ dsh plugin --profile web remove @michengai/dsh-codex-pet
163
+ ```
164
+
165
+ 完成后重新加载 DSH。切换版本时保留 DSH 数据目录。
166
+
167
+ ## 开发
168
+
169
+ ```powershell
170
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
171
+ $OutputEncoding = [System.Text.Encoding]::UTF8
172
+
173
+ npm ci
174
+ npm run check
175
+ npm test
176
+ npm run build
177
+ ```
178
+
179
+ - `src/`:Host 服务、宠物设置、动画和任务通知。
180
+ - `skills/`:随包宠物创建 Skill。
181
+ - `test/`:宠物库、创建和通知回归测试。
182
+ - `scripts/`:构建、资源维护、安装包校验和隔离 Electron smoke 检查。
183
+ - `lib/`:生成的运行产物,修改源码应在 `src/` 中进行。
184
+
185
+ 项目不提供独立 HTML 预览页或原生窗口入口,请在 DSH 内验证。`assets:import` 仅供维护者更新原始资源,使用者安装时无需执行。
186
+
187
+ 使用 CodeGraph 时,首次运行 `codegraph init .`,修改后运行 `codegraph sync .`,通过 `codegraph status .` 检查索引新鲜度。索引与 `docs/` 下的本地项目文档均不纳入 Git。
188
+
189
+ ## 验证与当前边界
190
+
191
+ 类型检查、25 项自动化测试、构建和受控浏览器客户端交互验证已通过,覆盖任务通知和创建请求流程。完整图像生成、真实模型任务联动及真实 npm 更新仍待端到端验收。
192
+
193
+
194
+
195
+ ## 浏览器冒烟测试
196
+
197
+ 执行 `npm ci` 后,运行 `npx playwright install chromium`,再执行 `npm run smoke`。Playwright 是本项目的开发依赖,测试使用无头 Chromium 和独立系统临时目录,测试进程退出后自动清理;不需要 Electron、相邻仓库、`.preview` 或 docs 输出。
198
+
199
+ ## 消费者接口 v1
200
+
201
+ 插件在 DSH 页面提供 `window.dshPet`,发布 `dsh-pet-ready` / `dsh-pet-disposed` 事件。消费者主动订阅和展示,插件不导入或探测消费者。旧原生窗口路由与窗口桥接已移除,已有原生适配需迁移到此接口。
202
+
203
+ | 方法 | 约定 |
204
+ | --- | --- |
205
+ | `getSnapshot()` | 返回独立副本 `{pet, config, language, notifications}`;未加载或卸载后为 `null`。宠物资源相对 URL 按 DSH 页面 origin 解析。 |
206
+ | `subscribe(listener)` | 内容变化时通知,卸载时收到 `null`;返回退订函数。初始状态另行调用 getSnapshot。 |
207
+ | `command(value)` | 执行通知操作:open、stop、dismiss、restore、approve、reject、answer、sort。目标操作携带当前通知 id、token;请求回答另带 requestKey。校验和拒绝由插件执行。 |
208
+ | `updateConfig(value)` | 通过现有 Host 校验接口更新宠物设置。 |
209
+ | `openSettings()` | 在 DSH 打开宠物设置。 |
210
+ | `acquireDisplay()` | 暂时隐藏页内浮层,返回幂等释放函数。消费者断开时必须释放,所有接管者释放后恢复页内显示,不改持久化可见性配置。 |
211
+
212
+ 消费者负责自身渲染器、原生窗口、IPC 校验和断开清理;接口不携带原生窗口实现。用户标题、问题与回答选项保持原文,language 字段提供显示语言。
213
+
214
+ ## 自动发布
215
+
216
+ GitHub Actions 在 main 推送与 PR 上运行类型检查、单元测试、Chromium 冒烟及完整包校验。推送与 package.json 一致的正式版本标签(例如 v0.1.2)后,publish.yml 重新验证并通过 npm OIDC 发布;成功后从两份 CHANGELOG 提取对应版本内容,生成中文在前、英文在后的正式 Latest Release,不附加 tgz 或校验文件。
217
+
218
+ 首次启用需在 npm 包 Settings 的 Trusted Publisher 中选择 GitHub Actions,填写组织/用户 MichengAI、仓库 dsh-codex-pet、工作流文件 publish.yml,Environment 留空。不需要 NPM_TOKEN。此 npm 端绑定必须完成后才能发布;本仓库工作流无法替 npm 创建该信任关系。
219
+
220
+ 发布前同步 package.json、package-lock.json 和双语 CHANGELOG,再提交并推送新版本标签。已发布的 npm 版本不可覆盖,修复需递增版本。CI 可通过 workflow_dispatch 手动运行,不会发布包。
package/lib/client.js CHANGED
@@ -759,7 +759,7 @@ function PluginUpdateHeader({ locale }) {
759
759
  zh2 ? "\u5BA0\u7269" : "Pets",
760
760
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dcp-version", children: [
761
761
  "v",
762
- "0.1.1"
762
+ "0.1.2"
763
763
  ] })
764
764
  ] }),
765
765
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", { className: "dcp-project-links", children: [
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
- {
2
- "name": "@michengai/dsh-codex-pet",
3
- "version": "0.1.1",
4
- "description": "独立实现的 DSH 宠物插件:Codex 原始宠物库、Skill 创建、Web 页内显示与消费者接入接口",
5
- "type": "module",
1
+ {
2
+ "name": "@michengai/dsh-codex-pet",
3
+ "version": "0.1.2",
4
+ "license": "Apache-2.0",
5
+ "description": "独立实现的 DSH 宠物插件:Codex 原始宠物库、Skill 创建、Web 页内显示与消费者接入接口",
6
+ "type": "module",
6
7
  "publishConfig": {
7
8
  "access": "public",
8
9
  "registry": "https://registry.npmjs.org/"
@@ -15,64 +16,66 @@
15
16
  "bugs": {
16
17
  "url": "https://github.com/MichengAI/dsh-codex-pet/issues"
17
18
  },
18
- "main": "lib/index.js",
19
- "exports": {
20
- ".": "./lib/index.js",
21
- "./client": "./lib/client.js",
22
- "./package.json": "./package.json"
23
- },
24
- "files": [
25
- "lib",
26
- "assets/codex/*/spritesheet.webp",
27
- "assets/branding/dsh-codex-pet-banner.png",
28
- "assets/screenshots/*.png",
29
- "skills",
30
- "cordis.patch.yml",
31
- "README.md",
32
- "README.zh-CN.md",
33
- "CHANGELOG.md",
34
- "CHANGELOG.zh-CN.md"
35
- ],
36
- "dsh": {
37
- "bundle": {
38
- "patch": "./cordis.patch.yml"
39
- },
40
- "client": {
41
- "platform": "web",
42
- "inject": [
43
- "@deepseek-ai/dsh-client-runtime",
44
- "@deepseek-ai/dsh-client-ui-slots",
45
- "@deepseek-ai/dsh-client-ui-session",
46
- "@deepseek-ai/dsh-client-locale"
47
- ]
48
- }
49
- },
50
- "scripts": {
51
- "prepack": "npm run build && tsx scripts/verify-package.ts",
52
- "build": "node scripts/build.mjs",
53
- "check": "tsc --noEmit",
54
- "test": "tsx --test test/*.test.ts",
55
- "smoke": "npm run build && node scripts/run-smoke.cjs",
56
- "assets:import": "tsx scripts/import-codex.ts"
57
- },
58
- "peerDependencies": {
59
- "react": "^18.2.0",
60
- "react-dom": "^18.2.0"
61
- },
62
- "devDependencies": {
63
- "@electron/asar": "^3.4.1",
64
- "@radix-ui/react-icons": "^1.3.2",
65
- "@types/node": "^24.0.0",
66
- "@types/react": "^18.3.0",
67
- "@types/react-dom": "^18.3.0",
68
- "esbuild": "^0.25.0",
69
- "playwright": "^1.63.0",
70
- "react": "^18.3.1",
71
- "react-dom": "^18.3.1",
72
- "tsx": "^4.20.0",
73
- "typescript": "^5.9.0"
74
- },
75
- "engines": {
76
- "node": ">=22.19.0"
77
- }
78
- }
19
+ "main": "lib/index.js",
20
+ "exports": {
21
+ ".": "./lib/index.js",
22
+ "./client": "./lib/client.js",
23
+ "./package.json": "./package.json"
24
+ },
25
+ "files": [
26
+ "LICENSE",
27
+ "NOTICE",
28
+ "lib",
29
+ "assets/codex/*/spritesheet.webp",
30
+ "assets/branding/dsh-codex-pet-banner.png",
31
+ "assets/screenshots/*.png",
32
+ "skills",
33
+ "cordis.patch.yml",
34
+ "README.md",
35
+ "README.zh-CN.md",
36
+ "CHANGELOG.md",
37
+ "CHANGELOG.zh-CN.md"
38
+ ],
39
+ "dsh": {
40
+ "bundle": {
41
+ "patch": "./cordis.patch.yml"
42
+ },
43
+ "client": {
44
+ "platform": "web",
45
+ "inject": [
46
+ "@deepseek-ai/dsh-client-runtime",
47
+ "@deepseek-ai/dsh-client-ui-slots",
48
+ "@deepseek-ai/dsh-client-ui-session",
49
+ "@deepseek-ai/dsh-client-locale"
50
+ ]
51
+ }
52
+ },
53
+ "scripts": {
54
+ "prepack": "npm run build && tsx scripts/verify-package.ts",
55
+ "build": "node scripts/build.mjs",
56
+ "check": "tsc --noEmit",
57
+ "test": "tsx --test test/*.test.ts",
58
+ "smoke": "npm run build && node scripts/run-smoke.cjs",
59
+ "assets:import": "tsx scripts/import-codex.ts"
60
+ },
61
+ "peerDependencies": {
62
+ "react": "^18.2.0",
63
+ "react-dom": "^18.2.0"
64
+ },
65
+ "devDependencies": {
66
+ "@electron/asar": "^3.4.1",
67
+ "@radix-ui/react-icons": "^1.3.2",
68
+ "@types/node": "^24.0.0",
69
+ "@types/react": "^18.3.0",
70
+ "@types/react-dom": "^18.3.0",
71
+ "esbuild": "^0.25.0",
72
+ "playwright": "^1.63.0",
73
+ "react": "^18.3.1",
74
+ "react-dom": "^18.3.1",
75
+ "tsx": "^4.20.0",
76
+ "typescript": "^5.9.0"
77
+ },
78
+ "engines": {
79
+ "node": ">=22.19.0"
80
+ }
81
+ }