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