cconnect 2.0.6__tar.gz → 2.0.7__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.
- {cconnect-2.0.6 → cconnect-2.0.7}/PKG-INFO +1 -1
- {cconnect-2.0.6 → cconnect-2.0.7}/cconnect.egg-info/PKG-INFO +1 -1
- {cconnect-2.0.6 → cconnect-2.0.7}/cconnect.egg-info/SOURCES.txt +2 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/release.py +1 -1
- {cconnect-2.0.6 → cconnect-2.0.7}/mcps/session.py +4 -6
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/agents.py +1 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/capabilities.py +1 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/chat.py +12 -3
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/claude.py +2 -2
- {cconnect-2.0.6 → cconnect-2.0.7}/schemas/chat.py +1 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/accounts.py +12 -5
- {cconnect-2.0.6 → cconnect-2.0.7}/services/acp_events.py +0 -108
- {cconnect-2.0.6 → cconnect-2.0.7}/services/agent_connections.py +2 -2
- {cconnect-2.0.6 → cconnect-2.0.7}/services/agent_sessions.py +19 -6
- {cconnect-2.0.6 → cconnect-2.0.7}/services/claude_runtime.py +9 -2
- {cconnect-2.0.6 → cconnect-2.0.7}/services/cli_info.py +12 -4
- {cconnect-2.0.6 → cconnect-2.0.7}/services/cli_settings.py +56 -8
- cconnect-2.0.7/services/control_requests.py +70 -0
- cconnect-2.0.7/services/elicitation.py +157 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/mods.py +13 -22
- {cconnect-2.0.6 → cconnect-2.0.7}/services/persistent_sessions.py +2 -1
- {cconnect-2.0.6 → cconnect-2.0.7}/services/usage.py +59 -35
- {cconnect-2.0.6 → cconnect-2.0.7}/cconnect.egg-info/dependency_links.txt +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/cconnect.egg-info/entry_points.txt +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/cconnect.egg-info/requires.txt +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/cconnect.egg-info/top_level.txt +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/__init__.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/access.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/app.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/cli.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/cli_manager.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/config.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/data_migration.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/db.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/display.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/models.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packages.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/builtin.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect/accents.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect/pack.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect/terminal/black.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect/themes/cconnect-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect/themes/cconnect-light.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/backgrounds/cyberpunk.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/backgrounds/darkwave.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/pack.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/campbell.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/catppuccin-latte.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/catppuccin-mocha.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/claude-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/claude-light.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/dark-plus.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/dracula.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/github-dark-hc.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/github-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/github-dimmed.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/github-light-hc.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/github-light.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/gruvbox-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/light-plus.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/monokai.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/nord.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/one-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/one-half-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/one-half-light.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/rose-pine.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/solarized-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/solarized-light.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/tango-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/tango-light.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/tokyo-night.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/ubuntu.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/vscode-dark-modern.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/vscode-hc-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/vscode-hc-light.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/terminal/vscode-light-modern.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/catppuccin-latte.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/catppuccin-mocha.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/claude-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/claude-light.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/dracula.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/github-dark-hc.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/github-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/github-dimmed.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/github-light-hc.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/github-light.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/gruvbox-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/nord.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/one-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/rose-pine.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/solarized-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/solarized-light.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/tokyo-night.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/vscode-dark-modern.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/vscode-dark-plus.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/vscode-hc-dark.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/vscode-hc-light.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/vscode-light-modern.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/cconnect-extras/themes/vscode-light-plus.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/packs/schema.json +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/paths.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/process_job.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/prompts/BLOCKS.md +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/prompts/BROWSER.md +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/prompts/CCONNECT.md +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/prompts/COMMIT.md +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/prompts/MODS.md +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/prompts/SUGGESTIONS.md +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/rate_limit.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/responses.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/scripts/page_icon.js +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/sdk.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/settings_defs.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/slugs.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/core/ws.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/mcps/__init__.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/mcps/browser.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/mcps/check_progress.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/mcps/components.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/mcps/delegate.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/mcps/media.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/mcps/packs.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/mcps/shared_files.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/mcps/terminal.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/middleware/__init__.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/middleware/error_handler.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/middleware/public_auth.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/middleware/security.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/pyproject.toml +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/__init__.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/accounts.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/browser.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/cli.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/git.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/health.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/list.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/network.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/packs.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/projects.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/sessions.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/settings.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/shared.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/system.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/routers/terminal.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/schemas/__init__.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/schemas/accounts.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/schemas/network.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/__init__.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/account_login.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/acp_peer.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/agent_registry.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/agents.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/api_errors.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/attachments.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/blocks.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/browser.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/categories.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/chat_list.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/claude_assets.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/claude_manage.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/claude_status.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/delegate_runner.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/delegate_runs.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/delegates.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/diffs.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/directories.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/directory_watch.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/event_rows.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/files.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/git.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/git_ops.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/live_sessions.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/network.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/pack_format.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/packs.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/project_files.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/project_watch.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/projects.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/prompt_cache.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/providers.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/questions.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/repo.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/rewind.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/sessions.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/settings_store.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/shared.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/shared_links.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/shared_watch.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/speedtest.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/system_monitor.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/system_watch.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/terminal.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/todos.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/tool_calls.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/tool_props.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/trash.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/services/visibility.py +0 -0
- {cconnect-2.0.6 → cconnect-2.0.7}/setup.cfg +0 -0
|
@@ -153,12 +153,14 @@ services/claude_runtime.py
|
|
|
153
153
|
services/claude_status.py
|
|
154
154
|
services/cli_info.py
|
|
155
155
|
services/cli_settings.py
|
|
156
|
+
services/control_requests.py
|
|
156
157
|
services/delegate_runner.py
|
|
157
158
|
services/delegate_runs.py
|
|
158
159
|
services/delegates.py
|
|
159
160
|
services/diffs.py
|
|
160
161
|
services/directories.py
|
|
161
162
|
services/directory_watch.py
|
|
163
|
+
services/elicitation.py
|
|
162
164
|
services/event_rows.py
|
|
163
165
|
services/files.py
|
|
164
166
|
services/git.py
|
|
@@ -184,6 +184,7 @@ def make_tools(context: dict) -> list:
|
|
|
184
184
|
account = context.get("account")
|
|
185
185
|
info = context.get("session_info")
|
|
186
186
|
capabilities = context.get("capabilities") or ()
|
|
187
|
+
locale = context.get("locale")
|
|
187
188
|
on_provider = bool(accounts.provider_for(account))
|
|
188
189
|
|
|
189
190
|
if info is not None:
|
|
@@ -246,9 +247,9 @@ def make_tools(context: dict) -> list:
|
|
|
246
247
|
|
|
247
248
|
@tool("usage", USAGE, {})
|
|
248
249
|
async def usage(args):
|
|
249
|
-
from services.usage import CAPABILITY as USAGE, usage_blocks, usage_data,
|
|
250
|
+
from services.usage import CAPABILITY as USAGE, usage_blocks, usage_data, window_line
|
|
250
251
|
|
|
251
|
-
data = await usage_data(account)
|
|
252
|
+
data = await usage_data(account, language=locale)
|
|
252
253
|
if "error" in data:
|
|
253
254
|
return {"content": [{"type": "text", "text": data["error"]}]}
|
|
254
255
|
windows = data.get("windows") or []
|
|
@@ -257,10 +258,7 @@ def make_tools(context: dict) -> list:
|
|
|
257
258
|
elif emit is not None and COMPONENTS in capabilities and windows:
|
|
258
259
|
await emit({"type": "component", "blocks": await usage_blocks(account)})
|
|
259
260
|
lines = [f"Plan: {data['plan']}"] if data.get("plan") else []
|
|
260
|
-
lines += [
|
|
261
|
-
f"{window_label(win['id'])}: {round(win['percent'])}%" + (" (not used yet)" if win["unused"] else "")
|
|
262
|
-
for win in windows
|
|
263
|
-
]
|
|
261
|
+
lines += [window_line(win) for win in windows]
|
|
264
262
|
return {"content": [{"type": "text", "text": "\n".join(lines) or "No usage data available."}]}
|
|
265
263
|
|
|
266
264
|
tools.append(usage)
|
|
@@ -224,6 +224,7 @@ async def _signed_in(agent_id: str, held: terminal.Terminal) -> None:
|
|
|
224
224
|
await held.exited.wait()
|
|
225
225
|
if held.exit_status in (None, 0):
|
|
226
226
|
await pool.restart(agent_id)
|
|
227
|
+
agent_sessions.watch.refresh(agent_id)
|
|
227
228
|
|
|
228
229
|
|
|
229
230
|
async def _login_command(agent_id: str, method: str, cwd: str) -> tuple[str, list[str], dict[str, str]]:
|
|
@@ -41,6 +41,7 @@ async def get_capabilities(capabilities: str = Query(""), account: str = Query("
|
|
|
41
41
|
"supported_cli": SUPPORTED_CLI,
|
|
42
42
|
"permission_modes": [{"id": m, "label": PERMISSION_LABELS.get(m, m)} for m in permission_modes()],
|
|
43
43
|
"models": listed,
|
|
44
|
+
"subagent_efforts": cli_info.subagent_efforts(info),
|
|
44
45
|
"request_limit": REQUEST_LIMIT_BYTES,
|
|
45
46
|
"shared_scheme": SHARED_SCHEME,
|
|
46
47
|
"pack_schema": PACK_SCHEMA["schema"],
|
|
@@ -81,6 +81,7 @@ class _Session:
|
|
|
81
81
|
self.effort: str = "max"
|
|
82
82
|
self.partial: bool = False
|
|
83
83
|
self.agent: str | None = None
|
|
84
|
+
self.locale: str | None = None
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
def _build_turn_runner(session, text: str, attachments: list[str] | None = None, seed_id: str | None = None, wanted=None, capabilities=None, on_transport=None, adopt=False, shown=None):
|
|
@@ -137,6 +138,7 @@ def _build_turn_runner(session, text: str, attachments: list[str] | None = None,
|
|
|
137
138
|
request_compact=request_compact,
|
|
138
139
|
reload=lambda kind: session.reload(f"reload-{kind}"),
|
|
139
140
|
capabilities=capabilities,
|
|
141
|
+
locale=state.locale,
|
|
140
142
|
on_transport=on_transport,
|
|
141
143
|
adopt=adopted,
|
|
142
144
|
read_from=shown if adopted else None,
|
|
@@ -311,6 +313,7 @@ def _build_side_runner(main_state: _Session, side_state: _Session, question: str
|
|
|
311
313
|
model=_side_model(main_state),
|
|
312
314
|
emit=emit,
|
|
313
315
|
capabilities=capabilities,
|
|
316
|
+
locale=main_state.locale,
|
|
314
317
|
session_info=lambda: {
|
|
315
318
|
"session_id": side_state.session_id,
|
|
316
319
|
"cwd": str(paths.AI_WORKDIR),
|
|
@@ -325,14 +328,14 @@ def _build_side_runner(main_state: _Session, side_state: _Session, question: str
|
|
|
325
328
|
return factory
|
|
326
329
|
|
|
327
330
|
|
|
328
|
-
async def _run_usage(send, account: str | None = None, capabilities=None):
|
|
331
|
+
async def _run_usage(send, account: str | None = None, capabilities=None, locale: str | None = None):
|
|
329
332
|
"""Send the plan-usage report as a one-off markdown message."""
|
|
330
333
|
from mcps.components import CAPABILITY as COMPONENTS
|
|
331
334
|
from services.usage import CAPABILITY as USAGE, usage_blocks, usage_data, usage_markdown
|
|
332
335
|
|
|
333
336
|
try:
|
|
334
337
|
if USAGE in (capabilities or ()):
|
|
335
|
-
await send({"type": "usage", **await usage_data(account), "local": True})
|
|
338
|
+
await send({"type": "usage", **await usage_data(account, language=locale), "local": True})
|
|
336
339
|
elif COMPONENTS in (capabilities or ()):
|
|
337
340
|
await send({"type": "component", "blocks": await usage_blocks(account), "local": True})
|
|
338
341
|
else:
|
|
@@ -437,6 +440,7 @@ async def chat_ws(ws: WebSocket):
|
|
|
437
440
|
state.effort = msg.effort or settings_store.get("effort")
|
|
438
441
|
state.partial = msg.partial if msg.partial is not None else settings_store.get("streaming")
|
|
439
442
|
session = registry.create(state)
|
|
443
|
+
session.state.locale = msg.locale or session.state.locale
|
|
440
444
|
if previous is not None and previous is not session:
|
|
441
445
|
await previous.detach(sink)
|
|
442
446
|
await send({
|
|
@@ -635,7 +639,12 @@ async def chat_ws(ws: WebSocket):
|
|
|
635
639
|
await send({"type": "error", "message": "busy: a side question is already running", "channel": side_session.channel})
|
|
636
640
|
|
|
637
641
|
elif mtype == "usage":
|
|
638
|
-
spawn(_run_usage(
|
|
642
|
+
spawn(_run_usage(
|
|
643
|
+
send,
|
|
644
|
+
accounts.resolve(session.state.account if session else None),
|
|
645
|
+
seen["capabilities"],
|
|
646
|
+
session.state.locale if session else None,
|
|
647
|
+
))
|
|
639
648
|
|
|
640
649
|
elif mtype == "reload":
|
|
641
650
|
if session is not None:
|
|
@@ -16,8 +16,8 @@ router = APIRouter(tags=["Claude"])
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
@router.get("/claude/usage")
|
|
19
|
-
async def get_usage(account: str | None = None, force: bool = False):
|
|
20
|
-
return api_response(data=await usage_service.usage_data(account, force))
|
|
19
|
+
async def get_usage(account: str | None = None, force: bool = False, lang: str | None = None):
|
|
20
|
+
return api_response(data=await usage_service.usage_data(account, force, lang))
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
@router.get("/claude/status")
|
|
@@ -407,6 +407,12 @@ def _identity(account_id: Optional[str]) -> dict:
|
|
|
407
407
|
return {key: data[key] for key in _IDENTITY_KEYS if key in data}
|
|
408
408
|
|
|
409
409
|
|
|
410
|
+
def plan_name(account_id: Optional[str]) -> Optional[str]:
|
|
411
|
+
account =_identity(account_id).get("oauthAccount")
|
|
412
|
+
name = account.get("planDisplayName") if isinstance(account, dict) else None
|
|
413
|
+
return name if isinstance(name, str) and name.strip() else None
|
|
414
|
+
|
|
415
|
+
|
|
410
416
|
def export_bundle(account_id: str) -> Optional[bytes]:
|
|
411
417
|
"""Zip the credentials and the account's own config. History, caches, the
|
|
412
418
|
machine id and the linked projects/plugins/skills are all left out."""
|
|
@@ -520,13 +526,14 @@ def _merge_shared(source: Path, target: Path, keys: tuple[str, ...]) -> None:
|
|
|
520
526
|
current = json.loads(target.read_text(encoding="utf-8"))
|
|
521
527
|
except (OSError, json.JSONDecodeError):
|
|
522
528
|
current = {}
|
|
523
|
-
before = {key:
|
|
529
|
+
before = {key: cli_settings.lookup(current, key) for key in keys}
|
|
524
530
|
for key in keys:
|
|
525
|
-
|
|
526
|
-
|
|
531
|
+
value = cli_settings.lookup(primary, key)
|
|
532
|
+
if value is None:
|
|
533
|
+
cli_settings.discard(current, key)
|
|
527
534
|
else:
|
|
528
|
-
|
|
529
|
-
if target.is_file() and before == {key:
|
|
535
|
+
cli_settings.assign(current, key, value)
|
|
536
|
+
if target.is_file() and before == {key: cli_settings.lookup(current, key) for key in keys}:
|
|
530
537
|
return
|
|
531
538
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
532
539
|
target.write_text(json.dumps(current, indent=2), encoding="utf-8")
|
|
@@ -23,14 +23,6 @@ FINISHED = ("completed", "failed")
|
|
|
23
23
|
COMPACTION_DONE = "completed"
|
|
24
24
|
COMPACTION_RUNNING = "in_progress"
|
|
25
25
|
PERMISSION_IDS = {"allow_once": "allow", "allow_always": "allow_always", "reject_once": "deny", "reject_always": "deny"}
|
|
26
|
-
ACCEPT = "accept"
|
|
27
|
-
DECLINE = "decline"
|
|
28
|
-
URL_MODE = "url"
|
|
29
|
-
URL_ACTION = "action"
|
|
30
|
-
INTEGER = "integer"
|
|
31
|
-
NUMBER = "number"
|
|
32
|
-
BOOLEAN = "boolean"
|
|
33
|
-
ARRAY = "array"
|
|
34
26
|
|
|
35
27
|
Share = Callable[[bytes, str, str], Awaitable[Optional[dict]]]
|
|
36
28
|
Watch = Callable[[str, str], None]
|
|
@@ -248,103 +240,3 @@ def permission_outcome(answer: dict, params: dict) -> dict:
|
|
|
248
240
|
def resolved_id(option_id: Optional[str], options: list) -> Optional[str]:
|
|
249
241
|
kind = next((option.get("kind") for option in options if isinstance(option, dict) and option.get("id") == option_id), None)
|
|
250
242
|
return PERMISSION_IDS.get(kind or "", option_id)
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
def _field(name: str, spec: dict, required: bool) -> list[dict]:
|
|
254
|
-
kind = spec.get("type")
|
|
255
|
-
label = str(spec.get("title") or name)
|
|
256
|
-
base: dict = {"id": name, "label": label, **({"required": True} if required else {})}
|
|
257
|
-
about = [{"type": "text", "text": str(spec["description"])}] if spec.get("description") else []
|
|
258
|
-
if kind == BOOLEAN:
|
|
259
|
-
return [*about, {**base, "type": "toggle", "value": bool(spec.get("default"))}]
|
|
260
|
-
if kind in (NUMBER, INTEGER):
|
|
261
|
-
bounds = {key: spec[key] for key in ("minimum", "maximum") if isinstance(spec.get(key), (int, float))}
|
|
262
|
-
return [*about, {
|
|
263
|
-
**base,
|
|
264
|
-
"type": "input",
|
|
265
|
-
"format": "number",
|
|
266
|
-
**({"min": bounds["minimum"]} if "minimum" in bounds else {}),
|
|
267
|
-
**({"max": bounds["maximum"]} if "maximum" in bounds else {}),
|
|
268
|
-
**({"step": 1} if kind == INTEGER else {}),
|
|
269
|
-
**({"value": str(spec["default"])} if spec.get("default") is not None else {}),
|
|
270
|
-
}]
|
|
271
|
-
if kind == ARRAY:
|
|
272
|
-
items = spec.get("items") or {}
|
|
273
|
-
return [*about, {**base, "type": "select", "multiple": True, "options": _choices(items)}]
|
|
274
|
-
choices = _choices(spec)
|
|
275
|
-
if choices:
|
|
276
|
-
return [*about, {**base, "type": "select", "display": "dropdown", "options": choices}]
|
|
277
|
-
return [*about, {
|
|
278
|
-
**base,
|
|
279
|
-
"type": "input",
|
|
280
|
-
**{key: spec[key] for key in ("pattern",) if isinstance(spec.get(key), str)},
|
|
281
|
-
**({"min_length": spec["minLength"]} if isinstance(spec.get("minLength"), int) else {}),
|
|
282
|
-
**({"max_length": spec["maxLength"]} if isinstance(spec.get("maxLength"), int) else {}),
|
|
283
|
-
**({"value": str(spec["default"])} if spec.get("default") is not None else {}),
|
|
284
|
-
}]
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
def _choices(spec: dict) -> list[dict]:
|
|
288
|
-
listed = spec.get("oneOf") or spec.get("anyOf")
|
|
289
|
-
if isinstance(listed, list):
|
|
290
|
-
return [
|
|
291
|
-
{"value": str(item.get("const")), "label": str(item.get("title") or item.get("const")), **({"description": str(item["description"])} if item.get("description") else {})}
|
|
292
|
-
for item in listed
|
|
293
|
-
if isinstance(item, dict) and item.get("const") is not None
|
|
294
|
-
]
|
|
295
|
-
if isinstance(spec.get("enum"), list):
|
|
296
|
-
return [{"value": str(value), "label": str(value)} for value in spec["enum"]]
|
|
297
|
-
return []
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
def _typed(value: Any, spec: dict) -> Any:
|
|
301
|
-
kind = spec.get("type")
|
|
302
|
-
if kind == BOOLEAN:
|
|
303
|
-
return value if isinstance(value, bool) else str(value).lower() == "true"
|
|
304
|
-
if kind in (NUMBER, INTEGER):
|
|
305
|
-
try:
|
|
306
|
-
number = float(value)
|
|
307
|
-
except (TypeError, ValueError):
|
|
308
|
-
return value
|
|
309
|
-
return int(number) if kind == INTEGER or number.is_integer() else number
|
|
310
|
-
if kind == ARRAY:
|
|
311
|
-
return value if isinstance(value, list) else [value] if value else []
|
|
312
|
-
return value
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
def elicitation(params: dict) -> dict:
|
|
316
|
-
"""The form the user answers for an agent's request."""
|
|
317
|
-
message = str(params.get("message") or "")
|
|
318
|
-
if params.get("mode") == URL_MODE:
|
|
319
|
-
url = str(params.get("url") or "")
|
|
320
|
-
return {
|
|
321
|
-
"kind": "component",
|
|
322
|
-
"title": message,
|
|
323
|
-
"blocks": [
|
|
324
|
-
{"type": "text", "text": f"[{url}]({url})"},
|
|
325
|
-
{"type": "buttons", "id": URL_ACTION, "options": [
|
|
326
|
-
{"value": ACCEPT, "label": "", "label_key": "link_done", "style": "primary", "icon": "check"},
|
|
327
|
-
{"value": DECLINE, "label": "", "label_key": "cancel", "style": "plain", "icon": "x"},
|
|
328
|
-
]},
|
|
329
|
-
],
|
|
330
|
-
}
|
|
331
|
-
schema = params.get("requestedSchema") or {}
|
|
332
|
-
required = set(schema.get("required") or [])
|
|
333
|
-
blocks = [
|
|
334
|
-
element
|
|
335
|
-
for name, spec in (schema.get("properties") or {}).items()
|
|
336
|
-
if isinstance(spec, dict)
|
|
337
|
-
for element in _field(str(name), spec, name in required)
|
|
338
|
-
]
|
|
339
|
-
return {"kind": "component", "title": message, "blocks": blocks}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
def elicitation_answer(answer: dict, params: dict) -> dict:
|
|
343
|
-
if answer.get("chat"):
|
|
344
|
-
return {"action": DECLINE}
|
|
345
|
-
values = answer.get("values") or {}
|
|
346
|
-
if params.get("mode") == URL_MODE:
|
|
347
|
-
return {"action": ACCEPT if values.get(URL_ACTION) == ACCEPT else DECLINE}
|
|
348
|
-
properties = (params.get("requestedSchema") or {}).get("properties") or {}
|
|
349
|
-
content = {name: _typed(values[name], spec) for name, spec in properties.items() if name in values and isinstance(spec, dict)}
|
|
350
|
-
return {"action": ACCEPT, "content": content}
|
|
@@ -10,7 +10,7 @@ from typing import Any, Awaitable, Callable, Optional, Protocol
|
|
|
10
10
|
import psutil
|
|
11
11
|
|
|
12
12
|
from core import packages, process_job, release
|
|
13
|
-
from services import
|
|
13
|
+
from services import agents, elicitation, persistent_sessions
|
|
14
14
|
from services.acp_peer import AUTH_REQUIRED, INTERNAL_ERROR, RESOURCE_NOT_FOUND, STREAM_LIMIT, AcpError, AcpPeer
|
|
15
15
|
|
|
16
16
|
PROTOCOL_VERSION = 1
|
|
@@ -146,7 +146,7 @@ class AgentConnection:
|
|
|
146
146
|
if receiver is not None:
|
|
147
147
|
return await receiver.requested(method, params)
|
|
148
148
|
if method == ELICIT and self._login_ask is not None:
|
|
149
|
-
return
|
|
149
|
+
return elicitation.answer(await self._login_ask(elicitation.form(params)), params)
|
|
150
150
|
raise AcpError(RESOURCE_NOT_FOUND, f"no session for {method}")
|
|
151
151
|
|
|
152
152
|
async def _notified(self, method: str, params: dict) -> None:
|
|
@@ -12,7 +12,7 @@ from urllib.parse import urlparse
|
|
|
12
12
|
|
|
13
13
|
from core import paths
|
|
14
14
|
from mcps.shared_files import listing
|
|
15
|
-
from services import acp_events, agents, attachments, event_rows, shared, terminal
|
|
15
|
+
from services import acp_events, agents, attachments, elicitation, event_rows, shared, terminal
|
|
16
16
|
from services.acp_peer import AUTH_REQUIRED, INVALID_PARAMS, METHOD_NOT_FOUND, RESOURCE_NOT_FOUND, AcpError
|
|
17
17
|
from services.agent_connections import AgentConnection, pool
|
|
18
18
|
from services.live_sessions import registry
|
|
@@ -255,6 +255,7 @@ class AgentSession:
|
|
|
255
255
|
|
|
256
256
|
async def open(self, resume: Optional[str] = None, signing_in: bool = False, create_now: bool = False) -> None:
|
|
257
257
|
self.released = False
|
|
258
|
+
signed_out = self.status == SIGN_IN
|
|
258
259
|
self.status = LOADING if self._process_up() else CONNECTING
|
|
259
260
|
self.reason, self.detail = None, ""
|
|
260
261
|
await self._announce()
|
|
@@ -275,6 +276,8 @@ class AgentSession:
|
|
|
275
276
|
except OSError as exc:
|
|
276
277
|
self._fail(FAILED, str(exc))
|
|
277
278
|
await self._announce()
|
|
279
|
+
if signed_out and self.status == READY:
|
|
280
|
+
watch.refresh(self.agent_id)
|
|
278
281
|
if resume and self._emit is not None:
|
|
279
282
|
await self._emit(self.history())
|
|
280
283
|
|
|
@@ -513,6 +516,7 @@ class AgentSession:
|
|
|
513
516
|
return
|
|
514
517
|
self._fail(SIGN_IN, "")
|
|
515
518
|
await self._announce()
|
|
519
|
+
watch.refresh(self.agent_id)
|
|
516
520
|
|
|
517
521
|
async def _wait(self, asked: Awaitable[dict]) -> Optional[dict]:
|
|
518
522
|
answer = asyncio.ensure_future(asked)
|
|
@@ -556,9 +560,9 @@ class AgentSession:
|
|
|
556
560
|
|
|
557
561
|
async def _elicit(self, params: dict) -> dict:
|
|
558
562
|
if self._ask is None:
|
|
559
|
-
return
|
|
560
|
-
answer = await self._wait(self._ask(
|
|
561
|
-
return
|
|
563
|
+
return elicitation.cancelled()
|
|
564
|
+
answer = await self._wait(self._ask(elicitation.form(params)))
|
|
565
|
+
return elicitation.answer(answer, params) if answer is not None else elicitation.cancelled()
|
|
562
566
|
|
|
563
567
|
def _path(self, raw: Any) -> Path:
|
|
564
568
|
path = Path(str(raw or ""))
|
|
@@ -806,11 +810,16 @@ async def fork(agent_id: str, cwd: str, session_id: str) -> str:
|
|
|
806
810
|
|
|
807
811
|
|
|
808
812
|
async def _snapshot(agent_id: str, cwd: str) -> dict:
|
|
813
|
+
reason = None
|
|
809
814
|
try:
|
|
810
815
|
listed = await all_sessions(agent_id, cwd)
|
|
811
|
-
except
|
|
816
|
+
except AcpError as exc:
|
|
812
817
|
listed = None
|
|
813
|
-
|
|
818
|
+
reason = SIGN_IN if exc.code == AUTH_REQUIRED else FAILED
|
|
819
|
+
except (agents.AgentError, OSError):
|
|
820
|
+
listed = None
|
|
821
|
+
reason = FAILED
|
|
822
|
+
return {"type": "sessions", "agent": agent_id, "cwd": cwd, "sessions": listed, "reason": reason}
|
|
814
823
|
|
|
815
824
|
|
|
816
825
|
class SessionsWatch:
|
|
@@ -835,6 +844,10 @@ class SessionsWatch:
|
|
|
835
844
|
if watching:
|
|
836
845
|
asyncio.get_running_loop().create_task(self._push(agent_id, cwd, watching))
|
|
837
846
|
|
|
847
|
+
def refresh(self, agent_id: str) -> None:
|
|
848
|
+
for folder in {cwd for agent, cwd in self._watching.values() if agent == agent_id}:
|
|
849
|
+
self.changed(agent_id, folder)
|
|
850
|
+
|
|
838
851
|
def activity(self, agent_id: str, cwd: str, session_id: str, activity: Optional[str]) -> None:
|
|
839
852
|
update = {"type": "activity", "agent": agent_id, "cwd": cwd, "session_id": session_id, "activity": activity}
|
|
840
853
|
for queue, key in self._watching.items():
|
|
@@ -19,7 +19,7 @@ from mcps import build_cconnect_server
|
|
|
19
19
|
from mcps.media import block_types
|
|
20
20
|
from mcps.packs import TOOL as PACKS_TOOL
|
|
21
21
|
from mcps.shared_files import TOOL as SHARE_TOOL
|
|
22
|
-
from services import claude_assets, cli_info, delegates, diffs, mods, persistent_sessions, prompt_cache, providers, settings_store, tool_calls, visibility
|
|
22
|
+
from services import claude_assets, cli_info, control_requests, delegates, diffs, elicitation, mods, persistent_sessions, prompt_cache, providers, settings_store, tool_calls, visibility
|
|
23
23
|
from services.api_errors import api_error
|
|
24
24
|
from services.questions import DECLINE_MESSAGE, DISMISS, SUBMIT_KEY, answers_from_values, questions_to_blocks
|
|
25
25
|
|
|
@@ -804,6 +804,7 @@ async def run_prompt(
|
|
|
804
804
|
request_compact: Optional[Callable[[str], None]] = None,
|
|
805
805
|
reload: Optional[Callable[[str], Awaitable[Optional[dict]]]] = None,
|
|
806
806
|
capabilities: Optional[list[str]] = None,
|
|
807
|
+
locale: Optional[str] = None,
|
|
807
808
|
session_info: Optional[Callable[[], dict]] = None,
|
|
808
809
|
on_transport: Optional[Callable[[Any], None]] = None,
|
|
809
810
|
resident: Optional[Any] = None,
|
|
@@ -878,6 +879,7 @@ async def run_prompt(
|
|
|
878
879
|
"background": resident.run_background if resident is not None else None,
|
|
879
880
|
"visibility": resident.wanted if resident is not None else vis,
|
|
880
881
|
"capabilities": list(capabilities or ()),
|
|
882
|
+
"locale": locale,
|
|
881
883
|
},
|
|
882
884
|
only=None if scope["cconnect"] else [SHARE_TOOL],
|
|
883
885
|
)}
|
|
@@ -1105,7 +1107,10 @@ async def run_prompt(
|
|
|
1105
1107
|
transport = None
|
|
1106
1108
|
if on_transport is not None:
|
|
1107
1109
|
try:
|
|
1108
|
-
transport =
|
|
1110
|
+
transport = control_requests.Answering(
|
|
1111
|
+
SubprocessCLITransport(prompt=prompt_arg, options=options),
|
|
1112
|
+
elicitation.answers(turn_ask),
|
|
1113
|
+
)
|
|
1109
1114
|
on_transport(CliControls(transport))
|
|
1110
1115
|
except Exception as exc:
|
|
1111
1116
|
logger.warning(f"no interruptible transport: {type(exc).__name__}: {exc}")
|
|
@@ -1384,6 +1389,7 @@ async def ask_side_question(
|
|
|
1384
1389
|
permission_mode: str = "default",
|
|
1385
1390
|
emit: Optional[Callable[[dict], Awaitable[None]]] = None,
|
|
1386
1391
|
capabilities: Optional[list[str]] = None,
|
|
1392
|
+
locale: Optional[str] = None,
|
|
1387
1393
|
session_info: Optional[Callable[[], dict]] = None,
|
|
1388
1394
|
model: Optional[str] = None,
|
|
1389
1395
|
) -> AsyncIterator[dict]:
|
|
@@ -1424,6 +1430,7 @@ async def ask_side_question(
|
|
|
1424
1430
|
"account": account,
|
|
1425
1431
|
"session_info": session_info,
|
|
1426
1432
|
"capabilities": list(capabilities or ()),
|
|
1433
|
+
"locale": locale,
|
|
1427
1434
|
}, exclude=("ask_component", "show_component"))}
|
|
1428
1435
|
tools = scope["tools"]
|
|
1429
1436
|
if tools is not True:
|
|
@@ -155,16 +155,24 @@ def _entries(info: dict[str, Any]) -> list[dict]:
|
|
|
155
155
|
return [entry for entry in listed if isinstance(entry, dict) and entry.get("value")] if isinstance(listed, list) else []
|
|
156
156
|
|
|
157
157
|
|
|
158
|
-
def
|
|
159
|
-
if not entry.get("supportsEffort"):
|
|
160
|
-
return []
|
|
158
|
+
def _supported(entry: dict) -> list[str]:
|
|
161
159
|
raw = entry.get("supportedEffortLevels")
|
|
162
|
-
|
|
160
|
+
if not entry.get("supportsEffort") or not isinstance(raw, list):
|
|
161
|
+
return []
|
|
162
|
+
return [level for level in raw if isinstance(level, str)]
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def _levels(entry: dict) -> list[str]:
|
|
166
|
+
levels = _supported(entry)
|
|
163
167
|
if not levels:
|
|
164
168
|
return []
|
|
165
169
|
return ["default", *levels, *([ULTRACODE_EFFORT] if "xhigh" in levels else [])]
|
|
166
170
|
|
|
167
171
|
|
|
172
|
+
def subagent_efforts(info: dict[str, Any]) -> list[str]:
|
|
173
|
+
return max((_supported(entry) for entry in _entries(info)), key=len, default=[])
|
|
174
|
+
|
|
175
|
+
|
|
168
176
|
def effort_levels_for(model: Optional[str], account: Optional[str] = None) -> list[str]:
|
|
169
177
|
from services import accounts
|
|
170
178
|
|
|
@@ -81,6 +81,19 @@ SETTINGS: dict[str, CliSettingDef] = {
|
|
|
81
81
|
type=bool,
|
|
82
82
|
description="Upload session transcripts to Anthropic",
|
|
83
83
|
),
|
|
84
|
+
"subagent_effort": CliSettingDef(
|
|
85
|
+
json_key="env.CLAUDE_CODE_SUBAGENT_EFFORT",
|
|
86
|
+
default="",
|
|
87
|
+
type=str,
|
|
88
|
+
description="Effort a subagent runs at when its own definition names none; empty follows the chat's",
|
|
89
|
+
),
|
|
90
|
+
"block_outside_writes": CliSettingDef(
|
|
91
|
+
json_key="permissions.blockWritesOutsideWorkingDirectories",
|
|
92
|
+
default=False,
|
|
93
|
+
type=bool,
|
|
94
|
+
description="Refuse to create or edit files outside the working directories, in every permission mode",
|
|
95
|
+
unset_by=False,
|
|
96
|
+
),
|
|
84
97
|
}
|
|
85
98
|
|
|
86
99
|
|
|
@@ -88,6 +101,40 @@ def json_keys() -> tuple[str, ...]:
|
|
|
88
101
|
return tuple(key for defn in SETTINGS.values() for key in (defn.json_key, defn.replaces) if key)
|
|
89
102
|
|
|
90
103
|
|
|
104
|
+
def lookup(data: dict, key: str) -> Any:
|
|
105
|
+
*parents, leaf = key.split(".")
|
|
106
|
+
for part in parents:
|
|
107
|
+
data = data.get(part)
|
|
108
|
+
if not isinstance(data, dict):
|
|
109
|
+
return None
|
|
110
|
+
return data.get(leaf)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def assign(data: dict, key: str, value: Any) -> None:
|
|
114
|
+
*parents, leaf = key.split(".")
|
|
115
|
+
for part in parents:
|
|
116
|
+
child = data.get(part)
|
|
117
|
+
if not isinstance(child, dict):
|
|
118
|
+
child = data[part] = {}
|
|
119
|
+
data = child
|
|
120
|
+
data[leaf] = value
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def discard(data: dict, key: str) -> None:
|
|
124
|
+
*parents, leaf = key.split(".")
|
|
125
|
+
chain = [data]
|
|
126
|
+
for part in parents:
|
|
127
|
+
child = chain[-1].get(part)
|
|
128
|
+
if not isinstance(child, dict):
|
|
129
|
+
return
|
|
130
|
+
chain.append(child)
|
|
131
|
+
chain[-1].pop(leaf, None)
|
|
132
|
+
for depth in range(len(parents), 0, -1):
|
|
133
|
+
if chain[depth]:
|
|
134
|
+
return
|
|
135
|
+
chain[depth - 1].pop(parents[depth - 1], None)
|
|
136
|
+
|
|
137
|
+
|
|
91
138
|
def _path() -> Path:
|
|
92
139
|
from services import accounts
|
|
93
140
|
|
|
@@ -112,7 +159,7 @@ def _valid(value: Any, expected: type) -> bool:
|
|
|
112
159
|
|
|
113
160
|
def _stored(key: str) -> Any:
|
|
114
161
|
defn = SETTINGS[key]
|
|
115
|
-
value = _read()
|
|
162
|
+
value = lookup(_read(), defn.json_key)
|
|
116
163
|
return value if _valid(value, defn.type) else None
|
|
117
164
|
|
|
118
165
|
|
|
@@ -174,9 +221,9 @@ def set(key: str, value: Any) -> None:
|
|
|
174
221
|
raise ValueError(f"{key} must be at most {defn.maximum}")
|
|
175
222
|
data = _read()
|
|
176
223
|
if not blank:
|
|
177
|
-
data
|
|
178
|
-
elif value is None or _valid(data
|
|
179
|
-
data
|
|
224
|
+
assign(data, defn.json_key, value)
|
|
225
|
+
elif value is None or _valid(lookup(data, defn.json_key), defn.type):
|
|
226
|
+
discard(data, defn.json_key)
|
|
180
227
|
_write(data)
|
|
181
228
|
accounts.sync_all_shared_config()
|
|
182
229
|
|
|
@@ -189,11 +236,12 @@ def reset() -> None:
|
|
|
189
236
|
def migrate() -> None:
|
|
190
237
|
"""Move a setting the CLI renamed onto its current key."""
|
|
191
238
|
data = _read()
|
|
192
|
-
moved = [defn for defn in SETTINGS.values() if defn.replaces and defn.replaces
|
|
239
|
+
moved = [defn for defn in SETTINGS.values() if defn.replaces and lookup(data, defn.replaces) is not None]
|
|
193
240
|
if not moved:
|
|
194
241
|
return
|
|
195
242
|
for defn in moved:
|
|
196
|
-
value = data
|
|
197
|
-
|
|
198
|
-
|
|
243
|
+
value = lookup(data, defn.replaces)
|
|
244
|
+
discard(data, defn.replaces)
|
|
245
|
+
if lookup(data, defn.json_key) is None and _valid(value, defn.type) and value != defn.unset_by:
|
|
246
|
+
assign(data, defn.json_key, value)
|
|
199
247
|
_write(data)
|