perf(ttft): salvage easy-win startup optimizations from #3346 (#3395)

* perf(ttft): dedupe shared tool availability checks

* perf(ttft): short-circuit vision auto-resolution

* perf(ttft): make Claude Code version detection lazy

* perf(ttft): reuse loaded toolsets for skills prompt

---------

Co-authored-by: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com>
This commit is contained in:
Teknium
2026-03-27 07:49:44 -07:00
committed by GitHub
parent 41d9d08078
commit 5a1e2a307a
7 changed files with 124 additions and 12 deletions

View File

@@ -81,6 +81,33 @@ class TestGetDefinitions:
assert len(defs) == 1
assert defs[0]["function"]["name"] == "available"
def test_reuses_shared_check_fn_once_per_call(self):
reg = ToolRegistry()
calls = {"count": 0}
def shared_check():
calls["count"] += 1
return True
reg.register(
name="first",
toolset="shared",
schema=_make_schema("first"),
handler=_dummy_handler,
check_fn=shared_check,
)
reg.register(
name="second",
toolset="shared",
schema=_make_schema("second"),
handler=_dummy_handler,
check_fn=shared_check,
)
defs = reg.get_definitions({"first", "second"})
assert len(defs) == 2
assert calls["count"] == 1
class TestUnknownToolDispatch:
def test_returns_error_json(self):