dsh-requirement-dev-workbench 4.5.11 → 4.5.13

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 (4) hide show
  1. package/CHANGELOG.md +244 -237
  2. package/dsh/index.js +334 -33
  3. package/lib/client.js +147 -27
  4. package/package.json +65 -65
package/lib/client.js CHANGED
@@ -13,7 +13,7 @@ window.__ModuleLoader__.load({
13
13
  const { useCallback, useEffect, useMemo, useRef, useState } = React
14
14
 
15
15
  const API = '/api/requirement-dev-workbench'
16
- const WORKBENCH_VERSION = '4.5.11'
16
+ const WORKBENCH_VERSION = '4.5.13'
17
17
  const STYLE_ID = 'rdw-business-panel-styles'
18
18
 
19
19
  const CSS = `
@@ -529,6 +529,26 @@ window.__ModuleLoader__.load({
529
529
  * yyyy-MM-dd HH:mm:ss。只认带日期+时间的串,普通文本原样返回,
530
530
  * 避免把「需求编号」这类数字/短横线误当时间。
531
531
  */
532
+ /** 飞书内部主键这类字段,不给人看。 */
533
+ /**
534
+ * 专家在界面上统一显示成「别名 · 职务」。
535
+ * 别名和职务都是使用者自己填的自定义文本,可能只填一个、也可能都不填:
536
+ * - 两个都有 → 别名 · 职务
537
+ * - 只有一个 → 显示那一个
538
+ * - 都没有 → 退回专家标识,不显示空白
539
+ */
540
+ function expertLabel(expert) {
541
+ const alias = String(expert?.displayName ?? '').trim()
542
+ const role = String(expert?.profession ?? '').trim()
543
+ if (alias && role) return alias + ' · ' + role
544
+ if (alias) return alias
545
+ if (role) return role
546
+ return String(expert?.agentId ?? expert?.id ?? expert?.name ?? '专家')
547
+ }
548
+
549
+ function isInternalKey(key) {
550
+ return /^(record_id|recordId|recordIDs|_id)$/i.test(String(key ?? '').trim())
551
+ }
532
552
  function formatCellValue(value) {
533
553
  const raw = String(value ?? '').trim()
534
554
  if (!raw) return ''
@@ -751,7 +771,8 @@ window.__ModuleLoader__.load({
751
771
  lines.push(String(value))
752
772
  }
753
773
  const shown = new Set(['需求标题', '需求编号', '状态', '负责人', '优先级', '原始需求', '详细设计', '详细设计链接', '开发补充描述', '验收标准'])
754
- const rest = Object.entries(item.fields ?? {}).filter(([key, value]) => value && !shown.has(key))
774
+ // record_id 是飞书内部主键,对看需求没用,详情与指令里都不展示
775
+ const rest = Object.entries(item.fields ?? {}).filter(([key, value]) => value && !shown.has(key) && !isInternalKey(key))
755
776
  if (rest.length) {
756
777
  lines.push('')
757
778
  lines.push('其它字段:')
@@ -1080,6 +1101,10 @@ window.__ModuleLoader__.load({
1080
1101
  const [dragCounts, setDragCounts] = useState({ starts: 0, moves: 0 })
1081
1102
  const dragSessionRef = useRef(null)
1082
1103
  const [splitRef, splitNodeRef, splitWidth, splitHeight] = useContainerSize()
1104
+ // v4.5.12 白屏复盘:这里曾经放过一个「保留旧数据」的 ref,但被另一处(目录选择弹窗)
1105
+ // 提前引用到,运行时抛 ReferenceError,整个工作台就白屏了。切换的顺滑改由服务端缓存保证。
1106
+ const [staleTick, setStaleTick] = useState(0)
1107
+ const showStale = useMemo(() => staleTick >= 0, [staleTick])
1083
1108
 
1084
1109
  const settings = state?.settings ?? {}
1085
1110
  const tableKey = table?.key ?? ''
@@ -1118,6 +1143,9 @@ window.__ModuleLoader__.load({
1118
1143
  return
1119
1144
  }
1120
1145
  try {
1146
+ // /workspace 返回的是扁平结构:projectDir / ownProjectDir / inherited 都在顶层。
1147
+ // 以前保存后按 { workspace: {...} } 取,取到 null,界面就退回全局设置,
1148
+ // 表现成「改了一个模块的目录,看别的模块也变了」。
1121
1149
  setWsInfo(await api(`/workspace?module=${encodeURIComponent(moduleKey)}`))
1122
1150
  } catch {
1123
1151
  setWsInfo(null)
@@ -1131,9 +1159,12 @@ window.__ModuleLoader__.load({
1131
1159
  const saveWorkspace = useCallback(async (projectDir) => {
1132
1160
  if (!moduleKey) throw new Error('这个模块还没有自己的数据来源,先点 🔗 配一张表')
1133
1161
  const result = await api('/workspace', { method: 'POST', body: JSON.stringify({ moduleKey, projectDir }) })
1134
- setWsInfo(result?.workspace ?? null)
1162
+ setWsInfo(result ?? null)
1163
+ // 目录变了:重新读一次「这个模块」的目录与表,别让页面停在改之前的状态
1164
+ void loadWorkspace()
1165
+ void loadFields()
1135
1166
  return result
1136
- }, [moduleKey])
1167
+ }, [moduleKey, loadWorkspace, loadFields])
1137
1168
 
1138
1169
  useEffect(() => {
1139
1170
  if (state?.configured) loadFields()
@@ -1442,10 +1473,20 @@ window.__ModuleLoader__.load({
1442
1473
  const saveSettings = async (patch) => {
1443
1474
  setToast('')
1444
1475
  try {
1445
- await api('/settings', { method: 'POST', body: JSON.stringify(patch) })
1446
- notifySettingsChanged(patch)
1476
+ // 模块里打开设置时,目录要写进「这个模块」,绝不能落到全局 settings:
1477
+ // 全局一变,所有没有自己目录的模块都会被带着一起改(就是串模块的原因)。
1478
+ let modulePatch = patch
1479
+ if (moduleKey && Object.hasOwn(patch, 'projectDir')) {
1480
+ const { projectDir: ownDir, ...rest } = patch
1481
+ modulePatch = rest
1482
+ await saveWorkspace(String(ownDir ?? ''))
1483
+ }
1484
+ if (Object.keys(modulePatch).length) {
1485
+ await api('/settings', { method: 'POST', body: JSON.stringify(modulePatch) })
1486
+ notifySettingsChanged(modulePatch)
1487
+ }
1447
1488
  await reloadState()
1448
- await onSavedSettings?.(patch)
1489
+ await onSavedSettings?.(modulePatch)
1449
1490
  setToast('已保存')
1450
1491
  setShowSettings(false)
1451
1492
  load()
@@ -1461,7 +1502,8 @@ window.__ModuleLoader__.load({
1461
1502
  await saveSettings({ projectDir: picked })
1462
1503
  return
1463
1504
  }
1464
- setDirPicker({ start: String(settings?.projectDir ?? '') })
1505
+ // 起点用「这个模块」当前的目录,别拿全局目录当起点
1506
+ setDirPicker({ start: String(moduleDirNow || settings?.projectDir || '') })
1465
1507
  }
1466
1508
 
1467
1509
  const copyInstruction = async () => {
@@ -1564,6 +1606,10 @@ window.__ModuleLoader__.load({
1564
1606
  onReloadSources: loadSources,
1565
1607
  onCancel: onCloseSettings ?? (() => setShowSettings(false)),
1566
1608
  onSave: saveSettings,
1609
+ // 带上模块身份:设置页里的「项目目录」要写进这个模块,不能落到全局 settings
1610
+ moduleKey,
1611
+ moduleTitle: table?.label ?? moduleKey,
1612
+ moduleDir: moduleDirNow,
1567
1613
  })
1568
1614
  // 设置页是「提前 return」的独立分支:目录选择弹窗必须挂在这一层,
1569
1615
  // 否则在设置页点「选择项目目录」只改状态、弹窗永远不渲染(v4.5.3 修的回归)。
@@ -2189,7 +2235,7 @@ window.__ModuleLoader__.load({
2189
2235
  )
2190
2236
  }
2191
2237
 
2192
- function SettingsView({ settings, sources, failure, onCancel, onSave, larkCli, chooseDirectory, onReloadSources }) {
2238
+ function SettingsView({ settings, sources, failure, onCancel, onSave, larkCli, chooseDirectory, onReloadSources, moduleKey = '', moduleTitle = '', moduleDir = '', onOpenModuleWorkspace }) {
2193
2239
  const [remoteSource, setRemoteSource] = useState(null)
2194
2240
  useEffect(() => {
2195
2241
  let live = true
@@ -2200,7 +2246,10 @@ window.__ModuleLoader__.load({
2200
2246
  }, [])
2201
2247
  const [link, setLink] = useState(settings.baseToken ? `${settings.baseToken} ${settings.tableId}` : '')
2202
2248
  const [tableId, setTableId] = useState(settings.tableId ?? '')
2203
- const [projectDir, setProjectDir] = useState(settings.projectDir ?? '')
2249
+ // 在某个模块里打开设置时,这一栏是「这个模块自己的目录」,不是全局项目目录。
2250
+ // 以前这里一律读全局 settings.projectDir 并写回 /settings —— 改一个模块,所有没有
2251
+ // 自己目录的模块都跟着变(moduleProjectDir 的规则是「模块没填就跟随全局」)。
2252
+ const [projectDir, setProjectDir] = useState(moduleKey ? String(moduleDir ?? '') : (settings.projectDir ?? ''))
2204
2253
  const [titleField, setTitleField] = useState(settings.titleField ?? '')
2205
2254
  const [statusField, setStatusField] = useState(settings.statusField ?? '')
2206
2255
  const [sourceName, setSourceName] = useState(settings.sourceName ?? '')
@@ -2223,7 +2272,15 @@ window.__ModuleLoader__.load({
2223
2272
  'div',
2224
2273
  { className: 'rdw-card' },
2225
2274
  h('h3', null, '1. 先选项目目录'),
2226
- h(Field, { label: '项目目录(绝对路径)', value: projectDir, placeholder: 'D:\\workspace\\your-project', onChange: setProjectDir }),
2275
+ moduleKey
2276
+ ? h('div', { className: 'rdw-note', style: { marginBottom: 4 } }, `这里是「${moduleTitle || moduleKey}」自己的工作区目录:只影响这个模块,其他模块保持各自的选择。`)
2277
+ : h('div', { className: 'rdw-note', style: { marginBottom: 4 } }, '这里设置的是全局默认项目目录:没有单独设置过工作区的模块都会跟随它。'),
2278
+ h(Field, {
2279
+ label: moduleKey ? '这个模块的项目目录(留空 = 跟随全局项目)' : '项目目录(绝对路径)',
2280
+ value: projectDir,
2281
+ placeholder: 'D:\\workspace\\your-project',
2282
+ onChange: setProjectDir,
2283
+ }),
2227
2284
  h('div', { className: 'rdw-toolbar', style: { marginTop: 6 } }, h('button', { className: 'rdw-btn', onClick: chooseRoot, disabled: !chooseDirectory }, '用系统目录选择器挑选')),
2228
2285
  h('div', { className: 'rdw-note' }, '选好项目后,「技能与规范」会扫描它的 skill;如果项目里已经有需求源配置,会自动认出来。'),
2229
2286
  h('div', { className: 'rdw-note' }, '优先读取项目根目录的 sino-skill-config.json,未配置的类别仍可使用旧的独立配置文件。'),
@@ -2654,7 +2711,7 @@ window.__ModuleLoader__.load({
2654
2711
  }
2655
2712
  const statuses = ['待开发', '开发中', '已完成']
2656
2713
  const expertOptions = [
2657
- ...(expertData?.experts ?? []).map((expert) => ({ value: `agent:${expert.agentId}`, label: `专家 · ${expert.displayName || expert.name}(${expert.profession || expert.name})` })),
2714
+ ...(expertData?.experts ?? []).map((expert) => ({ value: `agent:${expert.agentId}`, label: `专家 · ${expertLabel(expert)}` })),
2658
2715
  ...(expertData?.teams ?? []).map((team) => ({ value: `team:${team.id}`, label: `专家团 · ${team.name}(${team.members.length} 人)` })),
2659
2716
  ]
2660
2717
  const expertPick = resolveExpertPick(settings, expertData)
@@ -2699,7 +2756,7 @@ window.__ModuleLoader__.load({
2699
2756
  h(
2700
2757
  'dl',
2701
2758
  { className: 'rdw-kv' },
2702
- ...Object.entries(item.fields ?? {}).flatMap(([key, value]) => [h('dt', { key: `k-${key}` }, key), h('dd', { key: `v-${key}` }, formatCellValue(value) || '—')]),
2759
+ ...Object.entries(item.fields ?? {}).filter(([key]) => !isInternalKey(key)).flatMap(([key, value]) => [h('dt', { key: `k-${key}` }, key), h('dd', { key: `v-${key}` }, formatCellValue(value) || '—')]),
2703
2760
  ),
2704
2761
  h('div', { style: { marginTop: 14 } }, h('div', { className: 'rdw-note' }, `项目目录:${settings.projectDir || '未选择'}`), h('div', { className: 'rdw-toolbar', style: { marginTop: 6 } }, h('button', { className: 'rdw-btn', onClick: chooseDirectory }, '选择项目目录'))),
2705
2762
  h(
@@ -3139,6 +3196,9 @@ window.__ModuleLoader__.load({
3139
3196
  const [aiPrompt, setAiPrompt] = useState('')
3140
3197
  const [aiBusy, setAiBusy] = useState(false)
3141
3198
  const [aiResult, setAiResult] = useState(null)
3199
+ // 失败要说清楚(ChatGPT 说的「点了没反应」多半是这里只改小字提示)
3200
+ const [aiNoteTone, setAiNoteTone] = useState('')
3201
+ const [aiFailure, setAiFailure] = useState(null)
3142
3202
  const settings = state?.settings ?? {}
3143
3203
  const live = expertData ?? data
3144
3204
 
@@ -3185,6 +3245,8 @@ window.__ModuleLoader__.load({
3185
3245
  /** 打开「交给 AI 完善」面板(专家/专家团)。 */
3186
3246
  const openAi = (kind) => {
3187
3247
  setAiNote('')
3248
+ setAiNoteTone('')
3249
+ setAiFailure(null)
3188
3250
  setAiPrompt('')
3189
3251
  setAiResult(null)
3190
3252
  setToast('')
@@ -3207,11 +3269,13 @@ window.__ModuleLoader__.load({
3207
3269
  const description = String(aiDraft.description ?? '').trim()
3208
3270
  if (!description) {
3209
3271
  setAiNote('先用一句话说清你要谁(比如「一个盯支付对账的后端专家」),剩下的 AI 补齐。')
3272
+ setAiNoteTone('error')
3210
3273
  return
3211
3274
  }
3212
3275
  setAiBusy(true)
3213
3276
  setAiResult(null)
3214
3277
  setAiNote('AI 正在按专业流程完善…(这个页面会直接出结果,不用管右侧对话)')
3278
+ setAiNoteTone('')
3215
3279
  try {
3216
3280
  const result = await api('/ai/create', {
3217
3281
  method: 'POST',
@@ -3225,9 +3289,16 @@ window.__ModuleLoader__.load({
3225
3289
  })
3226
3290
  setAiResult(result)
3227
3291
  setAiNote(`✓ 已创建:${result.name || result.id}`)
3292
+ setAiNoteTone('ok')
3228
3293
  if (refresh) await refresh()
3229
3294
  } catch (error) {
3230
- setAiNote(`页面里直接创建没成功:${error.message}。可以用右边「发到对话里做」,或「我自己填(高级)」。`)
3295
+ // 失败一定要看得出来:以前这条只改了小字提示,AI 明明写出了完整草稿却因为落盘目录
3296
+ // 解析不到而失败时,界面看上去像「点了没反应」。
3297
+ const message = String(error?.message ?? error)
3298
+ const detail = error?.payload ?? null
3299
+ setAiNote(`没创建成功:${message}`)
3300
+ setAiNoteTone('error')
3301
+ setAiFailure({ message, detail })
3231
3302
  } finally {
3232
3303
  setAiBusy(false)
3233
3304
  }
@@ -3336,7 +3407,7 @@ window.__ModuleLoader__.load({
3336
3407
  'div',
3337
3408
  { className: 'rdw-checks' },
3338
3409
  h('button', { className: `rdw-btn${!settings.expert ? ' is-primary' : ''}`, onClick: () => pick('') }, '不用专家(普通交付)'),
3339
- ...experts.map((expert) => h('button', { key: `a-${expert.agentId}`, className: `rdw-btn${settings.expert === `agent:${expert.agentId}` ? ' is-primary' : ''}`, onClick: () => pick(`agent:${expert.agentId}`) }, `专家 · ${expert.displayName || expert.name}`)),
3410
+ ...experts.map((expert) => h('button', { key: `a-${expert.agentId}`, className: `rdw-btn${settings.expert === `agent:${expert.agentId}` ? ' is-primary' : ''}`, onClick: () => pick(`agent:${expert.agentId}`) }, `专家 · ${expertLabel(expert)}`)),
3340
3411
  ...teams.map((team) => h('button', { key: `t-${team.id}`, className: `rdw-btn${settings.expert === `team:${team.id}` ? ' is-primary' : ''}`, onClick: () => pick(`team:${team.id}`) }, `专家团 · ${team.name}`)),
3341
3412
  ),
3342
3413
  toast ? h('div', { className: 'rdw-note', style: { marginTop: 8 } }, toast) : null,
@@ -3402,7 +3473,31 @@ window.__ModuleLoader__.load({
3402
3473
  h('button', { className: 'rdw-btn', onClick: () => setAiTab('') }, '取消'),
3403
3474
  ),
3404
3475
  h('div', { className: 'rdw-note', style: { marginTop: 4 } }, '「AI 直接创建」在这个页面里就完成(工作台自己调模型并落盘),不需要去外面复制任何提示词。'),
3405
- aiNote ? h('div', { className: 'rdw-note', style: { marginTop: 8 } }, aiNote) : null,
3476
+ aiNote
3477
+ ? h(
3478
+ 'div',
3479
+ {
3480
+ className: 'rdw-note',
3481
+ style: {
3482
+ marginTop: 8,
3483
+ ...(aiNoteTone === 'error'
3484
+ ? { color: '#ff8a80', border: '1px solid rgba(255,110,100,.45)', borderRadius: 8, padding: '8px 10px', background: 'rgba(255,110,100,.08)' }
3485
+ : aiNoteTone === 'ok'
3486
+ ? { color: '#7ee2a8' }
3487
+ : {}),
3488
+ },
3489
+ },
3490
+ aiNote,
3491
+ )
3492
+ : null,
3493
+ aiFailure?.detail
3494
+ ? h(
3495
+ 'div',
3496
+ { className: 'rdw-card', style: { marginTop: 8, borderColor: 'rgba(255,110,100,.35)' } },
3497
+ h('div', { className: 'rdw-note' }, '模型已经把角色写出来了,只是没落盘。原文如下,可复制到「我自己填(高级)」里用:'),
3498
+ h('pre', { className: 'rdw-pre', style: { maxHeight: 220, overflow: 'auto' } }, String(aiFailure.detail.draft ? JSON.stringify(aiFailure.detail.draft, null, 2) : aiFailure.detail.raw ?? '')),
3499
+ )
3500
+ : null,
3406
3501
  aiResult
3407
3502
  ? h(
3408
3503
  'div',
@@ -3440,16 +3535,33 @@ window.__ModuleLoader__.load({
3440
3535
  { className: 'rdw-filterrow' },
3441
3536
  h('span', { className: 'rdw-note' }, '标识(小写字母/数字/连字符)'),
3442
3537
  h('input', { className: 'rdw-input', value: draft.id, placeholder: 'java-backend-expert', 'aria-label': '专家标识', onChange: (event) => setDraft({ ...draft, id: event.target.value }) }),
3443
- h('span', { className: 'rdw-note' }, '显示名'),
3444
- h('input', { className: 'rdw-input', value: draft.displayName, placeholder: '老陈', 'aria-label': '专家显示名', onChange: (event) => setDraft({ ...draft, displayName: event.target.value }) }),
3445
- h('span', { className: 'rdw-note' }, '职业/定位'),
3446
- h('input', { className: 'rdw-input', value: draft.profession, placeholder: 'Java 后端开发专家', 'aria-label': '专家定位', onChange: (event) => setDraft({ ...draft, profession: event.target.value }) }),
3538
+ // 界面上专家统一显示成「别名 · 职务」,两个字段都由使用者自己填。
3539
+ h('span', { className: 'rdw-note' }, '别名'),
3540
+ h('input', { className: 'rdw-input', value: draft.displayName, placeholder: '老周(随便起,团队里怎么称呼他)', 'aria-label': '专家别名', onChange: (event) => setDraft({ ...draft, displayName: event.target.value }) }),
3541
+ h('span', { className: 'rdw-note' }, '职务'),
3542
+ h('input', { className: 'rdw-input', value: draft.profession, placeholder: '产品经理 · 需求分析与详细设计', 'aria-label': '专家职务', onChange: (event) => setDraft({ ...draft, profession: event.target.value }) }),
3543
+ draft.displayName || draft.profession
3544
+ ? h(
3545
+ 'span',
3546
+ { className: 'rdw-note', style: { flexBasis: '100%' } },
3547
+ `列表里会显示成:${draft.displayName || '(未填别名)'} · ${draft.profession || '(未填职务)'}`,
3548
+ )
3549
+ : null,
3447
3550
  h(
3448
3551
  'select',
3449
3552
  { className: 'rdw-input', value: draft.scope, 'aria-label': '专家适用范围', onChange: (event) => setDraft({ ...draft, scope: event.target.value }) },
3450
3553
  h('option', { value: 'harness' }, 'DeepSeek Harness 通用(所有项目可用)'),
3451
3554
  h('option', { value: 'project' }, '只放当前项目'),
3452
3555
  ),
3556
+ // 选完作用域立刻把「最终写进哪个目录」摊开写清楚:
3557
+ // 只放当前项目 = 跟着项目目录走,换项目/换工作区就看不到了;通用 = 所有项目都能选到。
3558
+ h(
3559
+ 'span',
3560
+ { className: 'rdw-note', style: { flexBasis: '100%' } },
3561
+ draft.scope === 'harness'
3562
+ ? `所有项目都能用,写进:${live?.targets?.harness?.dir || '(取不到 DSH_HOME)'}`
3563
+ : `只在这个项目里可见,写进:${live?.targets?.project?.dir || '(先选项目目录)'} · 离开这个项目(换工作区/换模块)就选不到它了`,
3564
+ ),
3453
3565
  draft.scope === 'project'
3454
3566
  ? h(
3455
3567
  'select',
@@ -3522,7 +3634,7 @@ window.__ModuleLoader__.load({
3522
3634
  h(
3523
3635
  'div',
3524
3636
  { className: 'rdw-checks' },
3525
- ...experts.map((expert) => h('button', { key: expert.path, className: `rdw-btn${teamDraft.members.includes(expert.agentId) ? ' is-primary' : ''}`, onClick: () => toggleMember(expert.agentId) }, `${expert.displayName || expert.name}(${expert.profession || expert.agentId})`)),
3637
+ ...experts.map((expert) => h('button', { key: expert.path, className: `rdw-btn${teamDraft.members.includes(expert.agentId) ? ' is-primary' : ''}`, onClick: () => toggleMember(expert.agentId) }, expertLabel(expert))),
3526
3638
  experts.length ? null : h('span', { className: 'rdw-note' }, '还没有专家,先新建一位专家再来组团'),
3527
3639
  ),
3528
3640
  ),
@@ -3560,7 +3672,7 @@ window.__ModuleLoader__.load({
3560
3672
  h(
3561
3673
  'button',
3562
3674
  { key: expert.path, className: 'rdw-item', 'aria-current': settings.expert === `agent:${expert.agentId}` ? 'true' : 'false', style: { marginBottom: 6 }, onClick: () => open(expert) },
3563
- h('span', { className: 'rdw-item-title' }, `${expert.displayName || expert.name} · ${expert.profession || expert.agentId}`),
3675
+ h('span', { className: 'rdw-item-title' }, expertLabel(expert)),
3564
3676
  h('span', { className: 'rdw-note' }, expert.description),
3565
3677
  (expert.alsoIn ?? []).length
3566
3678
  ? h('span', { className: 'rdw-note' }, `同名还在:${(expert.alsoIn ?? []).join('、')}`)
@@ -4565,7 +4677,7 @@ window.__ModuleLoader__.load({
4565
4677
  const list = []
4566
4678
  for (const team of expertData?.teams ?? []) list.push({ value: `team:${team.id}`, label: `专家团 · ${team.name || team.id}`, team })
4567
4679
  for (const expert of expertData?.experts ?? []) {
4568
- list.push({ value: `expert:${expert.agentId}`, label: `专家 · ${expert.displayName || expert.name || expert.agentId}`, expert })
4680
+ list.push({ value: `expert:${expert.agentId}`, label: `专家 · ${expertLabel(expert)}`, expert })
4569
4681
  }
4570
4682
  return list
4571
4683
  }, [expertData])
@@ -5204,11 +5316,16 @@ window.__ModuleLoader__.load({
5204
5316
  setWorkspaceDialog(null)
5205
5317
  void reloadWorkspace(workspaceFor)
5206
5318
  }, [workspaceFor, reloadWorkspace])
5319
+ // 模块列表里那份「改模块目录」的回调。改完必须让内容区重建,否则页面上还显示旧目录:
5320
+ // - 模块自己那份 wsInfo(📁 按钮、开发指令、执行记录都读它)不会自己刷新;
5321
+ // - TableModule 的 key 只跟全局 projectDir 变,模块目录变了它不会重建。
5322
+ const [wsEpoch, setWsEpoch] = useState(0)
5207
5323
  const saveModuleWorkspace = useCallback(async (projectDir) => {
5208
5324
  const result = await api('/workspace', { method: 'POST', body: JSON.stringify({ moduleKey: workspaceFor, projectDir }) })
5209
- setWorkspaceDialog(result?.workspace ?? null)
5325
+ setWorkspaceDialog(result ?? null)
5210
5326
  await reloadView()
5211
5327
  await reloadTables()
5328
+ setWsEpoch((value) => value + 1)
5212
5329
  return result
5213
5330
  }, [workspaceFor, reloadView, reloadTables])
5214
5331
  /** 让用户自己挑一个目录(优先系统对话框,没有就用自带的浏览器)。 */
@@ -5632,7 +5749,9 @@ window.__ModuleLoader__.load({
5632
5749
  : h(TableModule, {
5633
5750
  // key 里带上「配置好了没」:从设置页回到内容区时重建一次,
5634
5751
  // 宽度测量才挂得到新出现的容器上(否则窄内容区的详情让位不会生效)。
5635
- key: `${activeEntry?.id}:${state?.configured ? 'ready' : 'setup'}:${state?.settings?.projectDir ?? ''}`,
5752
+ // 再带上「这个模块自己的目录 + 改动次数」:改完模块工作区要重新读 /workspace 与 /requirements,
5753
+ // 否则页面还显示改之前的目录(会误以为改动串到别的模块上了)。
5754
+ key: `${activeEntry?.id}:${state?.configured ? 'ready' : 'setup'}:${state?.settings?.projectDir ?? ''}:${activeEntry?.module?.projectDir ?? ''}:${wsEpoch}`,
5636
5755
  state,
5637
5756
  reloadState,
5638
5757
  settingsOnly: activeEntry?.kind === 'settings',
@@ -5897,7 +6016,7 @@ window.__ModuleLoader__.load({
5897
6016
  ? teams.find((entry) => `team:${entry.id}` === selected)
5898
6017
  : experts.find((entry) => `agent:${entry.agentId}` === selected)
5899
6018
  : null
5900
- const buttonLabel = current ? `+ 专家 · ${current.displayName || current.name || current.id}` : '+ 专家'
6019
+ const buttonLabel = current ? `+ 专家 · ${expertLabel(current)}` : '+ 专家'
5901
6020
 
5902
6021
  return h(
5903
6022
  'div',
@@ -5940,7 +6059,7 @@ window.__ModuleLoader__.load({
5940
6059
  className: `rdw-expert-option${selected === `agent:${expert.agentId}` ? ' is-current' : ''}`,
5941
6060
  onClick: () => use({ ...expert, kind: 'expert' }, `agent:${expert.agentId}`),
5942
6061
  },
5943
- h('span', { className: 'rdw-expert-option-title' }, `${expert.displayName || expert.name} · ${expert.profession || expert.agentId}`),
6062
+ h('span', { className: 'rdw-expert-option-title' }, expertLabel(expert)),
5944
6063
  expert.description ? h('span', { className: 'rdw-expert-option-note' }, expert.description) : null,
5945
6064
  ),
5946
6065
  ),
@@ -6149,6 +6268,7 @@ window.__ModuleLoader__.load({
6149
6268
  // 自测钩子:给 test/smoke.mjs 直接跑组件函数体与纯函数用;宿主只读 apply/inject,多余的键会被忽略。
6150
6269
  __components: { BusinessPanel, TableModule, OverviewModule, ModuleDialog, ModuleSourceDialog, WorkspaceDialog, DetailView, ChangelogDialog, ViewConfigPanel, SettingsView, SkillsModule, DevModule, ExpertsModule, ExpertComposerEntry, FlowModule, DocsModule, DirectoryPickerDialog },
6151
6270
  __pure: {
6271
+ expertLabel,
6152
6272
  summarizeBuckets,
6153
6273
  runBadge,
6154
6274
  sliceForTable,
package/package.json CHANGED
@@ -1,65 +1,65 @@
1
- {
2
- "name": "dsh-requirement-dev-workbench",
3
- "version": "4.5.11",
4
- "private": false,
5
- "type": "module",
6
- "description": "AI Native 工作台:把「拿任务 → 开发 → 验收」串成一条流水线。跨多张飞书多维表格看开发任务与进度,拉取飞书文档信息,用专家/专家团跑完整流程(需求分析 → 代码开发 → 代码评审 → QA 测试),选中本地项目后一键生成开发指令,并可浏览项目/全局 skill 与开发规范。模块可扩展。",
7
- "license": "MIT",
8
- "author": "EDY",
9
- "main": "dsh/index.js",
10
- "homepage": "https://github.com/chdepanghu/dsh-worker-plug#readme",
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/chdepanghu/dsh-worker-plug.git"
14
- },
15
- "bugs": {
16
- "url": "https://github.com/chdepanghu/dsh-worker-plug/issues"
17
- },
18
- "scripts": {
19
- "test": "node test/smoke.mjs"
20
- },
21
- "exports": {
22
- ".": "./dsh/index.js",
23
- "./client": "./lib/client.js",
24
- "./cordis.patch.yml": "./cordis.patch.yml",
25
- "./package.json": "./package.json"
26
- },
27
- "dsh": {
28
- "bundle": {
29
- "patch": "./cordis.patch.yml"
30
- },
31
- "client": {
32
- "platform": "web"
33
- }
34
- },
35
- "peerDependencies": {
36
- "@deepseek-ai/cordis": ">=4.0.0",
37
- "@deepseek-ai/schemastery": ">=3.0.0"
38
- },
39
- "peerDependenciesMeta": {
40
- "@deepseek-ai/cordis": {
41
- "optional": true
42
- },
43
- "@deepseek-ai/schemastery": {
44
- "optional": true
45
- }
46
- },
47
- "files": [
48
- "dsh",
49
- "lib",
50
- "cordis.patch.yml",
51
- "README.md",
52
- "CHANGELOG.md",
53
- "LICENSE"
54
- ],
55
- "keywords": [
56
- "dsh",
57
- "dsh-plugin",
58
- "dsh-workbench",
59
- "ai-native",
60
- "workbench",
61
- "requirement",
62
- "feishu",
63
- "lark"
64
- ]
65
- }
1
+ {
2
+ "name": "dsh-requirement-dev-workbench",
3
+ "version": "4.5.13",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "AI Native 工作台:把「拿任务 → 开发 → 验收」串成一条流水线。跨多张飞书多维表格看开发任务与进度,拉取飞书文档信息,用专家/专家团跑完整流程(需求分析 → 代码开发 → 代码评审 → QA 测试),选中本地项目后一键生成开发指令,并可浏览项目/全局 skill 与开发规范。模块可扩展。",
7
+ "license": "MIT",
8
+ "author": "EDY",
9
+ "main": "dsh/index.js",
10
+ "homepage": "https://github.com/chdepanghu/dsh-worker-plug#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/chdepanghu/dsh-worker-plug.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/chdepanghu/dsh-worker-plug/issues"
17
+ },
18
+ "scripts": {
19
+ "test": "node test/smoke.mjs"
20
+ },
21
+ "exports": {
22
+ ".": "./dsh/index.js",
23
+ "./client": "./lib/client.js",
24
+ "./cordis.patch.yml": "./cordis.patch.yml",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "dsh": {
28
+ "bundle": {
29
+ "patch": "./cordis.patch.yml"
30
+ },
31
+ "client": {
32
+ "platform": "web"
33
+ }
34
+ },
35
+ "peerDependencies": {
36
+ "@deepseek-ai/cordis": ">=4.0.0",
37
+ "@deepseek-ai/schemastery": ">=3.0.0"
38
+ },
39
+ "peerDependenciesMeta": {
40
+ "@deepseek-ai/cordis": {
41
+ "optional": true
42
+ },
43
+ "@deepseek-ai/schemastery": {
44
+ "optional": true
45
+ }
46
+ },
47
+ "files": [
48
+ "dsh",
49
+ "lib",
50
+ "cordis.patch.yml",
51
+ "README.md",
52
+ "CHANGELOG.md",
53
+ "LICENSE"
54
+ ],
55
+ "keywords": [
56
+ "dsh",
57
+ "dsh-plugin",
58
+ "dsh-workbench",
59
+ "ai-native",
60
+ "workbench",
61
+ "requirement",
62
+ "feishu",
63
+ "lark"
64
+ ]
65
+ }