dostuff 0.2.6__tar.gz → 0.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dostuff-0.2.6 → dostuff-0.2.7}/PKG-INFO +1 -1
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/permissions.py +8 -3
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/cli_tui.py +48 -6
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff.egg-info/PKG-INFO +1 -1
- {dostuff-0.2.6 → dostuff-0.2.7}/pyproject.toml +1 -1
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_permissions.py +23 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_tui.py +93 -2
- {dostuff-0.2.6 → dostuff-0.2.7}/LICENSE +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/README.md +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/__init__.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/__main__.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/call_agent.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/instructions.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/loop.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/run_tool.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/subagents/__init__.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/subagents/adapter.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/subagents/definitions.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/subagents/fork.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/subagents/prompt.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/subagents/registry.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/agent/subagents/run.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/cli.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/config.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/headless.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/append_step.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/constants.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/consume_stream.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/context_usage.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/environment_context.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/file_mentions.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/get_model_token_limit.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/load_identity.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/load_project_instructions.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/loop_check_cancelled.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/loop_emit.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/manage_context.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/model_cost.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/notices.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/pastes.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/quick_memory.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/slash_suggestion.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/agent/tool_output.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/hooks/__init__.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/hooks/dispatch.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/hooks/events.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/hooks/load_hooks.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/hooks/run_hook.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/hooks/trust.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/mcp/load_mcp_config.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/mcp/mcp_oauth.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/mcp/server_config.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/mcp/token_store.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/memory/export_session.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/memory/resolve_memory_operation.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/memory/shell_step.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/models/add_model_entry.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/models/list_models.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/models/opencode.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/skills/custom_commands.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/skills/discover_skills.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/skills/skill_command.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/tools/diff.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/tools/generate_tool_schema.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/tools/project_root.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/tools/resolve_safe_path.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/ui/__init__.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/ui/doctor.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/ui/emit.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/ui/prompt_history.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/ui/terminal_signals.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/helpers/ui/tools_listing.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/checkpoints.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/exceptions.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/mcp/mcp_client.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/mcp/mcp_client_registration_store.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/mcp/mcp_tool_registry_store.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/memory/chroma.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/memory/episodic_memory_store.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/memory/semantic_memory_store.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/memory/session_store.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/memory/stores.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/memory/types.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/model.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/tracing.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/lib/worktree.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/memory/__init__.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/setup_wizard.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/skills.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/templates/config.example.yaml +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/templates/env.example +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/__init__.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/agent.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/bash/bash_command.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/bash/bash_output.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/bash/jobs.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/bash/kill_shell.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/create_agent_type.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/definitions.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/files/delete_file.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/files/edit_file.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/files/list_files.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/files/read_file.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/files/write_file.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/get_current_datetime.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/mcp/call_mcp_tool.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/mcp/get_mcp_tool_details.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/mcp/search_mcp_tools.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/memory/save_episode.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/memory/save_memory.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/names.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/search/glob.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/search/grep.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/search/walk.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/send_message.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/settings.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/stop_agent.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/todo_write.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/web_fetch.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff/tools/web_search.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff.egg-info/SOURCES.txt +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff.egg-info/dependency_links.txt +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff.egg-info/entry_points.txt +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff.egg-info/requires.txt +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/dostuff.egg-info/top_level.txt +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/setup.cfg +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_bash_command.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_checkpoints_todos_caching.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_cli_commands.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_config_memory_mcp.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_create_agent_type.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_file_mentions.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_file_tools.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_hooks.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_jobs.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_loop.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_mcp_e2e.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_mcp_oauth.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_opencode.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_optional_memory_and_instructions.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_pastes.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_roadmap_021.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_session_store.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_settings_tools.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_setup_wizard.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_skill_command.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_skills_discovery.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_slash_suggestion.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_subagent.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_subagents_background.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_subagents_fork.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_subagents_run.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_subagents_store.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_subagents_types.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_terminal_signals.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_tool_schemas.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_tools_listing.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_web_fetch.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_web_search.py +0 -0
- {dostuff-0.2.6 → dostuff-0.2.7}/tests/test_worktree.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dostuff
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: DoStuff - a terminal coding agent for any LLM: TUI and headless mode, permissions, MCP, skills, web tools, sessions and git worktrees
|
|
5
5
|
Author-email: Varun Kumawat <varunkumawatleap2@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -73,8 +73,11 @@ _GIT_SAFE_ARGS: dict[str, set[str]] = {
|
|
|
73
73
|
# `env` / `printenv` are intentionally absent: they dump secrets into the transcript.
|
|
74
74
|
|
|
75
75
|
_FORBIDDEN_SUBSTRINGS = (
|
|
76
|
-
">", "<", "`", "$(", "${", "out-file", "set-content", "add-content", "env:", ".env",
|
|
76
|
+
">", "<", "`", "$(", "${", "out-file", "set-content", "add-content", "env:", ".env",
|
|
77
77
|
)
|
|
78
|
+
# A `.dostuff` path (`.dostuff/config.yaml`, `~/.dostuff`, cwd=".dostuff"), not a dotted attribute such
|
|
79
|
+
# as `cli_tui.DostuffTUI` — that is ordinary code, and treating it as one denied reads in plan mode.
|
|
80
|
+
_DOSTUFF_REF = re.compile(r"(?<![\w-])\.dostuff(?![\w-])", re.IGNORECASE)
|
|
78
81
|
# Flags that make otherwise read-only commands write, delete or execute (find -exec, rg --pre, git --output …).
|
|
79
82
|
_FORBIDDEN_FLAGS = re.compile(
|
|
80
83
|
r"(?<![\w-])(-delete|-exec\w*|-ok\w*|-fprint\w*|-fls|--output|--pre)(?![\w-])",
|
|
@@ -141,6 +144,7 @@ def has_unsafe_constructs(command: str) -> bool:
|
|
|
141
144
|
lowered = _WORKTREES_PREFIX.sub("", lowered)
|
|
142
145
|
return (
|
|
143
146
|
any(s in lowered for s in _FORBIDDEN_SUBSTRINGS)
|
|
147
|
+
or bool(_DOSTUFF_REF.search(lowered))
|
|
144
148
|
or bool(_FORBIDDEN_FLAGS.search(command))
|
|
145
149
|
or bool(_ENV_EXPANSION.search(command))
|
|
146
150
|
)
|
|
@@ -268,11 +272,11 @@ def _plan_denies(kind: ToolKind, args: dict[str, Any]) -> bool:
|
|
|
268
272
|
|
|
269
273
|
|
|
270
274
|
def _mentions_dostuff_dir(text: str) -> bool:
|
|
271
|
-
"""`.dostuff` named in a shell command or cwd, other than a path into a subagent worktree."""
|
|
275
|
+
"""`.dostuff` named as a path in a shell command or cwd, other than a path into a subagent worktree."""
|
|
272
276
|
lowered = text.lower()
|
|
273
277
|
if ".." not in lowered: # same worktree exemption as has_unsafe_constructs
|
|
274
278
|
lowered = _WORKTREES_PREFIX.sub("", lowered)
|
|
275
|
-
return
|
|
279
|
+
return bool(_DOSTUFF_REF.search(lowered))
|
|
276
280
|
|
|
277
281
|
|
|
278
282
|
def effective_kind(kind: ToolKind, args: dict[str, Any]) -> ToolKind:
|
|
@@ -280,6 +284,7 @@ def effective_kind(kind: ToolKind, args: dict[str, Any]) -> ToolKind:
|
|
|
280
284
|
|
|
281
285
|
So does a shell command naming `.dostuff` (in `command` or `cwd`): otherwise auto mode would let
|
|
282
286
|
`echo … >> ~/.dostuff/config.yaml` add a user hook, which no trust check covers, without a prompt.
|
|
287
|
+
Only a `.dostuff` path counts — `cli_tui.DostuffTUI` is a dotted attribute, not a settings path.
|
|
283
288
|
A heuristic: a name built indirectly (`.dost''uff`, a variable holding it) is not caught here.
|
|
284
289
|
"""
|
|
285
290
|
if kind == "write" and _is_settings_path(str(args.get("path") or "")):
|
|
@@ -16,6 +16,7 @@ import uuid
|
|
|
16
16
|
from pathlib import Path
|
|
17
17
|
from typing import TYPE_CHECKING, Any, Awaitable, Callable, Iterable, Literal
|
|
18
18
|
from textual.app import App, ComposeResult
|
|
19
|
+
from textual.geometry import Region
|
|
19
20
|
from textual.message import Message
|
|
20
21
|
from textual.timer import Timer
|
|
21
22
|
from textual.widget import Widget
|
|
@@ -268,13 +269,51 @@ class ToolResult(Static):
|
|
|
268
269
|
self.set_expanded(not self.expanded)
|
|
269
270
|
|
|
270
271
|
|
|
271
|
-
class
|
|
272
|
-
"""
|
|
272
|
+
class Transcript(VerticalScroll):
|
|
273
|
+
"""The conversation viewport.
|
|
274
|
+
|
|
275
|
+
Textual pins an anchored scrollbox in the same layout pass it arranges it (`_compositor`):
|
|
276
|
+
`total_region.bottom - (container_size.height - scrollbar_size_horizontal)`. It reads
|
|
277
|
+
`container_size`, which the compositor only writes back *after* the pass, so the first frame
|
|
278
|
+
after the viewport changes height is pinned for the *previous* height. Swapping the input for
|
|
279
|
+
the picker (or a taller approval prompt, or giving the rows back when it closes) changes
|
|
280
|
+
`#messages`' height by itself, so that frame kept the old scroll offset and the transcript was
|
|
281
|
+
drawn a few rows off — the bounce you see as the selectors come in and go out.
|
|
282
|
+
|
|
283
|
+
`_get_scrollable_region` runs just before that arithmetic inside the pass, so setting the
|
|
284
|
+
container size there makes the anchor use the size being laid out. Textual stores the same
|
|
285
|
+
value afterwards, so nothing else changes.
|
|
286
|
+
"""
|
|
287
|
+
|
|
288
|
+
def _get_scrollable_region(self, region: Region) -> Region:
|
|
289
|
+
self._container_size = region.size
|
|
290
|
+
return super()._get_scrollable_region(region)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
class _JumpToBottomLabel(Static):
|
|
294
|
+
"""The pill inside `JumpToBottom`; a click goes back to the latest message."""
|
|
295
|
+
|
|
296
|
+
ALLOW_SELECT = False # a click with a little mouse movement would start a selection instead
|
|
273
297
|
|
|
274
298
|
def on_click(self) -> None:
|
|
275
299
|
messages = self.app.query_one("#messages", VerticalScroll)
|
|
276
300
|
messages.anchor() # scroll_end inside also re-attaches a released anchor
|
|
277
|
-
self.
|
|
301
|
+
if isinstance(self.parent, JumpToBottom):
|
|
302
|
+
self.parent.display = False
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
class JumpToBottom(Horizontal):
|
|
306
|
+
"""Shown while the conversation is scrolled up.
|
|
307
|
+
|
|
308
|
+
The widget itself is a full-width row so it can center a small pill (`#jump-bottom-label`)
|
|
309
|
+
over the conversation instead of banding the whole width; only the pill is clickable."""
|
|
310
|
+
|
|
311
|
+
def __init__(self, label: str, **kwargs: Any) -> None:
|
|
312
|
+
super().__init__(**kwargs)
|
|
313
|
+
self._label = label
|
|
314
|
+
|
|
315
|
+
def compose(self) -> ComposeResult:
|
|
316
|
+
yield _JumpToBottomLabel(self._label, id="jump-bottom-label")
|
|
278
317
|
|
|
279
318
|
|
|
280
319
|
class JobsBar(Static):
|
|
@@ -1090,10 +1129,13 @@ class DostuffTUI(App):
|
|
|
1090
1129
|
#queue-bar { height: auto; display: none; padding: 0 1; margin-top: 1; }
|
|
1091
1130
|
#queue-bar:hover { background: #2c2c2c; }
|
|
1092
1131
|
#jump-bottom {
|
|
1093
|
-
dock: bottom; display: none; width: 100%; height: 1;
|
|
1132
|
+
dock: bottom; display: none; width: 100%; height: 1; align-horizontal: center;
|
|
1133
|
+
}
|
|
1134
|
+
#jump-bottom-label {
|
|
1135
|
+
width: auto; height: 1; padding: 0 2;
|
|
1094
1136
|
text-align: center; color: #8ab4f8; text-style: bold; background: #2c2c2c;
|
|
1095
1137
|
}
|
|
1096
|
-
#jump-bottom:hover { background: #3a3a3a; }
|
|
1138
|
+
#jump-bottom-label:hover { background: #3a3a3a; }
|
|
1097
1139
|
#agent-view { height: 1fr; }
|
|
1098
1140
|
#agent-view-title { height: auto; padding: 0 1; color: #8ab4f8; text-style: bold; }
|
|
1099
1141
|
#agent-view-scroll { height: 1fr; border: round #4a4a4a; }
|
|
@@ -1208,7 +1250,7 @@ class DostuffTUI(App):
|
|
|
1208
1250
|
def compose(self) -> ComposeResult:
|
|
1209
1251
|
# Not focusable: clicking the conversation keeps focus in the input (see _keep_input_focus)
|
|
1210
1252
|
with Vertical(id="conversation"):
|
|
1211
|
-
with
|
|
1253
|
+
with Transcript(id="messages", can_focus=False):
|
|
1212
1254
|
yield Vertical(id="msg-container")
|
|
1213
1255
|
yield JumpToBottom("↓ Jump to bottom", id="jump-bottom")
|
|
1214
1256
|
yield CommandMenu(id="command-menu")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dostuff
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: DoStuff - a terminal coding agent for any LLM: TUI and headless mode, permissions, MCP, skills, web tools, sessions and git worktrees
|
|
5
5
|
Author-email: Varun Kumawat <varunkumawatleap2@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dostuff"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.7"
|
|
8
8
|
description = "DoStuff - a terminal coding agent for any LLM: TUI and headless mode, permissions, MCP, skills, web tools, sessions and git worktrees"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -10,6 +10,7 @@ from dostuff.agent.permissions import (
|
|
|
10
10
|
PermissionConfig,
|
|
11
11
|
SessionPermissions,
|
|
12
12
|
check,
|
|
13
|
+
has_unsafe_constructs,
|
|
13
14
|
is_read_only_shell,
|
|
14
15
|
parse_answer,
|
|
15
16
|
)
|
|
@@ -87,6 +88,8 @@ AUTO = PermissionConfig(mode="auto")
|
|
|
87
88
|
(r"Add-Content C:\Users\me\.dostuff\config.yaml 'x'", ""),
|
|
88
89
|
("cp evil.yaml config.yaml", str(Path.home() / ".dostuff")),
|
|
89
90
|
("cat .dostuff/worktrees/../config.yaml", ""),
|
|
91
|
+
("cd .dostuff && rm -rf config.yaml", ""), # a bare path is still a settings change
|
|
92
|
+
("./.dostuff/config.yaml", ""),
|
|
90
93
|
])
|
|
91
94
|
def test_shell_touching_dostuff_asks_in_every_mode(command, cwd):
|
|
92
95
|
"""A shell command naming .dostuff is a settings change: it asks even in auto mode, with no "always"."""
|
|
@@ -97,6 +100,26 @@ def test_shell_touching_dostuff_asks_in_every_mode(command, cwd):
|
|
|
97
100
|
assert shell(command, cfg=PLAN, cwd=cwd) == "deny"
|
|
98
101
|
|
|
99
102
|
|
|
103
|
+
@pytest.mark.parametrize("command", [
|
|
104
|
+
'grep -rn "cli_tui.DostuffTUI" tests/',
|
|
105
|
+
"rm tests/test_tui.py", # any other shell command stays a plain shell call
|
|
106
|
+
])
|
|
107
|
+
def test_dotted_attribute_is_not_a_settings_change(command):
|
|
108
|
+
"""`cli_tui.DostuffTUI` is code, not a `.dostuff` path: a literal substring match asked (and in plan
|
|
109
|
+
mode denied) greps for the TUI class out of a repo that is itself named dostuff."""
|
|
110
|
+
assert check("bash_command", "shell", {"command": command}, None, AUTO).action == "allow"
|
|
111
|
+
assert check("write_file", "write", {"path": "dostuff/agent/permissions.py", "content": ""}, None, AUTO).action == "allow"
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def test_grep_for_the_tui_class_is_read_only():
|
|
115
|
+
"""The dotted name must not be a forbidden construct either, or plan mode denies the search."""
|
|
116
|
+
command = 'grep -rn "cli_tui.DostuffTUI" tests/'
|
|
117
|
+
assert not has_unsafe_constructs(command)
|
|
118
|
+
assert is_read_only_shell(command)
|
|
119
|
+
assert shell(command) == "allow"
|
|
120
|
+
assert shell(command, cfg=PLAN) == "allow"
|
|
121
|
+
|
|
122
|
+
|
|
100
123
|
def test_shell_in_subagent_worktree_is_not_settings():
|
|
101
124
|
command = "git -C .dostuff/worktrees/abc status"
|
|
102
125
|
assert check("bash_command", "shell", {"command": command}, None, AUTO).action == "allow"
|
|
@@ -955,7 +955,7 @@ def test_turn_summary_timer_format_and_jump_to_bottom(tui):
|
|
|
955
955
|
await pilot.pause()
|
|
956
956
|
assert any(t.startswith("✻ Worked for 1m 5s · $0.01 · done ") for t in _texts(app))
|
|
957
957
|
|
|
958
|
-
# Scrolling up shows the bar; clicking
|
|
958
|
+
# Scrolling up shows the bar; clicking the centered button goes back to the bottom and hides it
|
|
959
959
|
jump = app.query_one("#jump-bottom", cli_tui.JumpToBottom)
|
|
960
960
|
for i in range(40):
|
|
961
961
|
app._append(f"line {i}", msg_type="system")
|
|
@@ -964,7 +964,11 @@ def test_turn_summary_timer_format_and_jump_to_bottom(tui):
|
|
|
964
964
|
assert not jump.display
|
|
965
965
|
messages.scroll_home(animate=False)
|
|
966
966
|
await _until(pilot, lambda: jump.display)
|
|
967
|
-
|
|
967
|
+
# The bar spans the conversation so it can center a small button (not a full-width band)
|
|
968
|
+
label = app.query_one("#jump-bottom-label", cli_tui.Static)
|
|
969
|
+
assert label.region.width < jump.region.width
|
|
970
|
+
assert abs(label.region.x + label.region.width / 2 - (jump.region.x + jump.region.width / 2)) <= 1
|
|
971
|
+
await pilot.click("#jump-bottom-label")
|
|
968
972
|
await _until(pilot, lambda: messages.is_vertical_scroll_end and not jump.display)
|
|
969
973
|
await app._cleanup_and_save_session()
|
|
970
974
|
|
|
@@ -3067,3 +3071,90 @@ def test_trust_prompt_does_not_bounce(tui, fresh_trust, hook_cmd):
|
|
|
3067
3071
|
assert app.query_one("#msg-container").styles.inline.min_height is None # released at the end
|
|
3068
3072
|
await app._cleanup_and_save_session()
|
|
3069
3073
|
asyncio.run(scenario())
|
|
3074
|
+
|
|
3075
|
+
|
|
3076
|
+
def test_picker_does_not_bounce_the_transcript(tui):
|
|
3077
|
+
"""Opening or closing a selector must not move the transcript, not even for the frame that lays out
|
|
3078
|
+
the new height: Textual pins an anchored scrollbox with `container_size`, which it only writes back
|
|
3079
|
+
after arranging, so the first frame after the input/picker swap used the previous viewport height
|
|
3080
|
+
and drew the conversation a few rows off (the bounce). Every painted frame stays flush."""
|
|
3081
|
+
cli_tui = tui
|
|
3082
|
+
|
|
3083
|
+
async def scenario():
|
|
3084
|
+
app = cli_tui.DostuffTUI(session_id="bounce")
|
|
3085
|
+
async with app.run_test(size=(100, 30)) as pilot:
|
|
3086
|
+
await pilot.pause()
|
|
3087
|
+
for i in range(25): # enough to overflow the viewport
|
|
3088
|
+
app._append(f"row{i:02d} " + "-" * 30, msg_type="user")
|
|
3089
|
+
await pilot.pause()
|
|
3090
|
+
await pilot.pause()
|
|
3091
|
+
messages = app.query_one("#messages")
|
|
3092
|
+
assert isinstance(messages, cli_tui.Transcript)
|
|
3093
|
+
off_bottom: list[int] = []
|
|
3094
|
+
original_display = app._display
|
|
3095
|
+
|
|
3096
|
+
def display(screen, renderable):
|
|
3097
|
+
"""Check what is actually painted, before it goes to the terminal."""
|
|
3098
|
+
rows = [strip.text.rstrip() for strip in
|
|
3099
|
+
app.screen._compositor.render_strips()[:messages.region.height]]
|
|
3100
|
+
occupied = [y for y, row in enumerate(rows) if row]
|
|
3101
|
+
if occupied: # empty viewport: nothing to be flush with
|
|
3102
|
+
off_bottom.append(messages.region.height - 1 - occupied[-1])
|
|
3103
|
+
return original_display(screen, renderable)
|
|
3104
|
+
app._display = display # type: ignore[method-assign]
|
|
3105
|
+
|
|
3106
|
+
for cursor in (0, 3, 5): # as if arrowing through the options: the picker can change height
|
|
3107
|
+
app._show_picker("Pick", [(f"v{i}", f"o{i}") for i in range(6)], app._switch_session)
|
|
3108
|
+
await pilot.pause()
|
|
3109
|
+
await pilot.pause()
|
|
3110
|
+
for _ in range(cursor):
|
|
3111
|
+
await pilot.press("down")
|
|
3112
|
+
await pilot.pause()
|
|
3113
|
+
app._close_picker()
|
|
3114
|
+
await pilot.pause()
|
|
3115
|
+
await pilot.pause()
|
|
3116
|
+
|
|
3117
|
+
# An approval prompt (mounted, not just shown) opens and closes the same way
|
|
3118
|
+
task = asyncio.get_running_loop().create_task(app.adapter.ask("Allow write_file?"))
|
|
3119
|
+
deadline = time.monotonic() + 20
|
|
3120
|
+
while not app.query("#permission-prompt") and time.monotonic() < deadline:
|
|
3121
|
+
await pilot.pause(0.01)
|
|
3122
|
+
await pilot.pause(0.1)
|
|
3123
|
+
app.adapter.choose("yes")
|
|
3124
|
+
await task
|
|
3125
|
+
await pilot.pause(0.1)
|
|
3126
|
+
app._display = original_display # type: ignore[method-assign]
|
|
3127
|
+
|
|
3128
|
+
assert off_bottom, "no frame was measured"
|
|
3129
|
+
assert max(off_bottom) <= 0, f"the transcript drifted off the bottom: {off_bottom}"
|
|
3130
|
+
await app._cleanup_and_save_session()
|
|
3131
|
+
asyncio.run(scenario())
|
|
3132
|
+
|
|
3133
|
+
|
|
3134
|
+
def test_picker_keeps_a_scrolled_up_transcript_in_place(tui):
|
|
3135
|
+
"""The anchoring fix must not drag a transcript the user scrolled up back to the bottom."""
|
|
3136
|
+
cli_tui = tui
|
|
3137
|
+
|
|
3138
|
+
async def scenario():
|
|
3139
|
+
app = cli_tui.DostuffTUI(session_id="scrolled")
|
|
3140
|
+
async with app.run_test(size=(100, 30)) as pilot:
|
|
3141
|
+
await pilot.pause()
|
|
3142
|
+
for i in range(25):
|
|
3143
|
+
app._append(f"row{i:02d} " + "-" * 30, msg_type="user")
|
|
3144
|
+
await pilot.pause()
|
|
3145
|
+
messages = app.query_one("#messages", cli_tui.Transcript)
|
|
3146
|
+
messages.scroll_to(y=10, animate=False)
|
|
3147
|
+
await pilot.pause()
|
|
3148
|
+
await pilot.pause()
|
|
3149
|
+
assert messages.scroll_y == 10
|
|
3150
|
+
|
|
3151
|
+
app._show_picker("Pick", [("a", "a")], app._switch_session)
|
|
3152
|
+
await pilot.pause()
|
|
3153
|
+
await pilot.pause()
|
|
3154
|
+
assert messages.scroll_y == 10
|
|
3155
|
+
app._close_picker()
|
|
3156
|
+
await pilot.pause()
|
|
3157
|
+
await pilot.pause()
|
|
3158
|
+
assert messages.scroll_y == 10
|
|
3159
|
+
await app._cleanup_and_save_session()
|
|
3160
|
+
asyncio.run(scenario())
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|