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,307 @@
|
|
|
1
|
+
# Auto Debug Exception - AI-Powered Exception Debugger
|
|
2
|
+
|
|
3
|
+
**Debugs ONLY uncaught exceptions** - crashes, raised exceptions, and failed assertions.
|
|
4
|
+
|
|
5
|
+
When your Python program **encounters an uncaught exception**, ConnectOnion's `auto_debug_exception()` gives the AI **live access to your program's runtime state**. The AI can execute code, inspect objects, and test fixes using the actual data. No more guessing - get verified solutions that actually work.
|
|
6
|
+
|
|
7
|
+
> **Important:** This only works for uncaught exceptions. For logic errors that don't crash, use `raise` or `assert` to convert them to exceptions!
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from connectonion import auto_debug_exception
|
|
13
|
+
|
|
14
|
+
# Enable AI debugging with runtime inspection
|
|
15
|
+
auto_debug_exception()
|
|
16
|
+
|
|
17
|
+
# Your code - any crash triggers deep AI analysis
|
|
18
|
+
data = {"users": []}
|
|
19
|
+
average = sum(u["age"] for u in data["users"]) / len(data["users"]) # Crashes!
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
When this crashes, the AI will:
|
|
23
|
+
1. Show the normal Python traceback first
|
|
24
|
+
2. Execute code in the crashed context to understand what happened
|
|
25
|
+
3. Test potential fixes with your actual data
|
|
26
|
+
4. Provide a working solution you can copy-paste
|
|
27
|
+
|
|
28
|
+
## What Makes This Special
|
|
29
|
+
|
|
30
|
+
### 🔬 Live Runtime Access
|
|
31
|
+
The AI isn't just reading your code - it has access to the actual runtime state when the crash occurred. It can:
|
|
32
|
+
- Execute any Python expression using your variables
|
|
33
|
+
- See the real values that caused the problem
|
|
34
|
+
- Test fixes before suggesting them
|
|
35
|
+
|
|
36
|
+
### ✅ Verified Solutions
|
|
37
|
+
Every fix is tested with your actual data before being suggested. No more "this might work" - only proven solutions.
|
|
38
|
+
|
|
39
|
+
### 🎯 Precise Analysis
|
|
40
|
+
The AI can explore your data structures, check types, validate assumptions, and trace variables through the call stack.
|
|
41
|
+
|
|
42
|
+
## Real-World Examples
|
|
43
|
+
|
|
44
|
+
### Example 1: Empty Collection Crash
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from connectonion import auto_debug_exception
|
|
48
|
+
auto_debug_exception()
|
|
49
|
+
|
|
50
|
+
def calculate_metrics(scores):
|
|
51
|
+
return {
|
|
52
|
+
'average': sum(scores) / len(scores), # Crashes if empty!
|
|
53
|
+
'maximum': max(scores),
|
|
54
|
+
'minimum': min(scores)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
result = calculate_metrics([]) # 💥 Multiple issues!
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**AI Runtime Debug Analysis:**
|
|
61
|
+
|
|
62
|
+
What I found:
|
|
63
|
+
- Executed: len(scores) → 0
|
|
64
|
+
- Executed: sum(scores) → 0
|
|
65
|
+
- The division 0/0 causes ZeroDivisionError
|
|
66
|
+
- Also tested: max([]) raises ValueError
|
|
67
|
+
|
|
68
|
+
Why it failed:
|
|
69
|
+
Empty list causes division by zero and max()/min() to fail
|
|
70
|
+
|
|
71
|
+
Verified fix (tested with your data):
|
|
72
|
+
```python
|
|
73
|
+
def calculate_metrics(scores):
|
|
74
|
+
if not scores:
|
|
75
|
+
return {
|
|
76
|
+
'average': 0,
|
|
77
|
+
'maximum': None,
|
|
78
|
+
'minimum': None
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
'average': sum(scores) / len(scores),
|
|
82
|
+
'maximum': max(scores),
|
|
83
|
+
'minimum': min(scores)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Example 2: Nested Dictionary Access
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from connectonion import auto_debug_exception
|
|
92
|
+
auto_debug_exception()
|
|
93
|
+
|
|
94
|
+
# API response with unexpected structure
|
|
95
|
+
response = {
|
|
96
|
+
'data': {
|
|
97
|
+
'user': {
|
|
98
|
+
'profile': {'name': 'Alice'}
|
|
99
|
+
# Missing 'settings' key!
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
# Your code expects different structure
|
|
105
|
+
theme = response['data']['user']['profile']['settings']['theme'] # 💥
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**AI Runtime Debug Analysis:**
|
|
109
|
+
```
|
|
110
|
+
What I found:
|
|
111
|
+
- Executed: list(response['data']['user']['profile'].keys()) → ['name']
|
|
112
|
+
- No 'settings' key exists in profile
|
|
113
|
+
- Tested: response['data']['user']['profile'].get('settings') → None
|
|
114
|
+
|
|
115
|
+
Why it failed:
|
|
116
|
+
KeyError because 'settings' doesn't exist in the profile dictionary
|
|
117
|
+
|
|
118
|
+
Verified fix (tested with your data):
|
|
119
|
+
```python
|
|
120
|
+
# Safe navigation with defaults
|
|
121
|
+
profile = response['data']['user']['profile']
|
|
122
|
+
theme = profile.get('settings', {}).get('theme', 'light')
|
|
123
|
+
|
|
124
|
+
# Or check before accessing
|
|
125
|
+
if 'settings' in profile and 'theme' in profile['settings']:
|
|
126
|
+
theme = profile['settings']['theme']
|
|
127
|
+
else:
|
|
128
|
+
theme = 'light' # default
|
|
129
|
+
```
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Example 3: Type Mismatch
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from connectonion import auto_debug_exception
|
|
136
|
+
auto_debug_exception()
|
|
137
|
+
|
|
138
|
+
def process_items(items):
|
|
139
|
+
# Expects list, might get dict or string
|
|
140
|
+
for item in items:
|
|
141
|
+
print(f"Processing: {item['id']}")
|
|
142
|
+
|
|
143
|
+
# API returned dict instead of list
|
|
144
|
+
api_data = {'item1': {...}, 'item2': {...}}
|
|
145
|
+
process_items(api_data) # 💥
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**AI Runtime Debug Analysis:**
|
|
149
|
+
```
|
|
150
|
+
What I found:
|
|
151
|
+
- Executed: type(items) → <class 'dict'>
|
|
152
|
+
- Iterating over dict gives keys, not items
|
|
153
|
+
- Executed: list(items.keys()) → ['item1', 'item2']
|
|
154
|
+
- item (the key) is a string, not dict with 'id'
|
|
155
|
+
|
|
156
|
+
Why it failed:
|
|
157
|
+
TypeError because you're iterating over dict keys (strings), not dict values
|
|
158
|
+
|
|
159
|
+
Verified fix (tested with your data):
|
|
160
|
+
```python
|
|
161
|
+
def process_items(items):
|
|
162
|
+
# Handle both list and dict
|
|
163
|
+
if isinstance(items, dict):
|
|
164
|
+
items = items.values()
|
|
165
|
+
|
|
166
|
+
for item in items:
|
|
167
|
+
print(f"Processing: {item['id']}")
|
|
168
|
+
```
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Power Features
|
|
172
|
+
|
|
173
|
+
### 1. Execute Code in Crashed Context
|
|
174
|
+
The AI can run any Python code using your actual variables:
|
|
175
|
+
```python
|
|
176
|
+
# AI explores your data:
|
|
177
|
+
execute_in_frame("type(data)") # → <class 'dict'>
|
|
178
|
+
execute_in_frame("list(data.keys())") # → ['users', 'config']
|
|
179
|
+
execute_in_frame("len(data['users'])") # → 0
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 2. Deep Object Inspection
|
|
183
|
+
See everything about an object - type, attributes, methods, values:
|
|
184
|
+
```python
|
|
185
|
+
# AI inspects complex objects:
|
|
186
|
+
inspect_object("response")
|
|
187
|
+
# → Type: dict
|
|
188
|
+
# → Keys: ['data', 'meta', 'errors']
|
|
189
|
+
# → Methods: get, items, keys, values...
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 3. Test Fixes Before Suggesting
|
|
193
|
+
The AI tests solutions with your actual data:
|
|
194
|
+
```python
|
|
195
|
+
# AI tests potential fixes:
|
|
196
|
+
test_fix(
|
|
197
|
+
"data['missing']", # Original (fails)
|
|
198
|
+
"data.get('missing', 'default')" # Fixed (works)
|
|
199
|
+
)
|
|
200
|
+
# → Original: ✗ KeyError
|
|
201
|
+
# → Fixed: ✓ Returns 'default'
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### 4. Validate Assumptions
|
|
205
|
+
Test any hypothesis about your data:
|
|
206
|
+
```python
|
|
207
|
+
# AI validates assumptions:
|
|
208
|
+
validate_assumption("isinstance(data, dict)") # → ✓ TRUE
|
|
209
|
+
validate_assumption("len(users) > 0") # → ✗ FALSE
|
|
210
|
+
validate_assumption("'id' in user") # → Shows available keys
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### 5. Trace Variables Through Stack
|
|
214
|
+
See how variables changed across function calls:
|
|
215
|
+
```python
|
|
216
|
+
# AI traces variable through call stack:
|
|
217
|
+
trace_variable("user_data")
|
|
218
|
+
# → Frame 1: process() - user_data = {...}
|
|
219
|
+
# → Frame 2: validate() - user_data = {...}
|
|
220
|
+
# → Frame 3: save() - user_data = None (modified!)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Configuration
|
|
224
|
+
|
|
225
|
+
### Choose Your Model
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
# Use a specific model
|
|
229
|
+
auto_debug(model="gpt-4") # More thorough analysis
|
|
230
|
+
auto_debug(model="o4-mini") # Faster, default
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Disable via Environment
|
|
234
|
+
|
|
235
|
+
In your `.env` file:
|
|
236
|
+
```bash
|
|
237
|
+
# Disable auto_debug completely
|
|
238
|
+
CONNECTONION_AUTO_DEBUG=false
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Or temporarily:
|
|
242
|
+
```bash
|
|
243
|
+
CONNECTONION_AUTO_DEBUG=false python your_script.py
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Best Practices
|
|
247
|
+
|
|
248
|
+
### When to Use
|
|
249
|
+
|
|
250
|
+
✅ **Perfect for:**
|
|
251
|
+
- Development and debugging
|
|
252
|
+
- Understanding unfamiliar codebases
|
|
253
|
+
- Complex data structure issues
|
|
254
|
+
- Learning from mistakes
|
|
255
|
+
- Debugging production issues locally
|
|
256
|
+
|
|
257
|
+
❌ **Not recommended for:**
|
|
258
|
+
- Production environments (exposes runtime data)
|
|
259
|
+
- Performance-critical code (adds overhead)
|
|
260
|
+
- Simple syntax errors (overkill)
|
|
261
|
+
|
|
262
|
+
### Tips for Best Results
|
|
263
|
+
|
|
264
|
+
1. **Let it crash** - Don't wrap in try/except, let auto_debug catch it
|
|
265
|
+
2. **Use descriptive variable names** - Helps AI understand context
|
|
266
|
+
3. **Keep sensitive data out** - AI sees all variables in crashed scope
|
|
267
|
+
|
|
268
|
+
## How It Works
|
|
269
|
+
|
|
270
|
+
1. **Exception Hook**: Intercepts uncaught exceptions via `sys.excepthook`
|
|
271
|
+
2. **Frame Capture**: Captures the exception frame with all variables
|
|
272
|
+
3. **Runtime Inspector**: Creates a `RuntimeInspector` with crashed state
|
|
273
|
+
4. **AI Analysis**: Provides tools for the AI to explore and test
|
|
274
|
+
5. **Solution Verification**: Tests fixes before suggesting them
|
|
275
|
+
|
|
276
|
+
## Limitations
|
|
277
|
+
|
|
278
|
+
- **Only uncaught exceptions** - Caught exceptions aren't analyzed
|
|
279
|
+
- **Frame access** - Some built-in objects may not be fully inspectable
|
|
280
|
+
- **API dependency** - Requires OpenAI/Anthropic API access
|
|
281
|
+
- **Performance** - Adds overhead, not for production
|
|
282
|
+
|
|
283
|
+
## Security Notes
|
|
284
|
+
|
|
285
|
+
⚠️ **The AI can see all variables in the crashed scope**, including:
|
|
286
|
+
- API keys in variables (use environment variables instead)
|
|
287
|
+
- User data
|
|
288
|
+
- Database credentials
|
|
289
|
+
- Any sensitive information in memory
|
|
290
|
+
|
|
291
|
+
For production, always set `CONNECTONION_AUTO_DEBUG=false`.
|
|
292
|
+
|
|
293
|
+
## Coming Soon
|
|
294
|
+
|
|
295
|
+
Based on user feedback, we're considering:
|
|
296
|
+
- **Automatic fix application** - Apply the verified fix automatically
|
|
297
|
+
- **Historical analysis** - Learn from past crashes
|
|
298
|
+
- **Team sharing** - Share crash analysis with team
|
|
299
|
+
- **Custom prompts** - Tailor analysis to your needs
|
|
300
|
+
- **Offline mode** - Save crash state for later analysis
|
|
301
|
+
|
|
302
|
+
## See Also
|
|
303
|
+
|
|
304
|
+
- [Getting Started](quickstart.md) - ConnectOnion basics
|
|
305
|
+
- [RuntimeInspector](runtime_inspector.md) - Technical details of runtime tools
|
|
306
|
+
- [Debug Agent](debug_agent.md) - How the debug agent works
|
|
307
|
+
- [Examples](examples.md#auto-debug) - More auto_debug examples
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Logging
|
|
2
|
+
|
|
3
|
+
ConnectOnion automatically logs agent activity to files for debugging and analysis.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
# Default: logs to .co/logs/{name}.log + .co/evals/{name}_{timestamp}.yaml
|
|
9
|
+
agent = Agent("assistant")
|
|
10
|
+
|
|
11
|
+
# Quiet mode: no console output, but sessions still recorded
|
|
12
|
+
agent = Agent("assistant", quiet=True)
|
|
13
|
+
|
|
14
|
+
# Disable all logging
|
|
15
|
+
agent = Agent("assistant", log=False)
|
|
16
|
+
|
|
17
|
+
# Custom log file path
|
|
18
|
+
agent = Agent("assistant", log="debug.log")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Logging Modes
|
|
22
|
+
|
|
23
|
+
| quiet | log | Console | Plain Text | Sessions | Use Case |
|
|
24
|
+
|-------|-----|---------|------------|----------|----------|
|
|
25
|
+
| False | True/None | ✓ | ✓ | ✓ | Development (default) |
|
|
26
|
+
| True | True/None | ✗ | ✗ | ✓ | Eval/testing |
|
|
27
|
+
| False | False | ✓ | ✗ | ✗ | Benchmarking |
|
|
28
|
+
| False | "path" | ✓ | custom | ✓ | Custom log path |
|
|
29
|
+
|
|
30
|
+
## Log Locations
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
.co/
|
|
34
|
+
├── logs/
|
|
35
|
+
│ └── assistant.log # Plain text logs
|
|
36
|
+
└── sessions/
|
|
37
|
+
└── assistant_2024-12-02_10-30-00.yaml # Session YAML
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Plain Text Format (.co/logs/)
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
============================================================
|
|
44
|
+
Session started: 2024-12-02 10:32:14
|
|
45
|
+
============================================================
|
|
46
|
+
|
|
47
|
+
[10:32:14] INPUT: Generate a Python function...
|
|
48
|
+
[10:32:14] -> LLM Request (co/o4-mini) • 2 msgs • 3 tools
|
|
49
|
+
[10:32:15] <- LLM Response (1.1s) • 1 tools • 1.2k tokens • $0.0012
|
|
50
|
+
[10:32:15] -> Tool: generate_code({"language": "python"})
|
|
51
|
+
[10:32:15] <- Result (0.05s): def hello(): print("Hi")...
|
|
52
|
+
[10:32:16] [OK] Complete (2.3s)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Session YAML Format (.co/evals/)
|
|
56
|
+
|
|
57
|
+
Sessions are saved as YAML for replay and eval:
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
name: assistant
|
|
61
|
+
timestamp: 2024-12-02 10:32:14
|
|
62
|
+
|
|
63
|
+
turns:
|
|
64
|
+
- input: "Generate a Python function"
|
|
65
|
+
model: "co/o4-mini"
|
|
66
|
+
duration_ms: 2300
|
|
67
|
+
tokens: 1234
|
|
68
|
+
cost: 0.0012
|
|
69
|
+
tools_called: [generate_code]
|
|
70
|
+
result: "Here's a Python function..."
|
|
71
|
+
messages: '[{"role":"system",...}]'
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Use cases:
|
|
75
|
+
- **Session replay**: Restore context from saved sessions
|
|
76
|
+
- **Regression testing**: Compare expected vs actual results
|
|
77
|
+
- **Development comparison**: See what changed after prompt edits
|
|
78
|
+
|
|
79
|
+
## View Logs
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Watch plain text logs in real-time
|
|
83
|
+
tail -f .co/logs/assistant.log
|
|
84
|
+
|
|
85
|
+
# Search for errors
|
|
86
|
+
grep ERROR .co/logs/assistant.log
|
|
87
|
+
|
|
88
|
+
# See all tool calls
|
|
89
|
+
grep "Tool:" .co/logs/assistant.log
|
|
90
|
+
|
|
91
|
+
# List sessions
|
|
92
|
+
ls -la .co/evals/
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Environment Variable
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Override log file via environment (highest priority)
|
|
99
|
+
CONNECTONION_LOG=debug.log python agent.py
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Git Ignore
|
|
103
|
+
|
|
104
|
+
Add to `.gitignore`:
|
|
105
|
+
```
|
|
106
|
+
.co/logs/
|
|
107
|
+
.co/evals/
|
|
108
|
+
*.log
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Parameters
|
|
112
|
+
|
|
113
|
+
- **`quiet`** (bool): Suppress console output. Sessions still recorded. Default: `False`
|
|
114
|
+
- **`log`** (bool|str|Path): Control file logging
|
|
115
|
+
- `None`/`True`: Default `.co/logs/{name}.log`
|
|
116
|
+
- `False`: Disable all logging
|
|
117
|
+
- `"path/to/file.log"`: Custom log path
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Debug with @xray
|
|
2
|
+
|
|
3
|
+
See what your AI agent is thinking.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from connectonion import xray
|
|
9
|
+
|
|
10
|
+
@xray
|
|
11
|
+
def my_tool(text: str) -> str:
|
|
12
|
+
"""Process some text."""
|
|
13
|
+
|
|
14
|
+
# Now you can see inside the agent's mind!
|
|
15
|
+
print(xray.agent.name) # "my_assistant"
|
|
16
|
+
print(xray.task) # "Process this document"
|
|
17
|
+
print(xray.iteration) # 1, 2, 3...
|
|
18
|
+
|
|
19
|
+
return f"Processed: {text}"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
That's it! Add `@xray` to any tool to unlock debugging superpowers.
|
|
23
|
+
|
|
24
|
+
## What You Can Access
|
|
25
|
+
|
|
26
|
+
Inside any `@xray` decorated function:
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
xray.agent # The Agent instance calling this tool
|
|
30
|
+
xray.task # Original request from user
|
|
31
|
+
xray.messages # Full conversation history
|
|
32
|
+
xray.iteration # Which round of tool calls (1-10)
|
|
33
|
+
xray.previous_tools # Tools called before this one
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Real Example
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
@xray
|
|
40
|
+
def search_database(query: str) -> str:
|
|
41
|
+
"""Search our database."""
|
|
42
|
+
|
|
43
|
+
# See what led to this search
|
|
44
|
+
print(f"User asked: {xray.task}")
|
|
45
|
+
print(f"This is iteration {xray.iteration}")
|
|
46
|
+
|
|
47
|
+
if xray.previous_tools:
|
|
48
|
+
print(f"Already tried: {xray.previous_tools}")
|
|
49
|
+
|
|
50
|
+
# Adjust behavior based on context
|
|
51
|
+
if xray.iteration > 2:
|
|
52
|
+
return "No results found, please refine your search"
|
|
53
|
+
|
|
54
|
+
return f"Found 5 results for '{query}'"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Visual Execution Trace
|
|
58
|
+
|
|
59
|
+
See the complete flow of your agent's work from inside a tool:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
@xray
|
|
63
|
+
def analyze_data(text: str) -> str:
|
|
64
|
+
"""Analyze data and show execution trace."""
|
|
65
|
+
|
|
66
|
+
# Show what happened so far
|
|
67
|
+
xray.trace()
|
|
68
|
+
|
|
69
|
+
return "Analysis complete"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Output:**
|
|
73
|
+
```
|
|
74
|
+
Task: "Find Python tutorials and summarize them"
|
|
75
|
+
|
|
76
|
+
[1] • 89ms search_database(query="Python tutorials")
|
|
77
|
+
IN → query: "Python tutorials"
|
|
78
|
+
OUT ← "Found 5 results for 'Python tutorials'"
|
|
79
|
+
|
|
80
|
+
[2] • 234ms summarize_text(text="Found 5 results...", max_words=50)
|
|
81
|
+
IN → text: "Found 5 results for 'Python tutorials'"
|
|
82
|
+
IN → max_words: 50
|
|
83
|
+
OUT ← "5 Python tutorials found covering basics to advanced topics"
|
|
84
|
+
|
|
85
|
+
Total: 323ms • 2 steps • 1 iterations
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Debug in Your IDE
|
|
89
|
+
|
|
90
|
+
Set a breakpoint and explore:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
@xray
|
|
94
|
+
def analyze_sentiment(text: str) -> str:
|
|
95
|
+
# 🎯 Set breakpoint on next line
|
|
96
|
+
sentiment = "positive" # When stopped here in debugger:
|
|
97
|
+
# >>> xray
|
|
98
|
+
# <XrayContext active>
|
|
99
|
+
# agent: 'my_bot'
|
|
100
|
+
# task: 'How do people feel about Python?'
|
|
101
|
+
# >>> xray.messages
|
|
102
|
+
# [{'role': 'user', 'content': '...'}, ...]
|
|
103
|
+
|
|
104
|
+
return sentiment
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Practical Use Cases
|
|
108
|
+
|
|
109
|
+
### 1. Understand Why a Tool Was Called
|
|
110
|
+
```python
|
|
111
|
+
@xray
|
|
112
|
+
def emergency_shutdown():
|
|
113
|
+
"""Shutdown the system."""
|
|
114
|
+
|
|
115
|
+
# Check why this drastic action was requested
|
|
116
|
+
print(f"Shutdown requested because: {xray.task}")
|
|
117
|
+
print(f"After trying: {xray.previous_tools}")
|
|
118
|
+
|
|
119
|
+
# Maybe don't shutdown if it's the first try
|
|
120
|
+
if xray.iteration == 1:
|
|
121
|
+
return "Try restarting first"
|
|
122
|
+
|
|
123
|
+
return "System shutdown complete"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 2. Adaptive Tool Behavior
|
|
127
|
+
```python
|
|
128
|
+
@xray
|
|
129
|
+
def fetch_data(source: str) -> str:
|
|
130
|
+
"""Fetch data from a source."""
|
|
131
|
+
|
|
132
|
+
# Use cache on repeated calls
|
|
133
|
+
if "fetch_data" in xray.previous_tools:
|
|
134
|
+
return "Using cached data"
|
|
135
|
+
|
|
136
|
+
# Fresh fetch on first call
|
|
137
|
+
return f"Fresh data from {source}"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 3. Debug Complex Flows
|
|
141
|
+
```python
|
|
142
|
+
@xray
|
|
143
|
+
def process_order(order_id: str) -> str:
|
|
144
|
+
"""Process an order."""
|
|
145
|
+
|
|
146
|
+
# See the full context when debugging
|
|
147
|
+
if xray.agent:
|
|
148
|
+
print(f"Processing for agent: {xray.agent.name}")
|
|
149
|
+
print(f"Original request: {xray.task}")
|
|
150
|
+
print(f"Conversation length: {len(xray.messages)}")
|
|
151
|
+
|
|
152
|
+
return f"Order {order_id} processed"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Tips
|
|
156
|
+
|
|
157
|
+
1. **Development Only** - Remove @xray in production for best performance
|
|
158
|
+
2. **Combine with IDE** - Set breakpoints for interactive debugging
|
|
159
|
+
3. **Use trace()** - Call `xray.trace(agent)` after runs to see full flow
|
|
160
|
+
4. **Check context** - Always verify `xray.agent` exists before using
|
|
161
|
+
|
|
162
|
+
## Production Notes
|
|
163
|
+
|
|
164
|
+
**Thread Safety:** xray uses global state that is NOT thread-safe. This is fine for:
|
|
165
|
+
- Single-threaded async servers (uvicorn, asyncio) ✅
|
|
166
|
+
- Multi-process workers (gunicorn with workers) ✅
|
|
167
|
+
|
|
168
|
+
But NOT safe for:
|
|
169
|
+
- Multi-threaded servers with shared agent instances ❌
|
|
170
|
+
- Parallel tool execution in threads ❌
|
|
171
|
+
|
|
172
|
+
If you need multi-threading, either:
|
|
173
|
+
1. Don't use `@xray` in production (recommended)
|
|
174
|
+
2. Use separate agent instances per thread
|
|
175
|
+
|
|
176
|
+
**For production:** If you need to access agent context in tools, use the [Events system](../events.md) instead. Events provide a cleaner, safer pattern for injecting agent context without global state.
|
|
177
|
+
|
|
178
|
+
If you have a use case that requires thread-local xray context, please [open a GitHub issue](https://github.com/openonion/connectonion/issues) to discuss.
|
|
179
|
+
|
|
180
|
+
## Common Patterns
|
|
181
|
+
|
|
182
|
+
### Logging What Matters
|
|
183
|
+
```python
|
|
184
|
+
@xray
|
|
185
|
+
def important_action(data: str) -> str:
|
|
186
|
+
# Log with context
|
|
187
|
+
if xray.agent:
|
|
188
|
+
logger.info(f"Agent {xray.agent.name} performing action")
|
|
189
|
+
logger.info(f"Original task: {xray.task}")
|
|
190
|
+
logger.info(f"Iteration: {xray.iteration}")
|
|
191
|
+
|
|
192
|
+
return "Action completed"
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Conditional Logic
|
|
196
|
+
```python
|
|
197
|
+
@xray
|
|
198
|
+
def smart_search(query: str) -> str:
|
|
199
|
+
# Different strategies based on context
|
|
200
|
+
if xray.iteration > 1:
|
|
201
|
+
# Broaden search on retry
|
|
202
|
+
query = f"{query} OR related"
|
|
203
|
+
|
|
204
|
+
if "analyze" in xray.previous_tools:
|
|
205
|
+
# We already analyzed, search differently
|
|
206
|
+
query = f"summary of {query}"
|
|
207
|
+
|
|
208
|
+
return f"Results for: {query}"
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Next Steps
|
|
212
|
+
|
|
213
|
+
- Try [@replay](replay.md) for re-running tools with different parameters
|
|
214
|
+
- See [Examples](examples.md) for complete debugging workflows
|
|
215
|
+
- Check [API Reference](api.md) for all xray properties
|