@xiangyixie/dsh-superagent 0.16.1 → 0.16.3

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 CHANGED
@@ -8,6 +8,39 @@ 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.16.3 — 2026-11-17
12
+
13
+ ### 修复
14
+
15
+ - **assistant 正文恢复了 Markdown 渲染。** 根因不是渲染分支,而是组件探测:
16
+ `MarkdownText` 是 `React.memo` 包装的对象,`Button` 是 `React.forwardRef`
17
+ 对象,0.16.1 起用 `typeof x === 'function'` 判断,两者都被误判为「宿主没导出」,
18
+ 于是正文一直走 `.dsa-md-plain` 纯文本兜底(表格、加粗、行内代码原样露出)。
19
+ 现在同时接受 function、`react.memo` 和 `react.forward_ref`,流式与完成态的
20
+ 正文都走宿主 `MarkdownText`。
21
+ - **降级不再静默。** 缺少宿主组件时在控制台打印一次缺失清单;单条消息降级为
22
+ 纯文本时打印带消息 id 的 `console.error`;`MarkdownText` 运行期抛错由错误
23
+ 边界接住并记录,正文继续以纯文本显示。
24
+
25
+ ### 已知待办(本轮未改)
26
+
27
+ - 委派提示词里把 Run ID、token 统计、并行上限这类内部信息写进了面向用户的
28
+ 输出,措辞需要单独调整。
29
+
30
+ ## 0.16.2 — 2026-11-17
31
+
32
+ ### 变化
33
+
34
+ - **「排队 / 插话」不再用浏览器原生 `<select>`。** 换成宿主导出的 `Menu`:
35
+ 深浅两套语义 token、32px 行高、圆角与阴影都来自宿主菜单,选中态有对勾,
36
+ 支持方向键 / Home / End / Enter、Esc 关闭、点击外部关闭、关闭后焦点回到
37
+ 触发器,并用 `portal` + CSS anchor 定位,不会被输入卡裁掉。
38
+ - **原生提示条换成宿主 `Tooltip`。** 刷新、新建会话、附件、发送、停止、会话行、
39
+ 任务线行、工具参数气泡都改用宿主 `Tooltip`(无 primitives 的宿主才退回
40
+ `title`),不再出现系统黄框提示。
41
+ - 附件仍用隐藏的 `<input type="file">` 触发系统文件选择器——宿主没有文件选择
42
+ 组件,这个输入框本身不可见,外观由旁边的宿主风格按钮承担。
43
+
11
44
  ## 0.16.1 — 2026-11-17
12
45
 
13
46
  ### 变化
package/README.en.md CHANGED
@@ -36,12 +36,12 @@ Three steps. The desktop app and the CLI install the same plugin; each step says
36
36
 
37
37
  ### 1. Install
38
38
 
39
- Desktop: **Plugins** → **Add plugin** → enter `@xiangyixie/dsh-superagent@0.16.1` → install.
39
+ Desktop: **Plugins** → **Add plugin** → enter `@xiangyixie/dsh-superagent@0.16.3` → install.
40
40
 
41
41
  CLI:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.1
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.3
45
45
  ```
46
46
 
47
47
  **Restart DSH** afterwards — plugins are loaded once at host startup. You can also add the [plugin index](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json) on the **Discover** page for one-click installs; upgrades are always remove-then-add.
@@ -1666,7 +1666,7 @@ appears to "hang" until the ignored-abort child returns.
1666
1666
 
1667
1667
  | What you see | What it means | What to do |
1668
1668
  | --- | --- | --- |
1669
- | `superagent_*` tools do not exist | The bundle row is not mounted, or the host refused to load the plugin. | Run `--dump-config` and check for the `@xiangyixie/dsh-superagent` block; reinstall with `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.1` and read the host log for `[dsh-superagent]` lines. |
1669
+ | `superagent_*` tools do not exist | The bundle row is not mounted, or the host refused to load the plugin. | Run `--dump-config` and check for the `@xiangyixie/dsh-superagent` block; reinstall with `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.3` and read the host log for `[dsh-superagent]` lines. |
1670
1670
  | `Cannot find module .../lib/control.js` (or `watch.js` / `report.js` / `wizard.js`), or `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` in the host log | The copy in that profile is incomplete — an `add` that was interrupted leaves a partial extraction. From 0.14.3 the entry point names the missing file itself. The published package is not the cause: every version ships all thirty-four `lib/` files. | Delete the plugin's directory under the profile's `node_modules` (scoped `@xiangyixie/dsh-superagent`, or unscoped `dsh-superagent` from an older tarball install) and run the same `add` command again, with the version number. Do not copy files in by hand. |
1671
1671
  | `[error] the model provider rejected the API key` | The key env var is missing in the process that started the host. | Export `DEEPSEEK_API_KEY` (the default route) or the variable your route names, then restart `dsh`. |
1672
1672
  | `MISSING_CREDENTIAL ... no API key for provider route "..."` | The profile's route has no credential in the environment. | Set the env var named for that route and restart. The error line names the route, so use that, not this page. |
package/README.md CHANGED
@@ -36,12 +36,12 @@ dsh-superagent 把这件事接过去:你说一句目标,它负责拆、负
36
36
 
37
37
  ### 1. 装
38
38
 
39
- 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.1` → 安装。
39
+ 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.3` → 安装。
40
40
 
41
41
  命令行:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.1
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.3
45
45
  ```
46
46
 
47
47
  装完**重启 DSH**(插件只在宿主启动时加载一次)。也可以从「发现」页添加[插件索引](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json)一键安装;升级一律先 `remove` 再 `add`。
@@ -1090,7 +1090,7 @@ SHA-256)。`--format html` 把同样的内容写成一个自包含
1090
1090
 
1091
1091
  | 你看到的 | 含义 | 怎么办 |
1092
1092
  | --- | --- | --- |
1093
- | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.1` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1093
+ | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.3` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1094
1094
  | `Cannot find module .../lib/control.js`(或 `watch.js` / `report.js` / `wizard.js`),或宿主日志里的 `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` | 那个 profile 里的副本不完整——被中断的 `add` 会留下残缺的解包结果。0.14.3 起的入口会直接点名缺哪个文件。已发布的包不是原因:每个版本都带全部三十四个 `lib/` 文件。 | 删掉 profile 的 `node_modules` 下该插件的目录(带 scope 的 `@xiangyixie/dsh-superagent`,或旧 tarball 安装留下的无 scope 的 `dsh-superagent`),再用同一条 `add` 命令重装,并带上版本号。不要手工拷贝文件进去。 |
1095
1095
  | `[error] the model provider rejected the API key` | 启动宿主的那个进程里缺 key 环境变量。 | 导出 `DEEPSEEK_API_KEY`(默认路由)或你那条路由声明的变量,然后重启 `dsh`。 |
1096
1096
  | `MISSING_CREDENTIAL ... no API key for provider route "..."` | profile 的路由在环境里没有凭据。 | 设置该路由对应的环境变量并重启。错误行里写了路由名,以它为准,不要照本文。 |
package/README.zh.md CHANGED
@@ -36,12 +36,12 @@ dsh-superagent 把这件事接过去:你说一句目标,它负责拆、负
36
36
 
37
37
  ### 1. 装
38
38
 
39
- 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.1` → 安装。
39
+ 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.3` → 安装。
40
40
 
41
41
  命令行:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.1
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.3
45
45
  ```
46
46
 
47
47
  装完**重启 DSH**(插件只在宿主启动时加载一次)。也可以从「发现」页添加[插件索引](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json)一键安装;升级一律先 `remove` 再 `add`。
@@ -1090,7 +1090,7 @@ SHA-256)。`--format html` 把同样的内容写成一个自包含
1090
1090
 
1091
1091
  | 你看到的 | 含义 | 怎么办 |
1092
1092
  | --- | --- | --- |
1093
- | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.1` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1093
+ | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.3` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1094
1094
  | `Cannot find module .../lib/control.js`(或 `watch.js` / `report.js` / `wizard.js`),或宿主日志里的 `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` | 那个 profile 里的副本不完整——被中断的 `add` 会留下残缺的解包结果。0.14.3 起的入口会直接点名缺哪个文件。已发布的包不是原因:每个版本都带全部三十四个 `lib/` 文件。 | 删掉 profile 的 `node_modules` 下该插件的目录(带 scope 的 `@xiangyixie/dsh-superagent`,或旧 tarball 安装留下的无 scope 的 `dsh-superagent`),再用同一条 `add` 命令重装,并带上版本号。不要手工拷贝文件进去。 |
1095
1095
  | `[error] the model provider rejected the API key` | 启动宿主的那个进程里缺 key 环境变量。 | 导出 `DEEPSEEK_API_KEY`(默认路由)或你那条路由声明的变量,然后重启 `dsh`。 |
1096
1096
  | `MISSING_CREDENTIAL ... no API key for provider route "..."` | profile 的路由在环境里没有凭据。 | 设置该路由对应的环境变量并重启。错误行里写了路由名,以它为准,不要照本文。 |
package/lib/client.js CHANGED
@@ -52,11 +52,27 @@ window.__ModuleLoader__.load({
52
52
  }
53
53
 
54
54
  const h = react ? react.createElement : null
55
- const Button = ui && typeof ui.Button === 'function' ? ui.Button : null
56
- const FishLogo = ui && typeof ui.FishLogo === 'function' ? ui.FishLogo : null
57
- const MarkdownText = ui && typeof ui.MarkdownText === 'function' ? ui.MarkdownText : null
58
- const UserMessageBubble = ui && typeof ui.UserMessageBubble === 'function' ? ui.UserMessageBubble : null
59
- const StateDot = ui && typeof ui.StateDot === 'function' ? ui.StateDot : null
55
+ // React.memo / React.forwardRef components are objects, not functions.
56
+ // Checking typeof alone silently rejected MarkdownText and Button and made
57
+ // assistant prose fall back to raw text.
58
+ const isComponent = value => typeof value === 'function'
59
+ || (value !== null && typeof value === 'object'
60
+ && (value.$$typeof === Symbol.for('react.memo') || value.$$typeof === Symbol.for('react.forward_ref')))
61
+ const pick = name => (isComponent(ui?.[name]) ? ui[name] : null)
62
+ const Button = pick('Button')
63
+ const FishLogo = pick('FishLogo')
64
+ const MarkdownText = pick('MarkdownText')
65
+ const UserMessageBubble = pick('UserMessageBubble')
66
+ const StateDot = pick('StateDot')
67
+ const Menu = pick('Menu')
68
+ const Tooltip = pick('Tooltip')
69
+ const MISSING_PRIMITIVES = ['Button', 'FishLogo', 'MarkdownText', 'UserMessageBubble', 'StateDot', 'Menu', 'Tooltip']
70
+ .filter(name => !pick(name))
71
+ if (!ui) {
72
+ console.warn('[dsh-superagent] host primitives module is absent; assistant text renders as plain text')
73
+ } else if (MISSING_PRIMITIVES.length > 0) {
74
+ console.warn(`[dsh-superagent] host primitives unavailable: ${MISSING_PRIMITIVES.join(', ')}; those spots fall back to plain rendering`)
75
+ }
60
76
  const ICONS = {
61
77
  spark: ui?.IconSparkleRegular ?? ui?.IconSparkleMedium,
62
78
  send: ui?.IconSendOutlineRegular ?? ui?.IconSendOutlineMedium,
@@ -68,6 +84,7 @@ window.__ModuleLoader__.load({
68
84
  check: ui?.IconCheckOutlineRegular ?? ui?.IconCheckOutlineMedium,
69
85
  close: ui?.IconCloseOutlineRegular ?? ui?.IconCloseOutlineMedium,
70
86
  folder: ui?.IconFolderCloseRegular ?? ui?.IconFolderCloseMedium,
87
+ chevron: ui?.IconChevronDownOutlineRegular ?? ui?.IconChevronDownOutlineMedium,
71
88
  }
72
89
  // MarkdownText reads `labels.code` on every fenced block, so the host
73
90
  // component is only safe with this shape filled in.
@@ -83,6 +100,49 @@ window.__ModuleLoader__.load({
83
100
  },
84
101
  footnotes: '脚注',
85
102
  }
103
+ /** Composer delivery modes, rendered by the host Menu. */
104
+ const MODES = [
105
+ { id: 'queue', label: '排队' },
106
+ { id: 'steer', label: '插话' },
107
+ ]
108
+
109
+ /**
110
+ * Host tooltip when it exists; the native `title` only survives as the
111
+ * fallback for a host that ships no primitives at all.
112
+ */
113
+ function tipped(label, node, side = 'bottom', key) {
114
+ if (Tooltip) return h(Tooltip, { key, label, side }, node)
115
+ return react.cloneElement(node, { key, title: label })
116
+ }
117
+
118
+ const MARKDOWN_FALLBACKS = new Set()
119
+ function noteMarkdownFallback(id, reason) {
120
+ if (MARKDOWN_FALLBACKS.has(id)) return
121
+ MARKDOWN_FALLBACKS.add(id)
122
+ console.error(`[dsh-superagent] assistant message ${id} fell back to plain text: ${reason}`)
123
+ }
124
+
125
+ // A throw inside MarkdownText must be visible, not silently swallowed by
126
+ // React. This logs once and keeps the prose on screen as plain text.
127
+ const MarkdownBoundary = react && typeof react.Component === 'function'
128
+ ? class MarkdownBoundary extends react.Component {
129
+ constructor(props) {
130
+ super(props)
131
+ this.state = { failed: false }
132
+ }
133
+ static getDerivedStateFromError() {
134
+ return { failed: true }
135
+ }
136
+ componentDidCatch(error) {
137
+ noteMarkdownFallback(this.props.messageId, error?.message ?? String(error))
138
+ }
139
+ render() {
140
+ return this.state.failed
141
+ ? h('div', { className: 'dsa-md-plain' }, this.props.text)
142
+ : this.props.children
143
+ }
144
+ }
145
+ : null
86
146
 
87
147
  /**
88
148
  * One class sheet for the panel. Every value is copied from the host's own
@@ -127,8 +187,8 @@ window.__ModuleLoader__.load({
127
187
  .dsa-trailing{margin-left:auto;flex:none}
128
188
  .dsa-add{display:grid;place-items:center;flex:none;width:28px;height:28px;border:0;border-radius:999px;background:var(--dsw-specific-selector,rgba(255,255,255,.08));color:var(--dsw-alias-label-primary,#f9fafb);cursor:pointer}
129
189
  .dsa-add:hover{background:var(--dsw-alias-interactive-bg-hover-solid,rgba(255,255,255,.14))}
130
- .dsa-chip{height:28px;padding:0 20px 0 8px;border:0;border-radius:var(--dsw-radius-sm,8px);background-color:transparent;background-repeat:no-repeat;background-position:right 4px center;background-size:12px 12px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");color:var(--dsw-alias-label-secondary,rgb(207,211,214));font-size:13px;line-height:20px;font-weight:500;white-space:nowrap;cursor:pointer;appearance:none}
131
- .dsa-chip:hover{background-color:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}
190
+ .dsa-chip{display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 8px;border:0;border-radius:var(--dsw-radius-sm,8px);background-color:transparent;color:var(--dsw-alias-label-secondary,rgb(207,211,214));font-size:13px;line-height:20px;font-weight:500;white-space:nowrap;cursor:pointer;appearance:none}
191
+ .dsa-chip:hover,.dsa-chip[aria-expanded=true]{background-color:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}
132
192
  .dsa-send{display:grid;place-items:center;flex:none;width:34px;height:34px;border:0;border-radius:999px;background:var(--dsw-alias-button-info-fill,#3964fe);color:var(--dsw-alias-label-on-color,#fff);cursor:pointer;transform:translateY(-2px);transition:background-color 100ms ease}
133
193
  .dsa-send:hover:not(:disabled){background:var(--dsw-alias-button-info-hover,#2f57e6)}
134
194
  .dsa-send:disabled{opacity:.4;cursor:default}
@@ -489,10 +549,10 @@ window.__ModuleLoader__.load({
489
549
  h('span', { className: 'dsa-status' },
490
550
  h('span', { className: 'dsa-dot', 'data-state': model.conn }),
491
551
  model.conn === 'live' ? '已连接' : model.conn === 'warn' ? '流中断' : '连接中'),
492
- h('button', { type: 'button', className: 'dsa-iconbtn', title: '刷新', onClick: onRefresh },
493
- h(Icon, { of: 'refresh' })),
494
- h('button', { type: 'button', className: 'dsa-iconbtn', title: '新建会话', onClick: onNew },
495
- h(Icon, { of: 'newChat' }))))
552
+ tipped('刷新', h('button', { type: 'button', className: 'dsa-iconbtn', onClick: onRefresh },
553
+ h(Icon, { of: 'refresh' }))),
554
+ tipped('新建会话', h('button', { type: 'button', className: 'dsa-iconbtn', onClick: onNew },
555
+ h(Icon, { of: 'newChat' })))))
496
556
  }
497
557
 
498
558
  function UserMessage(props) {
@@ -511,22 +571,33 @@ window.__ModuleLoader__.load({
511
571
  children.push(h('div', { key: 'reasoning', className: 'dsa-reasoning' }, message.reasoning))
512
572
  }
513
573
  if (tools.length > 0) {
514
- children.push(h('div', { key: 'tools', className: 'dsa-tools-row' }, tools.map(tool => h('span', {
515
- key: tool.callId ?? tool.name,
516
- className: 'dsa-tool',
517
- 'data-status': tool.status,
518
- title: typeof tool.arguments === 'string' ? tool.arguments : undefined,
519
- }, tool.name))))
574
+ children.push(h('div', { key: 'tools', className: 'dsa-tools-row' }, tools.map(tool => {
575
+ const chip = h('span', {
576
+ key: tool.callId ?? tool.name,
577
+ className: 'dsa-tool',
578
+ 'data-status': tool.status,
579
+ }, tool.name)
580
+ return typeof tool.arguments === 'string' && tool.arguments
581
+ ? (Tooltip
582
+ ? h(Tooltip, { key: tool.callId ?? tool.name, label: tool.arguments, side: 'top', maxWidth: 420 }, chip)
583
+ : react.cloneElement(chip, { title: tool.arguments }))
584
+ : chip
585
+ })))
520
586
  }
521
587
  if (message.text) {
522
- children.push(MarkdownText
523
- ? h(MarkdownText, {
524
- key: 'text',
588
+ if (MarkdownText) {
589
+ const node = h(MarkdownText, {
525
590
  text: message.text,
526
591
  streaming: message.streaming === true,
527
592
  labels: MARKDOWN_LABELS,
528
593
  })
529
- : h('div', { key: 'text', className: 'dsa-md-plain' }, message.text))
594
+ children.push(MarkdownBoundary
595
+ ? h(MarkdownBoundary, { key: 'text', messageId: message.id, text: message.text }, node)
596
+ : react.cloneElement(node, { key: 'text' }))
597
+ } else {
598
+ noteMarkdownFallback(message.id, 'host MarkdownText export is unavailable')
599
+ children.push(h('div', { key: 'text', className: 'dsa-md-plain' }, message.text))
600
+ }
530
601
  }
531
602
  return h('div', { className: 'dsa-assistant' }, children)
532
603
  }
@@ -588,10 +659,50 @@ window.__ModuleLoader__.load({
588
659
  }))
589
660
  }
590
661
 
662
+ /**
663
+ * Delivery-mode picker. The host Menu carries the theme, radius, row height,
664
+ * hover fill, check mark, shadow, keyboard handling, outside dismiss and
665
+ * focus return; without it the chip still never falls back to a native
666
+ * `<select>` (it just cycles on click).
667
+ */
668
+ function Chooser(props) {
669
+ const label = MODES.find(entry => entry.id === props.mode)?.label ?? '排队'
670
+ if (!Menu) {
671
+ return h('button', {
672
+ type: 'button',
673
+ className: 'dsa-chip',
674
+ 'aria-label': `发送方式:${label},点击切换`,
675
+ onClick: () => props.onMode(props.mode === 'queue' ? 'steer' : 'queue'),
676
+ }, h('span', null, label), h(Icon, { of: 'chevron', size: 12 }))
677
+ }
678
+ return h(Menu, {
679
+ open: props.open,
680
+ anchor: h('button', {
681
+ type: 'button',
682
+ className: 'dsa-chip',
683
+ 'aria-haspopup': 'menu',
684
+ 'aria-expanded': props.open ? 'true' : 'false',
685
+ 'aria-label': `发送方式:${label}`,
686
+ onClick: () => props.onOpenChange(!props.open),
687
+ }, h('span', null, label), h(Icon, { of: 'chevron', size: 12 })),
688
+ items: MODES,
689
+ selectedId: props.mode,
690
+ side: 'top',
691
+ align: 'start',
692
+ portal: true,
693
+ onClose: () => props.onOpenChange(false),
694
+ onSelect: id => {
695
+ props.onOpenChange(false)
696
+ if (id !== props.mode) props.onMode(id)
697
+ },
698
+ })
699
+ }
700
+
591
701
  function Composer(props) {
592
702
  const { hero, disabled, onSend } = props
593
703
  const [text, setText] = react.useState('')
594
704
  const [busy, setBusy] = react.useState(false)
705
+ const [chooser, setChooser] = react.useState(false)
595
706
  const areaRef = react.useRef(null)
596
707
  const fileRef = react.useRef(null)
597
708
 
@@ -667,39 +778,36 @@ window.__ModuleLoader__.load({
667
778
  event.target.value = ''
668
779
  },
669
780
  }),
670
- h('button', {
781
+ tipped('放进工作区', h('button', {
671
782
  type: 'button',
672
783
  className: 'dsa-add',
673
- title: '放进工作区',
674
784
  disabled: busy,
785
+ 'aria-label': '放进工作区',
675
786
  onClick: () => fileRef.current?.click(),
676
- }, h(Icon, { of: 'plus', size: 16 })),
677
- h('select', {
678
- className: 'dsa-chip',
679
- value: props.mode ?? 'queue',
680
- onChange: event => props.onMode(event.target.value),
681
- title: '发送方式',
682
- },
683
- h('option', { value: 'queue' }, '排队'),
684
- h('option', { value: 'steer' }, '插话'))),
787
+ }, h(Icon, { of: 'plus', size: 16 })), 'top'),
788
+ h(Chooser, {
789
+ mode: props.mode ?? 'queue',
790
+ open: chooser,
791
+ onOpenChange: setChooser,
792
+ onMode: props.onMode,
793
+ })),
685
794
  h('div', { className: 'dsa-trailing' },
686
795
  props.running
687
- ? h('button', {
796
+ ? tipped('停止本轮', h('button', {
688
797
  type: 'button',
689
798
  className: 'dsa-send',
690
799
  'data-mode': 'stop',
691
800
  'aria-label': '停止本轮',
692
- title: '停止本轮',
693
801
  disabled: props.canceling === true,
694
802
  onClick: () => props.onStop?.(),
695
- }, props.canceling ? h('span', { className: 'dsa-spin' }) : h(Icon, { of: 'stop', size: 10 }))
696
- : h('button', {
803
+ }, props.canceling ? h('span', { className: 'dsa-spin' }) : h(Icon, { of: 'stop', size: 10 })), 'top')
804
+ : tipped('发送', h('button', {
697
805
  type: 'button',
698
806
  className: 'dsa-send',
807
+ 'aria-label': '发送',
699
808
  disabled: disabled || !text.trim(),
700
- title: '发送',
701
809
  onClick: submit,
702
- }, h(Icon, { of: 'send', size: 15 }))))),
810
+ }, h(Icon, { of: 'send', size: 15 })), 'top')))),
703
811
  h('div', { className: 'dsa-stats' },
704
812
  h('span', null, props.model.sessionId ? `会话 ${shortId(props.model.sessionId)}` : '还没有会话'),
705
813
  h('span', null, `${props.model.runs.length} 条任务线`)))
@@ -714,29 +822,27 @@ window.__ModuleLoader__.load({
714
822
  h('div', { className: 'dsa-rail-list' },
715
823
  model.sessions.length === 0
716
824
  ? h('div', { className: 'dsa-hint', style: { padding: '8px' } }, model.sessionsReason || '还没有历史会话')
717
- : model.sessions.map(session => h('button', {
825
+ : model.sessions.map(session => tipped(sessionTitle(session), h('button', {
718
826
  key: session.sessionId,
719
827
  type: 'button',
720
828
  className: 'dsa-rowitem',
721
829
  'data-selected': session.sessionId === model.sessionId ? 'true' : 'false',
722
- title: sessionTitle(session),
723
830
  onClick: () => onSwitch(session.sessionId),
724
831
  },
725
832
  h('span', { className: 'dsa-rowtitle' }, sessionTitle(session)),
726
- h('span', { className: 'dsa-rowtime' }, clockOf(session.updatedAt))))),
833
+ h('span', { className: 'dsa-rowtime' }, clockOf(session.updatedAt))), 'left', session.sessionId))),
727
834
  h('div', { className: 'dsa-rail-head' },
728
835
  h('span', null, '任务线'),
729
836
  h('span', null, `${model.runs.length}`)),
730
837
  h('div', { className: 'dsa-rail-list' },
731
838
  model.runs.length === 0
732
839
  ? h('div', { className: 'dsa-hint', style: { padding: '8px' } }, '这一轮还没有任务线')
733
- : model.runs.map(run => h('div', {
840
+ : model.runs.map(run => tipped(run.goal ?? '', h('div', {
734
841
  key: run.id,
735
842
  className: 'dsa-rowitem',
736
- title: run.goal ?? '',
737
843
  },
738
844
  h('span', { className: 'dsa-rowtitle' }, run.goal ?? '任务线'),
739
- h('span', { className: 'dsa-rowtime' }, run.status === 'running' ? '运行中' : run.status === 'completed' ? '完成' : '已停')))))
845
+ h('span', { className: 'dsa-rowtime' }, run.status === 'running' ? '运行中' : run.status === 'completed' ? '完成' : '已停')), 'left', run.id))))
740
846
  }
741
847
 
742
848
  function Hero(props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiangyixie/dsh-superagent",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "description": "长周期自主执行插件:一个目标拆成可并行的子任务,交付一份合并报告,重启后仍可继续。",
5
5
  "author": "Admire (LittleChenLiya)",
6
6
  "type": "module",