gemcode 0.3.54__tar.gz → 0.3.55__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gemcode-0.3.54/src/gemcode.egg-info → gemcode-0.3.55}/PKG-INFO +1 -1
- {gemcode-0.3.54 → gemcode-0.3.55}/pyproject.toml +1 -1
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/model_routing.py +4 -1
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/session_runtime.py +68 -24
- {gemcode-0.3.54 → gemcode-0.3.55/src/gemcode.egg-info}/PKG-INFO +1 -1
- {gemcode-0.3.54 → gemcode-0.3.55}/LICENSE +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/MANIFEST.in +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/README.md +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/setup.cfg +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/__init__.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/__main__.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/agent.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/audit.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/autocompact.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/callbacks.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/capability_routing.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/cli.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/compaction.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/computer_use/__init__.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/computer_use/browser_computer.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/config.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/context_budget.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/context_warning.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/credentials.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/hitl_session.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/hooks.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/intent_classifier.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/interactions.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/invoke.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/kairos_daemon.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/limits.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/live_audio_engine.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/logging_config.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/mcp_loader.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/memory/__init__.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/memory/embedding_memory_service.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/memory/file_memory_service.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/modality_tools.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/model_errors.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/openapi_loader.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/paths.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/permissions.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/plugins/__init__.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/plugins/terminal_hooks_plugin.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/plugins/tool_recovery_plugin.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/pricing.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/prompt_suggestions.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/query/__init__.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/query/config.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/query/deps.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/query/engine.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/query/stop_hooks.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/query/token_budget.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/query/transitions.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/refine.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/repl_commands.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/repl_slash.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/review_agent.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/session_store.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/slash_commands.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/thinking.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tool_prompt_manifest.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tool_registry.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/__init__.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/bash.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/browser.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/edit.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/filesystem.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/notes.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/search.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/shell.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/shell_gate.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/subtask.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/think.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/todo.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools/web.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tools_inspector.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/trust.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tui/input_handler.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tui/scrollback.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tui/spinner.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tui/welcome_banner.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/tui/welcome_rich.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/version.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/vertex.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/web/__init__.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/web/claude_sse_adapter.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/web/terminal_repl.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode/workspace_hints.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode.egg-info/SOURCES.txt +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode.egg-info/dependency_links.txt +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode.egg-info/entry_points.txt +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode.egg-info/requires.txt +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/src/gemcode.egg-info/top_level.txt +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_agent_instruction.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_autocompact.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_capability_routing.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_claude_web_adapter_sse.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_cli_init.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_computer_use_permissions.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_context_budget.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_context_warning.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_credentials.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_interactive_permission_ask.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_kairos_scheduler.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_modality_tools.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_model_error_retry.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_model_errors.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_model_routing.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_paths.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_permissions.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_prompt_suggestions.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_repl_commands.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_repl_slash.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_slash_commands.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_thinking_config.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_token_budget.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_tool_context_circulation.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_tools.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_tools_inspector.py +0 -0
- {gemcode-0.3.54 → gemcode-0.3.55}/tests/test_workspace_hints.py +0 -0
|
@@ -60,7 +60,10 @@ def pick_effective_model(cfg: GemCodeConfig, prompt: str) -> str:
|
|
|
60
60
|
# (Deep research already handled above.)
|
|
61
61
|
if getattr(cfg, "enable_audio", False):
|
|
62
62
|
return getattr(cfg, "model_audio_live", None) or cfg.model
|
|
63
|
-
|
|
63
|
+
# Only switch to the computer-use model when Playwright is actually available.
|
|
64
|
+
# `_computer_use_available` is set False by session_runtime when the probe fails,
|
|
65
|
+
# preventing an HTTP 400 ("model requires Computer Use tool") from the API.
|
|
66
|
+
if getattr(cfg, "enable_computer_use", False) and getattr(cfg, "_computer_use_available", True):
|
|
64
67
|
return getattr(cfg, "model_computer_use", None) or cfg.model
|
|
65
68
|
|
|
66
69
|
primary_fast = cfg.model
|
|
@@ -12,8 +12,13 @@ token budget helpers, and `GemCodeQueryEngine`.
|
|
|
12
12
|
from __future__ import annotations
|
|
13
13
|
|
|
14
14
|
import os
|
|
15
|
+
import warnings
|
|
15
16
|
from pathlib import Path
|
|
16
17
|
|
|
18
|
+
# Suppress ADK's noisy "EXPERIMENTAL feature" UserWarning globally.
|
|
19
|
+
# Users get enough context from gemcode's own messages; the warning is redundant.
|
|
20
|
+
warnings.filterwarnings("ignore", category=UserWarning, message=".*EXPERIMENTAL.*")
|
|
21
|
+
|
|
17
22
|
from google.adk.runners import Runner
|
|
18
23
|
from google.adk.sessions.sqlite_session_service import SqliteSessionService
|
|
19
24
|
|
|
@@ -30,6 +35,29 @@ def session_db_path(cfg: GemCodeConfig) -> Path:
|
|
|
30
35
|
return cfg.project_root / ".gemcode" / "sessions.sqlite"
|
|
31
36
|
|
|
32
37
|
|
|
38
|
+
def _playwright_available() -> bool:
|
|
39
|
+
"""
|
|
40
|
+
Quick synchronous check: does a usable Playwright browser executable exist?
|
|
41
|
+
|
|
42
|
+
Runs playwright.sync_api.sync_playwright() briefly to resolve the browser
|
|
43
|
+
path, without actually launching a browser. Falls back to a path probe if
|
|
44
|
+
playwright is not installed.
|
|
45
|
+
|
|
46
|
+
Returns True only when Playwright AND at least one browser binary are present.
|
|
47
|
+
This is called before building the runner so we can disable computer-use
|
|
48
|
+
early and prevent model routing from switching to gemini-2.5-computer-use-*.
|
|
49
|
+
"""
|
|
50
|
+
try:
|
|
51
|
+
from playwright.sync_api import sync_playwright
|
|
52
|
+
with sync_playwright() as p:
|
|
53
|
+
exe = p.chromium.executable_path
|
|
54
|
+
return bool(exe) and Path(exe).exists()
|
|
55
|
+
except Exception:
|
|
56
|
+
pass
|
|
57
|
+
# playwright not installed at all
|
|
58
|
+
return False
|
|
59
|
+
|
|
60
|
+
|
|
33
61
|
def _make_safe_computer_toolset(computer):
|
|
34
62
|
"""
|
|
35
63
|
Build a BaseToolset-compatible wrapper around ComputerUseToolset that catches
|
|
@@ -183,31 +211,47 @@ def create_runner(cfg: GemCodeConfig, extra_tools: list | None = None) -> Runner
|
|
|
183
211
|
pass # OpenAPIToolset not in this ADK version — continue without
|
|
184
212
|
|
|
185
213
|
# Computer-use: ADK ComputerUseToolset backed by our Playwright BrowserComputer.
|
|
186
|
-
#
|
|
187
|
-
#
|
|
214
|
+
# Probe Playwright BEFORE building the agent so model routing (which runs
|
|
215
|
+
# inside build_root_agent → pick_effective_model) never switches to
|
|
216
|
+
# gemini-2.5-computer-use-* when the browser binary is missing.
|
|
188
217
|
if getattr(cfg, "enable_computer_use", False):
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
218
|
+
if not _playwright_available():
|
|
219
|
+
import sys
|
|
220
|
+
print(
|
|
221
|
+
"\n[gemcode] Browser (computer-use) is unavailable — Playwright browsers "
|
|
222
|
+
"are not installed.\n"
|
|
223
|
+
" Run: playwright install chromium\n"
|
|
224
|
+
" Then restart GemCode with /computer on (or --computer flag).\n"
|
|
225
|
+
" Disabling computer-use for this session.\n",
|
|
226
|
+
file=sys.stderr,
|
|
227
|
+
)
|
|
228
|
+
# Disable so model_routing stays on the normal model (not computer-use preview).
|
|
229
|
+
cfg.enable_computer_use = False
|
|
230
|
+
cfg._computer_use_available = False # type: ignore[attr-defined]
|
|
231
|
+
else:
|
|
232
|
+
cfg._computer_use_available = True # type: ignore[attr-defined]
|
|
233
|
+
headless_env = os.environ.get("GEMCODE_COMPUTER_HEADLESS", "1").lower()
|
|
234
|
+
headless = headless_env in ("1", "true", "yes", "on")
|
|
235
|
+
viewport_w = int(os.environ.get("GEMCODE_BROWSER_WIDTH", "1280"))
|
|
236
|
+
viewport_h = int(os.environ.get("GEMCODE_BROWSER_HEIGHT", "720"))
|
|
237
|
+
from gemcode.computer_use.browser_computer import BrowserComputer
|
|
238
|
+
|
|
239
|
+
computer = BrowserComputer(
|
|
240
|
+
headless=headless,
|
|
241
|
+
viewport_size=(viewport_w, viewport_h),
|
|
242
|
+
)
|
|
243
|
+
computer_toolset = _make_safe_computer_toolset(computer)
|
|
244
|
+
merged_extra_tools = list(merged_extra_tools or [])
|
|
245
|
+
if computer_toolset is not None:
|
|
246
|
+
merged_extra_tools.append(computer_toolset)
|
|
247
|
+
|
|
248
|
+
# Standalone read-only browser tools (browser_screenshot, browser_get_text, etc.)
|
|
249
|
+
from gemcode.tools.browser import build_browser_inspection_tools
|
|
250
|
+
browser_tools = build_browser_inspection_tools(cfg, computer)
|
|
251
|
+
merged_extra_tools.extend(browser_tools)
|
|
252
|
+
|
|
253
|
+
# Store reference on cfg so slash commands / TUI can check browser state.
|
|
254
|
+
cfg._browser_computer = computer # type: ignore[attr-defined]
|
|
211
255
|
|
|
212
256
|
agent = build_root_agent(cfg, extra_tools=merged_extra_tools)
|
|
213
257
|
db = session_db_path(cfg)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|