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,629 @@
|
|
|
1
|
+
# Connect to Remote Agents
|
|
2
|
+
|
|
3
|
+
> Use any agent, anywhere, as if it were local. Real-time UI updates included.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌────────────────────────────────────────────────────────────────────────────┐
|
|
11
|
+
│ YOUR APPLICATION │
|
|
12
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
|
|
13
|
+
│ │ React/Vue │ │ Python │ │ Swift/Kotlin │ │
|
|
14
|
+
│ │ useAgent() │ │ connect() │ │ connect() │ │
|
|
15
|
+
│ └──────┬───────┘ └──────┬───────┘ └──────────┬───────────┘ │
|
|
16
|
+
│ │ │ │ │
|
|
17
|
+
└─────────┼───────────────────────┼───────────────────────────┼──────────────┘
|
|
18
|
+
│ │ │
|
|
19
|
+
└───────────────────────┼───────────────────────────┘
|
|
20
|
+
│
|
|
21
|
+
▼
|
|
22
|
+
┌─────────────────────────────┐
|
|
23
|
+
│ WebSocket /ws/input │
|
|
24
|
+
│ wss://oo.openonion.ai │
|
|
25
|
+
└──────────────┬──────────────┘
|
|
26
|
+
│
|
|
27
|
+
▼
|
|
28
|
+
┌────────────────────────────────────────────────────┐
|
|
29
|
+
│ RELAY SERVER │
|
|
30
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌───────────┐ │
|
|
31
|
+
│ │ /ws/announce │ │ /ws/input │ │ /ws/lookup│ │
|
|
32
|
+
│ │ Agents │ │ Clients │ │ Discovery │ │
|
|
33
|
+
│ └──────┬───────┘ └──────┬───────┘ └───────────┘ │
|
|
34
|
+
│ │ │ │
|
|
35
|
+
│ │ active_connections {address → WebSocket} │
|
|
36
|
+
│ │ pending_outputs {input_id → Future} │
|
|
37
|
+
│ │ │
|
|
38
|
+
└─────────┼─────────────────┼─────────────────────────┘
|
|
39
|
+
│ │
|
|
40
|
+
│ ┌───────────┘
|
|
41
|
+
│ │
|
|
42
|
+
▼ ▼
|
|
43
|
+
┌────────────────────────────────────────────────────┐
|
|
44
|
+
│ AGENT │
|
|
45
|
+
│ host(agent) → /ws/announce → ANNOUNCE → ready │
|
|
46
|
+
│ │
|
|
47
|
+
│ INPUT received → agent.input(prompt) → OUTPUT │
|
|
48
|
+
└────────────────────────────────────────────────────┘
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Lifecycle
|
|
54
|
+
|
|
55
|
+
### 1. Agent Registers (Server Side)
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from connectonion import Agent, host
|
|
59
|
+
|
|
60
|
+
agent = Agent("my-agent", tools=[...])
|
|
61
|
+
host(agent) # Connects to /ws/announce, sends ANNOUNCE
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The agent:
|
|
65
|
+
1. Connects WebSocket to `wss://oo.openonion.ai/ws/announce`
|
|
66
|
+
2. Sends ANNOUNCE: `{type, address, summary, endpoints, signature}`
|
|
67
|
+
3. Relay stores in `active_connections[address] = websocket`
|
|
68
|
+
4. Agent waits for INPUT messages
|
|
69
|
+
|
|
70
|
+
### 2. Client Connects (Any Platform)
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from connectonion import connect
|
|
74
|
+
|
|
75
|
+
agent = connect("0x123abc...")
|
|
76
|
+
response = agent.input("Hello")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The client:
|
|
80
|
+
1. `connect(address)` creates RemoteAgent instance
|
|
81
|
+
2. `input(prompt)` opens WebSocket to `/ws/input`
|
|
82
|
+
3. Sends INPUT: `{type: "INPUT", input_id, to: "0x...", prompt, session?}`
|
|
83
|
+
4. Relay looks up `active_connections[to]`
|
|
84
|
+
5. Relay forwards INPUT to agent's WebSocket
|
|
85
|
+
|
|
86
|
+
### 3. Agent Processes
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
Relay → INPUT → Agent
|
|
90
|
+
│
|
|
91
|
+
├─ agent.input(prompt)
|
|
92
|
+
│
|
|
93
|
+
├─ Streaming events (direct /ws only):
|
|
94
|
+
│ ← tool_call, tool_result, thinking, assistant, ask_user
|
|
95
|
+
│
|
|
96
|
+
└─ OUTPUT → Relay → Client
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 4. Client Receives Response
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
response = agent.input("Hello")
|
|
103
|
+
|
|
104
|
+
response.text # "Hello! How can I help?"
|
|
105
|
+
response.done # True (complete) or False (needs more input)
|
|
106
|
+
|
|
107
|
+
agent.ui # All events for rendering
|
|
108
|
+
agent.status # 'idle' | 'working' | 'waiting'
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Connection Modes
|
|
114
|
+
|
|
115
|
+
### Via Relay (Default)
|
|
116
|
+
|
|
117
|
+
Uses agent address to route through relay server:
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
# Python
|
|
121
|
+
agent = connect("0x3d4017c3...")
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
// TypeScript
|
|
126
|
+
const agent = connect("0x3d4017c3...");
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Direct to Deployed Agent
|
|
130
|
+
|
|
131
|
+
For agents deployed via `co deploy`, connect directly to their URL:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// TypeScript - bypass relay
|
|
135
|
+
const agent = connect("agent-name", {
|
|
136
|
+
directUrl: "https://my-agent.agents.openonion.ai"
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Discovery & Smart Routing (Recommended for Custom Clients)
|
|
141
|
+
|
|
142
|
+
The relay stores agent-provided endpoints and can return them for direct connections.
|
|
143
|
+
The SDKs do **not** automatically probe endpoints yet; they use relay by default (Python) or `directUrl` when provided (TypeScript).
|
|
144
|
+
|
|
145
|
+
To implement smarter routing:
|
|
146
|
+
1. **Lookup endpoints** for the agent via relay:
|
|
147
|
+
- **WebSocket** `/ws/lookup` with `GET_AGENT`
|
|
148
|
+
- **HTTP** `/api/relay/agents/{address}`
|
|
149
|
+
2. **Try direct endpoints first** (if any):
|
|
150
|
+
- Prefer `ws://`/`http://` endpoints that are reachable from your network.
|
|
151
|
+
- If you are on the same LAN, a private IP (RFC1918) endpoint may be fastest.
|
|
152
|
+
3. **Fallback to relay** `/ws/input` if direct endpoints fail.
|
|
153
|
+
|
|
154
|
+
The relay does not determine whether an endpoint is “local” or “public”; it simply returns what the agent announced.
|
|
155
|
+
There is no WebRTC support in the relay server today.
|
|
156
|
+
TODO: Add WebRTC-style ICE candidates (host/srflx/relay) and connectivity checks
|
|
157
|
+
so clients can automatically pick the best direct path.
|
|
158
|
+
|
|
159
|
+
#### Lookup via WebSocket
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
// Client → /ws/lookup
|
|
163
|
+
{ "type": "GET_AGENT", "address": "0x3d4017c3..." }
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
// Server → client
|
|
168
|
+
{
|
|
169
|
+
"type": "AGENT_INFO",
|
|
170
|
+
"agent": {
|
|
171
|
+
"address": "0x3d4017c3...",
|
|
172
|
+
"summary": "translator agent",
|
|
173
|
+
"endpoints": ["ws://192.168.1.10:8000/ws"],
|
|
174
|
+
"last_announce": "2024-01-15T10:23:45Z",
|
|
175
|
+
"online": true
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
#### Lookup via HTTP
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
curl https://oo.openonion.ai/api/relay/agents/0x3d4017c3...
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"online": true,
|
|
189
|
+
"endpoints": ["ws://192.168.1.10:8000/ws"],
|
|
190
|
+
"last_seen": "2024-01-15T10:23:45Z"
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Message Protocol
|
|
197
|
+
|
|
198
|
+
### INPUT (Client → Relay → Agent)
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"type": "INPUT",
|
|
203
|
+
"input_id": "uuid-1234",
|
|
204
|
+
"to": "0x3d4017c3...",
|
|
205
|
+
"prompt": "Book a flight to Tokyo",
|
|
206
|
+
"session": { "messages": [...] }
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### OUTPUT (Agent → Relay → Client)
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"type": "OUTPUT",
|
|
215
|
+
"input_id": "uuid-1234",
|
|
216
|
+
"result": "Booked! Confirmation #ABC123",
|
|
217
|
+
"session": { "messages": [...updated...] }
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Streaming Events (Agent → Client)
|
|
222
|
+
|
|
223
|
+
| Event | Purpose |
|
|
224
|
+
|-------|---------|
|
|
225
|
+
| `tool_call` | Tool execution started `{id, name, args, status: "running"}` |
|
|
226
|
+
| `tool_result` | Tool completed `{id, result, status: "done"}` |
|
|
227
|
+
| `thinking` | Agent is processing |
|
|
228
|
+
| `ask_user` | Agent needs input `{text, options?}` → `done: false` |
|
|
229
|
+
|
|
230
|
+
Note: Relay /ws/input does not forward streaming events. Use direct host /ws for real-time events.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Related Files
|
|
235
|
+
|
|
236
|
+
| File | Purpose |
|
|
237
|
+
|------|---------|
|
|
238
|
+
| `connectonion/network/connect.py` | Python client - RemoteAgent class |
|
|
239
|
+
| `connectonion/network/relay.py` | Agent-side relay connection |
|
|
240
|
+
| `connectonion-ts/src/connect.ts` | TypeScript client - same API |
|
|
241
|
+
| `connectonion-ts/src/react/index.ts` | useAgent React hook |
|
|
242
|
+
| `oo-api/relay/routes.py` | Relay server endpoints |
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Quick Start
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
from connectonion import connect
|
|
250
|
+
|
|
251
|
+
agent = connect("0x...")
|
|
252
|
+
|
|
253
|
+
response = agent.input("Book a flight to Tokyo")
|
|
254
|
+
print(response.text) # "Which date do you prefer?"
|
|
255
|
+
print(response.done) # False - agent asked a question
|
|
256
|
+
|
|
257
|
+
response = agent.input("March 15")
|
|
258
|
+
print(response.text) # "Booked! Confirmation #ABC123"
|
|
259
|
+
print(response.done) # True
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Response
|
|
265
|
+
|
|
266
|
+
```python
|
|
267
|
+
response = agent.input("task")
|
|
268
|
+
|
|
269
|
+
response.text # Agent's response or question
|
|
270
|
+
response.done # True = complete, False = needs more input
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Session State
|
|
276
|
+
|
|
277
|
+
`current_session` is synced from the server when the server includes it (direct host /ws).
|
|
278
|
+
Relay /ws/input currently returns only OUTPUT without session data.
|
|
279
|
+
|
|
280
|
+
```python
|
|
281
|
+
agent.current_session # Synced from server when available (read-only)
|
|
282
|
+
agent.ui # Client-side UI event list (input + streamed events)
|
|
283
|
+
agent.status # 'idle' | 'working' | 'waiting'
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## UI Rendering
|
|
289
|
+
|
|
290
|
+
`agent.ui` contains all events for rendering. **One type = one component.**
|
|
291
|
+
Streaming events are delivered only for direct host /ws connections; relay returns only OUTPUT.
|
|
292
|
+
|
|
293
|
+
```python
|
|
294
|
+
agent.ui = [
|
|
295
|
+
{"id": "1", "type": "user", "content": "Book a flight"},
|
|
296
|
+
{"id": "2", "type": "thinking"},
|
|
297
|
+
{"id": "3", "type": "tool_call", "name": "search_flights", "status": "running"},
|
|
298
|
+
# ↑ When tool_result arrives, client updates this item to status: "done"
|
|
299
|
+
{"id": "4", "type": "agent", "content": "Found 3 flights..."},
|
|
300
|
+
{"id": "5", "type": "ask_user", "text": "Which date?", "options": ["Mar 15", "Mar 16"]},
|
|
301
|
+
]
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Event Types
|
|
305
|
+
|
|
306
|
+
| Type | Component | Fields |
|
|
307
|
+
|------|-----------|--------|
|
|
308
|
+
| `user` | User chat bubble | `content` |
|
|
309
|
+
| `agent` | Agent chat bubble | `content` |
|
|
310
|
+
| `thinking` | Loading spinner | - |
|
|
311
|
+
| `tool_call` | Tool card | `name`, `status`, `result?` |
|
|
312
|
+
| `ask_user` | Question form | `text`, `options?` |
|
|
313
|
+
|
|
314
|
+
### Server → Client Mapping
|
|
315
|
+
|
|
316
|
+
Server sends two events, client merges into one UI item:
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
Server: tool_call {id: "3", name: "search"} → UI: {id: "3", status: "running"}
|
|
320
|
+
Server: tool_result {id: "3", result: "..."} → UI: {id: "3", status: "done", result: "..."}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Cross-Platform SDKs
|
|
326
|
+
|
|
327
|
+
### Python
|
|
328
|
+
|
|
329
|
+
```python
|
|
330
|
+
from connectonion import connect
|
|
331
|
+
|
|
332
|
+
agent = connect("0x...")
|
|
333
|
+
response = agent.input("Book a flight")
|
|
334
|
+
print(response.text) # "Which date?"
|
|
335
|
+
print(response.done) # False
|
|
336
|
+
print(agent.ui) # All events for rendering
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### TypeScript
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
import { connect } from 'connectonion';
|
|
343
|
+
|
|
344
|
+
const agent = connect('0x...');
|
|
345
|
+
const response = await agent.input('Book a flight');
|
|
346
|
+
console.log(response.text); // "Which date?"
|
|
347
|
+
console.log(response.done); // false
|
|
348
|
+
console.log(agent.ui); // All events for rendering
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Swift
|
|
352
|
+
|
|
353
|
+
```swift
|
|
354
|
+
import ConnectOnion
|
|
355
|
+
|
|
356
|
+
let agent = connect("0x...")
|
|
357
|
+
let response = try await agent.input("Book a flight")
|
|
358
|
+
print(response.text) // "Which date?"
|
|
359
|
+
print(response.done) // false
|
|
360
|
+
print(agent.ui) // All events for rendering
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Kotlin
|
|
364
|
+
|
|
365
|
+
```kotlin
|
|
366
|
+
import com.connectonion.connect
|
|
367
|
+
|
|
368
|
+
val agent = connect("0x...")
|
|
369
|
+
val response = agent.input("Book a flight")
|
|
370
|
+
println(response.text) // "Which date?"
|
|
371
|
+
println(response.done) // false
|
|
372
|
+
println(agent.ui) // All events for rendering
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## React / Vue Integration
|
|
378
|
+
|
|
379
|
+
For reactive UI updates, use framework-specific hooks:
|
|
380
|
+
|
|
381
|
+
### React
|
|
382
|
+
|
|
383
|
+
```tsx
|
|
384
|
+
import { useAgent } from 'connectonion/react';
|
|
385
|
+
|
|
386
|
+
function ChatUI() {
|
|
387
|
+
const agent = useAgent('0x...');
|
|
388
|
+
|
|
389
|
+
return (
|
|
390
|
+
<div>
|
|
391
|
+
{agent.ui.map(item => {
|
|
392
|
+
switch (item.type) {
|
|
393
|
+
case 'user': return <UserBubble key={item.id} {...item} />;
|
|
394
|
+
case 'agent': return <AgentBubble key={item.id} {...item} />;
|
|
395
|
+
case 'thinking': return <Thinking key={item.id} />;
|
|
396
|
+
case 'tool_call': return <ToolCard key={item.id} {...item} />;
|
|
397
|
+
case 'ask_user': return <QuestionForm key={item.id} {...item} onAnswer={agent.send} />;
|
|
398
|
+
}
|
|
399
|
+
})}
|
|
400
|
+
<Input onSend={agent.send} disabled={agent.status === 'working'} />
|
|
401
|
+
</div>
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Vue
|
|
407
|
+
|
|
408
|
+
```vue
|
|
409
|
+
<script setup>
|
|
410
|
+
import { useAgent } from 'connectonion/vue';
|
|
411
|
+
|
|
412
|
+
const agent = useAgent('0x...');
|
|
413
|
+
</script>
|
|
414
|
+
|
|
415
|
+
<template>
|
|
416
|
+
<div v-for="item in agent.ui" :key="item.id">
|
|
417
|
+
<UserBubble v-if="item.type === 'user'" v-bind="item" />
|
|
418
|
+
<AgentBubble v-if="item.type === 'agent'" v-bind="item" />
|
|
419
|
+
<Thinking v-if="item.type === 'thinking'" />
|
|
420
|
+
<ToolCard v-if="item.type === 'tool_call'" v-bind="item" />
|
|
421
|
+
<QuestionForm v-if="item.type === 'ask_user'" v-bind="item" @answer="agent.send" />
|
|
422
|
+
</div>
|
|
423
|
+
<Input @send="agent.send" :disabled="agent.status === 'working'" />
|
|
424
|
+
</template>
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Hook Interface
|
|
428
|
+
|
|
429
|
+
All hooks return the same interface:
|
|
430
|
+
|
|
431
|
+
```ts
|
|
432
|
+
const agent = useAgent('0x...');
|
|
433
|
+
|
|
434
|
+
agent.ui // UIEvent[] - reactive, auto updates
|
|
435
|
+
agent.status // 'idle' | 'working' | 'waiting' - reactive
|
|
436
|
+
agent.send() // Send message
|
|
437
|
+
agent.reset() // Clear conversation
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
## API Reference
|
|
443
|
+
|
|
444
|
+
### connect()
|
|
445
|
+
|
|
446
|
+
```python
|
|
447
|
+
agent = connect("0x...", relay_url="ws://localhost:8000/ws/announce")
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
| Parameter | Type | Default | Description |
|
|
451
|
+
|-----------|------|---------|-------------|
|
|
452
|
+
| `address` | `str` | required | Agent's address (0x...) |
|
|
453
|
+
| `relay_url` | `str` | production | Relay server URL |
|
|
454
|
+
|
|
455
|
+
### RemoteAgent
|
|
456
|
+
|
|
457
|
+
```python
|
|
458
|
+
class RemoteAgent:
|
|
459
|
+
# Actions
|
|
460
|
+
def input(self, prompt: str) -> Response
|
|
461
|
+
def reset(self) -> None
|
|
462
|
+
|
|
463
|
+
# State (read-only)
|
|
464
|
+
current_session: dict # Full session data
|
|
465
|
+
ui: List[UIEvent] # Shortcut to current_session['trace']
|
|
466
|
+
status: str # 'idle' | 'working' | 'waiting'
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### useAgent() (React/Vue)
|
|
470
|
+
|
|
471
|
+
```ts
|
|
472
|
+
const agent = useAgent('0x...');
|
|
473
|
+
|
|
474
|
+
agent.ui // Reactive - auto updates when data changes
|
|
475
|
+
agent.status // Reactive - 'idle' | 'working' | 'waiting'
|
|
476
|
+
agent.send() // Send message to agent
|
|
477
|
+
agent.reset() // Clear conversation
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### Data Types
|
|
481
|
+
|
|
482
|
+
```python
|
|
483
|
+
@dataclass
|
|
484
|
+
class Response:
|
|
485
|
+
text: str # Agent's response
|
|
486
|
+
done: bool # True = complete, False = needs input
|
|
487
|
+
|
|
488
|
+
# Server trace events (what server sends)
|
|
489
|
+
@dataclass
|
|
490
|
+
class ServerEvent:
|
|
491
|
+
id: str
|
|
492
|
+
type: str # 'user' | 'agent' | 'thinking' | 'tool_call' | 'tool_result' | 'ask_user'
|
|
493
|
+
|
|
494
|
+
# UI events (what client renders) - tool_result merged into tool_call
|
|
495
|
+
@dataclass
|
|
496
|
+
class UIEvent:
|
|
497
|
+
id: str
|
|
498
|
+
type: str # 'user' | 'agent' | 'thinking' | 'tool_call' | 'ask_user'
|
|
499
|
+
|
|
500
|
+
# For user/agent
|
|
501
|
+
content: Optional[str]
|
|
502
|
+
|
|
503
|
+
# For tool_call (merged from tool_call + tool_result)
|
|
504
|
+
name: Optional[str]
|
|
505
|
+
status: Optional[str] # 'running' | 'done' | 'error'
|
|
506
|
+
result: Optional[str]
|
|
507
|
+
|
|
508
|
+
# For ask_user
|
|
509
|
+
text: Optional[str]
|
|
510
|
+
options: Optional[List[str]]
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
## State Machine
|
|
516
|
+
|
|
517
|
+
```
|
|
518
|
+
input() response.done=false
|
|
519
|
+
IDLE ────────────────▶ WORKING ─────────────────────▶ WAITING
|
|
520
|
+
▲ │ │
|
|
521
|
+
│ │ response.done=true │ input()
|
|
522
|
+
│ ▼ │
|
|
523
|
+
└───────────────────────────────────────────────────────
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
---
|
|
527
|
+
|
|
528
|
+
## Common Patterns
|
|
529
|
+
|
|
530
|
+
### Conversation Loop
|
|
531
|
+
|
|
532
|
+
```python
|
|
533
|
+
agent = connect("0x...")
|
|
534
|
+
|
|
535
|
+
response = agent.input("book a flight")
|
|
536
|
+
|
|
537
|
+
while not response.done:
|
|
538
|
+
answer = input(f"{response.text}: ")
|
|
539
|
+
response = agent.input(answer)
|
|
540
|
+
|
|
541
|
+
print(f"Final: {response.text}")
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### Multiple Agents
|
|
545
|
+
|
|
546
|
+
```python
|
|
547
|
+
researcher = connect("0xaaa...")
|
|
548
|
+
writer = connect("0xbbb...")
|
|
549
|
+
|
|
550
|
+
research = researcher.input("Research AI trends").text
|
|
551
|
+
article = writer.input(f"Write about: {research}").text
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### Complete Example
|
|
555
|
+
|
|
556
|
+
**Terminal 1: Host an Agent**
|
|
557
|
+
|
|
558
|
+
```python
|
|
559
|
+
from connectonion import Agent, host
|
|
560
|
+
|
|
561
|
+
def search(query: str) -> str:
|
|
562
|
+
return f"Found results for: {query}"
|
|
563
|
+
|
|
564
|
+
def book_flight(destination: str, date: str) -> str:
|
|
565
|
+
return f"Booked flight to {destination} on {date}. Confirmation: ABC123"
|
|
566
|
+
|
|
567
|
+
agent = Agent("travel-assistant", tools=[search, book_flight])
|
|
568
|
+
host(agent)
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
**Terminal 2: Connect and Use**
|
|
572
|
+
|
|
573
|
+
```python
|
|
574
|
+
from connectonion import connect
|
|
575
|
+
|
|
576
|
+
agent = connect("0x7a8f...")
|
|
577
|
+
response = agent.input("Book me a flight to Paris")
|
|
578
|
+
|
|
579
|
+
while not response.done:
|
|
580
|
+
print(response.text)
|
|
581
|
+
answer = input("> ")
|
|
582
|
+
response = agent.input(answer)
|
|
583
|
+
|
|
584
|
+
print(f"Done: {response.text}")
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
|
|
589
|
+
## Error Handling
|
|
590
|
+
|
|
591
|
+
```python
|
|
592
|
+
from connectonion import connect, ConnectionError, TimeoutError
|
|
593
|
+
|
|
594
|
+
agent = connect("0x...")
|
|
595
|
+
response = agent.input("task")
|
|
596
|
+
# Errors raise exceptions - no try/except needed unless you want custom handling
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
## Summary
|
|
602
|
+
|
|
603
|
+
```python
|
|
604
|
+
# Python / TypeScript / Swift / Kotlin
|
|
605
|
+
agent = connect("0x...")
|
|
606
|
+
response = agent.input("task")
|
|
607
|
+
agent.ui # All events for UI rendering
|
|
608
|
+
agent.status # 'idle' | 'working' | 'waiting'
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
```tsx
|
|
612
|
+
// React / Vue (reactive)
|
|
613
|
+
const agent = useAgent('0x...');
|
|
614
|
+
agent.ui // Reactive - auto updates
|
|
615
|
+
agent.send() // Send message
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
**Server events:** `user`, `agent`, `thinking`, `tool_call`, `tool_result`, `ask_user`
|
|
619
|
+
|
|
620
|
+
**UI events:** `user`, `agent`, `thinking`, `tool_call`, `ask_user` (tool_result merged into tool_call)
|
|
621
|
+
|
|
622
|
+
**One UI type = one component.** That's it.
|
|
623
|
+
|
|
624
|
+
---
|
|
625
|
+
|
|
626
|
+
## Learn More
|
|
627
|
+
|
|
628
|
+
- **[host.md](host.md)** - Host agents for remote access
|
|
629
|
+
- **[io.md](io.md)** - IO interface for real-time communication
|