Files
EvoScientist-Multi/EvoScientist/cli/_app.py
T
Xi Zhang 50719ef256 Implement PruningCheckpointer for efficient checkpoint management and… (#194)
* Implement PruningCheckpointer for efficient checkpoint management and add comprehensive tests

- Introduced `PruningCheckpointer` to manage checkpoint pruning after each `aput()`, ensuring only the latest checkpoints are retained based on a configurable limit.
- Added migration sweep functionality to clean up legacy checkpoints and prevent database bloat.
- Enhanced `get_checkpointer()` to utilize the new `PruningCheckpointer` and trigger migration sweeps when necessary.
- Developed a suite of integration tests for `PruningCheckpointer`, covering various scenarios including pruning behavior, concurrent writes, and retention policies.
- Implemented tests for migration sweep functionality, ensuring proper partitioning and user version management.
- Added diagnostic helper `db_stats` to provide insights into the database state, including thread and checkpoint counts.

* feat(sessions): enhance pruning logic to handle legacy DBs without writes table

* fix(tests): prevent atexit hook leakage in TestMigrationSweep

* feat(tests): enhance TestPruningCheckpointer to validate put+prune serialization

* feat(tests): refactor mock path implementation for get_db_path in test cases
2026-04-28 22:26:59 +02:00

61 lines
2.1 KiB
Python

"""Typer application objects — no intra-package imports to avoid circular deps."""
import typer # type: ignore[import-untyped]
app = typer.Typer(
no_args_is_help=False,
add_completion=False,
context_settings={"help_option_names": ["-h", "--help"]},
)
# Config subcommand group
config_app = typer.Typer(
help="Configuration management commands", invoke_without_command=True
)
app.add_typer(config_app, name="config")
# MCP subcommand group
_MCP_HELP = """\
Configure and manage MCP servers
Examples:
# Add a local MCP server (stdio auto-detected):
EvoSci mcp add local-server python -- /path/to/server.py
# Add an npx-based server:
EvoSci mcp add sequential-thinking npx -- -y @modelcontextprotocol/server-sequential-thinking
# Add an HTTP server (http auto-detected from URL):
EvoSci mcp add docs-langchain https://docs.langchain.com/mcp
# Add a stdio server with env vars (hardcoded):
EvoSci mcp add my-server node --env API_KEY=xxx -- server.js
# Add a server with runtime env ref (resolved from .env at startup):
EvoSci mcp add brave-search npx --env-ref BRAVE_API_KEY -- -y @modelcontextprotocol/server-brave-search
# Expose to a specific sub-agent (e.g. research-agent):
EvoSci mcp add brave-search npx --env-ref BRAVE_API_KEY -e research-agent -- -y @modelcontextprotocol/server-brave-search
# Expose to multiple agents:
EvoSci mcp add local-server python -e main,research-agent,code-agent -- /path/to/server.py
# Explicit transport override:
EvoSci mcp add my-sse https://example.com/sse --transport sse
Sub-agents (-e): planner-agent | research-agent | code-agent | debug-agent | data-analysis-agent | writing-agent
"""
mcp_app = typer.Typer(help=_MCP_HELP, invoke_without_command=True)
app.add_typer(mcp_app, name="mcp")
# Channel subcommand group
channel_app = typer.Typer(help="Channel management commands")
app.add_typer(channel_app, name="channel")
# Sessions subcommand group — diagnostic tools for the LangGraph checkpoint DB
sessions_app = typer.Typer(
help="Inspect and manage the sessions DB (~/.evoscientist/sessions.db)",
invoke_without_command=True,
)
app.add_typer(sessions_app, name="sessions")