@kenkaiiii/gg-agent 5.44.0 → 5.44.1

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.d.cts CHANGED
@@ -55,6 +55,13 @@ interface AgentToolCallEndEvent {
55
55
  details?: unknown;
56
56
  isError: boolean;
57
57
  durationMs: number;
58
+ /**
59
+ * Set only when the call failed schema validation: how many consecutive
60
+ * times this tool produced this same validation error. 1 means the model
61
+ * still has room to self-correct; 3 is the threshold that ends the turn.
62
+ * Logged so a retry loop shows up as a count instead of identical lines.
63
+ */
64
+ invalidArgAttempt?: number;
58
65
  }
59
66
  interface AgentTurnTiming {
60
67
  /** Logical turn start, before context transforms or provider retries. Unix epoch milliseconds. */
package/dist/index.d.ts CHANGED
@@ -55,6 +55,13 @@ interface AgentToolCallEndEvent {
55
55
  details?: unknown;
56
56
  isError: boolean;
57
57
  durationMs: number;
58
+ /**
59
+ * Set only when the call failed schema validation: how many consecutive
60
+ * times this tool produced this same validation error. 1 means the model
61
+ * still has room to self-correct; 3 is the threshold that ends the turn.
62
+ * Logged so a retry loop shows up as a count instead of identical lines.
63
+ */
64
+ invalidArgAttempt?: number;
58
65
  }
59
66
  interface AgentTurnTiming {
60
67
  /** Logical turn start, before context transforms or provider retries. Unix epoch milliseconds. */
package/dist/index.js CHANGED
@@ -1134,6 +1134,7 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
1134
1134
  let resultContent;
1135
1135
  let details;
1136
1136
  let isError = false;
1137
+ let invalidArgAttempt;
1137
1138
  const tool = options.toolMap.get(toolCall.name);
1138
1139
  if (!tool) {
1139
1140
  resultContent = `Unknown tool: ${toolCall.name}`;
@@ -1168,6 +1169,7 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
1168
1169
  const failureKey = `${toolCall.name}:${prettyError}`;
1169
1170
  const failureCount = (options.invalidToolArgumentCounts.get(failureKey) ?? 0) + 1;
1170
1171
  options.invalidToolArgumentCounts.set(failureKey, failureCount);
1172
+ invalidArgAttempt = failureCount;
1171
1173
  resultContent = `Invalid arguments for tool \`${toolCall.name}\`:
1172
1174
  ` + prettyError + "\nRe-issue the call with each field as the correct type.";
1173
1175
  if (failureCount >= 3) {
@@ -1198,7 +1200,8 @@ async function executeSingleToolCall(toolCall, options, pushEvent) {
1198
1200
  result: toolResultPreview(resultContent),
1199
1201
  details,
1200
1202
  isError,
1201
- durationMs
1203
+ durationMs,
1204
+ ...invalidArgAttempt === void 0 ? {} : { invalidArgAttempt }
1202
1205
  });
1203
1206
  return { toolCallId: toolCall.id, content: resultContent, isError };
1204
1207
  }