| 872 | /** An edit batch that could not be applied. Carries the current stored source |
| 873 | * so the model can rebuild its edits without a `show-artifact` round trip. */ |
| 874 | const editRejectedResult = (reason: string, currentCode: string): McpToolResult => ({ |
| 875 | content: [ |
| 876 | { |
| 877 | type: "text", |
| 878 | text: [ |
| 879 | `edit-artifact rejected: ${reason}`, |
| 880 | "Nothing was changed. The artifact's current source is in structuredContent.code — build the retry against it.", |
| 881 | ].join("\n"), |
| 882 | }, |
| 883 | ], |
| 884 | structuredContent: { status: "error", error: reason, code: currentCode }, |
| 885 | isError: true, |
| 886 | }); |
| 887 | |
| 888 | /** `execute-action` was handed something other than a single proxy-shaped tool |
| 889 | * call. Names the contract rather than just refusing, since the reader is |