Commit Graph

49 Commits

Author SHA1 Message Date
NCBM 38edc09854 core/lmproto: move Responses API into openai package
openai_compatible stays chat-completions-only; OpenAI provider uses lmproto.openai.OpenAIClient.
2026-07-15 20:52:17 +08:00
NCBM 3e20b1559c core/lmproto: add OpenAI Responses API models and client
POST/GET/DELETE /responses with stream events; helpers for output_text and function_call items.
2026-07-15 20:43:11 +08:00
NCBM c466d09173 core/process: cross-platform PTY via backend and pywinpty
POSIX openpty/fork and Windows ConPTY; win32 marker dep plus typings stub.
2026-07-15 20:01:43 +08:00
NCBM cf7d331634 core/agent: checkpoint tool rounds so /retry does not redo side effects
After each completed assistant+tool batch, persist and keep that prefix on
failure. Rollback only unfinished assistant/stream suffix. pending_retry
and /retry also apply when history ends with tool results (continue model
without re-executing tools).
2026-07-15 15:01:15 +08:00
NCBM 64d288a9b1 core/memory+cli: remember session LLM; readline prompts
Store provider_name/model on sessions (SQLite migrate); restore on
resume and persist on create//model//provider. Startup prefers session
selection over re-asking. ask/choose and provider/model pick use
readline with Tab completion when available.
2026-07-15 14:12:10 +08:00
NCBM 2052967824 core/config: default DeepSeek models v4-flash and v4-pro
When preset deepseek omits models, seed deepseek-v4-flash and
deepseek-v4-pro as text-capable entries for selection and docs.
2026-07-15 13:57:29 +08:00
NCBM fb61f6bc32 docs: README, example config, and Phase G completion notes
Document install, config, chat/one-shot, slash commands, workspace and
safety model. Add doc/plyngent.example.toml; refresh CLAUDE and architecture.
2026-07-15 13:51:11 +08:00
NCBM 0dc5c876ee core/process+cli: PTY hardening and config/log polish
Mark PTY master FD non-inheritable; run read_pty/close_pty via to_thread;
close_all PTY sessions on chat exit. Add --log-level; clearer invalid
TOML errors. Keep export/status free of provider secrets.
2026-07-15 13:48:58 +08:00
NCBM 723fa85879 core/cli: one-shot chat with -p/stdin and exit codes
Add plyngent chat -p/--prompt (and non-TTY stdin), --stream/--no-stream,
--yes, --quiet. Non-interactive mode uses NonInteractiveBackend and
disables limit prompts. Exit codes: 0 ok, 1 config, 2 cancelled, 3 failed.
2026-07-15 13:33:18 +08:00
NCBM ec5e6ab0f4 core/cli: multiline \"\"\" input and /edit via EDITOR
Add triple-quote block messages in the REPL and /edit to compose a turn
in $EDITOR (temp file). Empty multiline or empty edit cancels.
2026-07-15 13:29:00 +08:00
NCBM 5b0c9be90b core/cli: Click slash registry with awaitlet bridge
Register REPL slash commands as a Click Group (params, UsageError, help).
Dispatch via awaitlet.async_def so sync command bodies can awaitlet()
async memory/confirm work. Completer and /help derive from the registry.
2026-07-15 13:03:55 +08:00
NCBM 9d05988245 core/memory+cli: session rename, delete, and export
Add MemoryStore rename/delete with explicit message cleanup. Slash
commands /rename, /delete (confirm), /export md|json write transcripts
from DB; deleting the current session starts a fresh empty one.
2026-07-15 12:26:52 +08:00
NCBM 04d421a4b5 core/agent+cli: reasoning deltas, /stream and /verbose
Decode and stream reasoning_content as ReasoningDeltaEvent; keep it on
assistant messages. CLI shows dim reasoning, toggles stream/verbose, and
prints full tool results when verbose.
2026-07-15 12:11:19 +08:00
NCBM f77ac7eea8 core/prompting+tools: shared ask/choose/form and chat tools
Add process-wide prompting backends for interactive human I/O; wire CLI
limit/confirm/workspace prompts through it. Expose ask_user, choose_user,
and form_user under tools/chat and include them in DEFAULT_TOOLS.
2026-07-15 11:51:44 +08:00
NCBM 6e9e034de4 core/agent: derive pending_retry_text from trailing user message
Drop stored pending field; incomplete turns are just history ending in
UserChatMessage. Compact seeds use an assistant summary so they are not
mistaken for retryable orphans.
2026-07-15 11:27:29 +08:00
NCBM 00a8ed3a9c core/agent+cli: persist user immediately; /retry reuses DB turn
Keep incomplete user messages in memory/DB; roll back only
assistant/tool on failure. /retry and resume of orphan-user sessions
re-run without duplicating the user message.
2026-07-15 11:21:01 +08:00
NCBM b1223c8189 core/agent: calibrate soft-compact with last-request prompt_tokens
After the first model call, scale char-based token estimates by
API/resolved prompt size so budget checks track near-real tokens.
/compact uses the same calibration when available.
2026-07-15 11:11:15 +08:00
NCBM c9e805f38d core/agent+cli: treat last-request prompt_tokens as context size
context_tokens prefers API usage from the last model call; char est.
is only a pre-call fallback. Clarify billed turn/session totals in UI.
2026-07-15 11:07:52 +08:00
NCBM a61b536243 core/agent+cli: separate last-request usage from billed turn totals
Tool-loop rounds re-send history, so summed prompt tokens are billing
not context size. Track last_request_usage and label turn/session as
billed; clarify /status and end-of-turn lines.
2026-07-15 11:04:41 +08:00
NCBM 58041c6c87 core/agent+config: soft context budget in estimated tokens
Replace max_context_chars with max_context_tokens (default 200k est.
tokens via char/4); compact and /status use the token budget.
2026-07-15 10:58:01 +08:00
NCBM d2cab4198b core/cli: show estimated context tokens and usage source tags
/status adds context_tokens~=(est); docs note api/estimate/mixed labels.
2026-07-15 10:52:58 +08:00
NCBM d81e168f3b core/agent+cli: accumulate usage and show on turn end /status
ChatAgent tracks session_usage and last_turn_usage; CLI prints a quiet
token line after successful turns and includes totals in /status.
2026-07-15 10:48:07 +08:00
NCBM 53ac1c8d44 docs: drop edit_patch from roadmap
Model-generated patches are unreliable; keep line/string edit tools
instead of a patch apply path.
2026-07-15 10:24:06 +08:00
NCBM 0ab1a7f953 core/tools: include VCS_TOOLS in DEFAULT_TOOLS
Wire vcs tools into the default agent registry and document the
extensible backend design.
2026-07-15 10:22:07 +08:00
NCBM f1ea392c1c core/tools: register glob_paths and grep_files in DEFAULT_TOOLS
Wire new search tools into FILE_TOOLS and document them.
2026-07-15 10:15:26 +08:00
NCBM 6e1820d150 docs: roadmap notes for Phase D and usage v2 in F
Record that context is char-estimate-only for now; defer real usage
accounting to Phase F (no separate local-tokenizer stage).
2026-07-15 10:12:08 +08:00
NCBM 001619d9dd core/cli+agent: /compact and resume latest by workspace recency
Soft-compact history, model-summarize without tools, seed a new session;
/resume with no id loads the lately-used session for this workspace.
2026-07-15 10:03:22 +08:00
NCBM a7d9c9879b core/cli+agent: run TTY confirms off the event loop
Max-rounds and destructive-tool prompts use asyncio.to_thread with
cancel paused on the main thread so multi-tool turns no longer look
like user cancel. Hooks may be sync or async.
2026-07-15 09:41:32 +08:00
NCBM b80ebf783a core/cli+memory: prompt on session workspace mismatch
When /resume or --session hits a different directory, ask keep (switch
tools root), update binding to current, or abort. Legacy unbound
sessions attach to the current workspace.
2026-07-15 09:33:39 +08:00
NCBM ede7dcccd6 core/cli: scope sessions to workspace directory
Create/resume/list sessions for the current workspace; resume rejects
mismatched workspace bindings.
2026-07-15 00:01:00 +08:00
NCBM f31032b801 core/agent+cli: wire max_context_chars and re-raise CancelledError
Propagate context budget from [agent] config; preserve cancel through
tool invoke for mid-turn interruption.
2026-07-14 23:42:55 +08:00
NCBM bcfd1098f8 core/cli+config: confirm destructive tools and path denylist
Wire [agent] confirm_destructive / path_denylist into CLI; default
confirm prompt denies; document Phase C safety hooks.
2026-07-14 23:30:17 +08:00
NCBM 81a30d0e4d core/tools/file: add edit_lineno line-range edit tool
1-based inclusive range replace/delete/append; document Phase B agent
and tool updates in CLAUDE.md.
2026-07-14 23:24:34 +08:00
NCBM e063efda20 core/agent: fix Phase A streaming await bug and polish
Do not await async generators for raw SSE; close stream on cancel;
merge tool calls without relying only on finish_reason; quieter tool
output; /status slash command.
2026-07-14 22:22:14 +08:00
NCBM f26e13c2c1 core/tools/file: copy, move, and delete paths via shutil
Workspace-bound copy_path/move_path/delete_path for files and
directories; overwrite and recursive flags where needed.
2026-07-14 21:47:57 +08:00
NCBM 25ff849efe core/cli: level-1 cancel of in-flight turns via Ctrl+C
Run turns as asyncio tasks; SIGINT cancels the task; agent rolls back
and keeps pending_retry_text for /retry.
2026-07-14 21:02:54 +08:00
NCBM e0916a6352 core/agent+cli: defer DB write until turn success; auto/manual retry
Failed turns roll back memory and keep pending_retry_text; persist only
after success. CLI auto-retries 10s/20s/30s (cancellable) and /retry.
2026-07-14 20:56:08 +08:00
NCBM f079ab73df core/tools/file: add tree with depth, entry, and VCS filters
Workspace-relative tree; always skip VCS dirs; skip hidden dirs by
default; max_depth and max_entries caps.
2026-07-14 20:19:49 +08:00
NCBM a634021a80 core/cli: interactive continue prompts for loop and PTY limits
on_limit raises tool-round allowance; PTY session/budget limits can
prompt to raise; MaxRoundsEvent.continued marks extended runs.
2026-07-14 19:53:34 +08:00
NCBM 1b53b415b6 core/tools/process: harden PTY sessions for agents
Structured alive/exit_code/data reads; until= wait; SIGTERM then
SIGKILL; exec-fail marker; session limit, idle TTL, output budget.
2026-07-14 19:47:32 +08:00
NCBM 73c11cee36 core/tools/process: run_command stdin/env and write_pty
Optional stdin and env overlay for run_command; write_pty for
interactive PTY input.
2026-07-14 19:36:46 +08:00
NCBM bd6f8f5d9a core/cli: resume sessions, history, editline Tab, higher tool rounds
Default to file SQLite DB and latest session; /history and /rounds;
bind Tab for libedit; max tool rounds default 32.
2026-07-14 19:15:12 +08:00
NCBM 5d90e48618 core/cli: open config in $EDITOR with optional prompt
shlex-split EDITOR (e.g. codium --wait); prompt when no providers;
add config path/edit commands.
2026-07-14 18:44:32 +08:00
NCBM a017adda39 core/cli: readline Tab completion and persistent history
Complete slash commands and provider/model/tools args; store history
under platformdirs user data.
2026-07-14 18:33:34 +08:00
NCBM 054b2e8837 docs: document CLI in CLAUDE.md 2026-07-14 18:29:46 +08:00
NCBM 2d589eb36f docs: document tools package in CLAUDE.md 2026-07-14 18:20:32 +08:00
NCBM b72a9a8c1c docs: document agent package in CLAUDE.md 2026-07-14 17:45:47 +08:00
NCBM 27c6cb77f5 docs: update CLAUDE.md for memory, runtime, and pytest 2026-07-14 17:25:22 +08:00
NCBM 123aadeadf docs: add architecture notes and development principles 2026-07-14 17:19:31 +08:00