@suifei/dsh-ai-team 0.4.153 → 0.4.154

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
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.154 - 2026-12-03
4
+
5
+ - 新建和编辑项目可用宿主的浏览式目录列表。选定后回填路径,提交表单时才保存或创建项目。感谢 @ljyzww 提供 Windows 复现与宿主契约(#100)。
6
+ - 桌面首次安装说明明确初始化后先退出应用,再安装到内置 `desktop` profile。感谢 @Arnoldnuo 的桌面安装反馈(#102)。
7
+ - 编制巡检列出缺少合格验收人的任务、宿主回合观察值和容量来源。补位建议按每张卡的实际验收资格判断能否恢复现有成员或需要补位。感谢 @buger-gif 的现场案例和巡检建议(#116)。
8
+
3
9
  ## 0.4.153 - 2026-12-03
4
10
 
5
11
  - 看板的受阻徽标、读屏名称和分组计数使用宿主提供的当前受阻状态,依赖编号保持可查。感谢 @idontlikefruit 提供复现(#115)。
package/README.md CHANGED
@@ -37,6 +37,7 @@
37
37
 
38
38
  ## 最近更新
39
39
 
40
+ - **目录浏览和验收补位**(0.4.154)。新建或编辑项目时可使用宿主的原生对话框或浏览式选择器。桌面安装说明补齐首次初始化和退出步骤。编制巡检标明缺少合格验收人的任务、观察到的成员回合和容量来源。感谢 [@ljyzww](https://github.com/ljyzww),[#100](https://github.com/suifei/dsh-ai-team/issues/100)。感谢 [@Arnoldnuo](https://github.com/Arnoldnuo),[#102](https://github.com/suifei/dsh-ai-team/issues/102)。感谢 [@buger-gif](https://github.com/buger-gif),[#116](https://github.com/suifei/dsh-ai-team/issues/116)。
40
41
  - **看板受阻、离队交接和只读巡检**(0.4.153)。看板按当前状态显示受阻,历史依赖仍可查。离队与认领按同一顺序处理,待交接的原卡能交给继任者。普通项目可以开启只读编制巡检。感谢 [@idontlikefruit](https://github.com/idontlikefruit),[#115](https://github.com/suifei/dsh-ai-team/issues/115)。感谢 [@buger-gif](https://github.com/buger-gif),[#116](https://github.com/suifei/dsh-ai-team/issues/116)、[#117](https://github.com/suifei/dsh-ai-team/issues/117)。
41
42
  - **派发预检和 DSH 0.2.3 兼容**(0.4.153)。PMO 在唤醒前核对依赖、在手任务和写入范围。工作台兼容新版宿主的会话鉴权。感谢 [@buger-gif](https://github.com/buger-gif),[#120](https://github.com/suifei/dsh-ai-team/issues/120)。感谢 [@Estelle00](https://github.com/Estelle00),[#122](https://github.com/suifei/dsh-ai-team/issues/122)。
42
43
  - **PMO 重启后续跑**(0.4.152)。恢复原会话时即提供模型路由,避免首轮因缺少模型而失败。保留原 PMO 会话、成员关系和任务。感谢 [@phm101299-ui](https://github.com/phm101299-ui),[#112](https://github.com/suifei/dsh-ai-team/issues/112)。
@@ -141,6 +142,8 @@ const svg = HashAvatar.svg('墨渊', { gender: 'male', age: 'middle', race: 'asi
141
142
 
142
143
  在当前 DSH profile 的 `ai-team` 配置中设 `staffingReviewMinutes: 180` 和 `diagLevel: full` 后,启用 PMO 自动的运行中普通项目会随现有巡检周期采样,每个时间窗口记录一次。`staffingReviewMinutes: 0`(默认)关闭采样。诊断日志中的 `pmo.staffing.review` 包含岗位已分配队列、可认领与待验收队列、最长及平均等待,以及采样窗口内每位成员的提交、验收和退回。返工率按退回的本窗口提交除以本窗口提交数计算,零样本为空。
143
144
 
145
+ 巡检还会记录没有合格验收人的任务 ID、插件观察到的在队成员运行回合数和容量来源。容量来源为 `default` 时使用默认估计,为 `host` 时来自宿主报告。PMO 会把长期无人可验收的任务带进现有补位建议。
146
+
144
147
  巡检复用现有派员建议和冷却规则,记录被暂缓的建议。人员动作仍由已有授权流程处理。试跑样本和调整建议可回到 [#116](https://github.com/suifei/dsh-ai-team/issues/116)。
145
148
 
146
149
  ---
@@ -164,7 +167,7 @@ const svg = HashAvatar.svg('墨渊', { gender: 'male', age: 'middle', race: 'asi
164
167
 
165
168
  ### DSH 桌面应用
166
169
 
167
- 首次使用时先打开一次 DSH 桌面应用,初始化 `desktop`。使用桌面版自带的 `dsh` 安装。
170
+ 首次使用时先打开一次 DSH 桌面应用,初始化 `desktop`。完全退出应用后,使用桌面版自带的 `dsh` 安装。
168
171
 
169
172
  ```powershell
170
173
  dsh plugin --profile desktop add "@suifei/dsh-ai-team"
@@ -185,6 +188,8 @@ dsh --profile web --no-open --port 33271
185
188
 
186
189
  第一次进入 Project 先设置 **工作目录**:工作目录编辑器会自动弹出,并预填宿主给出的建议值——配置项 `defaultWorkspace` → 当前进程目录 → **`~/works`**(Windows 为 `%USERPROFILE%\works`,Linux/macOS 为 `~/works`;不存在时自动创建)。点「选择目录」或用输入框改成任意已存在的目录即可;**新建项目必须填工作目录**(服务端强制,空目录会被 400 拒绝)。每个 Project 独立一个目录,成员只在这个目录里执行 Task。
187
190
 
191
+ 「选择目录」会使用宿主的原生对话框或在文渊阁内浏览宿主目录。选定后先回填路径,保存或创建项目时生效。
192
+
188
193
  ### 打开文渊阁后提示 503
189
194
 
190
195
  先确认插件安装在当前入口使用的 profile。桌面应用可用 `dsh plugin --profile desktop list "@suifei/dsh-ai-team" --depth 0` 回读版本。浏览器入口把命令里的 `desktop` 换成 `web`,并打开当前 Web 进程输出的完整 URL。
@@ -386,14 +391,14 @@ round-19 DeepSeek + Zhipu 双 provider
386
391
  | 贡献者 | 贡献 | 带来的进展 |
387
392
  |---|---|---|
388
393
  | [@idontlikefruit](https://github.com/idontlikefruit) | 受阻状态的三组复现输入 [#115](https://github.com/suifei/dsh-ai-team/issues/115) | 统一看板徽标、读屏和分组统计的受阻判定,保留历史依赖 |
389
- | [@buger-gif](https://github.com/buger-gif) | 编制巡检、离队交接案例 [#116](https://github.com/suifei/dsh-ai-team/issues/116)、[#117](https://github.com/suifei/dsh-ai-team/issues/117),派发空转记录 [#120](https://github.com/suifei/dsh-ai-team/issues/120) | 统一认领与离队的执行顺序,开放只读巡检取证,并在唤醒前检查认领条件 |
394
+ | [@buger-gif](https://github.com/buger-gif) | 编制巡检、离队交接案例 [#116](https://github.com/suifei/dsh-ai-team/issues/116)、[#117](https://github.com/suifei/dsh-ai-team/issues/117),派发空转记录 [#120](https://github.com/suifei/dsh-ai-team/issues/120) | 统一认领与离队的执行顺序,在唤醒前检查认领条件,巡检识别缺少合格验收人的任务并记录运行回合和容量来源 |
390
395
  | [@Estelle00](https://github.com/Estelle00) | DSH 0.2.3 启动 503 的复现和桌面验证 [#122](https://github.com/suifei/dsh-ai-team/issues/122) | 接入新版会话鉴权接口,恢复工作台初始化 |
391
396
  | [@phm101299-ui](https://github.com/phm101299-ui) | PMO 冷恢复的复现、根因和桌面验证 [#112](https://github.com/suifei/dsh-ai-team/issues/112) | 让原 PMO 在宿主重启后带着模型路由继续工作,保留成员关系和任务 |
392
397
  | [@godfay-g](https://github.com/godfay-g) | 技能目录和 ZIP 的导入建议 [#109](https://github.com/suifei/dsh-ai-team/issues/109) | 成员与自定义人才可在文渊阁选择已安装的技能或导入完整技能包。0.4.151 统一新建人才的导入入口,并由文渊阁直接安装整包 |
393
398
  | [@qq958691165](https://github.com/qq958691165) | 归档项目的成员反馈、团队管理建议 [#103](https://github.com/suifei/dsh-ai-team/issues/103) | 人员池排除归档项目,侧栏集中管理项目成员与团队预设 |
394
- | [@Arnoldnuo](https://github.com/Arnoldnuo) | 桌面端启动 503 反馈 [#102](https://github.com/suifei/dsh-ai-team/issues/102) | 工作台提供分情况的 503 提示,快速开始说明内置 `desktop` 与 `web` 的安装和启动方式,连接错误提示引导核对 profile |
399
+ | [@Arnoldnuo](https://github.com/Arnoldnuo) | 桌面端启动 503 反馈 [#102](https://github.com/suifei/dsh-ai-team/issues/102) | 工作台提示核对 profile,快速开始说明内置 `desktop` 与 `web` 的入口和安装方式,以及桌面端首次初始化和退出步骤 |
395
400
  | [@Lamooner](https://github.com/Lamooner) | PMO 决策反馈与建议 [#99](https://github.com/suifei/dsh-ai-team/issues/99) | 避免选中「不推荐」项,移除编号偏向并补充括注编号回归 |
396
- | [@ljyzww](https://github.com/ljyzww) | Windows 目录选择反馈 [#100](https://github.com/suifei/dsh-ai-team/issues/100) | 新建和编辑项目共用目录选择失败提示,保留手填路径 |
401
+ | [@ljyzww](https://github.com/ljyzww) | Windows 目录选择复现及宿主能力说明 [#100](https://github.com/suifei/dsh-ai-team/issues/100) | 新建和编辑项目共用浏览式目录选择,选定后回填路径 |
397
402
  | [@xiuchuan666](https://github.com/xiuchuan666) | 反馈与建议 [#65](https://github.com/suifei/dsh-ai-team/issues/65) | 输入框长高可拖大、贴图拖文件、@ 点名成员(0.4.120–0.4.123);人才市场与在线人才库(0.4.124–0.4.131);团队扩编:超限排队、开发验收配对、空闲必派、写入范围、加人建议(0.4.140) |
398
403
  | [@TardisBooo](https://github.com/TardisBooo) | 代码 [#88](https://github.com/suifei/dsh-ai-team/pull/88) | 工具参数改为对象 JSON Schema,Grok 4.7 可用(0.4.139) |
399
404
 
package/client.js CHANGED
@@ -299,6 +299,13 @@ window.__ModuleLoader__.load({
299
299
  workspacePathPlaceholder: '例如 D:/work/my-project',
300
300
  workspacePickUnavailable: '当前宿主的目录选择器不能用于此表单。请在「工作目录」中粘贴或输入完整路径。',
301
301
  workspacePickFailed: '未能打开目录选择器。请重试,或在「工作目录」中粘贴或输入完整路径。',
302
+ workspaceBrowseTitle: '浏览工作目录',
303
+ workspaceBrowseHome: '主目录',
304
+ workspaceBrowseParent: '上一级',
305
+ workspaceBrowseChoose: '使用当前目录',
306
+ workspaceBrowseEmpty: '此目录没有子目录。',
307
+ workspaceBrowseTruncated: '仅显示宿主返回的部分目录。',
308
+ workspaceBrowseError: '未能读取目录。{message}',
302
309
  workspaceSave: '保存目录',
303
310
  projectCreate: '创建项目',
304
311
  projectCreated: '已创建项目 {name}。',
@@ -809,6 +816,13 @@ window.__ModuleLoader__.load({
809
816
  workspacePathPlaceholder: 'e.g. D:/work/my-project',
810
817
  workspacePickUnavailable: 'The host’s directory picker is unavailable for this form. Paste or enter the full path in the Workspace field.',
811
818
  workspacePickFailed: 'Could not open the directory picker. Retry, or paste or enter the full path in the Workspace field.',
819
+ workspaceBrowseTitle: 'Browse workspace directories',
820
+ workspaceBrowseHome: 'Home',
821
+ workspaceBrowseParent: 'Parent directory',
822
+ workspaceBrowseChoose: 'Use this directory',
823
+ workspaceBrowseEmpty: 'This directory has no subdirectories.',
824
+ workspaceBrowseTruncated: 'Only some directories were returned by the host.',
825
+ workspaceBrowseError: 'Could not read the directory. {message}',
812
826
  workspaceSave: 'Save directory',
813
827
  projectCreate: 'Create project',
814
828
  projectCreated: 'Created project {name}.',
@@ -1575,6 +1589,11 @@ window.__ModuleLoader__.load({
1575
1589
  .at-modal.at-modal-wide { width: 90%; height: 90%; max-height: 90%; }
1576
1590
  .at-modal.at-blueprint-dialog { width: min(720px, 90cqi); max-width: 90%; height: auto; }
1577
1591
  .at-modal.at-blueprint-setup { width: min(820px, 90cqi); height: auto; }
1592
+ .at-modal.at-directory-picker { width: min(460px, 90cqi); overflow-x: hidden; }
1593
+ .at-directory-nav { display: flex; flex-wrap: wrap; gap: 8px; }
1594
+ .at-directory-path { overflow-wrap: anywhere; }
1595
+ .at-directory-list { display: grid; gap: 4px; max-height: 42vh; overflow: auto; overscroll-behavior: contain; }
1596
+ .at-directory-list .at-btn { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: start; }
1578
1597
  .at-blueprint-fields { display: grid; gap: 10px; min-width: 0; }
1579
1598
  .at-blueprint-fields fieldset { min-inline-size: 0; margin: 0; padding: 10px; border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-sm); }
1580
1599
  .at-blueprint-fields p { margin: 0; overflow-wrap: anywhere; }
@@ -2101,6 +2120,58 @@ window.__ModuleLoader__.load({
2101
2120
  return h('div', { className: 'at-modalback', ref: backRef }, children);
2102
2121
  }
2103
2122
 
2123
+ function WorkspaceDirectoryBrowser({ t, service, initialPath, onPick, onClose }) {
2124
+ const [request, setRequest] = React.useState({ path: initialPath });
2125
+ const [listing, setListing] = React.useState(null);
2126
+ const [error, setError] = React.useState('');
2127
+ const [loading, setLoading] = React.useState(true);
2128
+ const closeButton = React.useRef(null);
2129
+ React.useEffect(() => {
2130
+ const previous = document.activeElement;
2131
+ closeButton.current?.focus({ preventScroll: true });
2132
+ return () => previous?.focus?.({ preventScroll: true });
2133
+ }, []);
2134
+ React.useEffect(() => {
2135
+ const controller = new AbortController();
2136
+ const { signal } = controller;
2137
+ const load = async () => {
2138
+ try {
2139
+ const result = await service.listDirectory(request.path, signal);
2140
+ if (!signal.aborted) setListing(result);
2141
+ } catch (cause) {
2142
+ if (!signal.aborted) setError(cause?.message ?? String(cause));
2143
+ } finally {
2144
+ if (!signal.aborted) setLoading(false);
2145
+ }
2146
+ };
2147
+ void load();
2148
+ return () => controller.abort();
2149
+ }, [request, service]);
2150
+ const browse = (path) => {
2151
+ setLoading(true);
2152
+ setError('');
2153
+ setRequest({ path });
2154
+ };
2155
+ const parentPath = listing?.crumbs?.at(-2)?.path;
2156
+ return h(ModalBack, { onClose },
2157
+ h('div', { className: 'at-modal at-directory-picker', role: 'dialog', 'aria-modal': 'true', 'aria-label': t('workspaceBrowseTitle') },
2158
+ h('h2', { className: 'at-modaltitle' }, t('workspaceBrowseTitle')),
2159
+ h('div', { className: 'at-modalactions' },
2160
+ h('button', { ref: closeButton, className: 'at-btn', type: 'button', onClick: onClose }, t('cancel')),
2161
+ h('button', { className: 'at-btn at-btn-primary', type: 'button', disabled: loading || !listing?.path || Boolean(error), onClick: () => onPick(listing.path) }, t('workspaceBrowseChoose'))),
2162
+ h('div', { className: 'at-directory-nav' },
2163
+ h('button', { className: 'at-btn', type: 'button', disabled: loading, onClick: () => browse(undefined) }, t('workspaceBrowseHome')),
2164
+ h('button', { className: 'at-btn', type: 'button', disabled: loading || !parentPath, onClick: () => browse(parentPath) }, t('workspaceBrowseParent'))),
2165
+ listing?.path ? h('div', { className: 'at-modalmeta at-directory-path' }, listing.path) : null,
2166
+ loading ? h('div', { className: 'at-modalmeta', role: 'status' }, t('loading')) : null,
2167
+ error ? h('div', { className: 'at-modalerror at-directory-path', role: 'alert' }, tf(t, 'workspaceBrowseError', { message: error })) : null,
2168
+ h('div', { className: 'at-directory-list', 'aria-busy': loading },
2169
+ (listing?.entries ?? []).map(({ name, path }) =>
2170
+ h('button', { className: 'at-btn', key: path, title: name, type: 'button', disabled: loading, onClick: () => browse(path) }, name))),
2171
+ !loading && !error && listing?.entries?.length === 0 ? h('p', { className: 'at-modalmeta' }, t('workspaceBrowseEmpty')) : null,
2172
+ listing?.truncated ? h('p', { className: 'at-modalmeta' }, t('workspaceBrowseTruncated')) : null));
2173
+ }
2174
+
2104
2175
  const emptyBlueprintOpportunity = () => ({ kind: '', work: '', minutes: '', perWeek: '' });
2105
2176
  const emptyBlueprintIntake = () => ({ business: '', humanWork: '', weeklyHours: '', opportunities: [emptyBlueprintOpportunity()] });
2106
2177
 
@@ -4295,6 +4366,12 @@ window.__ModuleLoader__.load({
4295
4366
  const [workspaceDraft, setWorkspaceDraft] = React.useState('');
4296
4367
  const [workspaceError, setWorkspaceError] = React.useState('');
4297
4368
  const [workspaceBusy, setWorkspaceBusy] = React.useState(false);
4369
+ const [workspacePicker, setWorkspacePicker] = React.useState(null);
4370
+ const workspacePickRequest = React.useRef(0);
4371
+ React.useEffect(() => {
4372
+ setWorkspacePicker((picker) => (picker && (picker.form === 'new' ? !newOpen : !workspaceOpen) ? null : picker));
4373
+ return () => { workspacePickRequest.current += 1; };
4374
+ }, [newOpen, workspaceOpen]);
4298
4375
  const [memberViewId, setMemberViewId] = React.useState(null);
4299
4376
  // 人员池(全局层):进入该 scope 时拉取一次聚合视图。
4300
4377
  const [peopleData, setPeopleData] = React.useState(null);
@@ -4996,31 +5073,41 @@ window.__ModuleLoader__.load({
4996
5073
  }
4997
5074
  async function pickWorkspacePath() {
4998
5075
  const service = ctx?.get?.('uiWorkspace') ?? ctx?.uiWorkspace;
4999
- if (service === undefined || service === null || typeof service.pickDirectory !== 'function') {
5000
- return { error: 'unavailable', path: null };
5001
- }
5002
- try {
5003
- return { path: await service.pickDirectory(), error: null };
5004
- } catch (error) {
5005
- // Harness rc.5 wraps the RPC error in a plain Error and retains only its message.
5006
- const unavailable = error?.code === 'directory-picker/unavailable'
5007
- || error?.message === 'directory picker failed: directoryPicker.pick needs the native capability; the composed picker serves "browse"';
5008
- return { error: unavailable ? 'unavailable' : 'failed', path: null };
5076
+ if (typeof service?.pickDirectory === 'function') {
5077
+ try {
5078
+ return { path: await service.pickDirectory() };
5079
+ } catch (error) {
5080
+ // Harness rc.5 retains only the message from the native pick RPC failure.
5081
+ const unavailable = (error?.code ?? error?.rpcError?.code) === 'directory-picker/unavailable'
5082
+ || error?.message === 'directory picker failed: directoryPicker.pick needs the native capability; the composed picker serves "browse"';
5083
+ if (!unavailable) {
5084
+ console.warn('[ai-team] directory picker failed', error);
5085
+ return { error: 'failed' };
5086
+ }
5087
+ }
5009
5088
  }
5089
+ return typeof service?.listDirectory === 'function' ? { browse: service } : { error: 'unavailable' };
5010
5090
  }
5011
- async function applyWorkspacePick(setPath, setError) {
5091
+ async function applyWorkspacePick(form, draft, setPath, setError) {
5092
+ const request = ++workspacePickRequest.current;
5012
5093
  const picked = await pickWorkspacePath();
5094
+ if (workspacePickRequest.current !== request) return;
5013
5095
  const unavailable = t('workspacePickUnavailable');
5014
5096
  const failed = t('workspacePickFailed');
5015
- if (picked.path) {
5016
- setPath(picked.path);
5097
+ const onPick = (path) => {
5098
+ setPath(path);
5017
5099
  setError((previous) => previous === unavailable || previous === failed ? '' : previous);
5100
+ };
5101
+ if (picked.browse) {
5102
+ setWorkspacePicker({ form, service: picked.browse, initialPath: draft.trim() || undefined, onPick });
5103
+ } else if (picked.path) {
5104
+ onPick(picked.path);
5018
5105
  } else if (picked.error) {
5019
5106
  setError(picked.error === 'unavailable' ? unavailable : failed);
5020
5107
  }
5021
5108
  }
5022
5109
  async function pickNewWorkspace() {
5023
- await applyWorkspacePick(setNWorkspace, setNError);
5110
+ await applyWorkspacePick('new', nWorkspace, setNWorkspace, setNError);
5024
5111
  }
5025
5112
  function openWorkspaceEditor() {
5026
5113
  setWorkspaceDraft(project?.workspacePath ?? '');
@@ -5028,7 +5115,7 @@ window.__ModuleLoader__.load({
5028
5115
  setWorkspaceOpen(true);
5029
5116
  }
5030
5117
  async function pickProjectWorkspace() {
5031
- await applyWorkspacePick(setWorkspaceDraft, setWorkspaceError);
5118
+ await applyWorkspacePick('edit', workspaceDraft, setWorkspaceDraft, setWorkspaceError);
5032
5119
  }
5033
5120
  async function saveWorkspace() {
5034
5121
  if (!project || workspaceBusy || !workspaceDraft.trim()) return;
@@ -6585,6 +6672,11 @@ window.__ModuleLoader__.load({
6585
6672
  h('h2', { className: 'at-modaltitle' }, withIco('users', t('teamComposeTitle'), 16)),
6586
6673
  h(TeamComposer, { t, talents, onSaved: (team) => { setTeamComposeOpen(false); void loadTeams(team && team.id); }, onCancel: () => setTeamComposeOpen(false) }))) : null,
6587
6674
  peopleModel ? h(PeopleModelDialog, { t, catalog: modelCatalog, catalogError: modelCatalogError, people: peopleData ?? [], initial: peopleModel, onApply: applyPeopleModel, onClose: () => setPeopleModel(null) }) : null,
6675
+ workspacePicker && (workspacePicker.form === 'new' ? newOpen : workspaceOpen) ? h(WorkspaceDirectoryBrowser, {
6676
+ t, service: workspacePicker.service, initialPath: workspacePicker.initialPath,
6677
+ onPick: (path) => { workspacePicker.onPick(path); setWorkspacePicker(null); },
6678
+ onClose: () => setWorkspacePicker(null),
6679
+ }) : null,
6588
6680
  dialog ? h(WorkbenchDialog, { key: dialogSeqRef.current, t, dialog, onDismiss: () => setDialog(null) }) : null,
6589
6681
  shortcutsOpen ? h(ModalBack, { onClose: () => setShortcutsOpen(false) },
6590
6682
  h('div', { className: 'at-modal', role: 'dialog', 'aria-modal': 'true', 'aria-label': t('shortcutTitle') },
package/index.js CHANGED
@@ -979,10 +979,10 @@ export function apply(ctx, config = {}) {
979
979
  const pmoLastStaffing = new Map();
980
980
  const pmoStaffingReviewWindows = new Map();
981
981
  // 宿主同时在跑的子智能体上限:默认 8,见到容量报错就以报错里的数字为准(加人建议的排队提示用)。
982
- let hostCapacity = HOST_SUBAGENT_LIMIT;
982
+ let observedHostCapacity = null;
983
983
  const noteHostCapacity = (error) => {
984
984
  const limit = capacityLimit(error);
985
- if (limit !== null) hostCapacity = limit;
985
+ if (limit !== null) observedHostCapacity = limit;
986
986
  };
987
987
  const pmoLastEscalate = new Map();
988
988
  const pmoLastReview = new Map();
@@ -1485,8 +1485,10 @@ export function apply(ctx, config = {}) {
1485
1485
  const reviewWindow = diag.level === 'full' && reviewInterval > 0 ? Math.floor(now / reviewInterval) : null;
1486
1486
  const reviewDue = reviewWindow !== null && pmoStaffingReviewWindows.get(projectRuntime.id) !== reviewWindow;
1487
1487
  const suppressed = [];
1488
+ const inTurn = (id) => turnsInFlight.has(id);
1489
+ const capacity = observedHostCapacity ?? HOST_SUBAGENT_LIMIT;
1488
1490
  const adviceList = planStaffingAdvice(staffingState, {
1489
- now, inTurn: (id) => turnsInFlight.has(id), capacity: hostCapacity,
1491
+ now, inTurn, capacity,
1490
1492
  humanId: projectRuntime.service.humanId(), wait: (config.staffingAdviceMinutes ?? 30) * 60_000,
1491
1493
  onSuppressed: reviewDue ? (entry) => suppressed.push(entry) : undefined,
1492
1494
  });
@@ -1494,7 +1496,8 @@ export function apply(ctx, config = {}) {
1494
1496
  pmoStaffingReviewWindows.set(projectRuntime.id, reviewWindow);
1495
1497
  try {
1496
1498
  const review = staffingReview(staffingState, projectRuntime.ledger.events, {
1497
- now, intervalMs: reviewInterval, capacity: hostCapacity, advice: adviceList, suppressed,
1499
+ now, intervalMs: reviewInterval, capacity, capacitySource: observedHostCapacity === null ? 'default' : 'host',
1500
+ inTurn, advice: adviceList, suppressed,
1498
1501
  });
1499
1502
  diag.append({ ev: 'pmo.staffing.review', projectId: projectRuntime.id, window: reviewWindow, ...review });
1500
1503
  } catch (error) {
package/lib/host/pmo.js CHANGED
@@ -1,4 +1,4 @@
1
- import { STALLED_MEMBER_STATUSES, dependenciesDone, teamRoles, writeScopeConflict } from '../domain/policy.js';
1
+ import { STALLED_MEMBER_STATUSES, dependenciesDone, isReviewCandidate, teamRoles, writeScopeConflict } from '../domain/policy.js';
2
2
  import { canDispatchTask } from '../domain/task.js';
3
3
 
4
4
  /**
@@ -254,8 +254,13 @@ function waitingSummary(tasks, now) {
254
254
  return { count: tasks.length, oldestMinutes: Math.round(oldest / MINUTE), meanMinutes: tasks.length ? Math.round(total / tasks.length / MINUTE) : 0 };
255
255
  }
256
256
 
257
+ function tasksWithoutReviewer(state, tasks) {
258
+ const members = Object.values(state.members ?? {});
259
+ return tasks.filter((task) => !members.some((member) => isReviewCandidate(member, task, state)));
260
+ }
261
+
257
262
  /** A read-only rollup of the existing queues and observed submissions in this window. */
258
- export function staffingReview(state, events, { now, intervalMs, capacity, advice = [], suppressed = [] }) {
263
+ export function staffingReview(state, events, { now, intervalMs, capacity, capacitySource = null, inTurn, advice = [], suppressed = [] }) {
259
264
  const since = now - intervalMs;
260
265
  const people = new Map(Object.values(state.members ?? {})
261
266
  .filter((member) => member.kind === 'agent' && member.status !== 'retired')
@@ -282,6 +287,11 @@ export function staffingReview(state, events, { now, intervalMs, capacity, advic
282
287
  groups.set(member.role, group);
283
288
  }
284
289
  const open = openTasks(state);
290
+ const waitingReview = open.filter(({ status }) => status === 'pending_acceptance');
291
+ const missingReviewers = tasksWithoutReviewer(state, waitingReview);
292
+ const activeMemberTurns = typeof inTurn === 'function'
293
+ ? [...people.keys()].map((id) => state.members[id].sessionId).filter((id) => typeof id === 'string' && inTurn(id)).length
294
+ : null;
285
295
  for (const task of open) {
286
296
  const group = groups.get(people.get(task.assigneeId)?.role);
287
297
  if (!group) continue;
@@ -289,9 +299,10 @@ export function staffingReview(state, events, { now, intervalMs, capacity, advic
289
299
  if (task.status === 'in_progress') group.inProgress += 1;
290
300
  }
291
301
  return {
292
- since, now, capacity,
302
+ since, now, capacity, capacitySource, activeMemberTurns,
293
303
  claimable: waitingSummary(claimableTasks(state, open), now),
294
- pendingAcceptance: waitingSummary(open.filter(({ status }) => status === 'pending_acceptance'), now),
304
+ pendingAcceptance: waitingSummary(waitingReview, now),
305
+ pendingAcceptanceWithoutReviewer: { ...waitingSummary(missingReviewers, now), taskIds: missingReviewers.map(({ id }) => id) },
295
306
  roles: [...groups.values()].map(({ assigned, ...group }) => ({ ...group, assignedQueue: waitingSummary(assigned, now) })),
296
307
  advice,
297
308
  suppressed,
@@ -302,7 +313,7 @@ export function staffingReview(state, events, { now, intervalMs, capacity, advic
302
313
  * 加人建议(用户 2026-11-20:从管理角度看推进过慢就该加人,由 Human 决定)。插件自己按看板判定,不靠模型:
303
314
  * - 开发不够:有可认领的待办等了 ≥ 30 分钟,却没有空闲开发(空闲开发会先被 planIdleStaffing 派活)。
304
315
  * 建议人数 = 等着的待办数,最多 3。
305
- * - 验收不够:待验收的卡等了 ≥ 30 分钟,且没有验收人,或每位验收人摊到 ≥ 2 张。建议加 1 名。
316
+ * - 验收不够:待验收的卡等了 ≥ 30 分钟,且卡片没有合格验收人、团队没有验收岗位或每个验收岗位摊到 ≥ 2 张。建议加 1 名。
306
317
  * 团队人数加上建议人数超过宿主同时在跑的上限时,理由里写明多出的人会排队、提速有限。
307
318
  * 该岗位有人停摆(failed / unavailable,等 Human 恢复)时改为「建议恢复」:人还在,只是停了,恢复比加人快,
308
319
  * 也不占新名额(实机 il2c 2026-11-20:验收人白砚 06:53 模型报错停摆,两张卡待验收 9 小时,旧版却说「团队没有验收人,建议加 1 名」)。
@@ -331,13 +342,18 @@ export function planStaffingAdvice(state, { now, inTurn, capacity = HOST_SUBAGEN
331
342
  : { role: 'developer', action: 'add', count: Math.min(waitingWork.length, 3), memberIds: [], reasons: [waited] }) });
332
343
  }
333
344
  const waitingReview = open.filter((task) => task.status === 'pending_acceptance' && age(task) >= wait);
334
- if (waitingReview.length > 0 && (qas.length === 0 || waitingReview.length >= 2 * qas.length)) {
335
- const waited = `${waitingReview.length} 张卡待验收已等 ${longest(waitingReview)} 分钟`;
336
- advice.push({ taskIds: waitingReview.map((task) => task.id), ...(stalled.qas.length > 0
337
- ? recover('qa', stalled.qas, waited)
338
- : { role: 'qa', action: 'add', count: 1, memberIds: [], reasons: [qas.length === 0
339
- ? `${waited},团队没有验收人`
340
- : `${waited},${qas.length} 位验收人每人摊到 ${Math.ceil(waitingReview.length / qas.length)} 张`] }) });
345
+ const missingReviewers = tasksWithoutReviewer(state, waitingReview);
346
+ if (waitingReview.length > 0 && (missingReviewers.length > 0 || qas.length === 0 || waitingReview.length >= 2 * qas.length)) {
347
+ const affected = missingReviewers.length > 0 ? missingReviewers : waitingReview;
348
+ const waited = `${affected.length} 张卡待验收已等 ${longest(affected)} 分钟`;
349
+ const restorable = stalled.qas.filter((member) =>
350
+ affected.some((task) => isReviewCandidate({ ...member, status: 'idle' }, task, state)));
351
+ const shortage = qas.length === 0 ? '团队没有验收人'
352
+ : missingReviewers.length > 0 ? '没有符合任务规则的验收人'
353
+ : `${qas.length} 位验收人每人摊到 ${Math.ceil(waitingReview.length / qas.length)} 张`;
354
+ advice.push({ taskIds: affected.map((task) => task.id), ...(restorable.length > 0
355
+ ? recover('qa', restorable, waited)
356
+ : { role: 'qa', action: 'add', count: 1, memberIds: [], reasons: [`${waited},${shortage}`] }) });
341
357
  }
342
358
  const headcount = Object.values(state?.members ?? {}).filter((member) => member?.kind === 'agent' && member.status !== 'retired' && !STALLED_MEMBER_STATUSES.includes(member.status)).length;
343
359
  const recent = (role) => Object.values(state?.inbox ?? {}).find((item) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.4.153",
3
+ "version": "0.4.154",
4
4
  "type": "module",
5
5
  "description": "文渊阁 (Wenyuan Pavilion) — AI Team mode for DeepSeek Harness: concurrent projects, owned tasks, threads, inbox and an append-only team ledger",
6
6
  "license": "MIT",