@jeffreycao/copilot-api 2.0.1 → 2.0.2

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
@@ -25,7 +25,7 @@ bindElectronFetch();
25
25
  const { auth } = await import("./auth-DH-ThnhJ.js");
26
26
  const { debug } = await import("./debug-D2giR-Kj.js");
27
27
  const { mcp } = await import("./mcp-BG6fpi6q.js");
28
- const { start } = await import("./start-BZqWghY0.js");
28
+ const { start } = await import("./start-CtwcJQT5.js");
29
29
  await runMain(defineCommand({
30
30
  meta: {
31
31
  name: "copilot-api",
@@ -2562,9 +2562,11 @@ async function forwardCodexAlphaSearchRequest(request) {
2562
2562
  return createProviderProxyResponse(upstreamResponse);
2563
2563
  }
2564
2564
  function createAlphaSearchRequest(request, payload) {
2565
- return new Request(request, {
2565
+ return new Request(request.url, {
2566
2566
  body: JSON.stringify(payload),
2567
- method: "post"
2567
+ headers: request.headers,
2568
+ method: request.method,
2569
+ signal: request.signal
2568
2570
  });
2569
2571
  }
2570
2572
  async function handleCodexRequest(c, request, resolvedProviderConfig) {
@@ -2609,7 +2611,10 @@ async function handleAlphaSearchRequest(c, resolvedProviderConfig) {
2609
2611
  if (providerModelAlias.provider === "codex") return await handleCodexRequest(c, createAlphaSearchRequest(c.req.raw, payload));
2610
2612
  }
2611
2613
  if (isAlphaSearchCodexPriorityEnabled()) {
2612
- if (await resolveProviderConfig("codex")) return await forwardCodexAlphaSearchRequest(createAlphaSearchRequest(c.req.raw, payload));
2614
+ if (await resolveProviderConfig("codex")) {
2615
+ if (!payload.model.startsWith("gpt")) payload.model = "gpt-5.6-luna";
2616
+ return await forwardCodexAlphaSearchRequest(createAlphaSearchRequest(c.req.raw, payload));
2617
+ }
2613
2618
  }
2614
2619
  const messagesBackedModel = await isMessagesBackedModel(resolvedRequestedModel);
2615
2620
  if (messagesBackedModel) {
@@ -8772,6 +8777,9 @@ var CustomToolInputStreamDecoder = class {
8772
8777
  prefixTokenOffset = 0;
8773
8778
  safeInputLength = 0;
8774
8779
  state = "prefix";
8780
+ trailingDepth = 0;
8781
+ trailingEscaped = false;
8782
+ trailingInString = false;
8775
8783
  unicodeDigitsRemaining = 0;
8776
8784
  append(partialJson) {
8777
8785
  if (this.failed) return this.fail("decoder is already in a failed state");
@@ -8807,8 +8815,42 @@ var CustomToolInputStreamDecoder = class {
8807
8815
  }
8808
8816
  if (this.state === "suffix") {
8809
8817
  if (isJsonWhitespace(char)) return;
8810
- if (char !== "}") return this.fail("expected \"}\" after the input string");
8811
- this.state = "done";
8818
+ if (char === "}") {
8819
+ this.state = "done";
8820
+ return;
8821
+ }
8822
+ if (char === ",") {
8823
+ this.state = "trailing";
8824
+ this.trailingDepth = 1;
8825
+ return;
8826
+ }
8827
+ return this.fail("expected \"}\" or \",\" after the input string");
8828
+ }
8829
+ if (this.state === "trailing") {
8830
+ if (this.trailingInString) {
8831
+ if (this.trailingEscaped) {
8832
+ this.trailingEscaped = false;
8833
+ return;
8834
+ }
8835
+ if (char === "\\") {
8836
+ this.trailingEscaped = true;
8837
+ return;
8838
+ }
8839
+ if (char === "\"") this.trailingInString = false;
8840
+ return;
8841
+ }
8842
+ if (char === "\"") {
8843
+ this.trailingInString = true;
8844
+ return;
8845
+ }
8846
+ if (char === "{" || char === "[") {
8847
+ this.trailingDepth += 1;
8848
+ return;
8849
+ }
8850
+ if (char === "}" || char === "]") {
8851
+ this.trailingDepth -= 1;
8852
+ if (this.trailingDepth === 0) this.state = "done";
8853
+ }
8812
8854
  return;
8813
8855
  }
8814
8856
  if (this.state === "done") {
@@ -10062,4 +10104,4 @@ server.route("/:provider/images", providerImageRoutes);
10062
10104
  //#endregion
10063
10105
  export { server };
10064
10106
 
10065
- //# sourceMappingURL=server-BDdqK9ps.js.map
10107
+ //# sourceMappingURL=server-0udg5DWI.js.map