@xiangyixie/dsh-superagent 0.22.0 → 0.23.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.
- package/CHANGELOG.md +15 -0
- package/lib/client.js +128 -53
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,21 @@ along with the next code release. A doc-only version leaves `lib/` and `bin/`
|
|
|
8
8
|
byte-identical to the version before it, and the pinned install line in the
|
|
9
9
|
README is updated to the version being released.
|
|
10
10
|
|
|
11
|
+
## 0.23.0 — 2026-11-18
|
|
12
|
+
|
|
13
|
+
- 过程行可以整行点开:思考与工具调用不再只有小箭头能展开,命中区域和宿主的
|
|
14
|
+
`expandOnRowClick` 一致。
|
|
15
|
+
- 项目表单改用宿主 Input 与图标按钮,产物文件名改用宿主 PathLabel(目录渐隐、
|
|
16
|
+
长路径省略),图片预览改用宿主灯箱(Esc 或点遮罩关闭、焦点归还)。
|
|
17
|
+
- 任务详情头补上宿主状态点和图标关闭/停止按钮,停止、返回任务、打开会话统一为
|
|
18
|
+
宿主小号按钮。
|
|
19
|
+
- 对话流声明 `role="log"` 与 `aria-live="polite"`,新消息对读屏可见。
|
|
20
|
+
- 修掉审批卡和问答卡向宿主按钮转发空 `type` 的问题,避免在表单里退化成提交。
|
|
21
|
+
|
|
22
|
+
## 0.22.1 — 2026-11-17
|
|
23
|
+
|
|
24
|
+
- 问答卡的回答按钮不再转发空的 `type`,避免宿主按钮在表单里退化成提交按钮。
|
|
25
|
+
|
|
11
26
|
## 0.22.0 — 2026-11-17
|
|
12
27
|
|
|
13
28
|
- 面板按宿主设计重做:思考与工具行进改用宿主 24px 过程行(DisclosureRow/TextShimmer),
|
package/lib/client.js
CHANGED
|
@@ -75,12 +75,14 @@ window.__ModuleLoader__.load({
|
|
|
75
75
|
const Pill = pick('Pill')
|
|
76
76
|
const Tag = pick('Tag')
|
|
77
77
|
const FileTypeIcon = pick('FileTypeIcon')
|
|
78
|
+
const PathLabel = pick('PathLabel')
|
|
79
|
+
const ImageLightbox = pick('ImageLightbox')
|
|
78
80
|
const QuotePreview = pick('QuotePreview')
|
|
79
81
|
const DetailDocument = pick('DetailDocument')
|
|
80
82
|
const CodeBlock = pick('CodeBlock')
|
|
81
83
|
const MISSING_PRIMITIVES = ['Button', 'MarkdownText', 'UserMessageBubble', 'StateDot', 'Tooltip',
|
|
82
|
-
'DisclosureRow', 'TextShimmer', 'Toast', 'Input', 'Pill', 'Tag', 'FileTypeIcon',
|
|
83
|
-
'QuotePreview', 'DetailDocument', 'CodeBlock']
|
|
84
|
+
'DisclosureRow', 'TextShimmer', 'Toast', 'Input', 'Pill', 'Tag', 'FileTypeIcon', 'PathLabel',
|
|
85
|
+
'ImageLightbox', 'QuotePreview', 'DetailDocument', 'CodeBlock']
|
|
84
86
|
.filter(name => !pick(name))
|
|
85
87
|
if (!ui) {
|
|
86
88
|
console.warn('[dsh-superagent] host primitives module is absent; assistant text renders as plain text')
|
|
@@ -203,6 +205,7 @@ window.__ModuleLoader__.load({
|
|
|
203
205
|
.dsa-project-head{display:flex;align-items:center;justify-content:space-between;padding:10px 8px 4px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
|
|
204
206
|
.dsa-project-add{display:grid;gap:4px;padding:5px 2px}
|
|
205
207
|
.dsa-project-add input{min-width:0;width:100%;box-sizing:border-box}
|
|
208
|
+
.dsa-project-add > span{display:block;box-sizing:border-box;width:100%;min-width:0}
|
|
206
209
|
.dsa-msg .dsa-reply{opacity:0;display:block;margin:2px 0 0 auto}
|
|
207
210
|
.dsa-msg:hover .dsa-reply,.dsa-reply:focus-visible{opacity:1}
|
|
208
211
|
.dsa-quote{display:flex;gap:6px;align-items:center;margin:0 10px;padding:4px 7px;border-left:2px solid var(--dsw-alias-border-l3);font-size:12px;color:var(--dsw-alias-label-secondary)}
|
|
@@ -338,6 +341,8 @@ window.__ModuleLoader__.load({
|
|
|
338
341
|
.dsa-artifact-row .dsa-artifact-link{flex:1;min-width:0;overflow:hidden}
|
|
339
342
|
.dsa-preview{display:flex;flex-direction:column;gap:12px;padding:12px;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-base)}
|
|
340
343
|
.dsa-preview-img{display:block;max-width:100%;border-radius:var(--dsw-radius-sm)}
|
|
344
|
+
.dsa-preview-thumb{display:block;align-self:flex-start;max-width:100%;padding:0;border:0;background:none;cursor:zoom-in}
|
|
345
|
+
.dsa-artifact-link [data-path-label]{flex:1;min-width:0}
|
|
341
346
|
.dsa-preview-frame{width:100%;height:320px;border:0;border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-base)}
|
|
342
347
|
.dsa-preview-text{max-height:320px;overflow:auto;white-space:pre-wrap;word-break:break-word;font:inherit;font-size:13px;line-height:20px;color:var(--dsw-alias-label-secondary)}
|
|
343
348
|
.dsa-chip{height:28px;padding:0 12px;border:0;border-radius:999px;background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:20px;cursor:pointer}
|
|
@@ -739,6 +744,7 @@ window.__ModuleLoader__.load({
|
|
|
739
744
|
title: props.title,
|
|
740
745
|
open,
|
|
741
746
|
expandable: Boolean(body),
|
|
747
|
+
expandOnRowClick: true,
|
|
742
748
|
onToggle: toggle,
|
|
743
749
|
running: props.running === true,
|
|
744
750
|
}, body)
|
|
@@ -837,6 +843,9 @@ window.__ModuleLoader__.load({
|
|
|
837
843
|
return h('div', {
|
|
838
844
|
className: 'dsa-scroll',
|
|
839
845
|
ref: props.scrollRef,
|
|
846
|
+
role: 'log',
|
|
847
|
+
'aria-live': 'polite',
|
|
848
|
+
'aria-label': '对话',
|
|
840
849
|
}, h('div', { className: 'dsa-flow' }, rows))
|
|
841
850
|
}
|
|
842
851
|
|
|
@@ -858,25 +867,22 @@ window.__ModuleLoader__.load({
|
|
|
858
867
|
? h('div', { className: 'dsa-approval-body' }, entry.callArguments ?? entry.reason)
|
|
859
868
|
: null,
|
|
860
869
|
h('div', { className: 'dsa-approval-actions' },
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
disabled: busy,
|
|
878
|
-
onClick: () => props.onDecide(entry.id, 'allow-tool'),
|
|
879
|
-
}, '本会话都放行'))))
|
|
870
|
+
[['reject', '拒绝', 'outline'], ['allow', '允许一次', 'primary'], ['allow-tool', '本会话都放行', 'outline']]
|
|
871
|
+
.map(([decision, label, variant]) => (Button
|
|
872
|
+
? h(Button, {
|
|
873
|
+
key: decision,
|
|
874
|
+
variant,
|
|
875
|
+
size: 'sm',
|
|
876
|
+
disabled: busy,
|
|
877
|
+
onClick: () => props.onDecide(entry.id, decision),
|
|
878
|
+
}, label)
|
|
879
|
+
: h('button', {
|
|
880
|
+
key: decision,
|
|
881
|
+
type: 'button',
|
|
882
|
+
className: 'dsa-chip',
|
|
883
|
+
disabled: busy,
|
|
884
|
+
onClick: () => props.onDecide(entry.id, decision),
|
|
885
|
+
}, label))))))
|
|
880
886
|
}))
|
|
881
887
|
}
|
|
882
888
|
|
|
@@ -1066,7 +1072,7 @@ window.__ModuleLoader__.load({
|
|
|
1066
1072
|
key: `${run.id}:${item.href}`, type: 'button', className: 'dsa-artifact-link', title: item.href,
|
|
1067
1073
|
onClick: () => props.onArtifact(run, item),
|
|
1068
1074
|
}, FileTypeIcon ? h(FileTypeIcon, { path: item.href, size: 16 }) : null,
|
|
1069
|
-
h('span', null, item.name))), '暂无产物')))
|
|
1075
|
+
PathLabel ? h(PathLabel, { path: item.href }) : h('span', null, item.name))), '暂无产物')))
|
|
1070
1076
|
}
|
|
1071
1077
|
|
|
1072
1078
|
function ProjectNav({ workbench, onSelect, onAdd, onPick }) {
|
|
@@ -1079,15 +1085,34 @@ window.__ModuleLoader__.load({
|
|
|
1079
1085
|
return h('nav', { className: 'dsa-project-nav', 'aria-label': '全局助理和项目' },
|
|
1080
1086
|
choose(null, '全局助理', !project),
|
|
1081
1087
|
h('div', { className: 'dsa-project-head' }, h('span', null, '项目'),
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1088
|
+
Button
|
|
1089
|
+
? h(Button, {
|
|
1090
|
+
variant: 'ghost',
|
|
1091
|
+
size: 'sm',
|
|
1092
|
+
icon: h(Icon, { of: 'plus', size: 14 }),
|
|
1093
|
+
'aria-label': '添加项目',
|
|
1094
|
+
onClick: async () => {
|
|
1095
|
+
if (workbench?.canPickProject && await onPick()) return
|
|
1096
|
+
setDraft(draft === null ? '' : null)
|
|
1097
|
+
},
|
|
1098
|
+
})
|
|
1099
|
+
: h('button', { type: 'button', className: 'dsa-linkbtn', 'aria-label': '添加项目', onClick: async () => {
|
|
1100
|
+
if (workbench?.canPickProject && await onPick()) return
|
|
1101
|
+
setDraft(draft === null ? '' : null)
|
|
1102
|
+
} }, '+')),
|
|
1086
1103
|
draft === null ? null : h('form', { className: 'dsa-project-add', onSubmit: async event => {
|
|
1087
1104
|
event.preventDefault()
|
|
1088
1105
|
if (draft.trim() && await onAdd(draft.trim())) setDraft(null)
|
|
1089
|
-
} },
|
|
1090
|
-
|
|
1106
|
+
} }, Input
|
|
1107
|
+
? h(Input, {
|
|
1108
|
+
value: draft,
|
|
1109
|
+
placeholder: '项目文件夹绝对路径',
|
|
1110
|
+
onChange: event => setDraft(event.target.value),
|
|
1111
|
+
})
|
|
1112
|
+
: h('input', { className: 'dsa-answer-input', placeholder: '项目文件夹绝对路径', value: draft, onChange: event => setDraft(event.target.value) }),
|
|
1113
|
+
Button
|
|
1114
|
+
? h(Button, { variant: 'outline', size: 'sm', type: 'submit', disabled: !draft.trim() }, '打开项目')
|
|
1115
|
+
: h('button', { type: 'submit', className: 'dsa-linkbtn', disabled: !draft.trim() }, '打开项目')),
|
|
1091
1116
|
(workbench?.projects ?? []).map(entry => choose(entry, entry.name, entry.cwd === project?.cwd)))
|
|
1092
1117
|
}
|
|
1093
1118
|
|
|
@@ -1134,7 +1159,9 @@ window.__ModuleLoader__.load({
|
|
|
1134
1159
|
h('span', { className: 'dsa-session-title' }, item.title || item.first || item.sessionId.slice(0, 12)),
|
|
1135
1160
|
h('span', { className: 'dsa-session-meta' }, `${item.runs ?? 0} 轮`)))),
|
|
1136
1161
|
h('div', { className: 'dsa-sessions-foot' },
|
|
1137
|
-
|
|
1162
|
+
Button
|
|
1163
|
+
? h(Button, { variant: 'ghost', size: 'sm', onClick: () => props.onClose?.() }, '关闭')
|
|
1164
|
+
: h('button', { type: 'button', className: 'dsa-linkbtn', onClick: () => props.onClose?.() }, '关闭')))
|
|
1138
1165
|
}
|
|
1139
1166
|
|
|
1140
1167
|
const STATUS_LABELS = {
|
|
@@ -1241,6 +1268,7 @@ window.__ModuleLoader__.load({
|
|
|
1241
1268
|
|
|
1242
1269
|
/** One delegated run: status, questions waiting for the user, artifacts. */
|
|
1243
1270
|
function RunDetail(props) {
|
|
1271
|
+
const [zoom, setZoom] = react.useState(false)
|
|
1244
1272
|
const { model } = props
|
|
1245
1273
|
const run = model.detail
|
|
1246
1274
|
if (!run) return null
|
|
@@ -1249,7 +1277,9 @@ window.__ModuleLoader__.load({
|
|
|
1249
1277
|
return h('section', { className: 'dsa-detail', 'aria-label': '工作线原会话' },
|
|
1250
1278
|
h('div', { className: 'dsa-detail-head' },
|
|
1251
1279
|
h('span', { className: 'dsa-detail-title' }, worker.title ?? '工作线原会话'),
|
|
1252
|
-
|
|
1280
|
+
Button
|
|
1281
|
+
? h(Button, { variant: 'ghost', size: 'sm', onClick: props.onCloseWorker }, '返回任务')
|
|
1282
|
+
: h('button', { type: 'button', className: 'dsa-linkbtn', onClick: props.onCloseWorker }, '返回任务')),
|
|
1253
1283
|
worker.transcript.messages.length ? h(Transcript, { model: worker.transcript })
|
|
1254
1284
|
: h('div', { className: 'dsa-workbench-empty' }, '暂无会话记录'))
|
|
1255
1285
|
}
|
|
@@ -1259,25 +1289,48 @@ window.__ModuleLoader__.load({
|
|
|
1259
1289
|
const busy = model.detailBusy === true
|
|
1260
1290
|
return h('div', { className: 'dsa-detail', role: 'dialog', 'aria-label': '任务详情' },
|
|
1261
1291
|
h('div', { className: 'dsa-detail-head' },
|
|
1292
|
+
StateDot ? h(StateDot, { state: statusDot(false, run.status), size: 10 }) : null,
|
|
1262
1293
|
h('span', { className: 'dsa-detail-title' }, run.goal ?? '任务详情'),
|
|
1263
|
-
ACTIVE_RUN.has(run.status) ? h('button',
|
|
1264
|
-
|
|
1265
|
-
className: 'dsa-linkbtn',
|
|
1266
|
-
|
|
1267
|
-
|
|
1294
|
+
ACTIVE_RUN.has(run.status) ? h(Button ?? 'button', Button
|
|
1295
|
+
? { variant: 'ghost', size: 'sm', onClick: () => props.onCancelRun?.(run.id) }
|
|
1296
|
+
: { type: 'button', className: 'dsa-linkbtn', onClick: () => props.onCancelRun?.(run.id) }, '停止任务') : null,
|
|
1297
|
+
h(Button ?? 'button', Button
|
|
1298
|
+
? { variant: 'ghost', size: 'sm', icon: h(Icon, { of: 'close', size: 14 }), 'aria-label': '关闭任务详情', onClick: props.onCloseRun }
|
|
1299
|
+
: { type: 'button', className: 'dsa-iconbtn', 'aria-label': '关闭任务详情', onClick: props.onCloseRun },
|
|
1300
|
+
Button ? null : h(Icon, { of: 'close', size: 14 }))),
|
|
1268
1301
|
h('div', { className: 'dsa-detail-body' },
|
|
1269
1302
|
(run.subtasks ?? []).some(task => task.childId) ? h('div', { className: 'dsa-detail-sec' },
|
|
1270
1303
|
h('div', { className: 'dsa-detail-label' }, '工作线会话'),
|
|
1271
1304
|
(run.subtasks ?? []).filter(task => task.childId).map(task => h('div', { key: task.childId, className: 'dsa-goal-phase' },
|
|
1272
1305
|
h('span', null, task.title),
|
|
1273
|
-
|
|
1306
|
+
Button
|
|
1307
|
+
? h(Button, { variant: 'ghost', size: 'sm', onClick: () => props.onOpenWorker(run.id, task.childId) }, '打开会话')
|
|
1308
|
+
: h('button', { type: 'button', className: 'dsa-linkbtn', onClick: () => props.onOpenWorker(run.id, task.childId) }, '打开会话')))) : null,
|
|
1274
1309
|
model.preview
|
|
1275
1310
|
? h('div', { className: 'dsa-detail-sec dsa-preview' },
|
|
1276
1311
|
h('div', { className: 'dsa-detail-head' },
|
|
1277
1312
|
h('span', { className: 'dsa-detail-title' }, model.preview.name),
|
|
1278
|
-
|
|
1313
|
+
Button
|
|
1314
|
+
? h(Button, {
|
|
1315
|
+
variant: 'ghost',
|
|
1316
|
+
size: 'sm',
|
|
1317
|
+
icon: h(Icon, { of: 'close', size: 14 }),
|
|
1318
|
+
'aria-label': '关闭预览',
|
|
1319
|
+
onClick: () => props.onClosePreview?.(),
|
|
1320
|
+
})
|
|
1321
|
+
: h('button', {
|
|
1322
|
+
type: 'button',
|
|
1323
|
+
className: 'dsa-iconbtn',
|
|
1324
|
+
'aria-label': '关闭预览',
|
|
1325
|
+
onClick: () => props.onClosePreview?.(),
|
|
1326
|
+
}, h(Icon, { of: 'close', size: 14 }))),
|
|
1279
1327
|
model.preview.kind === 'img'
|
|
1280
|
-
? h('
|
|
1328
|
+
? h('button', {
|
|
1329
|
+
type: 'button',
|
|
1330
|
+
className: 'dsa-preview-thumb',
|
|
1331
|
+
'aria-label': `放大预览 ${model.preview.name}`,
|
|
1332
|
+
onClick: () => setZoom(true),
|
|
1333
|
+
}, h('img', { className: 'dsa-preview-img', src: model.preview.url, alt: model.preview.name }))
|
|
1281
1334
|
: model.preview.kind === 'html'
|
|
1282
1335
|
? h('iframe', {
|
|
1283
1336
|
className: 'dsa-preview-frame',
|
|
@@ -1332,12 +1385,19 @@ window.__ModuleLoader__.load({
|
|
|
1332
1385
|
}
|
|
1333
1386
|
},
|
|
1334
1387
|
}),
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1388
|
+
Button
|
|
1389
|
+
? h(Button, {
|
|
1390
|
+
variant: 'primary',
|
|
1391
|
+
size: 'sm',
|
|
1392
|
+
disabled: busy || !String(model.answerDraft ?? '').trim(),
|
|
1393
|
+
onClick: () => props.onAnswer?.(run.id, item.id, model.answerDraft),
|
|
1394
|
+
}, '回答')
|
|
1395
|
+
: h('button', {
|
|
1396
|
+
type: 'button',
|
|
1397
|
+
className: 'dsa-chip',
|
|
1398
|
+
disabled: busy || !String(model.answerDraft ?? '').trim(),
|
|
1399
|
+
onClick: () => props.onAnswer?.(run.id, item.id, model.answerDraft),
|
|
1400
|
+
}, '回答')))))
|
|
1341
1401
|
: null,
|
|
1342
1402
|
artifacts.length > 0
|
|
1343
1403
|
? h('div', { className: 'dsa-detail-sec' },
|
|
@@ -1347,7 +1407,8 @@ window.__ModuleLoader__.load({
|
|
|
1347
1407
|
type: 'button',
|
|
1348
1408
|
className: 'dsa-artifact-link',
|
|
1349
1409
|
onClick: () => props.onArtifact?.(item),
|
|
1350
|
-
}, FileTypeIcon ? h(FileTypeIcon, { path: item.href, size: 16 }) : null,
|
|
1410
|
+
}, FileTypeIcon ? h(FileTypeIcon, { path: item.href, size: 16 }) : null,
|
|
1411
|
+
PathLabel ? h(PathLabel, { path: item.href }) : h('span', null, item.name)),
|
|
1351
1412
|
h('button', {
|
|
1352
1413
|
type: 'button',
|
|
1353
1414
|
className: 'dsa-linkbtn',
|
|
@@ -1368,7 +1429,15 @@ window.__ModuleLoader__.load({
|
|
|
1368
1429
|
? h('div', { className: 'dsa-detail-sec' },
|
|
1369
1430
|
run.output ? h('details', null, h('summary', null, '验收报告'), h('div', { className: 'dsa-md-plain' }, run.report))
|
|
1370
1431
|
: h('div', { className: 'dsa-md-plain' }, run.report))
|
|
1371
|
-
: null)
|
|
1432
|
+
: null),
|
|
1433
|
+
zoom && ImageLightbox && model.preview?.kind === 'img'
|
|
1434
|
+
? h(ImageLightbox, {
|
|
1435
|
+
src: model.preview.url,
|
|
1436
|
+
alt: model.preview.name,
|
|
1437
|
+
labels: { dialog: '图片预览', close: '关闭图片预览' },
|
|
1438
|
+
onClose: () => setZoom(false),
|
|
1439
|
+
})
|
|
1440
|
+
: null)
|
|
1372
1441
|
}
|
|
1373
1442
|
|
|
1374
1443
|
/**
|
|
@@ -1425,13 +1494,19 @@ window.__ModuleLoader__.load({
|
|
|
1425
1494
|
item.reason ? h('div', { className: 'dsa-attention-desc' }, item.reason) : null,
|
|
1426
1495
|
h('div', { className: 'dsa-answer-row' },
|
|
1427
1496
|
field,
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1497
|
+
Button
|
|
1498
|
+
? h(Button, {
|
|
1499
|
+
variant: 'primary',
|
|
1500
|
+
size: 'sm',
|
|
1501
|
+
disabled: !draft.trim(),
|
|
1502
|
+
onClick: submit,
|
|
1503
|
+
}, '回答')
|
|
1504
|
+
: h('button', {
|
|
1505
|
+
type: 'button',
|
|
1506
|
+
className: 'dsa-chip',
|
|
1507
|
+
disabled: !draft.trim(),
|
|
1508
|
+
onClick: submit,
|
|
1509
|
+
}, '回答'))),
|
|
1435
1510
|
options.length > 0
|
|
1436
1511
|
? h('div', { className: 'dsa-attention-footer' },
|
|
1437
1512
|
h('div', { className: 'dsa-attention-options' },
|