opencode-aicodewith-auth 0.1.57 → 0.1.59
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.js +21 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -695,30 +695,23 @@ function resolveInclude(body) {
|
|
|
695
695
|
return include;
|
|
696
696
|
}
|
|
697
697
|
function sanitizeItemIds(input) {
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
if (
|
|
701
|
-
const callId = item.call_id;
|
|
702
|
-
if (typeof callId === "string" && callId.trim().length > 0) {
|
|
703
|
-
outputCallIds.add(callId.trim());
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
return input.filter((item) => item.type !== "item_reference").map((item) => {
|
|
708
|
-
if (!("id" in item)) {
|
|
698
|
+
const strippedIds = [];
|
|
699
|
+
const result = input.filter((item) => item.type !== "item_reference").map((item) => {
|
|
700
|
+
if (!("id" in item))
|
|
709
701
|
return item;
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
const callId = item.call_id;
|
|
714
|
-
const hasMatchingOutput = typeof callId === "string" && callId.trim().length > 0 && outputCallIds.has(callId.trim());
|
|
715
|
-
if (hasMatchingOutput) {
|
|
716
|
-
return item;
|
|
717
|
-
}
|
|
702
|
+
const itemId = item.id;
|
|
703
|
+
if (typeof itemId === "string") {
|
|
704
|
+
strippedIds.push(itemId);
|
|
718
705
|
}
|
|
719
706
|
const { id, ...rest } = item;
|
|
720
707
|
return rest;
|
|
721
708
|
});
|
|
709
|
+
if (strippedIds.length > 0) {
|
|
710
|
+
logDebug(`Stripped ${strippedIds.length} item IDs from input (stateless mode)`, {
|
|
711
|
+
ids: strippedIds
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
return result;
|
|
722
715
|
}
|
|
723
716
|
function filterOpenCodeSystemPrompts(input) {
|
|
724
717
|
if (!Array.isArray(input))
|
|
@@ -765,6 +758,8 @@ async function transformRequestBody(body, codexInstructions) {
|
|
|
765
758
|
logDebug(`Model lookup: "${originalModel}" -> "${normalizedModel}"`, {
|
|
766
759
|
hasTools: !!body.tools
|
|
767
760
|
});
|
|
761
|
+
const hadPreviousResponseId = !!(body.previousResponseId || body.previous_response_id);
|
|
762
|
+
const hadItemReferences = Array.isArray(body.input) && body.input.some((item) => item.type === "item_reference");
|
|
768
763
|
body.model = normalizedModel;
|
|
769
764
|
body.stream = true;
|
|
770
765
|
body.store = false;
|
|
@@ -777,6 +772,12 @@ async function transformRequestBody(body, codexInstructions) {
|
|
|
777
772
|
body.input = addCodexBridgeMessage(body.input, !!body.tools);
|
|
778
773
|
if (body.input) {
|
|
779
774
|
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
|
+
}
|
|
780
781
|
}
|
|
781
782
|
}
|
|
782
783
|
const reasoningConfig = resolveReasoningConfig(normalizedModel, body);
|
|
@@ -2080,13 +2081,7 @@ var AicodewithCodexAuthPlugin = async (ctx) => {
|
|
|
2080
2081
|
return;
|
|
2081
2082
|
if (isCodexModel(input.model.id)) {
|
|
2082
2083
|
const next2 = { ...output.options };
|
|
2083
|
-
next2.
|
|
2084
|
-
...next2.providerOptions,
|
|
2085
|
-
openai: {
|
|
2086
|
-
...next2.providerOptions?.openai,
|
|
2087
|
-
store: false
|
|
2088
|
-
}
|
|
2089
|
-
};
|
|
2084
|
+
next2.store = false;
|
|
2090
2085
|
output.options = next2;
|
|
2091
2086
|
return;
|
|
2092
2087
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-aicodewith-auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.59",
|
|
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",
|