opencode-aicodewith-auth 0.1.58 → 0.1.60

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/index.js +17 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -624,11 +624,13 @@ var collectCallIds = (input) => {
624
624
  };
625
625
  var normalizeOrphanedToolOutputs = (input) => {
626
626
  const { functionCallIds, localShellCallIds, customToolCallIds } = collectCallIds(input);
627
- return input.map((item) => {
627
+ let orphanCount = 0;
628
+ const result = input.map((item) => {
628
629
  if (item.type === "function_call_output") {
629
630
  const callId = getCallId(item);
630
631
  const hasMatch = !!callId && (functionCallIds.has(callId) || localShellCallIds.has(callId));
631
632
  if (!hasMatch) {
633
+ orphanCount++;
632
634
  return convertOrphanedOutputToMessage(item, callId);
633
635
  }
634
636
  }
@@ -636,6 +638,7 @@ var normalizeOrphanedToolOutputs = (input) => {
636
638
  const callId = getCallId(item);
637
639
  const hasMatch = !!callId && customToolCallIds.has(callId);
638
640
  if (!hasMatch) {
641
+ orphanCount++;
639
642
  return convertOrphanedOutputToMessage(item, callId);
640
643
  }
641
644
  }
@@ -643,11 +646,20 @@ var normalizeOrphanedToolOutputs = (input) => {
643
646
  const callId = getCallId(item);
644
647
  const hasMatch = !!callId && localShellCallIds.has(callId);
645
648
  if (!hasMatch) {
649
+ orphanCount++;
646
650
  return convertOrphanedOutputToMessage(item, callId);
647
651
  }
648
652
  }
649
653
  return item;
650
654
  });
655
+ if (orphanCount > 0 || functionCallIds.size > 0 || localShellCallIds.size > 0 || customToolCallIds.size > 0) {
656
+ logDebug(`normalizeOrphanedToolOutputs: ${orphanCount} orphans converted`, {
657
+ functionCallIds: functionCallIds.size,
658
+ localShellCallIds: localShellCallIds.size,
659
+ customToolCallIds: customToolCallIds.size
660
+ });
661
+ }
662
+ return result;
651
663
  };
652
664
 
653
665
  // lib/request/request-transformer.ts
@@ -758,8 +770,6 @@ async function transformRequestBody(body, codexInstructions) {
758
770
  logDebug(`Model lookup: "${originalModel}" -> "${normalizedModel}"`, {
759
771
  hasTools: !!body.tools
760
772
  });
761
- const hadPreviousResponseId = !!(body.previousResponseId || body.previous_response_id);
762
- const hadItemReferences = Array.isArray(body.input) && body.input.some((item) => item.type === "item_reference");
763
773
  body.model = normalizedModel;
764
774
  body.stream = true;
765
775
  body.store = false;
@@ -772,12 +782,6 @@ async function transformRequestBody(body, codexInstructions) {
772
782
  body.input = addCodexBridgeMessage(body.input, !!body.tools);
773
783
  if (body.input) {
774
784
  body.input = normalizeOrphanedToolOutputs(body.input);
775
- if (hadPreviousResponseId || hadItemReferences) {
776
- const hasAssistantOrToolHistory = body.input.some((item) => item.role === "assistant" || item.type === "function_call" || item.type === "function_call_output" || item.type === "local_shell_call" || item.type === "local_shell_call_output" || item.type === "custom_tool_call" || item.type === "custom_tool_call_output");
777
- if (!hasAssistantOrToolHistory) {
778
- logDebug("WARNING: Request had previous_response_id/item_reference but input lacks assistant/tool history. " + "Context may be lost in store:false mode. Upstream should send full conversation history in input.", { hadPreviousResponseId, hadItemReferences, inputLength: body.input.length });
779
- }
780
- }
781
785
  }
782
786
  }
783
787
  const reasoningConfig = resolveReasoningConfig(normalizedModel, body);
@@ -875,13 +879,10 @@ function sanitizeRequestBody(bodyStr) {
875
879
  const body = JSON.parse(bodyStr);
876
880
  delete body.previousResponseId;
877
881
  delete body.previous_response_id;
882
+ body.store = false;
878
883
  if (Array.isArray(body.input)) {
879
- body.input = body.input.filter((item) => item.type !== "item_reference").map((item) => {
880
- if (item.type === "function_call" || item.type === "local_shell_call" || item.type === "custom_tool_call")
881
- return item;
882
- const { id, ...rest } = item;
883
- return rest;
884
- });
884
+ body.input = sanitizeItemIds(body.input);
885
+ body.input = normalizeOrphanedToolOutputs(body.input);
885
886
  }
886
887
  return JSON.stringify(body);
887
888
  } catch {
@@ -2081,13 +2082,7 @@ var AicodewithCodexAuthPlugin = async (ctx) => {
2081
2082
  return;
2082
2083
  if (isCodexModel(input.model.id)) {
2083
2084
  const next2 = { ...output.options };
2084
- next2.providerOptions = {
2085
- ...next2.providerOptions,
2086
- openai: {
2087
- ...next2.providerOptions?.openai,
2088
- store: false
2089
- }
2090
- };
2085
+ next2.store = false;
2091
2086
  output.options = next2;
2092
2087
  return;
2093
2088
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-aicodewith-auth",
3
- "version": "0.1.58",
3
+ "version": "0.1.60",
4
4
  "description": "OpenCode plugin for AICodewith authentication - Access GPT-5.3 Codex, GPT-5.2, Claude, and Gemini models through AICodewith API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",