Explorar el Código

repair tool calls when casing is wrong

Dax Raad hace 5 meses
padre
commit
e69d10b6c9
Se han modificado 1 ficheros con 11 adiciones y 0 borrados
  1. 11 0
      packages/opencode/src/session/index.ts

+ 11 - 0
packages/opencode/src/session/index.ts

@@ -1007,6 +1007,17 @@ export namespace Session {
         }
         }
       },
       },
       async experimental_repairToolCall(input) {
       async experimental_repairToolCall(input) {
+        const lower = input.toolCall.toolName.toLowerCase()
+        if (lower !== input.toolCall.toolName && tools[lower]) {
+          log.info("repairing tool call", {
+            tool: input.toolCall.toolName,
+            repaired: lower,
+          })
+          return {
+            ...input.toolCall,
+            toolName: lower,
+          }
+        }
         return {
         return {
           ...input.toolCall,
           ...input.toolCall,
           input: JSON.stringify({
           input: JSON.stringify({