omnigateway 0.13.0 → 0.13.1

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.
Files changed (3) hide show
  1. package/bin/omni.js +31 -27
  2. package/gateway.js +31 -27
  3. package/package.json +1 -1
package/bin/omni.js CHANGED
@@ -26016,35 +26016,37 @@ var museBodyOrder = [
26016
26016
  ];
26017
26017
 
26018
26018
  // packages/providers/src/openai/profile.ts
26019
- var OPENAI_CLI_VERSION = env("OMNI_OPENAI_CLI_VERSION", "0.156.0");
26019
+ var OPENAI_CLI_VERSION = env("OMNI_OPENAI_CLI_VERSION", "0.159.2");
26020
26020
  var OPENAI_UA_PLATFORM = env("OMNI_OPENAI_UA_PLATFORM", "Windows 10.0.26200");
26021
- var OPENAI_UA_ARCH = env("OMNI_OPENAI_UA_ARCH", "x64");
26021
+ var OPENAI_UA_ARCH = env("OMNI_OPENAI_UA_ARCH", "x86_64");
26022
+ var OPENAI_UA_TERMINAL = env("OMNI_OPENAI_UA_TERMINAL", "WindowsTerminal");
26023
+ var originator = env("OMNI_OPENAI_ORIGINATOR", "codex_cli_rs");
26022
26024
  var openaiProfile = {
26023
26025
  headers: [
26024
26026
  [
26025
- "User-Agent",
26026
- env("OMNI_UA_OPENAI", `codex-cli/${OPENAI_CLI_VERSION} (${OPENAI_UA_PLATFORM}; ${OPENAI_UA_ARCH})`)
26027
+ "user-agent",
26028
+ env("OMNI_UA_OPENAI", `${originator}/${OPENAI_CLI_VERSION} (${OPENAI_UA_PLATFORM}; ${OPENAI_UA_ARCH}) ${OPENAI_UA_TERMINAL}`)
26027
26029
  ],
26028
- ["originator", env("OMNI_OPENAI_ORIGINATOR", "codex_cli_rs")],
26029
- ["Version", OPENAI_CLI_VERSION],
26030
- ["Openai-Beta", "responses=experimental"],
26031
- ["X-Codex-Beta-Features", "responses_websockets"],
26032
- ["Accept", "text/event-stream"]
26030
+ ["originator", originator],
26031
+ ["version", OPENAI_CLI_VERSION],
26032
+ ["x-codex-beta-features", "remote_compaction_v2"],
26033
+ ["accept", "text/event-stream"]
26033
26034
  ],
26034
26035
  order: envOrder("OMNI_ORDER_OPENAI", [
26035
- "Host",
26036
- "Content-Type",
26037
- "Authorization",
26038
- "chatgpt-account-id",
26036
+ "host",
26037
+ "version",
26038
+ "x-codex-beta-features",
26039
26039
  "originator",
26040
- "session_id",
26041
- "Version",
26042
- "Openai-Beta",
26043
- "X-Codex-Beta-Features",
26044
- "Accept",
26045
- "User-Agent",
26046
- "Accept-Encoding",
26047
- "Content-Length"
26040
+ "x-client-request-id",
26041
+ "session-id",
26042
+ "thread-id",
26043
+ "accept",
26044
+ "content-type",
26045
+ "authorization",
26046
+ "chatgpt-account-id",
26047
+ "user-agent",
26048
+ "accept-encoding",
26049
+ "content-length"
26048
26050
  ])
26049
26051
  };
26050
26052
  var openaiBodyOrder = [
@@ -32502,11 +32504,13 @@ async function* decodeResponses(messages, options = {}) {
32502
32504
 
32503
32505
  // packages/providers/src/openai/wire.ts
32504
32506
  import { createHash as createHash6 } from "crypto";
32507
+ var MAX_CACHE_KEY_LENGTH = 1024;
32508
+ var HEADER_SAFE_KEY = /^[\x21-\x7e]+$/;
32505
32509
  function suppliedKey2(req) {
32506
32510
  const vendor = req.vendor?.openai;
32507
32511
  for (const name of ["prompt_cache_key", "session_id"]) {
32508
32512
  const value = vendor?.[name];
32509
- if (typeof value === "string" && value.length > 0)
32513
+ if (typeof value === "string" && value.length <= MAX_CACHE_KEY_LENGTH && HEADER_SAFE_KEY.test(value))
32510
32514
  return value;
32511
32515
  }
32512
32516
  return;
@@ -32689,18 +32693,18 @@ var openaiCodec = {
32689
32693
  buildRequest(input2) {
32690
32694
  const oauth = input2.credentials.accessToken !== null;
32691
32695
  const { body, degradations, cacheKey: cacheKey3 } = toResponsesWire(input2.request, input2.model, { oauth });
32692
- const protocol = [["Content-Type", "application/json"]];
32696
+ const protocol = [["content-type", "application/json"]];
32693
32697
  if (oauth) {
32694
- protocol.push(["Authorization", `Bearer ${input2.credentials.accessToken}`]);
32698
+ protocol.push(["authorization", `Bearer ${input2.credentials.accessToken}`]);
32695
32699
  const accountId = input2.credentials.providerData.accountId;
32696
32700
  if (typeof accountId === "string")
32697
32701
  protocol.push(["chatgpt-account-id", accountId]);
32698
- protocol.push(["session_id", cacheKey3]);
32699
32702
  } else if (input2.credentials.apiKey !== null) {
32700
- protocol.push(["Authorization", `Bearer ${input2.credentials.apiKey}`]);
32703
+ protocol.push(["authorization", `Bearer ${input2.credentials.apiKey}`]);
32701
32704
  } else {
32702
32705
  throw input2.fail("AUTH", "openai credential has no token");
32703
32706
  }
32707
+ protocol.push(["x-client-request-id", cacheKey3], ["session-id", cacheKey3], ["thread-id", cacheKey3]);
32704
32708
  const headers = orderHeaders(mergeHeaders(openaiProfile.headers, protocol), openaiProfile.order);
32705
32709
  const include = body.include;
32706
32710
  const nativeReasoning = Array.isArray(include) && include.includes("reasoning.encrypted_content");
@@ -38542,7 +38546,7 @@ function createServiceDeps(input2) {
38542
38546
  }
38543
38547
 
38544
38548
  // apps/cli/src/version.ts
38545
- var VERSION = "0.13.0";
38549
+ var VERSION = "0.13.1";
38546
38550
 
38547
38551
  // apps/cli/src/commands/service.ts
38548
38552
  function gatewayArgv(root) {
package/gateway.js CHANGED
@@ -31562,35 +31562,37 @@ var museBodyOrder = [
31562
31562
  ];
31563
31563
 
31564
31564
  // packages/providers/src/openai/profile.ts
31565
- var OPENAI_CLI_VERSION = env("OMNI_OPENAI_CLI_VERSION", "0.156.0");
31565
+ var OPENAI_CLI_VERSION = env("OMNI_OPENAI_CLI_VERSION", "0.159.2");
31566
31566
  var OPENAI_UA_PLATFORM = env("OMNI_OPENAI_UA_PLATFORM", "Windows 10.0.26200");
31567
- var OPENAI_UA_ARCH = env("OMNI_OPENAI_UA_ARCH", "x64");
31567
+ var OPENAI_UA_ARCH = env("OMNI_OPENAI_UA_ARCH", "x86_64");
31568
+ var OPENAI_UA_TERMINAL = env("OMNI_OPENAI_UA_TERMINAL", "WindowsTerminal");
31569
+ var originator = env("OMNI_OPENAI_ORIGINATOR", "codex_cli_rs");
31568
31570
  var openaiProfile = {
31569
31571
  headers: [
31570
31572
  [
31571
- "User-Agent",
31572
- env("OMNI_UA_OPENAI", `codex-cli/${OPENAI_CLI_VERSION} (${OPENAI_UA_PLATFORM}; ${OPENAI_UA_ARCH})`)
31573
+ "user-agent",
31574
+ env("OMNI_UA_OPENAI", `${originator}/${OPENAI_CLI_VERSION} (${OPENAI_UA_PLATFORM}; ${OPENAI_UA_ARCH}) ${OPENAI_UA_TERMINAL}`)
31573
31575
  ],
31574
- ["originator", env("OMNI_OPENAI_ORIGINATOR", "codex_cli_rs")],
31575
- ["Version", OPENAI_CLI_VERSION],
31576
- ["Openai-Beta", "responses=experimental"],
31577
- ["X-Codex-Beta-Features", "responses_websockets"],
31578
- ["Accept", "text/event-stream"]
31576
+ ["originator", originator],
31577
+ ["version", OPENAI_CLI_VERSION],
31578
+ ["x-codex-beta-features", "remote_compaction_v2"],
31579
+ ["accept", "text/event-stream"]
31579
31580
  ],
31580
31581
  order: envOrder("OMNI_ORDER_OPENAI", [
31581
- "Host",
31582
- "Content-Type",
31583
- "Authorization",
31584
- "chatgpt-account-id",
31582
+ "host",
31583
+ "version",
31584
+ "x-codex-beta-features",
31585
31585
  "originator",
31586
- "session_id",
31587
- "Version",
31588
- "Openai-Beta",
31589
- "X-Codex-Beta-Features",
31590
- "Accept",
31591
- "User-Agent",
31592
- "Accept-Encoding",
31593
- "Content-Length"
31586
+ "x-client-request-id",
31587
+ "session-id",
31588
+ "thread-id",
31589
+ "accept",
31590
+ "content-type",
31591
+ "authorization",
31592
+ "chatgpt-account-id",
31593
+ "user-agent",
31594
+ "accept-encoding",
31595
+ "content-length"
31594
31596
  ])
31595
31597
  };
31596
31598
  var openaiBodyOrder = [
@@ -38064,11 +38066,13 @@ async function* decodeResponses(messages, options = {}) {
38064
38066
 
38065
38067
  // packages/providers/src/openai/wire.ts
38066
38068
  import { createHash as createHash6 } from "crypto";
38069
+ var MAX_CACHE_KEY_LENGTH = 1024;
38070
+ var HEADER_SAFE_KEY = /^[\x21-\x7e]+$/;
38067
38071
  function suppliedKey2(req) {
38068
38072
  const vendor = req.vendor?.openai;
38069
38073
  for (const name of ["prompt_cache_key", "session_id"]) {
38070
38074
  const value = vendor?.[name];
38071
- if (typeof value === "string" && value.length > 0)
38075
+ if (typeof value === "string" && value.length <= MAX_CACHE_KEY_LENGTH && HEADER_SAFE_KEY.test(value))
38072
38076
  return value;
38073
38077
  }
38074
38078
  return;
@@ -38251,18 +38255,18 @@ var openaiCodec = {
38251
38255
  buildRequest(input2) {
38252
38256
  const oauth = input2.credentials.accessToken !== null;
38253
38257
  const { body, degradations, cacheKey: cacheKey3 } = toResponsesWire(input2.request, input2.model, { oauth });
38254
- const protocol = [["Content-Type", "application/json"]];
38258
+ const protocol = [["content-type", "application/json"]];
38255
38259
  if (oauth) {
38256
- protocol.push(["Authorization", `Bearer ${input2.credentials.accessToken}`]);
38260
+ protocol.push(["authorization", `Bearer ${input2.credentials.accessToken}`]);
38257
38261
  const accountId = input2.credentials.providerData.accountId;
38258
38262
  if (typeof accountId === "string")
38259
38263
  protocol.push(["chatgpt-account-id", accountId]);
38260
- protocol.push(["session_id", cacheKey3]);
38261
38264
  } else if (input2.credentials.apiKey !== null) {
38262
- protocol.push(["Authorization", `Bearer ${input2.credentials.apiKey}`]);
38265
+ protocol.push(["authorization", `Bearer ${input2.credentials.apiKey}`]);
38263
38266
  } else {
38264
38267
  throw input2.fail("AUTH", "openai credential has no token");
38265
38268
  }
38269
+ protocol.push(["x-client-request-id", cacheKey3], ["session-id", cacheKey3], ["thread-id", cacheKey3]);
38266
38270
  const headers = orderHeaders(mergeHeaders(openaiProfile.headers, protocol), openaiProfile.order);
38267
38271
  const include = body.include;
38268
38272
  const nativeReasoning = Array.isArray(include) && include.includes("reasoning.encrypted_content");
@@ -63488,7 +63492,7 @@ function createRing(limits = DEFAULT_RING_LIMITS) {
63488
63492
  }
63489
63493
 
63490
63494
  // apps/gateway/src/version.ts
63491
- var VERSION = "0.13.0";
63495
+ var VERSION = "0.13.1";
63492
63496
 
63493
63497
  // apps/gateway/src/app.ts
63494
63498
  var ADMIN_SESSION_TTL_MS = 12 * 60 * 60 * 1000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnigateway",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Self-hosted AI gateway with Anthropic- and OpenAI-compatible APIs, an admin console, and a CLI",
5
5
  "license": "MIT",
6
6
  "author": "Harismawan <mail@harismawan.com>",