mirror of
https://github.com/0xWheatyz/handler.git
synced 2026-08-29 19:21:40 +00:00
pi bridge: activate the full built-in tool set (grep/find/ls)
pi ships seven built-in tools but activates only read/write/edit/bash by default. The --tools flag can't fix this (it is a strict allowlist that drops extension tools — verified against a live endpoint), so the bridge calls setActiveTools with everything registered at session start: all seven built-ins plus ask_operator and the four memory tools. Verified live: the model now receives all twelve tool definitions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KdGv3u3DfTsP1S188KDhVH
This commit is contained in:
@@ -134,7 +134,9 @@ completion gate never sees generated files:
|
||||
`PI_CONTEXT_WINDOW`, and `PI_MAX_TOKENS` tune it; everything else in the env map
|
||||
passes through to the process.
|
||||
- **`extensions/handler-bridge.ts`** — the bundled bridge extension that adapts pi's
|
||||
events to the same `python -m handler.hooks` contract claude uses. The gates are the
|
||||
events to the same `python -m handler.hooks` contract claude uses. It also activates
|
||||
pi's full built-in tool set — `read`, `write`, `edit`, `bash`, plus `grep`, `find`,
|
||||
and `ls`, which pi leaves off by default — alongside the handler tools it registers. The gates are the
|
||||
*same tested Python code*: the Stop/completion gate re-prompts pi with the blockers,
|
||||
`git push` runs the test + image-build + protected-branch approval gates and denies on
|
||||
failure, and questions go through an `ask_operator` tool that pauses the agent for the
|
||||
|
||||
@@ -84,6 +84,14 @@ export default function (pi: ExtensionAPI) {
|
||||
let stopRounds = 0;
|
||||
let lastAssistantText = "";
|
||||
|
||||
// Tool parity with the claude harness: pi ships read/write/edit/bash active and
|
||||
// leaves grep/find/ls off by default. Enable everything registered — the built-ins
|
||||
// plus this bridge's own tools. (The --tools flag can't do this: it is a strict
|
||||
// allowlist that would drop extension tools.)
|
||||
pi.on("session_start", async () => {
|
||||
pi.setActiveTools(pi.getAllTools().map((t) => t.name));
|
||||
});
|
||||
|
||||
// ---- memory recall at session start (claude's SessionStart hook) ----------------
|
||||
pi.on("before_agent_start", async () => {
|
||||
if (contextInjected) return;
|
||||
|
||||
@@ -106,6 +106,9 @@ def test_write_config_renders_provider_and_bridge(pi_env, tmp_path):
|
||||
assert "handler.hooks" in text
|
||||
assert "handler.mcpserver" in text
|
||||
assert "ask_operator" in text
|
||||
# Tool parity: the bridge activates pi's full built-in set (grep/find/ls are off
|
||||
# by default) alongside its own tools.
|
||||
assert "setActiveTools" in text
|
||||
assert (base / "APPEND_SYSTEM.md").read_text().strip()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user