fix: correct tool name guidance, UUID comment, and docstring path

- Support both read_file (E2B) and Read (non-E2B) in prompt guidance
- Fix UUID comment from "UUID-v4" to "UUID" (regex accepts all versions)
- Update security_hooks docstring to include UUID segment in path
This commit is contained in:
Zamil Majdy
2026-03-14 22:28:12 +07:00
parent 84482071a8
commit f07bb52ac3
3 changed files with 5 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ if TYPE_CHECKING:
# for sweep operations without depending on a private implementation detail.
SDK_PROJECTS_DIR = os.path.realpath(os.path.expanduser("~/.claude/projects"))
# Compiled UUID-v4 pattern for validating conversation directory names.
# Compiled UUID pattern for validating conversation directory names.
# Kept as a module-level constant so the security-relevant pattern is easy
# to audit in one place and avoids recompilation on every call.
_UUID_RE = re.compile(r"^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$", re.IGNORECASE)

View File

@@ -124,8 +124,9 @@ Important files (code, configs, outputs) should be saved to workspace to ensure
### SDK tool-result files
When tool outputs are large, the SDK truncates them and saves the full output to
a local file under `~/.claude/projects/.../tool-results/`. To read these files,
always use `read_file` (NOT `read_workspace_file`). `read_workspace_file` reads
from cloud workspace storage, where SDK tool-results are NOT stored.
always use `read_file` or `Read` (NOT `read_workspace_file`).
`read_workspace_file` reads from cloud workspace storage, where SDK
tool-results are NOT stored.
{_SHARED_TOOL_NOTES}"""

View File

@@ -42,7 +42,7 @@ def _validate_workspace_path(
Delegates to :func:`is_allowed_local_path` which permits:
- The SDK working directory (``/tmp/copilot-<session>/``)
- The current session's tool-results directory
(``~/.claude/projects/<encoded-cwd>/tool-results/``)
(``~/.claude/projects/<encoded-cwd>/<uuid>/tool-results/``)
"""
path = tool_input.get("file_path") or tool_input.get("path") or ""
if not path: