| 891 | /** An edit batch that could not be applied. Carries the current stored source |
| 892 | * so the model can rebuild its edits without a `show-artifact` round trip. */ |
| 893 | const editRejectedResult = (reason: string, currentCode: string): McpToolResult => ({ |
| 894 | content: [ |
| 895 | { |
| 896 | type: "text", |
| 897 | text: [ |
| 898 | `edit-artifact rejected: ${reason}`, |
| 899 | "Nothing was changed. The artifact's current source is in structuredContent.code — build the retry against it.", |
| 900 | ].join("\n"), |
| 901 | }, |
| 902 | ], |
| 903 | structuredContent: { status: "error", error: reason, code: currentCode }, |
| 904 | isError: true, |
| 905 | }); |
| 906 | |
| 907 | /** `execute-action` was handed something other than a single proxy-shaped tool |
| 908 | * call. Names the contract rather than just refusing, since the reader is |