@suifei/dsh-ai-team 0.4.82 → 0.4.84
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 +118 -9
- package/lib/runtime/subagent-provider.js +65 -0
- package/lib/runtime/wake-failure.js +42 -22
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -49,10 +49,11 @@ import { buildModelCatalog, buildModelEfforts } from './lib/host/model-catalog.j
|
|
|
49
49
|
import { createTeamTool } from './lib/host/member-tools.js';
|
|
50
50
|
import { describeTaskContext, describeWake, planWakes } from './lib/host/waker.js';
|
|
51
51
|
import { describeCauseChain } from './lib/runtime/error-chain.js';
|
|
52
|
-
import { classifyWakeFailure } from './lib/runtime/wake-failure.js';
|
|
52
|
+
import { classifyWakeFailure, isMalformedTurnError } from './lib/runtime/wake-failure.js';
|
|
53
53
|
import { registerShellGuard } from './lib/runtime/shell-guard.js';
|
|
54
54
|
import { createActivationBudget } from './lib/runtime/activation-budget.js';
|
|
55
55
|
import { blocksActivation, probeProviderRegistration } from './lib/runtime/subagent-probe.js';
|
|
56
|
+
import { isRuntimeUnavailableFailure, resolveSubagentProviderName } from './lib/runtime/subagent-provider.js';
|
|
56
57
|
import { aggregatePeople } from './lib/host/people-view.js';
|
|
57
58
|
import { riskView } from './lib/host/risk-view.js';
|
|
58
59
|
import { weeklyView } from './lib/host/weekly-view.js';
|
|
@@ -101,6 +102,8 @@ export const Config = z.object({
|
|
|
101
102
|
skilloptJudgeVotes: z.number().step(1).min(3).max(9).default(3),
|
|
102
103
|
// 初装默认项目与「新建项目」对话框的默认工作目录;留空则取宿主 cwd(见 boot)。
|
|
103
104
|
defaultWorkspace: z.string().default(''),
|
|
105
|
+
// 启动成员会话用的 subagent provider 名;留空按宿主实际注册的自动解析(默认 spawn)。
|
|
106
|
+
subagentProviderName: z.string().default('spawn'),
|
|
104
107
|
// 同一成员 30 分钟内允许的自动重建次数(失败→自愈→再失败的死循环闸门)。
|
|
105
108
|
autoReseatLimitPer30Min: z.number().step(1).min(1).max(100).default(6),
|
|
106
109
|
// 成员 shell 风险守卫:'warn' 只记诊断(默认),'block' 直接拒绝,'off' 不介入。
|
|
@@ -448,7 +451,12 @@ export function apply(ctx, config = {}) {
|
|
|
448
451
|
// 强制重建,让升级本身就把卡住的成员救回来。
|
|
449
452
|
for (const runtime of value.runtimes.values()) {
|
|
450
453
|
for (const member of Object.values(runtime.service.state.members ?? {})) {
|
|
451
|
-
if (member.kind !== 'agent'
|
|
454
|
+
if (member.kind !== 'agent') continue;
|
|
455
|
+
// 两种「该重建」:路由过期(配置换了 provider/model),或上次失败是运行时/提供方
|
|
456
|
+
// 不可用(rc.2 没有 list() 时激活全挂在 E_RUNTIME_UNAVAILABLE,成员进了 failed,
|
|
457
|
+
// 而 waker 不再唤醒 failed —— 不在这里救就永远醒不过来)。
|
|
458
|
+
const runtimeUnavailable = isRuntimeUnavailableFailure(member);
|
|
459
|
+
if (member.routeStale !== true && runtimeUnavailable !== true) continue;
|
|
452
460
|
if (member.status === 'retired') continue;
|
|
453
461
|
const budget = activationBudget.take(member.id);
|
|
454
462
|
if (budget.allowed !== true) {
|
|
@@ -459,7 +467,9 @@ export function apply(ctx, config = {}) {
|
|
|
459
467
|
payload: {
|
|
460
468
|
memberId: member.id,
|
|
461
469
|
force: true,
|
|
462
|
-
prompt:
|
|
470
|
+
prompt: runtimeUnavailable && member.routeStale !== true
|
|
471
|
+
? '运行时已恢复(此前因 subagent provider 不可用而中断)。先读 tasks 与 thread 的当前状态,继续未完成的工作,不要重复已完成的事。'
|
|
472
|
+
: '模型/提供方已切换,会话按新路由重建。先读 tasks 与 thread 的当前状态,继续未完成的工作,不要重复已完成的事。',
|
|
463
473
|
},
|
|
464
474
|
}, runtime).then((result) => {
|
|
465
475
|
diag.append({
|
|
@@ -672,6 +682,11 @@ export function apply(ctx, config = {}) {
|
|
|
672
682
|
});
|
|
673
683
|
// blocked 最常见的原因是归档 gate:立刻复核一次血缘归档状态。
|
|
674
684
|
if (endKind === 'blocked') void repairArchivedHosts();
|
|
685
|
+
// 工具参数在传输中截断(MALFORMED_RESPONSE):那次调用没有执行,成员
|
|
686
|
+
// 停在半路。重发一次通常就好,交给带预算的续跑(见 retryMalformedTurn)。
|
|
687
|
+
if (endKind === 'error' && isMalformedTurnError(event?.data?.reason)) {
|
|
688
|
+
void retryMalformedTurn(eventRuntime, member);
|
|
689
|
+
}
|
|
675
690
|
return;
|
|
676
691
|
}
|
|
677
692
|
if (member.lastFailure === undefined || member.lastFailure === null) return;
|
|
@@ -733,6 +748,67 @@ export function apply(ctx, config = {}) {
|
|
|
733
748
|
const projectWorkspace = (projectRuntime, member) => member?.workspace
|
|
734
749
|
|| projectRuntime?.service?.state?.projects?.[projectRuntime.id]?.workspacePath
|
|
735
750
|
|| null;
|
|
751
|
+
// 工具参数截断的续跑预算:与「会话重建」分开计数——重建会丢上下文,
|
|
752
|
+
// 续跑只是重发一条消息,成本低但也不能无限。
|
|
753
|
+
const malformedRetries = createActivationBudget({ limit: 3, windowMs: 10 * 60 * 1000 });
|
|
754
|
+
const retryMalformedTurn = async (projectRuntime, member) => {
|
|
755
|
+
try {
|
|
756
|
+
const project = projectRuntime?.service?.state?.projects?.[projectRuntime.id];
|
|
757
|
+
if (project !== undefined && project.runState === 'stopped') return;
|
|
758
|
+
const budget = malformedRetries.take(member.id);
|
|
759
|
+
if (budget.allowed !== true) {
|
|
760
|
+
diag.append({
|
|
761
|
+
ev: 'member.malformed.retry.suppressed.fail',
|
|
762
|
+
projectId: projectRuntime?.id ?? null,
|
|
763
|
+
memberId: member.id,
|
|
764
|
+
count: budget.count,
|
|
765
|
+
limit: budget.limit,
|
|
766
|
+
windowMs: budget.windowMs,
|
|
767
|
+
});
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
const cwd = projectWorkspace(projectRuntime, member);
|
|
771
|
+
if (typeof cwd !== 'string' || cwd === '') return;
|
|
772
|
+
const parentInfo = await ensureParent();
|
|
773
|
+
if (parentInfo?.agent === undefined) return;
|
|
774
|
+
const subagents = serviceOf(ctx, 'subagents');
|
|
775
|
+
const sessionRuntime = new MemberRuntime({
|
|
776
|
+
subagents,
|
|
777
|
+
sessions: serviceOf(ctx, 'sessions'),
|
|
778
|
+
permissionPresets: serviceOf(ctx, 'permissionPresets'),
|
|
779
|
+
sandboxPolicy: serviceOf(ctx, 'sandboxPolicy'),
|
|
780
|
+
agents: serviceOf(ctx, 'agents'),
|
|
781
|
+
agentPresets: serviceOf(ctx, 'agentPresets'),
|
|
782
|
+
direct: false,
|
|
783
|
+
parent: parentInfo.agent,
|
|
784
|
+
provider: resolveSubagentProviderName(subagents, config?.subagentProviderName),
|
|
785
|
+
preset: 'standard',
|
|
786
|
+
cwd,
|
|
787
|
+
trackHandle: (sessionId, handle) => resumedHandles.set(sessionId, handle),
|
|
788
|
+
});
|
|
789
|
+
const delivered = await sessionRuntime.wake(member, {
|
|
790
|
+
prompt: [
|
|
791
|
+
'上一轮你发起的工具调用在传输中被截断(Unexpected end of JSON input),那次调用没有执行。',
|
|
792
|
+
'请重新发起同一次调用:参数写成一行紧凑 JSON,不要在参数里展开大段文本;',
|
|
793
|
+
'需要写长内容时改用更短的措辞,或先落盘再引用路径。',
|
|
794
|
+
].join(''),
|
|
795
|
+
});
|
|
796
|
+
diag.append({
|
|
797
|
+
ev: 'member.malformed.retry',
|
|
798
|
+
projectId: projectRuntime?.id ?? null,
|
|
799
|
+
memberId: member.id,
|
|
800
|
+
attempt: budget.count,
|
|
801
|
+
messageId: delivered?.messageId ?? null,
|
|
802
|
+
});
|
|
803
|
+
} catch (error) {
|
|
804
|
+
diag.append({
|
|
805
|
+
ev: 'member.malformed.retry.fail',
|
|
806
|
+
projectId: projectRuntime?.id ?? null,
|
|
807
|
+
memberId: member?.id ?? null,
|
|
808
|
+
message: error?.message ?? String(error),
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
};
|
|
736
812
|
const wakeFromResult = async (projectRuntime, result, actor = {}) => {
|
|
737
813
|
if (projectRuntime === null || projectRuntime === undefined) return;
|
|
738
814
|
// P6 停止门(事件 hook 侧):stopped 项目停止**自动派发**;Human
|
|
@@ -837,7 +913,7 @@ export function apply(ctx, config = {}) {
|
|
|
837
913
|
agentPresets: serviceOf(ctx, 'agentPresets'),
|
|
838
914
|
direct: false,
|
|
839
915
|
parent: parentInfo.agent,
|
|
840
|
-
provider: (serviceOf(ctx, 'subagents')?.
|
|
916
|
+
provider: resolveSubagentProviderName(serviceOf(ctx, 'subagents'), config?.subagentProviderName),
|
|
841
917
|
preset: 'standard',
|
|
842
918
|
cwd,
|
|
843
919
|
trackHandle: (sessionId, handle) => resumedHandles.set(sessionId, handle),
|
|
@@ -989,7 +1065,7 @@ export function apply(ctx, config = {}) {
|
|
|
989
1065
|
projectDir: projectRuntime.dir,
|
|
990
1066
|
deps: {
|
|
991
1067
|
now: () => Date.now(),
|
|
992
|
-
provider: (serviceOf(ctx, 'subagents')?.
|
|
1068
|
+
provider: resolveSubagentProviderName(serviceOf(ctx, 'subagents'), config?.subagentProviderName),
|
|
993
1069
|
// parent 惰性解析:仅启动 judge 子代理时需要;generating 阶段
|
|
994
1070
|
// 不依赖 agents 服务,避免 tick 阶段服务不可用时整块失败。
|
|
995
1071
|
ensureParent: () => ensureParent(),
|
|
@@ -1463,7 +1539,7 @@ export function apply(ctx, config = {}) {
|
|
|
1463
1539
|
projectDir: jobRoot,
|
|
1464
1540
|
deps: {
|
|
1465
1541
|
now: () => Date.now(),
|
|
1466
|
-
provider: (serviceOf(ctx, 'subagents')?.
|
|
1542
|
+
provider: resolveSubagentProviderName(serviceOf(ctx, 'subagents'), config?.subagentProviderName),
|
|
1467
1543
|
ensureParent: () => ensureParent(),
|
|
1468
1544
|
votes: config.skilloptJudgeVotes ?? 3,
|
|
1469
1545
|
startChild: async (label, spec) => {
|
|
@@ -1861,7 +1937,7 @@ export function apply(ctx, config = {}) {
|
|
|
1861
1937
|
agentPresets: serviceOf(ctx, 'agentPresets'),
|
|
1862
1938
|
direct: false,
|
|
1863
1939
|
parent: parentInfo.agent,
|
|
1864
|
-
provider: (serviceOf(ctx, 'subagents')?.
|
|
1940
|
+
provider: resolveSubagentProviderName(serviceOf(ctx, 'subagents'), config?.subagentProviderName),
|
|
1865
1941
|
preset: 'standard',
|
|
1866
1942
|
cwd: effectiveDir,
|
|
1867
1943
|
trackHandle: (sessionId, handle) => resumedHandles.set(sessionId, handle),
|
|
@@ -2101,7 +2177,40 @@ export function apply(ctx, config = {}) {
|
|
|
2101
2177
|
return send(res, { ok: true, people });
|
|
2102
2178
|
}
|
|
2103
2179
|
// R-17 绑定:把一个名字并到某个 personId(Human 在人员池显式确认)。
|
|
2104
|
-
|
|
2180
|
+
// 批量恢复入口:把「因运行时/提供方不可用而 failed」的成员按新运行时重建。
|
|
2181
|
+
// 这类失败与任务无关,但 failed 成员被 waker 排除,不手动救就永远醒不过来
|
|
2182
|
+
// (实机:rc.2 那次激活全挂,6 个成员一起变 failed)。
|
|
2183
|
+
if (req.method === 'POST' && url.pathname === '/ai-team/api/members/retry') {
|
|
2184
|
+
const body = await readJson(req);
|
|
2185
|
+
const includeAll = body?.all === true;
|
|
2186
|
+
const runtimeEntries = [...(booted?.runtimes?.values() ?? [])];
|
|
2187
|
+
const revived = [];
|
|
2188
|
+
const skipped = [];
|
|
2189
|
+
for (const runtime of runtimeEntries) {
|
|
2190
|
+
for (const member of Object.values(runtime.service.state.members ?? {})) {
|
|
2191
|
+
if (member.kind !== 'agent' || member.status === 'retired') continue;
|
|
2192
|
+
const eligible = includeAll ? member.status === 'failed' : isRuntimeUnavailableFailure(member);
|
|
2193
|
+
if (eligible !== true) continue;
|
|
2194
|
+
if (member.status === 'running') { skipped.push({ memberId: member.id, reason: 'running' }); continue; }
|
|
2195
|
+
const budget = activationBudget.take(member.id);
|
|
2196
|
+
if (budget.allowed !== true) {
|
|
2197
|
+
skipped.push({ memberId: member.id, reason: 'budget' });
|
|
2198
|
+
continue;
|
|
2199
|
+
}
|
|
2200
|
+
const result = await activateMember({
|
|
2201
|
+
payload: {
|
|
2202
|
+
memberId: member.id,
|
|
2203
|
+
force: true,
|
|
2204
|
+
prompt: '运行时已恢复,会话已重建。先读 tasks 与 thread 的当前状态,继续未完成的工作,不要重复已完成的事。',
|
|
2205
|
+
},
|
|
2206
|
+
}, runtime);
|
|
2207
|
+
if (result?.error === undefined) revived.push(member.id);
|
|
2208
|
+
else skipped.push({ memberId: member.id, reason: result.error.code ?? 'error' });
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
diag?.append({ ev: 'member.retry.batch', revived: revived.length, skipped: skipped.length, all: includeAll });
|
|
2212
|
+
return send(res, { ok: true, revived, skipped });
|
|
2213
|
+
} if (req.method === 'POST' && url.pathname === '/ai-team/api/people-aliases') {
|
|
2105
2214
|
const body = await readJson(req);
|
|
2106
2215
|
const memberName = typeof body?.name === 'string' ? body.name.trim() : '';
|
|
2107
2216
|
const personId = typeof body?.personId === 'string' ? body.personId.trim() : '';
|
|
@@ -2691,4 +2800,4 @@ export function apply(ctx, config = {}) {
|
|
|
2691
2800
|
return Promise.allSettled(cleanup).then(() => undefined);
|
|
2692
2801
|
};
|
|
2693
2802
|
}, 'ai-team: workbench routes');
|
|
2694
|
-
}
|
|
2803
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 解析「用哪个 subagent provider 启动成员会话」。
|
|
3
|
+
*
|
|
4
|
+
* 实机事故(issue #1 借楼,DSH 0.2.2-rc.2):`SubagentRuntime` 没有 `list()`,而插件
|
|
5
|
+
* 用 `(subagents.list?.() ?? [])[0]` 取名字,拿到 `undefined`,`MemberRuntime.activate`
|
|
6
|
+
* 直接判 `E_RUNTIME_UNAVAILABLE: no subagent provider or parent Agent is available`。
|
|
7
|
+
* 0.4.79 只修了「判空→503」那一处探测,这五处取值仍在,于是激活全挂。
|
|
8
|
+
*
|
|
9
|
+
* 规则:先信配置,再信 `list()`(rc.1 及更早),最后用 `getProvider()` 验证候选名
|
|
10
|
+
* (rc.2 起只剩这个方法),默认候选是 dsh-base 里注册的 `spawn`。
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const DEFAULT_SUBAGENT_PROVIDER = 'spawn';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {any} subagents `ctx.subagents`
|
|
17
|
+
* @param {string} [preferred] 配置里的首选 provider 名
|
|
18
|
+
* @returns {string|undefined}
|
|
19
|
+
*/
|
|
20
|
+
export function resolveSubagentProviderName(subagents, preferred) {
|
|
21
|
+
if (subagents === undefined || subagents === null) return undefined;
|
|
22
|
+
const candidates = [];
|
|
23
|
+
if (typeof preferred === 'string' && preferred.trim() !== '') candidates.push(preferred.trim());
|
|
24
|
+
|
|
25
|
+
let enumerable = null;
|
|
26
|
+
if (typeof subagents.list === 'function') {
|
|
27
|
+
try {
|
|
28
|
+
const names = subagents.list();
|
|
29
|
+
if (Array.isArray(names) && names.length > 0) {
|
|
30
|
+
enumerable = names.filter((name) => typeof name === 'string' && name !== '');
|
|
31
|
+
candidates.push(...enumerable);
|
|
32
|
+
}
|
|
33
|
+
} catch {
|
|
34
|
+
// list() 存在但抛错:当作枚举不到,继续用候选名验证。
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// `spawn` 是 dsh-base 的默认在进程内 provider;枚举不到时它是唯一可靠的猜测。
|
|
39
|
+
candidates.push(DEFAULT_SUBAGENT_PROVIDER);
|
|
40
|
+
|
|
41
|
+
const unique = [...new Set(candidates)];
|
|
42
|
+
// 没有 getProvider 说明宿主连验证手段都没给:退回「首选或 spawn」,让
|
|
43
|
+
// startActivation 去报真实错误,而不是在这里武断失败。
|
|
44
|
+
if (typeof subagents.getProvider !== 'function') return unique[0];
|
|
45
|
+
for (const name of unique) {
|
|
46
|
+
try {
|
|
47
|
+
if (subagents.getProvider(name) !== undefined) return name;
|
|
48
|
+
} catch {
|
|
49
|
+
// 单个候选查询失败不影响其它候选。
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 成员是否因「运行时/提供方不可用」失败——这类失败与任务无关,运行时恢复后应当自动重试。
|
|
57
|
+
* @param {{status?: string, lastFailure?: {message?: string|null, category?: string}|null}} member
|
|
58
|
+
*/
|
|
59
|
+
export function isRuntimeUnavailableFailure(member) {
|
|
60
|
+
if (member === null || typeof member !== 'object' || member.status !== 'failed') return false;
|
|
61
|
+
const failure = member.lastFailure;
|
|
62
|
+
if (failure === null || typeof failure !== 'object') return false;
|
|
63
|
+
const text = `${failure.category ?? ''} ${failure.message ?? ''}`;
|
|
64
|
+
return /E_RUNTIME_UNAVAILABLE|no subagent provider|no subagent provider or parent Agent/i.test(text);
|
|
65
|
+
}
|
|
@@ -1,22 +1,42 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 唤醒失败的归类。
|
|
3
|
-
*
|
|
4
|
-
* 实机根因(2026-11-12 确诊):成员回合结束后会话仍被一个活跃写句柄占用,
|
|
5
|
-
* `sessionQuery.observeSession` 拒绝发放读租约,冷恢复必然失败:
|
|
6
|
-
*
|
|
7
|
-
* subagent "X" is unavailable
|
|
8
|
-
* cause: session "X" is already owned by an active write handle
|
|
9
|
-
*
|
|
10
|
-
* 插件无法释放这个租约(属 Harness 侧的句柄泄漏),只能重建会话。这类失败是
|
|
11
|
-
* **可预期的**,不应按未知故障刷告警;其它原因仍然算真实失败。
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const BUSY_HANDLE = /active write handle/i;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @param {string|null|undefined} causeChain `describeCauseChain()` 的输出
|
|
18
|
-
* @returns {'wake.session-busy'|'wake.fail'} busy 表示「写租约被占用,必然需要重建」
|
|
19
|
-
*/
|
|
20
|
-
export function classifyWakeFailure(causeChain) {
|
|
21
|
-
return typeof causeChain === 'string' && BUSY_HANDLE.test(causeChain) ? 'wake.session-busy' : 'wake.fail';
|
|
22
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 唤醒失败的归类。
|
|
3
|
+
*
|
|
4
|
+
* 实机根因(2026-11-12 确诊):成员回合结束后会话仍被一个活跃写句柄占用,
|
|
5
|
+
* `sessionQuery.observeSession` 拒绝发放读租约,冷恢复必然失败:
|
|
6
|
+
*
|
|
7
|
+
* subagent "X" is unavailable
|
|
8
|
+
* cause: session "X" is already owned by an active write handle
|
|
9
|
+
*
|
|
10
|
+
* 插件无法释放这个租约(属 Harness 侧的句柄泄漏),只能重建会话。这类失败是
|
|
11
|
+
* **可预期的**,不应按未知故障刷告警;其它原因仍然算真实失败。
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const BUSY_HANDLE = /active write handle/i;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {string|null|undefined} causeChain `describeCauseChain()` 的输出
|
|
18
|
+
* @returns {'wake.session-busy'|'wake.fail'} busy 表示「写租约被占用,必然需要重建」
|
|
19
|
+
*/
|
|
20
|
+
export function classifyWakeFailure(causeChain) {
|
|
21
|
+
return typeof causeChain === 'string' && BUSY_HANDLE.test(causeChain) ? 'wake.session-busy' : 'wake.fail';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 回合是否因「工具参数在传输中截断」而失败。
|
|
26
|
+
*
|
|
27
|
+
* 实机(2026-11-13):成员在第 4 步发起的 `team` 调用只到
|
|
28
|
+
* `{"action": "tasks", "qaChecklist": ` 就断了,宿主解析不出 JSON,整轮以
|
|
29
|
+
* `MALFORMED_RESPONSE` 结束——工具没执行、成员也没被唤醒,任务停在半路。
|
|
30
|
+
* 这类失败是**传输/采样**造成的,与任务本身无关:重发一次通常就好,所以值得
|
|
31
|
+
* 自动续跑一次(预算见调用方),而不是让成员静默停摆。
|
|
32
|
+
*
|
|
33
|
+
* @param {{kind?: string, error?: {code?: string, message?: string}}|null|undefined} reason `turn/end` 的 reason
|
|
34
|
+
* @returns {boolean}
|
|
35
|
+
*/
|
|
36
|
+
export function isMalformedTurnError(reason) {
|
|
37
|
+
if (reason === null || typeof reason !== 'object' || reason.kind !== 'error') return false;
|
|
38
|
+
const error = reason.error;
|
|
39
|
+
if (error === null || typeof error !== 'object') return false;
|
|
40
|
+
if (String(error.code ?? '').toUpperCase() === 'MALFORMED_RESPONSE') return true;
|
|
41
|
+
return /unexpected end of json input/i.test(String(error.message ?? ''));
|
|
42
|
+
}
|
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.84",
|
|
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",
|