@michengai/dsh-automation 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.
Files changed (44) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +9 -0
  3. package/README.md +136 -0
  4. package/README.zh-CN.md +136 -0
  5. package/cordis.patch.yml +9 -0
  6. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/00-/351/230/205/350/257/273/345/257/274/350/210/252.md +11 -0
  7. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/01-/351/241/271/347/233/256/346/246/202/350/247/210.md +22 -0
  8. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/02-/345/275/223/345/211/215/347/212/266/346/200/201.md +9 -0
  9. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/03-/345/276/205/345/212/236/344/270/216/351/230/273/345/241/236.md +7 -0
  10. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/04-/350/277/255/344/273/243/350/267/257/347/272/277/345/233/276.md +5 -0
  11. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/05-/346/212/200/346/234/257/346/236/266/346/236/204/345/237/272/347/272/277.md +10 -0
  12. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/06-/346/226/207/346/241/243/347/274/226/345/206/231/350/247/204/350/214/203.md +8 -0
  13. package/docs/01-/345/275/223/345/211/215/345/267/245/344/275/234/I001-/344/273/273/345/212/241/350/207/252/345/212/250/345/214/226/346/217/222/344/273/266/00-/350/277/255/344/273/243/346/200/273/350/247/210.md +47 -0
  14. package/docs/03-/346/212/200/346/234/257/346/236/266/346/236/204/00-/351/242/206/345/237/237/347/264/242/345/274/225.md +5 -0
  15. package/docs/03-/346/212/200/346/234/257/346/236/266/346/236/204/01-/350/260/203/345/272/246/344/270/216/346/211/247/350/241/214/346/250/241/345/236/213.md +30 -0
  16. package/lib/client.js +2792 -0
  17. package/lib/client.js.map +7 -0
  18. package/lib/index.js +22869 -0
  19. package/lib/types/client/AutomationView.d.ts +2 -0
  20. package/lib/types/client/ScheduleRail.d.ts +34 -0
  21. package/lib/types/client/contracts.d.ts +57 -0
  22. package/lib/types/client/create-modal.d.ts +30 -0
  23. package/lib/types/client/helpers.d.ts +67 -0
  24. package/lib/types/client/icons.d.ts +28 -0
  25. package/lib/types/client/index.d.ts +4 -0
  26. package/lib/types/client/locales.d.ts +187 -0
  27. package/lib/types/client/menu.d.ts +53 -0
  28. package/lib/types/client/native-session-list.d.ts +14 -0
  29. package/lib/types/client/native-tabs.d.ts +23 -0
  30. package/lib/types/client/prefill.d.ts +6 -0
  31. package/lib/types/client/protocol.d.ts +153 -0
  32. package/lib/types/client/runtime.d.ts +29 -0
  33. package/lib/types/client/schedule-rail-model.d.ts +87 -0
  34. package/lib/types/client/styles.d.ts +1 -0
  35. package/lib/types/domain.d.ts +67 -0
  36. package/lib/types/executor.d.ts +30 -0
  37. package/lib/types/index.d.ts +20 -0
  38. package/lib/types/recurrence.d.ts +7 -0
  39. package/lib/types/rpc.d.ts +13 -0
  40. package/lib/types/run-title.d.ts +3 -0
  41. package/lib/types/service.d.ts +110 -0
  42. package/lib/types/tools.d.ts +12 -0
  43. package/lib/types/types.d.ts +146 -0
  44. package/package.json +99 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,9 @@
1
+ dsh-automation
2
+ Copyright 2026 MichengAI contributors
3
+
4
+ 本项目的 TypeScript 源码、构建脚本与项目文档采用 Apache License 2.0。
5
+
6
+ 产品模型参考了 DeepSeek Harness 社区中的独立自动化实践:
7
+ - 独立 Session 调度与审计历史(titanwings/dsh-automation,MIT)
8
+
9
+ 上述参考实现的许可证与版权仍归其原作者所有;本仓库实现为独立编写,不复制其专有代码。
package/README.md ADDED
@@ -0,0 +1,136 @@
1
+ <h1 align="center">DSH Automation</h1>
2
+
3
+ <p align="center">
4
+ <strong>A DeepSeek Harness Web plugin for running standalone coding tasks on a schedule.</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/MichengAI/dsh-automation/issues">Report an issue</a>
9
+ · <a href="https://www.npmjs.com/package/@michengai/dsh-automation">View on npm</a>
10
+ · <a href="README.zh-CN.md">简体中文</a>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="Apache License 2.0"></a>
15
+ <a href="https://www.npmjs.com/package/@michengai/dsh-automation"><img src="https://img.shields.io/npm/v/%40michengai/dsh-automation?label=npm" alt="npm package"></a>
16
+ <img src="https://img.shields.io/badge/DSH-Web%20Plugin-10b981" alt="DSH Web Plugin">
17
+ <img src="https://img.shields.io/badge/Node.js-%E2%89%A522.19-339933?logo=nodedotjs&logoColor=white" alt="Node.js 22.19 or later">
18
+ </p>
19
+
20
+ > DSH Automation is a community-maintained plugin, not an official DeepSeek AI product.
21
+
22
+ ## Features
23
+
24
+ - Manages scheduled tasks from **Settings → Scheduled Tasks**.
25
+ - Creates, pauses, resumes, runs now, and deletes rules from the Web UI or Agent tools.
26
+ - Starts each occurrence in a fresh root Agent and Session. Source-chat history is not inherited.
27
+ - Supports once, interval, hourly, daily, weekly, monthly, and custom-every-N-days schedules.
28
+ - Lets you pick workspace, model, skills, and `read-only` / `workspace-write` permission in the create dialog.
29
+ - Fills a chat draft from **Create in chat**: `I want to create a scheduled task that runs every [interval] and does [the actual task]`.
30
+ - Keeps durable run history with `queued`, `running`, `succeeded`, `failed`, `skipped`, and `cancelled`.
31
+ - Adds a sidebar **Scheduled** tab. Folders are task names and child sessions are run times. On stock DSH it wraps the official workspace tree instead of replacing it, and it does not depend on `dsh-codex-ui`.
32
+
33
+ ## Prerequisites
34
+
35
+ - A working DeepSeek Harness Web installation with `dsh` available in PowerShell.
36
+ - Examples use the `web` profile; replace it with the target profile.
37
+ - Source installation and development require Node.js 22.19+. npm installation does not require running `npm install` in an arbitrary directory.
38
+
39
+ ## Installation
40
+
41
+ ### Install from npm
42
+
43
+ Run this from any PowerShell directory. Install into the DSH profile through `dsh plugin`:
44
+
45
+ ```powershell
46
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
47
+ $OutputEncoding = [System.Text.Encoding]::UTF8
48
+ dsh plugin --profile web add @michengai/dsh-automation
49
+ dsh --profile web --dump-config
50
+ ```
51
+
52
+ Restart DSH Web or reload the active Web profile. If a package mirror is behind, append `--registry=https://registry.npmjs.org/`.
53
+
54
+ ### Install from source
55
+
56
+ Use this for debugging or unpublished changes. The cloned directory becomes the plugin source path:
57
+
58
+ ```powershell
59
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
60
+ $OutputEncoding = [System.Text.Encoding]::UTF8
61
+ Set-Location D:\Repository\deepseek-harness-plugin
62
+ git clone https://github.com/MichengAI/dsh-automation.git
63
+ Set-Location .\dsh-automation
64
+ pnpm install
65
+ pnpm test
66
+ pnpm build
67
+ dsh plugin --profile web add .
68
+ dsh --profile web --dump-config
69
+ ```
70
+
71
+ Restart DSH Web or reload the active Web profile. Local installation reads and applies `cordis.patch.yml`; do not copy `lib` files manually.
72
+
73
+ ## Usage
74
+
75
+ Open **Settings → Scheduled Tasks**, then use the panel as follows:
76
+
77
+ | Goal | Action | Scope |
78
+ | --- | --- | --- |
79
+ | Create a rule | Select **New scheduled task**, then set name, schedule, prompt, workspace, model, skills, and permission. | Host-wide |
80
+ | Create from chat | Select **Create in chat**. Settings close and the composer is filled with a template prompt. | Current conversation |
81
+ | Pause or resume | Use the switch on a task card. | One rule |
82
+ | Run now | Open the card menu and select **Run now**. | One rule |
83
+ | Delete | Open the card menu and select **Delete task**. Run history is kept. | Definition only |
84
+ | Inspect runs | Open **Run history**, then filter by day, week, month, task, or status. | Host-wide |
85
+
86
+ Each dispatched run uses the saved prompt, workspace, model, and permission boundary. It does not reuse approvals from the source chat.
87
+
88
+ ## Safety boundary
89
+
90
+ | Item | Behavior |
91
+ | --- | --- |
92
+ | Permission | Default is `read-only`. File writes require an explicit `workspace-write` choice. |
93
+ | Full access | Unattended `danger-full-access` is not offered. |
94
+ | Approval | Unattended runs use fail-closed `never` and do not wait for a missing human. |
95
+ | Retry | No automatic retry after a started run. |
96
+ | Host restart | Leftover `queued` / `running` records become `failed(host_interrupted)`. |
97
+ | Overlap | One active run per rule. A colliding occurrence is recorded as `skipped(overlap)`. |
98
+
99
+ A schedule stores future intent. It is not a cached permission grant.
100
+
101
+ ## Development
102
+
103
+ Current sources live in `src` and build into `lib`:
104
+
105
+ - [src\index.ts](src/index.ts): Host plugin, tools, and RPC.
106
+ - [src\service.ts](src/service.ts): Durable definitions, clock, and run admission.
107
+ - [src\client\index.ts](src/client/index.ts): Settings page and chat prefill.
108
+ - `tests\*.test.ts`: Domain, recurrence, service, client, and package-contract tests.
109
+
110
+ After changing files, run tests, rebuild, and reinstall from the local directory:
111
+
112
+ ```powershell
113
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
114
+ $OutputEncoding = [System.Text.Encoding]::UTF8
115
+ pnpm check
116
+ dsh plugin --profile web add .
117
+ ```
118
+
119
+ Keep the at-most-once dispatch policy, workspace scoping for Agent tools, and fail-closed unattended approval when changing execution code.
120
+
121
+ ## Verification
122
+
123
+ ```powershell
124
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
125
+ $OutputEncoding = [System.Text.Encoding]::UTF8
126
+ pnpm test
127
+ pnpm build
128
+ ```
129
+
130
+ `pnpm check` runs typecheck, tests, and build together.
131
+
132
+ ## Project docs and license
133
+
134
+ Start from the [documentation entry](docs/00-交接入口/00-阅读导航.md) for project status, architecture, and the current iteration. Product notes live in NOTICE.
135
+
136
+ This project uses [Apache License 2.0](LICENSE).
@@ -0,0 +1,136 @@
1
+ <h1 align="center">DSH Automation</h1>
2
+
3
+ <p align="center">
4
+ <strong>在独立 Session 中按计划执行编码任务的 DeepSeek Harness Web 插件。</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/MichengAI/dsh-automation/issues">反馈问题</a>
9
+ · <a href="https://www.npmjs.com/package/@michengai/dsh-automation">在 npm 查看</a>
10
+ · <a href="README.md">English</a>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="Apache License 2.0"></a>
15
+ <a href="https://www.npmjs.com/package/@michengai/dsh-automation"><img src="https://img.shields.io/npm/v/%40michengai/dsh-automation?label=npm" alt="npm 包"></a>
16
+ <img src="https://img.shields.io/badge/DSH-Web%20Plugin-10b981" alt="DSH Web Plugin">
17
+ <img src="https://img.shields.io/badge/Node.js-%E2%89%A522.19-339933?logo=nodedotjs&logoColor=white" alt="Node.js 22.19 或更高版本">
18
+ </p>
19
+
20
+ > DSH Automation 是社区维护的插件,并非 DeepSeek AI 官方产品。
21
+
22
+ ## 功能概览
23
+
24
+ - 在「设置 → 定时任务」集中管理规则和运行历史。
25
+ - 支持从 Web 或 Agent 工具创建、暂停、恢复、立即运行和删除。
26
+ - 每次到期都启动全新 root Agent 和 Session,不继承来源对话。
27
+ - 计划类型包括不重复、间隔、每小时、每天、每周、每月和自定义间隔天数。
28
+ - 新建弹窗可选择工作目录、模型、技能,以及 `read-only` / `workspace-write`。
29
+ - 「通过对话创建」会关闭设置页,并在输入框填入:`我要创建一个定时任务,每【时间间隔】执行【具体任务】`。
30
+ - 运行状态包含 `queued`、`running`、`succeeded`、`failed`、`skipped`、`cancelled`。
31
+ - 侧栏提供「定时」页签:文件夹是任务名称,子会话是执行时间。原生下只包裹官方任务树,不替换搜索和工作区,也不依赖 `dsh-codex-ui`。
32
+
33
+ ## 前置条件
34
+
35
+ - 已可正常运行 DeepSeek Harness Web,且可在 PowerShell 中使用 `dsh`。
36
+ - 以下示例使用 `web` profile;请替换为实际目标 profile。
37
+ - 从源码安装或二次开发需要 Node.js 22.19+;仅从 npm 安装无需在任意目录执行 `npm install`。
38
+
39
+ ## 安装
40
+
41
+ ### 从 npm 安装
42
+
43
+ 在任意 PowerShell 目录执行。请通过 `dsh plugin` 安装到 DSH profile:
44
+
45
+ ```powershell
46
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
47
+ $OutputEncoding = [System.Text.Encoding]::UTF8
48
+ dsh plugin --profile web add @michengai/dsh-automation
49
+ dsh --profile web --dump-config
50
+ ```
51
+
52
+ 安装或升级后重启 DSH Web,或重新加载当前 Web profile。若镜像未同步最新版本,可在安装命令末尾追加 `--registry=https://registry.npmjs.org/`。
53
+
54
+ ### 从源码安装
55
+
56
+ 适用于调试或使用未发布改动。克隆后的目录会直接作为插件安装路径:
57
+
58
+ ```powershell
59
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
60
+ $OutputEncoding = [System.Text.Encoding]::UTF8
61
+ Set-Location D:\Repository\deepseek-harness-plugin
62
+ git clone https://github.com/MichengAI/dsh-automation.git
63
+ Set-Location .\dsh-automation
64
+ pnpm install
65
+ pnpm test
66
+ pnpm build
67
+ dsh plugin --profile web add .
68
+ dsh --profile web --dump-config
69
+ ```
70
+
71
+ 完成后重启 DSH Web 或重新加载当前 Web profile。`dsh plugin ... add .` 会自动读取并应用 `cordis.patch.yml`;不要手工复制 `lib` 文件。
72
+
73
+ ## 使用
74
+
75
+ 打开「设置 → 定时任务」,再按下表操作:
76
+
77
+ | 目标 | 操作 | 范围 |
78
+ | --- | --- | --- |
79
+ | 创建规则 | 点击「新建定时任务」,填写名称、计划、任务说明、工作目录、模型、技能和权限。 | 当前 Host |
80
+ | 通过对话创建 | 点击「通过对话创建」。设置页关闭,输入框填入模板提示词。 | 当前对话 |
81
+ | 暂停或恢复 | 使用任务卡片上的开关。 | 单条规则 |
82
+ | 立即运行 | 打开卡片菜单,选择「立即执行」。 | 单条规则 |
83
+ | 删除 | 打开卡片菜单,选择「删除任务」。运行历史会保留。 | 仅定义 |
84
+ | 查看记录 | 打开「执行记录」,再按天、周、月、任务或状态筛选。 | 当前 Host |
85
+
86
+ 每次派发都使用保存的任务说明、工作区、模型和权限边界,不会复用来源对话中的批准。
87
+
88
+ ## 权限与安全边界
89
+
90
+ | 项目 | 行为 |
91
+ | --- | --- |
92
+ | 权限 | 默认 `read-only`。改文件必须显式选择 `workspace-write`。 |
93
+ | 完全访问 | 不提供无人值守 `danger-full-access`。 |
94
+ | 审批 | 无人值守使用 fail-closed 的 `never`,不会等待一个不存在的人。 |
95
+ | 重试 | 已经开始的运行不会自动重试。 |
96
+ | Host 重启 | 遗留的 `queued` / `running` 会变成 `failed(host_interrupted)`。 |
97
+ | 重叠 | 同一规则同时最多一个 active run。冲突 occurrence 记为 `skipped(overlap)`。 |
98
+
99
+ 计划只表达未来意图,不是缓存下来的授权。
100
+
101
+ ## 二次开发
102
+
103
+ 当前源码在 `src`,构建产物在 `lib`:
104
+
105
+ - [src\index.ts](src/index.ts):Host 插件、工具和 RPC。
106
+ - [src\service.ts](src/service.ts):持久化定义、时钟和运行准入。
107
+ - [src\client\index.ts](src/client/index.ts):设置页和对话预填。
108
+ - `tests\*.test.ts`:领域、周期、服务、客户端和包契约测试。
109
+
110
+ 修改后运行测试、重新构建,并以本地目录安装验证:
111
+
112
+ ```powershell
113
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
114
+ $OutputEncoding = [System.Text.Encoding]::UTF8
115
+ pnpm check
116
+ dsh plugin --profile web add .
117
+ ```
118
+
119
+ 修改执行逻辑时必须保留 at-most-once 派发、Agent 工具的工作区边界,以及无人值守 fail-closed 审批。
120
+
121
+ ## 验证
122
+
123
+ ```powershell
124
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
125
+ $OutputEncoding = [System.Text.Encoding]::UTF8
126
+ pnpm test
127
+ pnpm build
128
+ ```
129
+
130
+ `pnpm check` 会连续执行类型检查、测试和构建。
131
+
132
+ ## 项目文档与许可证
133
+
134
+ 项目状态、使用边界、技术架构和迭代记录从[文档交接入口](docs/00-交接入口/00-阅读导航.md)开始。补充说明见 NOTICE。
135
+
136
+ 本项目采用 [Apache License 2.0](LICENSE)。
@@ -0,0 +1,9 @@
1
+ # 一次安装同时挂载 Host 服务并发布 Web 客户端。
2
+ - insert:
3
+ - id: dsh-automation
4
+ name: '@michengai/dsh-automation'
5
+ config:
6
+ maxConcurrentRuns: 2
7
+ runTimeoutMinutes: 60
8
+ misfireGraceMinutes: 15
9
+ historyLimit: 200
@@ -0,0 +1,11 @@
1
+ # 阅读导航
2
+
3
+ 更新时间:2026-08-16 18:30(Asia/Shanghai)
4
+
5
+ 1. [项目概览](01-项目概览.md) — 先看插件定位和稳定边界。
6
+ 2. [当前状态](02-当前状态.md) — 再看当前阶段和有效风险。
7
+ 3. [待办与阻塞](03-待办与阻塞.md) — 只看尚未关闭的事项。
8
+ 4. [迭代路线图](04-迭代路线图.md) — 只看迭代顺序。
9
+ 5. [技术架构基线](05-技术架构基线.md) — 看当前生效的硬约束。
10
+ 6. [调度与执行模型](..\03-技术架构\01-调度与执行模型.md) — 看领域设计。
11
+ 7. [I001 迭代总览](..\01-当前工作\I001-任务自动化插件\00-迭代总览.md) — 看本次交付范围。
@@ -0,0 +1,22 @@
1
+ # 项目概览
2
+
3
+ 更新时间:2026-08-16 18:30(Asia/Shanghai)
4
+
5
+ `@michengai/dsh-automation` 是 DeepSeek Harness Web Profile 的社区插件,用于创建独立、可审计的定时编码任务。
6
+
7
+ ## 当前阶段
8
+
9
+ 首个可安装版本:支持设置页、Agent 工具,以及单次/间隔/每天/每周计划。
10
+
11
+ ## 核心能力
12
+
13
+ - 每次到期都创建全新 root Agent 和 Session,不继承来源对话。
14
+ - 规则、修订号和运行历史持久化。
15
+ - 同一条规则同时最多一个 active run;超时、重叠和 Host 中断都有明确终态。
16
+ - 默认只读;可显式选择 `workspace-write`。禁止无人值守 `danger-full-access`。
17
+
18
+ ## 稳定边界
19
+
20
+ - 不替代 DSH Core Schedule 的同会话提醒。
21
+ - 不是操作系统守护进程,Host 必须正在运行。
22
+ - 不提供 raw cron、DAG、外部通知或 worktree 生命周期。
@@ -0,0 +1,9 @@
1
+ # 当前状态
2
+
3
+ 更新时间:2026-08-16 22:40(Asia/Shanghai)
4
+
5
+ - 阶段:I001 任务自动化插件首版实现,已补原生侧栏「定时」页签。
6
+ - 活动迭代:[I001-任务自动化插件](..\01-当前工作\I001-任务自动化插件\00-迭代总览.md)
7
+ - 有效风险:
8
+ - Host 未运行时不会补跑历史 backlog。
9
+ - 无人值守工具 allowlist 无法覆盖全部第三方 DSH tool。
@@ -0,0 +1,7 @@
1
+ # 待办与阻塞
2
+
3
+ 更新时间:2026-08-16 18:30(Asia/Shanghai)
4
+
5
+ | 事项 | 负责人 | 优先级 | 下一步 | 解除条件 |
6
+ | --- | --- | --- | --- | --- |
7
+ | 真实 DSH Web 组合验收 | 维护者 | 高 | 用 `dsh plugin --profile web add` 安装后做一次立即运行 | 能从 Web 创建、到期触发并打开结果 Session |
@@ -0,0 +1,5 @@
1
+ # 迭代路线图
2
+
3
+ 更新时间:2026-08-16 18:30(Asia/Shanghai)
4
+
5
+ - I001 任务自动化插件:进行中。交付独立 Session 调度、设置页与 Web/Agent 双入口。
@@ -0,0 +1,10 @@
1
+ # 技术架构基线
2
+
3
+ 更新时间:2026-08-16 18:30(Asia/Shanghai)
4
+
5
+ - 包名:`@michengai/dsh-automation`
6
+ - 运行时:Node.js 22.19+ / 24+,Cordis Host + DSH Web client
7
+ - 持久化:`ctx.storageDomain`,domain 名 `dsh_automation`
8
+ - 调度语义:at-most-once dispatch;无自动重试
9
+ - 权限:`read-only` / `workspace-write`;审批策略 `never`
10
+ - 构建:`scripts\build.mjs` 产出 Host ESM 与 `__ModuleLoader__` Web bundle
@@ -0,0 +1,8 @@
1
+ # 文档编写规范
2
+
3
+ 更新时间:2026-08-16 18:30(Asia/Shanghai)
4
+
5
+ 1. 文档使用简体中文和 UTF-8。
6
+ 2. 同一信息只保留一个权威位置。
7
+ 3. 当前工作只放未完成迭代;完成后移入 `docs\07-迭代归档`。
8
+ 4. 不创建空模板文档。
@@ -0,0 +1,47 @@
1
+ # I001 任务自动化插件
2
+
3
+ - 状态:进行中
4
+ - 负责人:维护者
5
+ - 优先级:高
6
+ - 更新时间:2026-08-16 22:40(Asia/Shanghai)
7
+
8
+ ## 目标与业务边界
9
+
10
+ 实现 DeepSeek Harness 的独立任务自动化:用户或 Agent 保存一条自包含任务,Host 到期后在全新 Session 中执行,并留下可审计历史。设置页提供任务列表、执行记录和新建模态。
11
+
12
+ ## 任务清单
13
+
14
+ - [x] 领域模型、周期计算
15
+ - [x] Service / Executor / Tools / RPC
16
+ - [x] Web Automations 页
17
+ - [x] 原生侧栏定时页签:包裹官方任务树,不依赖 dsh-codex-ui
18
+ - [x] 单测与包契约
19
+ - [ ] 真实 Web Profile 组合验收
20
+
21
+ ## 阻塞事项
22
+
23
+ 无。
24
+
25
+ ## 验收标准
26
+
27
+ 1. Web 和 Agent 都能创建、列出、暂停、恢复、立即运行和删除。
28
+ 2. 到期后创建新 Session,消息 source 为 `automation`。
29
+ 4. 重启不会偷偷重跑遗留 running。
30
+ 5. 删除定义不删除运行历史。
31
+
32
+ ## 已完成内容
33
+
34
+ 仓库内已落地 Host 插件、Web 客户端、原生侧栏定时页签、文档和单测。
35
+
36
+ ## 待处理事项
37
+
38
+ 真实 DSH Host 上的一次立即运行验收。
39
+
40
+ ## 关联提交
41
+
42
+ 尚未发布提交。
43
+
44
+ ## 阅读顺序
45
+
46
+ 1. [项目概览](..\..\00-交接入口\01-项目概览.md)
47
+ 2. [调度与执行模型](..\..\03-技术架构\01-调度与执行模型.md)
@@ -0,0 +1,5 @@
1
+ # 技术架构索引
2
+
3
+ 更新时间:2026-08-16 18:30(Asia/Shanghai)
4
+
5
+ 1. [调度与执行模型](01-调度与执行模型.md)
@@ -0,0 +1,30 @@
1
+ # 调度与执行模型
2
+
3
+ 更新时间:2026-08-16 22:40(Asia/Shanghai)
4
+
5
+ ## 分层
6
+
7
+ - Store:只保存 definition 与 run。
8
+ - Clock:只回答下次到期时间。
9
+ - Executor:只执行已经认领的 run。
10
+ - Tools / RPC:只调用 service。
11
+ - Web client:只展示快照并提交明确 mutation。
12
+
13
+ ## 调度
14
+
15
+ - `once` / `interval` / `daily` / `weekly` 会编译为校验过的 RRULE。
16
+ - `interval` 最短 5 分钟,创建后不会立刻跑第一次。
17
+ - 每天/每周使用 IANA 本地 `HH:mm`;夏令时中不存在的本地时间会被跳过。
18
+ - 立即运行不受计划时间限制。
19
+
20
+ ## 恢复
21
+
22
+ - 先持久化 `queued`,再创建 Agent。
23
+ - Host 重启后,遗留 `queued`/`running` 变为 `failed(host_interrupted)`。
24
+ - 补跑窗口默认 15 分钟,只物化最新一条 overdue occurrence。
25
+
26
+ ## 侧栏
27
+
28
+ - 有 `dsh-codex-ui` 时只填充 `sidebar.schedule`。
29
+ - 没有 Codex UI 时不换掉官方任务树,只在外面套「任务 / 定时」页签;官方搜索、工作区和会话菜单都保留。若存在 `sidebar.channels` 再显示「频道」。
30
+ - 定时树按任务名称分组,子会话标题为 `YYYY-MM-DD HH:mm - 任务名`。