connectonion 0.6.1__py3-none-any.whl → 0.6.3__py3-none-any.whl
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.
- connectonion/__init__.py +46 -9
- connectonion/cli/__init__.py +11 -1
- connectonion/cli/browser_agent/__init__.py +11 -1
- connectonion/cli/browser_agent/browser.py +95 -142
- connectonion/cli/browser_agent/element_finder.py +147 -0
- connectonion/cli/browser_agent/highlight_screenshot.py +182 -0
- connectonion/cli/browser_agent/prompt.md +188 -105
- connectonion/cli/browser_agent/prompts/element_matcher.md +59 -0
- connectonion/cli/browser_agent/prompts/form_filler.md +19 -0
- connectonion/cli/browser_agent/prompts/scroll_strategy.md +36 -0
- connectonion/cli/browser_agent/scripts/extract_elements.js +126 -0
- connectonion/cli/browser_agent/scroll.py +145 -0
- connectonion/cli/co_ai/__init__.py +6 -0
- connectonion/cli/co_ai/agent.py +87 -0
- connectonion/cli/co_ai/agents/__init__.py +5 -0
- connectonion/cli/co_ai/agents/registry.py +57 -0
- connectonion/cli/co_ai/commands/__init__.py +45 -0
- connectonion/cli/co_ai/commands/compact.py +173 -0
- connectonion/cli/co_ai/commands/cost.py +77 -0
- connectonion/cli/co_ai/commands/export.py +60 -0
- connectonion/cli/co_ai/commands/help.py +80 -0
- connectonion/cli/co_ai/commands/init.py +101 -0
- connectonion/cli/co_ai/commands/sessions.py +55 -0
- connectonion/cli/co_ai/commands/tasks.py +63 -0
- connectonion/cli/co_ai/commands/undo.py +103 -0
- connectonion/cli/co_ai/context.py +127 -0
- connectonion/cli/co_ai/main.py +52 -0
- connectonion/cli/co_ai/plugins/__init__.py +6 -0
- connectonion/cli/co_ai/plugins/reminder.py +76 -0
- connectonion/cli/co_ai/plugins/shell_approval.py +105 -0
- connectonion/cli/co_ai/prompts/agents/explore.md +79 -0
- connectonion/cli/co_ai/prompts/agents/plan.md +60 -0
- connectonion/cli/co_ai/prompts/assembler.py +303 -0
- connectonion/cli/{docs/co-vibecoding-principles-docs-contexts-all-in-one.md → co_ai/prompts/connectonion/README.md} +26 -0
- connectonion/cli/co_ai/prompts/connectonion/api.md +457 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/README.md +805 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/auth.md +46 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/browser.md +235 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/copy.md +184 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/create.md +335 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/init.md +431 -0
- connectonion/cli/co_ai/prompts/connectonion/co-directory-structure.md +214 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/agent.md +1078 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/events.md +816 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/llm_do.md +256 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/max_iterations.md +362 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/models.md +641 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/plugins.md +100 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/prompts.md +122 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/tools.md +512 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/transcribe.md +156 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/trust.md +291 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/README.md +18 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/auto_debug.md +1026 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/console.md +129 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/eval-format.md +178 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/eval.md +230 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/exceptions.md +307 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/log.md +117 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/xray.md +215 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/001-choosing-input-method.md +202 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/002-choosing-llm-function-name.md +202 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/003-choosing-trust-keyword.md +141 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/004-cli-create-flow.md +117 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/005-designing-agent-network-protocol.md +503 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/006-agent-address-format.md +305 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/007-authentication-backend-design.md +240 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/008-naming-is-hard.md +228 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/009-why-connect-function.md +167 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/010-cli-ux-progressive-disclosure.md +176 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/011-global-config-identity-management.md +357 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/012-tool-execution-separation.md +259 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/013-debug-and-logging-design.md +253 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/014-hook-system-design.md +510 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/015-interactive-auto-debug-design.md +837 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/016-why-no-zero-knowledge-proofs.md +358 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/017-session-logging-and-eval-format.md +120 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/018-event-api-naming.md +274 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/019-agent-lifecycle-design.md +655 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/020-trust-system-and-network-architecture.md +503 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/021-task-storage-jsonl-design.md +496 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/022-raw-asgi-implementation.md +273 -0
- connectonion/cli/co_ai/prompts/connectonion/examples/agent_reasoning.md +62 -0
- connectonion/cli/co_ai/prompts/connectonion/examples/atomic_tools.md +24 -0
- connectonion/cli/co_ai/prompts/connectonion/examples/load_guide.md +18 -0
- connectonion/cli/co_ai/prompts/connectonion/examples.md +0 -0
- connectonion/cli/co_ai/prompts/connectonion/hook-system-options.md +364 -0
- connectonion/cli/co_ai/prompts/connectonion/index.md +162 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/README.md +12 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/auth.md +450 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/google.md +431 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/microsoft.md +370 -0
- connectonion/cli/co_ai/prompts/connectonion/network/README.md +14 -0
- connectonion/cli/co_ai/prompts/connectonion/network/connect.md +543 -0
- connectonion/cli/co_ai/prompts/connectonion/network/connection.md +538 -0
- connectonion/cli/co_ai/prompts/connectonion/network/deploy.md +123 -0
- connectonion/cli/co_ai/prompts/connectonion/network/host.md +1049 -0
- connectonion/cli/co_ai/prompts/connectonion/network/protocol/agent-relay-protocol.md +495 -0
- connectonion/cli/co_ai/prompts/connectonion/network/protocol/announce-message.md +115 -0
- connectonion/cli/co_ai/prompts/connectonion/principles.md +124 -0
- connectonion/cli/co_ai/prompts/connectonion/quickstart.md +261 -0
- connectonion/cli/co_ai/prompts/connectonion/roadmap.md +81 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/README.md +77 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/meta-agent.md +152 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/minimal.md +105 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/playwright.md +130 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/web-research.md +144 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/README.md +95 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/chat.md +181 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/divider.md +63 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/dropdown.md +83 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/footer.md +44 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/fuzzy.md +68 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/input.md +84 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/keys.md +77 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/pick.md +71 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/providers.md +89 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/status_bar.md +67 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/README.md +156 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/calendar_plugin.md +68 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/eval.md +89 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/gmail_plugin.md +68 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/image_result_formatter.md +74 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/re_act.md +86 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/shell_approval.md +69 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/README.md +81 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/diff_writer.md +138 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/get_emails.md +499 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/gmail.md +135 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/google_calendar.md +106 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/memory.md +486 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/microsoft_calendar.md +106 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/outlook.md +120 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/send_email.md +403 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/shell.md +95 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/slash_command.md +96 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/terminal.md +97 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/todo_list.md +252 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/web_fetch.md +130 -0
- connectonion/cli/co_ai/prompts/connectonion/vibe-coding-guide.md +97 -0
- connectonion/cli/co_ai/prompts/connectonion/windows-support.md +258 -0
- connectonion/cli/co_ai/prompts/main.md +247 -0
- connectonion/cli/co_ai/prompts/reminders/plan_mode.md +34 -0
- connectonion/cli/co_ai/prompts/summarization.md +55 -0
- connectonion/cli/co_ai/prompts/tools/ask_user.md +61 -0
- connectonion/cli/co_ai/prompts/tools/background.md +57 -0
- connectonion/cli/co_ai/prompts/tools/edit.md +90 -0
- connectonion/cli/co_ai/prompts/tools/glob.md +52 -0
- connectonion/cli/co_ai/prompts/tools/grep.md +55 -0
- connectonion/cli/co_ai/prompts/tools/plan_mode.md +80 -0
- connectonion/cli/co_ai/prompts/tools/read.md +40 -0
- connectonion/cli/co_ai/prompts/tools/shell.md +67 -0
- connectonion/cli/co_ai/prompts/tools/task.md +51 -0
- connectonion/cli/co_ai/prompts/tools/todo.md +139 -0
- connectonion/cli/co_ai/prompts/tools/write.md +47 -0
- connectonion/cli/co_ai/prompts/workflow.md +89 -0
- connectonion/cli/co_ai/reminders.py +159 -0
- connectonion/cli/co_ai/sessions.py +110 -0
- connectonion/cli/co_ai/skills/__init__.py +37 -0
- connectonion/cli/co_ai/skills/builtin/commit/SKILL.md +63 -0
- connectonion/cli/co_ai/skills/builtin/review-pr/SKILL.md +76 -0
- connectonion/cli/co_ai/skills/loader.py +166 -0
- connectonion/cli/co_ai/skills/tool.py +46 -0
- connectonion/cli/co_ai/tools/__init__.py +92 -0
- connectonion/cli/co_ai/tools/ask_user.py +35 -0
- connectonion/cli/co_ai/tools/background.py +201 -0
- connectonion/cli/co_ai/tools/diff_writer.py +291 -0
- connectonion/cli/co_ai/tools/edit.py +89 -0
- connectonion/cli/co_ai/tools/glob.py +84 -0
- connectonion/cli/co_ai/tools/grep.py +158 -0
- connectonion/cli/co_ai/tools/load_guide.py +23 -0
- connectonion/cli/co_ai/tools/multi_edit.py +116 -0
- connectonion/cli/co_ai/tools/plan_mode.py +172 -0
- connectonion/cli/co_ai/tools/read.py +67 -0
- connectonion/cli/co_ai/tools/task.py +59 -0
- connectonion/cli/co_ai/tools/todo_list.py +159 -0
- connectonion/cli/co_ai/tools/write.py +126 -0
- connectonion/cli/commands/__init__.py +11 -1
- connectonion/cli/commands/ai_commands.py +34 -0
- connectonion/cli/commands/copy_commands.py +55 -6
- connectonion/cli/commands/create.py +20 -17
- connectonion/cli/commands/init.py +19 -22
- connectonion/cli/commands/project_cmd_lib.py +15 -0
- connectonion/cli/main.py +11 -0
- connectonion/console.py +15 -1
- connectonion/core/__init__.py +10 -1
- connectonion/core/agent.py +37 -16
- connectonion/core/exceptions.py +74 -0
- connectonion/core/llm.py +54 -6
- connectonion/core/tool_executor.py +32 -31
- connectonion/core/tool_factory.py +47 -10
- connectonion/debug/__init__.py +10 -1
- connectonion/debug/debug_explainer/__init__.py +10 -1
- connectonion/debug/execution_analyzer/__init__.py +10 -1
- connectonion/debug/execution_analyzer/execution_analysis.py +5 -2
- connectonion/debug/runtime_inspector/__init__.py +10 -1
- connectonion/docs/.package-ignore +6 -0
- connectonion/docs/README.md +2036 -0
- connectonion/docs/api.md +457 -0
- connectonion/docs/archive/001-ai-agent-is-just-prompt-plus-function.md +249 -0
- connectonion/docs/archive/README.md +53 -0
- connectonion/docs/archive/archive/consolidation-plan.md +72 -0
- connectonion/docs/archive/archive/core-principles-extracted.md +239 -0
- connectonion/docs/archive/archive/master-principles.md +222 -0
- connectonion/docs/archive/archive/principles.md +293 -0
- connectonion/docs/archive/archive/simplicity-principles.md +221 -0
- connectonion/docs/archive/attack-defense-insights.md +410 -0
- connectonion/docs/archive/business-model.md +305 -0
- connectonion/docs/archive/core-principles-unified.md +190 -0
- connectonion/docs/archive/discussion-journey.md +178 -0
- connectonion/docs/archive/economic-analysis.md +323 -0
- connectonion/docs/archive/features/01-share-and-find.md +256 -0
- connectonion/docs/archive/features/02-agent-authentication.md +93 -0
- connectonion/docs/archive/features/03-test-before-trust.md +71 -0
- connectonion/docs/archive/features/06-reliability-and-offline.md +197 -0
- connectonion/docs/archive/features/README.md +46 -0
- connectonion/docs/archive/features-roadmap.md +247 -0
- connectonion/docs/archive/mcp-comparison-insights.md +215 -0
- connectonion/docs/archive/migration-strategy.md +571 -0
- connectonion/docs/archive/mini-whitepaper.md +293 -0
- connectonion/docs/archive/network-protocol.md +394 -0
- connectonion/docs/archive/semantic-revolution.md +367 -0
- connectonion/docs/archive/technical-architecture.md +453 -0
- connectonion/docs/archive/the-semantic-insight.md +207 -0
- connectonion/docs/archive/threat-model.md +164 -0
- connectonion/docs/cli/README.md +805 -0
- connectonion/docs/cli/auth.md +46 -0
- connectonion/docs/cli/browser.md +235 -0
- connectonion/docs/cli/copy.md +232 -0
- connectonion/docs/cli/create.md +335 -0
- connectonion/docs/cli/init.md +431 -0
- connectonion/docs/co-directory-structure.md +214 -0
- connectonion/docs/concepts/agent.md +1078 -0
- connectonion/docs/concepts/events.md +699 -0
- connectonion/docs/concepts/llm_do.md +256 -0
- connectonion/docs/concepts/max_iterations.md +362 -0
- connectonion/docs/concepts/models.md +641 -0
- connectonion/docs/concepts/plugins.md +100 -0
- connectonion/docs/concepts/prompts.md +122 -0
- connectonion/docs/concepts/session.md +428 -0
- connectonion/docs/concepts/tools.md +512 -0
- connectonion/docs/concepts/transcribe.md +156 -0
- connectonion/docs/concepts/trust.md +291 -0
- connectonion/docs/connectonion.md +1256 -0
- connectonion/docs/debug/README.md +18 -0
- connectonion/docs/debug/auto_debug.md +1026 -0
- connectonion/docs/debug/console.md +129 -0
- connectonion/docs/debug/eval-format.md +178 -0
- connectonion/docs/debug/eval.md +230 -0
- connectonion/docs/debug/exceptions.md +307 -0
- connectonion/docs/debug/log.md +117 -0
- connectonion/docs/debug/xray.md +215 -0
- connectonion/docs/design-decisions/001-choosing-input-method.md +202 -0
- connectonion/docs/design-decisions/002-choosing-llm-function-name.md +202 -0
- connectonion/docs/design-decisions/003-choosing-trust-keyword.md +141 -0
- connectonion/docs/design-decisions/004-cli-create-flow.md +117 -0
- connectonion/docs/design-decisions/005-designing-agent-network-protocol.md +503 -0
- connectonion/docs/design-decisions/006-agent-address-format.md +305 -0
- connectonion/docs/design-decisions/007-authentication-backend-design.md +240 -0
- connectonion/docs/design-decisions/008-naming-is-hard.md +228 -0
- connectonion/docs/design-decisions/009-why-connect-function.md +167 -0
- connectonion/docs/design-decisions/010-cli-ux-progressive-disclosure.md +176 -0
- connectonion/docs/design-decisions/011-global-config-identity-management.md +357 -0
- connectonion/docs/design-decisions/012-tool-execution-separation.md +259 -0
- connectonion/docs/design-decisions/013-debug-and-logging-design.md +253 -0
- connectonion/docs/design-decisions/014-hook-system-design.md +510 -0
- connectonion/docs/design-decisions/015-interactive-auto-debug-design.md +837 -0
- connectonion/docs/design-decisions/016-why-no-zero-knowledge-proofs.md +358 -0
- connectonion/docs/design-decisions/017-session-logging-and-eval-format.md +120 -0
- connectonion/docs/design-decisions/018-event-api-naming.md +274 -0
- connectonion/docs/design-decisions/019-agent-lifecycle-design.md +655 -0
- connectonion/docs/design-decisions/020-trust-system-and-network-architecture.md +503 -0
- connectonion/docs/design-decisions/021-task-storage-jsonl-design.md +496 -0
- connectonion/docs/design-decisions/022-raw-asgi-implementation.md +273 -0
- connectonion/docs/examples.md +0 -0
- connectonion/docs/hook-system-options.md +364 -0
- connectonion/docs/integrations/README.md +12 -0
- connectonion/docs/integrations/auth.md +450 -0
- connectonion/docs/integrations/google.md +431 -0
- connectonion/docs/integrations/microsoft.md +370 -0
- connectonion/docs/network/README.md +14 -0
- connectonion/docs/network/connect.md +629 -0
- connectonion/docs/network/deploy.md +124 -0
- connectonion/docs/network/host.md +1087 -0
- connectonion/docs/network/io.md +538 -0
- connectonion/docs/network/protocol/agent-relay-protocol.md +495 -0
- connectonion/docs/network/protocol/announce-message.md +115 -0
- connectonion/docs/principles.md +124 -0
- connectonion/docs/quickstart.md +261 -0
- connectonion/docs/roadmap.md +81 -0
- connectonion/docs/templates/README.md +77 -0
- connectonion/docs/templates/meta-agent.md +152 -0
- connectonion/docs/templates/minimal.md +105 -0
- connectonion/docs/templates/playwright.md +130 -0
- connectonion/docs/templates/web-research.md +144 -0
- connectonion/docs/tui/README.md +95 -0
- connectonion/docs/tui/chat.md +181 -0
- connectonion/docs/tui/divider.md +63 -0
- connectonion/docs/tui/dropdown.md +83 -0
- connectonion/docs/tui/footer.md +44 -0
- connectonion/docs/tui/fuzzy.md +68 -0
- connectonion/docs/tui/input.md +84 -0
- connectonion/docs/tui/keys.md +77 -0
- connectonion/docs/tui/pick.md +71 -0
- connectonion/docs/tui/providers.md +89 -0
- connectonion/docs/tui/status_bar.md +67 -0
- connectonion/docs/useful_plugins/README.md +160 -0
- connectonion/docs/useful_plugins/calendar_plugin.md +68 -0
- connectonion/docs/useful_plugins/eval.md +89 -0
- connectonion/docs/useful_plugins/gmail_plugin.md +68 -0
- connectonion/docs/useful_plugins/image_result_formatter.md +74 -0
- connectonion/docs/useful_plugins/re_act.md +86 -0
- connectonion/docs/useful_plugins/shell_approval.md +69 -0
- connectonion/docs/useful_plugins/system_reminder.md +210 -0
- connectonion/docs/useful_prompts/README.md +127 -0
- connectonion/docs/useful_prompts/coding_agent.md +214 -0
- connectonion/docs/useful_tools/README.md +81 -0
- connectonion/docs/useful_tools/ask_user.md +103 -0
- connectonion/docs/useful_tools/diff_writer.md +158 -0
- connectonion/docs/useful_tools/get_emails.md +519 -0
- connectonion/docs/useful_tools/gmail.md +155 -0
- connectonion/docs/useful_tools/google_calendar.md +126 -0
- connectonion/docs/useful_tools/memory.md +506 -0
- connectonion/docs/useful_tools/microsoft_calendar.md +126 -0
- connectonion/docs/useful_tools/outlook.md +140 -0
- connectonion/docs/useful_tools/send_email.md +423 -0
- connectonion/docs/useful_tools/shell.md +115 -0
- connectonion/docs/useful_tools/slash_command.md +116 -0
- connectonion/docs/useful_tools/terminal.md +115 -0
- connectonion/docs/useful_tools/todo_list.md +272 -0
- connectonion/docs/useful_tools/web_fetch.md +150 -0
- connectonion/docs/vibe-coding-guide.md +97 -0
- connectonion/docs/windows-support.md +258 -0
- connectonion/logger.py +3 -3
- connectonion/network/__init__.py +19 -6
- connectonion/network/asgi/__init__.py +81 -0
- connectonion/network/asgi/http.py +205 -0
- connectonion/network/asgi/websocket.py +217 -0
- connectonion/network/connect.py +232 -185
- connectonion/network/host/__init__.py +59 -0
- connectonion/network/host/auth.py +191 -0
- connectonion/network/host/routes.py +135 -0
- connectonion/network/host/server.py +289 -0
- connectonion/network/host/session.py +78 -0
- connectonion/network/io/__init__.py +21 -0
- connectonion/network/{connection.py → io/base.py} +17 -42
- connectonion/network/io/websocket.py +55 -0
- connectonion/network/relay.py +37 -16
- connectonion/network/trust/__init__.py +30 -0
- connectonion/network/trust/factory.py +138 -0
- connectonion/network/{trust_agents.py → trust/prompts.py} +3 -3
- connectonion/network/{trust_functions.py → trust/tools.py} +2 -2
- connectonion/prompt_files/__init__.py +11 -1
- connectonion/prompt_files/react_acknowledge.md +26 -0
- connectonion/prompts.py +10 -1
- connectonion/tui/chat.py +10 -1
- connectonion/tui/divider.py +10 -1
- connectonion/tui/dropdown.py +10 -1
- connectonion/tui/footer.py +8 -0
- connectonion/tui/fuzzy.py +11 -1
- connectonion/tui/input.py +118 -70
- connectonion/tui/keys.py +133 -6
- connectonion/tui/providers.py +11 -1
- connectonion/tui/status_bar.py +10 -1
- connectonion/useful_events_handlers/__init__.py +8 -0
- connectonion/useful_events_handlers/reflect.py +19 -4
- connectonion/useful_plugins/__init__.py +2 -1
- connectonion/useful_plugins/eval.py +2 -2
- connectonion/useful_plugins/gmail_plugin.py +3 -3
- connectonion/useful_plugins/image_result_formatter.py +3 -3
- connectonion/useful_plugins/re_act.py +114 -28
- connectonion/useful_plugins/shell_approval.py +2 -2
- connectonion/useful_plugins/system_reminder.py +103 -0
- connectonion/useful_plugins/ui_stream.py +18 -133
- connectonion/useful_prompts/README.md +61 -0
- connectonion/useful_prompts/__init__.py +45 -0
- connectonion/useful_prompts/coding_agent/README.md +106 -0
- connectonion/useful_prompts/coding_agent/assembler.py +123 -0
- connectonion/useful_prompts/coding_agent/prompts/main.md +227 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/ask_user.md +61 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/background.md +57 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/edit.md +90 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/glob.md +52 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/grep.md +55 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/plan_mode.md +80 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/read.md +40 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/shell.md +67 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/task.md +51 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/todo.md +139 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/write.md +48 -0
- connectonion/useful_prompts/system-reminders/security-warning.md +14 -0
- connectonion/useful_prompts/system-reminders/test-reminder.md +11 -0
- connectonion/useful_tools/__init__.py +31 -4
- connectonion/useful_tools/ask_user.py +35 -0
- connectonion/useful_tools/bash.py +69 -0
- connectonion/useful_tools/diff_writer.py +186 -94
- connectonion/useful_tools/edit.py +102 -0
- connectonion/useful_tools/glob_files.py +97 -0
- connectonion/useful_tools/grep_files.py +171 -0
- connectonion/useful_tools/multi_edit.py +116 -0
- connectonion/useful_tools/read_file.py +73 -0
- connectonion/useful_tools/shell.py +50 -45
- connectonion/useful_tools/write_file.py +129 -0
- {connectonion-0.6.1.dist-info → connectonion-0.6.3.dist-info}/METADATA +10 -3
- connectonion-0.6.3.dist-info/RECORD +469 -0
- connectonion/cli/browser_agent/scroll_strategies.py +0 -276
- connectonion/network/asgi.py +0 -407
- connectonion/network/host.py +0 -616
- connectonion/network/trust.py +0 -166
- connectonion-0.6.1.dist-info/RECORD +0 -123
- /connectonion/cli/{docs → co_ai/prompts/connectonion}/connectonion.md +0 -0
- {connectonion-0.6.1.dist-info → connectonion-0.6.3.dist-info}/WHEEL +0 -0
- {connectonion-0.6.1.dist-info → connectonion-0.6.3.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
# Connection
|
|
2
|
+
|
|
3
|
+
> Communicate with clients from hosted agents. Same events, works locally and hosted.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Quick Start (60 Seconds)
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
from connectonion import Agent, host, after_llm, before_each_tool
|
|
11
|
+
|
|
12
|
+
@after_llm
|
|
13
|
+
def on_thinking(agent):
|
|
14
|
+
if agent.connection:
|
|
15
|
+
agent.connection.log("thinking")
|
|
16
|
+
|
|
17
|
+
@before_each_tool
|
|
18
|
+
def on_tool(agent):
|
|
19
|
+
if agent.connection:
|
|
20
|
+
tool = agent.current_session['pending_tool']
|
|
21
|
+
agent.connection.log("tool_call", name=tool['name'], arguments=tool['arguments'])
|
|
22
|
+
|
|
23
|
+
agent = Agent("helper", tools=[search], on_events=[on_thinking, on_tool])
|
|
24
|
+
host(agent)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**That's it.** Your agent now communicates with connected clients.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## The Core Concept
|
|
32
|
+
|
|
33
|
+
When you `host()` an agent, each request gets a `connection`:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
Local execution: agent.connection = None
|
|
37
|
+
Hosted execution: agent.connection = Connection to client
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Same events. Same code. Just check `if agent.connection:`.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Two-Layer API
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
48
|
+
│ HIGH-LEVEL API (2 methods) │
|
|
49
|
+
│ ────────────────────────── │
|
|
50
|
+
│ connection.log(type, **data) → one-way notify │
|
|
51
|
+
│ connection.request_approval(tool, args) → bool (two-way) │
|
|
52
|
+
├─────────────────────────────────────────────────────────────┤
|
|
53
|
+
│ LOW-LEVEL API (2 methods) │
|
|
54
|
+
│ ───────────────────────── │
|
|
55
|
+
│ connection.send(event) → send any event │
|
|
56
|
+
│ connection.receive() → get response │
|
|
57
|
+
└─────────────────────────────────────────────────────────────┘
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**High-level**: `log()` for notifications, `request_approval()` for permissions
|
|
61
|
+
**Low-level**: `send()` / `receive()` for custom needs
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## The Connection Interface
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
class Connection:
|
|
69
|
+
"""Connection to client for real-time communication."""
|
|
70
|
+
|
|
71
|
+
# ═══════════════════════════════════════════════════════
|
|
72
|
+
# LOW-LEVEL API (Primitives)
|
|
73
|
+
# ═══════════════════════════════════════════════════════
|
|
74
|
+
|
|
75
|
+
def send(self, event: dict) -> None:
|
|
76
|
+
"""Send any event to client."""
|
|
77
|
+
|
|
78
|
+
def receive(self) -> dict:
|
|
79
|
+
"""Receive response from client."""
|
|
80
|
+
|
|
81
|
+
# ═══════════════════════════════════════════════════════
|
|
82
|
+
# HIGH-LEVEL API (Patterns)
|
|
83
|
+
# ═══════════════════════════════════════════════════════
|
|
84
|
+
|
|
85
|
+
def log(self, event_type: str, **data) -> None:
|
|
86
|
+
"""One-way notification to client.
|
|
87
|
+
|
|
88
|
+
Common event types: thinking, tool_call, tool_result, complete, error
|
|
89
|
+
"""
|
|
90
|
+
self.send({"type": event_type, **data})
|
|
91
|
+
|
|
92
|
+
def request_approval(self, tool: str, arguments: dict) -> bool:
|
|
93
|
+
"""Two-way: request permission, wait for response."""
|
|
94
|
+
self.send({"type": "approval_needed", "tool": tool, "arguments": arguments})
|
|
95
|
+
response = self.receive()
|
|
96
|
+
return response.get("approved", False)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Lifecycle
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
105
|
+
│ │
|
|
106
|
+
│ LOCAL EXECUTION │
|
|
107
|
+
│ ─────────────── │
|
|
108
|
+
│ agent = Agent("helper", on_events=[...]) │
|
|
109
|
+
│ agent.connection = None ← Always None locally │
|
|
110
|
+
│ agent.input("hello") │
|
|
111
|
+
│ → Events fire │
|
|
112
|
+
│ → Handlers check: if agent.connection: (skip) │
|
|
113
|
+
│ │
|
|
114
|
+
│ HOSTED EXECUTION │
|
|
115
|
+
│ ──────────────── │
|
|
116
|
+
│ host(agent) │
|
|
117
|
+
│ │ │
|
|
118
|
+
│ ├─→ Client connects (WebSocket) │
|
|
119
|
+
│ │ │
|
|
120
|
+
│ ├─→ agent = copy.deepcopy(agent_template) │
|
|
121
|
+
│ │ │
|
|
122
|
+
│ ├─→ agent.connection = Connection(ws) ← Injected │
|
|
123
|
+
│ │ │
|
|
124
|
+
│ ├─→ agent.input(prompt) │
|
|
125
|
+
│ │ → Events fire │
|
|
126
|
+
│ │ → if agent.connection: ✓ │
|
|
127
|
+
│ │ → agent.connection.log("thinking") │
|
|
128
|
+
│ │ │
|
|
129
|
+
│ └─→ Request completes, connection closed │
|
|
130
|
+
│ │
|
|
131
|
+
└─────────────────────────────────────────────────────────────┘
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## High-Level API Examples
|
|
137
|
+
|
|
138
|
+
### Notify Events
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
from connectonion import Agent, host, after_llm, after_each_tool, on_complete
|
|
142
|
+
|
|
143
|
+
@after_llm
|
|
144
|
+
def on_thinking(agent):
|
|
145
|
+
if agent.connection:
|
|
146
|
+
agent.connection.log("thinking")
|
|
147
|
+
|
|
148
|
+
@after_each_tool
|
|
149
|
+
def on_result(agent):
|
|
150
|
+
if agent.connection:
|
|
151
|
+
trace = agent.current_session['trace'][-1]
|
|
152
|
+
agent.connection.log("tool_result", name=trace['tool_name'], result=trace['result'])
|
|
153
|
+
|
|
154
|
+
@on_complete
|
|
155
|
+
def on_done(agent):
|
|
156
|
+
if agent.connection:
|
|
157
|
+
agent.connection.log("complete", result=agent.current_session['result'])
|
|
158
|
+
|
|
159
|
+
agent = Agent("helper", tools=[search], on_events=[on_thinking, on_result, on_done])
|
|
160
|
+
host(agent)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Tool Approval
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
from connectonion import Agent, host, before_each_tool
|
|
167
|
+
|
|
168
|
+
class ToolRejected(Exception):
|
|
169
|
+
pass
|
|
170
|
+
|
|
171
|
+
DANGEROUS_TOOLS = ["delete_file", "send_email", "run_shell"]
|
|
172
|
+
|
|
173
|
+
@before_each_tool
|
|
174
|
+
def check_approval(agent):
|
|
175
|
+
if not agent.connection:
|
|
176
|
+
return
|
|
177
|
+
|
|
178
|
+
tool = agent.current_session['pending_tool']
|
|
179
|
+
|
|
180
|
+
# Notify tool is starting
|
|
181
|
+
agent.connection.log("tool_call", name=tool['name'], arguments=tool['arguments'])
|
|
182
|
+
|
|
183
|
+
# Request approval for dangerous tools
|
|
184
|
+
if tool['name'] in DANGEROUS_TOOLS:
|
|
185
|
+
if not agent.connection.request_approval(tool['name'], tool['arguments']):
|
|
186
|
+
raise ToolRejected(f"User rejected {tool['name']}")
|
|
187
|
+
|
|
188
|
+
agent = Agent("helper", tools=[delete_file], on_events=[check_approval])
|
|
189
|
+
host(agent)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Low-Level API Examples
|
|
195
|
+
|
|
196
|
+
For custom events and interactions:
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
@after_llm
|
|
200
|
+
def custom_progress(agent):
|
|
201
|
+
if agent.connection:
|
|
202
|
+
# Custom event type
|
|
203
|
+
agent.connection.send({
|
|
204
|
+
"type": "progress",
|
|
205
|
+
"percent": 50,
|
|
206
|
+
"stage": "analyzing"
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
@before_each_tool
|
|
210
|
+
def custom_interaction(agent):
|
|
211
|
+
if not agent.connection:
|
|
212
|
+
return
|
|
213
|
+
|
|
214
|
+
tool = agent.current_session['pending_tool']
|
|
215
|
+
|
|
216
|
+
# Ask user to choose
|
|
217
|
+
agent.connection.send({
|
|
218
|
+
"type": "choice",
|
|
219
|
+
"question": "Which method?",
|
|
220
|
+
"options": ["fast", "thorough"]
|
|
221
|
+
})
|
|
222
|
+
response = agent.connection.receive()
|
|
223
|
+
method = response.get("choice", "fast")
|
|
224
|
+
|
|
225
|
+
# Modify tool arguments based on choice
|
|
226
|
+
tool['arguments']['method'] = method
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Event Protocol
|
|
232
|
+
|
|
233
|
+
### Server → Client
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
// Common events (via log())
|
|
237
|
+
{ type: "thinking" }
|
|
238
|
+
{ type: "tool_call", name: string, arguments: object }
|
|
239
|
+
{ type: "tool_result", name: string, result: string }
|
|
240
|
+
{ type: "complete", result: string }
|
|
241
|
+
{ type: "error", message: string }
|
|
242
|
+
|
|
243
|
+
// Approval request (via request_approval())
|
|
244
|
+
{ type: "approval_needed", tool: string, arguments: object }
|
|
245
|
+
|
|
246
|
+
// Custom events (via send())
|
|
247
|
+
{ type: "your_custom_type", ...data }
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Client → Server
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
// Approval response
|
|
254
|
+
{ approved: boolean }
|
|
255
|
+
|
|
256
|
+
// Custom response
|
|
257
|
+
{ ...your_data }
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Client-Side (JavaScript)
|
|
263
|
+
|
|
264
|
+
```javascript
|
|
265
|
+
const ws = new WebSocket("ws://localhost:8000/ws");
|
|
266
|
+
|
|
267
|
+
ws.onmessage = async (event) => {
|
|
268
|
+
const msg = JSON.parse(event.data);
|
|
269
|
+
|
|
270
|
+
switch (msg.type) {
|
|
271
|
+
case "thinking":
|
|
272
|
+
showSpinner();
|
|
273
|
+
break;
|
|
274
|
+
|
|
275
|
+
case "tool_call":
|
|
276
|
+
appendMessage(`Calling ${msg.name}...`);
|
|
277
|
+
break;
|
|
278
|
+
|
|
279
|
+
case "tool_result":
|
|
280
|
+
appendMessage(`${msg.name}: ${msg.result}`);
|
|
281
|
+
break;
|
|
282
|
+
|
|
283
|
+
case "complete":
|
|
284
|
+
hideSpinner();
|
|
285
|
+
appendMessage(msg.result);
|
|
286
|
+
break;
|
|
287
|
+
|
|
288
|
+
case "error":
|
|
289
|
+
showError(msg.message);
|
|
290
|
+
break;
|
|
291
|
+
|
|
292
|
+
case "approval_needed":
|
|
293
|
+
const approved = await showApprovalDialog(msg.tool, msg.arguments);
|
|
294
|
+
ws.send(JSON.stringify({ approved }));
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// Send prompt
|
|
300
|
+
ws.send(JSON.stringify({ type: "INPUT", prompt: "Search for Python docs" }));
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## React Hook
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
309
|
+
|
|
310
|
+
function useAgent(wsUrl: string) {
|
|
311
|
+
const [events, setEvents] = useState([]);
|
|
312
|
+
const [pendingApproval, setPendingApproval] = useState(null);
|
|
313
|
+
const [ws, setWs] = useState(null);
|
|
314
|
+
|
|
315
|
+
useEffect(() => {
|
|
316
|
+
const socket = new WebSocket(wsUrl);
|
|
317
|
+
|
|
318
|
+
socket.onmessage = (e) => {
|
|
319
|
+
const event = JSON.parse(e.data);
|
|
320
|
+
setEvents(prev => [...prev, event]);
|
|
321
|
+
|
|
322
|
+
if (event.type === 'approval_needed') {
|
|
323
|
+
setPendingApproval(event);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
setWs(socket);
|
|
328
|
+
return () => socket.close();
|
|
329
|
+
}, [wsUrl]);
|
|
330
|
+
|
|
331
|
+
const send = useCallback((prompt) => {
|
|
332
|
+
ws?.send(JSON.stringify({ type: 'INPUT', prompt }));
|
|
333
|
+
}, [ws]);
|
|
334
|
+
|
|
335
|
+
const approve = useCallback((approved) => {
|
|
336
|
+
if (pendingApproval) {
|
|
337
|
+
ws?.send(JSON.stringify({ approved }));
|
|
338
|
+
setPendingApproval(null);
|
|
339
|
+
}
|
|
340
|
+
}, [ws, pendingApproval]);
|
|
341
|
+
|
|
342
|
+
return { events, pendingApproval, send, approve };
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Usage
|
|
347
|
+
|
|
348
|
+
```tsx
|
|
349
|
+
function AgentChat() {
|
|
350
|
+
const { events, pendingApproval, send, approve } = useAgent("ws://localhost:8000/ws");
|
|
351
|
+
|
|
352
|
+
return (
|
|
353
|
+
<div>
|
|
354
|
+
{events.map((e, i) => (
|
|
355
|
+
<EventMessage key={i} event={e} />
|
|
356
|
+
))}
|
|
357
|
+
|
|
358
|
+
{pendingApproval && (
|
|
359
|
+
<ApprovalDialog
|
|
360
|
+
tool={pendingApproval.tool}
|
|
361
|
+
onApprove={() => approve(true)}
|
|
362
|
+
onReject={() => approve(false)}
|
|
363
|
+
/>
|
|
364
|
+
)}
|
|
365
|
+
|
|
366
|
+
<ChatInput onSend={send} />
|
|
367
|
+
</div>
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## Available Events
|
|
375
|
+
|
|
376
|
+
| Event | When It Fires | Typical Usage |
|
|
377
|
+
|-------|---------------|---------------|
|
|
378
|
+
| `after_llm` | After each LLM response | `log("thinking")` |
|
|
379
|
+
| `before_each_tool` | Before each tool executes | `log("tool_call", ...)`, `request_approval(...)` |
|
|
380
|
+
| `after_each_tool` | After each tool completes | `log("tool_result", ...)` |
|
|
381
|
+
| `on_complete` | After agent finishes | `log("complete", ...)` |
|
|
382
|
+
| `on_error` | When tool fails | `log("error", ...)` |
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Complete Example
|
|
387
|
+
|
|
388
|
+
```python
|
|
389
|
+
from connectonion import (
|
|
390
|
+
Agent, host,
|
|
391
|
+
after_llm, before_each_tool, after_each_tool, on_complete, on_error
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
class ToolRejected(Exception):
|
|
395
|
+
pass
|
|
396
|
+
|
|
397
|
+
DANGEROUS_TOOLS = ["delete_file", "send_email"]
|
|
398
|
+
|
|
399
|
+
@after_llm
|
|
400
|
+
def on_thinking(agent):
|
|
401
|
+
if agent.connection:
|
|
402
|
+
agent.connection.log("thinking")
|
|
403
|
+
|
|
404
|
+
@before_each_tool
|
|
405
|
+
def on_tool_start(agent):
|
|
406
|
+
if not agent.connection:
|
|
407
|
+
return
|
|
408
|
+
|
|
409
|
+
tool = agent.current_session['pending_tool']
|
|
410
|
+
agent.connection.log("tool_call", name=tool['name'], arguments=tool['arguments'])
|
|
411
|
+
|
|
412
|
+
if tool['name'] in DANGEROUS_TOOLS:
|
|
413
|
+
if not agent.connection.request_approval(tool['name'], tool['arguments']):
|
|
414
|
+
raise ToolRejected(tool['name'])
|
|
415
|
+
|
|
416
|
+
@after_each_tool
|
|
417
|
+
def on_tool_end(agent):
|
|
418
|
+
if agent.connection:
|
|
419
|
+
trace = agent.current_session['trace'][-1]
|
|
420
|
+
agent.connection.log(
|
|
421
|
+
"tool_result",
|
|
422
|
+
name=trace['tool_name'],
|
|
423
|
+
result=trace['result'],
|
|
424
|
+
status=trace['status']
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
@on_complete
|
|
428
|
+
def on_done(agent):
|
|
429
|
+
if agent.connection:
|
|
430
|
+
agent.connection.log("complete", result=agent.current_session['result'])
|
|
431
|
+
|
|
432
|
+
@on_error
|
|
433
|
+
def on_fail(agent):
|
|
434
|
+
if agent.connection:
|
|
435
|
+
trace = agent.current_session['trace'][-1]
|
|
436
|
+
agent.connection.log("error", message=trace.get('error', 'Unknown error'))
|
|
437
|
+
|
|
438
|
+
agent = Agent(
|
|
439
|
+
"helper",
|
|
440
|
+
tools=[search, delete_file],
|
|
441
|
+
on_events=[on_thinking, on_tool_start, on_tool_end, on_done, on_fail]
|
|
442
|
+
)
|
|
443
|
+
|
|
444
|
+
host(agent)
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## Local vs Hosted
|
|
450
|
+
|
|
451
|
+
Same handlers work in both contexts:
|
|
452
|
+
|
|
453
|
+
```python
|
|
454
|
+
@after_llm
|
|
455
|
+
def my_handler(agent):
|
|
456
|
+
# Runs in BOTH local and hosted mode
|
|
457
|
+
print(f"Iteration {agent.current_session['iteration']}")
|
|
458
|
+
|
|
459
|
+
# Only runs when hosted
|
|
460
|
+
if agent.connection:
|
|
461
|
+
agent.connection.log("thinking")
|
|
462
|
+
|
|
463
|
+
# Local - connection is None, skips log
|
|
464
|
+
agent = Agent("helper", on_events=[my_handler])
|
|
465
|
+
agent.input("hello")
|
|
466
|
+
|
|
467
|
+
# Hosted - connection exists, sends to client
|
|
468
|
+
host(agent)
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## Custom Adapters
|
|
474
|
+
|
|
475
|
+
Implement your own connection for custom transports:
|
|
476
|
+
|
|
477
|
+
```python
|
|
478
|
+
from connectonion.network import Connection
|
|
479
|
+
|
|
480
|
+
class SlackConnection(Connection):
|
|
481
|
+
"""Send events to Slack channel."""
|
|
482
|
+
|
|
483
|
+
def __init__(self, slack_client, channel_id):
|
|
484
|
+
self._slack = slack_client
|
|
485
|
+
self._channel = channel_id
|
|
486
|
+
|
|
487
|
+
def send(self, event: dict):
|
|
488
|
+
self._slack.chat_postMessage(
|
|
489
|
+
channel=self._channel,
|
|
490
|
+
text=f"{event['type']}: {event.get('result', event.get('name', ''))}"
|
|
491
|
+
)
|
|
492
|
+
|
|
493
|
+
def receive(self) -> dict:
|
|
494
|
+
# Implementation depends on your Slack setup
|
|
495
|
+
pass
|
|
496
|
+
|
|
497
|
+
# High-level methods automatically use send/receive
|
|
498
|
+
|
|
499
|
+
# Use custom adapter
|
|
500
|
+
agent.connection = SlackConnection(slack_client, "#agent-events")
|
|
501
|
+
agent.input("do something")
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
## Summary
|
|
507
|
+
|
|
508
|
+
| Layer | Methods | For |
|
|
509
|
+
|-------|---------|-----|
|
|
510
|
+
| **High-level** | `log(type, **data)`, `request_approval(tool, args)` | Daily use (2 methods) |
|
|
511
|
+
| **Low-level** | `send(event)`, `receive()` | Custom events (2 methods) |
|
|
512
|
+
|
|
513
|
+
**The pattern:**
|
|
514
|
+
|
|
515
|
+
```python
|
|
516
|
+
if agent.connection:
|
|
517
|
+
# One-way notifications
|
|
518
|
+
agent.connection.log("thinking")
|
|
519
|
+
agent.connection.log("tool_call", name="search", arguments={"q": "python"})
|
|
520
|
+
|
|
521
|
+
# Two-way permission request
|
|
522
|
+
if not agent.connection.request_approval("delete", {"path": "/tmp/x"}):
|
|
523
|
+
raise ToolRejected()
|
|
524
|
+
|
|
525
|
+
# Custom events (low-level)
|
|
526
|
+
agent.connection.send({"type": "custom", "data": {...}})
|
|
527
|
+
response = agent.connection.receive()
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
**4 methods total. Simple things simple. Complicated things possible.**
|
|
531
|
+
|
|
532
|
+
---
|
|
533
|
+
|
|
534
|
+
## Learn More
|
|
535
|
+
|
|
536
|
+
- **[host.md](host.md)** - Host agents over HTTP/WebSocket
|
|
537
|
+
- **[connect.md](connect.md)** - Connect to remote agents
|
|
538
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Deploy Your Agent
|
|
2
|
+
|
|
3
|
+
Get your agent running in production.
|
|
4
|
+
|
|
5
|
+
> **Beta**: `co deploy` is in beta. Works well but may change.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Two Options
|
|
10
|
+
|
|
11
|
+
| Option | Best For |
|
|
12
|
+
|--------|----------|
|
|
13
|
+
| **`co deploy`** | Quick deployment, managed hosting |
|
|
14
|
+
| **Self-host** | Full control, your own infrastructure |
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## co deploy (Easiest)
|
|
19
|
+
|
|
20
|
+
Deploy to ConnectOnion Cloud with one command.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cd my-agent
|
|
24
|
+
git init && git add -A && git commit -m "Initial commit"
|
|
25
|
+
co auth # If not already authenticated
|
|
26
|
+
co deploy
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Output:**
|
|
30
|
+
```
|
|
31
|
+
Deploying to ConnectOnion Cloud...
|
|
32
|
+
|
|
33
|
+
Project: my-agent
|
|
34
|
+
Secrets: 3 keys
|
|
35
|
+
|
|
36
|
+
Uploading...
|
|
37
|
+
Building...
|
|
38
|
+
|
|
39
|
+
Deployed!
|
|
40
|
+
Agent URL: https://my-agent-0x7a9f3b2c.agents.openonion.ai
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
URL format: `{project_name}-{your_address[:10]}.agents.openonion.ai`
|
|
44
|
+
|
|
45
|
+
Re-deploying the same project updates the same URL (like Heroku).
|
|
46
|
+
|
|
47
|
+
### Requirements
|
|
48
|
+
|
|
49
|
+
- Git repository with committed code
|
|
50
|
+
- `.co/config.toml` (created by `co create` or `co init`)
|
|
51
|
+
- Authenticated (`co auth`)
|
|
52
|
+
|
|
53
|
+
### How It Works
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
co deploy → Upload source → We build and run → Returns URL
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
You upload source code, we handle the rest.
|
|
60
|
+
|
|
61
|
+
### Configuration
|
|
62
|
+
|
|
63
|
+
```toml
|
|
64
|
+
# .co/config.toml
|
|
65
|
+
[project]
|
|
66
|
+
name = "my-agent"
|
|
67
|
+
secrets = ".env"
|
|
68
|
+
|
|
69
|
+
[deploy]
|
|
70
|
+
entrypoint = "agent.py"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Secrets
|
|
74
|
+
|
|
75
|
+
Secrets from `.env` are securely passed to your agent:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# .env
|
|
79
|
+
OPENAI_API_KEY=sk-xxx
|
|
80
|
+
DATABASE_URL=postgres://...
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Self-Host
|
|
86
|
+
|
|
87
|
+
Deploy to your own VPS or infrastructure using `host()`.
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
# agent.py
|
|
91
|
+
from connectonion import Agent, host
|
|
92
|
+
|
|
93
|
+
agent = Agent("my-agent", tools=[my_tool])
|
|
94
|
+
|
|
95
|
+
# Export ASGI app for uvicorn/gunicorn
|
|
96
|
+
app = host.app(agent)
|
|
97
|
+
|
|
98
|
+
if __name__ == "__main__":
|
|
99
|
+
host(agent)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Deploy with uvicorn, gunicorn, or any ASGI server:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Direct
|
|
106
|
+
python agent.py
|
|
107
|
+
|
|
108
|
+
# Uvicorn
|
|
109
|
+
uvicorn agent:app --workers 4
|
|
110
|
+
|
|
111
|
+
# Gunicorn
|
|
112
|
+
gunicorn agent:app -w 4 -k uvicorn.workers.UvicornWorker
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
For full API reference, see [host()](host.md).
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## When to Use Which
|
|
120
|
+
|
|
121
|
+
**Use `co deploy`:** Fastest path to production, no infrastructure management.
|
|
122
|
+
|
|
123
|
+
**Use self-hosting:** Full control, custom domains, compliance requirements.
|