(
input: ShellRunWriteInput,
outcome: {
inputQueued: boolean;
resizeApplied: boolean;
resizeChanged: boolean;
failed?: boolean;
},
)
| 71 | } |
| 72 | |
| 73 | export function ptyControlOperation( |
| 74 | input: ShellRunWriteInput, |
| 75 | outcome: { |
| 76 | inputQueued: boolean; |
| 77 | resizeApplied: boolean; |
| 78 | resizeChanged: boolean; |
| 79 | failed?: boolean; |
| 80 | }, |
| 81 | ): Extract<ShellRunOperation, { kind: 'pty_control' }> { |
| 82 | const terminalInput = |
| 83 | input.input !== undefined |
| 84 | ? Buffer.byteLength(input.input, 'utf8') |
| 85 | : input.actions |
| 86 | ? encodedTerminalInputActionsByteLength(input.actions) |
| 87 | : undefined; |
| 88 | return { |
| 89 | kind: 'pty_control', |
| 90 | failed: outcome.failed === true, |
| 91 | ...(terminalInput !== undefined |
| 92 | ? { input: { bytes: terminalInput, queued: outcome.inputQueued } } |
| 93 | : {}), |
| 94 | ...(input.size |
| 95 | ? { |
| 96 | resize: { |
| 97 | cols: input.size.cols, |
| 98 | rows: input.size.rows, |
| 99 | applied: outcome.resizeApplied, |
| 100 | changed: outcome.resizeChanged, |
| 101 | }, |
| 102 | } |
| 103 | : {}), |
| 104 | }; |
| 105 | } |
| 106 | |
| 107 | function terminalResultStatus(status: ShellRunStatus): TerminalToolResult['status'] { |
| 108 | switch (status) { |
no test coverage detected