@suifei/dsh-ai-team 0.3.72 → 0.3.74

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,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.74 - 2026-11-12
4
+
5
+ - **P2 人员池统一模型配置**:人员池行级「统一配置模型」入口——选 LLM 端点后对该成员在**所有项目**逐个 member.config.update(跨项目批量),免去逐项目×逐成员修改(NO_ADAPTER / max_tokens 超限场景的根治入口)。
6
+ - **P5b 工作目录存在性校验**:project.workspace.update 校验目录真实存在且为目录(配置不存在的目录会让成员会话 cwd 无效、回合全失败——用户实证 working-directory does not exist)。
7
+ - 回归测试:+2 host 级断言(不存在目录 → 409;最后 active 项目归档 → 409)。
8
+
9
+
10
+ ## 0.3.73 - 2026-11-11
11
+
12
+ - **项目头开关失效修复**:bootstrap 的 projects[] 在 registry 重映射时丢弃了 chatGate/runState(按钮状态永远默认「开」,点击后 UI 不更新);归档 409 修复:归档保护在 service 内判定(只见自己账本,恒为最后项目)→ 移到 Host 路由层用 registry 全局清单判定。
13
+
14
+
15
+ # Changelog
16
+
17
+ ## 0.3.72 - 2026-11-11
18
+
19
+ - 项目头按钮栏布局修复:路径独占一行、按钮行自动换行并紧凑化(6 控件溢出错位,用户截图实证)。
20
+
3
21
  ## 0.3.71 — 2026-11-11
4
22
 
5
23
  - **【致命】工作台 #310 崩溃修复(用户实证)**:批量取消的忙碌标志 useState 被放在了 Workbench 的 Skeleton early-return **之后**——loading→ready 重渲染时 hooks 数量增多,触发 React #310 白屏。移到 early-return 之前的 state 区。渲染 E2E 的 React mock 同步加 **#310 守卫**:同一组件跨渲染 hooks 数量增多立即抛错(并在 0.3.69 类改动合入前即拦截)。
package/client.js CHANGED
@@ -392,7 +392,11 @@ window.__ModuleLoader__.load({
392
392
  aliasSaved: '已把「{name}」并到「{person}」。',
393
393
  teamBusyN: '在做 ×{n}',
394
394
  pendingAcceptanceN: '待验收 ×{n}',
395
- archivedCount: '已归档 {n}',
395
+ archivedCount: '已归档 {n}',
396
+ personModelBtn: '统一配置模型',
397
+ personModelTitle: '为「{name}」选择 LLM 端点(应用到其所有项目)',
398
+ personModelDone: '已把「{name}」配置为 {model}(成功 {done} 处,失败 {failed} 处)。',
399
+ modelCatalogEmpty: '模型目录为空:请先在 DSH 设置里配置可用的 LLM 端点。',
396
400
  q1Title: '需要你',
397
401
  q2Title: '团队在做',
398
402
  q3Title: '等待受阻',
@@ -805,7 +809,11 @@ window.__ModuleLoader__.load({
805
809
  aliasSaved: 'Merged "{name}" into "{person}".',
806
810
  teamBusyN: 'in progress ×{n}',
807
811
  pendingAcceptanceN: 'awaiting acceptance ×{n}',
808
- archivedCount: 'Archived {n}',
812
+ archivedCount: 'Archived {n}',
813
+ personModelBtn: 'Set model',
814
+ personModelTitle: 'Choose the LLM endpoint for "{name}" (applies to all its projects)',
815
+ personModelDone: 'Set "{name}" to {model} ({done} ok, {failed} failed).',
816
+ modelCatalogEmpty: 'The model catalog is empty: configure an LLM endpoint in DSH settings first.',
809
817
  q1Title: 'Needs you',
810
818
  q2Title: 'Team is doing',
811
819
  q3Title: 'Waiting / blocked',
@@ -1924,7 +1932,7 @@ window.__ModuleLoader__.load({
1924
1932
  * 人员池总览(全局层,11-管理视角 §2):按"人"聚合各项目身份。
1925
1933
  * 数据 = GET /ai-team/api/people(各项目账本 members/tasks 的只读聚合)。
1926
1934
  */
1927
- function PeoplePage({ t, people, error, loading, onOpenProject, onRefresh, localNames, onOpenPerson, onChatPerson }) {
1935
+ function PeoplePage({ t, people, error, loading, onOpenProject, onRefresh, localNames, onOpenPerson, onChatPerson, onConfigModel }) {
1928
1936
  if (error) return h('div', { className: 'at-stream', role: 'alert' },
1929
1937
  h('div', { className: 'at-streaminner' }, h(EmptyState, { t, icon: 'alert', title: t('peopleTitle'), body: tf(t, 'peopleLoadFailed', { message: error }) })));
1930
1938
  // loading 用中心区域骨架(流内行),不用整页 Skeleton——本组件位于
@@ -1954,7 +1962,10 @@ window.__ModuleLoader__.load({
1954
1962
  h(Avatar, { name: person.name, human: false }),
1955
1963
  h('span', { className: 'at-peoplename' }, person.name),
1956
1964
  person.role ? h('span', { className: 'at-people-role' }, person.role) : null,
1957
- h('span', { className: 'at-peoplebadges' }, badges.join(' · '))),
1965
+ h('span', { className: 'at-peoplebadges' }, badges.join(' · ')),
1966
+ // P2:统一配置该人在所有项目的 LLM 端点(人员池级入口,
1967
+ // 免去逐项目×逐成员修改)。
1968
+ onConfigModel ? h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: (event) => { event.preventDefault(); onConfigModel(person); } }, t('personModelBtn')) : null),
1958
1969
  h('div', { className: 'at-peopleprojects' }, person.projects.map((row) => {
1959
1970
  const failed = row.lastFailure !== undefined && row.lastFailure !== null;
1960
1971
  const localHere = localNames.has(person.name);
@@ -2914,6 +2925,41 @@ window.__ModuleLoader__.load({
2914
2925
  sayRight(tf(t, 'sendFailed', { message: error?.message ?? String(error) }));
2915
2926
  }
2916
2927
  }
2928
+ // P2:人员池统一配置模型——对同名成员在其所有项目逐个
2929
+ // member.config.update(跨项目批量,免逐项目进资料面板)。
2930
+ async function configPersonModel(person) {
2931
+ const providers = modelCatalog?.providers ?? [];
2932
+ const options = [];
2933
+ for (const provider of providers) {
2934
+ for (const model of provider.models ?? []) {
2935
+ options.push(provider.name + ' / ' + model);
2936
+ if (options.length >= 60) break;
2937
+ }
2938
+ if (options.length >= 60) break;
2939
+ }
2940
+ if (options.length === 0) { say(t('modelCatalogEmpty')); return; }
2941
+ const picked = await askPrompt(tf(t, 'personModelTitle', { name: person.name }), { options });
2942
+ if (picked === null) return;
2943
+ const chosen = options.includes(picked) ? picked : options[0];
2944
+ const [providerName, model] = chosen.split(' / ');
2945
+ const provider = providers.find((entry) => entry.name === providerName) ?? providers.find((entry) => entry.id === providerName);
2946
+ const patch = { provider: provider?.id ?? providerName, model };
2947
+ let done = 0; let failed = 0;
2948
+ for (const row of person.projects ?? []) {
2949
+ const memberIds = Array.isArray(row.memberIds) ? row.memberIds : [];
2950
+ for (const memberId of memberIds) {
2951
+ try {
2952
+ await runCommand('member.config.update', { memberId, patch, reason: 'people pool model' }, row.projectId);
2953
+ done += 1;
2954
+ } catch {
2955
+ failed += 1;
2956
+ }
2957
+ }
2958
+ }
2959
+ sayRight(tf(t, 'personModelDone', { name: person.name, model, done, failed }));
2960
+ await reloadData();
2961
+ loadPeople();
2962
+ }
2917
2963
  const inboxItems = (data.inbox ?? []).filter((item) => !isInformationalInboxItem(item));
2918
2964
  // R-13bis:Human↔成员对话门(项目级开关,账本留痕)。
2919
2965
  const chatGateClosed = (project?.chatGate ?? 'open') === 'closed';
@@ -3833,6 +3879,7 @@ window.__ModuleLoader__.load({
3833
3879
  if (target) void switchProject(target);
3834
3880
  else say(t('quadrantMissing'));
3835
3881
  },
3882
+ onConfigModel: configPersonModel,
3836
3883
  })
3837
3884
  : inInbox
3838
3885
  ? h('div', { className: 'at-stream', role: 'region', 'aria-label': t('inboxTitle') },
package/index.js CHANGED
@@ -41,7 +41,7 @@ export const name = 'ai-team';
41
41
  /** The workbench only makes sense where the Web carrier exists. */
42
42
  export const inject = ['webServer', 'permissionPresets', 'sandboxPolicy'];
43
43
 
44
- const VERSION = '0.3.71';
44
+ const VERSION = '0.3.74';
45
45
  const PROJECT_ID = 'prj_main';
46
46
  const HUMAN_ID = 'mem_human';
47
47
 
@@ -1249,18 +1249,24 @@ export function apply(ctx, config = {}) {
1249
1249
  ...bootstrap,
1250
1250
  inbox,
1251
1251
  inboxUnread: inbox.filter((item) => item.state === 'unread').length,
1252
- projects: booted.registry.list().map((project) => {
1253
- const active = bootstrap.projects?.find((entry) => entry.id === project.id);
1254
- return {
1255
- ...project,
1256
- owner: active?.owner ?? null,
1257
- goal: active?.goal ?? '',
1258
- workspacePath: active?.workspacePath ?? project.workspacePath ?? '',
1259
- pmoAuto: project.pmoAuto ?? active?.pmoAuto ?? true,
1260
- archived: false,
1261
- active: project.id === booted.activeProjectId,
1262
- };
1263
- }),
1252
+ projects: booted.registry.list()
1253
+ .filter((project) => project.archived !== true)
1254
+ .map((project) => {
1255
+ const active = bootstrap.projects?.find((entry) => entry.id === project.id);
1256
+ return {
1257
+ ...project,
1258
+ owner: active?.owner ?? null,
1259
+ goal: active?.goal ?? '',
1260
+ workspacePath: active?.workspacePath ?? project.workspacePath ?? '',
1261
+ pmoAuto: project.pmoAuto ?? active?.pmoAuto ?? true,
1262
+ // 项目级开关随 bootstrap 下发(此前被 registry 重映射
1263
+ // 丢弃,导致按钮状态永远默认「开」)。
1264
+ chatGate: active?.chatGate ?? 'open',
1265
+ runState: active?.runState ?? 'running',
1266
+ archived: project.archived === true,
1267
+ active: project.id === booted.activeProjectId,
1268
+ };
1269
+ }),
1264
1270
  runtime: {
1265
1271
  defaultModel: ctx.get('agentDefaultModel')?.currentSelection?.() ?? null,
1266
1272
  providers: ctx.get('subagents')?.list?.() ?? [],
@@ -1346,6 +1352,14 @@ export function apply(ctx, config = {}) {
1346
1352
  if (typeof body?.type !== 'string' || body.type === '') {
1347
1353
  return send(res, { error: { code: 'E_INVALID_ARGUMENT', message: 'command type is required' } }, 400);
1348
1354
  }
1355
+ // 归档保护在实际的全局清单上判定(registry 跨项目;service 只见
1356
+ // 自己的账本,旧实现在 service 内判定导致所有归档被误拒)。
1357
+ if (body.type === 'project.archive' && body.payload?.archived !== false) {
1358
+ const others = booted.registry.list().filter((project) => project.archived !== true && project.id !== projectId);
1359
+ if (others.length === 0) {
1360
+ return send(res, { error: { code: 'E_INVALID_STATE', message: 'cannot archive the last active project' } }, 409);
1361
+ }
1362
+ }
1349
1363
  if (body.type === 'test.llm.fault') {
1350
1364
  if (process.env.DSH_AI_TEAM_TEST !== '1') {
1351
1365
  return send(res, { error: { code: 'E_FORBIDDEN', message: 'test hook is disabled' } }, 403);
@@ -95,7 +95,7 @@ function handoffMarkdown(state, project, nowMs) {
95
95
  out.push('- 成员的 DSH 会话仍在,如需复用团队请保持项目 runState;如改用其他工具,可停止本项目。');
96
96
  return out.join('\n') + '\n';
97
97
  }
98
-
98
+
99
99
  export class TeamService {
100
100
  /**
101
101
  * @param {{ ledger: { state: any, append: (input: any) => Promise<any> }, now?: () => number, diag?: { append: (row: any) => any } }} options
@@ -440,6 +440,17 @@ export class TeamService {
440
440
  fail(ERRORS.INVALID_ARGUMENT, 'workspacePath is required');
441
441
  }
442
442
  const workspacePath = payload.workspacePath.trim();
443
+ // P5b:目录必须真实存在且是目录——配置不存在的目录会让成员会话 cwd
444
+ // 无效、回合直接失败(用户实证:working-directory: directory does not exist)。
445
+ let stat = null;
446
+ try {
447
+ stat = statSync(workspacePath);
448
+ } catch {
449
+ fail(ERRORS.INVALID_ARGUMENT, `工作目录不存在:${workspacePath};请先创建该目录,或选择已存在的目录`);
450
+ }
451
+ if (stat !== null && typeof stat.isDirectory === 'function' && stat.isDirectory() !== true) {
452
+ fail(ERRORS.INVALID_ARGUMENT, `工作目录不是目录:${workspacePath}`);
453
+ }
443
454
  await this.append(command, 'project/workspace-changed', {
444
455
  projectId,
445
456
  workspacePath,
@@ -505,10 +516,9 @@ export class TeamService {
505
516
  const archived = payload.archived !== false;
506
517
  if (command.actor.kind !== 'human') fail(ERRORS.UNAUTHORIZED, 'only Human may archive a project');
507
518
  if (archived === false && project.status === 'archived') fail(ERRORS.INVALID_STATE, 'archived projects cannot be un-archived in this version');
508
- const active = Object.values(this.state.projects ?? {}).filter((p) => p.status !== 'archived');
509
- if (archived && active.length <= 1 && active[0]?.id === projectId) {
510
- fail(ERRORS.INVALID_STATE, 'cannot archive the last active project');
511
- }
519
+ // 归档许可由 Host 层判定(registry 是全局项目清单;本 service 只持有
520
+ // 自己项目的账本,无法看到其它项目——旧实现的「最后 active 项目」检查
521
+ // 在本账本里恒为 1,导致所有归档都被误拒 409)。
512
522
  await this.append(command, 'project/archived', { projectId, archived, reason: payload.reason ?? '' });
513
523
  return { project: { ...project, status: archived ? 'archived' : 'active' } };
514
524
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.3.72",
3
+ "version": "0.3.74",
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",