You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 54757c0
Browse filesBrowse the repository at this point in the historyBrowse files
fix(pty): retain output by line and enforce buffer limits
Store retained output as lines so counts are constant-time and reads and
searches avoid splitting the full buffer. Trim discarded lines in one batch
and find the exit-notification tail with a single read. Normalize negative
read and search offsets, including the tool's next-page hint.
Intentional contract changes: honor PTY_MAX_BUFFER_LINES alongside
PTY_MAX_BUFFER_SIZE, retaining whole lines until either limit is reached;
only a single oversized line is sliced to its tail. Report byteLength as
UTF-8 bytes instead of UTF-16 code units. Remove the exported no-op
RingBuffer.flush(). Invalid or non-positive limits fall back to the
existing defaults.
An oversized final line that ends with a newline stays visible to pty_read
and exit notifications. Reads use native slice pagination, and the
line-density explanation lives in the README rather than the tool prompt.
|`PTY_MAX_BUFFER_LINES`|`50000`| Maximum lines to keep in output buffer per session |
295
+
|`PTY_MAX_BUFFER_SIZE`|`1000000`| Maximum characters to keep in output buffer per session |
295
296
|`PTY_WEB_HOSTNAME`|`::1`| Hostname for the web server to bind to (IPv6 loopback by default) |
296
297
|`PTY_WEB_PORT`|`0` (random) | Port for the web server (0 = random port) |
297
298
299
+
The buffer discards older whole lines when either limit is exceeded, whichever comes first. A single oversized line keeps only its tail. With the default character limit, 50,000 lines fit only when they average at most 20 characters including newlines. Invalid or non-positive limits use the defaults.
300
+
298
301
### Permissions
299
302
300
303
This plugin respects OpenCode's [permission settings](https://opencode.ai/docs/permissions/) for the `bash` tool. Commands spawned via `pty_spawn` are checked against your `permission.bash` configuration.
constpaginationMessage=`(${result.matches.length} of ${result.totalMatches} matches shown. Use offset=${offset+result.matches.length} to see more.)`
130
+
constpaginationMessage=`(${result.matches.length} of ${result.totalMatches} matches shown. Use offset=${result.offset+result.matches.length} to see more.)`
131
131
constendMessage=`(${result.totalMatches} match${result.totalMatches===1 ? '' : 'es'} from ${result.totalLines} total lines)`
Copy file name to clipboardExpand all lines: src/plugin/pty/tools/read.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Returns:
14
14
- Total line count in the buffer
15
15
- Indicator if more lines are available
16
16
17
-
The buffer stores up to PTY_MAX_BUFFER_LINES (default: 50000) lines. Older lines are discarded when the limit is reached.
17
+
The buffer stores up to PTY_MAX_BUFFER_LINES (default: 50000) lines or PTY_MAX_BUFFER_SIZE (default: 1000000) characters, whichever limit is reached first. Older lines are discarded whole; a single oversized line keeps only its tail.
18
18
19
19
Pattern Filtering:
20
20
- When `pattern` is set, lines are FILTERED FIRST using the regex, then offset/limit apply to the MATCHES
0 commit comments