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,135 @@
|
|
|
1
|
+
# Gmail
|
|
2
|
+
|
|
3
|
+
Give your agents Gmail access.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from connectonion import Agent, Gmail
|
|
9
|
+
|
|
10
|
+
gmail = Gmail()
|
|
11
|
+
agent = Agent("assistant", tools=[gmail])
|
|
12
|
+
|
|
13
|
+
agent.input("Show me my recent emails")
|
|
14
|
+
agent.input("Find emails from alice@example.com")
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
co auth google
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Your agent can now read and manage Gmail.
|
|
24
|
+
|
|
25
|
+
**Switch accounts?** Run `co auth google` again to connect a different Google account.
|
|
26
|
+
|
|
27
|
+
## Agent Methods
|
|
28
|
+
|
|
29
|
+
### Reading
|
|
30
|
+
|
|
31
|
+
**`read_inbox(last=10, unread=False)`**
|
|
32
|
+
- Read emails from inbox
|
|
33
|
+
- `last`: Number of emails (default: 10)
|
|
34
|
+
- `unread`: Only unread emails (default: False)
|
|
35
|
+
|
|
36
|
+
**`get_sent_emails(max_results=10)`**
|
|
37
|
+
- Get emails you sent
|
|
38
|
+
|
|
39
|
+
**`get_all_emails(max_results=50)`**
|
|
40
|
+
- Get emails from all folders (inbox, sent, archive)
|
|
41
|
+
|
|
42
|
+
### Search
|
|
43
|
+
|
|
44
|
+
**`search_emails(query, max_results=10)`**
|
|
45
|
+
- Search using Gmail query syntax
|
|
46
|
+
- Examples: `"from:alice@example.com"`, `"subject:meeting"`, `"is:unread has:attachment"`
|
|
47
|
+
|
|
48
|
+
### Content
|
|
49
|
+
|
|
50
|
+
**`get_email_body(email_id)`**
|
|
51
|
+
- Get full email content
|
|
52
|
+
|
|
53
|
+
**`get_email_attachments(email_id)`**
|
|
54
|
+
- List attachments (filename, size)
|
|
55
|
+
|
|
56
|
+
### Actions
|
|
57
|
+
|
|
58
|
+
**`mark_read(email_id)`**
|
|
59
|
+
- Mark email as read
|
|
60
|
+
|
|
61
|
+
**`mark_unread(email_id)`**
|
|
62
|
+
- Mark email as unread
|
|
63
|
+
|
|
64
|
+
**`archive_email(email_id)`**
|
|
65
|
+
- Archive email (remove from inbox)
|
|
66
|
+
|
|
67
|
+
**`star_email(email_id)`**
|
|
68
|
+
- Add star to email
|
|
69
|
+
|
|
70
|
+
### Labels
|
|
71
|
+
|
|
72
|
+
**`get_labels()`**
|
|
73
|
+
- List all Gmail labels
|
|
74
|
+
|
|
75
|
+
**`add_label(email_id, label)`**
|
|
76
|
+
- Add label to email
|
|
77
|
+
|
|
78
|
+
**`get_emails_with_label(label, max_results=10)`**
|
|
79
|
+
- Get emails with specific label
|
|
80
|
+
|
|
81
|
+
### Stats
|
|
82
|
+
|
|
83
|
+
**`count_unread()`**
|
|
84
|
+
- Count unread emails
|
|
85
|
+
|
|
86
|
+
### CRM
|
|
87
|
+
|
|
88
|
+
**`get_all_contacts(max_emails=500)`**
|
|
89
|
+
- Extract all unique contacts from emails
|
|
90
|
+
- Fast regex-based extraction
|
|
91
|
+
- Returns list of contacts with email and name
|
|
92
|
+
|
|
93
|
+
**`analyze_contact(email, max_emails=50)`**
|
|
94
|
+
- Analyze specific contact using LLM
|
|
95
|
+
- Provides relationship context, topics, patterns, tags
|
|
96
|
+
- Example: `gmail.analyze_contact("alice@example.com")`
|
|
97
|
+
|
|
98
|
+
## Example
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from connectonion import Agent, Gmail, Memory
|
|
102
|
+
|
|
103
|
+
gmail = Gmail()
|
|
104
|
+
memory = Memory()
|
|
105
|
+
|
|
106
|
+
agent = Agent(
|
|
107
|
+
name="email-assistant",
|
|
108
|
+
tools=[gmail, memory],
|
|
109
|
+
system_prompt="You help manage emails and remember important info."
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
agent.input("Check unread emails and save important deadlines to memory")
|
|
113
|
+
agent.input("Archive all newsletter emails from this week")
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Customizing
|
|
117
|
+
|
|
118
|
+
Need to modify Gmail's behavior? Copy the source to your project:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
co copy gmail
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Then import from your local copy:
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
# from connectonion import Gmail # Before
|
|
128
|
+
from tools.gmail import Gmail # After - customize freely!
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Troubleshooting
|
|
132
|
+
|
|
133
|
+
**Missing gmail.readonly scope**: Run `co auth google`
|
|
134
|
+
|
|
135
|
+
**Credentials not found**: Run `co auth google`
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# GoogleCalendar
|
|
2
|
+
|
|
3
|
+
Google Calendar integration for managing events and meetings.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from connectonion import Agent, GoogleCalendar
|
|
9
|
+
|
|
10
|
+
calendar = GoogleCalendar()
|
|
11
|
+
agent = Agent("assistant", tools=[calendar])
|
|
12
|
+
|
|
13
|
+
agent.input("What meetings do I have today?")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Setup
|
|
17
|
+
|
|
18
|
+
Requires Google OAuth authorization:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
co auth google
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Methods
|
|
25
|
+
|
|
26
|
+
### Reading Events
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
# List upcoming events
|
|
30
|
+
calendar.list_events(days_ahead=7, max_results=10)
|
|
31
|
+
|
|
32
|
+
# Get today's events
|
|
33
|
+
calendar.get_today_events()
|
|
34
|
+
|
|
35
|
+
# Get specific event
|
|
36
|
+
calendar.get_event(event_id="abc123")
|
|
37
|
+
|
|
38
|
+
# Get upcoming meetings
|
|
39
|
+
calendar.get_upcoming_meetings(days_ahead=7)
|
|
40
|
+
|
|
41
|
+
# Find free slots
|
|
42
|
+
calendar.find_free_slots(date="2024-01-15", duration_minutes=30)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Creating Events
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
# Create event
|
|
49
|
+
calendar.create_event(
|
|
50
|
+
title="Team Meeting",
|
|
51
|
+
start_time="2024-01-15 14:00",
|
|
52
|
+
end_time="2024-01-15 15:00",
|
|
53
|
+
description="Weekly sync",
|
|
54
|
+
attendees="alice@example.com,bob@example.com",
|
|
55
|
+
location="Conference Room A"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Create Google Meet meeting
|
|
59
|
+
calendar.create_meet(
|
|
60
|
+
title="Video Call",
|
|
61
|
+
start_time="2024-01-15 14:00",
|
|
62
|
+
end_time="2024-01-15 15:00",
|
|
63
|
+
attendees="alice@example.com",
|
|
64
|
+
description="Quick sync"
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Managing Events
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
# Update event
|
|
72
|
+
calendar.update_event(
|
|
73
|
+
event_id="abc123",
|
|
74
|
+
title="Updated Title",
|
|
75
|
+
start_time="2024-01-15 15:00",
|
|
76
|
+
end_time="2024-01-15 16:00"
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
# Delete event
|
|
80
|
+
calendar.delete_event(event_id="abc123")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Use with calendar_plugin
|
|
84
|
+
|
|
85
|
+
For calendar approval before creating/modifying events:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from connectonion.useful_plugins import calendar_plugin
|
|
89
|
+
|
|
90
|
+
agent = Agent("assistant", tools=[calendar], plugins=[calendar_plugin])
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Customizing
|
|
94
|
+
|
|
95
|
+
Need to modify GoogleCalendar's behavior? Copy the source to your project:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
co copy google_calendar
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Then import from your local copy:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
# from connectonion import GoogleCalendar # Before
|
|
105
|
+
from tools.google_calendar import GoogleCalendar # After - customize freely!
|
|
106
|
+
```
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
# Memory System
|
|
2
|
+
|
|
3
|
+
Give your agents persistent memory using markdown-based storage.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from connectonion import Agent, Memory
|
|
9
|
+
|
|
10
|
+
memory = Memory()
|
|
11
|
+
agent = Agent(
|
|
12
|
+
name="assistant",
|
|
13
|
+
system_prompt="You are a helpful assistant with memory.",
|
|
14
|
+
tools=[memory]
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
# Agent can now remember things
|
|
18
|
+
agent.input("Remember that Alice prefers email communication")
|
|
19
|
+
agent.input("What do I know about Alice?")
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What is Memory?
|
|
23
|
+
|
|
24
|
+
Memory is a simple, file-based storage system that lets your agents:
|
|
25
|
+
- Save information persistently across sessions
|
|
26
|
+
- Retrieve information by key
|
|
27
|
+
- Search across all memories with regex
|
|
28
|
+
- Organize knowledge in markdown format
|
|
29
|
+
|
|
30
|
+
**Storage**: Memories start in a single `memory.md` file. When the file exceeds 3000 lines, it automatically splits into a directory structure with separate `.md` files per memory key.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
Memory is included in ConnectOnion:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install connectonion
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Basic Usage
|
|
41
|
+
|
|
42
|
+
### Creating a Memory Instance
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from connectonion import Memory
|
|
46
|
+
|
|
47
|
+
# Default (creates memory.md)
|
|
48
|
+
memory = Memory()
|
|
49
|
+
|
|
50
|
+
# Custom file path
|
|
51
|
+
memory = Memory(memory_file="agent_knowledge.md")
|
|
52
|
+
|
|
53
|
+
# Legacy: directory structure (creates directory immediately)
|
|
54
|
+
memory = Memory(memory_dir="agent_knowledge")
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Adding Memory to an Agent
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from connectonion import Agent, Memory
|
|
61
|
+
|
|
62
|
+
memory = Memory()
|
|
63
|
+
agent = Agent("assistant", tools=[memory])
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Now your agent has access to 4 memory methods:
|
|
67
|
+
- `write_memory(key, content)` - Save or update information
|
|
68
|
+
- `read_memory(key)` - Retrieve information
|
|
69
|
+
- `list_memories()` - Show all stored memories
|
|
70
|
+
- `search_memory(pattern)` - Search with regex
|
|
71
|
+
|
|
72
|
+
## Memory Methods
|
|
73
|
+
|
|
74
|
+
### write_memory
|
|
75
|
+
|
|
76
|
+
Save information to memory:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
memory.write_memory("alice-notes", "Alice prefers email\nAlice works at TechCorp")
|
|
80
|
+
# Returns: "Memory saved: alice-notes"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Keys are sanitized:**
|
|
84
|
+
- Only alphanumeric, hyphens, and underscores allowed
|
|
85
|
+
- Converted to lowercase
|
|
86
|
+
- `"Alice Notes!"` becomes `"alicenotes"`
|
|
87
|
+
|
|
88
|
+
### read_memory
|
|
89
|
+
|
|
90
|
+
Retrieve saved information:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
memory.read_memory("alice-notes")
|
|
94
|
+
# Returns:
|
|
95
|
+
# Memory: alice-notes
|
|
96
|
+
#
|
|
97
|
+
# Alice prefers email
|
|
98
|
+
# Alice works at TechCorp
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
If not found:
|
|
102
|
+
```python
|
|
103
|
+
memory.read_memory("unknown")
|
|
104
|
+
# Returns: "Memory not found: unknown\nAvailable memories: alice-notes, project-x"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### list_memories
|
|
108
|
+
|
|
109
|
+
Show all stored memories:
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
memory.list_memories()
|
|
113
|
+
# Returns:
|
|
114
|
+
# Stored Memories (3):
|
|
115
|
+
# 1. alice-notes (85 bytes)
|
|
116
|
+
# 2. bob-notes (62 bytes)
|
|
117
|
+
# 3. project-x (120 bytes)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### search_memory
|
|
121
|
+
|
|
122
|
+
Search across all memories using regex:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
# Simple text search (case-sensitive by default)
|
|
126
|
+
memory.search_memory("email")
|
|
127
|
+
# Returns:
|
|
128
|
+
# Search Results (2 matches):
|
|
129
|
+
#
|
|
130
|
+
# alice-notes:
|
|
131
|
+
# Line 1: Alice prefers email
|
|
132
|
+
#
|
|
133
|
+
# contacts:
|
|
134
|
+
# Line 3: Email: alice@example.com
|
|
135
|
+
|
|
136
|
+
# Case-insensitive search with (?i) flag
|
|
137
|
+
memory.search_memory("(?i)email")
|
|
138
|
+
|
|
139
|
+
# Regex patterns
|
|
140
|
+
memory.search_memory(r"\w+@\w+\.\w+") # Find email addresses
|
|
141
|
+
memory.search_memory(r"Project [A-Z]") # Find project names
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Examples
|
|
145
|
+
|
|
146
|
+
### Example 1: Customer Notes
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from connectonion import Agent, Memory
|
|
150
|
+
|
|
151
|
+
memory = Memory(memory_dir="customer_notes")
|
|
152
|
+
agent = Agent(
|
|
153
|
+
name="sales-assistant",
|
|
154
|
+
system_prompt="You help track customer information.",
|
|
155
|
+
tools=[memory]
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
# Save customer info
|
|
159
|
+
agent.input("Remember that Alice from TechCorp is interested in our API product and prefers email contact")
|
|
160
|
+
|
|
161
|
+
# Later, recall the information
|
|
162
|
+
agent.input("What do I know about Alice?")
|
|
163
|
+
# Agent will use read_memory() to retrieve Alice's info
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Example 2: Project Tracker
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from connectonion import Agent, Memory
|
|
170
|
+
|
|
171
|
+
memory = Memory(memory_dir="projects")
|
|
172
|
+
agent = Agent(
|
|
173
|
+
name="project-manager",
|
|
174
|
+
system_prompt="You track project status and notes.",
|
|
175
|
+
tools=[memory]
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
# Save project updates
|
|
179
|
+
agent.input("Remember: Project Alpha is 80% complete, needs final testing")
|
|
180
|
+
agent.input("Remember: Project Beta is blocked, waiting on API keys")
|
|
181
|
+
|
|
182
|
+
# Search for blocked projects
|
|
183
|
+
agent.input("Which projects are blocked?")
|
|
184
|
+
# Agent will use search_memory("blocked") to find relevant projects
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Example 3: Research Assistant
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
from connectonion import Agent, Memory
|
|
191
|
+
|
|
192
|
+
def web_search(query: str) -> str:
|
|
193
|
+
"""Search the web for information."""
|
|
194
|
+
# Your search implementation
|
|
195
|
+
return f"Results for {query}"
|
|
196
|
+
|
|
197
|
+
memory = Memory(memory_dir="research")
|
|
198
|
+
agent = Agent(
|
|
199
|
+
name="researcher",
|
|
200
|
+
system_prompt="You research topics and save key findings.",
|
|
201
|
+
tools=[web_search, memory]
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
# Research and save
|
|
205
|
+
agent.input("Research the history of Python programming and save key points")
|
|
206
|
+
# Agent will search, then use write_memory() to save findings
|
|
207
|
+
|
|
208
|
+
# Later, recall research
|
|
209
|
+
agent.input("What did I learn about Python's history?")
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Example 4: Multi-Agent Shared Memory
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
from connectonion import Agent, Memory
|
|
216
|
+
|
|
217
|
+
# Shared memory between agents
|
|
218
|
+
shared_memory = Memory(memory_dir="shared_knowledge")
|
|
219
|
+
|
|
220
|
+
researcher = Agent(
|
|
221
|
+
name="researcher",
|
|
222
|
+
system_prompt="You research and document findings.",
|
|
223
|
+
tools=[shared_memory]
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
writer = Agent(
|
|
227
|
+
name="writer",
|
|
228
|
+
system_prompt="You write articles based on research.",
|
|
229
|
+
tools=[shared_memory]
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
# Researcher saves findings
|
|
233
|
+
researcher.input("Research AI trends and save the findings")
|
|
234
|
+
|
|
235
|
+
# Writer uses the same memory
|
|
236
|
+
writer.input("Write an article based on AI trends research")
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Advanced Patterns
|
|
240
|
+
|
|
241
|
+
### Memory with Different Tools
|
|
242
|
+
|
|
243
|
+
Memory works alongside any other tools:
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
from connectonion import Agent, Memory
|
|
247
|
+
|
|
248
|
+
def calculate(expression: str) -> float:
|
|
249
|
+
"""Calculate math expressions."""
|
|
250
|
+
return eval(expression)
|
|
251
|
+
|
|
252
|
+
def send_email(to: str, subject: str, body: str) -> str:
|
|
253
|
+
"""Send an email."""
|
|
254
|
+
# Implementation
|
|
255
|
+
return "Email sent"
|
|
256
|
+
|
|
257
|
+
memory = Memory()
|
|
258
|
+
|
|
259
|
+
agent = Agent(
|
|
260
|
+
name="multi-tool-agent",
|
|
261
|
+
tools=[calculate, send_email, memory]
|
|
262
|
+
)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Custom Memory File Organization
|
|
266
|
+
|
|
267
|
+
Organize memories by category:
|
|
268
|
+
|
|
269
|
+
```python
|
|
270
|
+
# Separate memory files for different purposes
|
|
271
|
+
customer_memory = Memory(memory_file="data/customers.md")
|
|
272
|
+
project_memory = Memory(memory_file="data/projects.md")
|
|
273
|
+
research_memory = Memory(memory_file="data/research.md")
|
|
274
|
+
|
|
275
|
+
agent = Agent(
|
|
276
|
+
name="organized-agent",
|
|
277
|
+
tools=[customer_memory, project_memory, research_memory]
|
|
278
|
+
)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Regex Search Patterns
|
|
282
|
+
|
|
283
|
+
Powerful search with regex:
|
|
284
|
+
|
|
285
|
+
```python
|
|
286
|
+
# Find email addresses
|
|
287
|
+
memory.search_memory(r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b")
|
|
288
|
+
|
|
289
|
+
# Find phone numbers
|
|
290
|
+
memory.search_memory(r"\d{3}-\d{3}-\d{4}")
|
|
291
|
+
|
|
292
|
+
# Find dates
|
|
293
|
+
memory.search_memory(r"\d{4}-\d{2}-\d{2}")
|
|
294
|
+
|
|
295
|
+
# Find URLs
|
|
296
|
+
memory.search_memory(r"https?://[^\s]+")
|
|
297
|
+
|
|
298
|
+
# Find specific keywords (word boundaries, case-insensitive)
|
|
299
|
+
memory.search_memory(r"(?i)\bproject\b")
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## File Format
|
|
303
|
+
|
|
304
|
+
### Single File (Default)
|
|
305
|
+
|
|
306
|
+
Memories start in a single `memory.md` file using section headers:
|
|
307
|
+
|
|
308
|
+
```markdown
|
|
309
|
+
## alice-notes
|
|
310
|
+
|
|
311
|
+
Alice prefers email communication
|
|
312
|
+
Works at TechCorp
|
|
313
|
+
Interested in API product
|
|
314
|
+
Last contact: 2025-11-20
|
|
315
|
+
|
|
316
|
+
## bob-notes
|
|
317
|
+
|
|
318
|
+
Bob from Marketing
|
|
319
|
+
Prefers phone calls
|
|
320
|
+
|
|
321
|
+
## project-x
|
|
322
|
+
|
|
323
|
+
Project X is 80% complete
|
|
324
|
+
Needs final testing
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Auto-Split to Directory
|
|
328
|
+
|
|
329
|
+
When `memory.md` exceeds 3000 lines, it automatically migrates to a directory structure:
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
memory/
|
|
333
|
+
├── alice-notes.md
|
|
334
|
+
├── bob-notes.md
|
|
335
|
+
└── project-x.md
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Each file contains plain text/markdown content (without the `##` header).
|
|
339
|
+
|
|
340
|
+
**Benefits of this approach:**
|
|
341
|
+
- Simple by default (one file)
|
|
342
|
+
- Scales automatically when needed
|
|
343
|
+
- Human-readable
|
|
344
|
+
- Version control friendly (git)
|
|
345
|
+
- Easy to edit manually if needed
|
|
346
|
+
- Supports rich formatting
|
|
347
|
+
|
|
348
|
+
## Best Practices
|
|
349
|
+
|
|
350
|
+
### 1. Use Descriptive Keys
|
|
351
|
+
|
|
352
|
+
```python
|
|
353
|
+
# Good
|
|
354
|
+
memory.write_memory("alice-techcorp-contact-info", content)
|
|
355
|
+
memory.write_memory("project-alpha-status", content)
|
|
356
|
+
|
|
357
|
+
# Bad
|
|
358
|
+
memory.write_memory("note1", content)
|
|
359
|
+
memory.write_memory("data", content)
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### 2. Structure Your Content
|
|
363
|
+
|
|
364
|
+
```python
|
|
365
|
+
# Use markdown formatting for better organization
|
|
366
|
+
content = """# Alice - TechCorp
|
|
367
|
+
|
|
368
|
+
## Contact Info
|
|
369
|
+
- Email: alice@techcorp.com
|
|
370
|
+
- Prefers: Email over phone
|
|
371
|
+
|
|
372
|
+
## Projects
|
|
373
|
+
- Interested in API product
|
|
374
|
+
- Budget: $50k
|
|
375
|
+
|
|
376
|
+
## Notes
|
|
377
|
+
- Decision maker
|
|
378
|
+
- Wants demo next week
|
|
379
|
+
"""
|
|
380
|
+
|
|
381
|
+
memory.write_memory("alice-techcorp", content)
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### 3. Keep Memories Updated
|
|
385
|
+
|
|
386
|
+
```python
|
|
387
|
+
# Update or overwrite outdated memories
|
|
388
|
+
agent.input("Review and update any memories older than 6 months")
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### 4. Search Before Creating
|
|
392
|
+
|
|
393
|
+
```python
|
|
394
|
+
# Check if similar memory exists
|
|
395
|
+
agent.input("Do we have any notes about Alice?")
|
|
396
|
+
# Agent will search before creating duplicate memory
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### 5. Use Consistent Naming
|
|
400
|
+
|
|
401
|
+
```python
|
|
402
|
+
# Choose a naming convention and stick to it
|
|
403
|
+
memory.write_memory("customer-alice-techcorp", ...)
|
|
404
|
+
memory.write_memory("customer-bob-acmecorp", ...)
|
|
405
|
+
memory.write_memory("project-alpha", ...)
|
|
406
|
+
memory.write_memory("project-beta", ...)
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
## Limitations
|
|
410
|
+
|
|
411
|
+
### Storage
|
|
412
|
+
|
|
413
|
+
- All memories are kept in memory during search operations
|
|
414
|
+
- For very large memory stores (>1000 files or >100MB), consider database alternatives
|
|
415
|
+
- No built-in memory limits - monitor disk usage
|
|
416
|
+
|
|
417
|
+
### Concurrency
|
|
418
|
+
|
|
419
|
+
- File-based storage is not optimized for high-concurrency scenarios
|
|
420
|
+
- Multiple agents writing to the same memory simultaneously may cause race conditions
|
|
421
|
+
- For production multi-agent systems, consider database-backed storage
|
|
422
|
+
|
|
423
|
+
### Search Performance
|
|
424
|
+
|
|
425
|
+
- Regex search scans all files linearly
|
|
426
|
+
- Performance degrades with more memories
|
|
427
|
+
- For large-scale search needs, consider full-text search solutions (Elasticsearch, etc.)
|
|
428
|
+
|
|
429
|
+
## Troubleshooting
|
|
430
|
+
|
|
431
|
+
### "Memory not found"
|
|
432
|
+
|
|
433
|
+
Check available memories:
|
|
434
|
+
```python
|
|
435
|
+
print(memory.list_memories())
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
Remember that keys are sanitized (lowercase, alphanumeric + hyphens/underscores).
|
|
439
|
+
|
|
440
|
+
### "Invalid key name"
|
|
441
|
+
|
|
442
|
+
Use only alphanumeric characters, hyphens, and underscores:
|
|
443
|
+
```python
|
|
444
|
+
# Good
|
|
445
|
+
memory.write_memory("alice-notes", content)
|
|
446
|
+
|
|
447
|
+
# Bad (will be rejected or sanitized)
|
|
448
|
+
memory.write_memory("alice@notes!", content)
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Memory file not created
|
|
452
|
+
|
|
453
|
+
Memory creates the file automatically on first write:
|
|
454
|
+
```python
|
|
455
|
+
import os
|
|
456
|
+
memory = Memory()
|
|
457
|
+
memory.write_memory("test", "content")
|
|
458
|
+
print(os.path.exists("memory.md")) # Should be True
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
## Next Steps
|
|
462
|
+
|
|
463
|
+
- See [Examples](../examples/memory_agent.py) for complete working code
|
|
464
|
+
- Learn about [Plugins](./plugin.md) for automatic memory behaviors
|
|
465
|
+
- Explore [Multi-Agent Systems](./multi-agent.md) with shared memory
|
|
466
|
+
|
|
467
|
+
## Customizing
|
|
468
|
+
|
|
469
|
+
Need to modify Memory's behavior? Copy the source to your project:
|
|
470
|
+
|
|
471
|
+
```bash
|
|
472
|
+
co copy memory
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Then import from your local copy:
|
|
476
|
+
|
|
477
|
+
```python
|
|
478
|
+
# from connectonion import Memory # Before
|
|
479
|
+
from tools.memory import Memory # After - customize freely!
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
## Related Documentation
|
|
483
|
+
|
|
484
|
+
- [Agent Basics](./agent.md)
|
|
485
|
+
- [Tools](./tools.md)
|
|
486
|
+
- [Plugins](./plugin.md)
|