This commit is contained in:
decolua
2026-06-15 18:18:04 +07:00
parent 8ab5af0052
commit b282f05549
66 changed files with 2328 additions and 213 deletions

View File

@@ -40,8 +40,11 @@ export function cloakClaudeTools(body) {
const clientToolNames = new Set();
const clientDeclarations = [];
// All client tools get renamed with suffix
// All client tools get renamed with suffix.
// Built-in server tools (web_search_20250305, etc.) carry a `type` and require
// an exact reserved `name` — never suffix those or Claude rejects the request.
for (const tool of tools) {
if (tool.type) { clientDeclarations.push(tool); continue; }
const suffixed = suffix(tool.name);
toolNameMap.set(suffixed, tool.name);
clientToolNames.add(tool.name);

View File

@@ -128,7 +128,10 @@ export function createDisconnectAwareStream(transformStream, streamController, o
controller.enqueue(value);
} catch (error) {
const wasConnected = streamController.isConnected();
streamController.handleError(error);
// Controller already closed = downstream ended; not an upstream error, skip noisy log.
const msg0 = error?.message || "";
const isControllerClosed = msg0.includes("already closed") || msg0.includes("Invalid state");
if (!isControllerClosed) streamController.handleError(error);
reader.cancel().catch(() => {});
writer.abort().catch(() => {});