@suifei/dsh-ai-team 0.3.81 → 0.3.83

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/index.js CHANGED
@@ -30,7 +30,6 @@ import { installFaultAdapter } from './lib/host/fault-adapter.js';
30
30
  import { buildModelCatalog } from './lib/host/model-catalog.js';
31
31
  import { createTeamTool } from './lib/host/member-tools.js';
32
32
  import { describeWake, planWakes } from './lib/host/waker.js';
33
- import { planChatGateReseats } from './lib/host/chat-gate-sync.js';
34
33
  import { aggregatePeople } from './lib/host/people-view.js';
35
34
  import { riskView } from './lib/host/risk-view.js';
36
35
  import { weeklyView } from './lib/host/weekly-view.js';
@@ -42,7 +41,7 @@ export const name = 'ai-team';
42
41
  /** The workbench only makes sense where the Web carrier exists. */
43
42
  export const inject = ['webServer', 'permissionPresets', 'sandboxPolicy'];
44
43
 
45
- const VERSION = '0.3.81';
44
+ const VERSION = '0.3.83';
46
45
  const HUMAN_ID = 'mem_human';
47
46
 
48
47
  const SKILLOPT_BACKENDS = ['mock', 'claude', 'codex', 'copilot', 'cursor', 'pi', 'opencode', 'handoff', 'azure_openai'];
@@ -372,9 +371,6 @@ export function apply(ctx, config = {}) {
372
371
  const pmoLastStall = new Map();
373
372
  const pmoLastHeartbeat = new Map();
374
373
  const pmoLastDispatch = new Map();
375
- // chatGate 已应用值(内存):boot 时用当前账本值初始化,避免重启即重建
376
- // 全体会话;此后每轮 tick 收敛到账本值(对空闲成员自动重建会话)。
377
- const chatGateApplied = new Map();
378
374
  const pmoLastEscalate = new Map();
379
375
  const pmoLastReview = new Map();
380
376
  // Members resumed from cold sessions produce AgentHandles nobody stored;
@@ -457,8 +453,7 @@ export function apply(ctx, config = {}) {
457
453
  subagents, sessions, permissionPresets, sandboxPolicy,
458
454
  agents: ctx.get('agents'),
459
455
  agentPresets: ctx.get('agentPresets'),
460
- direct: true,
461
- allowHumanWrite: projectRuntime.service.state.projects?.[projectRuntime.id]?.chatGate !== 'closed',
456
+ direct: false,
462
457
  parent: parentInfo.agent,
463
458
  provider: providers[0],
464
459
  preset: 'standard',
@@ -511,33 +506,6 @@ export function apply(ctx, config = {}) {
511
506
  // P6 停止门:stopped 项目停止一切派发(补派/心跳/升级/continue 全停),
512
507
  // 正在执行的回合自然完成;唤醒事件 hook 同样检查(见 wakeFromResult)。
513
508
  if (project.runState === 'stopped') return;
514
- // chatGate 自动收敛:开关变更后成员会话 header 需重建才生效——对
515
- // **空闲**成员自动 reseat(每轮最多 2 个),忙碌成员等回合结束再应用。
516
- // 本轮无可重建且无忙碌成员时记为已收敛(停止重复重建)。独立于派发门。
517
- const gate = project.chatGate === 'closed' ? 'closed' : 'open';
518
- if (chatGateApplied.get(projectRuntime.id) !== gate) {
519
- const plan = planChatGateReseats(
520
- Object.values(state.members ?? {}).filter((member) => member.kind === 'agent'),
521
- (sessionId) => ctx.get('agents')?.get?.(sessionId)?.status ?? null,
522
- { limit: 2 },
523
- );
524
- for (const memberId of plan.reseat) {
525
- const member = state.members?.[memberId];
526
- if (member === undefined) continue;
527
- diag.append({ ev: 'chatgate.reseat', projectId: projectRuntime.id, memberId, gate, oldSessionId: member.sessionId ?? null });
528
- const result = await activateMember({
529
- payload: { memberId, prompt: `会话已重建(Human 对话门:${gate})。先读 tasks/thread 当前状态,继续推进;不要重复已完成的工作。`, force: true },
530
- }, projectRuntime).catch((error) => ({ error: { message: error?.message ?? String(error) } }));
531
- if (result?.error !== undefined) {
532
- diag.append({ ev: 'chatgate.reseat.fail', projectId: projectRuntime.id, memberId, message: result.error.message });
533
- }
534
- }
535
- // 本轮没有可重建对象、也没有忙碌成员 → 全部收敛(cold 成员激活时
536
- // 自然读取当前门状态)。
537
- if (plan.reseat.length === 0 && plan.busy.length === 0) {
538
- chatGateApplied.set(projectRuntime.id, gate);
539
- }
540
- }
541
509
  for (const member of Object.values(state.members ?? {})) {
542
510
  if (member.kind === 'agent' && typeof member.sessionId === 'string') {
543
511
  await titleMemberSession(projectRuntime, member);
@@ -889,8 +857,7 @@ export function apply(ctx, config = {}) {
889
857
  sandboxPolicy,
890
858
  agents: ctx.get('agents'),
891
859
  agentPresets: ctx.get('agentPresets'),
892
- direct: true,
893
- allowHumanWrite: projectRuntime.service.state.projects?.[projectRuntime.id]?.chatGate !== 'closed',
860
+ direct: false,
894
861
  parent: parentInfo.agent,
895
862
  provider: providers[0],
896
863
  preset: 'standard',
@@ -1291,9 +1258,6 @@ export function apply(ctx, config = {}) {
1291
1258
  goal: active?.goal ?? '',
1292
1259
  workspacePath: active?.workspacePath ?? project.workspacePath ?? '',
1293
1260
  pmoAuto: project.pmoAuto ?? active?.pmoAuto ?? true,
1294
- // 项目级开关随 bootstrap 下发(此前被 registry 重映射
1295
- // 丢弃,导致按钮状态永远默认「开」)。
1296
- chatGate: active?.chatGate ?? 'open',
1297
1261
  runState: active?.runState ?? 'running',
1298
1262
  archived: project.archived === true,
1299
1263
  active: project.id === booted.activeProjectId,