From d5b8019fb13503ba65c8f71c9b88ce49a8273c2f Mon Sep 17 00:00:00 2001 From: Simon <10131203+gaomeng1900@users.noreply.github.com> Date: Tue, 13 Jan 2026 14:14:56 +0800 Subject: [PATCH 1/2] chore: better docs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- packages/page-agent/src/utils/normalize.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/page-agent/src/utils/normalize.ts b/packages/page-agent/src/utils/normalize.ts index a8b88ea..8709895 100644 --- a/packages/page-agent/src/utils/normalize.ts +++ b/packages/page-agent/src/utils/normalize.ts @@ -120,9 +120,9 @@ function safeJsonParse(input: any): any { } /** - * Retrieve the JSON part from a string. - * - treat content between the first `{` and the last `}` as JSON. - * - try to parse as JSON, return the parsed result if successful, otherwise return null. + * Extract and parse JSON from a string. + * - Treat content between the first `{` and the last `}` as JSON. + * - Try to parse that content as JSON and return the parsed value (object/array/primitive) if successful, otherwise return null. */ function retrieveJsonFromString(str: string): any { try { From 35d1fd1166940d70da7d36fc99fd64c399a54524 Mon Sep 17 00:00:00 2001 From: Simon <10131203+gaomeng1900@users.noreply.github.com> Date: Tue, 13 Jan 2026 14:16:51 +0800 Subject: [PATCH 2/2] chore: better erroring Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- packages/llms/src/OpenAIClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/llms/src/OpenAIClient.ts b/packages/llms/src/OpenAIClient.ts index be6f3af..9fe44b9 100644 --- a/packages/llms/src/OpenAIClient.ts +++ b/packages/llms/src/OpenAIClient.ts @@ -145,7 +145,7 @@ export class OpenAIClient implements LLMClient { const argString = normalizedChoice.message?.tool_calls?.[0]?.function?.arguments if (!argString) { throw new InvokeError( - InvokeErrorType.NO_TOOL_CALL, + InvokeErrorType.INVALID_TOOL_ARGS, 'No tool call arguments found', normalizedData )