@wengine-ai/ccr-provider-codex 1.0.5 → 1.0.7

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/plugin.js CHANGED
@@ -1678,6 +1678,7 @@ var CodexTransformer = class {
1678
1678
  constructor(options) {
1679
1679
  if (!options?.service) throw new Error("CodexTransformer requires { service }");
1680
1680
  this.service = options.service;
1681
+ this.logger = options.logger;
1681
1682
  }
1682
1683
  /**
1683
1684
  * Request phase: finalize the Responses body produced by the preceding
@@ -1908,7 +1909,12 @@ function codexAccountHeaders(input) {
1908
1909
  originator: CODEX_ORIGINATOR,
1909
1910
  version,
1910
1911
  "User-Agent": codexUserAgent2(version),
1911
- Accept: "text/event-stream"
1912
+ Accept: "text/event-stream",
1913
+ // Same middlebox rationale as the OAuth/management calls: the direct
1914
+ // route's middlebox strips content-encoding while handing through the
1915
+ // compressed bytes, which undici cannot decode. identity = plain SSE,
1916
+ // parseable under any exit node.
1917
+ "Accept-Encoding": "identity"
1912
1918
  };
1913
1919
  if (input.accountId) headers["chatgpt-account-id"] = input.accountId;
1914
1920
  const sessionKey = input.requestBody?.prompt_cache_key;
@@ -1966,11 +1972,16 @@ function createCodexManagedRuntime(options) {
1966
1972
  },
1967
1973
  // Pin the upstream: a config-supplied base_url can never win, a redirect
1968
1974
  // away from the fixed origin is an error, and the fixed origin ignores
1969
- // CCR/proxy environment routing.
1975
+ // CCR/proxy environment routing. Fixed subscription origins honor the
1976
+ // explicit SUBSCRIPTION_PROXY_URL opt-in: chatgpt.com answers through the
1977
+ // subscription dispatcher when one is configured. The plain direct agent
1978
+ // stays the fallback for hosts that predate the opt-in seam — and it is
1979
+ // also why tonight's direct-route middlebox could strip response headers
1980
+ // and hand the SSE parser undecodable bodies (every turn judged empty).
1970
1981
  lockUpstream: async (config) => {
1971
1982
  config.url = CODEX_UPSTREAM_URL;
1972
1983
  config.redirect = "error";
1973
- config.dispatcher = options.host.getDirectDispatcher();
1984
+ config.dispatcher = options.host.getSubscriptionDispatcher?.() ?? options.host.getDirectDispatcher();
1974
1985
  },
1975
1986
  // Called AFTER the body is final: session headers derive from it.
1976
1987
  signRequest: async ({ headers, requestBody }) => {
@@ -2376,7 +2387,7 @@ var codexLocales = {
2376
2387
  // src/plugin.ts
2377
2388
  var manifest = {
2378
2389
  name: "codex",
2379
- version: "1.0.5",
2390
+ version: "1.0.7",
2380
2391
  coreApi: "1",
2381
2392
  description: "Codex subscription managed provider: chatgpt.com backend-api/codex data plane, browser OAuth login (PKCE, loopback 1455/1457 + paste), model sync, usage and admin routes."
2382
2393
  };
@@ -2392,7 +2403,7 @@ async function activate(ctx) {
2392
2403
  });
2393
2404
  class ActivatedCodexTransformer extends CodexTransformer {
2394
2405
  constructor() {
2395
- super({ service });
2406
+ super({ service, logger: ctx.log });
2396
2407
  }
2397
2408
  }
2398
2409
  const runtime = createCodexManagedRuntime({ service, host: upstreamHost, log: ctx.log });
package/dist/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "coreApi": "1",
5
5
  "description": "Codex subscription managed provider: chatgpt.com backend-api/codex data plane, browser OAuth login (PKCE, loopback 1455/1457 + paste), model sync, usage and admin routes."
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wengine-ai/ccr-provider-codex",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Codex subscription provider plugin for claude-code-router: browser OAuth login, fixed-origin responses data plane, transformer, managed runtime, admin routes, config protector and UI card.",
5
5
  "type": "module",
6
6
  "main": "dist/plugin.js",
@@ -30,4 +30,4 @@
30
30
  "dist/*.json",
31
31
  "dist/*.md"
32
32
  ]
33
- }
33
+ }