mirror of
https://github.com/NCBM/plyngent.git
synced 2026-11-07 23:47:54 +08:00
core/config: document read_file L-range and prettier summaries
This commit is contained in:
@@ -85,7 +85,7 @@ Async SQLAlchemy + aiosqlite. `MemoryStore`: schema init (+ lightweight SQLite `
|
|||||||
Module-level `@tool` handlers. Call `set_workspace_root()` before use.
|
Module-level `@tool` handlers. Call `set_workspace_root()` before use.
|
||||||
|
|
||||||
- **`workspace`**: path resolve under primary root **or** temporary allowlist roots; path substring denylist; command basename denylist (CLI: timed human allow override, default deny on timeout; **not** skipped by YOLO); clearer deny messages.
|
- **`workspace`**: path resolve under primary root **or** temporary allowlist roots; path substring denylist; command basename denylist (CLI: timed human allow override, default deny on timeout; **not** skipped by YOLO); clearer deny messages.
|
||||||
- **`file`**: `read_file` (`with_lineno`, `max_chars`), `write_file`, `listdir`, `tree` (VCS + default noise dirs + optional `skip_dirs` / denylist walk), `glob_paths`, `grep_files` (regex, skip VCS/binary), `edit_replace` (`max_replaces`, reports remaining matches), `edit_lineno` (1-based range; only lines read via `with_lineno`; read state resets on any file write/edit/copy/move/delete), `copy_path` / `move_path` / `delete_path`, `new_temporary_workspace` (system temp allowlist; cleanup on chat exit; no session rebind), `get_truncated` (resume truncated `read_file`/`fetch` via `TRUNCATE_TOKEN`).
|
- **`file`**: `read_file` (`with_lineno`, `max_chars`; results start with a 1-based `L{begin}-{end}` range), `write_file`, `listdir`, `tree` (VCS + default noise dirs + optional `skip_dirs` / denylist walk), `glob_paths`, `grep_files` (regex, skip VCS/binary), `edit_replace` (`max_replaces`, reports remaining matches), `edit_lineno` (1-based range; only lines read via `with_lineno`; read state resets on any file write/edit/copy/move/delete), `copy_path` / `move_path` / `delete_path`, `new_temporary_workspace` (system temp allowlist; cleanup on chat exit; no session rebind), `get_truncated` (resume truncated `read_file`/`fetch` via `TRUNCATE_TOKEN`).
|
||||||
- **`process`**: `run_argv` (argv, no shell, timeout, optional stdin/env); `run_argv_batch` (serial steps, `pipe_out` on provider, `mix_stderr`, `stop_on_error`); PTY `open_pty` / `read_pty` / `write_pty` (literal) / `write_pty_keys` (escapes) / `ask_into_pty` (human→PTY only; `secret` no-echo; answer never in tool result) / `close_pty` (POSIX: `pty`+`fork`; Windows: ConPTY via `pywinpty` env marker dep).
|
- **`process`**: `run_argv` (argv, no shell, timeout, optional stdin/env); `run_argv_batch` (serial steps, `pipe_out` on provider, `mix_stderr`, `stop_on_error`); PTY `open_pty` / `read_pty` / `write_pty` (literal) / `write_pty_keys` (escapes) / `ask_into_pty` (human→PTY only; `secret` no-echo; answer never in tool result) / `close_pty` (POSIX: `pty`+`fork`; Windows: ConPTY via `pywinpty` env marker dep).
|
||||||
- PTY: backend in `pty_backend.py`; structured status (`alive`/`exit_code`/`data`); `read_pty(..., until=)` (**CSI sanitized** so host TTY is never reset); keys via `write_pty_keys` only (`\xHH`, `ctrl+x`, `key=esc`); secrets via `ask_into_pty` (not `write_pty` data); session limit/idle TTL/output budget; close terminate→kill.
|
- PTY: backend in `pty_backend.py`; structured status (`alive`/`exit_code`/`data`); `read_pty(..., until=)` (**CSI sanitized** so host TTY is never reset); keys via `write_pty_keys` only (`\xHH`, `ctrl+x`, `key=esc`); secrets via `ask_into_pty` (not `write_pty` data); session limit/idle TTL/output budget; close terminate→kill.
|
||||||
- CLI limit hooks: interactive confirm to raise tool-loop rounds, PTY session cap, or PTY output budget.
|
- CLI limit hooks: interactive confirm to raise tool-loop rounds, PTY session cap, or PTY output budget.
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Tool playbook still applies (see system). Hard constraints:
|
|||||||
use `run_argv_batch` for ordered pipelines.
|
use `run_argv_batch` for ordered pipelines.
|
||||||
- `edit_replace`: fix match / `max_replaces`; `edit_lineno` edits only lines read via \
|
- `edit_replace`: fix match / `max_replaces`; `edit_lineno` edits only lines read via \
|
||||||
`read_file(with_lineno=true)`, and line numbers reset after any file write.
|
`read_file(with_lineno=true)`, and line numbers reset after any file write.
|
||||||
|
- `read_file` results start with `L{begin}-{end}` (1-based lines; offset is 0-based).
|
||||||
- Truncated results carry a `TRUNCATE_TOKEN`; continue with `get_truncated`.
|
- Truncated results carry a `TRUNCATE_TOKEN`; continue with `get_truncated`.
|
||||||
- Prefer `fetch` for HTTP(S); private/LAN hosts need human policy allow (not YOLO).
|
- Prefer `fetch` for HTTP(S); private/LAN hosts need human policy allow (not YOLO).
|
||||||
- PTY secrets only via `ask_into_pty`; denylists and confirms still apply.
|
- PTY secrets only via `ask_into_pty`; denylists and confirms still apply.
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ raise `max_replaces` or narrow `old_string`.
|
|||||||
- `edit_lineno` edits only lines you read via `read_file(path, with_lineno=true)`; \
|
- `edit_lineno` edits only lines you read via `read_file(path, with_lineno=true)`; \
|
||||||
re-read with line numbers after any `edit_*` / `write_file` / copy/move/delete, \
|
re-read with line numbers after any `edit_*` / `write_file` / copy/move/delete, \
|
||||||
since line numbers go stale.
|
since line numbers go stale.
|
||||||
|
- `read_file` results start with a 1-based line range `L{begin}-{end}` (`offset` \
|
||||||
|
is 0-based); `with_lineno` shows per-line numbers instead.
|
||||||
- Truncated `read_file` / `fetch` results carry a `TRUNCATE_TOKEN`; use \
|
- Truncated `read_file` / `fetch` results carry a `TRUNCATE_TOKEN`; use \
|
||||||
`get_truncated` with it to keep reading (chains through truncations).
|
`get_truncated` with it to keep reading (chains through truncations).
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user