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
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
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
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
e1ea43cb8f
core/lmproto: add OpenAI-compatible models() list API
...
Decode GET /models into ModelsResponse and return sorted unique ids.
2026-07-15 17:31:57 +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
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
95df11713d
core/agent+config: configurable compact prompts
...
Add agent config compact_system_prompt, compact_user_prefix, and
compact_seed_text; wire through summarize and seed messages. Fix default
user prefix to include {transcript}; use safe seed substitution so braces
in summaries do not break formatting.
2026-07-15 14:45:12 +08:00
NCBM
9cc2216807
core/lmproto: allow null logprobs and usage on stream chunks
...
Providers send logprobs=null (and sometimes usage=null) on SSE choices;
accept None so decode does not fail mid-stream.
2026-07-15 14:23:23 +08:00
NCBM
366752efb9
core/lmproto: allow null content on stream deltas
...
OpenAI-compatible and DeepSeek SSE chunks often set content and
reasoning_content to null; accept None so decode does not fail mid-stream.
2026-07-15 14:21:50 +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
cc298c6cd2
core/runtime: DeepSeek default base URL without /v1
...
Use https://api.deepseek.com as the empty-url default for deepseek preset.
2026-07-15 13:58:17 +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
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
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
6bdf7ea283
core/agent: always emit UsageEvent with api or estimate
...
Every model round yields usage; prefer provider usage, else estimate
from request messages and assistant content.
2026-07-15 10:52:48 +08:00
NCBM
0a3127454d
core/agent: char-based token estimate fallback for usage
...
When API usage is missing, estimate prompt/completion tokens at ~4
chars per token and mark source as estimate (or mixed when combined).
2026-07-15 10:52:37 +08:00
NCBM
28b6767b32
core/agent: emit UsageEvent from stream and non-stream rounds
...
Request stream_options.include_usage; yield usage after each model
completion when the provider reports it.
2026-07-15 10:47:59 +08:00
NCBM
2ae7aa0e05
core/agent: add TokenUsage and API usage parser
...
Parse OpenAI-compatible usage dicts into prompt/completion/total counts
for session and turn aggregation.
2026-07-15 10:47:51 +08:00
NCBM
d5e7c3aa53
core/lmproto: await async AsyncResponse.content
...
niquests exposes content as an async property; reading it without await
left a coroutine warning and skipped the body. Only load body on HTTP
errors for streams so SSE is not consumed early.
2026-07-15 10:41:33 +08:00
NCBM
a78791b3a9
core/lmproto: extract pure SSE helpers; drop fake response tests
...
Test sse_data_payload and http_error_message with plain bytes instead
of a cast-heavy AsyncResponse double.
2026-07-15 10:38:17 +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
c5745e0711
core/lmproto: stop SSE stream at data: [DONE]
...
Previously DONE was skipped with continue, so keep-alive connections
could hang forever after the model finished. Also fail fast on HTTP
error statuses for stream and non-stream completions.
2026-07-15 10:33:47 +08:00
NCBM
4741341888
core/agent: yield stream text deltas as chunks arrive
...
Stop buffering the full SSE response before emitting TextDeltaEvent so
CLI/UI can render assistant output token-by-token.
2026-07-15 10:27:49 +08:00
NCBM
5b4d3985b7
core/tools/vcs: add read-only vcs_* agent tools
...
Expose vcs_kind/status/diff/log/branch over detect_vcs; cover git and
custom detector registration.
2026-07-15 10:22:00 +08:00
NCBM
c2d132de09
core/tools/file: add grep_files regex content search
...
Line-oriented regex search under the workspace; skip VCS/hidden/binary
and cap match count.
2026-07-15 10:15:20 +08:00
NCBM
007efdef5a
core/tools/file: add glob_paths workspace search tool
...
Stdlib Path.glob with VCS/hidden skip and match cap; paths relative to
workspace root.
2026-07-15 10:15:13 +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
19128735a2
core/memory: order sessions by recency and touch on activity
...
List/get-latest by updated_at; bump updated_at when messages are
appended so workspace resume picks the lately-used session.
2026-07-15 10:03:15 +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