connectonion 0.6.2__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 +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 +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.2.dist-info → connectonion-0.6.3.dist-info}/METADATA +10 -3
- connectonion-0.6.3.dist-info/RECORD +469 -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.3.dist-info}/WHEEL +0 -0
- {connectonion-0.6.2.dist-info → connectonion-0.6.3.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
# ConnectOnion Tools
|
|
2
|
+
|
|
3
|
+
> Built to “show, don’t tell,” with progressive disclosure from simple to advanced.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Quick Start (60 seconds to first tool)
|
|
8
|
+
|
|
9
|
+
**Three lines to a working tool. Then call it.**
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from connectonion import Agent
|
|
13
|
+
|
|
14
|
+
def search(query: str) -> str: # your first tool
|
|
15
|
+
return f"Found results for {query}"
|
|
16
|
+
|
|
17
|
+
agent = Agent(
|
|
18
|
+
"helper",
|
|
19
|
+
tools=[search],
|
|
20
|
+
max_iterations=5 # Simple search tasks
|
|
21
|
+
)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Run it**
|
|
25
|
+
|
|
26
|
+
```pycon
|
|
27
|
+
>>> agent("Find Python tutorials")
|
|
28
|
+
'Found results for Python tutorials'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
That’s it.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Core Concepts (function tools)
|
|
36
|
+
|
|
37
|
+
What you get:
|
|
38
|
+
|
|
39
|
+
- Clear interfaces via Python type hints
|
|
40
|
+
- Automatic tool schemas for the LLM and UIs
|
|
41
|
+
- Docstrings become user-facing descriptions
|
|
42
|
+
|
|
43
|
+
### Function tools with type hints
|
|
44
|
+
|
|
45
|
+
Type hints are the interface. Keep signatures explicit.
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from connectonion import Agent
|
|
49
|
+
from typing import List
|
|
50
|
+
|
|
51
|
+
def top_k(query: str, k: int = 5) -> List[str]:
|
|
52
|
+
"""Return the top-k result titles for a query."""
|
|
53
|
+
# ... your logic ...
|
|
54
|
+
return [f"{i+1}. {query} result" for i in range(k)]
|
|
55
|
+
|
|
56
|
+
agent = Agent(
|
|
57
|
+
"helper",
|
|
58
|
+
tools=[top_k],
|
|
59
|
+
max_iterations=8 # May need multiple searches
|
|
60
|
+
)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**What the agent sees**
|
|
64
|
+
|
|
65
|
+
```pycon
|
|
66
|
+
>>> agent.list_tools()
|
|
67
|
+
['top_k']
|
|
68
|
+
```
|
|
69
|
+
### Return types matter
|
|
70
|
+
|
|
71
|
+
Use structured returns when the next step needs fields.
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from typing import TypedDict, List
|
|
75
|
+
|
|
76
|
+
class SearchHit(TypedDict):
|
|
77
|
+
title: str
|
|
78
|
+
url: str
|
|
79
|
+
score: float
|
|
80
|
+
|
|
81
|
+
def search_hits(query: str, k: int = 3) -> List[SearchHit]:
|
|
82
|
+
"""Structured results for chaining and UI."""
|
|
83
|
+
return [
|
|
84
|
+
{"title": f"{query} {i}", "url": f"https://example.com/{i}", "score": 0.9 - i*0.1}
|
|
85
|
+
for i in range(k)
|
|
86
|
+
]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Real output**
|
|
90
|
+
|
|
91
|
+
```pycon
|
|
92
|
+
>>> agent("search_hits('vector db')")
|
|
93
|
+
[
|
|
94
|
+
{"title": "vector db 0", "url": "https://example.com/0", "score": 0.9},
|
|
95
|
+
{"title": "vector db 1", "url": "https://example.com/1", "score": 0.8},
|
|
96
|
+
{"title": "vector db 2", "url": "https://example.com/2", "score": 0.7}
|
|
97
|
+
]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### How Tool Schemas Are Generated
|
|
101
|
+
|
|
102
|
+
ConnectOnion automatically converts Python functions into tool schemas for the LLM.
|
|
103
|
+
|
|
104
|
+
**Your Python function:**
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
def search(query: str, limit: int = 10) -> list[str]:
|
|
108
|
+
# ^^^^^^ ^^^^^ ^^^ ^^^^^ ^^^ ^^
|
|
109
|
+
# | | | | | └── has default → not required
|
|
110
|
+
# | | | | └────── int → "integer"
|
|
111
|
+
# | | | └──────────── parameter name
|
|
112
|
+
# | | └────────────────── str → "string"
|
|
113
|
+
# | └──────────────────────── parameter name
|
|
114
|
+
# └──────────────────────────────── function name
|
|
115
|
+
"""Search the web for information.
|
|
116
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
117
|
+
# └── first paragraph → description
|
|
118
|
+
|
|
119
|
+
Args:
|
|
120
|
+
query: The search query string.
|
|
121
|
+
limit: Maximum results to return.
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
List of search result titles.
|
|
125
|
+
"""
|
|
126
|
+
# ↑ Args and Returns sections are NOT sent to LLM (saves tokens)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**JSON schema sent to LLM:**
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
{
|
|
133
|
+
"name": "search", ← function.__name__
|
|
134
|
+
"description": "Search the web...", ← first paragraph of docstring
|
|
135
|
+
"parameters": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"properties": {
|
|
138
|
+
"query": {"type": "string"}, ← query: str
|
|
139
|
+
"limit": {"type": "integer"} ← limit: int
|
|
140
|
+
},
|
|
141
|
+
"required": ["query"] ← no default value
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Why this minimal approach?**
|
|
147
|
+
- Docstrings serve many purposes (IDE hints, Sphinx docs, etc.)
|
|
148
|
+
- We only extract what the LLM needs - no confusion, fewer tokens
|
|
149
|
+
- Everything is optional - no docstring is fine too
|
|
150
|
+
|
|
151
|
+
**No docstring? Also fine:**
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
def add(a: int, b: int) -> int:
|
|
155
|
+
return a + b
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Description defaults to `"Execute the add tool."`
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Stateful Tools (class-based tools)
|
|
163
|
+
|
|
164
|
+
**✅ RECOMMENDED: Pass the class instance directly to ConnectOnion!**
|
|
165
|
+
|
|
166
|
+
ConnectOnion automatically discovers all public methods with type hints when you pass a class instance. This is much cleaner than listing methods individually.
|
|
167
|
+
|
|
168
|
+
Use class instances when tools need shared state, caching, or resources.
|
|
169
|
+
|
|
170
|
+
### Browser automation with Playwright (navigate, screenshot, tabs)
|
|
171
|
+
|
|
172
|
+
Requirements:
|
|
173
|
+
|
|
174
|
+
- Install Playwright and browsers: `pip install playwright` then `playwright install`
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
from typing import List, Optional
|
|
178
|
+
from connectonion import Agent
|
|
179
|
+
|
|
180
|
+
try:
|
|
181
|
+
from playwright.sync_api import sync_playwright, Page
|
|
182
|
+
except ImportError:
|
|
183
|
+
raise SystemExit("Install Playwright: pip install playwright && playwright install")
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class Browser:
|
|
187
|
+
"""Persistent browser session with navigation, screenshots, and tab control."""
|
|
188
|
+
|
|
189
|
+
def __init__(self):
|
|
190
|
+
self._p = None
|
|
191
|
+
self._browser = None
|
|
192
|
+
self._pages: dict[str, Page] = {}
|
|
193
|
+
self._active_tab: Optional[str] = None
|
|
194
|
+
|
|
195
|
+
def start(self, headless: bool = True) -> str:
|
|
196
|
+
"""Start the browser session and open the first tab named 'main'."""
|
|
197
|
+
self._p = sync_playwright().start()
|
|
198
|
+
self._browser = self._p.chromium.launch(headless=headless)
|
|
199
|
+
self._pages["main"] = self._browser.new_page()
|
|
200
|
+
self._active_tab = "main"
|
|
201
|
+
return f"Browser started (headless={headless}) with tab 'main'"
|
|
202
|
+
|
|
203
|
+
def new_tab(self, name: str) -> str:
|
|
204
|
+
"""Open a new tab with a friendly name, e.g., 'docs' or 'shop'."""
|
|
205
|
+
if not self._browser:
|
|
206
|
+
return "Error: Browser not started. Call start() first."
|
|
207
|
+
if name in self._pages:
|
|
208
|
+
return f"Tab '{name}' already exists"
|
|
209
|
+
self._pages[name] = self._browser.new_page()
|
|
210
|
+
self._active_tab = name
|
|
211
|
+
return f"Opened tab '{name}'"
|
|
212
|
+
|
|
213
|
+
def list_tabs(self) -> List[str]:
|
|
214
|
+
"""List available tab names."""
|
|
215
|
+
return list(self._pages.keys())
|
|
216
|
+
|
|
217
|
+
def switch_tab(self, name: str) -> str:
|
|
218
|
+
"""Switch the active tab by name."""
|
|
219
|
+
if name not in self._pages:
|
|
220
|
+
return f"Error: No tab named '{name}'"
|
|
221
|
+
self._active_tab = name
|
|
222
|
+
return f"Switched to tab '{name}'"
|
|
223
|
+
|
|
224
|
+
def goto(self, url: str, tab: Optional[str] = None) -> str:
|
|
225
|
+
"""Navigate the active (or specified) tab to a URL and return the page title."""
|
|
226
|
+
if not self._pages:
|
|
227
|
+
return "Error: Browser not started. Call start() first."
|
|
228
|
+
target = tab or self._active_tab
|
|
229
|
+
page = self._pages[target]
|
|
230
|
+
page.goto(url)
|
|
231
|
+
return page.title()
|
|
232
|
+
|
|
233
|
+
def screenshot(self, path: Optional[str] = None, tab: Optional[str] = None) -> str:
|
|
234
|
+
"""Save a PNG screenshot of the active (or specified) tab and return the filename."""
|
|
235
|
+
if not self._pages:
|
|
236
|
+
return "Error: Browser not started. Call start() first."
|
|
237
|
+
target = tab or self._active_tab
|
|
238
|
+
page = self._pages[target]
|
|
239
|
+
filename = path or f"{target}_screenshot.png"
|
|
240
|
+
page.screenshot(path=filename)
|
|
241
|
+
return filename
|
|
242
|
+
|
|
243
|
+
def close_tab(self, name: str) -> str:
|
|
244
|
+
"""Close a tab by name."""
|
|
245
|
+
if name not in self._pages:
|
|
246
|
+
return f"Error: No tab named '{name}'"
|
|
247
|
+
self._pages[name].close()
|
|
248
|
+
del self._pages[name]
|
|
249
|
+
if self._active_tab == name:
|
|
250
|
+
self._active_tab = next(iter(self._pages), None)
|
|
251
|
+
return f"Closed tab '{name}'"
|
|
252
|
+
|
|
253
|
+
def close(self) -> None:
|
|
254
|
+
"""Close all tabs and stop the browser."""
|
|
255
|
+
for page in list(self._pages.values()):
|
|
256
|
+
page.close()
|
|
257
|
+
self._pages.clear()
|
|
258
|
+
if self._browser:
|
|
259
|
+
self._browser.close()
|
|
260
|
+
if self._p:
|
|
261
|
+
self._p.stop()
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
browser = Browser()
|
|
265
|
+
|
|
266
|
+
# ✅ BEST PRACTICE: Pass the class instance directly!
|
|
267
|
+
# ConnectOnion automatically extracts all public methods as tools
|
|
268
|
+
agent = Agent(
|
|
269
|
+
"helper",
|
|
270
|
+
tools=[browser], # Just pass the instance - ConnectOnion does the rest!
|
|
271
|
+
max_iterations=15 # Browser automation often needs more steps
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
# With an LLM, the agent can use natural language prompts to decide which tools to call and in what order.
|
|
275
|
+
# For example, you can give the agent a high-level instruction and it will use the available tools to accomplish the task:
|
|
276
|
+
|
|
277
|
+
response = agent("Open https://example.com, take a screenshot, then open a new tab to https://playwright.dev and screenshot that too. List all open tabs at the end.")
|
|
278
|
+
print(response)
|
|
279
|
+
browser.close()
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Todo list
|
|
283
|
+
|
|
284
|
+
```python
|
|
285
|
+
class TodoList:
|
|
286
|
+
"""Simple todo list with add/list."""
|
|
287
|
+
def __init__(self):
|
|
288
|
+
self._items: list[str] = []
|
|
289
|
+
|
|
290
|
+
def add(self, text: str) -> None:
|
|
291
|
+
"""Add a new todo item."""
|
|
292
|
+
self._items.append(text)
|
|
293
|
+
|
|
294
|
+
def list(self) -> list[str]:
|
|
295
|
+
"""Return all todo items."""
|
|
296
|
+
return self._items
|
|
297
|
+
|
|
298
|
+
todos = TodoList()
|
|
299
|
+
|
|
300
|
+
# ✅ Two approaches - class instance is cleaner:
|
|
301
|
+
# Option 1: Pass individual methods (more verbose)
|
|
302
|
+
agent_verbose = Agent("helper", tools=[todos.add, todos.list], max_iterations=10)
|
|
303
|
+
|
|
304
|
+
# Option 2: Pass class instance (recommended - cleaner!)
|
|
305
|
+
agent = Agent("helper", tools=[todos], max_iterations=10)
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**Real session**
|
|
309
|
+
|
|
310
|
+
```pycon
|
|
311
|
+
>>> agent("add('buy milk')")
|
|
312
|
+
>>> agent("add('book flights')")
|
|
313
|
+
>>> agent("list()")
|
|
314
|
+
['buy milk', 'book flights']
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Resource management
|
|
318
|
+
|
|
319
|
+
Own the lifecycle. Close things you open. The `Browser` class above
|
|
320
|
+
exposes a `close()` method and uses `try/finally` to guarantee cleanup.
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Advanced Patterns
|
|
325
|
+
|
|
326
|
+
### Tool composition
|
|
327
|
+
|
|
328
|
+
Small tools compose into bigger moves.
|
|
329
|
+
|
|
330
|
+
```python
|
|
331
|
+
def pick_top(hit_list: list[dict]) -> dict:
|
|
332
|
+
"""Choose the highest score item."""
|
|
333
|
+
return max(hit_list, key=lambda h: h["score"])
|
|
334
|
+
|
|
335
|
+
def search_then_pick(query: str) -> dict:
|
|
336
|
+
"""Search then pick the best hit."""
|
|
337
|
+
hits = search_hits(query, k=5)
|
|
338
|
+
return pick_top(hits)
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Output**
|
|
342
|
+
|
|
343
|
+
```pycon
|
|
344
|
+
>>> agent("search_then_pick('weaviate vs pgvector')")
|
|
345
|
+
{'title': 'weaviate vs pgvector 0', 'url': 'https://example.com/0', 'score': 0.9}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Custom tool schemas
|
|
349
|
+
|
|
350
|
+
Expose structured inputs with clear constraints.
|
|
351
|
+
|
|
352
|
+
```python
|
|
353
|
+
from dataclasses import dataclass
|
|
354
|
+
from typing import Annotated, Literal
|
|
355
|
+
|
|
356
|
+
Priority = Literal["low", "normal", "high"]
|
|
357
|
+
|
|
358
|
+
@dataclass
|
|
359
|
+
class Ticket:
|
|
360
|
+
title: str
|
|
361
|
+
description: str
|
|
362
|
+
priority: Priority
|
|
363
|
+
assignee: Annotated[str, "email"]
|
|
364
|
+
|
|
365
|
+
def create_ticket(t: Ticket) -> dict:
|
|
366
|
+
"""Create a ticket and return its metadata."""
|
|
367
|
+
return {"id": "T-1024", "title": t.title, "priority": t.priority, "assignee": t.assignee}
|
|
368
|
+
|
|
369
|
+
agent = Agent(
|
|
370
|
+
"helper",
|
|
371
|
+
tools=[create_ticket],
|
|
372
|
+
max_iterations=5 # Ticket creation is straightforward
|
|
373
|
+
)
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
**Schema (example)**
|
|
377
|
+
|
|
378
|
+
```json
|
|
379
|
+
{
|
|
380
|
+
"name": "create_ticket",
|
|
381
|
+
"input": {
|
|
382
|
+
"type": "object",
|
|
383
|
+
"properties": {
|
|
384
|
+
"title": {"type": "string"},
|
|
385
|
+
"description": {"type": "string"},
|
|
386
|
+
"priority": {"enum": ["low", "normal", "high"]},
|
|
387
|
+
"assignee": {"type": "string", "format": "email"}
|
|
388
|
+
},
|
|
389
|
+
"required": ["title", "description", "priority", "assignee"]
|
|
390
|
+
},
|
|
391
|
+
"returns": {"type": "object"}
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## Tool Development Guide
|
|
398
|
+
|
|
399
|
+
### Design rules
|
|
400
|
+
|
|
401
|
+
* One job per tool. Names are verbs: `search`, `summarize`, `create_ticket`.
|
|
402
|
+
* Clean signatures. Prefer primitives and TypedDict/dataclass for structure.
|
|
403
|
+
* First docstring line explains the value in plain language.
|
|
404
|
+
* Deterministic by default. Document non-determinism.
|
|
405
|
+
|
|
406
|
+
### Error handling
|
|
407
|
+
|
|
408
|
+
* Validate inputs. Raise clear exceptions. Return helpful messages.
|
|
409
|
+
* Timeouts for IO. Circuit-breakers for flaky deps.
|
|
410
|
+
* Log stack traces during development.
|
|
411
|
+
|
|
412
|
+
### Performance
|
|
413
|
+
|
|
414
|
+
* Cache pure functions.
|
|
415
|
+
* Batch remote calls.
|
|
416
|
+
* Stream large outputs when useful.
|
|
417
|
+
|
|
418
|
+
### Security
|
|
419
|
+
|
|
420
|
+
* Treat inputs as untrusted.
|
|
421
|
+
* Sanitize shell/SQL/HTML.
|
|
422
|
+
* Scope credentials. Rotate secrets. Audit access.
|
|
423
|
+
|
|
424
|
+
### Testing
|
|
425
|
+
|
|
426
|
+
* Unit-test each tool. Avoid network in tests.
|
|
427
|
+
* Golden tests for outputs.
|
|
428
|
+
* Fuzz inputs for robustness.
|
|
429
|
+
|
|
430
|
+
### Versioning and deprecation
|
|
431
|
+
|
|
432
|
+
* Add `version="1.2.0"` metadata when behavior changes.
|
|
433
|
+
* Keep old signatures working until removal.
|
|
434
|
+
* Announce removals with dates.
|
|
435
|
+
|
|
436
|
+
### Authoring checklist
|
|
437
|
+
|
|
438
|
+
* [ ] Clear name and one-liner
|
|
439
|
+
* [ ] Explicit types
|
|
440
|
+
* [ ] Real output example
|
|
441
|
+
* [ ] Errors handled
|
|
442
|
+
* [ ] Tests written
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## Appendix: Patterns at a glance
|
|
447
|
+
|
|
448
|
+
* **Function tool** → simplest path to value.
|
|
449
|
+
* **Class tool** → shared state, caching, external handles.
|
|
450
|
+
* **Composition** → small tools, big outcomes.
|
|
451
|
+
* **Custom schemas** → robust interfaces and UIs.
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
## FAQ: How tools are discovered and used
|
|
456
|
+
|
|
457
|
+
- Tool schemas are built from function name, type hints, and first paragraph of docstring
|
|
458
|
+
- Args/Returns sections in docstrings are NOT sent to LLM (saves tokens)
|
|
459
|
+
- No docstring? That's fine - description defaults to "Execute the {name} tool."
|
|
460
|
+
- **✅ For class-based tools: Pass the instance directly!** ConnectOnion auto-discovers all public methods with type hints
|
|
461
|
+
- You can always call `agent.tools.tool_name.run(**kwargs)` to run tools without an LLM.
|
|
462
|
+
|
|
463
|
+
## Class Instance vs Individual Methods
|
|
464
|
+
|
|
465
|
+
**✅ RECOMMENDED (Clean & Automatic):**
|
|
466
|
+
```python
|
|
467
|
+
browser = BrowserAutomation()
|
|
468
|
+
agent = Agent("browser_agent", tools=[browser]) # Auto-discovers all methods!
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
**❌ VERBOSE (Works but not recommended):**
|
|
472
|
+
```python
|
|
473
|
+
browser = BrowserAutomation()
|
|
474
|
+
agent = Agent("browser_agent", tools=[
|
|
475
|
+
browser.start_browser,
|
|
476
|
+
browser.navigate,
|
|
477
|
+
browser.take_screenshot,
|
|
478
|
+
browser.scrape_content,
|
|
479
|
+
# ... list every method manually
|
|
480
|
+
])
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
ConnectOnion's class instance support makes your code much cleaner and more maintainable!
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
## Built-in Tools
|
|
488
|
+
|
|
489
|
+
ConnectOnion provides ready-to-use tools. See [useful_tools/](useful_tools/) for full documentation.
|
|
490
|
+
|
|
491
|
+
| Tool | Purpose |
|
|
492
|
+
|------|---------|
|
|
493
|
+
| [Shell](useful_tools/shell.md) | Execute shell commands |
|
|
494
|
+
| [DiffWriter](useful_tools/diff_writer.md) | Edit files with diffs |
|
|
495
|
+
| [TodoList](useful_tools/todo_list.md) | Track task progress |
|
|
496
|
+
| [WebFetch](useful_tools/web_fetch.md) | Fetch web content |
|
|
497
|
+
| [Gmail](useful_tools/gmail.md) | Gmail integration |
|
|
498
|
+
| [Outlook](useful_tools/outlook.md) | Outlook integration |
|
|
499
|
+
| [GoogleCalendar](useful_tools/google_calendar.md) | Google Calendar |
|
|
500
|
+
| [MicrosoftCalendar](useful_tools/microsoft_calendar.md) | Microsoft Calendar |
|
|
501
|
+
| [Memory](useful_tools/memory.md) | Persistent storage |
|
|
502
|
+
| [Terminal](useful_tools/terminal.md) | Interactive terminal |
|
|
503
|
+
| [SlashCommand](useful_tools/slash_command.md) | Custom commands |
|
|
504
|
+
|
|
505
|
+
```python
|
|
506
|
+
from connectonion import Agent, Shell, Gmail
|
|
507
|
+
|
|
508
|
+
shell = Shell()
|
|
509
|
+
gmail = Gmail()
|
|
510
|
+
|
|
511
|
+
agent = Agent("assistant", tools=[shell, gmail])
|
|
512
|
+
```
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Audio Transcription
|
|
2
|
+
|
|
3
|
+
Convert audio files to text using Gemini's multimodal capabilities. Simple one-function interface for transcription.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from connectonion import transcribe
|
|
9
|
+
|
|
10
|
+
# Simple transcription (uses OpenOnion managed keys)
|
|
11
|
+
text = transcribe("meeting.mp3")
|
|
12
|
+
print(text)
|
|
13
|
+
|
|
14
|
+
# With your own Gemini API key
|
|
15
|
+
text = transcribe("meeting.mp3", model="gemini-3-flash-preview")
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
That's it! One function for audio-to-text.
|
|
19
|
+
|
|
20
|
+
## With Context Hints
|
|
21
|
+
|
|
22
|
+
Improve accuracy for domain-specific terms:
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
# Technical meeting with specific names
|
|
26
|
+
text = transcribe(
|
|
27
|
+
"standup.mp3",
|
|
28
|
+
prompt="Technical AI discussion. Names: Aaron, Lisa. Terms: ConnectOnion, OpenOnion"
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# Medical transcription
|
|
32
|
+
text = transcribe(
|
|
33
|
+
"consultation.mp3",
|
|
34
|
+
prompt="Medical consultation. Terms: hypertension, metformin, CBC"
|
|
35
|
+
)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## With Timestamps
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
text = transcribe("podcast.mp3", timestamps=True)
|
|
42
|
+
# Output: "[00:00] Welcome to the show...\n[00:15] Today we're discussing..."
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Real Examples
|
|
46
|
+
|
|
47
|
+
### Meeting Minutes
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
def get_meeting_minutes(audio_path: str) -> str:
|
|
51
|
+
"""Transcribe and summarize a meeting."""
|
|
52
|
+
from connectonion import transcribe, llm_do
|
|
53
|
+
|
|
54
|
+
# Step 1: Transcribe
|
|
55
|
+
transcript = transcribe(audio_path, prompt="Business meeting")
|
|
56
|
+
|
|
57
|
+
# Step 2: Summarize
|
|
58
|
+
summary = llm_do(
|
|
59
|
+
transcript,
|
|
60
|
+
system_prompt="Extract action items and key decisions as bullet points."
|
|
61
|
+
)
|
|
62
|
+
return summary
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Voice Notes Processing
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from pathlib import Path
|
|
69
|
+
|
|
70
|
+
def process_voice_notes(folder: str) -> list[str]:
|
|
71
|
+
"""Transcribe all voice notes in a folder."""
|
|
72
|
+
from connectonion import transcribe
|
|
73
|
+
|
|
74
|
+
results = []
|
|
75
|
+
for audio in Path(folder).glob("*.mp3"):
|
|
76
|
+
text = transcribe(str(audio))
|
|
77
|
+
results.append(f"# {audio.stem}\n{text}")
|
|
78
|
+
return results
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Use as Agent Tool
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from connectonion import Agent, transcribe
|
|
85
|
+
|
|
86
|
+
def transcribe_audio(file_path: str) -> str:
|
|
87
|
+
"""Transcribe an audio file to text."""
|
|
88
|
+
return transcribe(file_path)
|
|
89
|
+
|
|
90
|
+
agent = Agent("assistant", tools=[transcribe_audio])
|
|
91
|
+
result = agent.input("Transcribe the file meeting.mp3 and summarize it")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Parameters
|
|
95
|
+
|
|
96
|
+
| Parameter | Type | Default | Description |
|
|
97
|
+
|-----------|------|---------|-------------|
|
|
98
|
+
| `audio` | str | required | Path to audio file |
|
|
99
|
+
| `prompt` | str | None | Context hints for accuracy |
|
|
100
|
+
| `model` | str | "co/gemini-3-flash-preview" | Model to use |
|
|
101
|
+
| `timestamps` | bool | False | Include timestamps in output |
|
|
102
|
+
|
|
103
|
+
## Supported Formats
|
|
104
|
+
|
|
105
|
+
- WAV, MP3, AIFF, AAC, OGG, FLAC, M4A, WebM
|
|
106
|
+
|
|
107
|
+
**Token cost:** 32 tokens per second of audio (1 minute = 1,920 tokens)
|
|
108
|
+
|
|
109
|
+
## Models
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
# OpenOnion managed keys (default - no API key needed)
|
|
113
|
+
transcribe("audio.mp3", model="co/gemini-3-flash-preview")
|
|
114
|
+
transcribe("audio.mp3", model="co/gemini-2.5-flash")
|
|
115
|
+
|
|
116
|
+
# Your own Gemini API key (set GEMINI_API_KEY)
|
|
117
|
+
transcribe("audio.mp3", model="gemini-3-flash-preview")
|
|
118
|
+
transcribe("audio.mp3", model="gemini-2.5-flash")
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Error Handling
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from connectonion import transcribe
|
|
125
|
+
|
|
126
|
+
try:
|
|
127
|
+
text = transcribe("nonexistent.mp3")
|
|
128
|
+
except FileNotFoundError:
|
|
129
|
+
print("Audio file not found")
|
|
130
|
+
except ValueError as e:
|
|
131
|
+
print(f"API error: {e}")
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Comparison with Agent
|
|
135
|
+
|
|
136
|
+
| Feature | `transcribe()` | `Agent()` |
|
|
137
|
+
|---------|----------------|-----------|
|
|
138
|
+
| Purpose | Audio to text | Multi-step workflows |
|
|
139
|
+
| Input | Audio files | Text prompts |
|
|
140
|
+
| Output | Plain text | Agent responses |
|
|
141
|
+
| Best for | Transcription | Complex tasks |
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
# Use transcribe() for audio-to-text
|
|
145
|
+
text = transcribe("meeting.mp3")
|
|
146
|
+
|
|
147
|
+
# Use Agent for complex workflows with multiple tools
|
|
148
|
+
agent = Agent("assistant", tools=[search, calculate])
|
|
149
|
+
result = agent.input("Research and analyze...")
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Next Steps
|
|
153
|
+
|
|
154
|
+
- Learn about [llm_do()](concepts/llm_do.md) for one-shot LLM calls
|
|
155
|
+
- Explore [Agents](concepts/agent.md) for multi-step workflows
|
|
156
|
+
- See [Tools](concepts/tools.md) for extending agents
|