(filePath: string, language: string, issues: SyntaxIssue[])
| 115 | |
| 116 | /** Pure: the observation the model receives on refusal. */ |
| 117 | export function buildSyntaxRejectMessage(filePath: string, language: string, issues: SyntaxIssue[]): string { |
| 118 | const head = issues[0]; |
| 119 | const more = issues.length > 1 ? ` (+${issues.length - 1} more)` : ''; |
| 120 | const what = head.kind === 'missing' ? 'missing token' : 'syntax error'; |
| 121 | return ( |
| 122 | `[SYNTAX_REJECTED] This edit would break ${filePath}: ${language} ${what} at line ${head.line}` + |
| 123 | (head.excerpt ? `: "${head.excerpt}"` : '') + more + '. ' + |
| 124 | `The file on disk was NOT modified. Re-check your old_string/new_string boundaries ` + |
| 125 | `(a brace, quote, or tag is likely unbalanced), fix the edit so the full file parses, then retry.` |
| 126 | ); |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Orchestrator used by Transaction.write / multi_file_edit. |
no outgoing calls
no test coverage detected