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,495 @@
|
|
|
1
|
+
# Agent-Relay Connection Protocol
|
|
2
|
+
|
|
3
|
+
This document specifies the WebSocket-based protocol for agent registration, discovery, and connection establishment.
|
|
4
|
+
|
|
5
|
+
## Developer Experience
|
|
6
|
+
|
|
7
|
+
**Developers only need one thing: the agent's address**
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
from connectonion import connect
|
|
11
|
+
|
|
12
|
+
# Connect to any agent using just their address
|
|
13
|
+
translator = connect("0x3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c")
|
|
14
|
+
result = translator.input("Translate 'Hello world' to Spanish")
|
|
15
|
+
# Returns: "Hola mundo"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**What happens behind the scenes:**
|
|
19
|
+
|
|
20
|
+
1. **Query Relay**: Gets agent's endpoints and network info
|
|
21
|
+
2. **Smart Connection**: Tries local network → public IP → relay
|
|
22
|
+
3. **Automatic Optimization**: Uses fastest available path
|
|
23
|
+
4. **Transparent Failover**: Switches to relay if direct fails
|
|
24
|
+
5. **Simple Interface**: Returns agent ready to use
|
|
25
|
+
|
|
26
|
+
The framework handles everything automatically:
|
|
27
|
+
- Discovery via relay (like DNS lookup)
|
|
28
|
+
- Direct connection establishment (like WebRTC)
|
|
29
|
+
- Protocol selection (TCP when possible, relay when needed)
|
|
30
|
+
- Automatic failover (seamless switching)
|
|
31
|
+
- Reconnection on failure (self-healing)
|
|
32
|
+
|
|
33
|
+
## Overview
|
|
34
|
+
|
|
35
|
+
The relay server (`oo.openonion.ai`) acts as a directory service where agents:
|
|
36
|
+
1. Register their presence via WebSocket
|
|
37
|
+
2. Discover other agents
|
|
38
|
+
3. Exchange connection information for direct communication
|
|
39
|
+
|
|
40
|
+
## Connection Lifecycle
|
|
41
|
+
|
|
42
|
+
### 1. Establishing Connection
|
|
43
|
+
|
|
44
|
+
The relay provides two WebSocket endpoints by function:
|
|
45
|
+
|
|
46
|
+
- **`wss://oo.openonion.ai/announce`** - Agents announce their presence here
|
|
47
|
+
- **`wss://oo.openonion.ai/lookup`** - Clients look up agent info here
|
|
48
|
+
|
|
49
|
+
### 2. Agent Registration via `/announce`
|
|
50
|
+
|
|
51
|
+
Agents connect to the announce endpoint and stay connected:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"type": "ANNOUNCE",
|
|
56
|
+
"address": "0x3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c",
|
|
57
|
+
"timestamp": 1234567890,
|
|
58
|
+
"summary": "I translate text between 100+ languages",
|
|
59
|
+
"endpoints": [
|
|
60
|
+
"tcp://192.168.1.100:8001",
|
|
61
|
+
"tcp://73.42.18.9:8001"
|
|
62
|
+
],
|
|
63
|
+
"signature": "0xabc123..."
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 3. Heartbeat & Keep-Alive
|
|
68
|
+
|
|
69
|
+
**WebSocket PING/PONG:**
|
|
70
|
+
- Server sends PING every 30 seconds
|
|
71
|
+
- Agent must respond with PONG
|
|
72
|
+
- Missing 2 PONGs = connection assumed dead
|
|
73
|
+
|
|
74
|
+
**ANNOUNCE Refresh:**
|
|
75
|
+
- Agent sends ANNOUNCE every 60 seconds
|
|
76
|
+
- Updates capability/endpoint information
|
|
77
|
+
- Confirms agent is still active
|
|
78
|
+
|
|
79
|
+
### 4. Disconnection
|
|
80
|
+
|
|
81
|
+
When WebSocket closes:
|
|
82
|
+
- Agent removed from active registry
|
|
83
|
+
- No longer discoverable
|
|
84
|
+
- All associated data cleared from memory
|
|
85
|
+
|
|
86
|
+
## Message Types
|
|
87
|
+
|
|
88
|
+
### ANNOUNCE (Agent → Relay)
|
|
89
|
+
|
|
90
|
+
Registers or updates agent information.
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"type": "ANNOUNCE",
|
|
95
|
+
"address": "0x...",
|
|
96
|
+
"timestamp": 1234567890,
|
|
97
|
+
"summary": "Natural language description of capabilities",
|
|
98
|
+
"endpoints": ["tcp://ip:port", ...],
|
|
99
|
+
"signature": "0x..."
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Relay Processing:**
|
|
104
|
+
1. Verify signature
|
|
105
|
+
2. Store/update in memory
|
|
106
|
+
3. Associate with WebSocket connection
|
|
107
|
+
4. No response sent (success assumed)
|
|
108
|
+
|
|
109
|
+
### FIND (Client → Relay via `/lookup`)
|
|
110
|
+
|
|
111
|
+
Query for agents with specific capabilities.
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"type": "FIND",
|
|
116
|
+
"query": "translate text to spanish",
|
|
117
|
+
"from": "0xRequesterAddress...",
|
|
118
|
+
"timestamp": 1234567890
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Relay Response:**
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"type": "AGENTS",
|
|
127
|
+
"query": "translate text to spanish",
|
|
128
|
+
"agents": [
|
|
129
|
+
{
|
|
130
|
+
"address": "0xAgentAddress...",
|
|
131
|
+
"summary": "I translate text between languages",
|
|
132
|
+
"endpoints": [
|
|
133
|
+
"tcp://192.168.1.100:8001",
|
|
134
|
+
"tcp://73.42.18.9:8001"
|
|
135
|
+
],
|
|
136
|
+
"last_seen": 1234567880
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"timestamp": 1234567890
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### GET_AGENT (Client → Relay via `/lookup`)
|
|
144
|
+
|
|
145
|
+
Query specific agent by address.
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"type": "GET_AGENT",
|
|
150
|
+
"address": "0xTargetAgent...",
|
|
151
|
+
"from": "0xRequesterAddress...",
|
|
152
|
+
"timestamp": 1234567890
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Relay Response:**
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"type": "AGENT_INFO",
|
|
161
|
+
"agent": {
|
|
162
|
+
"address": "0xTargetAgent...",
|
|
163
|
+
"summary": "I translate text",
|
|
164
|
+
"endpoints": ["tcp://192.168.1.100:8001"],
|
|
165
|
+
"last_seen": 1234567880,
|
|
166
|
+
"online": true
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**If agent not found:**
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"type": "AGENT_INFO",
|
|
176
|
+
"agent": null,
|
|
177
|
+
"error": "Agent not found or offline"
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### ERROR (Relay → Agent)
|
|
182
|
+
|
|
183
|
+
Sent when relay cannot process a message.
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"type": "ERROR",
|
|
188
|
+
"error": "Invalid signature",
|
|
189
|
+
"original_type": "ANNOUNCE",
|
|
190
|
+
"timestamp": 1234567890
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Connection Establishment Flow
|
|
195
|
+
|
|
196
|
+
### Complete `connect()` Flow
|
|
197
|
+
|
|
198
|
+
When a developer calls `connect("0x3d40...")`, the following sequence happens:
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
Client Relay Target Agent
|
|
202
|
+
| | |
|
|
203
|
+
|-- Connect to /lookup -->| |
|
|
204
|
+
| | |
|
|
205
|
+
|-- GET_AGENT request -->| |
|
|
206
|
+
| (address: 0x3d40...) | |
|
|
207
|
+
| | |
|
|
208
|
+
|<-- AGENT_INFO ---------| |
|
|
209
|
+
| (endpoints, NAT type) | |
|
|
210
|
+
| | |
|
|
211
|
+
|-- Disconnect ---------->| |
|
|
212
|
+
| | |
|
|
213
|
+
|-- Try Direct TCP ---------------------------------->|
|
|
214
|
+
| (using endpoints) | |
|
|
215
|
+
| | |
|
|
216
|
+
| If direct fails: | |
|
|
217
|
+
|-- Connect to relay ---->| |
|
|
218
|
+
|-- RELAY_TO_AGENT ------>|-- Forward to agent ------->|
|
|
219
|
+
| |<-- Response from agent ----|
|
|
220
|
+
|<-- Forward response ----| |
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Step 1: Query Agent Information
|
|
224
|
+
|
|
225
|
+
The client first connects to `/lookup` to get the target agent's connection details:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
Client → Relay (via /lookup): GET_AGENT
|
|
229
|
+
{
|
|
230
|
+
"type": "GET_AGENT",
|
|
231
|
+
"address": "0x3d40..."
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
Relay → Client: AGENT_INFO
|
|
235
|
+
{
|
|
236
|
+
"type": "AGENT_INFO",
|
|
237
|
+
"agent": {
|
|
238
|
+
"address": "0x3d40...",
|
|
239
|
+
"endpoints": [
|
|
240
|
+
"tcp://192.168.1.100:8001", # Local network
|
|
241
|
+
"tcp://73.42.18.9:8001" # Public IP
|
|
242
|
+
],
|
|
243
|
+
"nat_type": "restricted", # For NAT traversal
|
|
244
|
+
"wifi_ssid": "HomeNetwork", # For local network detection
|
|
245
|
+
"online": true
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
Client → Relay: Disconnect from /lookup
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Step 2: Connection Priority Strategy
|
|
253
|
+
|
|
254
|
+
The client attempts connections in order of likelihood and speed:
|
|
255
|
+
|
|
256
|
+
1. **Local Network First** (fastest, if on same WiFi)
|
|
257
|
+
- Check if wifi_ssid matches
|
|
258
|
+
- Try local IP endpoints (192.168.x.x, 10.x.x.x)
|
|
259
|
+
|
|
260
|
+
2. **Public IP Direct** (if NAT allows)
|
|
261
|
+
- Try public IP endpoints
|
|
262
|
+
- Success depends on NAT type
|
|
263
|
+
|
|
264
|
+
3. **NAT Traversal** (if both behind NAT)
|
|
265
|
+
- Use STUN-like coordination through relay
|
|
266
|
+
- Simultaneous connection attempts
|
|
267
|
+
|
|
268
|
+
4. **Relay Fallback** (always works)
|
|
269
|
+
- Route all messages through relay
|
|
270
|
+
- Higher latency but guaranteed delivery
|
|
271
|
+
|
|
272
|
+
### Step 3: Direct Connection Attempt
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
Client Agent B
|
|
276
|
+
| |
|
|
277
|
+
|-- TCP Connect to 192.168.1.100:8001 ------------->|
|
|
278
|
+
|<-- TCP Accept -------------------------------------|
|
|
279
|
+
| |
|
|
280
|
+
|-- Direct TASK Message ---------------------------->|
|
|
281
|
+
|<-- Direct TASK Response ---------------------------|
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Step 4: Fallback to Relay (if direct fails)
|
|
285
|
+
|
|
286
|
+
```
|
|
287
|
+
Client Relay Agent B
|
|
288
|
+
| | |
|
|
289
|
+
|-- RELAY_TO_AGENT ------>| |
|
|
290
|
+
| to: "0x3d40..." | |
|
|
291
|
+
| payload: {...} |-- Forward to Agent ----->|
|
|
292
|
+
| |<-- Response -------------|
|
|
293
|
+
|<-- Forward Response ----| |
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## NAT Traversal Strategies
|
|
297
|
+
|
|
298
|
+
### NAT Type Detection
|
|
299
|
+
|
|
300
|
+
The relay helps detect NAT types during ANNOUNCE:
|
|
301
|
+
|
|
302
|
+
| NAT Type | Can Receive Connections | Strategy |
|
|
303
|
+
|----------|------------------------|----------|
|
|
304
|
+
| **No NAT / Full Cone** | Yes, from anyone | Direct connection works |
|
|
305
|
+
| **Restricted Cone** | Only from contacted IPs | Coordination required |
|
|
306
|
+
| **Port Restricted** | Only from contacted IP:port | Precise coordination |
|
|
307
|
+
| **Symmetric** | Different port for each destination | Usually requires relay |
|
|
308
|
+
|
|
309
|
+
### Connection Strategies by NAT Combination
|
|
310
|
+
|
|
311
|
+
#### Both on Same Local Network
|
|
312
|
+
- **Strategy**: Direct local IP connection
|
|
313
|
+
- **Detection**: Same wifi_ssid or subnet
|
|
314
|
+
- **Success Rate**: ~100%
|
|
315
|
+
|
|
316
|
+
#### One or Both Have Public IP (No NAT)
|
|
317
|
+
- **Strategy**: Direct TCP connection
|
|
318
|
+
- **Detection**: Public endpoint accessible
|
|
319
|
+
- **Success Rate**: ~100%
|
|
320
|
+
|
|
321
|
+
#### Both Behind NAT (Same Type)
|
|
322
|
+
- **Strategy**: STUN-like hole punching
|
|
323
|
+
- **Process**:
|
|
324
|
+
1. Both agents contact relay
|
|
325
|
+
2. Relay coordinates simultaneous connection
|
|
326
|
+
3. Both attempt connection at same time
|
|
327
|
+
- **Success Rate**: ~70% for cone NATs
|
|
328
|
+
|
|
329
|
+
#### Symmetric NAT Involved
|
|
330
|
+
- **Strategy**: Relay required
|
|
331
|
+
- **Reason**: Port prediction impossible
|
|
332
|
+
- **Success Rate**: 100% via relay
|
|
333
|
+
|
|
334
|
+
### Smart Endpoint Selection
|
|
335
|
+
|
|
336
|
+
The client prioritizes endpoints based on network analysis:
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
Priority Order:
|
|
340
|
+
1. localhost (same machine) - 0ms latency
|
|
341
|
+
2. Local network (same WiFi) - 1-5ms latency
|
|
342
|
+
3. Direct public IP - 10-50ms latency
|
|
343
|
+
4. NAT traversal - 20-100ms latency
|
|
344
|
+
5. Relay fallback - 50-200ms latency
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Relay Server Behavior
|
|
348
|
+
|
|
349
|
+
### Memory Storage
|
|
350
|
+
|
|
351
|
+
The relay maintains in-memory registry:
|
|
352
|
+
|
|
353
|
+
```python
|
|
354
|
+
agents = {
|
|
355
|
+
"0xAgentAddress...": {
|
|
356
|
+
"summary": "...",
|
|
357
|
+
"endpoints": [...],
|
|
358
|
+
"websocket": <WebSocket object>,
|
|
359
|
+
"last_announce": timestamp,
|
|
360
|
+
"last_ping": timestamp
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Cleanup Policy
|
|
366
|
+
|
|
367
|
+
Agents are removed when:
|
|
368
|
+
1. WebSocket disconnects
|
|
369
|
+
2. No PONG received for 60 seconds
|
|
370
|
+
3. No ANNOUNCE received for 120 seconds
|
|
371
|
+
|
|
372
|
+
### Discovery Matching
|
|
373
|
+
|
|
374
|
+
For FIND queries, relay:
|
|
375
|
+
1. Performs semantic similarity on summaries
|
|
376
|
+
2. Returns top 10 matches
|
|
377
|
+
3. Prioritizes recently active agents
|
|
378
|
+
|
|
379
|
+
## Security Considerations
|
|
380
|
+
|
|
381
|
+
### Signature Verification
|
|
382
|
+
|
|
383
|
+
All ANNOUNCE messages must be signed:
|
|
384
|
+
1. Remove signature field from message
|
|
385
|
+
2. Serialize remaining fields (deterministic JSON)
|
|
386
|
+
3. Verify Ed25519 signature matches public key (address)
|
|
387
|
+
|
|
388
|
+
### Rate Limiting
|
|
389
|
+
|
|
390
|
+
- ANNOUNCE: Max 1 per 10 seconds per agent
|
|
391
|
+
- FIND: Max 10 per minute per agent
|
|
392
|
+
- GET_AGENT: Max 100 per minute per agent
|
|
393
|
+
|
|
394
|
+
### Privacy
|
|
395
|
+
|
|
396
|
+
- Relay only stores minimal information
|
|
397
|
+
- No message content is logged
|
|
398
|
+
- Endpoints can be omitted for privacy
|
|
399
|
+
|
|
400
|
+
## Implementation Notes
|
|
401
|
+
|
|
402
|
+
### WebSocket Configuration
|
|
403
|
+
|
|
404
|
+
- Heartbeat interval: 30 seconds
|
|
405
|
+
- Message size limit: 64KB
|
|
406
|
+
- Connection timeout: 120 seconds
|
|
407
|
+
- Automatic reconnection with exponential backoff
|
|
408
|
+
|
|
409
|
+
### Recommended Client Behavior
|
|
410
|
+
|
|
411
|
+
1. Connect to relay on startup
|
|
412
|
+
2. Send ANNOUNCE immediately
|
|
413
|
+
3. Send ANNOUNCE every 60 seconds
|
|
414
|
+
4. Respond to PINGs promptly
|
|
415
|
+
5. Implement reconnection logic
|
|
416
|
+
6. Cache discovered agents locally
|
|
417
|
+
|
|
418
|
+
### Direct Connection Strategy
|
|
419
|
+
|
|
420
|
+
When connecting to another agent:
|
|
421
|
+
1. Try local IPs first (same network)
|
|
422
|
+
2. Try public IP (if available)
|
|
423
|
+
3. Fall back to relay-forwarded messages
|
|
424
|
+
4. Cache successful routes
|
|
425
|
+
|
|
426
|
+
## Example Implementation
|
|
427
|
+
|
|
428
|
+
### Agent Connection to `/announce`
|
|
429
|
+
|
|
430
|
+
```python
|
|
431
|
+
async def connect_to_relay():
|
|
432
|
+
ws = await websocket.connect("wss://oo.openonion.ai/announce")
|
|
433
|
+
|
|
434
|
+
# Send initial ANNOUNCE
|
|
435
|
+
await ws.send(json.dumps({
|
|
436
|
+
"type": "ANNOUNCE",
|
|
437
|
+
"address": my_address,
|
|
438
|
+
"summary": my_summary,
|
|
439
|
+
"endpoints": gather_endpoints(),
|
|
440
|
+
"timestamp": int(time.time()),
|
|
441
|
+
"signature": sign_message(...)
|
|
442
|
+
}))
|
|
443
|
+
|
|
444
|
+
# Start announce loop
|
|
445
|
+
asyncio.create_task(announce_loop(ws))
|
|
446
|
+
|
|
447
|
+
# Handle messages
|
|
448
|
+
async for message in ws:
|
|
449
|
+
await handle_relay_message(json.loads(message))
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Using Remote Agents
|
|
453
|
+
|
|
454
|
+
```python
|
|
455
|
+
# Simple usage with connect()
|
|
456
|
+
from connectonion import connect
|
|
457
|
+
|
|
458
|
+
async def use_translator():
|
|
459
|
+
# Connect to remote agent
|
|
460
|
+
translator = connect("0x3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c")
|
|
461
|
+
|
|
462
|
+
# Use it naturally
|
|
463
|
+
result = translator.input("Translate 'Hello world' to Spanish")
|
|
464
|
+
return result
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Finding Agents by Capability
|
|
468
|
+
|
|
469
|
+
```python
|
|
470
|
+
async def find_agent(capability):
|
|
471
|
+
# Connect to lookup endpoint
|
|
472
|
+
ws = await websocket.connect("wss://oo.openonion.ai/lookup")
|
|
473
|
+
|
|
474
|
+
await ws.send(json.dumps({
|
|
475
|
+
"type": "FIND",
|
|
476
|
+
"query": capability,
|
|
477
|
+
"from": my_address,
|
|
478
|
+
"timestamp": int(time.time())
|
|
479
|
+
}))
|
|
480
|
+
|
|
481
|
+
response = await wait_for_response("AGENTS")
|
|
482
|
+
await ws.close() # Disconnect after getting response
|
|
483
|
+
return response["agents"]
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
## Summary
|
|
487
|
+
|
|
488
|
+
This protocol provides:
|
|
489
|
+
- Simple agent registration via WebSocket
|
|
490
|
+
- Efficient in-memory discovery
|
|
491
|
+
- Direct agent-to-agent connections
|
|
492
|
+
- Minimal relay involvement in actual communication
|
|
493
|
+
- Automatic cleanup of inactive agents
|
|
494
|
+
|
|
495
|
+
The relay acts purely as a directory service, enabling agents to find and connect to each other directly whenever possible.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# ANNOUNCE Message Specification
|
|
2
|
+
|
|
3
|
+
The ANNOUNCE message broadcasts agent presence and connectivity information to the network.
|
|
4
|
+
|
|
5
|
+
## Message Structure
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"type": "ANNOUNCE",
|
|
10
|
+
"address": "0x3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c",
|
|
11
|
+
"timestamp": 1234567890,
|
|
12
|
+
"summary": "I translate text between 100+ languages with cultural context",
|
|
13
|
+
"endpoints": [
|
|
14
|
+
"tcp://192.168.1.100:8001",
|
|
15
|
+
"tcp://73.42.18.9:8001",
|
|
16
|
+
"relay://relay.connectonion.io"
|
|
17
|
+
],
|
|
18
|
+
"signature": "0xabc123..."
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Field Definitions
|
|
23
|
+
|
|
24
|
+
| Field | Type | Required | Description |
|
|
25
|
+
|-------|------|----------|-------------|
|
|
26
|
+
| `type` | string | Yes | Always "ANNOUNCE" |
|
|
27
|
+
| `address` | string | Yes | Agent's public address (0x + hex encoded Ed25519 public key) |
|
|
28
|
+
| `timestamp` | number | Yes | Unix timestamp to prevent replay attacks |
|
|
29
|
+
| `summary` | string | Yes | Natural language description of agent capabilities |
|
|
30
|
+
| `endpoints` | array | Yes | Connection endpoints in priority order |
|
|
31
|
+
| `signature` | string | Yes | Ed25519 signature of all fields |
|
|
32
|
+
|
|
33
|
+
## Endpoints Format
|
|
34
|
+
|
|
35
|
+
Endpoints use URI scheme for self-documentation:
|
|
36
|
+
|
|
37
|
+
- `tcp://192.168.1.100:8001` - Local network direct connection
|
|
38
|
+
- `tcp://73.42.18.9:8001` - Public IP direct connection
|
|
39
|
+
- `relay://relay.connectonion.io` - WebSocket relay (always works)
|
|
40
|
+
|
|
41
|
+
Order matters - first endpoint is preferred, last is fallback.
|
|
42
|
+
|
|
43
|
+
## Minimal Valid Example
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"type": "ANNOUNCE",
|
|
48
|
+
"address": "0x3d40...",
|
|
49
|
+
"timestamp": 1234567890,
|
|
50
|
+
"summary": "",
|
|
51
|
+
"endpoints": [
|
|
52
|
+
"tcp://127.0.0.1:8001",
|
|
53
|
+
"relay://relay.connectonion.io"
|
|
54
|
+
],
|
|
55
|
+
"signature": "0x..."
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Optional Fields
|
|
60
|
+
|
|
61
|
+
Additional fields can be added at root level when needed:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"type": "ANNOUNCE",
|
|
66
|
+
"address": "0x3d40...",
|
|
67
|
+
"timestamp": 1234567890,
|
|
68
|
+
"summary": "I translate text",
|
|
69
|
+
"endpoints": [...],
|
|
70
|
+
|
|
71
|
+
"nat_type": "restricted", // For NAT traversal
|
|
72
|
+
"wifi_ssid": "HomeNetwork", // For local discovery
|
|
73
|
+
"tools": ["translate"], // For detailed matching
|
|
74
|
+
|
|
75
|
+
"signature": "..."
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## When to Send
|
|
80
|
+
|
|
81
|
+
1. Agent starts up
|
|
82
|
+
2. Every 60 seconds while running
|
|
83
|
+
3. When capabilities change
|
|
84
|
+
4. Before shutting down (optional)
|
|
85
|
+
|
|
86
|
+
## Size Considerations
|
|
87
|
+
|
|
88
|
+
- Typical size: ~400 bytes
|
|
89
|
+
- Maximum recommended: 1KB
|
|
90
|
+
- Network overhead: 400KB/min for 1000 agents
|
|
91
|
+
|
|
92
|
+
## Signature Generation
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
# 1. Remove signature field
|
|
96
|
+
message_dict = {k: v for k, v in announce.items() if k != "signature"}
|
|
97
|
+
|
|
98
|
+
# 2. Serialize deterministically
|
|
99
|
+
message_bytes = json.dumps(message_dict, sort_keys=True).encode()
|
|
100
|
+
|
|
101
|
+
# 3. Sign with Ed25519 private key
|
|
102
|
+
signature = signing_key.sign(message_bytes).signature.hex()
|
|
103
|
+
|
|
104
|
+
# 4. Add signature to message
|
|
105
|
+
announce["signature"] = "0x" + signature
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Design Rationale
|
|
109
|
+
|
|
110
|
+
- **No status field**: Being online is implied by sending ANNOUNCE
|
|
111
|
+
- **No sequence number**: Timestamp provides ordering and replay prevention
|
|
112
|
+
- **Address not pubkey**: Clarifies it's used for routing, not just identity
|
|
113
|
+
- **Summary not capabilities**: Natural language from system prompt is more flexible
|
|
114
|
+
|
|
115
|
+
This minimal design keeps messages small while providing everything needed for discovery and connection.
|