connectonion 0.6.2__py3-none-any.whl → 0.6.4__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 +13 -3
- connectonion/cli/browser_agent/element_finder.py +8 -0
- connectonion/cli/browser_agent/highlight_screenshot.py +9 -1
- connectonion/cli/browser_agent/scroll.py +8 -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 +5 -0
- connectonion/cli/co_ai/plugins/system_reminder.py +154 -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/summarization.md +55 -0
- connectonion/cli/co_ai/prompts/system-reminders/agent.md +23 -0
- connectonion/cli/co_ai/prompts/system-reminders/plan_mode.md +13 -0
- connectonion/cli/co_ai/prompts/system-reminders/security.md +14 -0
- connectonion/cli/co_ai/prompts/system-reminders/simplicity.md +14 -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/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 +169 -0
- connectonion/cli/co_ai/tools/read.py +61 -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 +101 -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_plugins/tool_approval.md +139 -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 +3 -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/tool_approval.py +233 -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.2.dist-info → connectonion-0.6.4.dist-info}/METADATA +10 -3
- connectonion-0.6.4.dist-info/RECORD +472 -0
- connectonion/network/asgi.py +0 -407
- connectonion/network/host.py +0 -616
- connectonion/network/trust.py +0 -166
- connectonion-0.6.2.dist-info/RECORD +0 -129
- /connectonion/cli/{docs → co_ai/prompts/connectonion}/connectonion.md +0 -0
- {connectonion-0.6.2.dist-info → connectonion-0.6.4.dist-info}/WHEEL +0 -0
- {connectonion-0.6.2.dist-info → connectonion-0.6.4.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Purpose: Persistent session storage for hosted agent requests with TTL expiry
|
|
3
|
+
LLM-Note:
|
|
4
|
+
Dependencies: imports from [pydantic.BaseModel, pathlib, json, time] | imported by [network/host/routes.py, network/host/server.py] | tested by [tests/network/test_session_storage.py]
|
|
5
|
+
Data flow: save(session) appends Session to JSONL file (.co/session_results.jsonl) → get(session_id) reads file backwards → returns latest matching session if not expired → list() loads all sessions → filters expired ones → sorts by created desc
|
|
6
|
+
State/Effects: writes to .co/session_results.jsonl (append-only) | creates .co/ directory | auto-expires sessions based on expires timestamp | last entry wins (duplicates overridden by latest)
|
|
7
|
+
Integration: exposes Session(session_id, status, prompt, result, created, expires, duration_ms) Pydantic model | SessionStorage(path) with .save(session), .get(session_id) → Session|None, .list() → list[Session] | used by routes to persist and retrieve agent execution results
|
|
8
|
+
Performance: append-only writes (fast) | linear scan on read (acceptable for thousands of sessions) | file-based (simple, no DB required) | TTL filtering prevents unbounded growth
|
|
9
|
+
Errors: returns None if session not found or expired | creates parent directory if missing | no exceptions raised
|
|
10
|
+
Session storage for hosted agents.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
import time
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from typing import Optional
|
|
17
|
+
|
|
18
|
+
from pydantic import BaseModel
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Session(BaseModel):
|
|
22
|
+
"""Session record for tracking agent requests.
|
|
23
|
+
|
|
24
|
+
Uses Pydantic BaseModel for:
|
|
25
|
+
- Native JSON serialization via .model_dump()
|
|
26
|
+
- Type validation
|
|
27
|
+
- API response compatibility
|
|
28
|
+
"""
|
|
29
|
+
session_id: str
|
|
30
|
+
status: str
|
|
31
|
+
prompt: str
|
|
32
|
+
result: Optional[str] = None
|
|
33
|
+
created: Optional[float] = None
|
|
34
|
+
expires: Optional[float] = None
|
|
35
|
+
duration_ms: Optional[int] = None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class SessionStorage:
|
|
39
|
+
"""JSONL file storage. Append-only, last entry wins."""
|
|
40
|
+
|
|
41
|
+
def __init__(self, path: str = ".co/session_results.jsonl"):
|
|
42
|
+
self.path = Path(path)
|
|
43
|
+
self.path.parent.mkdir(exist_ok=True)
|
|
44
|
+
|
|
45
|
+
def save(self, session: Session):
|
|
46
|
+
with open(self.path, "a") as f:
|
|
47
|
+
f.write(session.model_dump_json() + "\n")
|
|
48
|
+
|
|
49
|
+
def get(self, session_id: str) -> Session | None:
|
|
50
|
+
if not self.path.exists():
|
|
51
|
+
return None
|
|
52
|
+
now = time.time()
|
|
53
|
+
with open(self.path) as f:
|
|
54
|
+
lines = f.readlines()
|
|
55
|
+
for line in reversed(lines):
|
|
56
|
+
data = json.loads(line)
|
|
57
|
+
if data["session_id"] == session_id:
|
|
58
|
+
session = Session(**data)
|
|
59
|
+
# Return if running or not expired
|
|
60
|
+
if session.status == "running" or not session.expires or session.expires > now:
|
|
61
|
+
return session
|
|
62
|
+
return None # Expired
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
def list(self) -> list[Session]:
|
|
66
|
+
if not self.path.exists():
|
|
67
|
+
return []
|
|
68
|
+
sessions = {}
|
|
69
|
+
now = time.time()
|
|
70
|
+
with open(self.path) as f:
|
|
71
|
+
for line in f:
|
|
72
|
+
data = json.loads(line)
|
|
73
|
+
sessions[data["session_id"]] = Session(**data)
|
|
74
|
+
# Filter out expired non-running sessions
|
|
75
|
+
valid = [s for s in sessions.values()
|
|
76
|
+
if s.status == "running" or not s.expires or s.expires > now]
|
|
77
|
+
# Sort by created desc (newest first)
|
|
78
|
+
return sorted(valid, key=lambda s: s.created or 0, reverse=True)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Purpose: IO module re-exporting base IO protocol and WebSocket implementation
|
|
3
|
+
LLM-Note:
|
|
4
|
+
Dependencies: imports from [base.py, websocket.py] | imported by [network/__init__.py, agent.py, network/asgi/websocket.py] | tested by [tests/network/test_io.py]
|
|
5
|
+
Data flow: re-exports IO abstract class and WebSocketIO concrete implementation
|
|
6
|
+
State/Effects: no state
|
|
7
|
+
Integration: exposes IO(ABC) protocol with send(event), receive() → dict, log(type, **data), request_approval(tool, args) → bool | WebSocketIO uses queue-based async-to-sync bridge for agent.io attribute
|
|
8
|
+
Performance: trivial
|
|
9
|
+
Errors: none
|
|
10
|
+
IO module for agent-client communication.
|
|
11
|
+
|
|
12
|
+
Provides the IO interface and WebSocket implementation.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from .base import IO
|
|
16
|
+
from .websocket import WebSocketIO
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"IO",
|
|
20
|
+
"WebSocketIO",
|
|
21
|
+
]
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Purpose:
|
|
2
|
+
Purpose: Abstract IO interface for bidirectional agent-client communication in hosted agents
|
|
3
3
|
LLM-Note:
|
|
4
|
-
Dependencies: imports from [abc, typing] | imported by [
|
|
5
|
-
Data flow: receives
|
|
6
|
-
State/Effects:
|
|
7
|
-
Integration: exposes
|
|
8
|
-
Performance:
|
|
9
|
-
Errors:
|
|
4
|
+
Dependencies: imports from [abc.ABC, typing] | imported by [network/io/websocket.py, network/__init__.py, agent.py] | tested by [tests/network/test_io.py]
|
|
5
|
+
Data flow: agent.io.send(event) → client receives event → agent.io.receive() → blocks until client responds | high-level: io.log(type, **data) for one-way notifications | io.request_approval(tool, args) sends approval_needed → waits for client response → returns True/False
|
|
6
|
+
State/Effects: no state (abstract base class) | implementations handle message queuing/transport
|
|
7
|
+
Integration: exposes IO abstract class with send(event), receive() → dict primitives | convenience methods: log(type, **data), request_approval(tool, args) → bool | agent.io injected by host() for hosted execution | used in event handlers (@after_llm, @before_each_tool)
|
|
8
|
+
Performance: abstract (implementation-specific) | WebSocketIO uses queue.Queue for thread-safe communication
|
|
9
|
+
Errors: abstract methods must be implemented by subclasses | request_approval() blocks until response (timeout handled by implementation)
|
|
10
|
+
IO interface for agent-client communication during hosted execution.
|
|
10
11
|
"""
|
|
11
12
|
|
|
12
13
|
from abc import ABC, abstractmethod
|
|
13
14
|
from typing import Any, Dict
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
class
|
|
17
|
-
"""Base
|
|
17
|
+
class IO(ABC):
|
|
18
|
+
"""Base IO interface for agent-client communication.
|
|
18
19
|
|
|
19
20
|
Two-layer API:
|
|
20
21
|
- Low-level: send(event), receive() - primitives for any communication
|
|
@@ -23,15 +24,15 @@ class Connection(ABC):
|
|
|
23
24
|
Usage in event handlers:
|
|
24
25
|
@after_llm
|
|
25
26
|
def on_thinking(agent):
|
|
26
|
-
if agent.
|
|
27
|
-
agent.
|
|
27
|
+
if agent.io:
|
|
28
|
+
agent.io.log("thinking")
|
|
28
29
|
|
|
29
30
|
@before_each_tool
|
|
30
31
|
def on_tool(agent):
|
|
31
|
-
if agent.
|
|
32
|
+
if agent.io:
|
|
32
33
|
tool = agent.current_session['pending_tool']
|
|
33
34
|
if tool['name'] in DANGEROUS:
|
|
34
|
-
if not agent.
|
|
35
|
+
if not agent.io.request_approval(tool['name'], tool['arguments']):
|
|
35
36
|
raise ToolRejected()
|
|
36
37
|
"""
|
|
37
38
|
|
|
@@ -71,8 +72,8 @@ class Connection(ABC):
|
|
|
71
72
|
**data: Additional data for the event
|
|
72
73
|
|
|
73
74
|
Example:
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
io.log("thinking")
|
|
76
|
+
io.log("tool_call", name="search", arguments={"q": "python"})
|
|
76
77
|
"""
|
|
77
78
|
self.send({"type": event_type, **data})
|
|
78
79
|
|
|
@@ -89,35 +90,9 @@ class Connection(ABC):
|
|
|
89
90
|
True if approved, False if rejected
|
|
90
91
|
|
|
91
92
|
Example:
|
|
92
|
-
if not
|
|
93
|
+
if not io.request_approval("delete_file", {"path": "/tmp/x"}):
|
|
93
94
|
raise ToolRejected()
|
|
94
95
|
"""
|
|
95
96
|
self.send({"type": "approval_needed", "tool": tool, "arguments": arguments})
|
|
96
97
|
response = self.receive()
|
|
97
98
|
return response.get("approved", False)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
class SyncWebSocketConnection(Connection):
|
|
101
|
-
"""Synchronous WebSocket connection adapter.
|
|
102
|
-
|
|
103
|
-
Wraps async WebSocket send/receive for use in synchronous agent code.
|
|
104
|
-
Uses threading events to bridge async/sync boundary.
|
|
105
|
-
"""
|
|
106
|
-
|
|
107
|
-
def __init__(self, send_callback, receive_callback):
|
|
108
|
-
"""Initialize with send/receive callbacks.
|
|
109
|
-
|
|
110
|
-
Args:
|
|
111
|
-
send_callback: Callable that sends message to WebSocket
|
|
112
|
-
receive_callback: Callable that receives message from WebSocket
|
|
113
|
-
"""
|
|
114
|
-
self._send = send_callback
|
|
115
|
-
self._receive = receive_callback
|
|
116
|
-
|
|
117
|
-
def send(self, event: Dict[str, Any]) -> None:
|
|
118
|
-
"""Send event to client via WebSocket."""
|
|
119
|
-
self._send(event)
|
|
120
|
-
|
|
121
|
-
def receive(self) -> Dict[str, Any]:
|
|
122
|
-
"""Receive response from client via WebSocket."""
|
|
123
|
-
return self._receive()
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Purpose: WebSocket IO implementation bridging async WebSocket to sync agent code via queues
|
|
3
|
+
LLM-Note:
|
|
4
|
+
Dependencies: imports from [network/io/base.py IO, queue, time, uuid, typing] | imported by [network/asgi/websocket.py, network/host/server.py] | tested by [tests/network/test_websocket_io.py]
|
|
5
|
+
Data flow: agent calls io.send(event) → auto-adds id (UUID) and ts if missing → puts in _outgoing queue → async handler gets via queue.get() → sends via WebSocket | client sends message → async handler puts in _incoming queue → agent blocks on io.receive() → gets from _incoming | close() unblocks waiting receive() with io_closed event
|
|
6
|
+
State/Effects: maintains _outgoing and _incoming queues (thread-safe) | _closed flag prevents sending after close | receive() blocks until message available | auto-generates UUID for events without id (for frontend React keys)
|
|
7
|
+
Integration: exposes WebSocketIO() implementing IO interface | send(event) queues outgoing message with auto-id, receive() → dict blocks for incoming message, close() marks closed | used by handle_websocket() to provide agent.io for bidirectional communication
|
|
8
|
+
Performance: queue-based (thread-safe, no locks needed) | blocking receive() (use in agent thread) | async handler pumps messages between WebSocket and queues
|
|
9
|
+
Errors: closed IO puts io_closed sentinel in _incoming to unblock receive() | no exceptions (queue handles thread coordination)
|
|
10
|
+
WebSocket IO implementation.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import queue
|
|
14
|
+
import time
|
|
15
|
+
import uuid
|
|
16
|
+
from typing import Any, Dict
|
|
17
|
+
|
|
18
|
+
from .base import IO
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class WebSocketIO(IO):
|
|
22
|
+
"""Bridge async WebSocket to sync IO interface.
|
|
23
|
+
|
|
24
|
+
Uses queues to communicate between async WebSocket handler and sync agent code.
|
|
25
|
+
The agent runs in a thread, sending/receiving via queues.
|
|
26
|
+
The async handler pumps messages between WebSocket and queues.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init__(self):
|
|
30
|
+
self._outgoing: queue.Queue[Dict[str, Any]] = queue.Queue()
|
|
31
|
+
self._incoming: queue.Queue[Dict[str, Any]] = queue.Queue()
|
|
32
|
+
self._closed = False
|
|
33
|
+
|
|
34
|
+
def send(self, event: Dict[str, Any]) -> None:
|
|
35
|
+
"""Queue event to be sent to client.
|
|
36
|
+
|
|
37
|
+
Auto-generates 'id' (UUID) and 'ts' (timestamp) if not present,
|
|
38
|
+
ensuring all events have unique IDs for frontend React keys.
|
|
39
|
+
"""
|
|
40
|
+
if not self._closed:
|
|
41
|
+
if 'id' not in event:
|
|
42
|
+
event['id'] = str(uuid.uuid4())
|
|
43
|
+
if 'ts' not in event:
|
|
44
|
+
event['ts'] = time.time()
|
|
45
|
+
self._outgoing.put(event)
|
|
46
|
+
|
|
47
|
+
def receive(self) -> Dict[str, Any]:
|
|
48
|
+
"""Block until response from client."""
|
|
49
|
+
return self._incoming.get()
|
|
50
|
+
|
|
51
|
+
def close(self):
|
|
52
|
+
"""Mark IO as closed."""
|
|
53
|
+
self._closed = True
|
|
54
|
+
# Unblock any waiting receive
|
|
55
|
+
self._incoming.put({"type": "io_closed"})
|
connectonion/network/relay.py
CHANGED
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Purpose:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
Purpose: Agent-side relay client for registering and serving via central relay server
|
|
3
|
+
|
|
4
|
+
Lifecycle (Agent Side):
|
|
5
|
+
1. connect(relay_url) opens WebSocket to /ws/announce
|
|
6
|
+
2. send_announce() sends ANNOUNCE message to register agent
|
|
7
|
+
3. serve_loop() waits for INPUT messages from relay
|
|
8
|
+
4. On INPUT: task_handler(prompt) processes → sends OUTPUT back
|
|
9
|
+
5. Heartbeat: re-sends ANNOUNCE every 60s to stay registered
|
|
10
|
+
|
|
11
|
+
Message Flow:
|
|
12
|
+
Agent → ANNOUNCE → Relay (registers in active_connections)
|
|
13
|
+
Client → INPUT → Relay → forwards to Agent's WebSocket
|
|
14
|
+
Agent → OUTPUT → Relay → forwards to Client's /ws/input connection
|
|
15
|
+
|
|
16
|
+
Protocol:
|
|
17
|
+
ANNOUNCE: {type, address, summary, endpoints, signature, timestamp}
|
|
18
|
+
INPUT: {type, input_id, prompt, from_address?, session?}
|
|
19
|
+
OUTPUT: {type, input_id, result, session?}
|
|
20
|
+
TODO: Adopt WebRTC-style ICE candidates (host/srflx/relay) and connectivity
|
|
21
|
+
checks so clients can prefer direct endpoints when possible.
|
|
22
|
+
|
|
23
|
+
Related Files:
|
|
24
|
+
- oo-api/relay/routes.py: Relay server that receives these messages
|
|
25
|
+
- connectonion/network/connect.py: Client-side (sends INPUT, receives OUTPUT)
|
|
26
|
+
- connectonion/network/host/server.py: Uses this for relay registration
|
|
12
27
|
|
|
13
|
-
|
|
14
|
-
|
|
28
|
+
LLM-Note:
|
|
29
|
+
Dependencies: imports from [json, asyncio, typing, websockets]
|
|
30
|
+
Data flow: connect() → /ws/announce → serve_loop() → INPUT → task_handler → OUTPUT
|
|
31
|
+
State/Effects: WebSocket connection to relay | heartbeat every 60s
|
|
32
|
+
Integration: exposes connect(), send_announce(), wait_for_task(), serve_loop()
|
|
15
33
|
"""
|
|
16
34
|
|
|
17
35
|
import json
|
|
@@ -20,12 +38,12 @@ from typing import Dict, Any
|
|
|
20
38
|
import websockets
|
|
21
39
|
|
|
22
40
|
|
|
23
|
-
async def connect(relay_url: str = "wss://oo.openonion.ai
|
|
41
|
+
async def connect(relay_url: str = "wss://oo.openonion.ai"):
|
|
24
42
|
"""
|
|
25
|
-
Connect to relay
|
|
43
|
+
Connect to relay's announce endpoint.
|
|
26
44
|
|
|
27
45
|
Args:
|
|
28
|
-
relay_url:
|
|
46
|
+
relay_url: Relay server base URL (default: production relay)
|
|
29
47
|
|
|
30
48
|
Returns:
|
|
31
49
|
WebSocket connection object
|
|
@@ -34,7 +52,10 @@ async def connect(relay_url: str = "wss://oo.openonion.ai/ws/announce"):
|
|
|
34
52
|
>>> ws = await connect()
|
|
35
53
|
>>> # Now use ws for sending/receiving
|
|
36
54
|
"""
|
|
37
|
-
|
|
55
|
+
ws_url = f"{relay_url.rstrip('/')}/ws/announce"
|
|
56
|
+
# TODO: Future connection metadata (observed_ip, ICE candidates) should be
|
|
57
|
+
# attached to ANNOUNCE so relay can return best endpoints to clients.
|
|
58
|
+
return await websockets.connect(ws_url)
|
|
38
59
|
|
|
39
60
|
|
|
40
61
|
async def send_announce(websocket, announce_message: Dict[str, Any]):
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Purpose: Trust verification system module re-exporting factory, prompts, and verification tools
|
|
3
|
+
LLM-Note:
|
|
4
|
+
Dependencies: imports from [factory.py, prompts.py, tools.py] | imported by [network/__init__.py, network/host/auth.py, network/host/server.py] | tested by [tests/network/test_trust.py]
|
|
5
|
+
Data flow: re-exports trust agent creation utilities and trust level prompts
|
|
6
|
+
State/Effects: no state
|
|
7
|
+
Integration: exposes create_trust_agent(trust_spec) → Agent, get_default_trust_level() → str, validate_trust_level(level), TRUST_LEVELS dict, TRUST_PROMPTS dict, get_trust_prompt(level) → str, get_trust_verification_tools() → list | used by host() for access control policies
|
|
8
|
+
Performance: trivial
|
|
9
|
+
Errors: none
|
|
10
|
+
Trust verification system for agent networking.
|
|
11
|
+
|
|
12
|
+
This module contains:
|
|
13
|
+
- factory: Trust agent creation and configuration
|
|
14
|
+
- prompts: Pre-configured trust prompts for different levels
|
|
15
|
+
- tools: Verification tools for trust agents
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from .factory import create_trust_agent, get_default_trust_level, validate_trust_level, TRUST_LEVELS
|
|
19
|
+
from .prompts import TRUST_PROMPTS, get_trust_prompt
|
|
20
|
+
from .tools import get_trust_verification_tools
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"create_trust_agent",
|
|
24
|
+
"get_default_trust_level",
|
|
25
|
+
"validate_trust_level",
|
|
26
|
+
"TRUST_LEVELS",
|
|
27
|
+
"TRUST_PROMPTS",
|
|
28
|
+
"get_trust_prompt",
|
|
29
|
+
"get_trust_verification_tools",
|
|
30
|
+
]
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Purpose: Factory for creating trust verification agents with policies.
|
|
3
|
+
|
|
4
|
+
String Resolution Priority:
|
|
5
|
+
1. Trust level ("open", "careful", "strict")
|
|
6
|
+
2. File path (if exists)
|
|
7
|
+
3. Inline policy text
|
|
8
|
+
|
|
9
|
+
LLM-Note:
|
|
10
|
+
Dependencies: [os, pathlib, typing, .prompts, .tools] | imported by [host/server.py] | tested by [tests/unit/test_trust.py]
|
|
11
|
+
Data flow: trust param → check env default → resolve by priority → return Agent or None
|
|
12
|
+
Errors: TypeError (invalid type) | FileNotFoundError (Path doesn't exist)
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import os
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from typing import Union, Optional
|
|
18
|
+
|
|
19
|
+
from .prompts import get_trust_prompt
|
|
20
|
+
from .tools import get_trust_verification_tools
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# Trust level constants
|
|
24
|
+
TRUST_LEVELS = ["open", "careful", "strict"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def get_default_trust_level() -> Optional[str]:
|
|
28
|
+
"""
|
|
29
|
+
Get default trust level based on environment.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
Default trust level or None
|
|
33
|
+
"""
|
|
34
|
+
env = os.environ.get('CONNECTONION_ENV', '').lower()
|
|
35
|
+
|
|
36
|
+
if env == 'development':
|
|
37
|
+
return 'open'
|
|
38
|
+
elif env == 'production':
|
|
39
|
+
return 'strict'
|
|
40
|
+
elif env in ['staging', 'test']:
|
|
41
|
+
return 'careful'
|
|
42
|
+
|
|
43
|
+
return None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def create_trust_agent(trust: Union[str, Path, 'Agent', None], api_key: Optional[str] = None, model: str = "gpt-5-mini") -> Optional['Agent']:
|
|
47
|
+
"""
|
|
48
|
+
Create a trust agent based on the trust parameter.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
trust: Trust configuration:
|
|
52
|
+
- None: Check CONNECTONION_TRUST env, else return None
|
|
53
|
+
- Agent: Return as-is (must have tools)
|
|
54
|
+
- Path: Read file as policy
|
|
55
|
+
- str: Resolved by priority:
|
|
56
|
+
1. Trust level ("open", "careful", "strict")
|
|
57
|
+
2. File path (if file exists)
|
|
58
|
+
3. Inline policy text
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
Agent configured for trust verification, or None
|
|
62
|
+
"""
|
|
63
|
+
from ...core.agent import Agent # Import here to avoid circular dependency
|
|
64
|
+
|
|
65
|
+
# If None, check for environment default
|
|
66
|
+
if trust is None:
|
|
67
|
+
env_trust = os.environ.get('CONNECTONION_TRUST')
|
|
68
|
+
if env_trust:
|
|
69
|
+
trust = env_trust
|
|
70
|
+
else:
|
|
71
|
+
return None # No trust agent
|
|
72
|
+
|
|
73
|
+
# If it's already an Agent, validate and return it
|
|
74
|
+
if isinstance(trust, Agent):
|
|
75
|
+
if not trust.tools:
|
|
76
|
+
raise ValueError("Trust agent must have verification tools")
|
|
77
|
+
return trust
|
|
78
|
+
|
|
79
|
+
# Get trust verification tools
|
|
80
|
+
trust_tools = get_trust_verification_tools()
|
|
81
|
+
|
|
82
|
+
# Handle Path object
|
|
83
|
+
if isinstance(trust, Path):
|
|
84
|
+
if not trust.exists():
|
|
85
|
+
raise FileNotFoundError(f"Trust policy file not found: {trust}")
|
|
86
|
+
policy = trust.read_text(encoding='utf-8')
|
|
87
|
+
return Agent(
|
|
88
|
+
name="trust_agent_custom",
|
|
89
|
+
tools=trust_tools,
|
|
90
|
+
system_prompt=policy,
|
|
91
|
+
api_key=api_key,
|
|
92
|
+
model=model
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
# Handle string: trust level > file path > inline policy
|
|
96
|
+
if isinstance(trust, str):
|
|
97
|
+
if trust.lower() in TRUST_LEVELS:
|
|
98
|
+
return Agent(
|
|
99
|
+
name=f"trust_agent_{trust.lower()}",
|
|
100
|
+
tools=trust_tools,
|
|
101
|
+
system_prompt=get_trust_prompt(trust.lower()),
|
|
102
|
+
api_key=api_key,
|
|
103
|
+
model=model
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
path = Path(trust)
|
|
107
|
+
if path.exists() and path.is_file():
|
|
108
|
+
return Agent(
|
|
109
|
+
name="trust_agent_custom",
|
|
110
|
+
tools=trust_tools,
|
|
111
|
+
system_prompt=path.read_text(encoding='utf-8'),
|
|
112
|
+
api_key=api_key,
|
|
113
|
+
model=model
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
return Agent(
|
|
117
|
+
name="trust_agent_custom",
|
|
118
|
+
tools=trust_tools,
|
|
119
|
+
system_prompt=trust,
|
|
120
|
+
api_key=api_key,
|
|
121
|
+
model=model
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
# Invalid type
|
|
125
|
+
raise TypeError(f"Trust must be a string (level/policy/path), Path, Agent, or None, not {type(trust).__name__}")
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def validate_trust_level(level: str) -> bool:
|
|
129
|
+
"""
|
|
130
|
+
Check if a string is a valid trust level.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
level: String to check
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
True if valid trust level, False otherwise
|
|
137
|
+
"""
|
|
138
|
+
return level.lower() in TRUST_LEVELS
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Purpose: Provide pre-configured system prompts for trust agents at different security levels
|
|
3
3
|
LLM-Note:
|
|
4
|
-
Dependencies: no imports | imported by [
|
|
5
|
-
Data flow:
|
|
4
|
+
Dependencies: no imports | imported by [.factory] | tested by [tests/unit/test_trust_agents.py]
|
|
5
|
+
Data flow: factory.py calls get_trust_prompt(level) → validates level → returns TRUST_PROMPTS[level] string → used as system_prompt for trust Agent
|
|
6
6
|
State/Effects: no state or side effects | pure data module | TRUST_PROMPTS dict contains 3 prompts: "open" (dev - trust all), "careful" (staging - basic verification), "strict" (prod - whitelist only)
|
|
7
|
-
Integration: exposes TRUST_PROMPTS dict, get_trust_prompt(level), get_open_trust_prompt(), get_careful_trust_prompt(), get_strict_trust_prompt() | used by create_trust_agent() in
|
|
7
|
+
Integration: exposes TRUST_PROMPTS dict, get_trust_prompt(level), get_open_trust_prompt(), get_careful_trust_prompt(), get_strict_trust_prompt() | used by create_trust_agent() in factory.py to configure trust agent behavior
|
|
8
8
|
Performance: constant-time dict lookup | no computation
|
|
9
9
|
Errors: raises ValueError if level not in ["open", "careful", "strict"]
|
|
10
10
|
"""
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Purpose: Provide tool functions for trust agents to verify other agents
|
|
3
3
|
LLM-Note:
|
|
4
|
-
Dependencies: imports from [pathlib, typing] | imported by [
|
|
4
|
+
Dependencies: imports from [pathlib, typing] | imported by [.factory] | tested by [tests/unit/test_trust_functions.py]
|
|
5
5
|
Data flow: create_trust_agent() calls get_trust_verification_tools() → returns list of [check_whitelist, test_capability, verify_agent] functions → these become tools for trust Agent → trust agent calls tools with agent_id → functions return descriptive strings → AI interprets results per trust policy
|
|
6
6
|
State/Effects: check_whitelist() reads ~/.connectonion/trusted.txt file if exists | supports wildcard patterns with * | test_capability() and verify_agent() are pure (no I/O, just return descriptive strings for AI)
|
|
7
|
-
Integration: exposes check_whitelist(agent_id), test_capability(agent_id, test, expected), verify_agent(agent_id, agent_info), get_trust_verification_tools() | used by
|
|
7
|
+
Integration: exposes check_whitelist(agent_id), test_capability(agent_id, test, expected), verify_agent(agent_id, agent_info), get_trust_verification_tools() | used by factory.py to equip trust agents with verification capabilities
|
|
8
8
|
Performance: file read only for check_whitelist | simple string operations | no network calls
|
|
9
9
|
Errors: check_whitelist() catches file read exceptions and returns error string | missing whitelist file returns helpful message | no exceptions raised (errors returned as strings for AI interpretation)
|
|
10
10
|
"""
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Purpose: Prompt files namespace for built-in plugin markdown prompts (empty module)
|
|
3
|
+
LLM-Note:
|
|
4
|
+
Dependencies: none | imported by [prompts.py via load_system_prompt] | contains markdown files (reflect.md, etc.)
|
|
5
|
+
Data flow: namespace only (contains .md files, no code)
|
|
6
|
+
State/Effects: no state
|
|
7
|
+
Integration: directory contains prompt files loaded by plugins (e.g., useful_events_handlers/reflect.py loads prompt_files/reflect.md)
|
|
8
|
+
Performance: trivial
|
|
9
|
+
Errors: none
|
|
10
|
+
Prompts module for ConnectOnion built-in plugins.
|
|
11
|
+
"""
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# ReAct Acknowledge
|
|
2
|
+
|
|
3
|
+
You acknowledge user requests and show you understand their real need from context.
|
|
4
|
+
Be proactive - even brief inputs like "yes" or "fix it" have meaning in context.
|
|
5
|
+
|
|
6
|
+
## Guidelines
|
|
7
|
+
|
|
8
|
+
- Keep it SHORT: 1-2 sentences max
|
|
9
|
+
- Start with "I" or "Got it"
|
|
10
|
+
- Show you understood the CONTEXT, not just the literal words
|
|
11
|
+
- For brief inputs, reference what you're acting on
|
|
12
|
+
|
|
13
|
+
## Examples
|
|
14
|
+
|
|
15
|
+
- User: "build a web scraper" → "Got it, I'll build a scraper that handles pagination and extracts the data cleanly."
|
|
16
|
+
- User: "yes" → "Got it, I'll proceed with the approach we discussed."
|
|
17
|
+
- User: "fix it" → "I see the issue - I'll fix that bug and make sure it doesn't break again."
|
|
18
|
+
- User: "ok" → "Understood, moving forward with the changes."
|
|
19
|
+
- User: "edit it" → "Got it, I'll make those edits to the file we were looking at."
|
|
20
|
+
- User: "do it" → "On it - I'll implement what we discussed."
|
|
21
|
+
- User: "hmm not sure" → "I understand the hesitation - let me explain the tradeoffs so you can decide."
|
|
22
|
+
- User: "faster" → "Got it, I'll optimize the slow parts we identified."
|
|
23
|
+
- User: "add tests" → "I'll add tests that cover the edge cases and prevent regressions."
|
|
24
|
+
- User: "looks wrong" → "I see what you mean - let me fix that and double-check the logic."
|
|
25
|
+
- User: "continue" → "Continuing from where we left off."
|
|
26
|
+
- User: "try again" → "Got it, I'll retry with a different approach this time."
|
connectonion/prompts.py
CHANGED
|
@@ -19,7 +19,16 @@ DEFAULT_PROMPT = "You are a helpful assistant that can use tools to complete tas
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def _looks_like_file_path(text: str) -> bool:
|
|
22
|
-
"""Check if a string looks like a file path rather than prompt text.
|
|
22
|
+
"""Check if a string looks like a file path rather than prompt text.
|
|
23
|
+
|
|
24
|
+
Returns False if the text is likely prompt content (contains newlines or is very long).
|
|
25
|
+
Returns True if the text looks like a file path (has path separators or prompt file extensions).
|
|
26
|
+
"""
|
|
27
|
+
# Prompt text typically contains newlines and is longer than file paths
|
|
28
|
+
# File paths are single-line and limited by OS (usually < 1024 chars)
|
|
29
|
+
if '\n' in text or len(text) > 1024:
|
|
30
|
+
return False
|
|
31
|
+
|
|
23
32
|
# Check for file extensions
|
|
24
33
|
has_file_extension = '.' in text and text.split('.')[-1] in ['md', 'txt', 'prompt']
|
|
25
34
|
# Check for path separators
|
connectonion/tui/chat.py
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Purpose: Terminal chat interface using Textual framework for interactive agent conversations
|
|
3
|
+
LLM-Note:
|
|
4
|
+
Dependencies: imports from [textual App/Screen/Widget, rich, core/agent.py, tui/input.py, tui/status_bar.py, tui/providers.py] | imported by [cli/commands/, examples/] | tested by [tests/tui/test_chat.py]
|
|
5
|
+
Data flow: Chat.run() starts Textual app → renders status bar + chat messages → Input widget captures user input → on_submit sends to agent.input() → agent response appended to message log → UI updates | supports slash command triggers with autocomplete providers
|
|
6
|
+
State/Effects: maintains message history in MessageLog widget | modifies terminal (clears screen, moves cursor) | restores terminal on exit | saves chat state in self.messages
|
|
7
|
+
Integration: exposes Chat(agent, title, triggers, welcome, hints, status_segments, input_placeholder) with run() method | CommandItem dataclass for slash commands | uses Textual's reactive system for live updates | integrates with Agent for LLM interactions
|
|
8
|
+
Performance: Textual async rendering (smooth) | message log scrolls efficiently | minimal re-renders via reactive
|
|
9
|
+
Errors: catches agent errors and displays in chat | restores terminal on crash | validates command triggers
|
|
10
|
+
Chat - Terminal chat interface using Textual.
|
|
2
11
|
|
|
3
12
|
A simple, clean chat UI that works with the terminal medium rather than
|
|
4
13
|
fighting it. No fake "bubbles" - just clean text with color differentiation.
|
connectonion/tui/divider.py
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Purpose: Simple horizontal line separator for terminal UI sections
|
|
3
|
+
LLM-Note:
|
|
4
|
+
Dependencies: imports from [rich.text.Text] | imported by [tui/chat.py, tui/input.py] | tested by [tests/tui/test_divider.py]
|
|
5
|
+
Data flow: Divider(width, char, style) → render() → returns Rich Text with repeated character
|
|
6
|
+
State/Effects: no state (pure function)
|
|
7
|
+
Integration: exposes Divider(width, char, style) with render() → Text | used for visual separation in TUI layouts
|
|
8
|
+
Performance: trivial (string multiplication)
|
|
9
|
+
Errors: none
|
|
10
|
+
Divider - Simple horizontal line separator.
|
|
2
11
|
|
|
3
12
|
A minimal line to separate sections in terminal UI.
|
|
4
13
|
"""
|
connectonion/tui/dropdown.py
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
Purpose: Reusable selection list component with fuzzy matching and keyboard navigation
|
|
3
|
+
LLM-Note:
|
|
4
|
+
Dependencies: imports from [rich.text/table/console, tui/fuzzy.py, dataclasses] | imported by [tui/input.py, tui/providers.py] | tested by [tests/tui/test_dropdown.py]
|
|
5
|
+
Data flow: Dropdown(items, selected_index) → render() → formats items with icons/labels → highlights selected item → uses fuzzy.highlight_match() for query highlighting
|
|
6
|
+
State/Effects: maintains selected_index | no I/O (pure rendering)
|
|
7
|
+
Integration: exposes DropdownItem(icon, label, value, meta, score, positions) dataclass | Dropdown.render() → Rich Group | used by Input widget for autocomplete
|
|
8
|
+
Performance: renders visible items only | fuzzy highlighting is cached in positions
|
|
9
|
+
Errors: none (validates selected_index bounds)
|
|
10
|
+
Dropdown - reusable selection list component.
|
|
2
11
|
|
|
3
12
|
Modern zsh-style dropdown with icons and highlighting.
|
|
4
13
|
"""
|