@suifei/dsh-ai-team 0.4.22 → 0.4.24
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 +44 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -52,7 +52,7 @@ export const name = 'ai-team';
|
|
|
52
52
|
// 实际使用的服务(含可选服务:缺失时 serviceOf 回退 ctx.get 并返回 undefined)。
|
|
53
53
|
export const inject = ['webServer', 'permissionPresets', 'sandboxPolicy', 'tools', 'shell', 'agents', 'subagents', 'sessions'];
|
|
54
54
|
|
|
55
|
-
const VERSION = '0.4.
|
|
55
|
+
const VERSION = '0.4.24';
|
|
56
56
|
const HUMAN_ID = 'mem_human';
|
|
57
57
|
|
|
58
58
|
const SKILLOPT_BACKENDS = ['mock', 'claude', 'codex', 'copilot', 'cursor', 'pi', 'opencode', 'handoff', 'azure_openai'];
|
|
@@ -381,8 +381,50 @@ export function apply(ctx, config = {}) {
|
|
|
381
381
|
return { kind: 'retry' };
|
|
382
382
|
})
|
|
383
383
|
: () => {};
|
|
384
|
+
// 诊断:记录成员 agent 可见的工具名与 preset。DSH 以「scope carrier +
|
|
385
|
+
// agent」两个参数 emit(文档:both with the agent's scope carrier),
|
|
386
|
+
// 因此回调需兼容两种形状,取真正带 ctx 的那个。
|
|
387
|
+
const offAgentCreated = typeof ctx.on === 'function'
|
|
388
|
+
? ctx.on('agent/created', (first, second) => {
|
|
389
|
+
try {
|
|
390
|
+
const agent = second?.ctx !== undefined ? second : (first?.ctx !== undefined ? first : (second ?? first));
|
|
391
|
+
if (agent?.ctx?.tools === undefined) return;
|
|
392
|
+
const runtime = runtimeForAgent(agent?.id);
|
|
393
|
+
if (runtime === null) return; // 只关注成员会话
|
|
394
|
+
const names = (agent.ctx.tools.definitions?.() ?? []).map((definition) => definition.name);
|
|
395
|
+
diag.append({
|
|
396
|
+
ev: 'agent.created.probe.fail',
|
|
397
|
+
agentId: agent?.id ?? null,
|
|
398
|
+
toolCount: names.length,
|
|
399
|
+
hasTeam: names.includes('team'),
|
|
400
|
+
names: names.slice(0, 40),
|
|
401
|
+
});
|
|
402
|
+
} catch (error) {
|
|
403
|
+
diag.append({ ev: 'agent.created.probe.fail', error: error?.message ?? String(error) });
|
|
404
|
+
}
|
|
405
|
+
})
|
|
406
|
+
: () => {};
|
|
384
407
|
const offSessionEvent = typeof ctx.on === 'function'
|
|
385
408
|
? ctx.on('session/event', async (session, event) => {
|
|
409
|
+
// 成员输出探针:直接观察成员回合产出了什么(判定「成员是否真的在
|
|
410
|
+
// 工作 / 是否调用工具」的唯一插件侧可见通道)。
|
|
411
|
+
try {
|
|
412
|
+
if (booted !== null && event?.type === 'assistant/message' && runtimeForAgent(session?.id) !== null) {
|
|
413
|
+
const content = event?.data?.message?.content ?? [];
|
|
414
|
+
const text = (Array.isArray(content) ? content : [])
|
|
415
|
+
.map((block) => (typeof block === 'string' ? block : block?.text ?? ``))
|
|
416
|
+
.filter(Boolean)
|
|
417
|
+
.join('\n');
|
|
418
|
+
diag.append({
|
|
419
|
+
ev: 'member.output.probe.fail',
|
|
420
|
+
sessionId: session?.id ?? null,
|
|
421
|
+
chars: text.length,
|
|
422
|
+
preview: text.slice(0, 240),
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
} catch (probeError) {
|
|
426
|
+
diag.append({ ev: 'member.output.probe.fail', error: probeError?.message ?? String(probeError) });
|
|
427
|
+
}
|
|
386
428
|
if (booted === null || event?.type !== 'turn/end') return;
|
|
387
429
|
const eventRuntime = runtimeForAgent(session?.id);
|
|
388
430
|
const member = eventRuntime === null ? undefined : Object.values(eventRuntime.service.state.members ?? {})
|
|
@@ -1946,6 +1988,7 @@ export function apply(ctx, config = {}) {
|
|
|
1946
1988
|
try { disposeSkillOpt(); } catch { /* already disposed */ }
|
|
1947
1989
|
offRequestError();
|
|
1948
1990
|
offSessionEvent();
|
|
1991
|
+
offAgentCreated();
|
|
1949
1992
|
disposeTool();
|
|
1950
1993
|
dispose();
|
|
1951
1994
|
for (const runtime of booted?.runtimes?.values() ?? []) {
|
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.24",
|
|
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",
|