dsh-agent-team-playbook 1.29.0 → 1.30.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 (3) hide show
  1. package/README.md +4 -1
  2. package/client.js +73 -15
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -108,7 +108,10 @@ dsh plugin --profile web add dsh-agent-team-playbook
108
108
  | `/atp apply 1=覆盖 2=备份 3=改名:x` | 对 install 列出的冲突**逐项决定**(覆盖 / 备份你的文件 / 我们这侧改名并同步引用) |
109
109
  | `/atp help` | 用法 |
110
110
 
111
- **Web / 桌面端还会多一个设置面板**(设置 → 协作规程):
111
+ **Web / 桌面端有两个入口**:
112
+
113
+ 1. **首页 chip 行**(与「音乐制作 / 标准模式」并排)的「协作规程」——有冲突时角标显示数量,点一下:有冲突弹出处理框、无冲突直接安装
114
+ 2. **设置 → 协作规程** 面板:
112
115
 
113
116
  - 显示当前工作区是否已安装、有无同名冲突
114
117
  - 点「**安装到工作区**」:无冲突直接装;**有冲突会直接弹出处理对话框**(不用先执行命令)
package/client.js CHANGED
@@ -109,6 +109,29 @@ window.__ModuleLoader__.load({
109
109
  }
110
110
  }
111
111
 
112
+ /**
113
+ * 共享动作:检测当前工作区 → 有冲突打开弹窗,没有就直接装。
114
+ * 面板按钮与首页 chip 都走这一条路径。
115
+ * @returns {Promise<{started: boolean, conflicts: number, error?: string}>}
116
+ */
117
+ async function detectThenInstall(ctx, onDone) {
118
+ try {
119
+ const { sessionId, cwd } = currentSession(ctx)
120
+ const data = await fetchStatus(cwd)
121
+ const found = data?.conflicts ?? []
122
+ const execute = (sid, line) => ctx?.remote?.commands?.execute?.(sid, line, [])
123
+ if (found.length > 0) {
124
+ writeStore({ open: true, conflicts: found, cwd: cwd ?? '', sessionId: sessionId ?? '', execute, afterApply: onDone })
125
+ return { started: true, conflicts: found.length }
126
+ }
127
+ await execute(sessionId, '/atp install')
128
+ if (typeof onDone === 'function') await onDone()
129
+ return { started: true, conflicts: 0 }
130
+ } catch (error) {
131
+ return { started: false, conflicts: 0, error: String(error?.message ?? error) }
132
+ }
133
+ }
134
+
112
135
  /** 单个冲突的选择行:覆盖 / 备份 / 改名 + 名字输入。 */
113
136
  function ChoiceRow({ index, conflict, choice, onChoose, renameEnabled, onRename }) {
114
137
  const btn = (action, text) => {
@@ -233,6 +256,45 @@ window.__ModuleLoader__.load({
233
256
  return h(Modal, { open: true, onClose: () => writeStore({ open: false }), title: '处理同名内容', closeLabel: '取消', footer }, body)
234
257
  }
235
258
 
259
+ /** 首页 chip 行入口:和「音乐制作 / 标准模式」并排。 */
260
+ function HeroEntry() {
261
+ const [badge, setBadge] = React.useState('')
262
+ const [busy, setBusy] = React.useState(false)
263
+
264
+ React.useEffect(() => {
265
+ let alive = true
266
+ ;(async () => {
267
+ try {
268
+ const { cwd } = currentSession(HeroEntry.ctx)
269
+ const data = await fetchStatus(cwd)
270
+ const n = data?.conflicts?.length ?? 0
271
+ if (alive && n > 0) setBadge(` · ${n}`)
272
+ } catch {
273
+ /* 静默:首页 chip 不该因为检测失败而打扰 */
274
+ }
275
+ })()
276
+ return () => {
277
+ alive = false
278
+ }
279
+ }, [])
280
+
281
+ const onClick = async () => {
282
+ if (busy) return
283
+ setBusy(true)
284
+ try {
285
+ await detectThenInstall(HeroEntry.ctx, undefined)
286
+ } finally {
287
+ setBusy(false)
288
+ }
289
+ }
290
+
291
+ const label = busy ? '协作规程…' : `协作规程${badge}`
292
+ if (typeof Button === 'function') {
293
+ return h(Button, { variant: 'outline', disabled: busy, onClick: () => void onClick() }, label)
294
+ }
295
+ return h('button', { type: 'button', disabled: busy, onClick: () => void onClick() }, label)
296
+ }
297
+
236
298
  function Panel() {
237
299
  const [state, setState] = useState({ phase: 'loading' })
238
300
  const [copied, setCopied] = useState('')
@@ -337,21 +399,8 @@ window.__ModuleLoader__.load({
337
399
 
338
400
  // 安装:无冲突直接装;有冲突**直接弹窗**(等价于"install 后自动弹 UI")
339
401
  const install = useCallback(async () => {
340
- const ctx = Panel.ctx
341
- const { sessionId, cwd } = currentSession(ctx)
342
- const execute = (line) => ctx?.remote?.commands?.execute?.(sessionId, line, [])
343
- try {
344
- const data = await fetchStatus(cwd)
345
- const found = data?.conflicts ?? []
346
- if (found.length > 0) {
347
- writeStore({ open: true, conflicts: found, cwd: cwd ?? '', sessionId: sessionId ?? '', execute, afterApply: refresh })
348
- return
349
- }
350
- await execute('/atp install')
351
- await refresh()
352
- } catch (error) {
353
- setState({ phase: 'error', message: String(error?.message ?? error) })
354
- }
402
+ const result = await detectThenInstall(Panel.ctx, refresh)
403
+ if (!result.started && result.error) setState({ phase: 'error', message: result.error })
355
404
  }, [refresh])
356
405
 
357
406
  children.push(
@@ -378,6 +427,15 @@ window.__ModuleLoader__.load({
378
427
  label: () => '协作规程',
379
428
  }, () => h(Panel, null)))
380
429
 
430
+ // 首页 chip 行入口:和「音乐制作 / 标准模式」并排
431
+ HeroEntry.ctx = ctx
432
+ ctx.slots.inject('conversation.hero.options', () => ctx.slots.register({
433
+ name: 'conversation.hero.options',
434
+ id: 'agent-team-playbook.entry',
435
+ order: 20,
436
+ label: () => '协作规程',
437
+ }, () => h(HeroEntry, null)))
438
+
381
439
  // 冲突处理弹窗:常驻挂载,关闭时渲染 null
382
440
  ctx.slots.inject('shell.overlay', () => ctx.slots.register({
383
441
  name: 'shell.overlay',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agent-team-playbook",
3
- "version": "1.29.0",
3
+ "version": "1.30.0",
4
4
  "description": "DeepSeek Harness plugin that brings an executable multi-agent collaboration workflow (charter, triage tiers, six-stage pipeline, audit gates, experience library): a read-only /agent-team command plus a collision-aware installer for the documents.",
5
5
  "type": "module",
6
6
  "license": "MIT",