opencode-aicodewith-auth 0.1.47 → 0.1.49
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 +34 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -694,13 +694,28 @@ function resolveInclude(body) {
|
|
|
694
694
|
}
|
|
695
695
|
return include;
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function sanitizeItemIds(input) {
|
|
698
|
+
const outputCallIds = new Set;
|
|
699
|
+
for (const item of input) {
|
|
700
|
+
if (item.type === "function_call_output" || item.type === "local_shell_call_output" || item.type === "custom_tool_call_output") {
|
|
701
|
+
const callId = item.call_id;
|
|
702
|
+
if (typeof callId === "string" && callId.trim().length > 0) {
|
|
703
|
+
outputCallIds.add(callId.trim());
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
698
707
|
return input.filter((item) => item.type !== "item_reference").map((item) => {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
return
|
|
708
|
+
const isCallItem = item.type === "function_call" || item.type === "local_shell_call" || item.type === "custom_tool_call";
|
|
709
|
+
if (!isCallItem || !("id" in item)) {
|
|
710
|
+
return item;
|
|
702
711
|
}
|
|
703
|
-
|
|
712
|
+
const callId = item.call_id;
|
|
713
|
+
const hasMatchingOutput = typeof callId === "string" && callId.trim().length > 0 && outputCallIds.has(callId.trim());
|
|
714
|
+
if (hasMatchingOutput) {
|
|
715
|
+
return item;
|
|
716
|
+
}
|
|
717
|
+
const { id, ...rest } = item;
|
|
718
|
+
return rest;
|
|
704
719
|
});
|
|
705
720
|
}
|
|
706
721
|
function filterOpenCodeSystemPrompts(input) {
|
|
@@ -750,9 +765,10 @@ async function transformRequestBody(body, codexInstructions) {
|
|
|
750
765
|
});
|
|
751
766
|
body.model = normalizedModel;
|
|
752
767
|
body.stream = true;
|
|
768
|
+
body.store = false;
|
|
753
769
|
body.instructions = codexInstructions;
|
|
754
770
|
if (body.input && Array.isArray(body.input)) {
|
|
755
|
-
body.input =
|
|
771
|
+
body.input = sanitizeItemIds(body.input);
|
|
756
772
|
body.input = filterOpenCodeSystemPrompts(body.input);
|
|
757
773
|
body.input = addCodexBridgeMessage(body.input, !!body.tools);
|
|
758
774
|
if (body.input) {
|
|
@@ -970,6 +986,9 @@ function transformClaudeResponse(response) {
|
|
|
970
986
|
if (!response.body) {
|
|
971
987
|
return response;
|
|
972
988
|
}
|
|
989
|
+
if (!response.ok) {
|
|
990
|
+
return response;
|
|
991
|
+
}
|
|
973
992
|
const reader = response.body.getReader();
|
|
974
993
|
const decoder = new TextDecoder;
|
|
975
994
|
const encoder = new TextEncoder;
|
|
@@ -2026,6 +2045,15 @@ var AicodewithCodexAuthPlugin = async (ctx) => {
|
|
|
2026
2045
|
if (input.model.providerID !== PROVIDER_ID2)
|
|
2027
2046
|
return;
|
|
2028
2047
|
if (isCodexModel(input.model.id)) {
|
|
2048
|
+
const next2 = { ...output.options };
|
|
2049
|
+
next2.providerOptions = {
|
|
2050
|
+
...next2.providerOptions,
|
|
2051
|
+
openai: {
|
|
2052
|
+
...next2.providerOptions?.openai,
|
|
2053
|
+
store: false
|
|
2054
|
+
}
|
|
2055
|
+
};
|
|
2056
|
+
output.options = next2;
|
|
2029
2057
|
return;
|
|
2030
2058
|
}
|
|
2031
2059
|
if (!input.model.id?.startsWith("claude-"))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-aicodewith-auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.49",
|
|
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",
|