@kenkaiiii/gg-ai 5.91.2 → 5.93.0

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/index.d.cts CHANGED
@@ -1047,7 +1047,7 @@ declare function continuesTurn(message: Message): boolean;
1047
1047
  /** A real turn boundary: a user message that isn't a runtime notice. */
1048
1048
  declare function opensTurn(message: Message): boolean;
1049
1049
 
1050
- declare const CODEX_CLIENT_VERSION = "0.161.0";
1050
+ declare const CODEX_CLIENT_VERSION = "0.166.0";
1051
1051
  declare function usesResponsesLite(model: string): boolean;
1052
1052
 
1053
1053
  /**
package/dist/index.d.ts CHANGED
@@ -1047,7 +1047,7 @@ declare function continuesTurn(message: Message): boolean;
1047
1047
  /** A real turn boundary: a user message that isn't a runtime notice. */
1048
1048
  declare function opensTurn(message: Message): boolean;
1049
1049
 
1050
- declare const CODEX_CLIENT_VERSION = "0.161.0";
1050
+ declare const CODEX_CLIENT_VERSION = "0.166.0";
1051
1051
  declare function usesResponsesLite(model: string): boolean;
1052
1052
 
1053
1053
  /**
package/dist/index.js CHANGED
@@ -3931,7 +3931,7 @@ function toResponsesInput(messages, options) {
3931
3931
 
3932
3932
  // src/providers/openai-codex.ts
3933
3933
  var DEFAULT_BASE_URL = "https://chatgpt.com/backend-api";
3934
- var CODEX_CLIENT_VERSION = "0.161.0";
3934
+ var CODEX_CLIENT_VERSION = "0.166.0";
3935
3935
  var CODEX_REQUEST_COMPRESSION_MIN_BYTES = 16 * 1024;
3936
3936
  var zstdInitPromise;
3937
3937
  async function encodeCodexRequest(body) {
@@ -4995,6 +4995,20 @@ function isBinary(value) {
4995
4995
  function isMediaObject(value) {
4996
4996
  return (value.type === "image" || value.type === "video") && (typeof value.data === "string" || typeof value.url === "string");
4997
4997
  }
4998
+ var IMAGE_DATA_URL = /^data:image\/[a-z0-9.+-]+;base64,([A-Za-z0-9+/]*={0,2})$/i;
4999
+ var IMAGE_BASE64_SIGNATURE = /^(?:iVBORw0KGgo|\/9j\/|R0lGOD|UklGR|Qk)/;
5000
+ var MAX_IMAGE_BASE64_CHARS = 16e6;
5001
+ function isImageBase64(value) {
5002
+ return value.length <= MAX_IMAGE_BASE64_CHARS && IMAGE_BASE64_SIGNATURE.test(value);
5003
+ }
5004
+ function isImageDataUrl(value) {
5005
+ if (!value.startsWith("data:image/") || value.length > MAX_IMAGE_BASE64_CHARS + 64) return false;
5006
+ const match = IMAGE_DATA_URL.exec(value);
5007
+ return match !== null && isImageBase64(match[1]);
5008
+ }
5009
+ function isImagePreview(value) {
5010
+ return typeof value.base64 === "string" && typeof value.mediaType === "string" && value.mediaType.startsWith("image/") && isImageBase64(value.base64);
5011
+ }
4998
5012
  function redactValue(value, options = {}) {
4999
5013
  const maxDepth = options.maxDepth ?? 20;
5000
5014
  const maxEntries = options.maxEntries ?? 1e4;
@@ -5003,6 +5017,7 @@ function redactValue(value, options = {}) {
5003
5017
  const visit = (current, depth, sensitive = false) => {
5004
5018
  if (typeof current === "string") {
5005
5019
  if (sensitive && current.length > 0 && current !== REDACTED) return REDACTED;
5020
+ if (isImageDataUrl(current)) return current;
5006
5021
  return redactText(current, options);
5007
5022
  }
5008
5023
  if (current === null || current === void 0 || typeof current === "number" || typeof current === "boolean" || typeof current === "bigint") {
@@ -5045,13 +5060,14 @@ function redactValue(value, options = {}) {
5045
5060
  }
5046
5061
  const record = current;
5047
5062
  if (isMediaObject(record)) return { ...record };
5063
+ const preview = isImagePreview(record);
5048
5064
  const clone = {};
5049
5065
  for (const [key, child] of Object.entries(record)) {
5050
5066
  if (++entries > maxEntries) {
5051
5067
  clone[TRUNCATED] = true;
5052
5068
  break;
5053
5069
  }
5054
- clone[key] = visit(child, depth + 1, SENSITIVE_NAME.test(key));
5070
+ clone[key] = key === "base64" && preview ? child : visit(child, depth + 1, SENSITIVE_NAME.test(key));
5055
5071
  }
5056
5072
  return clone;
5057
5073
  };