31 Commits
Author SHA1 Message Date
zeekay 73fbba8141 feat: add hanzo-kms package, MCP proxy tools, and agent reflexion
- Add hanzo-kms v1.0.0: Secret management SDK compatible with Infisical API
  - Sync and async clients with multiple auth methods (Universal, AWS IAM, Azure, GCP, K8s)
  - Full CRUD operations for secrets with environment injection

- Add MCP proxy system for lazy-loading external MCP servers
  - mcp_proxy.py: Dynamic MCP server connection and tool discovery
  - proxy_tool.py: Tool for managing external MCP server proxies
  - platform_auth.py: Hanzo Platform authentication utilities
  - Built-in servers: platform, github, cloudflare, postgres, sqlite, docker, k8s

- Add agent reflexion module for self-correction and rule management
  - ReflexionEngine for reflection and rule-based behavior updates
  - Integration with hanzo-memory for persistent rules

- Add self_learning_agent example demonstrating reflexion capabilities

- Update ps_tool with improved process management and log handling
- Update browser tools with enhanced CDP bridge and automation
- Bump dependency versions across all tool packages

All tests pass (3156 passed)
2026-02-04 10:55:08 -08:00
zeekay 2940310a5d chore: update sub-package dependencies for security fixes
- Update uv.lock files in all sub-packages
- python-multipart 0.0.21 -> 0.0.22 (arbitrary file write fix)
- urllib3 2.6.1 -> 2.6.3 (decompression-bomb fix)
- Various other dependency updates

Note: docs/package-lock.json has next.js vulnerabilities that need
manual resolution due to npm dependency conflicts.
2026-02-02 22:40:00 -08:00
zeekay 86c2cdcc0d feat: add new tool packages and install command
- Add hanzo-tools-code: code analysis and transformation tools
- Add hanzo-tools-net: network and HTTP tools
- Add hanzo-tools-plan: planning and task management tools
- Add hanzo-tools-test: testing tools
- Add hanzo-tools-vcs: version control tools
- Add install command for dependency management
- Improve CDP bridge server with better error handling
- Add ui_tool for computer tools
- Add unified tool loading and id_tool
- Add HIP documentation (HIP-0300, HIP-0301)
2026-01-24 13:21:16 -08:00
zeekay 8d30e5a9e3 feat(shell): remove cmd, add ksh/tcsh/csh support, shell-first exposure
- Remove 'cmd' from default TOOLS list - only detected shell exposed
- Add KshTool, TcshTool, CshTool for enterprise Unix shells
- Fallback to ShellTool (smart auto-detect) if shell detection fails
- Support ksh93, pdksh, mksh as aliases for ksh
- Bump hanzo-tools-shell to 0.6.1, hanzo-mcp to 0.10.37
2026-01-11 19:22:32 -08:00
zeekay d5f07ec514 feat(shell): add shell detection to only expose user's active shell
- Add shell_detect.py module with comprehensive shell detection:
  - Detects login shell from passwd/Directory Services
  - Detects invoking shell by walking parent processes
  - Prefers Homebrew shell paths on macOS
  - Supports override via HANZO_MCP_SHELL and HANZO_MCP_FORCE_SHELL

- Update hanzo-tools-shell to only include detected shell in TOOLS list
  - HANZO_MCP_ALL_SHELLS=1 to expose all shells
  - get_shell_tools() now supports shell_override parameter

- Add CLI options to hanzo-mcp:
  - --shell: Specify shell by name or path
  - --all-shells: Expose all shell tools
  - Updated --force-shell to include fish and dash

- Bump hanzo-tools-shell to 0.6.0 (published to PyPI)
- Bump hanzo-mcp to 0.10.36

Detection order: HANZO_MCP_SHELL > HANZO_MCP_FORCE_SHELL > CLI --shell >
invoking shell > login shell > $SHELL
2026-01-11 19:11:20 -08:00
zeekay 169a7dccf2 feat: HANZO_AUTO_BACKGROUND_TIMEOUT=0 disables auto-backgrounding
- Setting timeout to 0 or negative now disables auto-backgrounding
  (uses 24h internal timeout instead of immediate backgrounding)
- Updated docstrings to document the disabled behavior
- hanzo-tools-shell 0.5.6, hanzo-tools-agent 0.3.1, hanzo-mcp 0.10.35
2026-01-05 12:50:30 -08:00
zeekay 86cb5e0eb5 feat: configurable HANZO_AUTO_BACKGROUND_TIMEOUT env var (default: 30s) 2026-01-05 06:41:08 -08:00
zeekay 88d094cfe0 perf: 30s auto-backgrounding + fix hanging processes
- Change default timeout from 45s to 30s for faster response
- Fix potential hanging in run_shell by using stream reading instead of communicate()
- Add start_new_session=True to prevent zombie processes
- Proper cleanup on error with process.kill()
- All stream reading uses chunked async reads (8KB chunks)
- Partial output preserved when backgrounding

53 tests pass in 1.1s.
2026-01-05 01:05:53 -08:00
zeekay bd9c6e5740 fix: async audit improvements and test fixes
- Fix deprecated asyncio.get_event_loop() → get_running_loop() in open_tool.py
- Add documentation for ProcessManager dict modification pattern
- Add module docstring for hanzo_async.paths explaining executor usage
- Fix bash test to use proper bash syntax (not zsh-style { } backgrounding)
- Bump hanzo-tools-shell 0.5.2 → 0.5.3
- Bump hanzo-async 0.1.0 → 0.1.1

All 53 shell tests pass. Async code review: production-ready.
2026-01-04 17:18:57 -08:00
zeekay 4fa44a28fc refactor: remove ambiguous shell tool, keep specific shells
- Remove ShellTool from TOOLS list (too ambiguous)
- Keep zsh, bash, fish, dash as specific shell tools
- Update get_shell_tools to include bash
- Fix test imports (ShellTool now in shell_tools.py)
- Update tests to expect cmd as primary tool
- Verify asyncio.gather + uvloop works correctly

hanzo-tools-shell: 0.5.1 → 0.5.2
2026-01-04 13:27:34 -08:00
zeekay 35c8288217 chore: bump versions for PyPI release
- hanzo-async: 0.1.0 (new)
- hanzo-tools-fs: 0.3.1
- hanzo-tools-shell: 0.5.1
- hanzo-tools-agent: 0.3.0
- hanzo-mcp: 0.10.31
2026-01-03 17:41:51 -08:00
zeekay f34a70a041 feat: add hanzo-async unified async I/O with uvloop support
New package: hanzo-async
- Automatic uvloop detection and configuration
- Async file I/O (read_file, write_file, append_file, read_json, write_json)
- Async path operations (path_exists, is_file, is_dir, mkdir, etc.)
- Async subprocess execution (run_command, run_shell)
- Graceful fallback to asyncio on Windows or when uvloop not installed

Updated packages to use hanzo-async:
- hanzo-tools-shell: base_process.py, ps_tool.py, shell_tools.py
- hanzo-tools-agent: agent_tool.py, dataset.py
- hanzo-tools-fs: search.py
- hanzo-mcp: cli.py, auto_timeout.py, event_loop.py, version_tool.py

Shell improvements:
- Renamed zsh_tool.py to shell_tools.py (better organization)
- Added DashTool for Debian/Ubuntu's fast POSIX shell
- All shell tools now thin shims over CmdTool

Version info now shows async backend:
- CLI: hanzo-mcp 0.10.27 (async: uvloop 0.22.1)
- Tool: async: uvloop 0.22.1
2026-01-03 17:39:48 -08:00
zeekay 1143769c59 fix(lint): fix import sorting and lru_cache noqa
- Fix 12 import sorting issues (I001)
- Add noqa for lru_cache in shellflow.py (TID251 rule for Stainless SDK)
2025-12-27 20:32:45 -08:00
zeekay 6998188dea style: format test files with black 2025-12-27 15:00:11 -08:00
zeekay 058fffc218 docs: add READMEs for all 18 hanzo-tools-* packages 2025-12-27 14:55:13 -08:00
zeekay a8eb3c4b67 feat(shell): shellflow DSL parser with high-performance optimization
- Add shellflow.py: minimal DSL for DAG execution
  - Syntax: A ; B (sequential), { A & B } (parallel)
  - Compiles to JSON AST, S-expressions, or command list
  - Supports quoted strings, &&, ||, nested braces

- Performance optimizations:
  - Precompiled regex with local variable caching
  - Fast-path for simple/sequential commands (8x faster)
  - LRU cache for repeated patterns
  - Full type annotations for mypyc compilation

- Restore dag as separate semantic tool:
  - dag: for parallel/serial/graph execution
  - zsh: for shell commands with shellflow DSL
  - Both support nested arrays for auto-parallel

- Add comprehensive test suite (53 tests):
  - Tokenizer, parser, normalization tests
  - S-expression and command conversion tests
  - Performance benchmarks
  - Integration tests with real shell execution

Performance: ~7M ops/sec for simple commands,
~220k ops/sec for sequential, ~100k ops/sec for mixed DAGs
2025-12-27 14:44:33 -08:00
zeekay a3a10fb760 docs(shell): update bash/shell tool descriptions with Shellflow syntax 2025-12-27 14:17:48 -08:00
zeekay 289b7d5711 feat(shell): add Shellflow DSL for inline DAG syntax
Shellflow syntax:
  A ; B ; C           → sequential
  { A & B & C }       → parallel
  A ; { B & C } ; D   → mixed

Usage:
  zsh("mkdir dist ; { cp a dist/ & cp b dist/ } ; zip out.zip dist/")

Compiles to JSON AST then executes via DAG.
Bump to v0.4.0
2025-12-27 14:17:04 -08:00
zeekay 0f8b1e9906 feat(shell): nested arrays auto-parallel in DAG execution
zsh(["setup", ["a", "b", "c"], "cleanup"])
# Runs: setup → (a, b, c in parallel) → cleanup

Bump hanzo-tools-shell to v0.3.3
2025-12-27 13:34:59 -08:00
zeekay fb1873b2ac feat(shell): add bash tool and shell parameter for runtime switching
- Add shell parameter to zsh/bash/shell tools for runtime shell switching
- Add BashTool for bash-specific scripts
- Usage: zsh("cmd", shell="bash") or bash("cmd")
- Bump hanzo-tools-shell to v0.3.2
2025-12-27 13:32:07 -08:00
zeekay 47c9c200b3 refactor(shell): merge dag into zsh for unified shell tool
- ZshTool now includes full DAG functionality (serial, parallel, graph)
- Single "zsh" command for all shell operations
- Usage: zsh("ls") or zsh(["cmd1", "cmd2"]) or zsh([...], parallel=True)
- DagTool kept in codebase for backwards compatibility
- Removed DagTool from default TOOLS list
- Bump hanzo-tools-shell to v0.3.1
2025-12-27 13:09:33 -08:00
zeekay a9769ebb28 refactor: merge hanzo-tools-core into hanzo-tools
- hanzo-tools now contains core infrastructure (BaseTool, ToolRegistry, etc.)
- hanzo-tools-core becomes a thin backwards-compat wrapper
- All tool packages now depend on hanzo-tools>=0.3.0
- Reduces package count and simplifies dependency tree
2025-12-26 16:53:58 -08:00
zeekay 08af6230f0 chore: bump hanzo-tools-shell to 0.3.0 2025-12-26 13:25:55 -08:00
zeekay a2403c928b feat(shell): add curl, jq, wget tools for shell escaping-free operations
Add three new shell tools that bypass shell escaping issues by using
subprocess with list arguments instead of shell interpretation:

- curl: HTTP client with proper JSON body handling
- jq: JSON processor with direct filter passing
- wget: File/site downloads with mirror mode support

These tools solve the common problem of shell escaping nightmares
when working with complex JSON or special characters.

Updates:
- Added CurlTool, JqTool, WgetTool to hanzo-tools-shell
- Updated __all__ exports and TOOLS list
- Added tools to entrypoint_loader PACKAGE_TOOL_PREFIXES
2025-12-26 13:25:21 -08:00
zeekay 5a1c976535 feat: consolidate tools - 52 to 30 tools
Major consolidation of hanzo-mcp tools:

Memory (9 → 1 tool):
- Unified UnifiedMemoryTool with actions: recall, create, update, delete,
  manage, facts, store, summarize, kb

Agent (10+ → 3 tools):
- Unified UnifiedAgentTool for claude, codex, gemini, grok CLI agents
- Removed duplicate critic (use reasoning.critic instead)
- Kept iching and review tools
- Removed code_auth, network, request_clarification

LLM (3 → 2 tools):
- Removed llm_manage (consolidated into llm)

Tool Management (4 → 1 tool):
- Existing unified `tool` command handles install, enable, disable, list

Essential Tools:
- Added memory, shell, open, tool to ESSENTIAL_TOOLS
- Added memory to ESSENTIAL_SYSTEM_TOOLS (always enabled)
- Updated hanzo mode with iching, review, computer

Bug fixes:
- Fixed async await warning in dag_tool.py
- Fixed duplicate critic conflict between agent and reasoning
2025-12-26 11:43:19 -08:00
zeekay 23b8a161a9 chore: bump hanzo-tools-* to 0.2.0, hanzo-mcp to 0.10.17
Published all packages to PyPI:
- hanzo-tools-core 0.2.0
- hanzo-tools-filesystem 0.2.0
- hanzo-tools-shell 0.2.0
- hanzo-tools-browser 0.2.0
- hanzo-tools-memory 0.2.0
- hanzo-tools-todo 0.2.0
- hanzo-tools-reasoning 0.2.0
- hanzo-tools-lsp 0.2.0
- hanzo-tools-refactor 0.2.0
- hanzo-tools-database 0.2.0
- hanzo-tools-agent 0.2.0
- hanzo-tools-jupyter 0.2.0
- hanzo-tools-editor 0.2.0
- hanzo-tools-computer 0.2.0
- hanzo-mcp 0.10.17
2025-12-26 06:49:24 -08:00
zeekay 7ff34ba5bf feat(hanzo-tools): v0.10.17 - modular tool packages + computer control
- Add hanzo-tools-computer package for pyautogui Mac automation
- Fix hanzo-tools-agent imports to use new package structure
- Add get_read_only_*_tools() helpers to filesystem/jupyter
- Remove BatchTool (replaced by dag - one tool per capability)
- Remove hanzo-persona dependency (not published yet)
- Simplify pyproject.toml for local development

Packages ready for PyPI:
- hanzo-tools-core
- hanzo-tools-filesystem
- hanzo-tools-shell
- hanzo-tools-browser
- hanzo-tools-memory
- hanzo-tools-todo
- hanzo-tools-reasoning
- hanzo-tools-lsp
- hanzo-tools-refactor
- hanzo-tools-database
- hanzo-tools-agent
- hanzo-tools-jupyter
- hanzo-tools-editor
- hanzo-tools-computer (NEW)
2025-12-26 06:37:28 -08:00
zeekay c825db98e5 chore: run ruff format on all hanzo packages 2025-12-26 04:12:26 -08:00
zeekay a3b58c011f chore: fix ruff linting issues across all hanzo-tools packages
- Fix import sorting (I001) in all packages
- Fix bare except (E722) in lsp_tool.py
- Fix duplicate set item (B033) in refactor_tool.py
2025-12-26 04:11:10 -08:00
zeekay 08970ba62c fix(dag): add defensive check for ProcessManager singleton
Add runtime check to provide better error message if ProcessManager()
returns None. This should never happen with proper singleton pattern,
but helps diagnose issues in edge cases.
2025-12-26 03:49:32 -08:00
zeekay d5f8e3f2b5 feat(hanzo-tools): add modular tool packages with 53 tools across 13 packages
Introduces hanzo-tools-* namespace packages for independent tool installation:

Core packages:
- hanzo-tools-core: BaseTool, ToolRegistry, PermissionManager
- hanzo-tools-filesystem: read, write, edit, tree, find, search, ast (7 tools)
- hanzo-tools-shell: dag, ps, zsh, shell, npx, uvx, open (7 tools)

AI/Agent packages:
- hanzo-tools-agent: critic, iching, review, network, CLI agents (12 tools)
- hanzo-tools-memory: recall/create/update/delete memories, facts, KB (9 tools)
- hanzo-tools-reasoning: think, critic (2 tools)

Editor/Dev packages:
- hanzo-tools-lsp: Language Server Protocol tool (1 tool)
- hanzo-tools-refactor: rename, extract, inline, move, change_signature (1 tool)
- hanzo-tools-database: SQL + graph database tools (8 tools)
- hanzo-tools-editor: neovim integration (3 tools)
- hanzo-tools-jupyter: notebook read/edit (1 tool)
- hanzo-tools-browser: Playwright browser automation (1 tool)
- hanzo-tools-todo: unified todo management (1 tool)

Key improvements:
- All subprocess.run calls have timeout protection
- All tool .call() methods are async
- Namespace package pattern for mix-and-match installation
- Entry point discovery via hanzo.tools
- No blocking imports (all < 2s)

Also updates hanzo-mcp:
- Browser tool integration
- Tool install/registry for dynamic tool management
- Auto-background timeout reduced to 60s
2025-12-25 22:38:26 -08:00