@suifei/dsh-ai-team 0.4.4 → 0.4.6
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 +79 -63
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -46,9 +46,11 @@ import { createDiagLogger, defaultDiagDir } from './lib/diaglog.js';
|
|
|
46
46
|
export const name = 'ai-team';
|
|
47
47
|
|
|
48
48
|
/** The workbench only makes sense where the Web carrier exists. */
|
|
49
|
-
|
|
49
|
+
// cordis 按 inject 保证属性注入;未声明的属性访问会抛错,因此这里列全插件
|
|
50
|
+
// 实际使用的服务(含可选服务:缺失时 serviceOf 回退 ctx.get 并返回 undefined)。
|
|
51
|
+
export const inject = ['webServer', 'permissionPresets', 'sandboxPolicy', 'tools', 'shell', 'agents', 'subagents', 'sessions'];
|
|
50
52
|
|
|
51
|
-
const VERSION = '0.4.
|
|
53
|
+
const VERSION = '0.4.6';
|
|
52
54
|
const HUMAN_ID = 'mem_human';
|
|
53
55
|
|
|
54
56
|
const SKILLOPT_BACKENDS = ['mock', 'claude', 'codex', 'copilot', 'cursor', 'pi', 'opencode', 'handoff', 'azure_openai'];
|
|
@@ -79,9 +81,23 @@ export const Config = z.object({
|
|
|
79
81
|
* 惰性 shell 服务代理:插件注入时机可能早于 shell 服务就绪,注册与 tick 都
|
|
80
82
|
* 必须在调用时现取,避免「boot 时未就绪 → 整条技能链静默跳过」。
|
|
81
83
|
*/
|
|
84
|
+
/**
|
|
85
|
+
* 取 DSH 服务:cordis 以属性形式注入(ctx.tools / ctx.shell …),
|
|
86
|
+
* ctx.get(name) 是另一套查询;两者在不同宿主版本上可用性不同,故先属性后 get。
|
|
87
|
+
*/
|
|
88
|
+
function serviceOf(ctx, name) {
|
|
89
|
+
// cordis Context 是 Proxy:访问未注入的属主会抛错,故必须 try/catch;
|
|
90
|
+
// 属性不可用时回退 ctx.get(name)(可选服务缺失返回 undefined)。
|
|
91
|
+
try {
|
|
92
|
+
const direct = ctx?.[name];
|
|
93
|
+
if (direct !== undefined && direct !== null) return direct;
|
|
94
|
+
} catch { /* not injected: fall back to ctx.get */ }
|
|
95
|
+
return ctx?.get?.(name);
|
|
96
|
+
}
|
|
97
|
+
|
|
82
98
|
function lazyShellService(ctx) {
|
|
83
99
|
const get = () => {
|
|
84
|
-
const service = ctx
|
|
100
|
+
const service = serviceOf(ctx, 'shell');
|
|
85
101
|
if (service === undefined || service === null) throw new Error('shell service is not available');
|
|
86
102
|
return service;
|
|
87
103
|
};
|
|
@@ -192,7 +208,7 @@ export function apply(ctx, config = {}) {
|
|
|
192
208
|
send(res, { error: { code, message: error?.message ?? 'command failed', details: error?.details ?? null } }, status);
|
|
193
209
|
};
|
|
194
210
|
ctx.effect(() => {
|
|
195
|
-
const webServer = ctx
|
|
211
|
+
const webServer = serviceOf(ctx, 'webServer');
|
|
196
212
|
if (webServer === undefined) return () => {};
|
|
197
213
|
|
|
198
214
|
let booted = null;
|
|
@@ -208,7 +224,7 @@ export function apply(ctx, config = {}) {
|
|
|
208
224
|
return null;
|
|
209
225
|
};
|
|
210
226
|
const workspaceForProject = async (projectRuntime) => {
|
|
211
|
-
const registry = ctx
|
|
227
|
+
const registry = serviceOf(ctx, 'workspaceRegistry');
|
|
212
228
|
const path = projectRuntime?.service?.state?.projects?.[projectRuntime.id]?.workspacePath;
|
|
213
229
|
if (registry === undefined || typeof path !== 'string' || path === '') return null;
|
|
214
230
|
try {
|
|
@@ -227,8 +243,8 @@ export function apply(ctx, config = {}) {
|
|
|
227
243
|
const projectNameOf = (projectRuntime) => projectRuntime?.service?.state?.projects?.[projectRuntime?.id]?.name ?? '';
|
|
228
244
|
const titleMemberSession = async (projectRuntime, member) => {
|
|
229
245
|
if (member === undefined) return;
|
|
230
|
-
const sessions = ctx
|
|
231
|
-
const titleService = ctx
|
|
246
|
+
const sessions = serviceOf(ctx, 'sessions');
|
|
247
|
+
const titleService = serviceOf(ctx, 'sessionTitle');
|
|
232
248
|
const session = sessions?.get?.(member.sessionId);
|
|
233
249
|
if (session === undefined || session === null || typeof titleService?.rename !== 'function') return;
|
|
234
250
|
const title = memberSessionTitle(member, projectNameOf(projectRuntime));
|
|
@@ -262,7 +278,7 @@ export function apply(ctx, config = {}) {
|
|
|
262
278
|
const route = `${selection.provider}/${selection.model}`;
|
|
263
279
|
if (modelSelectionLogged.get(sessionId) === route) return;
|
|
264
280
|
try {
|
|
265
|
-
const session = ctx
|
|
281
|
+
const session = serviceOf(ctx, 'sessions')?.get?.(sessionId);
|
|
266
282
|
if (session === undefined || session === null || typeof session.append !== 'function') return;
|
|
267
283
|
session.append('model/selection', { provider: selection.provider, model: selection.model });
|
|
268
284
|
modelSelectionLogged.set(sessionId, route);
|
|
@@ -273,8 +289,8 @@ export function apply(ctx, config = {}) {
|
|
|
273
289
|
}
|
|
274
290
|
};
|
|
275
291
|
const access = validatePermissionProfile({
|
|
276
|
-
permissionPresets: ctx
|
|
277
|
-
sandboxPolicy: ctx
|
|
292
|
+
permissionPresets: serviceOf(ctx, 'permissionPresets'),
|
|
293
|
+
sandboxPolicy: serviceOf(ctx, 'sandboxPolicy'),
|
|
278
294
|
});
|
|
279
295
|
const ready = access.ok
|
|
280
296
|
? Promise.resolve().then(() => boot(diag))
|
|
@@ -373,7 +389,7 @@ export function apply(ctx, config = {}) {
|
|
|
373
389
|
// The child Agent owns a persisted session, but its live events are
|
|
374
390
|
// buffered by the JSONL writer until a session/flush checkpoint. Flush
|
|
375
391
|
// every member turn boundary so restart/memory can replay the history.
|
|
376
|
-
const sessions = ctx
|
|
392
|
+
const sessions = serviceOf(ctx, 'sessions');
|
|
377
393
|
try {
|
|
378
394
|
await sessions?.flush?.(session);
|
|
379
395
|
} catch (error) {
|
|
@@ -392,7 +408,7 @@ export function apply(ctx, config = {}) {
|
|
|
392
408
|
: () => {};
|
|
393
409
|
let llmFaultMode = null;
|
|
394
410
|
const offLlmFault = process.env.DSH_AI_TEAM_TEST === '1'
|
|
395
|
-
? installFaultAdapter(ctx
|
|
411
|
+
? installFaultAdapter(serviceOf(ctx, 'llm'), () => llmFaultMode)
|
|
396
412
|
: () => {};
|
|
397
413
|
let host = null;
|
|
398
414
|
let hostPromise = null;
|
|
@@ -429,10 +445,10 @@ export function apply(ctx, config = {}) {
|
|
|
429
445
|
for (const [key, seq] of wakeKeys) {
|
|
430
446
|
if (Number.isSafeInteger(seq) && head - seq > 500) wakeKeys.delete(key);
|
|
431
447
|
}
|
|
432
|
-
const subagents = ctx
|
|
433
|
-
const sessions = ctx
|
|
434
|
-
const permissionPresets = ctx
|
|
435
|
-
const sandboxPolicy = ctx
|
|
448
|
+
const subagents = serviceOf(ctx, 'subagents');
|
|
449
|
+
const sessions = serviceOf(ctx, 'sessions');
|
|
450
|
+
const permissionPresets = serviceOf(ctx, 'permissionPresets');
|
|
451
|
+
const sandboxPolicy = serviceOf(ctx, 'sandboxPolicy');
|
|
436
452
|
if (subagents === undefined || sessions === undefined || permissionPresets === undefined || sandboxPolicy === undefined) return;
|
|
437
453
|
const providers = typeof subagents.list === 'function' ? subagents.list() : [];
|
|
438
454
|
if (providers.length === 0) return;
|
|
@@ -482,11 +498,11 @@ export function apply(ctx, config = {}) {
|
|
|
482
498
|
await titleMemberSession(projectRuntime, member);
|
|
483
499
|
const runtime = new MemberRuntime({
|
|
484
500
|
subagents, sessions, permissionPresets, sandboxPolicy,
|
|
485
|
-
agents: ctx
|
|
486
|
-
agentPresets: ctx
|
|
501
|
+
agents: serviceOf(ctx, 'agents'),
|
|
502
|
+
agentPresets: serviceOf(ctx, 'agentPresets'),
|
|
487
503
|
direct: false,
|
|
488
504
|
parent: parentInfo.agent,
|
|
489
|
-
provider: (ctx
|
|
505
|
+
provider: (serviceOf(ctx, 'subagents')?.list?.() ?? [])[0],
|
|
490
506
|
preset: 'standard',
|
|
491
507
|
cwd,
|
|
492
508
|
trackHandle: (sessionId, handle) => resumedHandles.set(sessionId, handle),
|
|
@@ -577,7 +593,7 @@ export function apply(ctx, config = {}) {
|
|
|
577
593
|
projectDir: projectRuntime.dir,
|
|
578
594
|
deps: {
|
|
579
595
|
now: () => Date.now(),
|
|
580
|
-
provider: (ctx
|
|
596
|
+
provider: (serviceOf(ctx, 'subagents')?.list?.() ?? [])[0],
|
|
581
597
|
// parent 惰性解析:仅启动 judge 子代理时需要;generating 阶段
|
|
582
598
|
// 不依赖 agents 服务,避免 tick 阶段服务不可用时整块失败。
|
|
583
599
|
ensureParent: () => ensureParent(),
|
|
@@ -727,13 +743,13 @@ export function apply(ctx, config = {}) {
|
|
|
727
743
|
if (member === undefined || member.kind !== 'agent') {
|
|
728
744
|
return { error: { code: 'E_NOT_FOUND', message: 'agent not found' }, status: 404 };
|
|
729
745
|
}
|
|
730
|
-
const llm = ctx
|
|
746
|
+
const llm = serviceOf(ctx, 'llm');
|
|
731
747
|
if (llm?.stream === undefined) {
|
|
732
748
|
return { error: { code: 'E_RUNTIME_UNAVAILABLE', message: 'llm service is unavailable' }, status: 503 };
|
|
733
749
|
}
|
|
734
750
|
const selection = member.config?.provider && member.config?.model
|
|
735
751
|
? { provider: member.config.provider, model: member.config.model }
|
|
736
|
-
: ctx
|
|
752
|
+
: serviceOf(ctx, 'agentDefaultModel')?.currentSelection?.();
|
|
737
753
|
if (!selection?.provider || !selection?.model) {
|
|
738
754
|
return { error: { code: 'E_RUNTIME_UNAVAILABLE', message: 'no provider/model configured' }, status: 503 };
|
|
739
755
|
}
|
|
@@ -792,7 +808,7 @@ export function apply(ctx, config = {}) {
|
|
|
792
808
|
return { ok: true, member: result.member, distilled: { provider: selection.provider, model: selection.model } };
|
|
793
809
|
};
|
|
794
810
|
|
|
795
|
-
const skillsService = ctx
|
|
811
|
+
const skillsService = serviceOf(ctx, 'skills');
|
|
796
812
|
let disposeSkillProvider = () => {};
|
|
797
813
|
try {
|
|
798
814
|
// A vendor failure must never fail composition activation: that left
|
|
@@ -806,14 +822,14 @@ export function apply(ctx, config = {}) {
|
|
|
806
822
|
diag.append({ ev: 'skill.provider.fail', message: error?.message ?? String(error) });
|
|
807
823
|
console.warn('[ai-team] file skill provider failed:', error?.message ?? error);
|
|
808
824
|
}
|
|
809
|
-
const tools = ctx
|
|
825
|
+
const tools = serviceOf(ctx, 'tools');
|
|
810
826
|
let disposeSkillOpt = () => {};
|
|
811
827
|
try {
|
|
812
828
|
// shell 惰性代理:注入时机早于 shell 服务就绪时,注册仍必须完成——
|
|
813
829
|
// 每次调用现取,避免「boot 时 shell 未就绪 → 整条技能链静默跳过」。
|
|
814
830
|
const shellProxy = lazyShellService(ctx);
|
|
815
831
|
if (!tools?.register) {
|
|
816
|
-
diag.append({ ev: 'skillopt.skip.fail', hasToolsRegister: false, hasShell: Boolean(ctx
|
|
832
|
+
diag.append({ ev: 'skillopt.skip.fail', hasToolsRegister: false, hasShell: Boolean(serviceOf(ctx, 'shell')) });
|
|
817
833
|
console.warn('[ai-team] SkillOpt tools not registered: no tool registry');
|
|
818
834
|
}
|
|
819
835
|
if (tools?.register) {
|
|
@@ -822,11 +838,11 @@ export function apply(ctx, config = {}) {
|
|
|
822
838
|
const engineScript = fileURLToPath(new URL('./lib/vendor/skillopt/scripts/sleep.py', import.meta.url));
|
|
823
839
|
const readPair = makeReadPair({ shell: shellProxy, engineScript, diag });
|
|
824
840
|
const judge = makeJudge({
|
|
825
|
-
subagents: ctx
|
|
841
|
+
subagents: serviceOf(ctx, 'subagents'),
|
|
826
842
|
// 惰性解析:ensureParent 在 apply 之后才定义(const TDZ),
|
|
827
843
|
// judge 只在 adopt 时调用,此处不能立即取值。
|
|
828
844
|
ensureParent: () => ensureParent(),
|
|
829
|
-
providerName: () => (ctx
|
|
845
|
+
providerName: () => (serviceOf(ctx, 'subagents')?.list?.() ?? [])[0],
|
|
830
846
|
votes: config.skilloptJudgeVotes ?? 3,
|
|
831
847
|
diag,
|
|
832
848
|
});
|
|
@@ -929,9 +945,9 @@ export function apply(ctx, config = {}) {
|
|
|
929
945
|
if (dimension === null) return '[skillopt optimize] rubric produced no scorable dimension';
|
|
930
946
|
const parentInfo = await ensureParent();
|
|
931
947
|
const generator = makeGenerator({
|
|
932
|
-
subagents: ctx
|
|
948
|
+
subagents: serviceOf(ctx, 'subagents'),
|
|
933
949
|
ensureParent: () => ensureParent(),
|
|
934
|
-
providerName: () => (ctx
|
|
950
|
+
providerName: () => (serviceOf(ctx, 'subagents')?.list?.() ?? [])[0],
|
|
935
951
|
cwd: project,
|
|
936
952
|
diag,
|
|
937
953
|
});
|
|
@@ -1018,10 +1034,10 @@ export function apply(ctx, config = {}) {
|
|
|
1018
1034
|
.map((runtime) => runtime.service.state.hostSessionId)
|
|
1019
1035
|
.find((value) => value !== undefined && value !== null);
|
|
1020
1036
|
hostPromise = ensureHostAgent({
|
|
1021
|
-
agents: ctx
|
|
1022
|
-
agentDefaultModel: ctx
|
|
1023
|
-
workspaceRegistry: ctx
|
|
1024
|
-
sessions: ctx
|
|
1037
|
+
agents: serviceOf(ctx, 'agents'),
|
|
1038
|
+
agentDefaultModel: serviceOf(ctx, 'agentDefaultModel'),
|
|
1039
|
+
workspaceRegistry: serviceOf(ctx, 'workspaceRegistry'),
|
|
1040
|
+
sessions: serviceOf(ctx, 'sessions'),
|
|
1025
1041
|
cwd: booted?.dataDir ?? process.cwd(),
|
|
1026
1042
|
resumeSessionId: existingHost,
|
|
1027
1043
|
}).then(async (value) => {
|
|
@@ -1078,10 +1094,10 @@ export function apply(ctx, config = {}) {
|
|
|
1078
1094
|
}
|
|
1079
1095
|
diag?.append({ ev: 'member.reseat', memberId: member.id, oldSessionId: staleId, projectId: projectRuntime.id });
|
|
1080
1096
|
}
|
|
1081
|
-
const subagents = ctx
|
|
1082
|
-
const sessions = ctx
|
|
1083
|
-
const permissionPresets = ctx
|
|
1084
|
-
const sandboxPolicy = ctx
|
|
1097
|
+
const subagents = serviceOf(ctx, 'subagents');
|
|
1098
|
+
const sessions = serviceOf(ctx, 'sessions');
|
|
1099
|
+
const permissionPresets = serviceOf(ctx, 'permissionPresets');
|
|
1100
|
+
const sandboxPolicy = serviceOf(ctx, 'sandboxPolicy');
|
|
1085
1101
|
if (subagents === undefined || sessions === undefined || permissionPresets === undefined || sandboxPolicy === undefined) {
|
|
1086
1102
|
diag?.append({ ev: 'activate.reject', projectId: projectRuntime.id, memberId: member.id, code: 'E_RUNTIME_UNAVAILABLE' });
|
|
1087
1103
|
return { error: { code: 'E_RUNTIME_UNAVAILABLE', message: 'member runtime services are unavailable' }, status: 503 };
|
|
@@ -1092,7 +1108,7 @@ export function apply(ctx, config = {}) {
|
|
|
1092
1108
|
return { error: { code: 'E_RUNTIME_UNAVAILABLE', message: 'no subagent provider is registered' }, status: 503 };
|
|
1093
1109
|
}
|
|
1094
1110
|
try {
|
|
1095
|
-
const selection = ctx
|
|
1111
|
+
const selection = serviceOf(ctx, 'agentDefaultModel')?.currentSelection?.();
|
|
1096
1112
|
const activationMember = member.config?.provider && member.config?.model
|
|
1097
1113
|
? member
|
|
1098
1114
|
: {
|
|
@@ -1112,11 +1128,11 @@ export function apply(ctx, config = {}) {
|
|
|
1112
1128
|
sessions,
|
|
1113
1129
|
permissionPresets,
|
|
1114
1130
|
sandboxPolicy,
|
|
1115
|
-
agents: ctx
|
|
1116
|
-
agentPresets: ctx
|
|
1131
|
+
agents: serviceOf(ctx, 'agents'),
|
|
1132
|
+
agentPresets: serviceOf(ctx, 'agentPresets'),
|
|
1117
1133
|
direct: false,
|
|
1118
1134
|
parent: parentInfo.agent,
|
|
1119
|
-
provider: (ctx
|
|
1135
|
+
provider: (serviceOf(ctx, 'subagents')?.list?.() ?? [])[0],
|
|
1120
1136
|
preset: 'standard',
|
|
1121
1137
|
cwd: effectiveDir,
|
|
1122
1138
|
trackHandle: (sessionId, handle) => resumedHandles.set(sessionId, handle),
|
|
@@ -1190,8 +1206,8 @@ export function apply(ctx, config = {}) {
|
|
|
1190
1206
|
};
|
|
1191
1207
|
disposePermissionGuard = tools.guard(createMemberPermissionGuard({
|
|
1192
1208
|
service: allMembers,
|
|
1193
|
-
permissionPresets: ctx
|
|
1194
|
-
sandboxPolicy: ctx
|
|
1209
|
+
permissionPresets: serviceOf(ctx, 'permissionPresets'),
|
|
1210
|
+
sandboxPolicy: serviceOf(ctx, 'sandboxPolicy'),
|
|
1195
1211
|
})) ?? (() => {});
|
|
1196
1212
|
}
|
|
1197
1213
|
// A restart is an explicit lifecycle event: resume unfinished Tasks
|
|
@@ -1311,7 +1327,7 @@ export function apply(ctx, config = {}) {
|
|
|
1311
1327
|
});
|
|
1312
1328
|
}
|
|
1313
1329
|
if (req.method === 'GET' && url.pathname === '/ai-team/api/models') {
|
|
1314
|
-
const catalog = await buildModelCatalog(ctx
|
|
1330
|
+
const catalog = await buildModelCatalog(serviceOf(ctx, 'llm'), serviceOf(ctx, 'agentDefaultModel'));
|
|
1315
1331
|
return send(res, catalog);
|
|
1316
1332
|
}
|
|
1317
1333
|
// R-17 person 别名:视图层绑定(name → personId),文件存策略数据
|
|
@@ -1424,19 +1440,19 @@ export function apply(ctx, config = {}) {
|
|
|
1424
1440
|
active: runtime.id === booted.activeProjectId,
|
|
1425
1441
|
})),
|
|
1426
1442
|
runtime: {
|
|
1427
|
-
roots: ctx
|
|
1443
|
+
roots: serviceOf(ctx, 'agents')?.roots?.().length ?? null,
|
|
1428
1444
|
// 服务探测(技能进化链路依赖 tools.register + shell):
|
|
1429
1445
|
// 同步可观测,避免历史「静默未启用」盲区。
|
|
1430
1446
|
services: {
|
|
1431
|
-
tools: typeof ctx
|
|
1432
|
-
shell: Boolean(ctx
|
|
1433
|
-
skilloptTools: (ctx
|
|
1447
|
+
tools: typeof serviceOf(ctx, 'tools')?.register === 'function',
|
|
1448
|
+
shell: Boolean(serviceOf(ctx, 'shell')),
|
|
1449
|
+
skilloptTools: (serviceOf(ctx, 'tools')?.definitions?.() ?? []).map((definition) => definition.name).filter((toolName) => String(toolName).startsWith('skillopt_')),
|
|
1434
1450
|
},
|
|
1435
|
-
defaultModel: ctx
|
|
1436
|
-
llmProviders: ctx
|
|
1437
|
-
providers: ctx
|
|
1438
|
-
providerCaps: (ctx
|
|
1439
|
-
const provider = ctx
|
|
1451
|
+
defaultModel: serviceOf(ctx, 'agentDefaultModel')?.currentSelection?.() ?? null,
|
|
1452
|
+
llmProviders: serviceOf(ctx, 'llm')?.listProviders?.() ?? [],
|
|
1453
|
+
providers: serviceOf(ctx, 'subagents')?.list?.() ?? [],
|
|
1454
|
+
providerCaps: (serviceOf(ctx, 'subagents')?.list?.() ?? []).map((providerName) => {
|
|
1455
|
+
const provider = serviceOf(ctx, 'subagents')?.getProvider?.(providerName);
|
|
1440
1456
|
return {
|
|
1441
1457
|
name: providerName,
|
|
1442
1458
|
capabilities: provider?.capabilities ?? null,
|
|
@@ -1445,17 +1461,17 @@ export function apply(ctx, config = {}) {
|
|
|
1445
1461
|
start: typeof provider?.start === 'function',
|
|
1446
1462
|
};
|
|
1447
1463
|
}),
|
|
1448
|
-
teamTool: ctx
|
|
1464
|
+
teamTool: serviceOf(ctx, 'tools')?.definitions?.().some((definition) => definition.name === 'team') ?? null,
|
|
1449
1465
|
skillsService: skillsService !== null && skillsService !== undefined,
|
|
1450
1466
|
skillNames: skillsService?.list
|
|
1451
1467
|
? await Promise.resolve(skillsService.list({})).then((rows) => rows.map((skill) => skill.name).filter((skillName) => !isSkillExcluded(skillName))).catch(() => [])
|
|
1452
1468
|
: [],
|
|
1453
1469
|
skilloptTools: tools?.definitions?.().map((definition) => definition.name).filter((name) => name.startsWith('skillopt_')) ?? [],
|
|
1454
|
-
presets: await Promise.resolve(ctx
|
|
1470
|
+
presets: await Promise.resolve(serviceOf(ctx, 'agentPresets')?.list?.()).catch(() => []),
|
|
1455
1471
|
members: Object.values(booted.service.state.members ?? {})
|
|
1456
1472
|
.filter((member) => member.kind === 'agent')
|
|
1457
1473
|
.map((member) => {
|
|
1458
|
-
const agent = ctx
|
|
1474
|
+
const agent = serviceOf(ctx, 'agents')?.get?.(member.sessionId);
|
|
1459
1475
|
let lastEvent = null;
|
|
1460
1476
|
let seq = null;
|
|
1461
1477
|
try {
|
|
@@ -1528,8 +1544,8 @@ export function apply(ctx, config = {}) {
|
|
|
1528
1544
|
};
|
|
1529
1545
|
}),
|
|
1530
1546
|
runtime: {
|
|
1531
|
-
defaultModel: ctx
|
|
1532
|
-
providers: ctx
|
|
1547
|
+
defaultModel: serviceOf(ctx, 'agentDefaultModel')?.currentSelection?.() ?? null,
|
|
1548
|
+
providers: serviceOf(ctx, 'subagents')?.list?.() ?? [],
|
|
1533
1549
|
},
|
|
1534
1550
|
});
|
|
1535
1551
|
}
|
|
@@ -1636,16 +1652,16 @@ export function apply(ctx, config = {}) {
|
|
|
1636
1652
|
return send(res, { error: { code: 'E_FORBIDDEN', message: 'test hook is disabled' } }, 403);
|
|
1637
1653
|
}
|
|
1638
1654
|
const member = runtime.service.state.members?.[body.payload?.memberId];
|
|
1639
|
-
const agent = member?.sessionId === undefined ? undefined : ctx
|
|
1655
|
+
const agent = member?.sessionId === undefined ? undefined : serviceOf(ctx, 'agents')?.get?.(member.sessionId);
|
|
1640
1656
|
const session = agent?.session;
|
|
1641
1657
|
if (session === undefined || session === null) {
|
|
1642
1658
|
return send(res, { error: { code: 'E_NOT_FOUND', message: 'member session not found' } }, 404);
|
|
1643
1659
|
}
|
|
1644
|
-
const permissionPresets = ctx
|
|
1660
|
+
const permissionPresets = serviceOf(ctx, 'permissionPresets');
|
|
1645
1661
|
permissionPresets?.set?.(session, 'workspace-write');
|
|
1646
1662
|
return send(res, {
|
|
1647
1663
|
ok: true,
|
|
1648
|
-
mode: ctx
|
|
1664
|
+
mode: serviceOf(ctx, 'sandboxPolicy')?.overrideOf?.(session) ?? null,
|
|
1649
1665
|
});
|
|
1650
1666
|
}
|
|
1651
1667
|
if (body.type === 'test.permission.read') {
|
|
@@ -1653,13 +1669,13 @@ export function apply(ctx, config = {}) {
|
|
|
1653
1669
|
return send(res, { error: { code: 'E_FORBIDDEN', message: 'test hook is disabled' } }, 403);
|
|
1654
1670
|
}
|
|
1655
1671
|
const member = runtime.service.state.members?.[body.payload?.memberId];
|
|
1656
|
-
const agent = member?.sessionId === undefined ? undefined : ctx
|
|
1672
|
+
const agent = member?.sessionId === undefined ? undefined : serviceOf(ctx, 'agents')?.get?.(member.sessionId);
|
|
1657
1673
|
const session = agent?.session;
|
|
1658
1674
|
return send(res, {
|
|
1659
1675
|
ok: true,
|
|
1660
1676
|
mode: session === undefined || session === null
|
|
1661
1677
|
? null
|
|
1662
|
-
: ctx
|
|
1678
|
+
: serviceOf(ctx, 'sandboxPolicy')?.overrideOf?.(session) ?? null,
|
|
1663
1679
|
});
|
|
1664
1680
|
}
|
|
1665
1681
|
if (body.type === 'member.distill' && body.payload?.mode === 'model') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suifei/dsh-ai-team",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
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",
|