Commit Graph

46 Commits

Author SHA1 Message Date
NCBM fc74b271bd core/cli: richer Tab completion for slash commands
Complete /todos actions and todo ids, session ids for /resume|/delete
(from cache after /sessions), /rounds hints, and --flags. Pass prior
tokens so multi-arg completion works.
2026-07-18 19:04:45 +08:00
NCBM 1012894f0d core/cli: multi-line boxed tool confirm prompts
Echo a terminal-width box with wrapped reason (argv / -c code) before a
short Allow? y/N prompt so shell confirms are not jammed on one line.
2026-07-18 18:41:00 +08:00
NCBM fb5b9f187b core/cli: /history last and --full with Rich markdown 2026-07-18 13:02:46 +08:00
NCBM 2368e46efd core/config+cli: /model --persist and /models --persist to TOML
ensure_model / merge_models update the provider catalog in memory; --persist
writes plyngent.toml so next launch has a warmer model list.
2026-07-18 01:32:06 +08:00
NCBM e04fda4bc6 core/agent+cli: fix compact session restore and persist cursor
After /compact, reload seed from DB so _persist_from matches stored rows.
rebuild_client preserves the checkpoint via replace_messages. Clarify that
the active session is summary-only and full history stays on the old id.
2026-07-18 00:25:13 +08:00
NCBM f7a562740e core/cli: 10 auto-retries with 5/10/15/20 then +10s waits
default_retry_delays builds (5,10,15,20,30,…80) for DEFAULT_MAX_AUTO_RETRIES=10.
2026-07-17 15:36:29 +08:00
NCBM b8ed9e0ee9 core/cli: assistant/reasoning on new lines; flush markdown on source change
Labels end with a newline before content. Switching reasoning↔assistant or
hitting tools/errors flushes the assistant markdown buffer so streams do not mix.
2026-07-17 15:36:29 +08:00
NCBM 8ebe68b3af core/cli: remote-first model lists; always fetch GET /models
Prefer provider catalog over config for selection/Tab; fetch at startup,
/provider, /model, and /models. Config-only ids remain as fallback.
2026-07-17 15:36:06 +08:00
NCBM 2761877460 core/cli: YOLO mode on|off|once for soft destructive confirms
Session /yolo and --yes skip classify_danger prompts; once expires after the
next user turn. Hard path/command denylists unchanged.
2026-07-17 14:55:34 +08:00
NCBM 5d2f0c5539 core/cli: Rich markdown for assistant text at end of turn
Stream plain tokens; on TTY re-render with Rich. /markdown and PLYNGENT_PLAIN.
2026-07-15 22:21:18 +08:00
NCBM fbba2c2a14 core/tools+test: make process and path checks Windows-portable
Use sys.executable for process tests; normalize denylist/glob paths; skip readline when missing.
2026-07-15 20:20:25 +08:00
NCBM 611147b0a5 core/config+cli: recover empty-models providers via models()
Keep empty models as recoverable; promote to ready after remote list or --model.
2026-07-15 17:32:10 +08:00
NCBM 6bd80cb915 core/cli: /models and remote catalog for model selection
Cache GET /models, merge with config ids for Tab and choose; free-form model ids allowed.
2026-07-15 17:32:04 +08:00
NCBM 54712b541a core/cli: /config opens plyngent.toml and reloads
Add slash /config to edit the active config path in $EDITOR, then reload
providers/agent settings while keeping a valid provider/model selection.
2026-07-15 14:52:19 +08:00
NCBM 553d491cbc core/config+cli: empty models are bad; prompt model on provider switch
Reject providers with no models into bad_providers and warn with reasons
on chat/providers. When /provider changes and the current model is not
listed, prompt for a new model (keep it when still supported).
2026-07-15 14:17:34 +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 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 3a0d9ac3cc core/cli: drive Tab completion from Click ParamTypes
Add shell_complete on OnOff/export/provider/model/help param types and
complete_slash_args so readline no longer keeps a parallel arg table.
2026-07-15 13:20:53 +08:00
NCBM 00c3350225 core/cli: clearer /stream /tools /verbose help text
Use metavar [on|off] and document default/effect so /help stream is
readable without guessing ENABLED.
2026-07-15 13:17:51 +08:00
NCBM ffab066cab core/cli: drop Click --help from slash commands
Slash commands use add_help_option=False and empty options_metavar so
/help shows Usage: /history [N] without a fake Options/--help section.
2026-07-15 13:14:47 +08:00
NCBM 5e016c012b core/cli: fix /help command usage line and help Tab completion
Use a standalone Click context so /help compact shows Usage: /compact,
not nested under help. Complete /help <cmd> from the slash registry.
2026-07-15 13:09:24 +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 aaf7fe8e7b ci/lint: ruff format pass and fix compact seed test typing
Apply pending ruff format; narrow AssistantChatMessage.content before
membership checks so basedpyright accepts Unset|None unions.
2026-07-15 11:36:01 +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 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 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 5c13e06427 ci/lint: per-file ignores for tests in ruff and basedpyright
Relax ANN/ARG/PLR/C901 and related rules under tests/**; silence noisy
basedpyright reports for test fakes and private helpers.
2026-07-15 10:35:30 +08:00
NCBM 3215a5cc35 core/cli: show context char estimate in /status
Surface soft budget usage (context_chars and tool_result_max) for
Phase D without introducing a local tokenizer.
2026-07-15 10:12:01 +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 566a06c996 core/cli: pause turn cancel during TTY confirm prompts
Max-rounds and destructive-tool confirms no longer cancel the in-flight
turn; SIGINT during the prompt aborts only the confirm.
2026-07-15 00:00:40 +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 bd6d98ceda core/lmproto+agent: stream via chat_completions(stream=True)
Keep library async-def→async-iterator shape; remove raw-lines path;
typed StreamToolCallDelta merge; scripted clients emit real chunks.
2026-07-14 22:40:24 +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 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 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 566c1d7d4d test/cli: cover selection, slash commands, and providers list 2026-07-14 18:29:46 +08:00