devez-vibe 1.9.36 → 1.9.38
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/bin/dvz.exe +0 -0
- package/bridge/claude-agent-sdk-bridge.mjs +27 -65
- package/package.json +1 -1
package/bin/dvz.exe
CHANGED
|
Binary file
|
|
@@ -1485,41 +1485,11 @@ async function createSession(params, resumeId) {
|
|
|
1485
1485
|
session.model = visibleModel(capabilities.value);
|
|
1486
1486
|
}
|
|
1487
1487
|
session.effort = supportedEffort(capabilities, params.effort);
|
|
1488
|
-
watchMcpStartup(session);
|
|
1489
1488
|
const account = initialization.account || await safeAccount(agentQuery);
|
|
1490
1489
|
const usage = await safeUsage(agentQuery);
|
|
1491
1490
|
return { session, initialization, account, usage };
|
|
1492
1491
|
}
|
|
1493
1492
|
|
|
1494
|
-
// Claude connects MCP servers in the background and reports a failure only
|
|
1495
|
-
// through mcpServerStatus(). Once nothing is pending, each failed or signed-out
|
|
1496
|
-
// server goes to the host as Codex's startup notification, so both providers
|
|
1497
|
-
// warn the same way. The first look waits a second so the host already knows
|
|
1498
|
-
// this thread when the notice arrives.
|
|
1499
|
-
async function watchMcpStartup(session, attempts = 30, delay = 1000) {
|
|
1500
|
-
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
1501
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1502
|
-
if (sessions.get(session.id) !== session) return;
|
|
1503
|
-
let statuses;
|
|
1504
|
-
try { statuses = await session.query.mcpServerStatus(); } catch { return; }
|
|
1505
|
-
if (!Array.isArray(statuses)) return;
|
|
1506
|
-
if (statuses.some((server) => server?.status === "pending")) continue;
|
|
1507
|
-
for (const server of statuses) {
|
|
1508
|
-
if (server?.status !== "failed" && server?.status !== "needs-auth") continue;
|
|
1509
|
-
const source = server.source || server.scope;
|
|
1510
|
-
notify("mcpServer/startupStatus/updated", {
|
|
1511
|
-
threadId: session.id,
|
|
1512
|
-
name: String(server.name || "MCP"),
|
|
1513
|
-
status: "failed",
|
|
1514
|
-
...(server.status === "needs-auth" ? { failureReason: "authenticationRequired" } : {}),
|
|
1515
|
-
...(server.error ? { error: String(server.error) } : {}),
|
|
1516
|
-
...(source ? { source: String(source) } : {}),
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
return;
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
1493
|
async function safeAccount(agentQuery) {
|
|
1524
1494
|
try { return await agentQuery.accountInfo(); } catch { return null; }
|
|
1525
1495
|
}
|
|
@@ -2865,7 +2835,12 @@ async function processResult(session, message) {
|
|
|
2865
2835
|
const detail = message.errors?.join("\n") || message.result || message.stop_reason || "Claude 실행 실패";
|
|
2866
2836
|
const guide = STARTUP_FAILURE_GUIDES[message.startup_failure_reason];
|
|
2867
2837
|
let error = message.is_error && !interrupted
|
|
2868
|
-
? {
|
|
2838
|
+
? {
|
|
2839
|
+
message: guide ? `${guide}\n${detail}` : detail,
|
|
2840
|
+
// An expired login gets the host's sign-in guide instead of the raw
|
|
2841
|
+
// `API Error: 401 {...}`; Codex tags the same failure `unauthorized`.
|
|
2842
|
+
...(session.turn?.assistantError === "authentication_failed" ? { codexErrorInfo: "unauthorized" } : {}),
|
|
2843
|
+
}
|
|
2869
2844
|
: null;
|
|
2870
2845
|
if (!error && !interrupted) {
|
|
2871
2846
|
const outcome = abnormalStopOutcome(message.stop_reason);
|
|
@@ -2965,7 +2940,12 @@ function finishTurn(session, error, durationMs) {
|
|
|
2965
2940
|
clearForegroundSubagents(session);
|
|
2966
2941
|
const turn = { id: session.turn.id, status: error ? "failed" : session.turn.interruptRequested ? "interrupted" : "completed" };
|
|
2967
2942
|
if (turn.status === "completed") completeLingeringTasks(session, Date.now());
|
|
2968
|
-
if (error)
|
|
2943
|
+
if (error) {
|
|
2944
|
+
turn.error = {
|
|
2945
|
+
message: error instanceof Error ? error.message : error.message || String(error),
|
|
2946
|
+
...(error.codexErrorInfo ? { codexErrorInfo: error.codexErrorInfo } : {}),
|
|
2947
|
+
};
|
|
2948
|
+
}
|
|
2969
2949
|
if (durationMs != null) turn.durationMs = durationMs;
|
|
2970
2950
|
notify("turn/completed", { threadId: session.id, turn });
|
|
2971
2951
|
session.turn = null;
|
|
@@ -4282,39 +4262,6 @@ async function runSelfTest() {
|
|
|
4282
4262
|
if (reconnected.join(",") !== "connected,disabled") {
|
|
4283
4263
|
throw new Error(`Claude MCP reconnect self-test failed: ${reconnected.join(",")}`);
|
|
4284
4264
|
}
|
|
4285
|
-
// Startup failures wait out pending servers, then go out once each.
|
|
4286
|
-
const startupPolls = [
|
|
4287
|
-
[{ name: "slow", status: "pending" }],
|
|
4288
|
-
[
|
|
4289
|
-
{ name: "ok", status: "connected" },
|
|
4290
|
-
{ name: "broken", status: "failed", error: "HTTP 401: token_expired" },
|
|
4291
|
-
{ name: "claude.ai Notion", status: "needs-auth", scope: "claudeai" },
|
|
4292
|
-
],
|
|
4293
|
-
];
|
|
4294
|
-
const startupSession = {
|
|
4295
|
-
id: "mcp-startup-self-test",
|
|
4296
|
-
query: { mcpServerStatus: async () => startupPolls.shift() || [] },
|
|
4297
|
-
};
|
|
4298
|
-
sessions.set(startupSession.id, startupSession);
|
|
4299
|
-
const startupNotices = [];
|
|
4300
|
-
const startupWrite = process.stdout.write;
|
|
4301
|
-
process.stdout.write = (chunk) => { startupNotices.push(JSON.parse(String(chunk))); return true; };
|
|
4302
|
-
try {
|
|
4303
|
-
await watchMcpStartup(startupSession, 3, 0);
|
|
4304
|
-
} finally {
|
|
4305
|
-
process.stdout.write = startupWrite;
|
|
4306
|
-
sessions.delete(startupSession.id);
|
|
4307
|
-
}
|
|
4308
|
-
const startupNames = startupNotices.map((notice) => notice.params?.name).join(",");
|
|
4309
|
-
if (startupNames !== "broken,claude.ai Notion"
|
|
4310
|
-
|| startupNotices.some((notice) => notice.method !== "mcpServer/startupStatus/updated"
|
|
4311
|
-
|| notice.params?.threadId !== startupSession.id
|
|
4312
|
-
|| notice.params?.status !== "failed")
|
|
4313
|
-
|| startupNotices[0].params.error !== "HTTP 401: token_expired"
|
|
4314
|
-
|| startupNotices[1].params.failureReason !== "authenticationRequired"
|
|
4315
|
-
|| startupNotices[1].params.source !== "claudeai") {
|
|
4316
|
-
throw new Error(`Claude MCP startup self-test failed: ${JSON.stringify(startupNotices)}`);
|
|
4317
|
-
}
|
|
4318
4265
|
const user = (uuid, text) => ({
|
|
4319
4266
|
type: "user",
|
|
4320
4267
|
uuid,
|
|
@@ -4869,6 +4816,21 @@ async function runSelfTest() {
|
|
|
4869
4816
|
await consumeMessage(limitSession, { type: "assistant", error: "server_error", message: { content: [] } });
|
|
4870
4817
|
await consumeMessage(limitSession, failedResult);
|
|
4871
4818
|
if (limitSession.usageLimitWait) throw new Error("Unrelated server error started a usage wait");
|
|
4819
|
+
// An expired login reaches the host tagged like Codex's `unauthorized`.
|
|
4820
|
+
const authNotices = [];
|
|
4821
|
+
const authWrite = process.stdout.write;
|
|
4822
|
+
process.stdout.write = (chunk) => { authNotices.push(JSON.parse(String(chunk))); return true; };
|
|
4823
|
+
try {
|
|
4824
|
+
beginTurn(limitSession);
|
|
4825
|
+
await consumeMessage(limitSession, { type: "assistant", error: "authentication_failed", message: { content: [] } });
|
|
4826
|
+
await consumeMessage(limitSession, { ...failedResult, errors: ["API Error: 401 {\"type\":\"error\"}"] });
|
|
4827
|
+
} finally {
|
|
4828
|
+
process.stdout.write = authWrite;
|
|
4829
|
+
}
|
|
4830
|
+
const authTurn = authNotices.find((notice) => notice.method === "turn/completed")?.params?.turn;
|
|
4831
|
+
if (authTurn?.error?.codexErrorInfo !== "unauthorized" || !authTurn.error.message.includes("401")) {
|
|
4832
|
+
throw new Error(`Claude login failure lost its tag: ${JSON.stringify(authTurn)}`);
|
|
4833
|
+
}
|
|
4872
4834
|
beginTurn(limitSession);
|
|
4873
4835
|
for (let attempt = 0; attempt < 4; attempt++) {
|
|
4874
4836
|
await rejectLimit();
|