Commit Graph

160 Commits

Author SHA1 Message Date
NCBM da4d3d097a core/config: persist provider models as TOML inline tables 2026-07-24 17:11:39 +08:00
NCBM 03e04f9a38 core/cli: plugins list/enable/disable commands and /plugins slash 2026-07-24 16:44:44 +08:00
NCBM 1d718582ac core/tools: drop process workspace/todo globals; require bound state 2026-07-24 16:32:33 +08:00
NCBM 4215a8cea0 core/config: top-level [plugins] enable/disable allowlist 2026-07-24 16:19:50 +08:00
NCBM ac3230647a test/agent: bind todo tools via SessionState instead of process global 2026-07-24 16:00:17 +08:00
NCBM 8baaa3f2e1 core/tools: hang workspace policy on InstanceState 2026-07-24 15:58:55 +08:00
NCBM 6c6cec05c4 core/cli: bind todo persist via session state, not process global 2026-07-24 15:49:57 +08:00
NCBM 7a3704edc1 core/tools: resolve_path accepts instance workspace root 2026-07-24 15:41:59 +08:00
NCBM 90c07061f3 core/tools: persist soft-confirm grants under session.data 2026-07-24 15:41:39 +08:00
NCBM 3d5380a3d4 core/tools: todo tools commit via session.data transactions 2026-07-24 15:31:26 +08:00
NCBM e82a226f91 core/tools: serialize domain objects on PersistentDataView commit 2026-07-24 15:31:06 +08:00
NCBM 96518974be core/tools: allowlisted entry-point plugin loader 2026-07-24 15:09:11 +08:00
NCBM 662e95f693 core/cli: /tools --list shows tags and catalog source 2026-07-24 15:04:33 +08:00
NCBM 7253ca84dd core/tools: prefer instance workspace and session todo views 2026-07-24 15:02:52 +08:00
NCBM 12c8adda3a test/tools: catalog, grants, and async tool helpers 2026-07-24 14:57:03 +08:00
NCBM 30beec6600 core/config: split agent system_prompt and tool_directives 2026-07-21 22:55:51 +08:00
NCBM db7c097466 test/cli: isolate oneshot chat from user-data database 2026-07-21 22:44:26 +08:00
NCBM b06bb1d409 core/agent: shift persist_from when prepending system prompt 2026-07-21 22:44:09 +08:00
NCBM b51d4780ab core/agent: refresh synthetic_tool todo nags to live stack 2026-07-21 22:42:27 +08:00
NCBM 6d74d31cea core/config: default system prompt for coding agent tools 2026-07-20 18:21:27 +08:00
NCBM 767578723e core/runtime: configurable provider HTTP request timeouts 2026-07-20 18:08:27 +08:00
NCBM 879e28ea4c core/agent: synthetic_tool review always when stack non-empty
needs_review is true for any non-empty stack so end-of-turn inject
keeps firing under synthetic_tool. Message history keeps only the last
todo-nag tool pair (dedupe by todo-nag- tool_call_id).
2026-07-20 16:20:01 +08:00
NCBM 7bdd9ff8b7 chore: pin ruff and basedpyright for prek and lockfile
Match prek additional_dependencies and pyproject dev pins to pdm.lock
(ruff==0.15.22, basedpyright==1.39.9). Format fix for ruff 0.15.22.
2026-07-20 04:35:26 +08:00
NCBM 59017fd61b core/agent: synthetic_tool nag uses real todo_list render body
developer/user keep OPEN WORK prose; synthetic_tool injects forged
todo_list call with stack.render() only so the result matches a real
tool output.
2026-07-20 04:10:21 +08:00
NCBM 2e6cb3834a core/agent: drop system todo nag; emit events for synthetic_tool
Remove system strategy (legacy maps to developer). synthetic_tool still
forges the call but uses real stack text as the tool result, and now
yields ToolCall/Result events so the CLI flushes and does not glue nag
text to the next assistant stream.
2026-07-20 03:55:50 +08:00
NCBM f6d14ed549 core/agent: configurable todo nag strategies
Add [agent] todo_nag_strategy: developer (default), system, user,
synthetic_tool (forged todo_list pair), or none. Shared inject helper
used for turn-start and end-of-turn nags; CLI wires agent config.
2026-07-20 03:33:02 +08:00
NCBM a4ab11c9a2 core/agent: stronger open-work signals in todo stack prompts
Split tags: [TODO OPEN WORK] for pending/in_progress (undone work) vs
[TODO HYGIENE] for all-terminal leftover groups. End-of-turn review lists
open titles; tool docs stress open items as unfinished work.
2026-07-20 03:17:44 +08:00
NCBM d6616d0da3 core/tools: timed human allow for denylisted commands
Denylist hits ask the user (default deny, timeout) instead of only hard
rejecting when a policy hook is installed. Independent of YOLO soft-confirm;
session grants skip re-prompt for the same basename. CLI installs the hook
via install_cli_limit_hooks.
2026-07-20 03:02:34 +08:00
NCBM a677e06af4 core/tools: add ask_into_pty for human-local PTY input
Prompt the human (optional no-echo secret) and write only to the PTY.
Tool results never include the answer so secrets stay off external APIs.
Empty/Ctrl-C cancel without writing; submit defaults to trailing newline.
2026-07-20 02:47:19 +08:00
NCBM aadcd237db core/cli: soft-fail GET /models cancel/timeout on provider switch
Map CancelledError and TimeoutError from models() to RuntimeError so
merged_model_choices falls back to config/cache. Stub remote fetch in
/provider unit tests so they never hit the network.
2026-07-19 22:38:22 +08:00
NCBM 58ff646034 core/cli: config open via VISUAL/EDITOR or system default
Prefer $VISUAL then $EDITOR (blocking). Without either, fall back to
xdg-open / open / startfile (non-blocking) for config paths only.
/edit stays blocking-only so the temp buffer can be re-read.
2026-07-19 22:33:02 +08:00
NCBM d528f65c4c core/tools: edit_replace max_replaces and richer match messages
Default still replaces first match only. Report how many matches were
found, how many replaced, and remaining hits so agents can raise
max_replaces or narrow old_string.
2026-07-19 21:55:16 +08:00
NCBM 0ec0d542e8 core/cli: keep database url :memory:; default url None
Unset/empty url still maps to durable user-data chat.db.
Explicit :memory: is not rewritten; CLI warns when not quiet.
DatabaseConfig.url default is None; engine treats None as memory.
2026-07-19 21:38:21 +08:00
NCBM e1e4df0f3f core/agent: strengthen todo prompts when stack not empty
Inject turn-start [TODO REMINDER] for non-empty stacks; rewrite end-of-turn
[TODO OPEN] copy so open items read as unfinished work. needs_review now
always true while open items remain (even if todo_* ran this turn); terminal-only
stacks still need review if untouched. Update tool docs and tests.
2026-07-19 20:34:01 +08:00
NCBM a54fa534f3 test/tools: clean shell confirm format test 2026-07-19 13:05:43 +08:00
NCBM fa9f28687f test/tools: fix shell confirm format test syntax 2026-07-19 13:02:24 +08:00
NCBM 95f277eda7 core/tools: shell confirm argv uses $(command); full -c body indented 2026-07-19 13:01:06 +08:00
NCBM f13ea9f316 core/tools: soft-confirm file overwrite only, not partial edits 2026-07-19 03:05:01 +08:00
NCBM f51d11d46f core/tools/process: add run_command_batch with pipe_out and mix_stderr 2026-07-19 02:46:21 +08:00
NCBM 5b51de12e0 core/cli: skip blocking GET /models on chat ready
Only fetch remote catalog when interactive model pick needs it; otherwise
use config/--model/session and warm Tab cache in the background. Cap list
fetch at 5s so a dead API cannot hang startup.
2026-07-19 02:08:58 +08:00
NCBM badcb3c9f3 core/cli: fix Ctrl+C after mid-turn prompts (SIGINT cancel)
asyncio signal handlers freeze ContextVars at install time; reinstalling
while allow_task_cancel was still False left cancel permanently disabled.
Use a process-level prompt depth counter and reinstall only after depth=0.
2026-07-18 19:31:40 +08:00
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 020e9215bf tools: new_temporary_workspace with cross-platform allowlist
Create scratch dirs under system temp (tempfile), allow absolute paths
under them without rebinding the project workspace or session. Cleanup
owned temps on chat exit. Cap 16 concurrent temps; sanitize prefix.
2026-07-18 18:16:06 +08:00
NCBM de79dec96f tools/file: add with_lineno option to read_file
When true, prefix each returned line with absolute 1-based line numbers
(N|…) for edit_lineno-friendly reads; works with offset/limit.
2026-07-18 17:52:25 +08:00
NCBM b1a8c23582 core/tools: soft-confirm shells, REPLs, and python/bash -c one-liners
classify_danger prompts on interactive shell/runtime launches and any -c
code (with argv + snippet preview). Confirm deny can attach a user comment
for the model. Restores ToolRegistry.execute after WIP breakage.
2026-07-18 17:41:44 +08:00
NCBM 9a9c808ea0 core/agent: agent-facing [TODO OPEN] review nag 2026-07-18 16:48:20 +08:00
NCBM edd54a427c core/tools/process: drop host TTY restore; rely on CSI sanitize only 2026-07-18 16:26:23 +08:00
NCBM 896dc98d20 core/tools/process: skip host TTY restore when no PTY closed 2026-07-18 16:14:19 +08:00
NCBM c8a0aeda8d core/agent: reuse todo ids after clear/pop; todo_push titles as array 2026-07-18 16:09:09 +08:00