@kenkaiiii/gg-agent 5.57.0 → 5.57.2

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.cjs CHANGED
@@ -133,6 +133,17 @@ function isAbortError(err) {
133
133
  const msg = err.message.toLowerCase();
134
134
  return msg.includes("aborted") || msg.includes("abort");
135
135
  }
136
+ function stripNullArguments(value) {
137
+ if (Array.isArray(value)) return value.map(stripNullArguments);
138
+ if (value !== null && typeof value === "object") {
139
+ const out = {};
140
+ for (const [key, entry] of Object.entries(value)) {
141
+ if (entry !== null) out[key] = stripNullArguments(entry);
142
+ }
143
+ return out;
144
+ }
145
+ return value;
146
+ }
136
147
  function isContextOverflow(err) {
137
148
  if (!(err instanceof Error)) return false;
138
149
  const overflowStatus = err.statusCode;
@@ -1280,7 +1291,17 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
1280
1291
  isError = true;
1281
1292
  } else {
1282
1293
  try {
1283
- const parsed = tool.parameters.parse(toolCall.args);
1294
+ let parsed;
1295
+ try {
1296
+ parsed = tool.parameters.parse(toolCall.args);
1297
+ } catch (originalError) {
1298
+ if (tool.rawInputSchema) throw originalError;
1299
+ try {
1300
+ parsed = tool.parameters.parse(stripNullArguments(toolCall.args));
1301
+ } catch {
1302
+ throw originalError;
1303
+ }
1304
+ }
1284
1305
  const callerSignal = options.signal;
1285
1306
  const toolTimeout = AbortSignal.timeout(tool.timeoutMs ?? DEFAULT_TOOL_TIMEOUT_MS);
1286
1307
  const ctx = {