( record: ShellRunRecord, operation?: ShellRunOperation, )
| 54 | } |
| 55 | |
| 56 | export function shellRunContent( |
| 57 | record: ShellRunRecord, |
| 58 | operation?: ShellRunOperation, |
| 59 | ): ShellRunToolResult { |
| 60 | const state = shellRunSnapshotContent(record); |
| 61 | if (!operation) return state; |
| 62 | if (operation.kind === 'stop') return { ...state, operation }; |
| 63 | if (state.mode !== 'pty') { |
| 64 | throw new Error('PTY control operation requires PTY ShellRun state'); |
| 65 | } |
| 66 | return { ...state, operation }; |
| 67 | } |
| 68 | |
| 69 | export function compactShellRunContent(record: ShellRunRecord): ShellRunToolResult { |
| 70 | return shellRunStateContent(record); |
no test coverage detected