cconnect 2.0.8__tar.gz → 2.1.0__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.8 → cconnect-2.1.0}/PKG-INFO +1 -1
- {cconnect-2.0.8 → cconnect-2.1.0}/cconnect.egg-info/PKG-INFO +1 -1
- {cconnect-2.0.8 → cconnect-2.1.0}/cconnect.egg-info/SOURCES.txt +7 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/app.py +5 -1
- {cconnect-2.0.8 → cconnect-2.1.0}/core/cli.py +23 -9
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect/pack.json +2 -2
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/schema.json +4 -3
- {cconnect-2.0.8 → cconnect-2.1.0}/core/paths.py +9 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/prompts/BROWSER.md +3 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/prompts/CCONNECT.md +2 -3
- cconnect-2.1.0/core/prompts/INSTALL.md +33 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/release.py +1 -1
- {cconnect-2.0.8 → cconnect-2.1.0}/core/responses.py +13 -1
- cconnect-2.1.0/core/scripts/browse.py +24 -0
- cconnect-2.1.0/core/scripts/mcp_bridge.py +23 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/mcps/media.py +2 -1
- {cconnect-2.0.8 → cconnect-2.1.0}/mcps/packs.py +3 -1
- {cconnect-2.0.8 → cconnect-2.1.0}/middleware/public_auth.py +4 -2
- {cconnect-2.0.8 → cconnect-2.1.0}/middleware/security.py +6 -2
- {cconnect-2.0.8 → cconnect-2.1.0}/pyproject.toml +1 -1
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/accounts.py +25 -3
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/agents.py +14 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/browser.py +2 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/chat.py +16 -1
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/claude.py +33 -2
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/network.py +4 -11
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/packs.py +13 -1
- cconnect-2.1.0/routers/pages.py +46 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/projects.py +8 -8
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/shared.py +5 -5
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/system.py +11 -2
- {cconnect-2.0.8 → cconnect-2.1.0}/schemas/chat.py +1 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/accounts.py +48 -20
- {cconnect-2.0.8 → cconnect-2.1.0}/services/agent_connections.py +93 -13
- cconnect-2.1.0/services/agent_mcp.py +83 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/agent_sessions.py +53 -7
- {cconnect-2.0.8 → cconnect-2.1.0}/services/browser.py +49 -2
- {cconnect-2.0.8 → cconnect-2.1.0}/services/claude_manage.py +95 -16
- {cconnect-2.0.8 → cconnect-2.1.0}/services/claude_runtime.py +48 -27
- {cconnect-2.0.8 → cconnect-2.1.0}/services/directory_watch.py +45 -41
- {cconnect-2.0.8 → cconnect-2.1.0}/services/elicitation.py +4 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/live_sessions.py +10 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/network.py +12 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/pack_format.py +2 -1
- {cconnect-2.0.8 → cconnect-2.1.0}/services/packs.py +25 -1
- cconnect-2.1.0/services/pages.py +85 -0
- cconnect-2.1.0/services/processes.py +179 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/project_watch.py +19 -15
- {cconnect-2.0.8 → cconnect-2.1.0}/services/providers.py +6 -4
- {cconnect-2.0.8 → cconnect-2.1.0}/services/shared.py +3 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/system_monitor.py +4 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/system_watch.py +44 -18
- {cconnect-2.0.8 → cconnect-2.1.0}/services/terminal.py +4 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/usage.py +50 -29
- {cconnect-2.0.8 → cconnect-2.1.0}/cconnect.egg-info/dependency_links.txt +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/cconnect.egg-info/entry_points.txt +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/cconnect.egg-info/requires.txt +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/cconnect.egg-info/top_level.txt +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/__init__.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/access.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/cli_manager.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/config.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/data_migration.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/db.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/display.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/models.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packages.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/builtin.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect/accents.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect/terminal/black.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect/themes/cconnect-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect/themes/cconnect-light.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/backgrounds/cyberpunk.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/backgrounds/darkwave.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/pack.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/campbell.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/catppuccin-latte.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/catppuccin-mocha.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/claude-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/claude-light.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/dark-plus.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/dracula.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/github-dark-hc.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/github-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/github-dimmed.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/github-light-hc.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/github-light.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/gruvbox-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/light-plus.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/monokai.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/nord.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/one-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/one-half-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/one-half-light.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/rose-pine.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/solarized-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/solarized-light.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/tango-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/tango-light.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/tokyo-night.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/ubuntu.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/vscode-dark-modern.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/vscode-hc-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/vscode-hc-light.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/terminal/vscode-light-modern.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/catppuccin-latte.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/catppuccin-mocha.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/claude-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/claude-light.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/dracula.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/github-dark-hc.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/github-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/github-dimmed.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/github-light-hc.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/github-light.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/gruvbox-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/nord.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/one-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/rose-pine.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/solarized-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/solarized-light.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/tokyo-night.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/vscode-dark-modern.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/vscode-dark-plus.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/vscode-hc-dark.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/vscode-hc-light.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/vscode-light-modern.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/packs/cconnect-extras/themes/vscode-light-plus.json +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/process_job.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/prompts/BLOCKS.md +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/prompts/COMMIT.md +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/prompts/MODS.md +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/prompts/SUGGESTIONS.md +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/rate_limit.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/scripts/page_icon.js +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/sdk.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/settings_defs.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/slugs.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/core/ws.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/mcps/__init__.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/mcps/browser.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/mcps/check_progress.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/mcps/components.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/mcps/delegate.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/mcps/session.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/mcps/shared_files.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/mcps/terminal.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/middleware/__init__.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/middleware/error_handler.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/__init__.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/capabilities.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/cli.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/git.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/health.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/list.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/sessions.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/settings.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/routers/terminal.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/schemas/__init__.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/schemas/accounts.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/schemas/network.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/__init__.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/account_login.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/acp_events.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/acp_peer.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/agent_registry.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/agents.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/api_errors.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/attachments.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/blocks.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/categories.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/chat_list.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/claude_assets.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/claude_status.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/cli_info.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/cli_settings.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/control_requests.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/delegate_runner.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/delegate_runs.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/delegates.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/diffs.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/directories.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/event_rows.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/files.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/git.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/git_ops.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/mods.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/persistent_sessions.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/project_files.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/projects.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/prompt_cache.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/questions.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/repo.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/rewind.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/sessions.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/settings_store.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/shared_links.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/shared_watch.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/speedtest.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/todos.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/tool_calls.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/tool_props.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/trash.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/services/visibility.py +0 -0
- {cconnect-2.0.8 → cconnect-2.1.0}/setup.cfg +0 -0
|
@@ -92,8 +92,11 @@ core/prompts/BLOCKS.md
|
|
|
92
92
|
core/prompts/BROWSER.md
|
|
93
93
|
core/prompts/CCONNECT.md
|
|
94
94
|
core/prompts/COMMIT.md
|
|
95
|
+
core/prompts/INSTALL.md
|
|
95
96
|
core/prompts/MODS.md
|
|
96
97
|
core/prompts/SUGGESTIONS.md
|
|
98
|
+
core/scripts/browse.py
|
|
99
|
+
core/scripts/mcp_bridge.py
|
|
97
100
|
core/scripts/page_icon.js
|
|
98
101
|
mcps/__init__.py
|
|
99
102
|
mcps/browser.py
|
|
@@ -122,6 +125,7 @@ routers/health.py
|
|
|
122
125
|
routers/list.py
|
|
123
126
|
routers/network.py
|
|
124
127
|
routers/packs.py
|
|
128
|
+
routers/pages.py
|
|
125
129
|
routers/projects.py
|
|
126
130
|
routers/sessions.py
|
|
127
131
|
routers/settings.py
|
|
@@ -138,6 +142,7 @@ services/accounts.py
|
|
|
138
142
|
services/acp_events.py
|
|
139
143
|
services/acp_peer.py
|
|
140
144
|
services/agent_connections.py
|
|
145
|
+
services/agent_mcp.py
|
|
141
146
|
services/agent_registry.py
|
|
142
147
|
services/agent_sessions.py
|
|
143
148
|
services/agents.py
|
|
@@ -170,7 +175,9 @@ services/mods.py
|
|
|
170
175
|
services/network.py
|
|
171
176
|
services/pack_format.py
|
|
172
177
|
services/packs.py
|
|
178
|
+
services/pages.py
|
|
173
179
|
services/persistent_sessions.py
|
|
180
|
+
services/processes.py
|
|
174
181
|
services/project_files.py
|
|
175
182
|
services/project_watch.py
|
|
176
183
|
services/projects.py
|
|
@@ -18,7 +18,7 @@ from core.db import init_db
|
|
|
18
18
|
from core.rate_limit import limiter
|
|
19
19
|
from core.responses import api_response
|
|
20
20
|
from core.sdk import ensure_sdk_installed, ensure_subscription_auth
|
|
21
|
-
from services import cli_settings, settings_store, system_monitor
|
|
21
|
+
from services import agent_mcp, cli_settings, settings_store, system_monitor
|
|
22
22
|
from middleware.error_handler import register_error_handlers
|
|
23
23
|
from middleware.public_auth import register_public_auth_middleware
|
|
24
24
|
from middleware.security import register_security_middleware
|
|
@@ -34,6 +34,7 @@ async def lifespan(app: FastAPI):
|
|
|
34
34
|
from services import delegates
|
|
35
35
|
delegates.migrate()
|
|
36
36
|
from services import accounts
|
|
37
|
+
await asyncio.to_thread(accounts.purge_forgotten)
|
|
37
38
|
await asyncio.to_thread(accounts.link_all_shared_dirs)
|
|
38
39
|
paths.RUNTIME_FILE.write_text(f"PORT={PORT}\nPID={os.getpid()}\n", encoding="utf-8")
|
|
39
40
|
system_monitor.setup_log_capture()
|
|
@@ -89,6 +90,7 @@ app.add_middleware(
|
|
|
89
90
|
allow_origins=["*"],
|
|
90
91
|
allow_methods=["*"],
|
|
91
92
|
allow_headers=["*"],
|
|
93
|
+
expose_headers=["ETag"],
|
|
92
94
|
)
|
|
93
95
|
register_error_handlers(app)
|
|
94
96
|
|
|
@@ -97,6 +99,8 @@ for module_info in pkgutil.iter_modules(routers_pkg.__path__):
|
|
|
97
99
|
if hasattr(module, "router"):
|
|
98
100
|
app.include_router(module.router, prefix="/api")
|
|
99
101
|
|
|
102
|
+
app.mount(agent_mcp.PATH, agent_mcp.asgi)
|
|
103
|
+
|
|
100
104
|
|
|
101
105
|
@app.api_route(
|
|
102
106
|
"/{path:path}",
|
|
@@ -13,6 +13,7 @@ import shutil
|
|
|
13
13
|
import socket
|
|
14
14
|
import subprocess
|
|
15
15
|
import sys
|
|
16
|
+
import threading
|
|
16
17
|
import time
|
|
17
18
|
from contextlib import suppress
|
|
18
19
|
from datetime import datetime
|
|
@@ -30,6 +31,7 @@ _ENV_PATH = paths.ENV_FILE
|
|
|
30
31
|
_TOKEN_VAR = "PUBLIC_ACCESS_TOKEN"
|
|
31
32
|
_SECURITY_KEY_VAR = "SECURITY_KEY"
|
|
32
33
|
_HOSTNAME_VAR = "PUBLIC_HOSTNAME"
|
|
34
|
+
_LIFELINE_VAR = "CCONNECT_LIFELINE"
|
|
33
35
|
_PROVIDERS = ("tailscale", "tailnet", "caddy")
|
|
34
36
|
_PRIVATE_PROVIDERS = ("tailnet",)
|
|
35
37
|
_STOP_TIMEOUT = 10
|
|
@@ -402,7 +404,7 @@ def _flag_parser() -> argparse.ArgumentParser:
|
|
|
402
404
|
"""The launcher's original flags, accepted alongside the subcommands."""
|
|
403
405
|
parser = argparse.ArgumentParser(description="CConnect backend launcher.")
|
|
404
406
|
parser.add_argument("--production", action="store_true",
|
|
405
|
-
help="No reload
|
|
407
|
+
help="No reload (Linux/macOS only).")
|
|
406
408
|
parser.add_argument("--expose", choices=list(_PROVIDERS), default="",
|
|
407
409
|
help="Serve the backend through the given provider: tailnet keeps it "
|
|
408
410
|
"inside your tailnet, tailscale and caddy publish it.")
|
|
@@ -433,7 +435,7 @@ def _command_parser() -> argparse.ArgumentParser:
|
|
|
433
435
|
|
|
434
436
|
run = commands.add_parser("run", help="Serve on this machine and its network. The default.")
|
|
435
437
|
run.add_argument("--production", action="store_true",
|
|
436
|
-
help="No reload
|
|
438
|
+
help="No reload (Linux/macOS only).")
|
|
437
439
|
run.add_argument("--detach", action="store_true",
|
|
438
440
|
help="Run in the background; the server outlives the terminal.")
|
|
439
441
|
run.add_argument("--port", type=int, default=None, help=f"Port to serve on instead of {PORT}.")
|
|
@@ -446,7 +448,7 @@ def _command_parser() -> argparse.ArgumentParser:
|
|
|
446
448
|
expose.add_argument("--detach", action="store_true",
|
|
447
449
|
help="Run in the background; the server outlives the terminal.")
|
|
448
450
|
expose.add_argument("--production", action="store_true",
|
|
449
|
-
help="No reload
|
|
451
|
+
help="No reload (Linux/macOS only).")
|
|
450
452
|
expose.add_argument("--port", type=int, default=None, help=f"Port to serve on instead of {PORT}.")
|
|
451
453
|
|
|
452
454
|
commands.add_parser("stop", help="Stop a backend started with --detach.")
|
|
@@ -548,6 +550,20 @@ def _restart() -> None:
|
|
|
548
550
|
print(f"Restarting the backend (pid {live['PID']}).")
|
|
549
551
|
|
|
550
552
|
|
|
553
|
+
def _watch_lifeline() -> None:
|
|
554
|
+
stream = sys.stdin.buffer if sys.stdin else None
|
|
555
|
+
if stream is None:
|
|
556
|
+
return
|
|
557
|
+
|
|
558
|
+
def wait() -> None:
|
|
559
|
+
with suppress(OSError, ValueError):
|
|
560
|
+
while stream.read(4096):
|
|
561
|
+
pass
|
|
562
|
+
paths.STOP_FLAG.touch()
|
|
563
|
+
|
|
564
|
+
threading.Thread(target=wait, name="lifeline", daemon=True).start()
|
|
565
|
+
|
|
566
|
+
|
|
551
567
|
def _port_state(port: int) -> str:
|
|
552
568
|
live = _runtime()
|
|
553
569
|
if live and int(live.get("PORT") or 0) == port:
|
|
@@ -691,18 +707,16 @@ def main():
|
|
|
691
707
|
_print_security_key(key_generated)
|
|
692
708
|
|
|
693
709
|
reload = not args.production and not is_windows
|
|
694
|
-
workers = int(os.environ.get("WEB_CONCURRENCY", "2")) if (args.production and not is_windows) else 1
|
|
695
710
|
|
|
696
711
|
cmd = [sys.executable, "-m", "uvicorn", _APP, "--host", "0.0.0.0", "--port", str(port)]
|
|
697
|
-
if reload
|
|
698
|
-
cmd += ["--reload", "--reload-exclude", str(paths.DATA_DIR)]
|
|
699
|
-
elif workers > 1:
|
|
700
|
-
cmd += ["--workers", str(workers)]
|
|
712
|
+
cmd += ["--reload", "--reload-exclude", str(paths.DATA_DIR)] if reload else ["--workers", "1"]
|
|
701
713
|
|
|
702
714
|
paths.RESTART_FLAG.unlink(missing_ok=True)
|
|
703
715
|
paths.STOP_FLAG.unlink(missing_ok=True)
|
|
716
|
+
if os.environ.pop(_LIFELINE_VAR, None):
|
|
717
|
+
_watch_lifeline()
|
|
704
718
|
while True:
|
|
705
|
-
process = subprocess.Popen(cmd, cwd=paths.BACKEND_DIR)
|
|
719
|
+
process = subprocess.Popen(cmd, cwd=paths.BACKEND_DIR, stdin=subprocess.DEVNULL)
|
|
706
720
|
asked = False
|
|
707
721
|
stopped = False
|
|
708
722
|
try:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schema":
|
|
2
|
+
"schema": 4,
|
|
3
3
|
"extension": ".ccpack",
|
|
4
4
|
"mime": "application/zip",
|
|
5
5
|
"manifest": "pack.json",
|
|
@@ -107,9 +107,10 @@
|
|
|
107
107
|
"y": { "min": 0, "max": 100 }
|
|
108
108
|
},
|
|
109
109
|
"backgroundFits": ["cover", "contain"],
|
|
110
|
+
"accentSources": { "dynamic": "dynamic", "theme": "theme" },
|
|
110
111
|
"fontKinds": ["text", "mono", "symbols", "emoji"],
|
|
111
112
|
"fontFormats": ["woff2", "woff", "ttf", "otf"],
|
|
112
113
|
"imageFormats": ["png", "jpg", "jpeg", "webp", "gif", "avif", "svg"],
|
|
113
|
-
"maxFileBytes":
|
|
114
|
-
"maxPackBytes":
|
|
114
|
+
"maxFileBytes": 524288000,
|
|
115
|
+
"maxPackBytes": 524288000
|
|
115
116
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Every path the backend owns, grouped by what the data is."""
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
|
+
import shutil
|
|
4
5
|
import stat
|
|
5
6
|
import subprocess
|
|
6
7
|
import sys
|
|
@@ -87,6 +88,14 @@ def unlink_dir(target: Path) -> None:
|
|
|
87
88
|
target.unlink()
|
|
88
89
|
|
|
89
90
|
|
|
91
|
+
def remove_tree(target: Path) -> bool:
|
|
92
|
+
for item in target.rglob("*"):
|
|
93
|
+
if item.is_file() and not os.access(item, os.W_OK):
|
|
94
|
+
item.chmod(stat.S_IWRITE)
|
|
95
|
+
shutil.rmtree(target, ignore_errors=True)
|
|
96
|
+
return not target.exists()
|
|
97
|
+
|
|
98
|
+
|
|
90
99
|
OWNED_DIRS = (
|
|
91
100
|
CONFIG_DIR,
|
|
92
101
|
STATE_DIR,
|
|
@@ -8,3 +8,6 @@ Anything that speaks the DevTools Protocol reaches that same browser at `$CCONNE
|
|
|
8
8
|
— Playwright, Puppeteer, Selenium, or the Playwright MCP already pointed at it. Use one of those
|
|
9
9
|
to click through a flow, and the browser tools to open a page, read it or look at it. Never
|
|
10
10
|
close the browser or its last tab: it is the user's window, not yours.
|
|
11
|
+
|
|
12
|
+
A `<browser-element>` with `browser="server"` was picked in this browser, so you can open that
|
|
13
|
+
page and look further.
|
|
@@ -18,9 +18,8 @@ only linking it: `` for a file you wrote there,
|
|
|
18
18
|
|
|
19
19
|
A `<browser-element>` block in a message is an element the user picked in a browser beside
|
|
20
20
|
the chat: the page it sits on (`url`, `title`), a CSS `selector`, its rendered `size` and its
|
|
21
|
-
HTML, cut at 2000 characters. `browser="
|
|
22
|
-
|
|
23
|
-
you cannot reach it, so work from what the block carries.
|
|
21
|
+
HTML, cut at 2000 characters. `browser="device"` runs on the user's own device and you cannot
|
|
22
|
+
reach it, so work from what the block carries.
|
|
24
23
|
|
|
25
24
|
# The chat
|
|
26
25
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Install cards
|
|
2
|
+
|
|
3
|
+
The user can install MCP servers, plugins, marketplaces, skills, ACP agents and this app's packs
|
|
4
|
+
(themes, fonts, chat backgrounds) from the chat. When you find one worth adding, offer it as a
|
|
5
|
+
block of cards instead of telling them how to set it up:
|
|
6
|
+
|
|
7
|
+
````
|
|
8
|
+
```cconnect
|
|
9
|
+
{ "type": "install", "items": [
|
|
10
|
+
{ "kind": "mcp", "name": "fetch", "command": "uvx", "args": ["mcp-server-fetch"] },
|
|
11
|
+
{ "kind": "mcp", "name": "linear", "url": "https://mcp.linear.app/mcp" },
|
|
12
|
+
{ "kind": "plugin", "name": "<plugin>@<marketplace>", "source": "<owner/repo>" },
|
|
13
|
+
{ "kind": "marketplace", "source": "<owner/repo or git url>" },
|
|
14
|
+
{ "kind": "skill", "source": "<owner/repo>", "path": "<folder holding SKILL.md>" },
|
|
15
|
+
{ "kind": "agent", "id": "<ACP registry id>" },
|
|
16
|
+
{ "kind": "pack", "url": "https://<host>/<name>.ccpack" }
|
|
17
|
+
] }
|
|
18
|
+
```
|
|
19
|
+
````
|
|
20
|
+
|
|
21
|
+
An `mcp` item is the entry `.mcp.json` holds: `command` with `args` and `env`, or `url` with
|
|
22
|
+
`headers` and `type` (`http` or `sse`). A `plugin` names its marketplace after the `@`, and
|
|
23
|
+
`source` is where that marketplace is added from when the user lacks it. A pack is served over
|
|
24
|
+
https.
|
|
25
|
+
|
|
26
|
+
A `skill` is a folder of a git repository that holds its `SKILL.md`. `source` is `owner/repo` on
|
|
27
|
+
GitHub or an https git URL, `path` the folder, left out for the root, and `ref` the branch when it
|
|
28
|
+
is not the default. The folder's address on GitHub, as the user copies it
|
|
29
|
+
(`https://github.com/<owner>/<repo>/tree/<branch>/<folder>`), also works as the `source` alone.
|
|
30
|
+
|
|
31
|
+
A card installs nothing by itself: it opens a dialog that shows exactly what runs and waits for
|
|
32
|
+
the user. The same request also works as a link, `cconnect://install/<kind>?…` with those fields
|
|
33
|
+
as query parameters, where `arg`, `env=KEY=value` and `header=Name: value` repeat.
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
"""Standardized API response helpers."""
|
|
2
2
|
|
|
3
|
+
import os
|
|
3
4
|
from http import HTTPStatus
|
|
4
5
|
from math import ceil
|
|
6
|
+
from pathlib import Path
|
|
5
7
|
from typing import Any, Iterable, Optional
|
|
6
8
|
|
|
7
9
|
import orjson
|
|
10
|
+
from fastapi import Request
|
|
8
11
|
from fastapi.encoders import jsonable_encoder
|
|
9
|
-
from fastapi.responses import JSONResponse
|
|
12
|
+
from fastapi.responses import FileResponse, JSONResponse, Response
|
|
13
|
+
from starlette.staticfiles import NotModifiedResponse
|
|
10
14
|
|
|
11
15
|
FILE_HEADERS = {"Content-Encoding": "identity", "Cache-Control": "no-cache"}
|
|
12
16
|
|
|
13
17
|
|
|
18
|
+
def file_response(request: Request, path: Path, **options: Any) -> Response:
|
|
19
|
+
response = FileResponse(path, stat_result=os.stat(path), headers=FILE_HEADERS, **options)
|
|
20
|
+
held = request.headers.get("if-none-match", "")
|
|
21
|
+
if response.headers["etag"] in [tag.strip(" W/") for tag in held.split(",")]:
|
|
22
|
+
return NotModifiedResponse(response.headers)
|
|
23
|
+
return response
|
|
24
|
+
|
|
25
|
+
|
|
14
26
|
class ORJSONResponse(JSONResponse):
|
|
15
27
|
"""orjson serializes plain payloads; jsonable_encoder covers the types it rejects."""
|
|
16
28
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
import urllib.request
|
|
5
|
+
import webbrowser
|
|
6
|
+
|
|
7
|
+
url = sys.argv[1] if len(sys.argv) > 1 else ""
|
|
8
|
+
target = os.environ.pop("CCONNECT_BROWSE_URL", "")
|
|
9
|
+
token = os.environ.pop("CCONNECT_BROWSE_TOKEN", "")
|
|
10
|
+
os.environ.pop("BROWSER", None)
|
|
11
|
+
|
|
12
|
+
if url and target:
|
|
13
|
+
request = urllib.request.Request(
|
|
14
|
+
target,
|
|
15
|
+
data=json.dumps({"url": url, "token": token}).encode("utf-8"),
|
|
16
|
+
headers={"Content-Type": "application/json"},
|
|
17
|
+
)
|
|
18
|
+
try:
|
|
19
|
+
urllib.request.urlopen(request, timeout=5).close()
|
|
20
|
+
except OSError:
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
if url:
|
|
24
|
+
webbrowser.open(url)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import urllib.error
|
|
4
|
+
import urllib.request
|
|
5
|
+
|
|
6
|
+
target = os.environ.get("CCONNECT_MCP_URL", "")
|
|
7
|
+
headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream"}
|
|
8
|
+
|
|
9
|
+
for line in sys.stdin.buffer:
|
|
10
|
+
body = line.strip()
|
|
11
|
+
if not body or not target:
|
|
12
|
+
continue
|
|
13
|
+
request = urllib.request.Request(target, data=body, headers=headers, method="POST")
|
|
14
|
+
try:
|
|
15
|
+
with urllib.request.urlopen(request, timeout=300) as response:
|
|
16
|
+
answer = response.read().strip()
|
|
17
|
+
except urllib.error.HTTPError as error:
|
|
18
|
+
answer = error.read().strip()
|
|
19
|
+
except OSError:
|
|
20
|
+
continue
|
|
21
|
+
if answer:
|
|
22
|
+
sys.stdout.buffer.write(answer + b"\n")
|
|
23
|
+
sys.stdout.buffer.flush()
|
|
@@ -29,7 +29,8 @@ MEDIA = (
|
|
|
29
29
|
"capability": "media.html",
|
|
30
30
|
"inline": "an html page",
|
|
31
31
|
"outside": "an html page",
|
|
32
|
-
"block": "`html` — takes `url` and `title
|
|
32
|
+
"block": "`html` — takes `url` and `title`; the page loads the files of its folder and its "
|
|
33
|
+
"subfolders by relative path, a reference by the name it shows",
|
|
33
34
|
},
|
|
34
35
|
)
|
|
35
36
|
|
|
@@ -46,7 +46,9 @@ GUIDE = "\n".join(
|
|
|
46
46
|
"motif of the pack's own and no text: a screenshot or fine detail turns to noise at that size.",
|
|
47
47
|
"Every other file is optional and takes its id from its name.",
|
|
48
48
|
"use is what the app's Use button applies, and without it the button is not offered: the first light "
|
|
49
|
-
"theme, dark theme, terminal, accent and background listed, and the first font of each kind."
|
|
49
|
+
"theme, dark theme, terminal, accent and background listed, and the first font of each kind. For the "
|
|
50
|
+
f"accent it also takes {' or '.join(SCHEMA['accentSources'].values())}, which follow the system's color or "
|
|
51
|
+
"the theme's own instead of one of the pack's.",
|
|
50
52
|
f"themes/<id>.json: {{name, kind: {' or '.join(SCHEMA['themeKinds'])}, extends?: theme id, accent?, "
|
|
51
53
|
"syntax?: syntax id, colors: {token: color}}. A token left out comes from extends, or from the default "
|
|
52
54
|
"theme of its kind, and the -bg, hover and scrollbar tokens derive from their base color.",
|
|
@@ -7,9 +7,11 @@ from starlette.middleware.base import BaseHTTPMiddleware
|
|
|
7
7
|
|
|
8
8
|
from core.config import PUBLIC_ACCESS_TOKEN
|
|
9
9
|
from core.responses import api_response
|
|
10
|
+
from services import agent_mcp, pages
|
|
10
11
|
|
|
11
12
|
# Open so the mobile app can probe connectivity before it has a token.
|
|
12
|
-
_OPEN_PATHS = frozenset({"/api/health"})
|
|
13
|
+
_OPEN_PATHS = frozenset({"/api/health", "/api/agents/browse"})
|
|
14
|
+
_OPEN_PREFIXES = (f"{agent_mcp.PATH}/", f"{pages.PATH}/")
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
def _provided_token(authorization: str, query_token: str) -> str:
|
|
@@ -42,7 +44,7 @@ class PublicAuthMiddleware(BaseHTTPMiddleware):
|
|
|
42
44
|
async def dispatch(self, request: Request, call_next):
|
|
43
45
|
if PUBLIC_ACCESS_TOKEN is None:
|
|
44
46
|
return await call_next(request)
|
|
45
|
-
if request.url.path in _OPEN_PATHS:
|
|
47
|
+
if request.url.path in _OPEN_PATHS or request.url.path.startswith(_OPEN_PREFIXES):
|
|
46
48
|
return await call_next(request)
|
|
47
49
|
if not http_bearer_ok(request):
|
|
48
50
|
return api_response(status=401)
|
|
@@ -4,10 +4,12 @@ from fastapi import FastAPI, Request, Response
|
|
|
4
4
|
from starlette.middleware.base import BaseHTTPMiddleware
|
|
5
5
|
|
|
6
6
|
from core.responses import api_response
|
|
7
|
+
from services import pages
|
|
7
8
|
|
|
8
9
|
MAX_BODY_SIZE = 500 * 1_048_576
|
|
10
|
+
STREAMED_UPLOAD = ("PUT", "/api/shared/")
|
|
9
11
|
|
|
10
|
-
FRAMEABLE_PATHS = ("/api/shared/", "/api/shared-archive-file")
|
|
12
|
+
FRAMEABLE_PATHS = ("/api/shared/", "/api/shared-archive-file", f"{pages.PATH}/")
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
class SecurityHeadersMiddleware(BaseHTTPMiddleware):
|
|
@@ -29,8 +31,10 @@ class SecurityHeadersMiddleware(BaseHTTPMiddleware):
|
|
|
29
31
|
|
|
30
32
|
class RequestSizeLimitMiddleware(BaseHTTPMiddleware):
|
|
31
33
|
async def dispatch(self, request: Request, call_next):
|
|
34
|
+
method, prefix = STREAMED_UPLOAD
|
|
35
|
+
streamed = request.method == method and request.url.path.startswith(prefix)
|
|
32
36
|
content_length = request.headers.get("content-length")
|
|
33
|
-
if content_length and int(content_length) > MAX_BODY_SIZE:
|
|
37
|
+
if not streamed and content_length and int(content_length) > MAX_BODY_SIZE:
|
|
34
38
|
return api_response(status=413)
|
|
35
39
|
return await call_next(request)
|
|
36
40
|
|
|
@@ -62,7 +62,7 @@ version = { attr = "core.release.VERSION" }
|
|
|
62
62
|
include = ["core*", "routers*", "schemas*", "middleware*", "services*", "mcps*"]
|
|
63
63
|
|
|
64
64
|
[tool.setuptools.package-data]
|
|
65
|
-
core = ["prompts/*.md", "scripts/*.js", "packs/**/*.json"]
|
|
65
|
+
core = ["prompts/*.md", "scripts/*.js", "scripts/*.py", "packs/**/*.json"]
|
|
66
66
|
|
|
67
67
|
[tool.pytest.ini_options]
|
|
68
68
|
asyncio_mode = "auto"
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"""Claude accounts: list, create, rename, delegation, delete and remote OAuth login."""
|
|
2
2
|
|
|
3
|
+
import asyncio
|
|
4
|
+
|
|
3
5
|
from fastapi import APIRouter, Request, Response
|
|
4
6
|
|
|
5
7
|
from core.responses import api_response
|
|
@@ -12,7 +14,7 @@ from schemas.accounts import (
|
|
|
12
14
|
ProviderProbeRequest,
|
|
13
15
|
ProviderUpdateRequest,
|
|
14
16
|
)
|
|
15
|
-
from services import account_login, accounts, cli_info, providers
|
|
17
|
+
from services import account_login, accounts, cli_info, live_sessions, providers
|
|
16
18
|
|
|
17
19
|
router = APIRouter(tags=["accounts"])
|
|
18
20
|
|
|
@@ -99,12 +101,32 @@ def set_account_delegation(account_id: str, payload: AccountDelegationRequest):
|
|
|
99
101
|
|
|
100
102
|
|
|
101
103
|
@router.delete("/accounts/{account_id}")
|
|
102
|
-
def delete_account(account_id: str):
|
|
103
|
-
|
|
104
|
+
async def delete_account(account_id: str):
|
|
105
|
+
holders = live_sessions.registry.on_account(account_id)
|
|
106
|
+
if not accounts.forget(account_id):
|
|
104
107
|
return api_response(status=404)
|
|
108
|
+
account_login.cancel(account_id)
|
|
109
|
+
cli_info.invalidate()
|
|
110
|
+
_pending_purges.add(asyncio.create_task(_purge(account_id, holders)))
|
|
105
111
|
return api_response()
|
|
106
112
|
|
|
107
113
|
|
|
114
|
+
_PURGE_ATTEMPTS = 10
|
|
115
|
+
_PURGE_PAUSE = 1.0
|
|
116
|
+
_pending_purges: set[asyncio.Task] = set()
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
async def _purge(account_id: str, holders: list) -> None:
|
|
120
|
+
try:
|
|
121
|
+
await live_sessions.registry.release_all(holders)
|
|
122
|
+
for _ in range(_PURGE_ATTEMPTS):
|
|
123
|
+
if await asyncio.to_thread(accounts.purge, account_id):
|
|
124
|
+
return
|
|
125
|
+
await asyncio.sleep(_PURGE_PAUSE)
|
|
126
|
+
finally:
|
|
127
|
+
_pending_purges.discard(asyncio.current_task())
|
|
128
|
+
|
|
129
|
+
|
|
108
130
|
@router.post("/accounts/import")
|
|
109
131
|
async def import_account(request: Request, label: str = ""):
|
|
110
132
|
account = accounts.import_bundle(await request.body(), label)
|
|
@@ -86,6 +86,20 @@ def _offered(item: dict, installed: dict[str, dict]) -> dict:
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
|
|
89
|
+
class BrowseRequest(BaseModel):
|
|
90
|
+
url: str
|
|
91
|
+
token: str
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@router.post("/agents/browse")
|
|
95
|
+
async def browse(payload: BrowseRequest):
|
|
96
|
+
connection = pool.by_browse_token(payload.token)
|
|
97
|
+
if connection is None or urlparse(payload.url).scheme not in ("http", "https"):
|
|
98
|
+
return api_response(status=404)
|
|
99
|
+
await connection.browsed(payload.url)
|
|
100
|
+
return api_response()
|
|
101
|
+
|
|
102
|
+
|
|
89
103
|
@router.get("/agents")
|
|
90
104
|
def list_agents():
|
|
91
105
|
return api_response(data={
|
|
@@ -37,6 +37,8 @@ async def _dispatch(session: BrowserSession, payload: dict):
|
|
|
37
37
|
await session.insert(str(payload.get("value") or ""))
|
|
38
38
|
elif kind == "navigate":
|
|
39
39
|
await session.navigate(str(payload.get("url") or ""))
|
|
40
|
+
elif kind == "home":
|
|
41
|
+
await session.go_home()
|
|
40
42
|
elif kind == "reload":
|
|
41
43
|
await session.reload()
|
|
42
44
|
elif kind == "back":
|
|
@@ -15,6 +15,7 @@ from loguru import logger
|
|
|
15
15
|
from pydantic import BaseModel, ValidationError
|
|
16
16
|
|
|
17
17
|
from core import paths
|
|
18
|
+
from core.access import key_matches
|
|
18
19
|
from core.config import DEFAULT_CWD, permission_modes, resolve_permission_mode
|
|
19
20
|
from core.responses import api_response
|
|
20
21
|
from core.ws import send_event
|
|
@@ -119,6 +120,8 @@ def _build_turn_runner(session, text: str, attachments: list[str] | None = None,
|
|
|
119
120
|
try:
|
|
120
121
|
async for event in run_prompt(
|
|
121
122
|
resident=resident,
|
|
123
|
+
channel=session.channel,
|
|
124
|
+
unlocked=lambda: session.unlocked,
|
|
122
125
|
prompt=prompt_text,
|
|
123
126
|
images=prompt_images,
|
|
124
127
|
cwd=state.cwd,
|
|
@@ -425,7 +428,14 @@ async def chat_ws(ws: WebSocket):
|
|
|
425
428
|
state.cwd = msg.cwd or DEFAULT_CWD
|
|
426
429
|
state.session_id = msg.resume
|
|
427
430
|
session = registry.create(state)
|
|
428
|
-
session.bind_agent(agent_sessions.AgentSession(
|
|
431
|
+
session.bind_agent(agent_sessions.AgentSession(
|
|
432
|
+
msg.agent,
|
|
433
|
+
state.cwd,
|
|
434
|
+
sessions_service.project_key_for(state.cwd),
|
|
435
|
+
msg.resume,
|
|
436
|
+
capabilities=msg.capabilities,
|
|
437
|
+
guided=True,
|
|
438
|
+
))
|
|
429
439
|
spawn(session.open_agent(msg.resume))
|
|
430
440
|
else:
|
|
431
441
|
state = _Session()
|
|
@@ -501,6 +511,7 @@ async def chat_ws(ws: WebSocket):
|
|
|
501
511
|
target = registry.get(msg.channel) if msg.channel and msg.channel != session.channel else session
|
|
502
512
|
if target is None:
|
|
503
513
|
continue
|
|
514
|
+
target.unlocked = key_matches(msg.security_key or "")
|
|
504
515
|
if target.running:
|
|
505
516
|
await target.enqueue(msg.id, msg.text, msg.attachments)
|
|
506
517
|
elif msg.id and target.already_consumed(msg.id):
|
|
@@ -564,6 +575,10 @@ async def chat_ws(ws: WebSocket):
|
|
|
564
575
|
if session is not None and session.agent is not None:
|
|
565
576
|
spawn(session.agent.login(msg.method))
|
|
566
577
|
|
|
578
|
+
elif mtype == "agent_login_cancel":
|
|
579
|
+
if session is not None and session.agent is not None:
|
|
580
|
+
session.agent.cancel_login()
|
|
581
|
+
|
|
567
582
|
elif mtype == "agent_logout":
|
|
568
583
|
if session is not None and session.agent is not None:
|
|
569
584
|
spawn(session.agent.logout())
|
|
@@ -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,
|
|
20
|
-
return api_response(data=await usage_service.usage_data(account,
|
|
19
|
+
async def get_usage(account: str | None = None, lang: str | None = None):
|
|
20
|
+
return api_response(data=await usage_service.usage_data(account, lang))
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
@router.get("/claude/status")
|
|
@@ -47,6 +47,12 @@ class PluginReloadBody(BaseModel):
|
|
|
47
47
|
force: bool = False
|
|
48
48
|
|
|
49
49
|
|
|
50
|
+
class SkillInstallBody(BaseModel):
|
|
51
|
+
source: str
|
|
52
|
+
path: str = ""
|
|
53
|
+
ref: str = ""
|
|
54
|
+
|
|
55
|
+
|
|
50
56
|
class MarketplaceActionBody(BaseModel):
|
|
51
57
|
action: str # add | remove | update
|
|
52
58
|
target: str # source for add, name otherwise
|
|
@@ -60,6 +66,20 @@ class McpAddBody(BaseModel):
|
|
|
60
66
|
env: list[str] = Field(default_factory=list)
|
|
61
67
|
|
|
62
68
|
|
|
69
|
+
class McpConfig(BaseModel):
|
|
70
|
+
command: str = ""
|
|
71
|
+
args: list[str] = Field(default_factory=list)
|
|
72
|
+
env: dict[str, str] = Field(default_factory=dict)
|
|
73
|
+
url: str = ""
|
|
74
|
+
type: str = ""
|
|
75
|
+
headers: dict[str, str] = Field(default_factory=dict)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class McpConfigBody(BaseModel):
|
|
79
|
+
name: str
|
|
80
|
+
config: McpConfig
|
|
81
|
+
|
|
82
|
+
|
|
63
83
|
class ToggleBody(BaseModel):
|
|
64
84
|
name: str
|
|
65
85
|
enabled: bool
|
|
@@ -200,6 +220,12 @@ def get_skill_file(skill: str, plugin: str | None = None, file: str = "SKILL.md"
|
|
|
200
220
|
return Response(content=text, media_type="text/markdown; charset=utf-8")
|
|
201
221
|
|
|
202
222
|
|
|
223
|
+
@router.post("/claude/skills/install")
|
|
224
|
+
async def install_skill(body: SkillInstallBody):
|
|
225
|
+
result = await asyncio.to_thread(claude_manage.install_skill, body.source, body.path, body.ref)
|
|
226
|
+
return api_response(data=await claude_manage.reload_after(result, "reload-skills"))
|
|
227
|
+
|
|
228
|
+
|
|
203
229
|
@router.get("/claude/mcp")
|
|
204
230
|
def get_mcp():
|
|
205
231
|
return api_response(data=claude_assets.list_mcp_servers())
|
|
@@ -212,6 +238,11 @@ def add_mcp(body: McpAddBody):
|
|
|
212
238
|
)
|
|
213
239
|
|
|
214
240
|
|
|
241
|
+
@router.post("/claude/mcp/config")
|
|
242
|
+
def add_mcp_config(body: McpConfigBody):
|
|
243
|
+
return api_response(data=claude_manage.mcp_add_config(body.name, body.config.model_dump()))
|
|
244
|
+
|
|
245
|
+
|
|
215
246
|
@router.post("/claude/mcp/toggle")
|
|
216
247
|
def toggle_mcp(body: ToggleBody):
|
|
217
248
|
return api_response(data=claude_manage.mcp_set_enabled(body.name, body.enabled))
|