dsh-agent-team-playbook 1.30.1 → 1.30.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/client.js +74 -8
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -28,6 +28,52 @@ window.__ModuleLoader__.load({
|
|
|
28
28
|
const { useCallback, useEffect, useMemo, useState } = React
|
|
29
29
|
|
|
30
30
|
const NAME = 'dsh-agent-team-playbook'
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* chip 样式:数值照抄原生的 `.workspace`(HeroShell 的 workspace chip),
|
|
34
|
+
* 这样和「音乐制作 / 标准模式」在同一行时视觉一致。
|
|
35
|
+
*/
|
|
36
|
+
const CHIP_CSS = `
|
|
37
|
+
.atp-chip{
|
|
38
|
+
border-radius: var(--dsw-radius-sm, 8px);
|
|
39
|
+
max-width: min(100%, 360px);
|
|
40
|
+
min-height: 28px;
|
|
41
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
background: 0 0;
|
|
44
|
+
border: none;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: 4px;
|
|
47
|
+
padding: 0 8px;
|
|
48
|
+
font: inherit;
|
|
49
|
+
font-size: 13px;
|
|
50
|
+
font-weight: 500;
|
|
51
|
+
line-height: 20px;
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
}
|
|
54
|
+
.atp-chip[aria-expanded="true"]{ background: var(--dsw-alias-interactive-bg-hover, rgba(127,127,127,.14)); }
|
|
55
|
+
@media (hover:hover){ .atp-chip:not(:disabled):hover{ background: var(--dsw-alias-interactive-bg-hover, rgba(127,127,127,.14)); } }
|
|
56
|
+
.atp-chip:disabled{ cursor: default; opacity: .6; }
|
|
57
|
+
.atp-chip .atp-chip-label{ text-overflow: ellipsis; white-space: nowrap; min-width: 0; overflow: hidden; }
|
|
58
|
+
.atp-chip .atp-chip-glyph{ flex: none; color: var(--dsw-alias-label-primary, inherit); }
|
|
59
|
+
/* heroOptions 容器原生是 margin-left:auto(靠右);把我们那行拉回左对齐,紧跟「标准模式」后面 */
|
|
60
|
+
div:has(> .atp-chip){ margin-left: 0 !important; }
|
|
61
|
+
`
|
|
62
|
+
const CHIP_STYLE_ID = 'agent-team-playbook/chip.css'
|
|
63
|
+
|
|
64
|
+
/** 注入一次样式(幂等)。 */
|
|
65
|
+
function ensureStyle() {
|
|
66
|
+
try {
|
|
67
|
+
if (typeof document === 'undefined') return
|
|
68
|
+
if (document.querySelector(`style[data-plugin-css="${CHIP_STYLE_ID}"]`) !== null) return
|
|
69
|
+
const tag = document.createElement('style')
|
|
70
|
+
tag.setAttribute('data-plugin-css', CHIP_STYLE_ID)
|
|
71
|
+
tag.textContent = CHIP_CSS
|
|
72
|
+
document.head.appendChild(tag)
|
|
73
|
+
} catch {
|
|
74
|
+
/* 样式注入失败不影响功能 */
|
|
75
|
+
}
|
|
76
|
+
}
|
|
31
77
|
const API = '/api/agent-team-playbook/status'
|
|
32
78
|
const Button = primitives?.Button
|
|
33
79
|
const Modal = primitives?.Modal
|
|
@@ -96,6 +142,18 @@ window.__ModuleLoader__.load({
|
|
|
96
142
|
}
|
|
97
143
|
|
|
98
144
|
/** 解析"当前会话"的 cwd 与 sessionId(客户端 sessions 快照)。 */
|
|
145
|
+
/** 安全取 remote.commands.execute:声明缺失时返回 undefined 而不是抛错。 */
|
|
146
|
+
function remoteExecute(ctx, sessionId, line) {
|
|
147
|
+
try {
|
|
148
|
+
const remote = ctx?.remote ?? (typeof ctx?.get === 'function' ? ctx.get('remote', false) : undefined)
|
|
149
|
+
const commands = remote?.commands ?? (typeof ctx?.get === 'function' ? ctx.get('remote.commands', false) : undefined)
|
|
150
|
+
if (typeof commands?.execute !== 'function') return Promise.resolve({ ok: false, error: { message: '当前 composition 没有远程命令服务,请改用 /atp apply 命令' } })
|
|
151
|
+
return commands.execute(sessionId, line, [])
|
|
152
|
+
} catch (error) {
|
|
153
|
+
return Promise.resolve({ ok: false, error: { message: String(error?.message ?? error) } })
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
99
157
|
function currentSession(ctx) {
|
|
100
158
|
try {
|
|
101
159
|
const rows = ctx?.sessions?.list?.getSnapshot?.()?.byId ?? {}
|
|
@@ -119,7 +177,7 @@ window.__ModuleLoader__.load({
|
|
|
119
177
|
const { sessionId, cwd } = currentSession(ctx)
|
|
120
178
|
const data = await fetchStatus(cwd)
|
|
121
179
|
const found = data?.conflicts ?? []
|
|
122
|
-
const execute = (sid, line) => ctx
|
|
180
|
+
const execute = (sid, line) => remoteExecute(ctx, sid, line)
|
|
123
181
|
if (found.length > 0) {
|
|
124
182
|
writeStore({ open: true, conflicts: found, cwd: cwd ?? '', sessionId: sessionId ?? '', execute, afterApply: onDone })
|
|
125
183
|
return { started: true, conflicts: found.length }
|
|
@@ -289,10 +347,17 @@ window.__ModuleLoader__.load({
|
|
|
289
347
|
}
|
|
290
348
|
|
|
291
349
|
const label = busy ? '协作规程…' : `协作规程${badge}`
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
350
|
+
const Icon = primitives?.IconChecklistOutlineRegular
|
|
351
|
+
// 结构照抄原生 chip:button + 16px 图标 + 文本(无边框、透明底、hover 才出底色)
|
|
352
|
+
return h('button', {
|
|
353
|
+
type: 'button',
|
|
354
|
+
className: 'atp-chip',
|
|
355
|
+
disabled: busy,
|
|
356
|
+
'aria-label': '多智能体协作规程',
|
|
357
|
+
onClick: () => void onClick(),
|
|
358
|
+
},
|
|
359
|
+
Icon !== undefined ? h(Icon, { className: 'atp-chip-glyph', size: 16 }) : null,
|
|
360
|
+
h('span', { className: 'atp-chip-label' }, label))
|
|
296
361
|
}
|
|
297
362
|
|
|
298
363
|
function Panel() {
|
|
@@ -324,7 +389,7 @@ window.__ModuleLoader__.load({
|
|
|
324
389
|
autoOpened = fingerprint
|
|
325
390
|
const ctx = Panel.ctx
|
|
326
391
|
const { sessionId, cwd } = currentSession(ctx)
|
|
327
|
-
const execute = async (sid, line) => ctx
|
|
392
|
+
const execute = async (sid, line) => remoteExecute(ctx, sid, line)
|
|
328
393
|
writeStore({ open: true, conflicts: found, cwd: cwd ?? '', sessionId: sessionId ?? '', execute, afterApply: refresh })
|
|
329
394
|
}, [state, refresh])
|
|
330
395
|
|
|
@@ -378,7 +443,7 @@ window.__ModuleLoader__.load({
|
|
|
378
443
|
onClick: () => {
|
|
379
444
|
const ctx = Panel.ctx
|
|
380
445
|
const { sessionId, cwd } = currentSession(ctx)
|
|
381
|
-
const execute = async (sid, line) => ctx
|
|
446
|
+
const execute = async (sid, line) => remoteExecute(ctx, sid, line)
|
|
382
447
|
writeStore({ open: true, conflicts, cwd: cwd ?? '', sessionId: sessionId ?? '', execute, afterApply: refresh })
|
|
383
448
|
},
|
|
384
449
|
}, '逐项处理冲突…')
|
|
@@ -419,6 +484,7 @@ window.__ModuleLoader__.load({
|
|
|
419
484
|
}
|
|
420
485
|
|
|
421
486
|
function apply(ctx) {
|
|
487
|
+
ensureStyle()
|
|
422
488
|
Panel.ctx = ctx
|
|
423
489
|
ctx.slots.inject('settings.section', () => ctx.slots.register({
|
|
424
490
|
name: 'settings.section',
|
|
@@ -444,7 +510,7 @@ window.__ModuleLoader__.load({
|
|
|
444
510
|
}
|
|
445
511
|
|
|
446
512
|
exports.apply = apply
|
|
447
|
-
exports.inject = ['slots', 'sessions', 'remote.commands']
|
|
513
|
+
exports.inject = ['slots', 'sessions', 'remote', 'remote.commands']
|
|
448
514
|
exports.name = NAME
|
|
449
515
|
// 测试缝:拼命令是纯函数,单独可测
|
|
450
516
|
exports.__test = { buildApplySpec, detectThenInstall, ResolveDialog, ChoiceRow, readStore }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agent-team-playbook",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.2",
|
|
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",
|