@dsh-teamwork/dsh-teamwork 0.0.0-stage → 0.2.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 (50) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +8 -0
  3. package/README.md +148 -2
  4. package/cordis.patch.yml +6 -0
  5. package/lib/cli.js +36 -0
  6. package/lib/cli.js.map +1 -0
  7. package/lib/client.js +155 -0
  8. package/lib/client.js.map +1 -0
  9. package/lib/config-sync.js +72 -0
  10. package/lib/config-sync.js.map +1 -0
  11. package/lib/index.js +429 -0
  12. package/lib/index.js.map +1 -0
  13. package/lib/panel.js +51 -0
  14. package/lib/panel.js.map +1 -0
  15. package/lib/platform-models.js +47 -0
  16. package/lib/platform-models.js.map +1 -0
  17. package/lib/plugin-status.js +23 -0
  18. package/lib/plugin-status.js.map +1 -0
  19. package/lib/preset-context.js +15 -0
  20. package/lib/preset-context.js.map +1 -0
  21. package/lib/preset-session.js +68 -0
  22. package/lib/preset-session.js.map +1 -0
  23. package/lib/prompt.js +10 -0
  24. package/lib/prompt.js.map +1 -0
  25. package/lib/task-session.js +92 -0
  26. package/lib/task-session.js.map +1 -0
  27. package/lib/types/cli.d.ts +2 -0
  28. package/lib/types/cli.d.ts.map +1 -0
  29. package/lib/types/client.d.ts +262 -0
  30. package/lib/types/client.d.ts.map +1 -0
  31. package/lib/types/config-sync.d.ts +27 -0
  32. package/lib/types/config-sync.d.ts.map +1 -0
  33. package/lib/types/index.d.ts +23 -0
  34. package/lib/types/index.d.ts.map +1 -0
  35. package/lib/types/panel.d.ts +104 -0
  36. package/lib/types/panel.d.ts.map +1 -0
  37. package/lib/types/platform-models.d.ts +6 -0
  38. package/lib/types/platform-models.d.ts.map +1 -0
  39. package/lib/types/plugin-status.d.ts +16 -0
  40. package/lib/types/plugin-status.d.ts.map +1 -0
  41. package/lib/types/preset-context.d.ts +29 -0
  42. package/lib/types/preset-context.d.ts.map +1 -0
  43. package/lib/types/preset-session.d.ts +45 -0
  44. package/lib/types/preset-session.d.ts.map +1 -0
  45. package/lib/types/prompt.d.ts +13 -0
  46. package/lib/types/prompt.d.ts.map +1 -0
  47. package/lib/types/task-session.d.ts +78 -0
  48. package/lib/types/task-session.d.ts.map +1 -0
  49. package/lib/web/client.js +712 -0
  50. package/package.json +76 -3
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,8 @@
1
+ DSH Teamwork plugin for DeepSeek Harness
2
+ Copyright 2026 Shushuo Ltd.
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (LICENSE).
5
+
6
+ The name "DSH Teamwork" and the whale mark are trademarks of Shushuo Ltd. The
7
+ Apache License does not grant permission to use them (section 6): a fork must
8
+ use a name and a mark of its own.
package/README.md CHANGED
@@ -1,3 +1,149 @@
1
- # Temporary Holding Version
1
+ # DSH Teamwork MVP
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
+ 团队模型、预设和插件目录作为独立增量配置加入 DSH,不覆盖本地用户配置。适配 DSH `0.2.2-rc.1` / Cordis `4.1.0`。
4
+
5
+ ## 开发
6
+
7
+ ```sh
8
+ pnpm install --frozen-lockfile
9
+ pnpm build
10
+ pnpm test
11
+ pnpm typecheck
12
+ ```
13
+
14
+ 插件包含可发布的 `lib` 输出;修改源码后应重新构建。`pnpm build` 同时编译宿主端(`src/` → `lib/`)和浏览器端(`src/web/` → `lib/web/client.js`)。
15
+
16
+ 仓库是 pnpm workspace:`ui/` 是共用组件库 `@dsh-teamwork/ui`,供本插件的面板使用,将来给 web 端和其他 DSH 插件共用,之后拆到独立仓库 `dsh-teamwork/dsh-teamwork-ui`。它的约定见 [`ui/README.md`](ui/README.md)。
17
+
18
+ ## 接入 DSH
19
+
20
+ 安装插件后,在 profile 中配置 `dsh-teamwork` 条目:
21
+
22
+ ```yaml
23
+ - id: dsh-teamwork
24
+ config:
25
+ apiEndpoint: http://localhost:3800
26
+ cachePath: /absolute/path/to/private/teamwork-cache.json
27
+ autoSync: true
28
+ syncIntervalMs: 60000
29
+ ```
30
+
31
+ 包的 `cordis.patch.yml` 使用 `insert` 声明新条目。手动 `--patch` 加载时也需使用 insert,并将 name 指向本仓库 `lib/index.js` 的绝对路径。
32
+
33
+ ## 侧栏面板
34
+
35
+ DSH web 和桌面端的左侧栏有 Teamwork 入口,打开后是主区域的 Teamwork 面板:
36
+
37
+ - 未登录:点"在浏览器中登录"打开网站授权页,把网页给出的授权码粘贴回面板。
38
+ - 顶栏:团队名和身份、同步状态、立即同步、退出;管理员多一个跳到网页 `/team` 的按钮。管理团队只在网页完成。
39
+ - 预设:每个预设的模型、就绪状态(必需工具、依赖插件),"在当前会话使用"(仅限尚未开始对话的会话)和"用它新建会话"。
40
+ - 团队模型:在当前会话使用,只改本会话,不改本地默认设置。
41
+ - 团队插件:固定版本的状态;安装前在面板里确认,确认绑定当时的精确版本。
42
+
43
+ 面板通过宿主端的 `/api/teamwork/*` 路由(`src/panel.ts`)工作,与 `/teamwork` 命令调用同一组函数;平台令牌只留在宿主进程里,不会发到浏览器。DSH 只允许本机所有者访问这些路由。会话恢复相关的子命令(`session`、`continue`、`cancel`、`retry`)只保留为命令。
44
+
45
+ ## 命令
46
+
47
+ 在 DSH 原生命令输入框中使用:
48
+
49
+ - `/teamwork login`:打开输出的浏览器链接,用 Google 或邮件验证码登录并确认授权。
50
+ - `/teamwork authorize <code>`:兑换两分钟有效的一次性授权码。
51
+ - `/teamwork status`:查看登录状态、自动同步开关、团队配置数量、最近同步成功时间和错误。
52
+ - `/teamwork sync`:拉取团队模型、预设和插件目录。
53
+ - `/teamwork list`:查看配置 ID。
54
+ - `/teamwork info [id]`:查看当前会话或指定预设的说明、版本、来源、提示词和工具状态。
55
+ - `/teamwork new <id>`:用最新团队预设创建新会话,在 DSH 会话列表打开;不复制旧历史、不启动任务。
56
+ - `/teamwork use <id>`:选择本会话使用的团队模型/预设,不修改本地默认模型。
57
+ - `/teamwork install <id>`:查看固定版本插件的安装确认说明。
58
+ - `/teamwork install <id> confirm`:通过 DSH 插件管理器先下载为禁用状态,检查配置覆盖和条目冲突后再启用。已有本地插件不会被覆盖或升级;有冲突的新包保持禁用,供用户在本地插件管理器中检查。
59
+ - `/teamwork logout`:在本地丢弃插件令牌,并移除团队缓存和注册。平台令牌无法在服务端撤销,但被移出团队的成员在下一次请求时即被拒绝。
60
+
61
+ 凭据只保存在内存,重启需要重新登录。非敏感团队配置缓存以 0600 文件权限保存并原子替换,宿主重启时恢复。缓存路径应位于用户私有目录。网络失败保留现有配置;明确的 401/403 清除团队缓存。
62
+
63
+ 团队提示词作为独立 scoped section 追加,按字面文本处理,不替换本地 persona,也不解释 `{{...}}` 模板。
64
+
65
+ 团队注册 ID 以 `team:<teamId>:<configId>` 命名。插件只释放自己持有的注册,不枚举或删除本地配置。已运行会话可能继续持有旧的 DSH 预设版本;更新后的版本用于新选择或新会话。用户确认安装的插件不会因为退出团队而被自动卸载。
66
+
67
+ 也可以用 `TEAMWORK_URL=... TEAMWORK_CACHE=... pnpm cli` 运行交互式同步客户端。CLI 写入缓存后,需要重新加载 DSH 插件;优先使用宿主中的 `/teamwork` 命令。
68
+
69
+ ## 验证范围
70
+
71
+ 单元测试验证配置隔离、幂等同步、失败保留、缓存恢复、权限失效清理,以及退出时同步/授权请求的并发取消。授权码换取令牌的服务端逻辑由 platform 仓库的 `packages/shared/src/server/auth/nextauth/__tests__/tokens.test.ts` 覆盖。
72
+
73
+ 已在真实 DSH web 宿主验证团队预设注册、会话模型选择和 `/teamwork list`。真实模型调用需要本地配置的模型密钥。真实 DSH + 本地 npm 测试仓库已验证固定版本插件下载、校验、加载、确认安装、重复安装保护,以及退出团队后保留用户已安装插件。测试包为无外部依赖的受控 fixture;任意第三方包的兼容性仍由 DSH 管理器检查。
74
+
75
+
76
+ ## 真实宿主集成测试
77
+
78
+ ```sh
79
+ npm install --prefix /tmp/dsh-test-runtime --no-package-lock @deepseek-ai/dsh@0.2.2-rc.1
80
+ DSH_CLI=/tmp/dsh-test-runtime/node_modules/@deepseek-ai/dsh/lib/bin.js pnpm test:host
81
+ ```
82
+
83
+ 测试启动独立临时 profile 和本地 npm registry,创建并打包两个固定版本 fixture,提供 SHA-512 integrity,经真实 DSH 包管理器下载和加载。测试不会发布包,也不修改现有 DSH profile。成功后清理临时目录;失败时报告诊断目录。宿主日志可能含本地浏览器令牌,请勿公开上传完整日志。
84
+
85
+ 安装确认绑定当前会话和包的精确版本;配置改变后必须重新查看安装说明。浏览器登录(Google 或邮件验证码)和授权仍由 platform 仓库提供。包声明 `dsh.bundle`(宿主端插件和原生命令)和 `dsh.client`(浏览器端面板,`exports["./client"]` 指向 `lib/web/client.js`)。
86
+
87
+ 测试为隔离的临时 DSH profile 设置 `npm_config_ignore_workspace_root_check=true`,允许 pnpm 9 在该 profile 的 workspace 根目录安装受控包。
88
+
89
+ ## 自动配置同步
90
+
91
+ 默认授权完成后立即同步,并每 60 秒自动刷新团队配置;`autoSync: false` 可关闭这两个自动行为,仍可手动 `/teamwork sync`。`syncIntervalMs` 必须是 10000–86400000 之间的整数毫秒数。每次定时请求结束后才安排下一次,手动与自动请求合并,避免慢网络下堆积请求。
92
+
93
+ 网络或响应格式错误保留已有配置,下次定时重试;401/403 清除团队缓存、注册与内存登录状态,暂停自动请求,需重新登录。重启恢复的缓存不代表已登录,`/teamwork status` 会明确区分。自动同步仅更新配置目录,不自动安装插件,不上传会话。插件卸载时停止定时器,等待当前同步结束后释放团队注册。
94
+
95
+ ## Platform 模型网关
96
+
97
+ 团队模型和预设统一选择 `teamwork-platform` provider,wire model 为团队配置 ID。插件把 DSH 的文本、工具调用和流式输出转换为 OpenAI Chat Completions 请求,发送到 `apiEndpoint/api/llm/chat/completions`。认证使用内存中的 platform 插件会话令牌,不读取本地供应商密钥,也不提供供应商直连降级。
98
+
99
+ 供应商地址和真实 API Key 仅配置在 platform 部署环境。缓存只保存配置描述;未登录时,即使有缓存也无法推理。当前适配器先支持文本和工具调用,模型目录读取团队配置中的 `contextWindow` 和 `maxTokens`。只有缺失字段才使用 32K 上下文、4096 输出的兼容值(确保输出不超过上下文)。管理员可在 platform 查询供应商模型列表并补充未提供的能力值;多模态和其他供应商协议后续补齐。
100
+
101
+ 按已确认的产品边界,现有本地模型继续独立使用;teamwork 管理的模型和预设全部经 platform,不修改本地模型配置或凭据。
102
+
103
+ ## Agent Preset
104
+
105
+ 团队预设复用 DSH 原生 `agentPresets` 注册、挂载、选择及 revision 生命周期。管理员在 platform 配置简介、使用说明、输出要求、团队模型引用、增量提示词以及必需/可选工具名称。说明字段供用户阅读;需要模型执行的要求写入 `systemPrompt`。新预设引用同团队 `kind=model` 的配置 ID,旧版内嵌 provider/model 配置继续兼容,不允许两种方式混用。引用模型删除后,客户端不降级到本地模型,网关也拒绝该请求。
106
+
107
+ - `/teamwork info` 显示实际挂载版本;`/teamwork info <id>` 预览最新目录配置,工具检查基于当前会话。
108
+ - 工具按 DSH 注册名称检查,区分已注册、条件可用、缺失、无法检查。工具已注册不意味着已获得执行授权,运行时仍由宿主处理权限与条件。
109
+ - 必需工具缺失/无法检查时,`/teamwork use` 拒绝选择;通过其他原生入口选择的预设,也在每次模型请求前重新检查。可选工具缺失只展示提示。
110
+ - DSH 只允许空白会话切换预设。开始第一轮后或执行中,使用 `/teamwork new <id>` 创建新会话;不在原会话静默改提示词、不清空历史。
111
+ - 同步更新后,已有 Agent 保留 DSH 原生旧 revision,`/teamwork info` 展示新版本;空白会话再次 `/teamwork use` 可更新。
112
+ - 每个会话开始时的团队/预设/版本记录在配置缓存旁的 `<缓存名>.sessions.json`(0600,原子替换),不写进会话日志:DSH 拒绝重新打开日志里含有它不认识的事件类型的会话,而第三方插件写不了它接受的可忽略记录。宿主恢复会话时若重新挂载的版本与记录不一致,阻止继续推理并提示新建会话;当前不保存历史预设定义,不承诺跨重启恢复已删除的旧 revision。没有记录的会话(包括分叉出的新会话)从首次请求开始记录。
113
+ - 预设版本固定不冻结服务端策略:成员权限、模型路由和输出限制仍采用 platform 当前配置。
114
+
115
+ 本地定向宿主检查:`DSH_CLI=/path/to/dsh/lib/bin.js pnpm test:presets`,不调用真实模型,不安装测试插件。
116
+
117
+ ## 工具清单与插件依赖
118
+
119
+ - `/teamwork tools`:列出当前会话可见的实际工具注册名及条件状态。DSH 工具接口未提供可靠的包归属,来源仅标记为「团队声明来源」或「宿主未提供归属信息」,不猜测运行时归属。已注册不代表已获执行权限。
120
+ - `/teamwork plugins`:重新读取宿主插件清单,检查所有团队目录插件;`/teamwork plugins <presetId>` 检查某预设的固定版本依赖。
121
+ - 预设的 `pluginDependencies` 是 `{pluginConfigId, version}[]`。目录记录消失或版本变化会提示管理员更新预设,不自动换成新版本。状态检查覆盖未安装、未启用、版本不符、加载失败、待加载/重启、正常和无法确认。
122
+ - 目录插件的 `providesTools` 是管理员声明的 DSH 工具注册名称,用于缺失工具的安装指引;实际可用性始终重新读取会话工具服务。
123
+ - 依赖未就绪时 `/teamwork use` 拒绝选择;原生入口创建的预设在每次模型请求前也检查。已固定的旧预设依赖不随目录更新自动改写。
124
+ - `/teamwork install` 仍需先查看说明再确认。已有插件的启用、升级和错误诊断交给 DSH 本地插件管理器,团队操作不覆盖它们。安装后刷新插件状态和当前预设必需工具;重启提示不会被误报为已就绪。
125
+
126
+ ## 会话与任务操作
127
+
128
+ - `/teamwork session`:查看原生运行状态、最近任务结果、最近已进入上下文的用户输入摘要、队列数量、模型、预设版本和本地恢复检查。`/teamwork session check` 额外刷新团队配置,验证当前平台访问权限;不启动任务。
129
+ - `/teamwork continue <后续指令>`:在空闲且无待处理输入时,检查模型、权限、预设版本、插件和工具,然后使用 DSH `followup` 发送新的用户消息。原有本地模型不要求 platform 登录。恢复已有会话沿用 DSH 原生入口,不覆盖其保存的模型选择。
130
+ - `/teamwork cancel`:调用 DSH `cancel({kind:'user'}, {keepInbox:true})`,请求取消当前执行,保留待处理输入。取消是请求,不承诺同步停止;用概览确认状态。文件修改不会回滚,历史不会删除。
131
+ - `/teamwork retry`:仅为失败、被阻止、取消、输出截断或意外中断的任务提供确认说明;`/teamwork retry confirm` 在两分钟内提交一次恢复指令,要求先检查已有结果再继续。不是重放工具调用,也不是完全复现原请求;仍可能产生新操作,需要用户明确确认。
132
+
133
+ 继续/重试不插队:如果有队列或引导输入,先在 DSH 原生界面检查处理。确认会在会话、模型、团队配置或登录身份变更后失效。权限检查期间取消不会在检查返回后启动任务;同时提交的请求也不会重复派发。
134
+
135
+ 任务摘要和结果使用原生 session projection,在本地会话恢复时重建;不向 platform 上传会话。错误提示区分凭据、限流、网络和工具条件,不复制上游原始错误正文。恢复检查是启动前检查,不替代 platform 对实际每次请求的实时权限校验。
136
+
137
+ ## 发布
138
+
139
+ 发布到 npm 用 trusted publishing(OIDC),不存任何 npm 令牌,做法和 `motionhub-dev/motions` 相同:
140
+
141
+ 1. 把 `package.json` 的 `version` 改成新版本,合进 `main`。
142
+ 2. 在 `main` 的那个提交上打 `v<version>` 并推送。`.github/workflows/release.yml` 分两步:`package` 不带 OIDC 权限,检查 tag 指向 `main` 的历史、和版本号一致、提交的 `lib/` 与源码构建一致,再测试并打包;`stage` 在受保护的 `npm-release` 环境里,核对拿到的正是打出来的那个包(SHA-256),关掉生命周期脚本后执行 `npm stage publish`。
143
+ 3. 维护者用 `npm stage list` 找到这次暂存,再用 `npm stage approve <stage-id>`(需要 2FA)正式发布。
144
+
145
+ 一次性设置:GitHub 仓库里建 `npm-release` 环境(限定维护者审批、只允许受保护的 tag);npm 上给 `@dsh-teamwork/dsh-teamwork` 配置 Trusted Publisher,指向本仓库、`release.yml` 和 `npm-release` 环境。仓库变量 `PUBLISHING=off` 可暂停暂存。
146
+
147
+ ## 许可证
148
+
149
+ Apache License 2.0(`LICENSE`)。名称“DSH Teamwork”和鲸鱼标志不随代码授权(`NOTICE`),派生项目需使用自己的名称和标志。
@@ -0,0 +1,6 @@
1
+ - insert:
2
+ - id: dsh-teamwork
3
+ name: '@dsh-teamwork/dsh-teamwork'
4
+ config:
5
+ apiEndpoint: http://localhost:3800
6
+ cachePath: ./teamwork-cache.json
package/lib/cli.js ADDED
@@ -0,0 +1,36 @@
1
+ import { createInterface } from 'node:readline/promises';
2
+ import { stdin, stdout } from 'node:process';
3
+ import { resolve } from 'node:path';
4
+ import { TeamworkClient } from './client.js';
5
+ const client = new TeamworkClient(process.env.TEAMWORK_URL ?? 'http://localhost:3800', resolve(process.env.TEAMWORK_CACHE ?? '.teamwork/cache.json'));
6
+ const terminal = createInterface({ input: stdin, output: stdout });
7
+ try {
8
+ console.log('Open this URL in your browser:', client.beginLogin());
9
+ await client.completeLogin((await terminal.question('Paste the one-time authorization code: ')).trim());
10
+ console.log('Signed in. Commands: sync, list, logout, quit. Tokens stay in memory.');
11
+ for (;;) {
12
+ const command = (await terminal.question('teamwork> ')).trim();
13
+ if (command === 'quit')
14
+ break;
15
+ try {
16
+ if (command === 'sync') {
17
+ const next = await client.sync();
18
+ console.log(`Synced ${next.configs.length} team configurations. Reload the DSH plugin to apply.`);
19
+ }
20
+ else if (command === 'list')
21
+ console.log(JSON.stringify(client.current(), null, 2));
22
+ else if (command === 'logout') {
23
+ await client.logout();
24
+ console.log('Signed out. Reload the DSH plugin to remove team registrations.');
25
+ break;
26
+ }
27
+ }
28
+ catch (error) {
29
+ console.error(error.message);
30
+ }
31
+ }
32
+ }
33
+ finally {
34
+ terminal.close();
35
+ }
36
+ //# sourceMappingURL=cli.js.map
package/lib/cli.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,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AAC,iEAAiE,CAAC,CAAC;gBAAC,MAAM;YAAC,CAAC;QAClJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAC,OAAO,CAAC,KAAK,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC;QAAC,CAAC;IAC9D,CAAC;AACH,CAAC;QAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;AAAC,CAAC"}
package/lib/client.js ADDED
@@ -0,0 +1,155 @@
1
+ import { createHash, randomBytes } from 'node:crypto';
2
+ import { mkdir, readFile, rename, writeFile, rm } from 'node:fs/promises';
3
+ import { dirname } from 'node:path';
4
+ import { z } from 'zod';
5
+ const common = { id: z.string().min(1), name: z.string(), version: z.number().int().positive() };
6
+ const route = { provider: z.string().min(1), model: z.string().min(1), contextWindow: z.number().int().positive().max(10000000).optional(), maxTokens: z.number().int().positive().max(10000000).optional() };
7
+ export const snapshotSchema = z.object({ teamId: z.string().min(1), teamName: z.string(), role: z.enum(['admin', 'member']), configs: z.array(z.discriminatedUnion('kind', [
8
+ z.object({ ...common, kind: z.literal('model'), data: z.object(route) }),
9
+ z.object({ ...common, kind: z.literal('preset'), data: z.object({
10
+ ...route, provider: route.provider.optional(), model: route.model.optional(), modelConfigId: z.string().min(1).optional(),
11
+ description: z.string().optional(), instructions: z.string().optional(), outputDescription: z.string().optional(),
12
+ pluginDependencies: z.array(z.object({ pluginConfigId: z.string().min(1), version: z.string().regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/) })).max(30).optional(),
13
+ requiredTools: z.array(z.string().min(1)).optional(), optionalTools: z.array(z.string().min(1)).optional(),
14
+ systemPrompt: z.string().default(''),
15
+ }).refine(d => d.modelConfigId ? !d.provider && !d.model && d.contextWindow === undefined && d.maxTokens === undefined : !!d.provider && !!d.model, 'Invalid preset model reference') }),
16
+ z.object({ ...common, kind: z.literal('plugin'), data: z.object({ package: z.string().regex(/^(?:@[a-z0-9-]+\/)?[a-z0-9][a-z0-9._-]*$/), version: z.string().regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/), providesTools: z.array(z.string().min(1)).optional(), description: z.string().default('') }) }),
17
+ ])) });
18
+ export class TeamworkClient {
19
+ endpoint;
20
+ cachePath;
21
+ request;
22
+ token;
23
+ verifier;
24
+ snapshot;
25
+ epoch = 0;
26
+ operations = Promise.resolve();
27
+ enqueue(operation) {
28
+ const next = this.operations.then(operation, operation);
29
+ this.operations = next.catch(() => { });
30
+ return next;
31
+ }
32
+ constructor(endpoint, cachePath, request = fetch) {
33
+ this.endpoint = endpoint;
34
+ this.cachePath = cachePath;
35
+ this.request = request;
36
+ const url = new URL(endpoint);
37
+ if (url.protocol !== 'https:' && !(url.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname)))
38
+ throw new Error('HTTPS required outside loopback');
39
+ }
40
+ beginLogin() {
41
+ this.epoch++;
42
+ this.verifier = randomBytes(32).toString('base64url');
43
+ const challenge = createHash('sha256').update(this.verifier).digest('base64url');
44
+ return `${this.endpoint}/plugin?challenge=${challenge}`;
45
+ }
46
+ completeLogin(code) {
47
+ const verifier = this.verifier, epoch = this.epoch;
48
+ return this.enqueue(async () => {
49
+ if (!verifier || epoch !== this.epoch)
50
+ throw new Error('Begin login first');
51
+ const result = z.object({ token: z.string().min(1) }).parse(await this.api('auth/plugin/token', 'POST', { code, verifier }));
52
+ // Platform tokens are stateless and cannot be revoked server-side; a late one is simply dropped.
53
+ if (epoch !== this.epoch)
54
+ throw new Error('Login cancelled');
55
+ await this.clear();
56
+ this.verifier = undefined;
57
+ this.token = result.token;
58
+ });
59
+ }
60
+ async api(path, method = 'GET', body, token = this.token) {
61
+ const response = await this.request(`${this.endpoint}/api/${path}`, {
62
+ method, headers: { 'Content-Type': 'application/json', Origin: new URL(this.endpoint).origin, ...(token ? { Authorization: `Bearer ${token}` } : {}) },
63
+ body: body === undefined ? undefined : JSON.stringify(body), signal: AbortSignal.timeout(15000),
64
+ });
65
+ if (!response.ok) {
66
+ if (path === 'team/configs' && [401, 403].includes(response.status)) {
67
+ this.token = undefined;
68
+ await this.clear();
69
+ }
70
+ throw new Error(`Teamwork request failed (${response.status})`);
71
+ }
72
+ return response.json();
73
+ }
74
+ sync() { return this.enqueue(() => this.syncOnce()); }
75
+ async syncOnce() {
76
+ if (!this.token)
77
+ throw new Error('Sign in first');
78
+ const epoch = this.epoch;
79
+ const next = snapshotSchema.parse(await this.api('team/configs'));
80
+ if (epoch !== this.epoch)
81
+ throw new Error('Session changed during synchronization');
82
+ const ids = next.configs.map(c => c.id);
83
+ if (new Set(ids).size !== ids.length)
84
+ throw new Error('Duplicate configuration ID');
85
+ await mkdir(dirname(this.cachePath), { recursive: true, mode: 0o700 });
86
+ const temporary = `${this.cachePath}.${randomBytes(8).toString('hex')}.tmp`;
87
+ try {
88
+ await writeFile(temporary, JSON.stringify(next), { mode: 0o600 });
89
+ await rename(temporary, this.cachePath);
90
+ }
91
+ finally {
92
+ await rm(temporary, { force: true });
93
+ }
94
+ this.snapshot = next;
95
+ return next;
96
+ }
97
+ async restore() {
98
+ try {
99
+ this.snapshot = snapshotSchema.parse(JSON.parse(await readFile(this.cachePath, 'utf8')));
100
+ }
101
+ catch (error) {
102
+ if (error.code !== 'ENOENT')
103
+ throw error;
104
+ this.snapshot = undefined;
105
+ }
106
+ return this.snapshot;
107
+ }
108
+ platformCredential() { if (!this.token)
109
+ throw new Error('Sign in to platform first'); return this.token; }
110
+ sessionRevision() { return this.epoch; }
111
+ authenticated() { return !!this.token; }
112
+ current() { return this.snapshot; }
113
+ async clear() { this.snapshot = undefined; await rm(this.cachePath, { force: true }); }
114
+ logout() { this.epoch++; return this.enqueue(() => this.logoutOnce()); }
115
+ /** Forgets the token locally; the platform cannot revoke it, but a removed member is refused on every request. */
116
+ async logoutOnce() {
117
+ this.token = undefined;
118
+ this.verifier = undefined;
119
+ await this.clear();
120
+ }
121
+ }
122
+ /** Reconcile only registrations owned by this plugin. The host's local registry is never enumerated or mutated. */
123
+ export class TeamOverlay {
124
+ register;
125
+ owned = new Map();
126
+ constructor(register) {
127
+ this.register = register;
128
+ }
129
+ operations = Promise.resolve();
130
+ apply(snapshot) { const next = this.operations.then(() => this.reconcile(snapshot)); this.operations = next.catch(() => { }); return next; }
131
+ async reconcile(snapshot) {
132
+ const desired = new Map((snapshot?.configs ?? []).filter(c => c.kind !== 'plugin').map(c => [`team:${snapshot.teamId}:${c.id}`, c]));
133
+ for (const [id, old] of this.owned)
134
+ if (!desired.has(id) || old.signature !== JSON.stringify(desired.get(id))) {
135
+ await old.dispose();
136
+ this.owned.delete(id);
137
+ }
138
+ for (const [id, config] of desired)
139
+ if (!this.owned.has(id)) {
140
+ const dispose = await this.register(id, config);
141
+ this.owned.set(id, { signature: JSON.stringify(config), dispose });
142
+ }
143
+ }
144
+ }
145
+ /** References resolve within the current team snapshot only; never fall back to local models. */
146
+ export function modelData(snapshot, config) {
147
+ if (config.kind === 'plugin')
148
+ return undefined;
149
+ if (config.kind === 'preset' && config.data.modelConfigId) {
150
+ const model = snapshot.configs.find(c => c.id === config.data.modelConfigId && c.kind === 'model');
151
+ return model?.kind === 'model' ? model.data : undefined;
152
+ }
153
+ return config.data;
154
+ }
155
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,MAAM,MAAM,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAA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