@suifei/dsh-ai-team 0.3.64 → 0.3.65

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,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.65 — 2026-11-11
4
+
5
+ - **Human↔成员对话门(项目级开关)**:成员的原生会话由团队路由驱动,宿主守卫(`session/agent-busy`)拒绝直接输入——这是宿主核心行为且无配置面。插件以产品通道补齐体验:
6
+ - 新命令 `project.chatGate`(Human-only,账本留痕 `project/chat-gate`)切换项目级对话门:**开(默认)**= 资料面板私信直通成员下一轮(waker prompt 注入,等价原生对话效果);**关**= 私信通道停用,`member.message` 被正常人话拒绝(不产生事件、不唤醒成员);
7
+ - 项目头新增「Human 对话 · 开/关」切换按钮(与 PMO 开关同款交互);
8
+ - 成员资料私信区新增**常驻路由说明**(解释原生直聊被拒的原因、指引走私信),关门时输入框禁用 + 正常提示(替代宿主黑 toast 的报错体验);
9
+ - bootstrap 下发 `chatGate`(默认 open,旧账本向后兼容,不升 stateVersion)。
10
+ - 测试:gate 门禁/留痕/Human-only/非法值/bootstrap 下发共 2 项新测试(133 总)。
11
+
3
12
  ## 0.3.64 — 2026-11-11
4
13
 
5
14
  - **风险清单失败行去刷屏(根治)**:0.3.63 的 240 字符行内截断在真实 tool-call 错误串下仍占据整卡(用户截图实证)。改为行内**只渲染人话分类**(如「未知失败」),完整技术原文移入 hover title(点「成员资料」看成员详情);管理视图的信息密度回归「一屏可扫读」。渲染 E2E 同步加防刷屏断言:任何 UI children 字符串不得超过 200 字符——超长诊断原文只允许走 title 属性,此类回归今后提交前即被拦截。
package/client.js CHANGED
@@ -214,6 +214,14 @@ window.__ModuleLoader__.load({
214
214
  pmoOn: 'PMO 自动 · 开',
215
215
  pmoOff: 'PMO 自动 · 关',
216
216
  pmoHint: 'PMO 自动处理 Human 决策并续派下一批 Task;默认开启',
217
+ chatGateOn: 'Human 对话 · 开',
218
+ chatGateOff: 'Human 对话 · 关',
219
+ chatGateHint: '开启后可在成员资料里给成员发私信(成员下一轮生效);关闭后私信通道停用。注意:成员的原生会话由团队路由驱动,宿主不接受直接输入,始终请用私信。',
220
+ chatGateClosed: 'Human 对话通道已由项目设置关闭;请通过决策与任务看板与团队交互,或用上方开关重新开启。',
221
+ chatGateClosedPlaceholder: '对话通道已关闭',
222
+ chatGateOpened: 'Human 对话通道已开启:私信将直达成员下一轮。',
223
+ chatGateClosedShort: 'Human 对话通道已关闭。',
224
+ routingHint: '成员的原生会话由团队路由驱动,宿主不接受直接输入;请用下方私信与成员对话(下一轮生效)。',
217
225
  pmoEnabled: 'PMO 自动已开启。',
218
226
  pmoDisabled: 'PMO 自动已关闭,决策回到收件箱。',
219
227
  notifyTaskCreated: '新 Task 已创建',
@@ -603,6 +611,14 @@ window.__ModuleLoader__.load({
603
611
  pmoOn: 'PMO auto · on',
604
612
  pmoOff: 'PMO auto · off',
605
613
  pmoHint: 'PMO answers Human decisions and dispatches the next Tasks; on by default',
614
+ chatGateOn: 'Human chat · on',
615
+ chatGateOff: 'Human chat · off',
616
+ chatGateHint: 'When on, you can DM members from their profile (effective next round); when off, the DM channel is disabled. Note: member native sessions are driven by team routing and the host rejects direct input — always use DMs.',
617
+ chatGateClosed: 'The Human chat channel is closed by project settings; interact via decisions and the task board, or re-open with the toggle above.',
618
+ chatGateClosedPlaceholder: 'Chat channel closed',
619
+ chatGateOpened: 'Human chat channel opened: DMs reach members next round.',
620
+ chatGateClosedShort: 'Human chat channel closed.',
621
+ routingHint: 'Member native sessions are driven by team routing; the host rejects direct input. Use the DM below to talk to a member (effective next round).',
606
622
  pmoEnabled: 'PMO auto enabled.',
607
623
  pmoDisabled: 'PMO auto disabled; decisions go back to the inbox.',
608
624
  notifyTaskCreated: 'New Task created',
@@ -2825,6 +2841,17 @@ window.__ModuleLoader__.load({
2825
2841
  const thread = threadFor(data, selectedTask?.id);
2826
2842
  const quadrants = deriveQuadrants(data);
2827
2843
  const inboxItems = (data.inbox ?? []).filter((item) => !isInformationalInboxItem(item));
2844
+ // R-13bis:Human↔成员对话门(项目级开关,账本留痕)。
2845
+ const chatGateClosed = (project?.chatGate ?? 'open') === 'closed';
2846
+ async function toggleChatGate() {
2847
+ try {
2848
+ await runCommand('project.chatGate', { gate: chatGateClosed ? 'open' : 'closed' });
2849
+ say(chatGateClosed ? t('chatGateOpened') : t('chatGateClosedShort'));
2850
+ await reloadData();
2851
+ } catch (error) {
2852
+ sayRight(tf(t, 'sendFailed', { message: error?.message ?? String(error) }));
2853
+ }
2854
+ }
2828
2855
  // R-13 老化分档(纯前端派生):决策项 >24h 加深、>72h 升错误色。
2829
2856
  const inboxAge = (item) => {
2830
2857
  const created = item.createdAt ?? 0;
@@ -3882,7 +3909,14 @@ window.__ModuleLoader__.load({
3882
3909
  title: t('pmoHint'),
3883
3910
  'aria-pressed': project.pmoAuto !== false,
3884
3911
  onClick: togglePmo,
3885
- }, project.pmoAuto !== false ? t('pmoOn') : t('pmoOff'))) : null,
3912
+ }, project.pmoAuto !== false ? t('pmoOn') : t('pmoOff')),
3913
+ h('button', {
3914
+ className: cx('at-pmobtn', !chatGateClosed && 'at-pmo-on'),
3915
+ type: 'button',
3916
+ title: t('chatGateHint'),
3917
+ 'aria-pressed': !chatGateClosed,
3918
+ onClick: () => { void toggleChatGate(); },
3919
+ }, !chatGateClosed ? t('chatGateOn') : t('chatGateOff'))) : null,
3886
3920
  inInbox || inPeople ? null : h('div', { className: 'at-tabs', role: 'tablist', 'aria-label': t('tabsAria'), onKeyDown: tabKeyDown },
3887
3921
  h('button', {
3888
3922
  className: cx('at-tab', tab === 'main' && 'at-on'),
@@ -4077,8 +4111,17 @@ window.__ModuleLoader__.load({
4077
4111
  h('input', { value: pSkill, onChange: (event) => setPSkill(event.target.value), placeholder: t('skillPlaceholder') }),
4078
4112
  h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: addSkill, disabled: !pSkill.trim() }, t('addSkill'))),
4079
4113
  h('div', { className: 'at-inlineadd' },
4080
- h('input', { value: pMessage, onChange: (event) => setPMessage(event.target.value), placeholder: t('messagePlaceholder') }),
4081
- h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: sendMemberMessage, disabled: !pMessage.trim() }, t('sendMessage'))),
4114
+ h('input', {
4115
+ value: pMessage,
4116
+ onChange: (event) => setPMessage(event.target.value),
4117
+ placeholder: chatGateClosed ? t('chatGateClosedPlaceholder') : t('messagePlaceholder'),
4118
+ disabled: chatGateClosed,
4119
+ }),
4120
+ h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: sendMemberMessage, disabled: !pMessage.trim() || chatGateClosed }, t('sendMessage'))),
4121
+ // R-13bis:正常提示替代宿主黑 toast——成员原生会话由团队
4122
+ // 路由驱动,宿主守卫拒绝直接写入;对话走私信(下一轮生效)。
4123
+ h('div', { className: 'at-modalmeta' }, t('routingHint')),
4124
+ chatGateClosed ? h('div', { className: 'at-modalmeta' }, t('chatGateClosed')) : null,
4082
4125
  pError ? h('div', { className: 'at-modalerror', role: 'alert' }, pError) : null,
4083
4126
  h('div', { className: 'at-modalactions' },
4084
4127
  h('button', { className: 'at-btn', type: 'button', onClick: () => setProfileAgent(null), disabled: pBusy }, t('cancel')),
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.64';
44
+ const VERSION = '0.3.65';
45
45
  const PROJECT_ID = 'prj_main';
46
46
  const HUMAN_ID = 'mem_human';
47
47
 
@@ -83,6 +83,7 @@ export class TeamService {
83
83
  const state = this.state;
84
84
  const projects = Object.values(state.projects ?? {}).map((p) => ({
85
85
  id: p.id, name: p.name, goal: p.goal ?? '', owner: p.ownerName ?? p.ownerMemberId ?? p.ownerId, workspacePath: p.workspacePath ?? '', pmoAuto: p.pmoAuto !== false, active: p.status !== 'archived',
86
+ chatGate: p.chatGate === 'closed' ? 'closed' : 'open',
86
87
  }));
87
88
  const members = Object.values(state.members ?? {}).map((m) => ({
88
89
  id: m.id,
@@ -274,6 +275,7 @@ export class TeamService {
274
275
  case 'project.owner.update': return await this.changeProjectOwner(command, payload);
275
276
  case 'project.workspace.update': return await this.changeProjectWorkspace(command, payload);
276
277
  case 'project.pmo.update': return await this.setProjectPmo(command, payload);
278
+ case 'project.chatGate': return await this.setProjectChatGate(command, payload);
277
279
  case 'stream.post': return await this.postStream(command, payload);
278
280
  case 'member.add': return await this.addMember(command, payload);
279
281
  case 'member.bind': return await this.bindMemberSession(command, payload);
@@ -382,8 +384,20 @@ export class TeamService {
382
384
  return { project: { ...project, workspacePath } };
383
385
  }
384
386
 
385
- async setProjectPmo(command, payload) {
387
+ // R-11bis:Human↔成员对话门(项目级开关)。'open' 时私信直通成员下一轮;
388
+ // 'closed' 时私信通道关闭(正常提示,不产生事件、不唤醒成员)。
389
+ async setProjectChatGate(command, payload) {
386
390
  const projectId = command.projectId;
391
+ const project = this.state.projects?.[projectId];
392
+ if (project === undefined) fail(ERRORS.NOT_FOUND, `project ${String(projectId)} not found`);
393
+ const gate = payload.gate;
394
+ if (gate !== 'open' && gate !== 'closed') fail(ERRORS.INVALID_ARGUMENT, 'gate must be open or closed');
395
+ if (command.actor.kind !== 'human') fail(ERRORS.UNAUTHORIZED, 'only Human may change the chat gate');
396
+ await this.append(command, 'project/chat-gate', { projectId, gate, reason: payload.reason ?? '' });
397
+ return { project: { ...project, chatGate: gate } };
398
+ }
399
+
400
+ async setProjectPmo(command, payload) { const projectId = command.projectId;
387
401
  const project = this.state.projects?.[projectId];
388
402
  if (project === undefined) fail(ERRORS.NOT_FOUND, `project ${String(projectId)} not found`);
389
403
  if (typeof payload.pmoAuto !== 'boolean') fail(ERRORS.INVALID_ARGUMENT, 'pmoAuto must be boolean');
@@ -574,6 +588,10 @@ export class TeamService {
574
588
 
575
589
  async messageMember(command, payload) {
576
590
  if (command.actor.kind !== 'human') fail(ERRORS.UNAUTHORIZED, 'only Human may message a member');
591
+ const gate = this.state.projects?.[command.projectId]?.chatGate;
592
+ if (gate === 'closed') {
593
+ fail(ERRORS.INVALID_STATE, 'Human 对话通道已由项目设置关闭;请通过决策与任务看板与团队交互,或重新开启对话门。');
594
+ }
577
595
  const member = this.state.members?.[payload.memberId];
578
596
  if (member === undefined || member.kind !== 'agent') fail(ERRORS.NOT_FOUND, `agent ${String(payload.memberId)} not found`);
579
597
  const body = typeof payload.body === 'string' ? payload.body.trim() : '';
@@ -674,6 +674,18 @@ export function applyEvent(state, event) {
674
674
  });
675
675
  }
676
676
 
677
+ case 'project/chat-gate': {
678
+ const projectId = textOr(payload.projectId, event.projectId);
679
+ const project = state.projects?.[projectId];
680
+ if (project === undefined || (payload.gate !== 'open' && payload.gate !== 'closed')) return advance(state, event);
681
+ return advance(state, event, {
682
+ projects: {
683
+ ...state.projects,
684
+ [projectId]: { ...project, chatGate: payload.gate },
685
+ },
686
+ });
687
+ }
688
+
677
689
  case 'project/workspace-changed': {
678
690
  const projectId = textOr(payload.projectId, event.projectId);
679
691
  const workspacePath = textOr(payload.workspacePath, null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suifei/dsh-ai-team",
3
- "version": "0.3.64",
3
+ "version": "0.3.65",
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",