ghc-proxy 0.5.7 → 0.5.8

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/dist/main.mjs CHANGED
@@ -2,9 +2,9 @@
2
2
  import { createRequire } from "node:module";
3
3
  import process$1 from "node:process";
4
4
  import { formatWithOptions, parseArgs, promisify } from "node:util";
5
- import path, { sep } from "node:path";
5
+ import path, { join, sep } from "node:path";
6
6
  import * as tty from "node:tty";
7
- import fs from "node:fs/promises";
7
+ import fs, { mkdir, readdir, unlink, writeFile } from "node:fs/promises";
8
8
  import os from "node:os";
9
9
  import { randomUUID } from "node:crypto";
10
10
  import { execFile, execFileSync } from "node:child_process";
@@ -6579,7 +6579,7 @@ const checkUsage = defineCommand({
6579
6579
 
6580
6580
  //#endregion
6581
6581
  //#region src/lib/version.ts
6582
- const VERSION = "0.5.7";
6582
+ const VERSION = "0.5.8";
6583
6583
 
6584
6584
  //#endregion
6585
6585
  //#region src/debug.ts
@@ -18538,7 +18538,7 @@ var require_snapshot_utils = /* @__PURE__ */ __commonJSMin$1(((exports, module)
18538
18538
  //#endregion
18539
18539
  //#region node_modules/undici/lib/mock/snapshot-recorder.js
18540
18540
  var require_snapshot_recorder = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
18541
- const { writeFile, readFile, mkdir } = __require$1("node:fs/promises");
18541
+ const { writeFile: writeFile$1, readFile, mkdir: mkdir$1 } = __require$1("node:fs/promises");
18542
18542
  const { dirname, resolve } = __require$1("node:path");
18543
18543
  const { setTimeout: setTimeout$1, clearTimeout: clearTimeout$1 } = __require$1("node:timers");
18544
18544
  const { InvalidArgumentError, UndiciError } = require_errors();
@@ -18825,12 +18825,12 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJSMin$1(((exports, modul
18825
18825
  const path = filePath || this.#snapshotPath;
18826
18826
  if (!path) throw new InvalidArgumentError("Snapshot path is required");
18827
18827
  const resolvedPath = resolve(path);
18828
- await mkdir(dirname(resolvedPath), { recursive: true });
18828
+ await mkdir$1(dirname(resolvedPath), { recursive: true });
18829
18829
  const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
18830
18830
  hash,
18831
18831
  snapshot
18832
18832
  }));
18833
- await writeFile(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
18833
+ await writeFile$1(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
18834
18834
  }
18835
18835
  /**
18836
18836
  * Clears all recorded snapshots
@@ -47639,8 +47639,11 @@ function normalizeSystemBlocks(system) {
47639
47639
  }];
47640
47640
  }
47641
47641
  function normalizeToolResultContent(block) {
47642
- if (typeof block.content === "string") return [textBlock(block.content)];
47643
- return block.content.map((contentBlock) => {
47642
+ return normalizeToolResultContentValue(block.content);
47643
+ }
47644
+ function normalizeToolResultContentValue(content) {
47645
+ if (typeof content === "string") return [textBlock(content)];
47646
+ return content.map((contentBlock) => {
47644
47647
  switch (contentBlock.type) {
47645
47648
  case "text": return textBlock(contentBlock.text);
47646
47649
  case "image": return imageBlock(contentBlock.source.media_type, contentBlock.source.data);
@@ -47648,6 +47651,15 @@ function normalizeToolResultContent(block) {
47648
47651
  }
47649
47652
  });
47650
47653
  }
47654
+ function normalizeMcpToolResultContent(block) {
47655
+ return normalizeToolResultContentValue(block.content);
47656
+ }
47657
+ function normalizeServerToolResultContent(block) {
47658
+ return [textBlock(typeof block.content === "string" ? block.content : JSON.stringify(block.content) ?? "")];
47659
+ }
47660
+ function describeDocumentBlock(block) {
47661
+ return `[document attachment omitted: ${typeof block.source.type === "string" ? block.source.type : "unknown"}]`;
47662
+ }
47651
47663
  function normalizeMessage(message) {
47652
47664
  if (typeof message.content === "string") return {
47653
47665
  role: message.role,
@@ -47662,7 +47674,13 @@ function normalizeMessage(message) {
47662
47674
  thinking: block.thinking,
47663
47675
  signature: block.signature
47664
47676
  };
47665
- case "tool_use": return {
47677
+ case "redacted_thinking": return {
47678
+ kind: "redacted_thinking",
47679
+ data: block.data
47680
+ };
47681
+ case "tool_use":
47682
+ case "server_tool_use":
47683
+ case "mcp_tool_use": return {
47666
47684
  kind: "tool_use",
47667
47685
  id: block.id,
47668
47686
  name: block.name,
@@ -47674,6 +47692,25 @@ function normalizeMessage(message) {
47674
47692
  content: normalizeToolResultContent(block),
47675
47693
  isError: block.is_error
47676
47694
  };
47695
+ case "mcp_tool_result": return {
47696
+ kind: "tool_result",
47697
+ toolUseId: block.tool_use_id,
47698
+ content: normalizeMcpToolResultContent(block),
47699
+ isError: block.is_error
47700
+ };
47701
+ case "server_tool_result":
47702
+ case "web_search_tool_result":
47703
+ case "web_fetch_tool_result":
47704
+ case "code_execution_tool_result":
47705
+ case "bash_code_execution_tool_result":
47706
+ case "text_editor_code_execution_tool_result":
47707
+ case "tool_search_tool_result": return {
47708
+ kind: "tool_result",
47709
+ toolUseId: block.tool_use_id,
47710
+ content: normalizeServerToolResultContent(block),
47711
+ isError: block.is_error
47712
+ };
47713
+ case "document": return textBlock(describeDocumentBlock(block));
47677
47714
  default: return assertNever(block);
47678
47715
  }
47679
47716
  });
@@ -48038,6 +48075,10 @@ function mapBlocks(response) {
48038
48075
  thinking: block.thinking,
48039
48076
  signature: block.signature
48040
48077
  };
48078
+ case "redacted_thinking": return {
48079
+ type: "redacted_thinking",
48080
+ data: block.data
48081
+ };
48041
48082
  case "tool_use": return {
48042
48083
  type: "tool_use",
48043
48084
  id: block.id,
@@ -48212,6 +48253,10 @@ function toConversationBlock(block) {
48212
48253
  text: block.thinking,
48213
48254
  signature: block.signature
48214
48255
  };
48256
+ case "redacted_thinking": return {
48257
+ kind: "redacted_thinking",
48258
+ data: block.data
48259
+ };
48215
48260
  case "tool_use": return {
48216
48261
  kind: "tool_use",
48217
48262
  id: block.id,
@@ -48260,6 +48305,9 @@ function recordAnthropicRequestIssues(request, context) {
48260
48305
  for (const block of turn.blocks) if (block.kind === "thinking") {
48261
48306
  sawThinking = true;
48262
48307
  if (sawToolUse) sawTextOrThinkingAfterTool = true;
48308
+ } else if (block.kind === "redacted_thinking") {
48309
+ sawThinking = true;
48310
+ if (sawToolUse) sawTextOrThinkingAfterTool = true;
48263
48311
  } else if (block.kind === "text") {
48264
48312
  if (sawToolUse) sawTextOrThinkingAfterTool = true;
48265
48313
  } else if (block.kind === "tool_use") sawToolUse = true;
@@ -48931,12 +48979,30 @@ function estimateContentBlockChars(blocks) {
48931
48979
  case "thinking":
48932
48980
  chars += block.thinking.length;
48933
48981
  break;
48982
+ case "redacted_thinking":
48983
+ chars += block.data.length;
48984
+ break;
48934
48985
  case "tool_use":
48986
+ case "server_tool_use":
48987
+ case "mcp_tool_use":
48935
48988
  chars += JSON.stringify(block.input).length;
48936
48989
  break;
48937
48990
  case "tool_result":
48991
+ case "mcp_tool_result":
48938
48992
  chars += typeof block.content === "string" ? block.content.length : JSON.stringify(block.content ?? "").length;
48939
48993
  break;
48994
+ case "server_tool_result":
48995
+ case "web_search_tool_result":
48996
+ case "web_fetch_tool_result":
48997
+ case "code_execution_tool_result":
48998
+ case "bash_code_execution_tool_result":
48999
+ case "text_editor_code_execution_tool_result":
49000
+ case "tool_search_tool_result":
49001
+ chars += JSON.stringify(block.content ?? "").length;
49002
+ break;
49003
+ case "document":
49004
+ chars += JSON.stringify(block).length;
49005
+ break;
48940
49006
  case "image":
48941
49007
  chars += 1e3;
48942
49008
  break;
@@ -49027,12 +49093,29 @@ const anthropicThinkingBlockSchema = object({
49027
49093
  thinking: string(),
49028
49094
  signature: string().optional()
49029
49095
  }).loose();
49096
+ const anthropicRedactedThinkingBlockSchema = object({
49097
+ type: literal("redacted_thinking"),
49098
+ data: string()
49099
+ }).loose();
49030
49100
  const anthropicToolUseBlockSchema = object({
49031
49101
  type: literal("tool_use"),
49032
49102
  id: string().min(1),
49033
49103
  name: string().min(1),
49034
49104
  input: jsonObjectSchema
49035
49105
  }).loose();
49106
+ const anthropicServerToolUseBlockSchema = object({
49107
+ type: literal("server_tool_use"),
49108
+ id: string().min(1),
49109
+ name: string().min(1),
49110
+ input: jsonObjectSchema
49111
+ }).loose();
49112
+ const anthropicMcpToolUseBlockSchema = object({
49113
+ type: literal("mcp_tool_use"),
49114
+ id: string().min(1),
49115
+ name: string().min(1),
49116
+ input: jsonObjectSchema,
49117
+ server_name: string().min(1)
49118
+ }).loose();
49036
49119
  const anthropicToolResultContentBlockSchema = union([anthropicTextBlockSchema, anthropicImageBlockSchema]);
49037
49120
  const anthropicToolResultBlockSchema = object({
49038
49121
  type: literal("tool_result"),
@@ -49040,12 +49123,39 @@ const anthropicToolResultBlockSchema = object({
49040
49123
  content: union([string(), array(anthropicToolResultContentBlockSchema)]),
49041
49124
  is_error: boolean().optional()
49042
49125
  }).loose();
49126
+ const anthropicMcpToolResultBlockSchema = object({
49127
+ type: literal("mcp_tool_result"),
49128
+ tool_use_id: string().min(1),
49129
+ content: union([string(), array(anthropicToolResultContentBlockSchema)]),
49130
+ is_error: boolean().optional()
49131
+ }).loose();
49132
+ const anthropicServerToolResultBlockSchema = object({
49133
+ type: _enum([
49134
+ "server_tool_result",
49135
+ "web_search_tool_result",
49136
+ "web_fetch_tool_result",
49137
+ "code_execution_tool_result",
49138
+ "bash_code_execution_tool_result",
49139
+ "text_editor_code_execution_tool_result",
49140
+ "tool_search_tool_result"
49141
+ ]),
49142
+ tool_use_id: string().min(1),
49143
+ content: unknown(),
49144
+ is_error: boolean().optional()
49145
+ }).loose();
49146
+ const anthropicDocumentBlockSchema = object({
49147
+ type: literal("document"),
49148
+ source: jsonObjectSchema
49149
+ }).loose();
49043
49150
  const anthropicUserMessageSchema = object({
49044
49151
  role: literal("user"),
49045
49152
  content: union([string(), array(union([
49046
49153
  anthropicTextBlockSchema,
49047
49154
  anthropicImageBlockSchema,
49048
- anthropicToolResultBlockSchema
49155
+ anthropicToolResultBlockSchema,
49156
+ anthropicMcpToolResultBlockSchema,
49157
+ anthropicServerToolResultBlockSchema,
49158
+ anthropicDocumentBlockSchema
49049
49159
  ]))])
49050
49160
  }).loose();
49051
49161
  const anthropicAssistantMessageSchema = object({
@@ -49053,7 +49163,12 @@ const anthropicAssistantMessageSchema = object({
49053
49163
  content: union([string(), array(union([
49054
49164
  anthropicTextBlockSchema,
49055
49165
  anthropicThinkingBlockSchema,
49056
- anthropicToolUseBlockSchema
49166
+ anthropicRedactedThinkingBlockSchema,
49167
+ anthropicToolUseBlockSchema,
49168
+ anthropicServerToolUseBlockSchema,
49169
+ anthropicMcpToolUseBlockSchema,
49170
+ anthropicMcpToolResultBlockSchema,
49171
+ anthropicServerToolResultBlockSchema
49057
49172
  ]))])
49058
49173
  }).loose();
49059
49174
  const anthropicMessageSchema = union([anthropicUserMessageSchema, anthropicAssistantMessageSchema]);
@@ -49912,11 +50027,16 @@ function translateUserMessage(message) {
49912
50027
  const items = [];
49913
50028
  const pendingContent = [];
49914
50029
  for (const block of message.content) {
49915
- if (block.type === "tool_result") {
50030
+ if (block.type === "tool_result" || block.type === "mcp_tool_result") {
49916
50031
  flushPendingContent(pendingContent, items, { role: "user" });
49917
50032
  items.push(createFunctionCallOutput(block));
49918
50033
  continue;
49919
50034
  }
50035
+ if (isServerToolResultBlock(block)) {
50036
+ flushPendingContent(pendingContent, items, { role: "user" });
50037
+ items.push(createServerFunctionCallOutput(block));
50038
+ continue;
50039
+ }
49920
50040
  const converted = translateUserContentBlock(block);
49921
50041
  if (converted) pendingContent.push(converted);
49922
50042
  }
@@ -49930,7 +50050,7 @@ function translateAssistantMessage(message) {
49930
50050
  const items = [];
49931
50051
  const pendingContent = [];
49932
50052
  for (const block of message.content) {
49933
- if (block.type === "tool_use") {
50053
+ if (block.type === "tool_use" || block.type === "server_tool_use" || block.type === "mcp_tool_use") {
49934
50054
  flushPendingContent(pendingContent, items, {
49935
50055
  role: "assistant",
49936
50056
  phase: assistantPhase
@@ -49938,6 +50058,30 @@ function translateAssistantMessage(message) {
49938
50058
  items.push(createFunctionToolCall(block));
49939
50059
  continue;
49940
50060
  }
50061
+ if (block.type === "redacted_thinking") {
50062
+ flushPendingContent(pendingContent, items, {
50063
+ role: "assistant",
50064
+ phase: assistantPhase
50065
+ });
50066
+ items.push(createRedactedReasoningContent(block));
50067
+ continue;
50068
+ }
50069
+ if (block.type === "mcp_tool_result") {
50070
+ flushPendingContent(pendingContent, items, {
50071
+ role: "assistant",
50072
+ phase: assistantPhase
50073
+ });
50074
+ items.push(createFunctionCallOutput(block));
50075
+ continue;
50076
+ }
50077
+ if (isServerToolResultBlock(block)) {
50078
+ flushPendingContent(pendingContent, items, {
50079
+ role: "assistant",
50080
+ phase: assistantPhase
50081
+ });
50082
+ items.push(createServerFunctionCallOutput(block));
50083
+ continue;
50084
+ }
49941
50085
  if (block.type === "thinking" && block.signature) {
49942
50086
  const compaction = createCompactionContent(block);
49943
50087
  if (compaction) {
@@ -49973,6 +50117,7 @@ function translateUserContentBlock(block) {
49973
50117
  switch (block.type) {
49974
50118
  case "text": return createTextContent(block.text);
49975
50119
  case "image": return createImageContent(block);
50120
+ case "document": return createDocumentContent(block);
49976
50121
  default: return;
49977
50122
  }
49978
50123
  }
@@ -50002,7 +50147,7 @@ function resolveAssistantPhase(content) {
50002
50147
  let hasToolUse = false;
50003
50148
  for (const block of content) {
50004
50149
  if (block.type === "text") hasText = true;
50005
- else if (block.type === "tool_use") hasToolUse = true;
50150
+ else if (block.type === "tool_use" || block.type === "server_tool_use" || block.type === "mcp_tool_use") hasToolUse = true;
50006
50151
  if (hasText && hasToolUse) break;
50007
50152
  }
50008
50153
  if (!hasText) return;
@@ -50027,6 +50172,23 @@ function createImageContent(block) {
50027
50172
  detail: "auto"
50028
50173
  };
50029
50174
  }
50175
+ function createDocumentContent(block) {
50176
+ const source = block.source;
50177
+ if (source.type === "file" && typeof source.file_id === "string") return {
50178
+ type: "input_file",
50179
+ file_id: source.file_id
50180
+ };
50181
+ if (source.type === "url" && typeof source.url === "string") return {
50182
+ type: "input_file",
50183
+ file_url: source.url
50184
+ };
50185
+ if (source.type === "base64" && typeof source.media_type === "string" && typeof source.data === "string") return {
50186
+ type: "input_file",
50187
+ file_data: `data:${source.media_type};base64,${source.data}`
50188
+ };
50189
+ if (source.type === "text" && typeof source.data === "string") return createTextContent(source.data);
50190
+ return createTextContent("[document attachment omitted]");
50191
+ }
50030
50192
  function createReasoningContent(block) {
50031
50193
  const { encryptedContent, id } = SignatureCodec.decodeReasoning(block.signature ?? "");
50032
50194
  const thinking = block.thinking === THINKING_TEXT ? "" : block.thinking;
@@ -50040,6 +50202,13 @@ function createReasoningContent(block) {
50040
50202
  encrypted_content: encryptedContent
50041
50203
  };
50042
50204
  }
50205
+ function createRedactedReasoningContent(block) {
50206
+ return {
50207
+ type: "reasoning",
50208
+ summary: [],
50209
+ encrypted_content: block.data
50210
+ };
50211
+ }
50043
50212
  function createCompactionContent(block) {
50044
50213
  const compaction = decodeCompactionCarrierSignature(block.signature ?? "");
50045
50214
  if (!compaction) return;
@@ -50066,6 +50235,17 @@ function createFunctionCallOutput(block) {
50066
50235
  status: block.is_error ? "incomplete" : "completed"
50067
50236
  };
50068
50237
  }
50238
+ function createServerFunctionCallOutput(block) {
50239
+ return {
50240
+ type: "function_call_output",
50241
+ call_id: block.tool_use_id,
50242
+ output: typeof block.content === "string" ? block.content : JSON.stringify(block.content) ?? "",
50243
+ status: block.is_error ? "incomplete" : "completed"
50244
+ };
50245
+ }
50246
+ function isServerToolResultBlock(block) {
50247
+ return block.type === "server_tool_result" || block.type === "web_search_tool_result" || block.type === "web_fetch_tool_result" || block.type === "code_execution_tool_result" || block.type === "bash_code_execution_tool_result" || block.type === "text_editor_code_execution_tool_result" || block.type === "tool_search_tool_result";
50248
+ }
50069
50249
  function translateSystemPrompt(system) {
50070
50250
  if (!system) return null;
50071
50251
  if (typeof system === "string") return system;
@@ -51452,8 +51632,13 @@ function fixStreamIds(rawData, eventName, state) {
51452
51632
  function createResponsesPassthroughStrategy(copilotClient, payload, options) {
51453
51633
  const tracker = createStreamIdTracker();
51454
51634
  return {
51455
- execute() {
51456
- return copilotClient.createResponses(payload, options);
51635
+ async execute() {
51636
+ try {
51637
+ return await copilotClient.createResponses(payload, options);
51638
+ } catch (error) {
51639
+ if (error instanceof HTTPError && error.status === 400) dumpFailedPayload(payload, error).catch(() => {});
51640
+ throw error;
51641
+ }
51457
51642
  },
51458
51643
  isStream(result) {
51459
51644
  return Boolean(payload.stream) && isAsyncIterable(result);
@@ -51490,6 +51675,29 @@ function tryExtractTerminalResponse(rawData) {
51490
51675
  if (response && typeof response === "object") return response;
51491
51676
  } catch {}
51492
51677
  }
51678
+ const DUMP_DIR = join(PATHS.APP_DIR, "dumps");
51679
+ const MAX_DUMPS = 20;
51680
+ const TIMESTAMP_CHARS_RE = /[:.]/g;
51681
+ const DUMP_FILE_RE = /^\d{3}-/;
51682
+ async function dumpFailedPayload(payload, error) {
51683
+ try {
51684
+ await mkdir(DUMP_DIR, { recursive: true });
51685
+ const now = (/* @__PURE__ */ new Date()).toISOString();
51686
+ const ts = now.replace(TIMESTAMP_CHARS_RE, "-");
51687
+ const file = join(DUMP_DIR, `${error.status}-${ts}.json`);
51688
+ await writeFile(file, JSON.stringify({
51689
+ timestamp: now,
51690
+ error: {
51691
+ status: error.status,
51692
+ message: error.message
51693
+ },
51694
+ payload
51695
+ }, null, 2));
51696
+ consola.warn(`Dumped failed /responses payload → ${file}`);
51697
+ const dumps = (await readdir(DUMP_DIR)).filter((f) => DUMP_FILE_RE.test(f) && f.endsWith(".json")).sort();
51698
+ if (dumps.length > MAX_DUMPS) await Promise.all(dumps.slice(0, dumps.length - MAX_DUMPS).map((f) => unlink(join(DUMP_DIR, f)).catch(() => {})));
51699
+ } catch {}
51700
+ }
51493
51701
 
51494
51702
  //#endregion
51495
51703
  //#region src/routes/responses/handler.ts
@@ -51586,8 +51794,52 @@ function rejectUnsupportedBuiltinTools(payload) {
51586
51794
  for (const tool of payload.tools) if (tool.type === "web_search") throwInvalidRequestError("The selected Copilot endpoint does not support the Responses web_search tool.", "tools", "unsupported_tool_web_search");
51587
51795
  }
51588
51796
  function applyResponsesInputPolicies(payload) {
51797
+ payload.store = false;
51798
+ stripUnresolvableInputItems(payload);
51799
+ stripPhaseFromInputMessages(payload);
51589
51800
  rejectUnsupportedRemoteImageUrls(payload);
51590
51801
  }
51802
+ /**
51803
+ * Strip `phase` from input message items. The `phase` field is an output
51804
+ * annotation that some models may reject when sent back as input.
51805
+ */
51806
+ function stripPhaseFromInputMessages(payload) {
51807
+ if (!Array.isArray(payload.input)) return;
51808
+ let stripped = 0;
51809
+ for (const item of payload.input) {
51810
+ if (typeof item !== "object" || item === null) continue;
51811
+ const rec = item;
51812
+ if ((!("type" in rec) || rec.type === "message") && "phase" in rec) {
51813
+ delete rec.phase;
51814
+ stripped++;
51815
+ }
51816
+ }
51817
+ if (stripped > 0) consola.debug(`Stripped phase from ${stripped} input message item(s)`);
51818
+ }
51819
+ /**
51820
+ * Remove input items that Copilot cannot resolve and would trigger 404:
51821
+ * - `item_reference` items (opaque IDs from store=true sessions)
51822
+ * - `function_call_output` items whose `call_id` has no matching prior
51823
+ * `function_call` in the same input array (orphaned outputs)
51824
+ */
51825
+ function stripUnresolvableInputItems(payload) {
51826
+ if (!Array.isArray(payload.input)) return;
51827
+ const functionCallIds = /* @__PURE__ */ new Set();
51828
+ for (const item of payload.input) {
51829
+ if (typeof item !== "object" || item === null) continue;
51830
+ const rec = item;
51831
+ if (rec.type === "function_call" && typeof rec.call_id === "string") functionCallIds.add(rec.call_id);
51832
+ }
51833
+ const originalLength = payload.input.length;
51834
+ payload.input = payload.input.filter((item) => {
51835
+ if (typeof item !== "object" || item === null) return true;
51836
+ const rec = item;
51837
+ if (rec.type === "item_reference") return false;
51838
+ if (rec.type === "function_call_output" && typeof rec.call_id === "string" && !functionCallIds.has(rec.call_id)) return false;
51839
+ return true;
51840
+ });
51841
+ if (payload.input.length !== originalLength) consola.debug(`Stripped ${originalLength - payload.input.length} unresolvable input items (item_reference / orphaned function_call_output)`);
51842
+ }
51591
51843
  function rejectUnsupportedRemoteImageUrls(payload) {
51592
51844
  if (!Array.isArray(payload.input) || !containsRemoteImageUrl(payload.input)) return;
51593
51845
  throwInvalidRequestError("The selected Copilot endpoint does not support external image URLs on the Responses API. Use file_id or data URL image input instead.", "input", "unsupported_input_image_remote_url");
@@ -51702,7 +51954,7 @@ function parseBooleanParam(value) {
51702
51954
  //#region src/routes/responses/route.ts
51703
51955
  function createResponsesRoutes() {
51704
51956
  return new Elysia().use(requestGuardPlugin).post("/responses", async function* ({ body, request, server }) {
51705
- if (hasStreamingFlag(body)) disableIdleTimeout(server, request);
51957
+ disableIdleTimeout(server, request);
51706
51958
  const { result, modelMapping } = await handleResponsesCore({
51707
51959
  body,
51708
51960
  signal: request.signal,
@@ -51711,7 +51963,8 @@ function createResponsesRoutes() {
51711
51963
  if (modelMapping) setRequestModelMapping(request, modelMapping);
51712
51964
  if (result.kind === "json") return result.data;
51713
51965
  yield* sseAdapter(result.generator);
51714
- }, { guarded: true }).post("/responses/input_tokens", async ({ body, request }) => {
51966
+ }, { guarded: true }).post("/responses/input_tokens", async ({ body, request, server }) => {
51967
+ disableIdleTimeout(server, request);
51715
51968
  return handleCreateResponseInputTokensCore({
51716
51969
  body,
51717
51970
  headers: request.headers,