| 851 | /** An edit batch that could not be applied. Carries the current stored source |
| 852 | * so the model can rebuild its edits without a `show-artifact` round trip. */ |
| 853 | const editRejectedResult = (reason: string, currentCode: string): McpToolResult => ({ |
| 854 | content: [ |
| 855 | { |
| 856 | type: "text", |
| 857 | text: [ |
| 858 | `edit-artifact rejected: ${reason}`, |
| 859 | "Nothing was changed. The artifact's current source is in structuredContent.code — build the retry against it.", |
| 860 | ].join("\n"), |
| 861 | }, |
| 862 | ], |
| 863 | structuredContent: { status: "error", error: reason, code: currentCode }, |
| 864 | isError: true, |
| 865 | }); |
| 866 | |
| 867 | /** `execute-action` was handed something other than a single proxy-shaped tool |
| 868 | * call. Names the contract rather than just refusing, since the reader is |