@oh-my-pi/pi-agent-core 18.4.10 → 18.4.11

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [18.4.11] - 2026-10-02
6
+
7
+ ### Fixed
8
+
9
+ - Fixed lenient argument validation for tools such as `yield`: malformed tool-call JSON is now reported to the model instead of causing the tool to run with empty arguments.
10
+
5
11
  ## [18.4.10] - 2026-10-02
6
12
 
7
13
  ### Fixed
@@ -1007,7 +1007,7 @@ export interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any
1007
1007
  * before ordinary dispatch commits its result.
1008
1008
  */
1009
1009
  speculation?: ToolSpeculationPolicy;
1010
- /** If true, argument validation errors are non-fatal: raw args are passed to execute() instead of returning an error to the LLM. */
1010
+ /** If true, schema validation errors are non-fatal: raw args are passed to execute() instead of returning an error to the LLM. Malformed argument JSON still returns the parse error. */
1011
1011
  lenientArgValidation?: boolean;
1012
1012
  /**
1013
1013
  * Whether the agent loop may abort this tool mid-execution — or skip it
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-agent-core",
4
- "version": "18.4.10",
4
+ "version": "18.4.11",
5
5
  "description": "General-purpose agent with transport abstraction, state management, and attachment support",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": {
@@ -38,16 +38,16 @@
38
38
  "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
39
39
  },
40
40
  "dependencies": {
41
- "@oh-my-pi/pi-ai": "18.4.10",
42
- "@oh-my-pi/pi-catalog": "18.4.10",
43
- "@oh-my-pi/pi-natives": "18.4.10",
44
- "@oh-my-pi/pi-utils": "18.4.10",
45
- "@oh-my-pi/pi-wire": "18.4.10",
46
- "@oh-my-pi/snapcompact": "18.4.10",
41
+ "@oh-my-pi/pi-ai": "18.4.11",
42
+ "@oh-my-pi/pi-catalog": "18.4.11",
43
+ "@oh-my-pi/pi-natives": "18.4.11",
44
+ "@oh-my-pi/pi-utils": "18.4.11",
45
+ "@oh-my-pi/pi-wire": "18.4.11",
46
+ "@oh-my-pi/snapcompact": "18.4.11",
47
47
  "@opentelemetry/api": "^1.9.1"
48
48
  },
49
49
  "devDependencies": {
50
- "@oh-my-pi/omptype": "18.4.10",
50
+ "@oh-my-pi/omptype": "18.4.11",
51
51
  "@opentelemetry/context-async-hooks": "^2.9.0",
52
52
  "@opentelemetry/sdk-trace-base": "^2.9.0",
53
53
  "@types/bun": "^1.3.14"
package/src/agent-loop.ts CHANGED
@@ -2907,13 +2907,14 @@ async function prepareToolCallDispatch(
2907
2907
  }
2908
2908
  return validateToolArguments(tool, { ...toolCall, arguments: args });
2909
2909
  } catch (validationError) {
2910
- if (tool?.lenientArgValidation) {
2910
+ // Lenience covers schema mismatches; a parse failure has no args to hand over.
2911
+ const parseFailed = "__parseError" in args;
2912
+ if (tool?.lenientArgValidation && !parseFailed) {
2911
2913
  const fallback = { ...args };
2912
- delete fallback.__parseError;
2913
2914
  delete fallback.__rawJson;
2914
2915
  return fallback;
2915
2916
  }
2916
- entry.args = "__parseError" in args ? { __parseError: args.__parseError } : args;
2917
+ entry.args = parseFailed ? { __parseError: args.__parseError } : args;
2917
2918
  entry.validationErrorMessage =
2918
2919
  validationError instanceof Error ? validationError.message : String(validationError);
2919
2920
  return undefined;
@@ -714,12 +714,12 @@ export class SpeculativeOperationCoordinator {
714
714
  try {
715
715
  validatedArgs = validateToolArguments(tool, toolCall);
716
716
  } catch {
717
- if (!tool.lenientArgValidation) {
717
+ // Lenience covers schema mismatches; a parse failure has no args to hand over.
718
+ if (!tool.lenientArgValidation || "__parseError" in toolCall.arguments) {
718
719
  this.ineligible(toolCall, "tool arguments are not valid", source, parentToolCallId);
719
720
  return undefined;
720
721
  }
721
- validatedArgs = { ...(toolCall.arguments as Record<string, unknown>) };
722
- delete validatedArgs.__parseError;
722
+ validatedArgs = { ...toolCall.arguments };
723
723
  delete validatedArgs.__rawJson;
724
724
  }
725
725
  let executionArgs: Record<string, unknown>;
package/src/types.ts CHANGED
@@ -1143,7 +1143,7 @@ export interface AgentTool<
1143
1143
  * before ordinary dispatch commits its result.
1144
1144
  */
1145
1145
  speculation?: ToolSpeculationPolicy;
1146
- /** If true, argument validation errors are non-fatal: raw args are passed to execute() instead of returning an error to the LLM. */
1146
+ /** If true, schema validation errors are non-fatal: raw args are passed to execute() instead of returning an error to the LLM. Malformed argument JSON still returns the parse error. */
1147
1147
  lenientArgValidation?: boolean;
1148
1148
  /**
1149
1149
  * Whether the agent loop may abort this tool mid-execution — or skip it