claude-code-openai 0.1.28 → 0.1.29

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 (2) hide show
  1. package/dist/cli.js +40 -28
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -204660,7 +204660,7 @@ var init_metadata = __esm(() => {
204660
204660
  isClaudeAiAuth: isClaudeAISubscriber(),
204661
204661
  version: "2.1.88-rebuild",
204662
204662
  versionBase: getVersionBase(),
204663
- buildTime: "2026-04-01T21:15:06.587Z",
204663
+ buildTime: "2026-04-01T21:37:21.080Z",
204664
204664
  deploymentEnvironment: env4.detectDeploymentEnvironment(),
204665
204665
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
204666
204666
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -592955,7 +592955,7 @@ function getAnthropicEnvMetadata() {
592955
592955
  function getBuildAgeMinutes() {
592956
592956
  if (false)
592957
592957
  ;
592958
- const buildTime = new Date("2026-04-01T21:15:06.587Z").getTime();
592958
+ const buildTime = new Date("2026-04-01T21:37:21.080Z").getTime();
592959
592959
  if (isNaN(buildTime))
592960
592960
  return;
592961
592961
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -595140,6 +595140,8 @@ function convertStopReason(status) {
595140
595140
  return "max_tokens";
595141
595141
  case "failed":
595142
595142
  case "cancelled":
595143
+ case "in_progress":
595144
+ case "queued":
595143
595145
  return null;
595144
595146
  default:
595145
595147
  return null;
@@ -595215,7 +595217,7 @@ __export(exports_openai_query, {
595215
595217
  getLastOpenAIResponseId: () => getLastOpenAIResponseId,
595216
595218
  clearLastOpenAIResponseId: () => clearLastOpenAIResponseId
595217
595219
  });
595218
- import { createHash as createHash22, randomUUID as randomUUID23 } from "crypto";
595220
+ import { randomUUID as randomUUID23 } from "crypto";
595219
595221
  function resolveOpenAIModel(anthropicModel) {
595220
595222
  if (process.env.OPENAI_MODEL) {
595221
595223
  return process.env.OPENAI_MODEL;
@@ -595246,11 +595248,7 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
595246
595248
  const oaiTools = convertToolSchemas(tools);
595247
595249
  const hasWebSearch = oaiTools.some((t2) => t2.type === "web_search_preview" || t2.type === "web_search");
595248
595250
  if (!hasWebSearch) {
595249
- if (client3.isOAuthChatgpt) {
595250
- oaiTools.push({ type: "web_search", search_context_size: "medium", external_web_access: true });
595251
- } else {
595252
- oaiTools.push({ type: "web_search_preview", search_context_size: "medium" });
595253
- }
595251
+ oaiTools.push({ type: "web_search", search_context_size: "medium" });
595254
595252
  }
595255
595253
  const toolChoice = convertToolChoice(options.toolChoice);
595256
595254
  const supportsReasoning = /^(gpt-5|o[1-9]|o3)/.test(openaiModel);
@@ -595258,7 +595256,12 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
595258
595256
  if (supportsReasoning && thinkingConfig.type !== "disabled") {
595259
595257
  const resolved = resolveAppliedEffort(options.model, options.effortValue);
595260
595258
  const level = resolved ? convertEffortValueToLevel(resolved) : "medium";
595261
- const effort = level === "max" ? "high" : level;
595259
+ let effort;
595260
+ if (level === "max") {
595261
+ effort = /codex/.test(openaiModel) ? "xhigh" : "high";
595262
+ } else {
595263
+ effort = level;
595264
+ }
595262
595265
  reasoning = { effort, summary: "auto" };
595263
595266
  }
595264
595267
  let input;
@@ -595278,7 +595281,7 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
595278
595281
  }
595279
595282
  const hasFunctionTools = oaiTools.some((t2) => t2.type === "function");
595280
595283
  let params;
595281
- const promptCacheKey = instructions ? createHash22("sha256").update(instructions).digest("hex").slice(0, 16) : undefined;
595284
+ const promptCacheKey = getSessionId() || undefined;
595282
595285
  if (client3.isOAuthChatgpt) {
595283
595286
  params = {
595284
595287
  model: openaiModel,
@@ -595291,7 +595294,8 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
595291
595294
  store: false,
595292
595295
  stream: true,
595293
595296
  include: reasoning ? ["reasoning.encrypted_content"] : [],
595294
- prompt_cache_key: promptCacheKey
595297
+ prompt_cache_key: promptCacheKey,
595298
+ truncation: "auto"
595295
595299
  };
595296
595300
  } else {
595297
595301
  const maxOutputTokens = options.maxOutputTokensOverride || MAX_OUTPUT_TOKENS[openaiModel] || 16384;
@@ -595308,13 +595312,15 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
595308
595312
  reasoning,
595309
595313
  previous_response_id: usePreviousResponseId ? _lastResponseId : undefined,
595310
595314
  store: true,
595311
- prompt_cache_key: promptCacheKey
595315
+ prompt_cache_key: promptCacheKey,
595316
+ truncation: "auto"
595312
595317
  };
595313
595318
  }
595314
595319
  logForDebugging(`[OpenAI] Request: model=${openaiModel} input=${input.length} items (${usePreviousResponseId ? "incremental, chain=" + _lastResponseId : "full"}) tools=${oaiTools.length}`);
595315
595320
  const start = Date.now();
595316
595321
  const MAX_RETRIES4 = 3;
595317
595322
  const BASE_DELAY_MS4 = 500;
595323
+ let responseId = null;
595318
595324
  try {
595319
595325
  let resetWatchdog = function() {
595320
595326
  if (watchdogTimer)
@@ -595456,7 +595462,7 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
595456
595462
  cache_read_input_tokens: 0
595457
595463
  };
595458
595464
  let isFirstChunk = true;
595459
- let responseId = null;
595465
+ responseId = null;
595460
595466
  let responseModel = openaiModel;
595461
595467
  let responseStatus = "completed";
595462
595468
  const functionCallState = new Map;
@@ -595795,10 +595801,15 @@ Sources:
595795
595801
  requestId: responseId ?? undefined,
595796
595802
  isApiErrorMessage: false
595797
595803
  };
595798
- logForDebugging(`[OpenAI] Complete: ${contentBlocks.length} blocks, ${usage.input_tokens}in/${usage.output_tokens}out tokens, ${Date.now() - start}ms`);
595804
+ const usageAny = usage;
595805
+ const cachedInfo = usageAny.cache_read_input_tokens ? ` (${usageAny.cache_read_input_tokens} cached)` : "";
595806
+ const reasoningInfo = usageAny.reasoning_output_tokens ? ` (${usageAny.reasoning_output_tokens} reasoning)` : "";
595807
+ logForDebugging(`[OpenAI] Complete: ${contentBlocks.length} blocks, ${usageAny.input_tokens}in${cachedInfo}/${usageAny.output_tokens}out${reasoningInfo} tokens, ${Date.now() - start}ms`);
595799
595808
  } catch (err2) {
595800
595809
  if (err2 instanceof Error && err2.name === "AbortError") {
595801
- _lastResponseId = null;
595810
+ if (!responseId) {
595811
+ _lastResponseId = null;
595812
+ }
595802
595813
  return;
595803
595814
  }
595804
595815
  const errorMsg = err2 instanceof Error ? err2.message : String(err2);
@@ -595843,6 +595854,7 @@ var init_openai_query = __esm(() => {
595843
595854
  init_client5();
595844
595855
  init_openai_adapter();
595845
595856
  init_effort();
595857
+ init_state();
595846
595858
  OPENAI_MODEL_MAP = {
595847
595859
  "claude-opus-4-6-20260401": "gpt-5.4",
595848
595860
  "claude-opus-4-5-20250918": "gpt-5.4",
@@ -597572,7 +597584,7 @@ var init_toolSearch = __esm(() => {
597572
597584
  });
597573
597585
 
597574
597586
  // src/services/vcr.ts
597575
- import { createHash as createHash23, randomUUID as randomUUID24 } from "crypto";
597587
+ import { createHash as createHash22, randomUUID as randomUUID24 } from "crypto";
597576
597588
  import { mkdir as mkdir22, readFile as readFile33, writeFile as writeFile24 } from "fs/promises";
597577
597589
  import { dirname as dirname38, join as join94 } from "path";
597578
597590
  function shouldUseVCR() {
@@ -597586,7 +597598,7 @@ async function withFixture(input, fixtureName, f2) {
597586
597598
  if (!shouldUseVCR()) {
597587
597599
  return await f2();
597588
597600
  }
597589
- const hash2 = createHash23("sha1").update(jsonStringify(input)).digest("hex").slice(0, 12);
597601
+ const hash2 = createHash22("sha1").update(jsonStringify(input)).digest("hex").slice(0, 12);
597590
597602
  const filename = join94(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${fixtureName}-${hash2}.json`);
597591
597603
  try {
597592
597604
  const cached3 = jsonParse(await readFile33(filename, { encoding: "utf8" }));
@@ -597621,7 +597633,7 @@ async function withVCR(messages, f2) {
597621
597633
  return true;
597622
597634
  }));
597623
597635
  const dehydratedInput = mapMessages(messagesForAPI.map((_3) => _3.message.content), dehydrateValue);
597624
- const filename = join94(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${dehydratedInput.map((_3) => createHash23("sha1").update(jsonStringify(_3)).digest("hex").slice(0, 6)).join("-")}.json`);
597636
+ const filename = join94(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${dehydratedInput.map((_3) => createHash22("sha1").update(jsonStringify(_3)).digest("hex").slice(0, 6)).join("-")}.json`);
597625
597637
  try {
597626
597638
  const cached3 = jsonParse(await readFile33(filename, { encoding: "utf8" }));
597627
597639
  cached3.output.forEach(addCachedCostToTotalSessionCost);
@@ -604307,7 +604319,7 @@ var init_managedPlugins = __esm(() => {
604307
604319
  });
604308
604320
 
604309
604321
  // src/utils/plugins/pluginVersioning.ts
604310
- import { createHash as createHash24 } from "crypto";
604322
+ import { createHash as createHash23 } from "crypto";
604311
604323
  async function calculatePluginVersion(pluginId, source, manifest, installPath, providedVersion, gitCommitSha) {
604312
604324
  if (manifest?.version) {
604313
604325
  logForDebugging(`Using manifest version for ${pluginId}: ${manifest.version}`);
@@ -604321,7 +604333,7 @@ async function calculatePluginVersion(pluginId, source, manifest, installPath, p
604321
604333
  const shortSha = gitCommitSha.substring(0, 12);
604322
604334
  if (typeof source === "object" && source.source === "git-subdir") {
604323
604335
  const normPath = source.path.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+$/, "");
604324
- const pathHash = createHash24("sha256").update(normPath).digest("hex").substring(0, 8);
604336
+ const pathHash = createHash23("sha256").update(normPath).digest("hex").substring(0, 8);
604325
604337
  const v6 = `${shortSha}-${pathHash}`;
604326
604338
  logForDebugging(`Using git-subdir SHA+path version for ${pluginId}: ${v6} (path=${normPath})`);
604327
604339
  return v6;
@@ -613444,14 +613456,14 @@ var init_terminalSetup = __esm(() => {
613444
613456
  });
613445
613457
 
613446
613458
  // src/utils/pasteStore.ts
613447
- import { createHash as createHash25 } from "crypto";
613459
+ import { createHash as createHash24 } from "crypto";
613448
613460
  import { mkdir as mkdir26, readdir as readdir21, readFile as readFile39, stat as stat37, unlink as unlink15, writeFile as writeFile30 } from "fs/promises";
613449
613461
  import { join as join109 } from "path";
613450
613462
  function getPasteStoreDir() {
613451
613463
  return join109(getClaudeConfigHomeDir(), PASTE_STORE_DIR);
613452
613464
  }
613453
613465
  function hashPastedText(content) {
613454
- return createHash25("sha256").update(content).digest("hex").slice(0, 16);
613466
+ return createHash24("sha256").update(content).digest("hex").slice(0, 16);
613455
613467
  }
613456
613468
  function getPastePath(hash2) {
613457
613469
  return join109(getPasteStoreDir(), `${hash2}.txt`);
@@ -679562,7 +679574,7 @@ var init_bridge_kick = __esm(() => {
679562
679574
  var call56 = async () => {
679563
679575
  return {
679564
679576
  type: "text",
679565
- value: `${"2.1.88-rebuild"} (built ${"2026-04-01T21:15:06.587Z"})`
679577
+ value: `${"2.1.88-rebuild"} (built ${"2026-04-01T21:37:21.080Z"})`
679566
679578
  };
679567
679579
  }, version6, version_default;
679568
679580
  var init_version = __esm(() => {
@@ -698652,7 +698664,7 @@ var init_prompts4 = __esm(() => {
698652
698664
  });
698653
698665
 
698654
698666
  // src/utils/api.ts
698655
- import { createHash as createHash26 } from "crypto";
698667
+ import { createHash as createHash25 } from "crypto";
698656
698668
  function filterSwarmFieldsFromSchema(toolName, schema) {
698657
698669
  const fieldsToRemove = SWARM_FIELDS_BY_TOOL[toolName];
698658
698670
  if (!fieldsToRemove || fieldsToRemove.length === 0) {
@@ -698742,7 +698754,7 @@ function logAPIPrefix(systemPrompt) {
698742
698754
  logEvent("tengu_sysprompt_block", {
698743
698755
  snippet: firstSystemPrompt?.slice(0, 20),
698744
698756
  length: firstSystemPrompt?.length ?? 0,
698745
- hash: firstSystemPrompt ? createHash26("sha256").update(firstSystemPrompt).digest("hex") : ""
698757
+ hash: firstSystemPrompt ? createHash25("sha256").update(firstSystemPrompt).digest("hex") : ""
698746
698758
  });
698747
698759
  }
698748
698760
  function splitSysPromptPrefix(systemPrompt, options) {
@@ -699068,7 +699080,7 @@ var init_api3 = __esm(() => {
699068
699080
  });
699069
699081
 
699070
699082
  // src/utils/fingerprint.ts
699071
- import { createHash as createHash27 } from "crypto";
699083
+ import { createHash as createHash26 } from "crypto";
699072
699084
  function extractFirstMessageText(messages) {
699073
699085
  const firstUserMessage = messages.find((msg) => msg.type === "user");
699074
699086
  if (!firstUserMessage) {
@@ -699090,7 +699102,7 @@ function computeFingerprint(messageText, version7) {
699090
699102
  const indices = [4, 7, 20];
699091
699103
  const chars = indices.map((i4) => messageText[i4] || "0").join("");
699092
699104
  const fingerprintInput = `${FINGERPRINT_SALT}${chars}${version7}`;
699093
- const hash2 = createHash27("sha256").update(fingerprintInput).digest("hex");
699105
+ const hash2 = createHash26("sha256").update(fingerprintInput).digest("hex");
699094
699106
  return hash2.slice(0, 3);
699095
699107
  }
699096
699108
  function computeFingerprintFromMessages(messages) {
@@ -777573,4 +777585,4 @@ async function main2() {
777573
777585
  }
777574
777586
  main2();
777575
777587
 
777576
- //# debugId=5C9DD16DE124AF3464756E2164756E21
777588
+ //# debugId=E1FE85DFD19006BC64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-openai",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Claude Code CLI with OpenAI GPT-5.4 backend support",
5
5
  "type": "module",
6
6
  "bin": {