| 1038 | /** An edit batch that could not be applied. Carries the current stored source |
| 1039 | * so the model can rebuild its edits without a `show-artifact` round trip. */ |
| 1040 | const editRejectedResult = (reason: string, currentCode: string): McpToolResult => ({ |
| 1041 | content: [ |
| 1042 | { |
| 1043 | type: "text", |
| 1044 | text: [ |
| 1045 | `edit-artifact rejected: ${reason}`, |
| 1046 | "Nothing was changed. The artifact's current source is in structuredContent.code — build the retry against it.", |
| 1047 | ].join("\n"), |
| 1048 | }, |
| 1049 | ], |
| 1050 | structuredContent: { status: "error", error: reason, code: currentCode }, |
| 1051 | isError: true, |
| 1052 | }); |
| 1053 | |
| 1054 | /** `execute-action` was handed something other than a single proxy-shaped tool |
| 1055 | * call. Names the contract rather than just refusing, since the reader is |