Files
d38b004368
Hanzo CI/CD / test (linux-amd64) (push) Skipped
Hanzo CI/CD / test (linux-arm64) (push) Skipped
Hanzo CI/CD / test-advisory (push) Skipped
Hanzo CI/CD / test-amd64 (push) Successful in 3m22s
Hanzo CI/CD / cicd (push) Failing after 5m5s
CI/CD / cicd (push) Failing after 8m37s
hanzo-tools-fs 0.3.5: fs apply_patch edits in one call; base_hash optional (cloud#758) (#52)
`fs` apply_patch required a base_hash from a prior read, and its schema never
said so: a model called it, was refused, read, retried. With enso-auto that
was 5-15 failing calls per edit and hundreds of thousands of cached input
tokens (hanzo-inc/cloud#758). A missing parameter surfaced as a Python
TypeError (INTERNAL_ERROR), not a sentence the model could act on.

Same contract as the Rust runtime (hanzoai/mcp#41) and the TypeScript tool:

- base_hash is optional. Sent, a stale edit is still refused (CONFLICT).
  Omitted, old_text must match exactly once, so one call edits a file.
- The action's schema names uri, old_text and new_text as required and
  base_hash as optional, in the Rust tool's words.
- Missing old_text/new_text is INVALID_PARAMS saying what apply_patch takes;
  a `*** Begin Patch` text sent as `input` is pointed at action "patch".

Test: pkg/hanzo-tools-fs/tests/test_fs_tools.py TestFsApplyPatch, 4 of 5 red
before (the stale-hash case already held), 12/12 after.

Refs hanzo-inc/cloud#758

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-19 13:10:43 -05:00

44 lines
1.1 KiB
TOML

[build-system]
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "hanzo-tools-fs"
version = "0.3.5"
description = "Filesystem tools for Hanzo AI - read, write, edit, search, find"
readme = "README.md"
requires-python = ">=3.12"
license = { text = "MIT" }
authors = [{ name = "Hanzo Industries Inc", email = "[email protected]" }]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
keywords = ["hanzo", "tools", "filesystem", "mcp", "ai"]
dependencies = [
"hanzo-async>=0.1.0", # Unified async I/O with uvloop
"grep-ast>=0.8.1",
"ffind>=1.3.0",
"watchdog>=6.0.0",
"mcp>=1.25.0",
"fastmcp>=2.14.1",
"pydantic>=2.12.5",
]
[project.urls]
"Homepage" = "https://github.com/hanzoai/python-sdk"
[project.optional-dependencies]
dev = ["pytest>=7.0.0", "ruff>=0.14.0"]
[project.entry-points."hanzo.tools"]
fs = "hanzo_tools.fs:TOOLS"
[tool.setuptools.packages.find]
where = ["."]
include = ["hanzo_tools*"]
[tool.setuptools.package-data]
hanzo_tools = ["py.typed"]