@koreanhole/opencodex 3.2.30 → 3.2.32

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koreanhole/opencodex",
3
- "version": "3.2.30",
3
+ "version": "3.2.32",
4
4
  "description": "Full opencodex runtime with Cline 2.2.0+ JSON and Gemini CLI headless provider adapters",
5
5
  "type": "module",
6
6
  "main": "./bin/package-main.mjs",
@@ -1091,7 +1091,7 @@ async function runAttempt(
1091
1091
  if (message.severity === "warning") continue;
1092
1092
  const messageText = safeMessage(message.message, "Gemini headless turn failed.");
1093
1093
  finish({ type: "error", message: messageText, ...classifyError(messageText) });
1094
- continue;
1094
+ break;
1095
1095
  }
1096
1096
  if (type === "result") {
1097
1097
  usage = usageFromStats(message.stats, observedModel ?? (input.modelId === "default" ? undefined : input.modelId)) ?? usage;
@@ -1113,7 +1113,7 @@ async function runAttempt(
1113
1113
  const messageText = safeMessage(error?.message ?? "Gemini headless turn failed.", "Gemini headless turn failed.");
1114
1114
  finish({ type: "error", message: messageText, ...classifyError(messageText) });
1115
1115
  }
1116
- continue;
1116
+ break;
1117
1117
  }
1118
1118
  // tool_use/tool_result are Gemini's internal native-tool records.
1119
1119
  }
@@ -23,7 +23,16 @@ const WRAPPED = Symbol.for("opencodex.gemini.stripEmptyTools.request");
23
23
 
24
24
  function hasToolType(entry) {
25
25
  if (!entry || typeof entry !== "object" || Array.isArray(entry)) return false;
26
- return TOOL_TYPE_KEYS.some(key => entry[key] !== null && entry[key] !== undefined);
26
+ return TOOL_TYPE_KEYS.some(key => isInitializedMember(key, entry[key]));
27
+ }
28
+
29
+ // A member counts only with the shape its key declares: a non-empty list for
30
+ // function declarations, any non-array object for the message spellings.
31
+ function isInitializedMember(key, value) {
32
+ if (key === "functionDeclarations" || key === "function_declarations") {
33
+ return Array.isArray(value) && value.length > 0;
34
+ }
35
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
27
36
  }
28
37
 
29
38
  function isEmptyObject(value) {