(document: PseudocodeDocument, answer: string)
| 110 | * Total: never throws, and an empty answer is a refusal like any other. |
| 111 | */ |
| 112 | export function applyRefinement(document: PseudocodeDocument, answer: string): RefineOutcome { |
| 113 | const cleaned = unfence(answer); |
| 114 | const applied = applyRefinedPseudocode(document, cleaned); |
| 115 | if (applied === undefined) { |
| 116 | return { kind: 'refused', reason: refusalReason(document, answer) }; |
| 117 | } |
| 118 | return { kind: 'applied', document: applied }; |
| 119 | } |
| 120 | |
| 121 | /** The text a rewrite is asked to rephrase. The block, as a reader copies it. */ |
| 122 | export function refineSubjectText(document: PseudocodeDocument): string { |
no test coverage detected