@jeffreycao/copilot-api 2.6.10 → 2.6.11

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.js CHANGED
@@ -30,7 +30,7 @@ if (isMcpFastPath(process.argv)) {
30
30
  const { auth } = await import("./auth-BTdaexGw.js");
31
31
  const { debug } = await import("./debug-DXGZGaoU.js");
32
32
  const { mcp } = await import("./mcp-Byz9h_xz.js");
33
- const { start } = await import("./start-BeVQ_Cd1.js");
33
+ const { start } = await import("./start-CYq2v7cu.js");
34
34
  await runMain(defineCommand({
35
35
  meta: {
36
36
  name: "copilot-api",
@@ -5338,7 +5338,7 @@ function handleReasoningOpaqueInToolCalls(state, events, delta) {
5338
5338
  function handleContent(delta, state, events) {
5339
5339
  if (delta.content && delta.content.length > 0) {
5340
5340
  closeThinkingBlockIfOpen(state, events);
5341
- if (isToolBlockOpen(state) || hasToolCallDelta(delta)) {
5341
+ if (isToolBlockOpen(state)) {
5342
5342
  state.deferredContent = `${state.deferredContent ?? ""}${delta.content}`;
5343
5343
  return;
5344
5344
  }
@@ -5378,9 +5378,6 @@ function handleContent(delta, state, events) {
5378
5378
  state.thinkingBlockOpen = false;
5379
5379
  }
5380
5380
  }
5381
- function hasToolCallDelta(delta) {
5382
- return Boolean(delta.tool_calls && delta.tool_calls.length > 0);
5383
- }
5384
5381
  function flushDeferredContent(state, events) {
5385
5382
  if (!state.deferredContent) return;
5386
5383
  if (!state.contentBlockOpen) {
@@ -10651,10 +10648,11 @@ async function handleCodexModelsProxy(c, resolvedProviderConfig) {
10651
10648
  return createProviderProxyResponse(await forwardCodexModels(c.req.url, c.req.raw.headers));
10652
10649
  }
10653
10650
  async function handleMergedCodexModels(c, candidatesRequest, options = {}) {
10654
- const [upstreamCatalog, candidates] = await Promise.all([tryGetCodexCatalog(c), Promise.resolve(candidatesRequest).catch((error) => {
10651
+ const [upstreamCatalogResult, candidates] = await Promise.all([tryGetCodexCatalog(c), Promise.resolve(candidatesRequest).catch((error) => {
10655
10652
  logger$8.warn("models.codex.candidates_error", { error });
10656
10653
  return [];
10657
10654
  })]);
10655
+ const upstreamCatalog = upstreamCatalogResult?.catalog;
10658
10656
  const upstreamModels = upstreamCatalog?.models ?? FALLBACK_CODEX_MODELS;
10659
10657
  const template = selectTemplate(upstreamModels);
10660
10658
  const catalogModelsBySlug = new Map(upstreamModels.map((model) => [model.slug, model]));
@@ -10687,7 +10685,12 @@ async function handleMergedCodexModels(c, candidatesRequest, options = {}) {
10687
10685
  ...upstreamCatalog ?? {},
10688
10686
  models
10689
10687
  };
10690
- return c.json(response);
10688
+ const result = c.json(response);
10689
+ if (upstreamCatalogResult?.etag) {
10690
+ result.headers.set("ETag", upstreamCatalogResult.etag);
10691
+ result.headers.set("Cache-Control", "private, no-store");
10692
+ }
10693
+ return result;
10691
10694
  }
10692
10695
  function createCatalogAlias(model, slug, providerName) {
10693
10696
  const alias = {
@@ -10775,7 +10778,10 @@ async function tryGetCodexCatalog(c) {
10775
10778
  logger$8.warn("models.codex.catalog_invalid");
10776
10779
  return null;
10777
10780
  }
10778
- return body;
10781
+ return {
10782
+ catalog: body,
10783
+ etag: response.headers.get("ETag")
10784
+ };
10779
10785
  } catch (error) {
10780
10786
  logger$8.warn("models.codex.catalog_error", { error });
10781
10787
  return null;
@@ -12078,6 +12084,7 @@ const logger$3 = createHandlerLogger("responses-messages-handler");
12078
12084
  const responsesMessagesDependencies = { handleCompletionPayload };
12079
12085
  async function handleResponsesViaMessages(c, options) {
12080
12086
  try {
12087
+ if (isCodexUserAgent(c.req.header("user-agent")) && options.targetModel.toLowerCase().includes("mimo-v2.6")) throw new ResponsesMessagesTranslationError("MiMo v2.6 cannot return valid Codex custom tool responses. Please switch models.");
12081
12088
  const translation = translateResponsesToMessages({
12082
12089
  ...options.payload,
12083
12090
  model: options.publicModel
@@ -12686,4 +12693,4 @@ createServer();
12686
12693
  //#endregion
12687
12694
  export { createServer };
12688
12695
 
12689
- //# sourceMappingURL=server-YjTkYHJ4.js.map
12696
+ //# sourceMappingURL=server-Biyjjk2W.js.map