connectonion 0.6.2__py3-none-any.whl → 0.6.4__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 +5 -0
- connectonion/cli/co_ai/plugins/system_reminder.py +154 -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/summarization.md +55 -0
- connectonion/cli/co_ai/prompts/system-reminders/agent.md +23 -0
- connectonion/cli/co_ai/prompts/system-reminders/plan_mode.md +13 -0
- connectonion/cli/co_ai/prompts/system-reminders/security.md +14 -0
- connectonion/cli/co_ai/prompts/system-reminders/simplicity.md +14 -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/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 +169 -0
- connectonion/cli/co_ai/tools/read.py +61 -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 +101 -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_plugins/tool_approval.md +139 -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 +3 -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/tool_approval.py +233 -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.4.dist-info}/METADATA +10 -3
- connectonion-0.6.4.dist-info/RECORD +472 -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.4.dist-info}/WHEEL +0 -0
- {connectonion-0.6.2.dist-info → connectonion-0.6.4.dist-info}/entry_points.txt +0 -0
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Purpose:
|
|
2
|
+
Purpose: Plugin for streaming agent completion summaries to WebSocket UI clients
|
|
3
3
|
LLM-Note:
|
|
4
|
-
Dependencies: imports from [
|
|
5
|
-
Data flow:
|
|
6
|
-
State/Effects:
|
|
7
|
-
Integration: exposes ui_stream
|
|
8
|
-
Performance:
|
|
9
|
-
Errors:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- LLM responses (thinking, tool_calls)
|
|
16
|
-
- Tool execution (before/after each tool)
|
|
17
|
-
- Errors and completion
|
|
4
|
+
Dependencies: imports from [core/events.py on_complete, typing] | imported by [useful_plugins/__init__.py, user code] | tested by [tests/plugins/test_ui_stream.py]
|
|
5
|
+
Data flow: fires on_complete event → extracts trace from current_session → counts tools_used and llm_calls → sends via agent.io.log('complete', tools_used, llm_calls, iterations) → WebSocket client receives completion event
|
|
6
|
+
State/Effects: sends message via agent.io (if connected) | no persistent state | read-only access to session trace
|
|
7
|
+
Integration: exposes ui_stream plugin (use via plugins=[ui_stream]) | only fires if agent.io exists (hosted mode) | complements direct events from agent.py/tool_executor.py | stream_complete handler decorated with @on_complete
|
|
8
|
+
Performance: minimal overhead (just counting trace entries) | single io.log call
|
|
9
|
+
Errors: returns early if no io connection | no exceptions raised
|
|
10
|
+
UI Stream Plugin - Stream agent completion summary to connected UI clients.
|
|
11
|
+
|
|
12
|
+
Events (user_input, thinking, tool_result, assistant) are now emitted directly
|
|
13
|
+
from their source (agent.py, tool_executor.py, plugins). This plugin only
|
|
14
|
+
handles the completion summary.
|
|
18
15
|
|
|
19
16
|
Usage:
|
|
20
17
|
from connectonion import Agent
|
|
@@ -25,128 +22,23 @@ Usage:
|
|
|
25
22
|
"""
|
|
26
23
|
|
|
27
24
|
from typing import TYPE_CHECKING
|
|
28
|
-
from ..core.events import
|
|
29
|
-
after_llm,
|
|
30
|
-
before_each_tool,
|
|
31
|
-
after_each_tool,
|
|
32
|
-
on_error,
|
|
33
|
-
on_complete,
|
|
34
|
-
)
|
|
25
|
+
from ..core.events import on_complete
|
|
35
26
|
|
|
36
27
|
if TYPE_CHECKING:
|
|
37
28
|
from ..core.agent import Agent
|
|
38
29
|
|
|
39
30
|
|
|
40
|
-
@after_llm
|
|
41
|
-
def stream_llm_response(agent: 'Agent') -> None:
|
|
42
|
-
"""Stream LLM response to connected UI."""
|
|
43
|
-
if not agent.connection:
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
trace = agent.current_session.get('trace', [])
|
|
47
|
-
if not trace:
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
last = trace[-1]
|
|
51
|
-
if last.get('type') != 'llm_call':
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
# Stream content if present
|
|
55
|
-
content = last.get('content', '')
|
|
56
|
-
if content:
|
|
57
|
-
agent.connection.log('message', content=content)
|
|
58
|
-
|
|
59
|
-
# Stream tool calls if present
|
|
60
|
-
tool_calls = last.get('tool_calls', [])
|
|
61
|
-
for tc in tool_calls:
|
|
62
|
-
agent.connection.log(
|
|
63
|
-
'tool_pending',
|
|
64
|
-
name=tc.get('function', {}).get('name', ''),
|
|
65
|
-
arguments=tc.get('function', {}).get('arguments', {}),
|
|
66
|
-
id=tc.get('id', ''),
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
@before_each_tool
|
|
71
|
-
def stream_tool_start(agent: 'Agent') -> None:
|
|
72
|
-
"""Stream tool execution start to connected UI."""
|
|
73
|
-
if not agent.connection:
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
pending = agent.current_session.get('pending_tool')
|
|
77
|
-
if not pending:
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
agent.connection.log(
|
|
81
|
-
'tool_start',
|
|
82
|
-
name=pending['name'],
|
|
83
|
-
arguments=pending['arguments'],
|
|
84
|
-
id=pending.get('id', ''),
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
@after_each_tool
|
|
89
|
-
def stream_tool_result(agent: 'Agent') -> None:
|
|
90
|
-
"""Stream tool execution result to connected UI."""
|
|
91
|
-
if not agent.connection:
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
trace = agent.current_session.get('trace', [])
|
|
95
|
-
if not trace:
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
last = trace[-1]
|
|
99
|
-
if last.get('type') != 'tool_execution':
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
status = last.get('status', 'unknown')
|
|
103
|
-
result = last.get('result', '')
|
|
104
|
-
|
|
105
|
-
# Truncate large results for UI
|
|
106
|
-
if isinstance(result, str) and len(result) > 1000:
|
|
107
|
-
result = result[:1000] + '...'
|
|
108
|
-
|
|
109
|
-
agent.connection.log(
|
|
110
|
-
'tool_result',
|
|
111
|
-
name=last.get('tool_name', ''),
|
|
112
|
-
status=status,
|
|
113
|
-
result=result,
|
|
114
|
-
timing_ms=last.get('timing', 0),
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@on_error
|
|
119
|
-
def stream_error(agent: 'Agent') -> None:
|
|
120
|
-
"""Stream error to connected UI."""
|
|
121
|
-
if not agent.connection:
|
|
122
|
-
return
|
|
123
|
-
|
|
124
|
-
trace = agent.current_session.get('trace', [])
|
|
125
|
-
if not trace:
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
last = trace[-1]
|
|
129
|
-
if last.get('status') != 'error':
|
|
130
|
-
return
|
|
131
|
-
|
|
132
|
-
agent.connection.log(
|
|
133
|
-
'error',
|
|
134
|
-
tool_name=last.get('tool_name', ''),
|
|
135
|
-
error=str(last.get('error', '')),
|
|
136
|
-
)
|
|
137
|
-
|
|
138
|
-
|
|
139
31
|
@on_complete
|
|
140
32
|
def stream_complete(agent: 'Agent') -> None:
|
|
141
|
-
"""Stream completion to connected UI."""
|
|
142
|
-
if not agent.
|
|
33
|
+
"""Stream completion summary to connected UI."""
|
|
34
|
+
if not agent.io:
|
|
143
35
|
return
|
|
144
36
|
|
|
145
37
|
trace = agent.current_session.get('trace', [])
|
|
146
|
-
tools_used = [t.get('
|
|
38
|
+
tools_used = [t.get('name', '') for t in trace if t.get('type') == 'tool_result']
|
|
147
39
|
llm_calls = len([t for t in trace if t.get('type') == 'llm_call'])
|
|
148
40
|
|
|
149
|
-
agent.
|
|
41
|
+
agent.io.log(
|
|
150
42
|
'complete',
|
|
151
43
|
tools_used=tools_used,
|
|
152
44
|
llm_calls=llm_calls,
|
|
@@ -154,11 +46,4 @@ def stream_complete(agent: 'Agent') -> None:
|
|
|
154
46
|
)
|
|
155
47
|
|
|
156
48
|
|
|
157
|
-
|
|
158
|
-
ui_stream = [
|
|
159
|
-
stream_llm_response,
|
|
160
|
-
stream_tool_start,
|
|
161
|
-
stream_tool_result,
|
|
162
|
-
stream_error,
|
|
163
|
-
stream_complete,
|
|
164
|
-
]
|
|
49
|
+
ui_stream = [stream_complete]
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# useful_prompts
|
|
2
|
+
|
|
3
|
+
Prompt examples and patterns for ConnectOnion agents. Copy what you need to your project.
|
|
4
|
+
|
|
5
|
+
## Philosophy
|
|
6
|
+
|
|
7
|
+
These are **examples**, not framework code. You:
|
|
8
|
+
1. Browse the examples
|
|
9
|
+
2. Copy what fits your needs
|
|
10
|
+
3. Modify freely - you own the code now
|
|
11
|
+
|
|
12
|
+
No lock-in. No rigid structure. Just good patterns.
|
|
13
|
+
|
|
14
|
+
## Available Examples
|
|
15
|
+
|
|
16
|
+
### coding_agent/
|
|
17
|
+
A modular prompt structure for coding assistants.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
coding_agent/
|
|
21
|
+
├── prompts/
|
|
22
|
+
│ ├── main.md # Core agent behavior
|
|
23
|
+
│ └── tools/ # Per-tool guidance
|
|
24
|
+
│ ├── shell.md
|
|
25
|
+
│ ├── read.md
|
|
26
|
+
│ ├── write.md
|
|
27
|
+
│ └── todo.md
|
|
28
|
+
├── assembler.py # Simple prompt assembly
|
|
29
|
+
└── README.md
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Good for:** CLI coding assistants, code review bots, development helpers
|
|
33
|
+
|
|
34
|
+
## How to Use
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Copy the example to your project
|
|
38
|
+
cp -r useful_prompts/coding_agent/ my-project/
|
|
39
|
+
|
|
40
|
+
# Customize the prompts
|
|
41
|
+
cd my-project/coding_agent
|
|
42
|
+
vim prompts/main.md # Edit core behavior
|
|
43
|
+
vim prompts/tools/shell.md # Edit shell guidance
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Creating Your Own
|
|
47
|
+
|
|
48
|
+
1. Start with an existing example
|
|
49
|
+
2. Modify `main.md` for your agent's personality
|
|
50
|
+
3. Add/remove tool files as needed
|
|
51
|
+
4. Customize `assembler.py` for your assembly logic
|
|
52
|
+
|
|
53
|
+
## Principles
|
|
54
|
+
|
|
55
|
+
From Claude Code's architecture, we learned:
|
|
56
|
+
|
|
57
|
+
1. **Modular prompts** - Split by concern (main, per-tool)
|
|
58
|
+
2. **"When NOT to use"** - As important as "when to use"
|
|
59
|
+
3. **Examples with reasoning** - Show good AND bad patterns
|
|
60
|
+
4. **Assembly at runtime** - Combine pieces based on available tools
|
|
61
|
+
5. **User owns the code** - No framework lock-in
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Purpose: Prompt templates directory with utility for copying example prompts to user projects
|
|
3
|
+
LLM-Note:
|
|
4
|
+
Dependencies: imports from [pathlib] | imported by [cli/commands/copy_commands.py, user code] | tested by [tests/prompts/test_useful_prompts.py]
|
|
5
|
+
Data flow: get_example_path(name) → returns Path to template directory for copying | PROMPTS_DIR constant points to useful_prompts/ directory
|
|
6
|
+
State/Effects: reads filesystem (Path operations) | no modifications
|
|
7
|
+
Integration: exposes PROMPTS_DIR constant, get_example_path(name) → Path | used by `co copy coding_agent` command to copy templates | contains coding_agent/ subdirectory with main.md, tools/*.md, assembler.py
|
|
8
|
+
Performance: trivial (Path operations only)
|
|
9
|
+
Errors: none (Path returned whether directory exists or not, caller handles)
|
|
10
|
+
useful_prompts - Prompt templates for ConnectOnion agents.
|
|
11
|
+
|
|
12
|
+
These are PROMPT TEMPLATES to copy to your project, not framework code to import.
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
1. Run: co copy coding_agent
|
|
16
|
+
2. Customize the markdown files in prompts/coding_agent/
|
|
17
|
+
3. Use assembler.py to build your system prompt
|
|
18
|
+
|
|
19
|
+
Available prompts:
|
|
20
|
+
- coding_agent/ : Coding Agent Prompt - modular template for coding assistants
|
|
21
|
+
|
|
22
|
+
See README.md for details.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
|
|
27
|
+
# Path to useful_prompts directory (for copying examples)
|
|
28
|
+
PROMPTS_DIR = Path(__file__).parent
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def get_example_path(name: str) -> Path:
|
|
32
|
+
"""Get path to an example directory for copying.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
name: Example name (e.g., "coding_agent")
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
Path to the example directory
|
|
39
|
+
|
|
40
|
+
Example:
|
|
41
|
+
>>> from connectonion.useful_prompts import get_example_path
|
|
42
|
+
>>> import shutil
|
|
43
|
+
>>> shutil.copytree(get_example_path("coding_agent"), "my_prompts")
|
|
44
|
+
"""
|
|
45
|
+
return PROMPTS_DIR / name
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Coding Agent Prompt
|
|
2
|
+
|
|
3
|
+
A modular **prompt template** for building coding agents. This is a prompt (not code) - copy it to your project and customize the markdown files.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
coding_agent/
|
|
9
|
+
├── prompts/
|
|
10
|
+
│ ├── main.md # Core agent behavior
|
|
11
|
+
│ └── tools/ # Per-tool guidance
|
|
12
|
+
│ ├── shell.md # Shell/bash usage
|
|
13
|
+
│ ├── read.md # File reading
|
|
14
|
+
│ ├── write.md # File writing
|
|
15
|
+
│ └── todo.md # Task tracking
|
|
16
|
+
├── assembler.py # Prompt assembly utility
|
|
17
|
+
└── README.md
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
1. **Copy to your project:**
|
|
23
|
+
```bash
|
|
24
|
+
cp -r coding_agent/ my-project/
|
|
25
|
+
cd my-project/coding_agent
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
2. **Use the assembler:**
|
|
29
|
+
```python
|
|
30
|
+
from assembler import assemble_prompt
|
|
31
|
+
from connectonion import Agent
|
|
32
|
+
from connectonion.useful_tools import Shell, DiffWriter
|
|
33
|
+
|
|
34
|
+
def read_file(path: str) -> str:
|
|
35
|
+
return open(path).read()
|
|
36
|
+
|
|
37
|
+
tools = [Shell(), read_file, DiffWriter()]
|
|
38
|
+
prompt = assemble_prompt(prompts_dir="prompts", tools=tools)
|
|
39
|
+
|
|
40
|
+
agent = Agent("my-agent", system_prompt=prompt, tools=tools)
|
|
41
|
+
agent.run()
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Customization
|
|
45
|
+
|
|
46
|
+
### Modify main.md
|
|
47
|
+
Edit `prompts/main.md` to change:
|
|
48
|
+
- Agent personality and tone
|
|
49
|
+
- Workflow steps
|
|
50
|
+
- General guidelines
|
|
51
|
+
|
|
52
|
+
### Add/modify tool descriptions
|
|
53
|
+
Each file in `prompts/tools/` provides guidance for one tool:
|
|
54
|
+
- `shell.md` - When to use shell, when not to
|
|
55
|
+
- `read.md` - File reading best practices
|
|
56
|
+
- `write.md` - File writing guidelines
|
|
57
|
+
- `todo.md` - Task tracking guidance
|
|
58
|
+
|
|
59
|
+
Add new files for your custom tools:
|
|
60
|
+
```markdown
|
|
61
|
+
# prompts/tools/my_custom_tool.md
|
|
62
|
+
|
|
63
|
+
# Tool: My Custom Tool
|
|
64
|
+
|
|
65
|
+
## When to Use
|
|
66
|
+
- Situation A
|
|
67
|
+
- Situation B
|
|
68
|
+
|
|
69
|
+
## When NOT to Use
|
|
70
|
+
- Situation C
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Add project context
|
|
74
|
+
Create `.co/AGENT.md` in your project root for project-specific instructions:
|
|
75
|
+
```markdown
|
|
76
|
+
# Project: My App
|
|
77
|
+
|
|
78
|
+
## Tech Stack
|
|
79
|
+
- Python 3.11
|
|
80
|
+
- FastAPI
|
|
81
|
+
- PostgreSQL
|
|
82
|
+
|
|
83
|
+
## Conventions
|
|
84
|
+
- Use snake_case for functions
|
|
85
|
+
- Type hints required
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Then pass it to the assembler:
|
|
89
|
+
```python
|
|
90
|
+
prompt = assemble_prompt(
|
|
91
|
+
prompts_dir="prompts",
|
|
92
|
+
tools=tools,
|
|
93
|
+
context_file=".co/AGENT.md"
|
|
94
|
+
)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Philosophy
|
|
98
|
+
|
|
99
|
+
This is NOT a framework. It's an example you own completely.
|
|
100
|
+
|
|
101
|
+
- Modify any file freely
|
|
102
|
+
- Delete what you don't need
|
|
103
|
+
- Add what you want
|
|
104
|
+
- No dependencies on ConnectOnion internals
|
|
105
|
+
|
|
106
|
+
The assembler is ~50 lines of simple Python. Read it, understand it, change it.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Purpose: Modular prompt assembly for coding agents from main.md + tool-specific prompts + project context
|
|
3
|
+
LLM-Note:
|
|
4
|
+
Dependencies: imports from [pathlib, typing] | imported by [examples/coding_agent/, user code] | tested by [tests/prompts/test_assembler.py]
|
|
5
|
+
Data flow: assemble_prompt(prompts_dir, tools, context_file) → reads prompts/main.md → for each tool reads prompts/tools/{tool_name}.md → optionally reads context_file (.co/AGENT.md) → concatenates with separators → returns assembled prompt
|
|
6
|
+
State/Effects: reads markdown files from filesystem | no persistent state
|
|
7
|
+
Integration: exposes assemble_prompt(prompts_dir, tools, context_file) → str | expects directory structure: prompts/main.md, prompts/tools/*.md | tool name extracted from tool.__name__ or tool.name | user customizable (copy to project and modify)
|
|
8
|
+
Performance: file I/O only (fast for typical prompt files) | lazy loading (only reads requested tool prompts)
|
|
9
|
+
Errors: skips missing tool prompt files silently | raises if main.md missing | context_file optional
|
|
10
|
+
Prompt Assembler - Copy this to your project and customize!
|
|
11
|
+
|
|
12
|
+
This is NOT a framework class. It's an example you can modify freely.
|
|
13
|
+
The assembled prompt combines:
|
|
14
|
+
- Main prompt (core agent behavior)
|
|
15
|
+
- Tool descriptions (for each tool you use)
|
|
16
|
+
- Project context (optional .co/AGENT.md)
|
|
17
|
+
|
|
18
|
+
Usage:
|
|
19
|
+
from assembler import assemble_prompt
|
|
20
|
+
|
|
21
|
+
prompt = assemble_prompt(
|
|
22
|
+
tools=[shell, read_file, writer],
|
|
23
|
+
context_file=".co/AGENT.md" # optional
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
agent = Agent("my-agent", system_prompt=prompt, tools=tools)
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
from pathlib import Path
|
|
30
|
+
from typing import List, Any, Optional
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def assemble_prompt(
|
|
34
|
+
prompts_dir: str = "prompts",
|
|
35
|
+
tools: Optional[List[Any]] = None,
|
|
36
|
+
context_file: Optional[str] = None,
|
|
37
|
+
) -> str:
|
|
38
|
+
"""
|
|
39
|
+
Assemble a system prompt from modular files.
|
|
40
|
+
|
|
41
|
+
Directory structure:
|
|
42
|
+
prompts/
|
|
43
|
+
├── main.md # Core agent behavior
|
|
44
|
+
└── tools/ # Tool-specific guidance
|
|
45
|
+
├── shell.md
|
|
46
|
+
├── read.md
|
|
47
|
+
└── write.md
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
prompts_dir: Path to prompts directory
|
|
51
|
+
tools: List of tool objects/functions (loads matching .md files)
|
|
52
|
+
context_file: Optional project-specific context file
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
Assembled prompt string
|
|
56
|
+
"""
|
|
57
|
+
prompts_path = Path(prompts_dir)
|
|
58
|
+
parts = []
|
|
59
|
+
|
|
60
|
+
# 1. Main prompt (required)
|
|
61
|
+
main_file = prompts_path / "main.md"
|
|
62
|
+
if main_file.exists():
|
|
63
|
+
parts.append(main_file.read_text())
|
|
64
|
+
|
|
65
|
+
# 2. Tool descriptions (for each available tool)
|
|
66
|
+
tools_dir = prompts_path / "tools"
|
|
67
|
+
if tools_dir.exists() and tools:
|
|
68
|
+
for tool in tools:
|
|
69
|
+
tool_name = _get_tool_name(tool).lower()
|
|
70
|
+
tool_file = tools_dir / f"{tool_name}.md"
|
|
71
|
+
if tool_file.exists():
|
|
72
|
+
parts.append(tool_file.read_text())
|
|
73
|
+
|
|
74
|
+
# 3. Project context (optional)
|
|
75
|
+
if context_file:
|
|
76
|
+
context_path = Path(context_file)
|
|
77
|
+
if context_path.exists():
|
|
78
|
+
parts.append(f"# Project Context\n\n{context_path.read_text()}")
|
|
79
|
+
|
|
80
|
+
return "\n\n---\n\n".join(parts)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _get_tool_name(tool: Any) -> str:
|
|
84
|
+
"""Extract tool name from function or class instance."""
|
|
85
|
+
# Function
|
|
86
|
+
if callable(tool) and hasattr(tool, "__name__"):
|
|
87
|
+
return tool.__name__
|
|
88
|
+
|
|
89
|
+
# Class instance with name attribute
|
|
90
|
+
if hasattr(tool, "name"):
|
|
91
|
+
return tool.name
|
|
92
|
+
|
|
93
|
+
# Class instance - use class name
|
|
94
|
+
return tool.__class__.__name__
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# Example usage
|
|
98
|
+
if __name__ == "__main__":
|
|
99
|
+
from connectonion import Agent
|
|
100
|
+
from connectonion.useful_tools import bash, DiffWriter, TodoList
|
|
101
|
+
|
|
102
|
+
# Define tools
|
|
103
|
+
def read_file(path: str) -> str:
|
|
104
|
+
"""Read file contents."""
|
|
105
|
+
return Path(path).read_text()
|
|
106
|
+
|
|
107
|
+
writer = DiffWriter()
|
|
108
|
+
todo = TodoList()
|
|
109
|
+
tools = [bash, read_file, writer, todo]
|
|
110
|
+
|
|
111
|
+
# Assemble prompt
|
|
112
|
+
prompt = assemble_prompt(
|
|
113
|
+
prompts_dir="prompts",
|
|
114
|
+
tools=tools,
|
|
115
|
+
context_file=".co/AGENT.md"
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
print(f"Assembled prompt ({len(prompt)} chars):\n")
|
|
119
|
+
print(prompt[:500] + "...")
|
|
120
|
+
|
|
121
|
+
# Create agent
|
|
122
|
+
# agent = Agent("coding-agent", system_prompt=prompt, tools=tools)
|
|
123
|
+
# agent.run()
|