pty_read
Read PTY session output incrementally with token-saving compression, and retrieve final assistant messages when long responses get truncated in the terminal.
Instructions
セッションの出力をトークン削減して読む(既定は前回読取位置からの増分)。削減: 制御文字除去 / 反復圧縮 / head+tail 折りたたみ+復元ヒント+メタ併記。agent_transcript:true は agent session の直近完了ターンの最終 assistant メッセージを公開されたvendor記録から平文で返す。長い回答が screen tail で切れた時の回収用。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| raw | No | 削減せず生テキスト | |
| rtk | No | 直前コマンド別の自前 reducer(git/grep/pytest 等)で縮約 | |
| full | No | 増分でなく全文 | |
| wait | No | 完了まで待つ(dead / mark sentinel 自動検出 / until / 出力静止∧シェル復帰 / timeout) | |
| lines | No | 末尾 N 行のみ | |
| until | No | この文字列が出たら完了とみなす(既定はリテラル部分一致。`$ ` や `[..]` もそのまま探せる) | |
| screen | No | 描画済みスクリーン(TUI 向け) | |
| timeout | No | wait の最大待ち秒数 | |
| line_range | No | 全文からの行範囲 "A:B" | |
| session_id | Yes | ||
| until_regex | No | until を正規表現として扱う(既定 false=リテラル部分一致。メタ文字を使いたい時のみ true) | |
| operation_id | No | Claude operationの期待ID。agent_transcript:true時だけ指定し、古い別operationの結果を拒否する | |
| agent_transcript | No | agent session の直近完了ターンの最終 assistant メッセージを返す。Claudeはlaunch相関付きStop hook result、他vendorは通常transcriptを使う。長い回答がscreen tailで切れた時の回収用 |