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,510 @@
|
|
|
1
|
+
# Design Decision: Hook System for Agent Lifecycle Events
|
|
2
|
+
|
|
3
|
+
**Status:** RFC (Community Vote in Progress)
|
|
4
|
+
**Date:** 2025-10-22
|
|
5
|
+
**Decision Makers:** Core team + Community
|
|
6
|
+
**Related:** [Issue #31](https://github.com/openonion/connectonion/issues/31), [Discussion #33](https://github.com/openonion/connectonion/discussions/33)
|
|
7
|
+
|
|
8
|
+
> **Note:** This document is historical. The event naming has been updated in [014-event-api-naming.md](./014-event-api-naming.md):
|
|
9
|
+
> - `before_tool` → `before_each_tool` (per-tool)
|
|
10
|
+
> - `after_tool` → `after_tools` (batch, fires once after all tools)
|
|
11
|
+
> - New: `after_each_tool` (per-tool), `before_tools` (batch)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## The Problem
|
|
16
|
+
|
|
17
|
+
Users needed a way to observe and modify agent behavior at key lifecycle points:
|
|
18
|
+
|
|
19
|
+
**Real Use Cases:**
|
|
20
|
+
- Track token usage and costs across LLM calls
|
|
21
|
+
- Cache expensive tool results to avoid re-execution
|
|
22
|
+
- Add timestamps or context to prompts before LLM sees them
|
|
23
|
+
- Custom logging and monitoring for production deployments
|
|
24
|
+
- Implement retry logic or rate limiting
|
|
25
|
+
|
|
26
|
+
**The Challenge:** How do we add this power without making the simple case complex?
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Our Design Journey
|
|
31
|
+
|
|
32
|
+
### Starting Point: "We Need Hooks"
|
|
33
|
+
|
|
34
|
+
The initial idea was simple: add a hook system like Flask or Express.js. But which API?
|
|
35
|
+
|
|
36
|
+
We explored **four fundamentally different approaches**, each with different trade-offs.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## The Options We Explored
|
|
41
|
+
|
|
42
|
+
### Option 1: Constructor Hooks (Dict Format)
|
|
43
|
+
|
|
44
|
+
**The Idea:** Pass hooks as a dictionary grouped by event type.
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
agent = Agent(
|
|
48
|
+
"assistant",
|
|
49
|
+
tools=[search],
|
|
50
|
+
hooks={
|
|
51
|
+
'before_llm': [add_timestamp],
|
|
52
|
+
'after_llm': [log_tokens, track_cost],
|
|
53
|
+
'after_tool': [cache_results],
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Why We Liked It:**
|
|
59
|
+
- ✅ All configuration in one place (declarative)
|
|
60
|
+
- ✅ Easy to see what hooks are active
|
|
61
|
+
- ✅ Reusable across agents (`common_hooks = {...}`)
|
|
62
|
+
- ✅ Perfect for "deploy once, runs everywhere" use case
|
|
63
|
+
- ✅ Familiar dict pattern - everyone knows `{key: [values]}`
|
|
64
|
+
|
|
65
|
+
**The Concern:**
|
|
66
|
+
- ❌ String keys can be misspelled (`'after_llm'` vs `'after-llm'`)
|
|
67
|
+
- ❌ No autocomplete for event names
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### Option 2: Event Wrappers (List Format)
|
|
72
|
+
|
|
73
|
+
**The Idea:** Wrap functions to mark their timing, pass as a list.
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from connectonion import before_llm, after_llm, after_tool
|
|
77
|
+
|
|
78
|
+
agent = Agent(
|
|
79
|
+
"assistant",
|
|
80
|
+
tools=[search],
|
|
81
|
+
hooks=[
|
|
82
|
+
before_llm(add_timestamp),
|
|
83
|
+
after_llm(log_tokens),
|
|
84
|
+
after_tool(cache_results),
|
|
85
|
+
]
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Why We Liked It:**
|
|
90
|
+
- ✅ Autocomplete - IDE suggests `before_llm`, `after_llm`
|
|
91
|
+
- ✅ Can't misspell - it's a function import
|
|
92
|
+
- ✅ **Perfect for plugins:** "import and it works"
|
|
93
|
+
```python
|
|
94
|
+
from connectonion.thinking import chain_of_thought
|
|
95
|
+
hooks=[chain_of_thought()] # Just works!
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**The Struggle:** Should it be `on_event=[]` or `hooks=[]`?
|
|
99
|
+
|
|
100
|
+
Initially we thought `on_event` was more descriptive ("on event, do this"), but then we realized:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
# This reads weird:
|
|
104
|
+
on_event=[chain_of_thought()] # "On event, chain of thought"??
|
|
105
|
+
|
|
106
|
+
# This reads naturally:
|
|
107
|
+
hooks=[chain_of_thought()] # "These hooks: chain of thought" ✅
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Key Insight:** When passing noun-like things (plugins, features), `hooks` works better than `on_event`. Grammar matters!
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### Option 3: Decorator Pattern
|
|
115
|
+
|
|
116
|
+
**The Idea:** Mark functions with `@hook('event_name')`, then pass to agent.
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from connectonion import hook
|
|
120
|
+
|
|
121
|
+
@hook('before_llm')
|
|
122
|
+
def add_timestamp(data):
|
|
123
|
+
from datetime import datetime
|
|
124
|
+
data['messages'].append({'role': 'system', 'content': f'{datetime.now()}'})
|
|
125
|
+
return data
|
|
126
|
+
|
|
127
|
+
@hook('after_llm')
|
|
128
|
+
def log_tokens(data):
|
|
129
|
+
print(f"Tokens: {data['usage']['total_tokens']}")
|
|
130
|
+
|
|
131
|
+
agent = Agent("assistant", tools=[search],
|
|
132
|
+
hooks=[add_timestamp, log_tokens])
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Why We Liked It:**
|
|
136
|
+
- ✅ Familiar pattern (like `@xray`, `@replay`)
|
|
137
|
+
- ✅ Reusable across modules
|
|
138
|
+
- ✅ Self-documenting (decorator tells you when it runs)
|
|
139
|
+
|
|
140
|
+
**The Problem:**
|
|
141
|
+
- ❌ Two-step process: decorate + pass to agent
|
|
142
|
+
- ❌ Less obvious than Options 1 or 2
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### Option 4: Event Emitter (Dynamic Methods)
|
|
147
|
+
|
|
148
|
+
**The Idea:** Add hooks after agent creation with `agent.on()`.
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
agent = Agent("assistant", tools=[search])
|
|
152
|
+
|
|
153
|
+
# Simple lambda
|
|
154
|
+
agent.on('after_llm', lambda d: print(f"Tokens: {d['usage']}"))
|
|
155
|
+
|
|
156
|
+
# Decorator syntax
|
|
157
|
+
@agent.on('before_llm')
|
|
158
|
+
def add_timestamp(data):
|
|
159
|
+
from datetime import datetime
|
|
160
|
+
data['messages'].append({'role': 'system', 'content': f'{datetime.now()}'})
|
|
161
|
+
return data
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Why We Liked It:**
|
|
165
|
+
- ✅ Familiar to JavaScript/Node.js developers
|
|
166
|
+
- ✅ Dynamic add/remove (`agent.off('after_llm', hook)`)
|
|
167
|
+
- ✅ Discoverable with autocomplete
|
|
168
|
+
|
|
169
|
+
**Why We Were Skeptical:**
|
|
170
|
+
- ❌ Hooks scattered throughout code (not declarative)
|
|
171
|
+
- ❌ Doesn't match "deploy once" philosophy
|
|
172
|
+
- ❌ Harder to track what hooks are active
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## The Struggles
|
|
177
|
+
|
|
178
|
+
### Struggle #1: Too Many Parameters
|
|
179
|
+
|
|
180
|
+
Initial attempt at separate parameters per hook type:
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
agent = Agent(
|
|
184
|
+
"assistant",
|
|
185
|
+
tools=[search],
|
|
186
|
+
system_prompt="...",
|
|
187
|
+
model="gpt-4",
|
|
188
|
+
before_llm_calls=[...], # Too many!
|
|
189
|
+
after_llm_calls=[...], # Too many!
|
|
190
|
+
before_tool_calls=[...], # Too many!
|
|
191
|
+
after_tool_calls=[...], # Too many!
|
|
192
|
+
before_input_calls=[...], # Too many!
|
|
193
|
+
after_output_calls=[...], # Too many!
|
|
194
|
+
on_errors=[...], # Too many!
|
|
195
|
+
)
|
|
196
|
+
# This is overwhelming! 😱
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Solution:** Group all hooks under a single parameter (`hooks`), let format (dict vs list) determine style.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### Struggle #2: Naming Ambiguity
|
|
204
|
+
|
|
205
|
+
**The Problem:**
|
|
206
|
+
```python
|
|
207
|
+
hooks={'after_tool': [my_func]}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Does this run after **each tool** or **all tools complete**?
|
|
211
|
+
|
|
212
|
+
**Solution:** Be explicit in documentation - "after_tool" means "after each tool execution".
|
|
213
|
+
|
|
214
|
+
We considered `after_each_tool` but decided the shorter name was clearer with good docs.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
### Struggle #3: Discoverability vs Simplicity
|
|
219
|
+
|
|
220
|
+
**The Tension:**
|
|
221
|
+
- Option 1 (dict): Simple but no autocomplete
|
|
222
|
+
- Option 2 (wrappers): Autocomplete but requires imports
|
|
223
|
+
- Option 4 (methods): Discoverable but not declarative
|
|
224
|
+
|
|
225
|
+
**Our Conclusion:** Offer both Options 1 and 2, let users choose based on their needs.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Key Insights
|
|
230
|
+
|
|
231
|
+
### Insight 1: Different Users, Different Needs
|
|
232
|
+
|
|
233
|
+
**Beginner users (80%):**
|
|
234
|
+
- Just want logging or token tracking
|
|
235
|
+
- Need simple, obvious API
|
|
236
|
+
- Don't want to learn "hooks" concept
|
|
237
|
+
- → **Option 1 (dict)** is perfect
|
|
238
|
+
|
|
239
|
+
**Power users (15%):**
|
|
240
|
+
- Building reusable plugins
|
|
241
|
+
- Want autocomplete and type safety
|
|
242
|
+
- Comfortable with imports
|
|
243
|
+
- → **Option 2 (wrappers)** is perfect
|
|
244
|
+
|
|
245
|
+
**Framework developers (5%):**
|
|
246
|
+
- Want dynamic control
|
|
247
|
+
- Need to add/remove hooks at runtime
|
|
248
|
+
- → **Option 4 (methods)** is perfect
|
|
249
|
+
|
|
250
|
+
### Insight 2: Deployment Patterns Matter
|
|
251
|
+
|
|
252
|
+
User quote: *"I want it deployed, each time will be same"*
|
|
253
|
+
|
|
254
|
+
This told us:
|
|
255
|
+
- Configuration should be declarative (visible upfront)
|
|
256
|
+
- Constructor-based (Options 1, 2) better than method-based (Option 4)
|
|
257
|
+
- Reusability is critical (`common_hooks` pattern)
|
|
258
|
+
|
|
259
|
+
### Insight 3: Grammar Reveals Intent
|
|
260
|
+
|
|
261
|
+
The `on_event` vs `hooks` debate taught us:
|
|
262
|
+
- Parameter names should work with **any** value, not just simple functions
|
|
263
|
+
- `hooks=[chain_of_thought()]` reads naturally
|
|
264
|
+
- `on_event=[chain_of_thought()]` reads awkwardly
|
|
265
|
+
- **Grammar matters for API design!**
|
|
266
|
+
|
|
267
|
+
### Insight 4: Format Auto-Detection is Powerful
|
|
268
|
+
|
|
269
|
+
Same parameter, different formats:
|
|
270
|
+
|
|
271
|
+
```python
|
|
272
|
+
# Agent detects format by type
|
|
273
|
+
hooks={'after_llm': [...]} # Dict → Option 1
|
|
274
|
+
hooks=[after_llm(...)] # List → Option 2
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
This gives us:
|
|
278
|
+
- Single parameter to learn (`hooks`)
|
|
279
|
+
- Multiple styles for different use cases
|
|
280
|
+
- No confusion (format is obvious from syntax)
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## Our Recommendations
|
|
285
|
+
|
|
286
|
+
### Primary Recommendation: **Support Options 1 & 2**
|
|
287
|
+
|
|
288
|
+
**Option 1 for everyday use:**
|
|
289
|
+
```python
|
|
290
|
+
agent = Agent("assistant", tools=[search], hooks={
|
|
291
|
+
'after_llm': [log_tokens],
|
|
292
|
+
'after_tool': [cache_results],
|
|
293
|
+
})
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Option 2 for plugin ecosystem:**
|
|
297
|
+
```python
|
|
298
|
+
from connectonion.thinking import chain_of_thought
|
|
299
|
+
|
|
300
|
+
agent = Agent("assistant", tools=[search], hooks=[
|
|
301
|
+
chain_of_thought()
|
|
302
|
+
])
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Why both?**
|
|
306
|
+
- Same parameter (`hooks`), different formats
|
|
307
|
+
- Serves different user needs
|
|
308
|
+
- Simple auto-detection by type
|
|
309
|
+
- Most flexible approach
|
|
310
|
+
|
|
311
|
+
### Secondary Options: Available but not primary
|
|
312
|
+
|
|
313
|
+
**Option 3 (decorators):** Useful for organizing code, but less intuitive than 1 & 2.
|
|
314
|
+
|
|
315
|
+
**Option 4 (methods):** Good for dynamic use cases, but doesn't fit "deploy once" pattern.
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## What Hooks Receive
|
|
320
|
+
|
|
321
|
+
Each hook gets a `data` dictionary with relevant context:
|
|
322
|
+
|
|
323
|
+
### `before_llm(data)`
|
|
324
|
+
```python
|
|
325
|
+
{
|
|
326
|
+
'messages': [...], # Conversation history
|
|
327
|
+
'tools': [...], # Available tool schemas
|
|
328
|
+
'iteration': 1, # Current iteration
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### `after_llm(data)`
|
|
333
|
+
```python
|
|
334
|
+
{
|
|
335
|
+
'response': LLMResponse,
|
|
336
|
+
'usage': {'total_tokens': 150, ...},
|
|
337
|
+
'timing': 234.5, # milliseconds
|
|
338
|
+
'iteration': 1,
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### `before_tool(data)`
|
|
343
|
+
```python
|
|
344
|
+
{
|
|
345
|
+
'tool_name': 'search',
|
|
346
|
+
'tool_args': {'query': '...'},
|
|
347
|
+
'tool_id': 'call_abc123',
|
|
348
|
+
'iteration': 1,
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### `after_tool(data)`
|
|
353
|
+
```python
|
|
354
|
+
{
|
|
355
|
+
'tool_name': 'search',
|
|
356
|
+
'tool_args': {...},
|
|
357
|
+
'result': '...',
|
|
358
|
+
'status': 'success', # success/error/not_found
|
|
359
|
+
'timing': 123.4,
|
|
360
|
+
'iteration': 1,
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
**For advanced use cases**, hooks can accept `(data, agent)` to get agent access:
|
|
365
|
+
|
|
366
|
+
```python
|
|
367
|
+
def advanced_hook(data, agent):
|
|
368
|
+
# Can call agent.llm, access agent.current_session, etc.
|
|
369
|
+
thinking = agent.llm.complete([...])
|
|
370
|
+
agent.current_session['messages'].append({...})
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Implementation Principles
|
|
376
|
+
|
|
377
|
+
### Keep Simple Things Simple
|
|
378
|
+
|
|
379
|
+
```python
|
|
380
|
+
# No hooks needed for basic usage
|
|
381
|
+
agent = Agent("assistant", tools=[search])
|
|
382
|
+
agent.input("task") # Just works!
|
|
383
|
+
|
|
384
|
+
# Add one hook when needed
|
|
385
|
+
agent = Agent("assistant", tools=[search], hooks={
|
|
386
|
+
'after_llm': [lambda d: print(d['usage'])]
|
|
387
|
+
})
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Make Complicated Things Possible
|
|
391
|
+
|
|
392
|
+
```python
|
|
393
|
+
# Complex plugin with agent access
|
|
394
|
+
from connectonion.thinking import chain_of_thought
|
|
395
|
+
from connectonion.caching import smart_cache
|
|
396
|
+
|
|
397
|
+
agent = Agent("assistant", tools=[search], hooks=[
|
|
398
|
+
chain_of_thought(depth=3),
|
|
399
|
+
smart_cache(ttl=3600),
|
|
400
|
+
])
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### No Breaking Changes
|
|
404
|
+
|
|
405
|
+
All existing code continues to work:
|
|
406
|
+
```python
|
|
407
|
+
# Still works without any hooks
|
|
408
|
+
agent = Agent("assistant", tools=[search])
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### Minimal Performance Overhead
|
|
412
|
+
|
|
413
|
+
Hooks only add cost when used:
|
|
414
|
+
- Zero overhead if `hooks=None`
|
|
415
|
+
- Simple list iteration when active
|
|
416
|
+
- No complex event system needed
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Open Questions for Community
|
|
421
|
+
|
|
422
|
+
1. **Which options should we implement?**
|
|
423
|
+
- Just Option 1? (simplest)
|
|
424
|
+
- Options 1 & 2? (flexible)
|
|
425
|
+
- All four? (maximum choice)
|
|
426
|
+
|
|
427
|
+
2. **Should hooks be able to modify data?**
|
|
428
|
+
- Read-only (safer, simpler)
|
|
429
|
+
- Read-write (more powerful)
|
|
430
|
+
- Both, based on return value?
|
|
431
|
+
|
|
432
|
+
3. **What about async hooks?**
|
|
433
|
+
- Not in MVP
|
|
434
|
+
- Add later if needed
|
|
435
|
+
- Support from day one?
|
|
436
|
+
|
|
437
|
+
4. **Error handling in hooks?**
|
|
438
|
+
- Log warning, continue execution
|
|
439
|
+
- Raise error, stop agent
|
|
440
|
+
- Configurable per hook
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## Community Feedback
|
|
445
|
+
|
|
446
|
+
We're gathering feedback through:
|
|
447
|
+
- **GitHub Issue #31:** Detailed RFC with technical discussion
|
|
448
|
+
- **GitHub Discussion #33:** Community vote with emoji reactions
|
|
449
|
+
- **Discord:** Casual discussion and use case sharing
|
|
450
|
+
|
|
451
|
+
**Vote here:** https://github.com/openonion/connectonion/discussions/33
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
## Lessons Learned
|
|
456
|
+
|
|
457
|
+
### 1. Start with User Problems, Not Solutions
|
|
458
|
+
|
|
459
|
+
We didn't start with "let's add hooks." We started with "users need to track costs, cache results, add logging."
|
|
460
|
+
|
|
461
|
+
### 2. Explore Widely, Then Narrow
|
|
462
|
+
|
|
463
|
+
We explored 4+ different approaches before converging on 2 primary ones. The exploration helped us understand trade-offs.
|
|
464
|
+
|
|
465
|
+
### 3. Real Use Cases Drive Design
|
|
466
|
+
|
|
467
|
+
The "chain of thought" plugin use case revealed the `on_event` vs `hooks` naming issue. Real examples expose hidden problems.
|
|
468
|
+
|
|
469
|
+
### 4. Grammar Tests
|
|
470
|
+
|
|
471
|
+
If a parameter name reads awkwardly with realistic values, it's the wrong name. "On event, chain of thought" failed the grammar test.
|
|
472
|
+
|
|
473
|
+
### 5. Community Input is Critical
|
|
474
|
+
|
|
475
|
+
We're not implementing until the community weighs in. Different users have different needs - we need to hear them all.
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
## Next Steps
|
|
480
|
+
|
|
481
|
+
1. ✅ Document all options with examples
|
|
482
|
+
2. ✅ Create community vote
|
|
483
|
+
3. ⏳ Gather feedback (1-2 weeks)
|
|
484
|
+
4. ⏳ Analyze votes and comments
|
|
485
|
+
5. ⏳ Make final decision
|
|
486
|
+
6. ⏳ Implement chosen approach(es)
|
|
487
|
+
7. ⏳ Write comprehensive documentation
|
|
488
|
+
8. ⏳ Build example plugins to validate design
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
492
|
+
## Conclusion
|
|
493
|
+
|
|
494
|
+
The hook system design is a balance between:
|
|
495
|
+
- **Simplicity** (for everyday use)
|
|
496
|
+
- **Power** (for advanced use cases)
|
|
497
|
+
- **Familiarity** (patterns users already know)
|
|
498
|
+
- **Extensibility** (plugin ecosystem)
|
|
499
|
+
|
|
500
|
+
We believe **Options 1 & 2** strike the best balance:
|
|
501
|
+
- Option 1 (dict) for simple, declarative configuration
|
|
502
|
+
- Option 2 (wrappers) for plugin ecosystem and autocomplete
|
|
503
|
+
|
|
504
|
+
But we're waiting for **your** input before making the final call.
|
|
505
|
+
|
|
506
|
+
**Join the discussion:** https://github.com/openonion/connectonion/discussions/33
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
*"Keep simple things simple, make complicated things possible."*
|