(relPath: string, kind: 'unread' | 'stale')
| 107 | |
| 108 | /** The observation the model receives when the gate refuses a mutation. */ |
| 109 | export function buildGateMessage(relPath: string, kind: 'unread' | 'stale'): string { |
| 110 | if (kind === 'unread') { |
| 111 | return ( |
| 112 | `[ACCESS_DENIED] You attempted to modify "${relPath}" without reading it first. ` + |
| 113 | `Call read_file on this exact path, understand its current contents, then retry the edit. ` + |
| 114 | `(grep results are NOT sufficient — they show isolated lines, not the file.)` |
| 115 | ); |
| 116 | } |
| 117 | return ( |
| 118 | `[ACCESS_DENIED] "${relPath}" changed on disk AFTER you last read it ` + |
| 119 | `(another tool, command, or the user modified it). Your knowledge of this file is stale. ` + |
| 120 | `Call read_file on it again, then retry the edit against the current contents.` |
| 121 | ); |
| 122 | } |
no outgoing calls
no test coverage detected