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,138 @@
|
|
|
1
|
+
# DiffWriter
|
|
2
|
+
|
|
3
|
+
Human-in-the-loop file writing with diff display and approval.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from connectonion import DiffWriter
|
|
9
|
+
|
|
10
|
+
writer = DiffWriter()
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## API
|
|
14
|
+
|
|
15
|
+
### write(path, content)
|
|
16
|
+
|
|
17
|
+
Write content to a file with diff display and user approval.
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
result = writer.write("hello.py", "print('hello')")
|
|
21
|
+
# Shows colorized diff
|
|
22
|
+
# Asks user to choose: 1=Yes, 2=Yes to all, 3=No + feedback
|
|
23
|
+
# Returns: "Wrote 15 bytes to hello.py" or feedback message
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### diff(path, content)
|
|
27
|
+
|
|
28
|
+
Show diff without writing (preview mode).
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
diff_text = writer.diff("hello.py", "print('hello')")
|
|
32
|
+
# Returns the diff string without writing
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### read(path)
|
|
36
|
+
|
|
37
|
+
Read file contents.
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
content = writer.read("hello.py")
|
|
41
|
+
# Returns: "print('hello')"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Approval Options
|
|
45
|
+
|
|
46
|
+
When a file change is proposed, user sees:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
╭─── Changes to hello.py ────────────────────────╮
|
|
50
|
+
│ --- a/hello.py │
|
|
51
|
+
│ +++ b/hello.py │
|
|
52
|
+
│ @@ -1,2 +1,3 @@ │
|
|
53
|
+
│ def hello(): │
|
|
54
|
+
│ - pass │
|
|
55
|
+
│ + print("Hello!") │
|
|
56
|
+
╰────────────────────────────────────────────────╯
|
|
57
|
+
|
|
58
|
+
Choose an option:
|
|
59
|
+
1 - Yes, apply this change
|
|
60
|
+
2 - Yes to all (auto-approve for this session)
|
|
61
|
+
3 - No, and tell agent what to do instead
|
|
62
|
+
|
|
63
|
+
Apply changes to hello.py? [1/2/3]:
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
| Option | Effect |
|
|
67
|
+
|--------|--------|
|
|
68
|
+
| **1** | Apply this change, ask again for next change |
|
|
69
|
+
| **2** | Apply this and all future changes (session-wide) |
|
|
70
|
+
| **3** | Reject + provide feedback for agent to try again |
|
|
71
|
+
|
|
72
|
+
## Options
|
|
73
|
+
|
|
74
|
+
### auto_approve
|
|
75
|
+
|
|
76
|
+
Skip approval prompts (for automation).
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
# Ask for approval (default)
|
|
80
|
+
writer = DiffWriter(auto_approve=False)
|
|
81
|
+
|
|
82
|
+
# Auto-approve all writes
|
|
83
|
+
writer = DiffWriter(auto_approve=True)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Use with Agent
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from connectonion import Agent, DiffWriter
|
|
90
|
+
|
|
91
|
+
writer = DiffWriter()
|
|
92
|
+
agent = Agent("coder", tools=[writer])
|
|
93
|
+
|
|
94
|
+
agent.input("create a hello.py file with a hello world function")
|
|
95
|
+
# Agent calls writer.write()
|
|
96
|
+
# User sees diff and chooses 1, 2, or 3
|
|
97
|
+
# If 3: User provides feedback, agent receives it and tries again
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Feedback Flow
|
|
101
|
+
|
|
102
|
+
When user chooses option 3 (reject):
|
|
103
|
+
|
|
104
|
+
1. User is prompted: "What should the agent do instead?"
|
|
105
|
+
2. User types feedback, e.g., "use snake_case for function names"
|
|
106
|
+
3. Agent receives: `"User rejected changes to hello.py. Feedback: use snake_case for function names"`
|
|
107
|
+
4. Agent can retry with the feedback
|
|
108
|
+
|
|
109
|
+
## Common Use Cases
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
# Interactive coding with approval
|
|
113
|
+
writer = DiffWriter()
|
|
114
|
+
agent = Agent("coder", tools=[writer])
|
|
115
|
+
|
|
116
|
+
# CI/CD automation - skip prompts
|
|
117
|
+
writer = DiffWriter(auto_approve=True)
|
|
118
|
+
agent = Agent("automation", tools=[writer])
|
|
119
|
+
|
|
120
|
+
# Preview changes only
|
|
121
|
+
diff = writer.diff("config.py", new_config)
|
|
122
|
+
print(diff)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Customizing
|
|
126
|
+
|
|
127
|
+
Need to modify DiffWriter's behavior? Copy the source to your project:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
co copy diff_writer
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Then import from your local copy:
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
# from connectonion import DiffWriter # Before
|
|
137
|
+
from tools.diff_writer import DiffWriter # After - customize freely!
|
|
138
|
+
```
|
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
# Get Emails
|
|
2
|
+
|
|
3
|
+
> Check your inbox with one line. Process emails safely. Keep it simple.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Quick Start (10 seconds)
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
from connectonion import get_emails, send_email, mark_read
|
|
11
|
+
|
|
12
|
+
# Get your emails
|
|
13
|
+
emails = get_emails()
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**That's it.** You have your emails.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Core Concept
|
|
21
|
+
|
|
22
|
+
Three functions. That's all:
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
get_emails(last=10, unread=False) # Get emails
|
|
26
|
+
send_email(to, subject, message) # Send email (already done)
|
|
27
|
+
mark_read(email_id) # Mark as read after processing
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Important**: Emails are NOT auto-marked as read. You control when to mark them.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Common Patterns
|
|
35
|
+
|
|
36
|
+
### Check for new emails
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from connectonion import get_emails, mark_read
|
|
40
|
+
|
|
41
|
+
# Get unread emails
|
|
42
|
+
new_emails = get_emails(unread=True)
|
|
43
|
+
|
|
44
|
+
for email in new_emails:
|
|
45
|
+
print(f"New from {email['from']}: {email['subject']}")
|
|
46
|
+
|
|
47
|
+
# Process the email
|
|
48
|
+
if process_email(email):
|
|
49
|
+
mark_read(email['id']) # Only mark if processed successfully
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Get latest email
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
# Get just the most recent email
|
|
56
|
+
emails = get_emails(last=1)
|
|
57
|
+
if emails:
|
|
58
|
+
latest = emails[0]
|
|
59
|
+
print(f"Latest: {latest['subject']}")
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Reply to emails
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
# Check and reply pattern
|
|
66
|
+
for email in get_emails(unread=True):
|
|
67
|
+
if "urgent" in email["subject"].lower():
|
|
68
|
+
# Send reply
|
|
69
|
+
send_email(
|
|
70
|
+
email["from"],
|
|
71
|
+
f"Re: {email['subject']}",
|
|
72
|
+
"I'm on it!"
|
|
73
|
+
)
|
|
74
|
+
# Mark as handled
|
|
75
|
+
mark_read(email['id'])
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Complete Email Agent Example
|
|
81
|
+
|
|
82
|
+
Here's a full-featured email assistant agent that can manage your inbox:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from connectonion import Agent, get_emails, send_email, mark_read
|
|
86
|
+
from typing import List, Dict
|
|
87
|
+
import json
|
|
88
|
+
|
|
89
|
+
class EmailManager:
|
|
90
|
+
"""Stateful email management with tracking."""
|
|
91
|
+
|
|
92
|
+
def __init__(self):
|
|
93
|
+
self.processed_count = 0
|
|
94
|
+
self.auto_replies_sent = 0
|
|
95
|
+
|
|
96
|
+
def check_inbox(self, show_all: bool = False) -> str:
|
|
97
|
+
"""Check inbox and summarize emails."""
|
|
98
|
+
emails = get_emails(unread=not show_all)
|
|
99
|
+
|
|
100
|
+
if not emails:
|
|
101
|
+
return "📭 No new emails"
|
|
102
|
+
|
|
103
|
+
summary = f"📬 You have {len(emails)} {'emails' if show_all else 'unread emails'}:\n\n"
|
|
104
|
+
|
|
105
|
+
for i, email in enumerate(emails, 1):
|
|
106
|
+
status = "✓" if email['read'] else "•"
|
|
107
|
+
summary += f"{status} [{i}] From: {email['from']}\n"
|
|
108
|
+
summary += f" Subject: {email['subject']}\n"
|
|
109
|
+
summary += f" Preview: {email['message'][:50]}...\n\n"
|
|
110
|
+
|
|
111
|
+
return summary
|
|
112
|
+
|
|
113
|
+
def reply_to_email(self, email_index: int, message: str) -> str:
|
|
114
|
+
"""Reply to a specific email by index."""
|
|
115
|
+
emails = get_emails()
|
|
116
|
+
|
|
117
|
+
if email_index < 1 or email_index > len(emails):
|
|
118
|
+
return f"❌ Invalid email index. You have {len(emails)} emails."
|
|
119
|
+
|
|
120
|
+
email = emails[email_index - 1]
|
|
121
|
+
|
|
122
|
+
# Send the reply
|
|
123
|
+
send_email(
|
|
124
|
+
email['from'],
|
|
125
|
+
f"Re: {email['subject']}",
|
|
126
|
+
message
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
# Mark original as read
|
|
130
|
+
mark_read(email['id'])
|
|
131
|
+
self.processed_count += 1
|
|
132
|
+
|
|
133
|
+
return f"✅ Replied to {email['from']} and marked as read"
|
|
134
|
+
|
|
135
|
+
def auto_respond(self, keywords: List[str] = None) -> str:
|
|
136
|
+
"""Auto-respond to emails matching keywords."""
|
|
137
|
+
if keywords is None:
|
|
138
|
+
keywords = ["urgent", "asap", "important"]
|
|
139
|
+
|
|
140
|
+
emails = get_emails(unread=True)
|
|
141
|
+
responded = []
|
|
142
|
+
|
|
143
|
+
for email in emails:
|
|
144
|
+
# Check if any keyword matches
|
|
145
|
+
if any(kw.lower() in email['subject'].lower() or
|
|
146
|
+
kw.lower() in email['message'].lower()
|
|
147
|
+
for kw in keywords):
|
|
148
|
+
|
|
149
|
+
# Send auto-response
|
|
150
|
+
send_email(
|
|
151
|
+
email['from'],
|
|
152
|
+
f"Auto-Reply: {email['subject']}",
|
|
153
|
+
f"Thank you for your message marked as important. "
|
|
154
|
+
f"I've received it and will respond within 24 hours.\n\n"
|
|
155
|
+
f"Original message received: {email['timestamp']}"
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
mark_read(email['id'])
|
|
159
|
+
responded.append(email['from'])
|
|
160
|
+
self.auto_replies_sent += 1
|
|
161
|
+
|
|
162
|
+
if responded:
|
|
163
|
+
return f"🤖 Auto-responded to {len(responded)} emails from: {', '.join(responded)}"
|
|
164
|
+
return "No emails matched auto-response criteria"
|
|
165
|
+
|
|
166
|
+
def process_support_tickets(self) -> str:
|
|
167
|
+
"""Process support emails and create tickets."""
|
|
168
|
+
support_emails = []
|
|
169
|
+
|
|
170
|
+
for email in get_emails(unread=True):
|
|
171
|
+
if any(word in email['subject'].lower()
|
|
172
|
+
for word in ['support', 'help', 'issue', 'problem', 'bug']):
|
|
173
|
+
|
|
174
|
+
support_emails.append(email)
|
|
175
|
+
|
|
176
|
+
# Acknowledge receipt
|
|
177
|
+
ticket_id = f"TICKET-{len(support_emails):04d}"
|
|
178
|
+
|
|
179
|
+
send_email(
|
|
180
|
+
email['from'],
|
|
181
|
+
f"Support Ticket Created: {ticket_id}",
|
|
182
|
+
f"Thank you for contacting support.\n\n"
|
|
183
|
+
f"Your ticket {ticket_id} has been created.\n"
|
|
184
|
+
f"Subject: {email['subject']}\n\n"
|
|
185
|
+
f"We'll respond within 24 hours."
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
mark_read(email['id'])
|
|
189
|
+
self.processed_count += 1
|
|
190
|
+
|
|
191
|
+
if support_emails:
|
|
192
|
+
return f"🎫 Created {len(support_emails)} support tickets"
|
|
193
|
+
return "No support emails found"
|
|
194
|
+
|
|
195
|
+
def archive_old_emails(self, days: int = 30) -> str:
|
|
196
|
+
"""Mark old emails as read to clean up inbox."""
|
|
197
|
+
# For demo, we'll just mark all read emails
|
|
198
|
+
emails = get_emails(last=50)
|
|
199
|
+
old_count = 0
|
|
200
|
+
|
|
201
|
+
for email in emails:
|
|
202
|
+
if email['read']:
|
|
203
|
+
continue
|
|
204
|
+
# In real implementation, check timestamp
|
|
205
|
+
# For now, just demonstrate the pattern
|
|
206
|
+
mark_read(email['id'])
|
|
207
|
+
old_count += 1
|
|
208
|
+
|
|
209
|
+
return f"📦 Archived {old_count} old emails"
|
|
210
|
+
|
|
211
|
+
def get_statistics(self) -> str:
|
|
212
|
+
"""Get email processing statistics."""
|
|
213
|
+
total = len(get_emails())
|
|
214
|
+
unread = len(get_emails(unread=True))
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
f"📊 Email Statistics:\n"
|
|
218
|
+
f"• Total emails: {total}\n"
|
|
219
|
+
f"• Unread: {unread}\n"
|
|
220
|
+
f"• Processed this session: {self.processed_count}\n"
|
|
221
|
+
f"• Auto-replies sent: {self.auto_replies_sent}"
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
# Create the email agent
|
|
226
|
+
email_manager = EmailManager()
|
|
227
|
+
|
|
228
|
+
email_agent = Agent(
|
|
229
|
+
name="email_assistant",
|
|
230
|
+
tools=[
|
|
231
|
+
email_manager, # Pass the whole class instance!
|
|
232
|
+
get_emails, # Also available as standalone
|
|
233
|
+
send_email, # For custom operations
|
|
234
|
+
mark_read # For manual marking
|
|
235
|
+
],
|
|
236
|
+
system_prompt="""You are a professional email assistant.
|
|
237
|
+
|
|
238
|
+
Your capabilities:
|
|
239
|
+
- Check and summarize inbox
|
|
240
|
+
- Reply to emails
|
|
241
|
+
- Auto-respond to urgent messages
|
|
242
|
+
- Process support tickets
|
|
243
|
+
- Provide email statistics
|
|
244
|
+
|
|
245
|
+
Guidelines:
|
|
246
|
+
1. Always confirm before sending emails
|
|
247
|
+
2. Be professional and courteous
|
|
248
|
+
3. Prioritize urgent/important emails
|
|
249
|
+
4. Keep responses concise
|
|
250
|
+
5. Track what you've processed
|
|
251
|
+
|
|
252
|
+
When checking emails, start with check_inbox() to see what's available.
|
|
253
|
+
"""
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
# Example usage
|
|
257
|
+
if __name__ == "__main__":
|
|
258
|
+
# Interactive email management
|
|
259
|
+
while True:
|
|
260
|
+
task = input("\n💌 What would you like to do with your emails? ")
|
|
261
|
+
if task.lower() in ['quit', 'exit']:
|
|
262
|
+
break
|
|
263
|
+
|
|
264
|
+
result = email_agent.input(task)
|
|
265
|
+
print(result)
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Using the Email Agent
|
|
271
|
+
|
|
272
|
+
### Example Conversations
|
|
273
|
+
|
|
274
|
+
```python
|
|
275
|
+
# Check inbox
|
|
276
|
+
>>> email_agent.input("Check my inbox")
|
|
277
|
+
"""
|
|
278
|
+
I'll check your inbox for you.
|
|
279
|
+
|
|
280
|
+
📬 You have 3 unread emails:
|
|
281
|
+
|
|
282
|
+
• [1] From: alice@example.com
|
|
283
|
+
Subject: Project Update
|
|
284
|
+
Preview: The new features are ready for review. Can we...
|
|
285
|
+
|
|
286
|
+
• [2] From: support@service.com
|
|
287
|
+
Subject: Issue with login
|
|
288
|
+
Preview: I'm having trouble accessing my account...
|
|
289
|
+
|
|
290
|
+
• [3] From: boss@company.com
|
|
291
|
+
Subject: Urgent: Meeting Tomorrow
|
|
292
|
+
Preview: We need to discuss the Q4 planning...
|
|
293
|
+
|
|
294
|
+
You have 2 urgent/important emails that may need immediate attention.
|
|
295
|
+
"""
|
|
296
|
+
|
|
297
|
+
# Reply to specific email
|
|
298
|
+
>>> email_agent.input("Reply to email 3 saying I'll be there")
|
|
299
|
+
"""
|
|
300
|
+
I'll reply to email #3 from boss@company.com about the urgent meeting.
|
|
301
|
+
|
|
302
|
+
✅ Replied to boss@company.com and marked as read
|
|
303
|
+
The reply "I'll be there" has been sent with subject "Re: Urgent: Meeting Tomorrow"
|
|
304
|
+
"""
|
|
305
|
+
|
|
306
|
+
# Auto-respond to urgent emails
|
|
307
|
+
>>> email_agent.input("Auto-respond to all urgent emails")
|
|
308
|
+
"""
|
|
309
|
+
I'll set up auto-responses for urgent emails.
|
|
310
|
+
|
|
311
|
+
🤖 Auto-responded to 2 emails from: alice@example.com, boss@company.com
|
|
312
|
+
|
|
313
|
+
Auto-responses have been sent to emails marked as urgent or important,
|
|
314
|
+
letting senders know you've received their message and will respond within 24 hours.
|
|
315
|
+
"""
|
|
316
|
+
|
|
317
|
+
# Process support requests
|
|
318
|
+
>>> email_agent.input("Handle any support tickets")
|
|
319
|
+
"""
|
|
320
|
+
I'll process support emails and create tickets.
|
|
321
|
+
|
|
322
|
+
🎫 Created 1 support ticket
|
|
323
|
+
|
|
324
|
+
Support ticket TICKET-0001 has been created for the email from support@service.com
|
|
325
|
+
about "Issue with login". An acknowledgment has been sent to the customer.
|
|
326
|
+
"""
|
|
327
|
+
|
|
328
|
+
# Get statistics
|
|
329
|
+
>>> email_agent.input("Show me email statistics")
|
|
330
|
+
"""
|
|
331
|
+
Here are your email statistics:
|
|
332
|
+
|
|
333
|
+
📊 Email Statistics:
|
|
334
|
+
• Total emails: 25
|
|
335
|
+
• Unread: 12
|
|
336
|
+
• Processed this session: 4
|
|
337
|
+
• Auto-replies sent: 2
|
|
338
|
+
|
|
339
|
+
You've handled 4 emails so far, with 12 still unread in your inbox.
|
|
340
|
+
"""
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## API Reference
|
|
346
|
+
|
|
347
|
+
### get_emails()
|
|
348
|
+
|
|
349
|
+
```python
|
|
350
|
+
get_emails(last=10, unread=False) -> list
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**Parameters:**
|
|
354
|
+
- `last` (int): Number of emails to retrieve. Default: 10
|
|
355
|
+
- `unread` (bool): Only get unread emails. Default: False
|
|
356
|
+
|
|
357
|
+
**Returns:**
|
|
358
|
+
List of email dictionaries:
|
|
359
|
+
```python
|
|
360
|
+
[
|
|
361
|
+
{
|
|
362
|
+
'id': 'msg_123',
|
|
363
|
+
'from': 'alice@example.com',
|
|
364
|
+
'subject': 'Project Update',
|
|
365
|
+
'message': 'The new feature is ready...',
|
|
366
|
+
'timestamp': '2024-01-15T10:30:00Z',
|
|
367
|
+
'read': False
|
|
368
|
+
}
|
|
369
|
+
]
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### mark_read()
|
|
373
|
+
|
|
374
|
+
```python
|
|
375
|
+
mark_read(email_id) -> bool
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
**Parameters:**
|
|
379
|
+
- `email_id` (str or list): Single ID or list of IDs to mark as read
|
|
380
|
+
|
|
381
|
+
**Returns:**
|
|
382
|
+
- `True` if successful
|
|
383
|
+
- `False` if failed
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Simple Standalone Examples
|
|
388
|
+
|
|
389
|
+
### Out-of-Office Responder
|
|
390
|
+
|
|
391
|
+
```python
|
|
392
|
+
from connectonion import get_emails, send_email, mark_read
|
|
393
|
+
import time
|
|
394
|
+
|
|
395
|
+
def out_of_office():
|
|
396
|
+
"""Simple out-of-office responder."""
|
|
397
|
+
message = """
|
|
398
|
+
Thank you for your email.
|
|
399
|
+
|
|
400
|
+
I am currently out of office and will return on Monday.
|
|
401
|
+
For urgent matters, please contact support@company.com.
|
|
402
|
+
|
|
403
|
+
Best regards
|
|
404
|
+
"""
|
|
405
|
+
|
|
406
|
+
while True:
|
|
407
|
+
for email in get_emails(unread=True):
|
|
408
|
+
# Skip if already replied (has Re: in subject)
|
|
409
|
+
if not email['subject'].startswith('Re:'):
|
|
410
|
+
send_email(
|
|
411
|
+
email['from'],
|
|
412
|
+
f"Out of Office: Re: {email['subject']}",
|
|
413
|
+
message
|
|
414
|
+
)
|
|
415
|
+
mark_read(email['id'])
|
|
416
|
+
print(f"Auto-replied to {email['from']}")
|
|
417
|
+
|
|
418
|
+
time.sleep(300) # Check every 5 minutes
|
|
419
|
+
|
|
420
|
+
# Run the responder
|
|
421
|
+
out_of_office()
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### Daily Digest
|
|
425
|
+
|
|
426
|
+
```python
|
|
427
|
+
from connectonion import get_emails, send_email
|
|
428
|
+
from datetime import datetime
|
|
429
|
+
|
|
430
|
+
def create_daily_digest():
|
|
431
|
+
"""Create a daily email digest."""
|
|
432
|
+
emails = get_emails(last=50)
|
|
433
|
+
|
|
434
|
+
# Group by sender
|
|
435
|
+
by_sender = {}
|
|
436
|
+
for email in emails:
|
|
437
|
+
sender = email['from']
|
|
438
|
+
if sender not in by_sender:
|
|
439
|
+
by_sender[sender] = []
|
|
440
|
+
by_sender[sender].append(email['subject'])
|
|
441
|
+
|
|
442
|
+
# Create digest
|
|
443
|
+
digest = f"📧 Daily Email Digest - {datetime.now().strftime('%Y-%m-%d')}\n\n"
|
|
444
|
+
digest += f"Total emails: {len(emails)}\n"
|
|
445
|
+
digest += f"Unique senders: {len(by_sender)}\n\n"
|
|
446
|
+
|
|
447
|
+
for sender, subjects in by_sender.items():
|
|
448
|
+
digest += f"From {sender} ({len(subjects)} emails):\n"
|
|
449
|
+
for subject in subjects[:3]: # Show first 3
|
|
450
|
+
digest += f" • {subject}\n"
|
|
451
|
+
if len(subjects) > 3:
|
|
452
|
+
digest += f" ... and {len(subjects)-3} more\n"
|
|
453
|
+
digest += "\n"
|
|
454
|
+
|
|
455
|
+
# Send digest to yourself
|
|
456
|
+
send_email(
|
|
457
|
+
"me@example.com",
|
|
458
|
+
"Daily Email Digest",
|
|
459
|
+
digest
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
return "Digest sent!"
|
|
463
|
+
|
|
464
|
+
# Create and send digest
|
|
465
|
+
create_daily_digest()
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
## Why No Auto-Mark?
|
|
471
|
+
|
|
472
|
+
**The Problem with auto-marking:**
|
|
473
|
+
```python
|
|
474
|
+
# BAD: Auto-mark on fetch
|
|
475
|
+
emails = get_emails(unread=True) # Server marks as read 😱
|
|
476
|
+
process_emails(emails) # Crashes! 💥
|
|
477
|
+
# Emails lost forever - marked read but not processed!
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
**Our Safe Approach:**
|
|
481
|
+
```python
|
|
482
|
+
# GOOD: Explicit marking
|
|
483
|
+
emails = get_emails(unread=True) # Stays unread
|
|
484
|
+
process_emails(emails) # Process them
|
|
485
|
+
mark_read([e['id'] for e in emails]) # Mark only after success ✅
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
## Philosophy
|
|
491
|
+
|
|
492
|
+
**Three functions for everything email:**
|
|
493
|
+
- `get_emails()` - Read emails
|
|
494
|
+
- `send_email()` - Send emails
|
|
495
|
+
- `mark_read()` - Mark as processed
|
|
496
|
+
|
|
497
|
+
No complexity. No confusion. Just email.
|
|
498
|
+
|
|
499
|
+
Keep simple things simple.
|