connectonion 0.6.1__py3-none-any.whl → 0.6.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- connectonion/__init__.py +46 -9
- connectonion/cli/__init__.py +11 -1
- connectonion/cli/browser_agent/__init__.py +11 -1
- connectonion/cli/browser_agent/browser.py +95 -142
- connectonion/cli/browser_agent/element_finder.py +147 -0
- connectonion/cli/browser_agent/highlight_screenshot.py +182 -0
- connectonion/cli/browser_agent/prompt.md +188 -105
- connectonion/cli/browser_agent/prompts/element_matcher.md +59 -0
- connectonion/cli/browser_agent/prompts/form_filler.md +19 -0
- connectonion/cli/browser_agent/prompts/scroll_strategy.md +36 -0
- connectonion/cli/browser_agent/scripts/extract_elements.js +126 -0
- connectonion/cli/browser_agent/scroll.py +145 -0
- connectonion/cli/co_ai/__init__.py +6 -0
- connectonion/cli/co_ai/agent.py +87 -0
- connectonion/cli/co_ai/agents/__init__.py +5 -0
- connectonion/cli/co_ai/agents/registry.py +57 -0
- connectonion/cli/co_ai/commands/__init__.py +45 -0
- connectonion/cli/co_ai/commands/compact.py +173 -0
- connectonion/cli/co_ai/commands/cost.py +77 -0
- connectonion/cli/co_ai/commands/export.py +60 -0
- connectonion/cli/co_ai/commands/help.py +80 -0
- connectonion/cli/co_ai/commands/init.py +101 -0
- connectonion/cli/co_ai/commands/sessions.py +55 -0
- connectonion/cli/co_ai/commands/tasks.py +63 -0
- connectonion/cli/co_ai/commands/undo.py +103 -0
- connectonion/cli/co_ai/context.py +127 -0
- connectonion/cli/co_ai/main.py +52 -0
- connectonion/cli/co_ai/plugins/__init__.py +6 -0
- connectonion/cli/co_ai/plugins/reminder.py +76 -0
- connectonion/cli/co_ai/plugins/shell_approval.py +105 -0
- connectonion/cli/co_ai/prompts/agents/explore.md +79 -0
- connectonion/cli/co_ai/prompts/agents/plan.md +60 -0
- connectonion/cli/co_ai/prompts/assembler.py +303 -0
- connectonion/cli/{docs/co-vibecoding-principles-docs-contexts-all-in-one.md → co_ai/prompts/connectonion/README.md} +26 -0
- connectonion/cli/co_ai/prompts/connectonion/api.md +457 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/README.md +805 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/auth.md +46 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/browser.md +235 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/copy.md +184 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/create.md +335 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/init.md +431 -0
- connectonion/cli/co_ai/prompts/connectonion/co-directory-structure.md +214 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/agent.md +1078 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/events.md +816 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/llm_do.md +256 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/max_iterations.md +362 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/models.md +641 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/plugins.md +100 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/prompts.md +122 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/tools.md +512 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/transcribe.md +156 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/trust.md +291 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/README.md +18 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/auto_debug.md +1026 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/console.md +129 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/eval-format.md +178 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/eval.md +230 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/exceptions.md +307 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/log.md +117 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/xray.md +215 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/001-choosing-input-method.md +202 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/002-choosing-llm-function-name.md +202 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/003-choosing-trust-keyword.md +141 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/004-cli-create-flow.md +117 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/005-designing-agent-network-protocol.md +503 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/006-agent-address-format.md +305 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/007-authentication-backend-design.md +240 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/008-naming-is-hard.md +228 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/009-why-connect-function.md +167 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/010-cli-ux-progressive-disclosure.md +176 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/011-global-config-identity-management.md +357 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/012-tool-execution-separation.md +259 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/013-debug-and-logging-design.md +253 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/014-hook-system-design.md +510 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/015-interactive-auto-debug-design.md +837 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/016-why-no-zero-knowledge-proofs.md +358 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/017-session-logging-and-eval-format.md +120 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/018-event-api-naming.md +274 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/019-agent-lifecycle-design.md +655 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/020-trust-system-and-network-architecture.md +503 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/021-task-storage-jsonl-design.md +496 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/022-raw-asgi-implementation.md +273 -0
- connectonion/cli/co_ai/prompts/connectonion/examples/agent_reasoning.md +62 -0
- connectonion/cli/co_ai/prompts/connectonion/examples/atomic_tools.md +24 -0
- connectonion/cli/co_ai/prompts/connectonion/examples/load_guide.md +18 -0
- connectonion/cli/co_ai/prompts/connectonion/examples.md +0 -0
- connectonion/cli/co_ai/prompts/connectonion/hook-system-options.md +364 -0
- connectonion/cli/co_ai/prompts/connectonion/index.md +162 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/README.md +12 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/auth.md +450 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/google.md +431 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/microsoft.md +370 -0
- connectonion/cli/co_ai/prompts/connectonion/network/README.md +14 -0
- connectonion/cli/co_ai/prompts/connectonion/network/connect.md +543 -0
- connectonion/cli/co_ai/prompts/connectonion/network/connection.md +538 -0
- connectonion/cli/co_ai/prompts/connectonion/network/deploy.md +123 -0
- connectonion/cli/co_ai/prompts/connectonion/network/host.md +1049 -0
- connectonion/cli/co_ai/prompts/connectonion/network/protocol/agent-relay-protocol.md +495 -0
- connectonion/cli/co_ai/prompts/connectonion/network/protocol/announce-message.md +115 -0
- connectonion/cli/co_ai/prompts/connectonion/principles.md +124 -0
- connectonion/cli/co_ai/prompts/connectonion/quickstart.md +261 -0
- connectonion/cli/co_ai/prompts/connectonion/roadmap.md +81 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/README.md +77 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/meta-agent.md +152 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/minimal.md +105 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/playwright.md +130 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/web-research.md +144 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/README.md +95 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/chat.md +181 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/divider.md +63 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/dropdown.md +83 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/footer.md +44 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/fuzzy.md +68 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/input.md +84 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/keys.md +77 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/pick.md +71 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/providers.md +89 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/status_bar.md +67 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/README.md +156 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/calendar_plugin.md +68 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/eval.md +89 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/gmail_plugin.md +68 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/image_result_formatter.md +74 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/re_act.md +86 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/shell_approval.md +69 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/README.md +81 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/diff_writer.md +138 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/get_emails.md +499 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/gmail.md +135 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/google_calendar.md +106 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/memory.md +486 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/microsoft_calendar.md +106 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/outlook.md +120 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/send_email.md +403 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/shell.md +95 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/slash_command.md +96 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/terminal.md +97 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/todo_list.md +252 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/web_fetch.md +130 -0
- connectonion/cli/co_ai/prompts/connectonion/vibe-coding-guide.md +97 -0
- connectonion/cli/co_ai/prompts/connectonion/windows-support.md +258 -0
- connectonion/cli/co_ai/prompts/main.md +247 -0
- connectonion/cli/co_ai/prompts/reminders/plan_mode.md +34 -0
- connectonion/cli/co_ai/prompts/summarization.md +55 -0
- connectonion/cli/co_ai/prompts/tools/ask_user.md +61 -0
- connectonion/cli/co_ai/prompts/tools/background.md +57 -0
- connectonion/cli/co_ai/prompts/tools/edit.md +90 -0
- connectonion/cli/co_ai/prompts/tools/glob.md +52 -0
- connectonion/cli/co_ai/prompts/tools/grep.md +55 -0
- connectonion/cli/co_ai/prompts/tools/plan_mode.md +80 -0
- connectonion/cli/co_ai/prompts/tools/read.md +40 -0
- connectonion/cli/co_ai/prompts/tools/shell.md +67 -0
- connectonion/cli/co_ai/prompts/tools/task.md +51 -0
- connectonion/cli/co_ai/prompts/tools/todo.md +139 -0
- connectonion/cli/co_ai/prompts/tools/write.md +47 -0
- connectonion/cli/co_ai/prompts/workflow.md +89 -0
- connectonion/cli/co_ai/reminders.py +159 -0
- connectonion/cli/co_ai/sessions.py +110 -0
- connectonion/cli/co_ai/skills/__init__.py +37 -0
- connectonion/cli/co_ai/skills/builtin/commit/SKILL.md +63 -0
- connectonion/cli/co_ai/skills/builtin/review-pr/SKILL.md +76 -0
- connectonion/cli/co_ai/skills/loader.py +166 -0
- connectonion/cli/co_ai/skills/tool.py +46 -0
- connectonion/cli/co_ai/tools/__init__.py +92 -0
- connectonion/cli/co_ai/tools/ask_user.py +35 -0
- connectonion/cli/co_ai/tools/background.py +201 -0
- connectonion/cli/co_ai/tools/diff_writer.py +291 -0
- connectonion/cli/co_ai/tools/edit.py +89 -0
- connectonion/cli/co_ai/tools/glob.py +84 -0
- connectonion/cli/co_ai/tools/grep.py +158 -0
- connectonion/cli/co_ai/tools/load_guide.py +23 -0
- connectonion/cli/co_ai/tools/multi_edit.py +116 -0
- connectonion/cli/co_ai/tools/plan_mode.py +172 -0
- connectonion/cli/co_ai/tools/read.py +67 -0
- connectonion/cli/co_ai/tools/task.py +59 -0
- connectonion/cli/co_ai/tools/todo_list.py +159 -0
- connectonion/cli/co_ai/tools/write.py +126 -0
- connectonion/cli/commands/__init__.py +11 -1
- connectonion/cli/commands/ai_commands.py +34 -0
- connectonion/cli/commands/copy_commands.py +55 -6
- connectonion/cli/commands/create.py +20 -17
- connectonion/cli/commands/init.py +19 -22
- connectonion/cli/commands/project_cmd_lib.py +15 -0
- connectonion/cli/main.py +11 -0
- connectonion/console.py +15 -1
- connectonion/core/__init__.py +10 -1
- connectonion/core/agent.py +37 -16
- connectonion/core/exceptions.py +74 -0
- connectonion/core/llm.py +54 -6
- connectonion/core/tool_executor.py +32 -31
- connectonion/core/tool_factory.py +47 -10
- connectonion/debug/__init__.py +10 -1
- connectonion/debug/debug_explainer/__init__.py +10 -1
- connectonion/debug/execution_analyzer/__init__.py +10 -1
- connectonion/debug/execution_analyzer/execution_analysis.py +5 -2
- connectonion/debug/runtime_inspector/__init__.py +10 -1
- connectonion/docs/.package-ignore +6 -0
- connectonion/docs/README.md +2036 -0
- connectonion/docs/api.md +457 -0
- connectonion/docs/archive/001-ai-agent-is-just-prompt-plus-function.md +249 -0
- connectonion/docs/archive/README.md +53 -0
- connectonion/docs/archive/archive/consolidation-plan.md +72 -0
- connectonion/docs/archive/archive/core-principles-extracted.md +239 -0
- connectonion/docs/archive/archive/master-principles.md +222 -0
- connectonion/docs/archive/archive/principles.md +293 -0
- connectonion/docs/archive/archive/simplicity-principles.md +221 -0
- connectonion/docs/archive/attack-defense-insights.md +410 -0
- connectonion/docs/archive/business-model.md +305 -0
- connectonion/docs/archive/core-principles-unified.md +190 -0
- connectonion/docs/archive/discussion-journey.md +178 -0
- connectonion/docs/archive/economic-analysis.md +323 -0
- connectonion/docs/archive/features/01-share-and-find.md +256 -0
- connectonion/docs/archive/features/02-agent-authentication.md +93 -0
- connectonion/docs/archive/features/03-test-before-trust.md +71 -0
- connectonion/docs/archive/features/06-reliability-and-offline.md +197 -0
- connectonion/docs/archive/features/README.md +46 -0
- connectonion/docs/archive/features-roadmap.md +247 -0
- connectonion/docs/archive/mcp-comparison-insights.md +215 -0
- connectonion/docs/archive/migration-strategy.md +571 -0
- connectonion/docs/archive/mini-whitepaper.md +293 -0
- connectonion/docs/archive/network-protocol.md +394 -0
- connectonion/docs/archive/semantic-revolution.md +367 -0
- connectonion/docs/archive/technical-architecture.md +453 -0
- connectonion/docs/archive/the-semantic-insight.md +207 -0
- connectonion/docs/archive/threat-model.md +164 -0
- connectonion/docs/cli/README.md +805 -0
- connectonion/docs/cli/auth.md +46 -0
- connectonion/docs/cli/browser.md +235 -0
- connectonion/docs/cli/copy.md +232 -0
- connectonion/docs/cli/create.md +335 -0
- connectonion/docs/cli/init.md +431 -0
- connectonion/docs/co-directory-structure.md +214 -0
- connectonion/docs/concepts/agent.md +1078 -0
- connectonion/docs/concepts/events.md +699 -0
- connectonion/docs/concepts/llm_do.md +256 -0
- connectonion/docs/concepts/max_iterations.md +362 -0
- connectonion/docs/concepts/models.md +641 -0
- connectonion/docs/concepts/plugins.md +100 -0
- connectonion/docs/concepts/prompts.md +122 -0
- connectonion/docs/concepts/session.md +428 -0
- connectonion/docs/concepts/tools.md +512 -0
- connectonion/docs/concepts/transcribe.md +156 -0
- connectonion/docs/concepts/trust.md +291 -0
- connectonion/docs/connectonion.md +1256 -0
- connectonion/docs/debug/README.md +18 -0
- connectonion/docs/debug/auto_debug.md +1026 -0
- connectonion/docs/debug/console.md +129 -0
- connectonion/docs/debug/eval-format.md +178 -0
- connectonion/docs/debug/eval.md +230 -0
- connectonion/docs/debug/exceptions.md +307 -0
- connectonion/docs/debug/log.md +117 -0
- connectonion/docs/debug/xray.md +215 -0
- connectonion/docs/design-decisions/001-choosing-input-method.md +202 -0
- connectonion/docs/design-decisions/002-choosing-llm-function-name.md +202 -0
- connectonion/docs/design-decisions/003-choosing-trust-keyword.md +141 -0
- connectonion/docs/design-decisions/004-cli-create-flow.md +117 -0
- connectonion/docs/design-decisions/005-designing-agent-network-protocol.md +503 -0
- connectonion/docs/design-decisions/006-agent-address-format.md +305 -0
- connectonion/docs/design-decisions/007-authentication-backend-design.md +240 -0
- connectonion/docs/design-decisions/008-naming-is-hard.md +228 -0
- connectonion/docs/design-decisions/009-why-connect-function.md +167 -0
- connectonion/docs/design-decisions/010-cli-ux-progressive-disclosure.md +176 -0
- connectonion/docs/design-decisions/011-global-config-identity-management.md +357 -0
- connectonion/docs/design-decisions/012-tool-execution-separation.md +259 -0
- connectonion/docs/design-decisions/013-debug-and-logging-design.md +253 -0
- connectonion/docs/design-decisions/014-hook-system-design.md +510 -0
- connectonion/docs/design-decisions/015-interactive-auto-debug-design.md +837 -0
- connectonion/docs/design-decisions/016-why-no-zero-knowledge-proofs.md +358 -0
- connectonion/docs/design-decisions/017-session-logging-and-eval-format.md +120 -0
- connectonion/docs/design-decisions/018-event-api-naming.md +274 -0
- connectonion/docs/design-decisions/019-agent-lifecycle-design.md +655 -0
- connectonion/docs/design-decisions/020-trust-system-and-network-architecture.md +503 -0
- connectonion/docs/design-decisions/021-task-storage-jsonl-design.md +496 -0
- connectonion/docs/design-decisions/022-raw-asgi-implementation.md +273 -0
- connectonion/docs/examples.md +0 -0
- connectonion/docs/hook-system-options.md +364 -0
- connectonion/docs/integrations/README.md +12 -0
- connectonion/docs/integrations/auth.md +450 -0
- connectonion/docs/integrations/google.md +431 -0
- connectonion/docs/integrations/microsoft.md +370 -0
- connectonion/docs/network/README.md +14 -0
- connectonion/docs/network/connect.md +629 -0
- connectonion/docs/network/deploy.md +124 -0
- connectonion/docs/network/host.md +1087 -0
- connectonion/docs/network/io.md +538 -0
- connectonion/docs/network/protocol/agent-relay-protocol.md +495 -0
- connectonion/docs/network/protocol/announce-message.md +115 -0
- connectonion/docs/principles.md +124 -0
- connectonion/docs/quickstart.md +261 -0
- connectonion/docs/roadmap.md +81 -0
- connectonion/docs/templates/README.md +77 -0
- connectonion/docs/templates/meta-agent.md +152 -0
- connectonion/docs/templates/minimal.md +105 -0
- connectonion/docs/templates/playwright.md +130 -0
- connectonion/docs/templates/web-research.md +144 -0
- connectonion/docs/tui/README.md +95 -0
- connectonion/docs/tui/chat.md +181 -0
- connectonion/docs/tui/divider.md +63 -0
- connectonion/docs/tui/dropdown.md +83 -0
- connectonion/docs/tui/footer.md +44 -0
- connectonion/docs/tui/fuzzy.md +68 -0
- connectonion/docs/tui/input.md +84 -0
- connectonion/docs/tui/keys.md +77 -0
- connectonion/docs/tui/pick.md +71 -0
- connectonion/docs/tui/providers.md +89 -0
- connectonion/docs/tui/status_bar.md +67 -0
- connectonion/docs/useful_plugins/README.md +160 -0
- connectonion/docs/useful_plugins/calendar_plugin.md +68 -0
- connectonion/docs/useful_plugins/eval.md +89 -0
- connectonion/docs/useful_plugins/gmail_plugin.md +68 -0
- connectonion/docs/useful_plugins/image_result_formatter.md +74 -0
- connectonion/docs/useful_plugins/re_act.md +86 -0
- connectonion/docs/useful_plugins/shell_approval.md +69 -0
- connectonion/docs/useful_plugins/system_reminder.md +210 -0
- connectonion/docs/useful_prompts/README.md +127 -0
- connectonion/docs/useful_prompts/coding_agent.md +214 -0
- connectonion/docs/useful_tools/README.md +81 -0
- connectonion/docs/useful_tools/ask_user.md +103 -0
- connectonion/docs/useful_tools/diff_writer.md +158 -0
- connectonion/docs/useful_tools/get_emails.md +519 -0
- connectonion/docs/useful_tools/gmail.md +155 -0
- connectonion/docs/useful_tools/google_calendar.md +126 -0
- connectonion/docs/useful_tools/memory.md +506 -0
- connectonion/docs/useful_tools/microsoft_calendar.md +126 -0
- connectonion/docs/useful_tools/outlook.md +140 -0
- connectonion/docs/useful_tools/send_email.md +423 -0
- connectonion/docs/useful_tools/shell.md +115 -0
- connectonion/docs/useful_tools/slash_command.md +116 -0
- connectonion/docs/useful_tools/terminal.md +115 -0
- connectonion/docs/useful_tools/todo_list.md +272 -0
- connectonion/docs/useful_tools/web_fetch.md +150 -0
- connectonion/docs/vibe-coding-guide.md +97 -0
- connectonion/docs/windows-support.md +258 -0
- connectonion/logger.py +3 -3
- connectonion/network/__init__.py +19 -6
- connectonion/network/asgi/__init__.py +81 -0
- connectonion/network/asgi/http.py +205 -0
- connectonion/network/asgi/websocket.py +217 -0
- connectonion/network/connect.py +232 -185
- connectonion/network/host/__init__.py +59 -0
- connectonion/network/host/auth.py +191 -0
- connectonion/network/host/routes.py +135 -0
- connectonion/network/host/server.py +289 -0
- connectonion/network/host/session.py +78 -0
- connectonion/network/io/__init__.py +21 -0
- connectonion/network/{connection.py → io/base.py} +17 -42
- connectonion/network/io/websocket.py +55 -0
- connectonion/network/relay.py +37 -16
- connectonion/network/trust/__init__.py +30 -0
- connectonion/network/trust/factory.py +138 -0
- connectonion/network/{trust_agents.py → trust/prompts.py} +3 -3
- connectonion/network/{trust_functions.py → trust/tools.py} +2 -2
- connectonion/prompt_files/__init__.py +11 -1
- connectonion/prompt_files/react_acknowledge.md +26 -0
- connectonion/prompts.py +10 -1
- connectonion/tui/chat.py +10 -1
- connectonion/tui/divider.py +10 -1
- connectonion/tui/dropdown.py +10 -1
- connectonion/tui/footer.py +8 -0
- connectonion/tui/fuzzy.py +11 -1
- connectonion/tui/input.py +118 -70
- connectonion/tui/keys.py +133 -6
- connectonion/tui/providers.py +11 -1
- connectonion/tui/status_bar.py +10 -1
- connectonion/useful_events_handlers/__init__.py +8 -0
- connectonion/useful_events_handlers/reflect.py +19 -4
- connectonion/useful_plugins/__init__.py +2 -1
- connectonion/useful_plugins/eval.py +2 -2
- connectonion/useful_plugins/gmail_plugin.py +3 -3
- connectonion/useful_plugins/image_result_formatter.py +3 -3
- connectonion/useful_plugins/re_act.py +114 -28
- connectonion/useful_plugins/shell_approval.py +2 -2
- connectonion/useful_plugins/system_reminder.py +103 -0
- connectonion/useful_plugins/ui_stream.py +18 -133
- connectonion/useful_prompts/README.md +61 -0
- connectonion/useful_prompts/__init__.py +45 -0
- connectonion/useful_prompts/coding_agent/README.md +106 -0
- connectonion/useful_prompts/coding_agent/assembler.py +123 -0
- connectonion/useful_prompts/coding_agent/prompts/main.md +227 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/ask_user.md +61 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/background.md +57 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/edit.md +90 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/glob.md +52 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/grep.md +55 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/plan_mode.md +80 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/read.md +40 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/shell.md +67 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/task.md +51 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/todo.md +139 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/write.md +48 -0
- connectonion/useful_prompts/system-reminders/security-warning.md +14 -0
- connectonion/useful_prompts/system-reminders/test-reminder.md +11 -0
- connectonion/useful_tools/__init__.py +31 -4
- connectonion/useful_tools/ask_user.py +35 -0
- connectonion/useful_tools/bash.py +69 -0
- connectonion/useful_tools/diff_writer.py +186 -94
- connectonion/useful_tools/edit.py +102 -0
- connectonion/useful_tools/glob_files.py +97 -0
- connectonion/useful_tools/grep_files.py +171 -0
- connectonion/useful_tools/multi_edit.py +116 -0
- connectonion/useful_tools/read_file.py +73 -0
- connectonion/useful_tools/shell.py +50 -45
- connectonion/useful_tools/write_file.py +129 -0
- {connectonion-0.6.1.dist-info → connectonion-0.6.3.dist-info}/METADATA +10 -3
- connectonion-0.6.3.dist-info/RECORD +469 -0
- connectonion/cli/browser_agent/scroll_strategies.py +0 -276
- connectonion/network/asgi.py +0 -407
- connectonion/network/host.py +0 -616
- connectonion/network/trust.py +0 -166
- connectonion-0.6.1.dist-info/RECORD +0 -123
- /connectonion/cli/{docs → co_ai/prompts/connectonion}/connectonion.md +0 -0
- {connectonion-0.6.1.dist-info → connectonion-0.6.3.dist-info}/WHEEL +0 -0
- {connectonion-0.6.1.dist-info → connectonion-0.6.3.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Cost command for showing session spending."""
|
|
2
|
+
|
|
3
|
+
from rich.console import Console
|
|
4
|
+
from rich.panel import Panel
|
|
5
|
+
from rich.table import Table
|
|
6
|
+
|
|
7
|
+
console = Console()
|
|
8
|
+
|
|
9
|
+
# Module-level storage for agent reference
|
|
10
|
+
_current_agent = None
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def set_agent(agent):
|
|
14
|
+
"""Set the current agent for cost tracking."""
|
|
15
|
+
global _current_agent
|
|
16
|
+
_current_agent = agent
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def cmd_cost(args: str = "") -> str:
|
|
20
|
+
"""
|
|
21
|
+
Display cost and token usage for the current session.
|
|
22
|
+
|
|
23
|
+
Shows:
|
|
24
|
+
- Total cost
|
|
25
|
+
- Token usage (input/output)
|
|
26
|
+
- Context usage percentage
|
|
27
|
+
- Model being used
|
|
28
|
+
"""
|
|
29
|
+
if _current_agent is None:
|
|
30
|
+
console.print("[yellow]No agent session active. Start a conversation first.[/]")
|
|
31
|
+
return "No session"
|
|
32
|
+
|
|
33
|
+
agent = _current_agent
|
|
34
|
+
|
|
35
|
+
# Build cost table
|
|
36
|
+
table = Table(show_header=False, box=None, padding=(0, 2))
|
|
37
|
+
table.add_column("Label", style="dim")
|
|
38
|
+
table.add_column("Value", style="cyan")
|
|
39
|
+
|
|
40
|
+
# Model
|
|
41
|
+
model = getattr(agent.llm, 'model', 'unknown')
|
|
42
|
+
table.add_row("Model", model)
|
|
43
|
+
|
|
44
|
+
# Cost
|
|
45
|
+
total_cost = getattr(agent, 'total_cost', 0)
|
|
46
|
+
if total_cost > 0:
|
|
47
|
+
cost_str = f"${total_cost:.4f}" if total_cost < 0.01 else f"${total_cost:.2f}"
|
|
48
|
+
else:
|
|
49
|
+
cost_str = "$0.00"
|
|
50
|
+
table.add_row("Total Cost", cost_str)
|
|
51
|
+
|
|
52
|
+
# Token usage
|
|
53
|
+
last_usage = getattr(agent, 'last_usage', None)
|
|
54
|
+
if last_usage:
|
|
55
|
+
input_tokens = last_usage.get('input_tokens', 0)
|
|
56
|
+
output_tokens = last_usage.get('output_tokens', 0)
|
|
57
|
+
table.add_row("Input Tokens", f"{input_tokens:,}")
|
|
58
|
+
table.add_row("Output Tokens", f"{output_tokens:,}")
|
|
59
|
+
table.add_row("Total Tokens", f"{input_tokens + output_tokens:,}")
|
|
60
|
+
|
|
61
|
+
# Context usage
|
|
62
|
+
context_percent = getattr(agent, 'context_percent', 0)
|
|
63
|
+
if context_percent > 0:
|
|
64
|
+
bar_width = 20
|
|
65
|
+
filled = int(bar_width * context_percent / 100)
|
|
66
|
+
bar = "█" * filled + "░" * (bar_width - filled)
|
|
67
|
+
color = "green" if context_percent < 50 else "yellow" if context_percent < 80 else "red"
|
|
68
|
+
table.add_row("Context Usage", f"[{color}]{bar}[/] {context_percent:.0f}%")
|
|
69
|
+
|
|
70
|
+
# Messages count
|
|
71
|
+
if hasattr(agent, 'current_session') and agent.current_session:
|
|
72
|
+
messages = agent.current_session.get('messages', [])
|
|
73
|
+
table.add_row("Messages", str(len(messages)))
|
|
74
|
+
|
|
75
|
+
console.print(Panel(table, title="💰 Session Cost", border_style="green"))
|
|
76
|
+
|
|
77
|
+
return f"Cost: {cost_str}"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Export command - export conversation to markdown."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import subprocess
|
|
5
|
+
import tempfile
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
|
|
8
|
+
_agent = None
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def set_agent(agent):
|
|
12
|
+
global _agent
|
|
13
|
+
_agent = agent
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def cmd_export(args: str = "") -> str:
|
|
17
|
+
if not _agent:
|
|
18
|
+
return "No active conversation to export."
|
|
19
|
+
|
|
20
|
+
messages = getattr(_agent, 'messages', [])
|
|
21
|
+
if not messages:
|
|
22
|
+
return "No messages to export."
|
|
23
|
+
|
|
24
|
+
lines = [
|
|
25
|
+
f"# Conversation Export",
|
|
26
|
+
f"",
|
|
27
|
+
f"**Date:** {datetime.now().strftime('%Y-%m-%d %H:%M')}",
|
|
28
|
+
f"**Model:** {_agent.llm.model if hasattr(_agent, 'llm') else 'unknown'}",
|
|
29
|
+
f"",
|
|
30
|
+
"---",
|
|
31
|
+
"",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
for msg in messages:
|
|
35
|
+
role = msg.get('role', 'unknown')
|
|
36
|
+
content = msg.get('content', '')
|
|
37
|
+
|
|
38
|
+
if role == 'user':
|
|
39
|
+
lines.append(f"## User\n\n{content}\n")
|
|
40
|
+
elif role == 'assistant':
|
|
41
|
+
lines.append(f"## Assistant\n\n{content}\n")
|
|
42
|
+
elif role == 'tool':
|
|
43
|
+
tool_name = msg.get('name', 'tool')
|
|
44
|
+
lines.append(f"### Tool: {tool_name}\n\n```\n{content}\n```\n")
|
|
45
|
+
|
|
46
|
+
markdown = "\n".join(lines)
|
|
47
|
+
|
|
48
|
+
editor = os.environ.get("EDITOR", "vim")
|
|
49
|
+
|
|
50
|
+
with tempfile.NamedTemporaryFile(mode='w', suffix='.md', delete=False) as f:
|
|
51
|
+
f.write(markdown)
|
|
52
|
+
f.flush()
|
|
53
|
+
temp_path = f.name
|
|
54
|
+
|
|
55
|
+
editor_parts = editor.split()
|
|
56
|
+
cmd = editor_parts + [temp_path]
|
|
57
|
+
|
|
58
|
+
subprocess.run(cmd)
|
|
59
|
+
|
|
60
|
+
return f"Exported to `{temp_path}`"
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""Help command for OO CLI."""
|
|
2
|
+
|
|
3
|
+
from rich.console import Console
|
|
4
|
+
from rich.panel import Panel
|
|
5
|
+
from rich.markdown import Markdown
|
|
6
|
+
|
|
7
|
+
console = Console()
|
|
8
|
+
|
|
9
|
+
HELP_TEXT = """
|
|
10
|
+
# OO Commands
|
|
11
|
+
|
|
12
|
+
## Built-in Commands
|
|
13
|
+
|
|
14
|
+
| Command | Description |
|
|
15
|
+
|---------|-------------|
|
|
16
|
+
| `/init` | Initialize .co/OO.md for the project |
|
|
17
|
+
| `/review-pr` | Review a GitHub PR (agent skill) |
|
|
18
|
+
| `/cost` | Show session cost and token usage |
|
|
19
|
+
| `/compact` | Compress conversation (LLM summarization) |
|
|
20
|
+
| `/tasks` | List background tasks |
|
|
21
|
+
| `/help` | Show this help message |
|
|
22
|
+
| `clear` | Clear the screen |
|
|
23
|
+
| `exit` | Exit OO |
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# One-shot mode
|
|
29
|
+
oo "fix the bug in auth.py"
|
|
30
|
+
|
|
31
|
+
# Interactive mode
|
|
32
|
+
oo
|
|
33
|
+
|
|
34
|
+
# With options
|
|
35
|
+
oo -m co/gemini-2.5-pro "task" # Use different model
|
|
36
|
+
oo -y "task" # Auto-approve file changes
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Agent Tools
|
|
40
|
+
|
|
41
|
+
**Search:** `glob`, `grep`
|
|
42
|
+
**Files:** `read_file`, `edit`, `write`
|
|
43
|
+
**Execute:** `bash`
|
|
44
|
+
**Sub-agents:** `task` (explore, plan)
|
|
45
|
+
**Plan Mode:** `enter_plan_mode`, `exit_plan_mode`
|
|
46
|
+
**Interaction:** `ask_user`, `confirm`
|
|
47
|
+
**Skills:** `skill` (auto-invoked when relevant)
|
|
48
|
+
**Background:** `run_background`, `task_output`, `kill_task`
|
|
49
|
+
|
|
50
|
+
## Skills
|
|
51
|
+
|
|
52
|
+
Skills are auto-discovered instruction sets. Built-in skills:
|
|
53
|
+
- `commit` - Create git commits with good messages
|
|
54
|
+
- `review-pr` - Review GitHub pull requests
|
|
55
|
+
|
|
56
|
+
Add custom skills in `.co/skills/skill-name/SKILL.md`
|
|
57
|
+
|
|
58
|
+
## Configuration
|
|
59
|
+
|
|
60
|
+
OO reads context from (in priority order):
|
|
61
|
+
1. `.co/OO.md` - OO-specific instructions
|
|
62
|
+
2. `CLAUDE.md` - Compatibility with Claude Code
|
|
63
|
+
3. `README.md` - Project understanding
|
|
64
|
+
|
|
65
|
+
Run `/init` to create `.co/OO.md` for your project.
|
|
66
|
+
|
|
67
|
+
## Tips
|
|
68
|
+
|
|
69
|
+
- Use `@` to autocomplete file paths
|
|
70
|
+
- Use `/` to autocomplete commands
|
|
71
|
+
- Use `/cost` to check spending
|
|
72
|
+
- Use `/compact` when context is high (>70%)
|
|
73
|
+
- Use `/tasks` to monitor background operations
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def cmd_help(args: str = "") -> str:
|
|
78
|
+
"""Show help message."""
|
|
79
|
+
console.print(Panel(Markdown(HELP_TEXT), title="oo /help", border_style="blue"))
|
|
80
|
+
return "Help displayed"
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"""Initialize OO for a project."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from rich.console import Console
|
|
5
|
+
from rich.panel import Panel
|
|
6
|
+
|
|
7
|
+
console = Console()
|
|
8
|
+
|
|
9
|
+
OO_MD_TEMPLATE = """# Project Configuration for OO
|
|
10
|
+
|
|
11
|
+
## About This Project
|
|
12
|
+
|
|
13
|
+
[Describe what this project does]
|
|
14
|
+
|
|
15
|
+
## Key Files
|
|
16
|
+
|
|
17
|
+
- `src/` - Source code
|
|
18
|
+
- `tests/` - Tests
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Development
|
|
24
|
+
npm run dev
|
|
25
|
+
|
|
26
|
+
# Testing
|
|
27
|
+
npm test
|
|
28
|
+
|
|
29
|
+
# Build
|
|
30
|
+
npm run build
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Coding Conventions
|
|
34
|
+
|
|
35
|
+
- [Add your coding style preferences]
|
|
36
|
+
- [Add naming conventions]
|
|
37
|
+
- [Add any project-specific rules]
|
|
38
|
+
|
|
39
|
+
## Important Notes
|
|
40
|
+
|
|
41
|
+
- [Add things OO should know when working on this project]
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def cmd_init(args: str = "") -> str:
|
|
46
|
+
"""
|
|
47
|
+
Initialize .co/ directory with OO.md configuration.
|
|
48
|
+
|
|
49
|
+
Creates:
|
|
50
|
+
- .co/OO.md - Project configuration file for OO
|
|
51
|
+
|
|
52
|
+
Detects:
|
|
53
|
+
- README.md - Will be used for project understanding
|
|
54
|
+
- CLAUDE.md - Will be used for compatibility
|
|
55
|
+
"""
|
|
56
|
+
cwd = Path.cwd()
|
|
57
|
+
co_dir = cwd / ".co"
|
|
58
|
+
oo_md = co_dir / "OO.md"
|
|
59
|
+
|
|
60
|
+
# Check what already exists
|
|
61
|
+
readme_exists = (cwd / "README.md").exists()
|
|
62
|
+
claude_exists = (cwd / "CLAUDE.md").exists()
|
|
63
|
+
oo_exists = oo_md.exists()
|
|
64
|
+
|
|
65
|
+
if oo_exists:
|
|
66
|
+
console.print(f"[yellow].co/OO.md already exists[/]")
|
|
67
|
+
console.print(f"Edit [cyan]{oo_md}[/] to update configuration.")
|
|
68
|
+
return "Already initialized"
|
|
69
|
+
|
|
70
|
+
# Create .co directory
|
|
71
|
+
co_dir.mkdir(exist_ok=True)
|
|
72
|
+
|
|
73
|
+
# Create OO.md
|
|
74
|
+
oo_md.write_text(OO_MD_TEMPLATE, encoding="utf-8")
|
|
75
|
+
|
|
76
|
+
# Build status message
|
|
77
|
+
lines = [
|
|
78
|
+
"[green]✓[/] Created [cyan].co/OO.md[/]",
|
|
79
|
+
"",
|
|
80
|
+
"Detected:",
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
if readme_exists:
|
|
84
|
+
lines.append(" [green]✓[/] README.md (will use for project understanding)")
|
|
85
|
+
else:
|
|
86
|
+
lines.append(" [dim]○[/] README.md (not found)")
|
|
87
|
+
|
|
88
|
+
if claude_exists:
|
|
89
|
+
lines.append(" [green]✓[/] CLAUDE.md (will use for compatibility)")
|
|
90
|
+
else:
|
|
91
|
+
lines.append(" [dim]○[/] CLAUDE.md (not found)")
|
|
92
|
+
|
|
93
|
+
lines.extend([
|
|
94
|
+
"",
|
|
95
|
+
f"Edit [cyan].co/OO.md[/] to configure OO for your project.",
|
|
96
|
+
])
|
|
97
|
+
|
|
98
|
+
output = "\n".join(lines)
|
|
99
|
+
console.print(Panel(output, title="oo /init", border_style="green"))
|
|
100
|
+
|
|
101
|
+
return "Initialized"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Session commands - /sessions, /new."""
|
|
2
|
+
|
|
3
|
+
from connectonion.cli.co_ai.sessions import get_session_manager
|
|
4
|
+
|
|
5
|
+
_agent = None
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def set_agent(agent):
|
|
9
|
+
global _agent
|
|
10
|
+
_agent = agent
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def cmd_sessions(args: str = "") -> str:
|
|
14
|
+
manager = get_session_manager()
|
|
15
|
+
sessions = manager.list_sessions(limit=10)
|
|
16
|
+
|
|
17
|
+
if not sessions:
|
|
18
|
+
return "No saved sessions. Start chatting to create one!"
|
|
19
|
+
|
|
20
|
+
lines = ["**Recent Sessions:**\n"]
|
|
21
|
+
for s in sessions:
|
|
22
|
+
date = s["updated_at"][:10] if s.get("updated_at") else "unknown"
|
|
23
|
+
title = s.get("title", "Untitled")[:40]
|
|
24
|
+
lines.append(f"- `{s['id']}` - {title} ({date})")
|
|
25
|
+
|
|
26
|
+
lines.append("\n*Use `/resume <id>` to continue a session*")
|
|
27
|
+
return "\n".join(lines)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def cmd_new(args: str = "") -> str:
|
|
31
|
+
manager = get_session_manager()
|
|
32
|
+
model = _agent.llm.model if _agent and hasattr(_agent, 'llm') else ""
|
|
33
|
+
session_id = manager.create_session(model=model)
|
|
34
|
+
|
|
35
|
+
if _agent and hasattr(_agent, 'messages'):
|
|
36
|
+
_agent.messages = []
|
|
37
|
+
|
|
38
|
+
return f"Started new session: `{session_id}`"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def cmd_resume(args: str = "") -> str:
|
|
42
|
+
if not args.strip():
|
|
43
|
+
return "Usage: `/resume <session_id>`\n\nUse `/sessions` to see available sessions."
|
|
44
|
+
|
|
45
|
+
session_id = args.strip()
|
|
46
|
+
manager = get_session_manager()
|
|
47
|
+
messages = manager.load_session(session_id)
|
|
48
|
+
|
|
49
|
+
if messages is None:
|
|
50
|
+
return f"Session `{session_id}` not found."
|
|
51
|
+
|
|
52
|
+
if _agent and hasattr(_agent, 'messages'):
|
|
53
|
+
_agent.messages = [{"role": m["role"], "content": m["content"]} for m in messages]
|
|
54
|
+
|
|
55
|
+
return f"Resumed session `{session_id}` with {len(messages)} messages."
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Tasks command - list and manage background tasks."""
|
|
2
|
+
|
|
3
|
+
from rich.console import Console
|
|
4
|
+
from rich.table import Table
|
|
5
|
+
|
|
6
|
+
from connectonion.cli.co_ai.tools.background import _tasks, TaskStatus
|
|
7
|
+
|
|
8
|
+
console = Console()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def cmd_tasks(args: str = "") -> str:
|
|
12
|
+
"""List background tasks.
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
/tasks - List all tasks
|
|
16
|
+
/tasks kill bg_1 - Kill a specific task
|
|
17
|
+
"""
|
|
18
|
+
parts = args.strip().split()
|
|
19
|
+
|
|
20
|
+
if parts and parts[0] == "kill":
|
|
21
|
+
if len(parts) < 2:
|
|
22
|
+
console.print("[error]Usage: /tasks kill <task_id>[/]")
|
|
23
|
+
return "Missing task ID"
|
|
24
|
+
|
|
25
|
+
from connectonion.cli.co_ai.tools.background import kill_task
|
|
26
|
+
result = kill_task(parts[1])
|
|
27
|
+
console.print(result)
|
|
28
|
+
return result
|
|
29
|
+
|
|
30
|
+
# List all tasks
|
|
31
|
+
if not _tasks:
|
|
32
|
+
console.print("[dim]No background tasks.[/]")
|
|
33
|
+
return "No background tasks"
|
|
34
|
+
|
|
35
|
+
table = Table(title="Background Tasks")
|
|
36
|
+
table.add_column("ID", style="cyan")
|
|
37
|
+
table.add_column("Status", style="bold")
|
|
38
|
+
table.add_column("Command")
|
|
39
|
+
table.add_column("Time", justify="right")
|
|
40
|
+
|
|
41
|
+
import time
|
|
42
|
+
for task in _tasks.values():
|
|
43
|
+
elapsed = time.time() - task.start_time
|
|
44
|
+
if task.end_time:
|
|
45
|
+
elapsed = task.end_time - task.start_time
|
|
46
|
+
|
|
47
|
+
status_style = {
|
|
48
|
+
TaskStatus.RUNNING: "yellow",
|
|
49
|
+
TaskStatus.COMPLETED: "green",
|
|
50
|
+
TaskStatus.FAILED: "red",
|
|
51
|
+
}[task.status]
|
|
52
|
+
|
|
53
|
+
cmd_short = task.command[:50] + "..." if len(task.command) > 50 else task.command
|
|
54
|
+
|
|
55
|
+
table.add_row(
|
|
56
|
+
task.id,
|
|
57
|
+
f"[{status_style}]{task.status.value}[/]",
|
|
58
|
+
cmd_short,
|
|
59
|
+
f"{elapsed:.1f}s",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
console.print(table)
|
|
63
|
+
return f"Listed {len(_tasks)} tasks"
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""Undo/Redo commands with Git backing."""
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
_agent = None
|
|
7
|
+
_undo_stack: list[dict] = []
|
|
8
|
+
_redo_stack: list[dict] = []
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def set_agent(agent):
|
|
12
|
+
global _agent
|
|
13
|
+
_agent = agent
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _is_git_repo() -> bool:
|
|
17
|
+
result = subprocess.run(["git", "rev-parse", "--git-dir"], capture_output=True)
|
|
18
|
+
return result.returncode == 0
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _git_stash_push(message: str) -> bool:
|
|
22
|
+
result = subprocess.run(
|
|
23
|
+
["git", "stash", "push", "-m", message, "--include-untracked"],
|
|
24
|
+
capture_output=True, text=True
|
|
25
|
+
)
|
|
26
|
+
return result.returncode == 0
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _git_stash_pop() -> bool:
|
|
30
|
+
result = subprocess.run(["git", "stash", "pop"], capture_output=True, text=True)
|
|
31
|
+
return result.returncode == 0
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _git_stash_apply(index: int = 0) -> bool:
|
|
35
|
+
result = subprocess.run(
|
|
36
|
+
["git", "stash", "apply", f"stash@{{{index}}}"],
|
|
37
|
+
capture_output=True, text=True
|
|
38
|
+
)
|
|
39
|
+
return result.returncode == 0
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _git_stash_drop(index: int = 0) -> bool:
|
|
43
|
+
result = subprocess.run(
|
|
44
|
+
["git", "stash", "drop", f"stash@{{{index}}}"],
|
|
45
|
+
capture_output=True, text=True
|
|
46
|
+
)
|
|
47
|
+
return result.returncode == 0
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def cmd_undo(args: str = "") -> str:
|
|
51
|
+
if not _is_git_repo():
|
|
52
|
+
return "**Error:** Not a git repository. Undo requires git."
|
|
53
|
+
|
|
54
|
+
if not _agent or not hasattr(_agent, 'messages'):
|
|
55
|
+
return "No conversation to undo."
|
|
56
|
+
|
|
57
|
+
messages = _agent.messages
|
|
58
|
+
if len(messages) < 2:
|
|
59
|
+
return "Nothing to undo."
|
|
60
|
+
|
|
61
|
+
user_msg = None
|
|
62
|
+
assistant_msg = None
|
|
63
|
+
|
|
64
|
+
for i in range(len(messages) - 1, -1, -1):
|
|
65
|
+
if messages[i].get('role') == 'assistant' and assistant_msg is None:
|
|
66
|
+
assistant_msg = messages[i]
|
|
67
|
+
elif messages[i].get('role') == 'user' and assistant_msg and user_msg is None:
|
|
68
|
+
user_msg = messages[i]
|
|
69
|
+
break
|
|
70
|
+
|
|
71
|
+
if not user_msg or not assistant_msg:
|
|
72
|
+
return "Nothing to undo."
|
|
73
|
+
|
|
74
|
+
_git_stash_push(f"oo-undo-{len(_undo_stack)}")
|
|
75
|
+
|
|
76
|
+
_undo_stack.append({
|
|
77
|
+
"user": user_msg,
|
|
78
|
+
"assistant": assistant_msg,
|
|
79
|
+
"stash_index": len(_undo_stack)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
messages.remove(user_msg)
|
|
83
|
+
messages.remove(assistant_msg)
|
|
84
|
+
_redo_stack.clear()
|
|
85
|
+
|
|
86
|
+
return f"Undone last message. File changes stashed. Use `/redo` to restore."
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def cmd_redo(args: str = "") -> str:
|
|
90
|
+
if not _undo_stack:
|
|
91
|
+
return "Nothing to redo."
|
|
92
|
+
|
|
93
|
+
if not _agent or not hasattr(_agent, 'messages'):
|
|
94
|
+
return "No active conversation."
|
|
95
|
+
|
|
96
|
+
entry = _undo_stack.pop()
|
|
97
|
+
|
|
98
|
+
_git_stash_pop()
|
|
99
|
+
|
|
100
|
+
_agent.messages.append(entry["user"])
|
|
101
|
+
_agent.messages.append(entry["assistant"])
|
|
102
|
+
|
|
103
|
+
return "Restored last undone message and file changes."
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""Context loading for project awareness."""
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
8
|
+
from connectonion.cli.co_ai.skills.loader import load_skills, get_skills_for_prompt
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def load_project_context(base_path: Optional[Path] = None) -> str:
|
|
12
|
+
"""
|
|
13
|
+
Load project context from various sources.
|
|
14
|
+
|
|
15
|
+
Reading priority:
|
|
16
|
+
1. .co/OO.md - OO-specific instructions (our brand)
|
|
17
|
+
2. CLAUDE.md - Compatibility with Claude Code
|
|
18
|
+
3. README.md - Project understanding
|
|
19
|
+
4. Git status - Current branch and changes
|
|
20
|
+
5. Environment - Working directory, date
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
base_path: Base directory to look for context files (default: cwd)
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
Assembled context string for system prompt
|
|
27
|
+
"""
|
|
28
|
+
base = base_path or Path.cwd()
|
|
29
|
+
parts = []
|
|
30
|
+
|
|
31
|
+
# 1. Load .co/OO.md (our brand, primary)
|
|
32
|
+
oo_md = base / ".co" / "OO.md"
|
|
33
|
+
if oo_md.exists():
|
|
34
|
+
content = oo_md.read_text(encoding="utf-8")
|
|
35
|
+
parts.append(f"# Project Instructions (OO.md)\n\n{content}")
|
|
36
|
+
|
|
37
|
+
# 2. Load CLAUDE.md (compatibility)
|
|
38
|
+
claude_md = base / "CLAUDE.md"
|
|
39
|
+
if claude_md.exists():
|
|
40
|
+
content = claude_md.read_text(encoding="utf-8")
|
|
41
|
+
if oo_md.exists():
|
|
42
|
+
parts.append(f"# Additional Instructions (CLAUDE.md)\n\n{content}")
|
|
43
|
+
else:
|
|
44
|
+
parts.append(f"# Project Instructions (CLAUDE.md)\n\n{content}")
|
|
45
|
+
|
|
46
|
+
# 3. Load README.md (project understanding)
|
|
47
|
+
readme_md = base / "README.md"
|
|
48
|
+
if readme_md.exists():
|
|
49
|
+
content = readme_md.read_text(encoding="utf-8")
|
|
50
|
+
# Truncate if too long (README can be verbose)
|
|
51
|
+
if len(content) > 5000:
|
|
52
|
+
content = content[:5000] + "\n\n... (truncated)"
|
|
53
|
+
parts.append(f"# Project Overview (README.md)\n\n{content}")
|
|
54
|
+
|
|
55
|
+
# 4. Load skills (descriptions only)
|
|
56
|
+
load_skills(base)
|
|
57
|
+
skills_prompt = get_skills_for_prompt()
|
|
58
|
+
if skills_prompt:
|
|
59
|
+
parts.append(f"# Available Skills\n\n{skills_prompt}")
|
|
60
|
+
|
|
61
|
+
# 5. Git status
|
|
62
|
+
git_info = _get_git_info(base)
|
|
63
|
+
if git_info:
|
|
64
|
+
parts.append(git_info)
|
|
65
|
+
|
|
66
|
+
# 6. Environment info
|
|
67
|
+
env_info = f"""# Environment
|
|
68
|
+
|
|
69
|
+
Working Directory: {base}
|
|
70
|
+
Date: {datetime.now().strftime("%Y-%m-%d")}
|
|
71
|
+
"""
|
|
72
|
+
parts.append(env_info)
|
|
73
|
+
|
|
74
|
+
return "\n\n---\n\n".join(parts)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _get_git_info(base: Path) -> Optional[str]:
|
|
78
|
+
"""Get git status information."""
|
|
79
|
+
git_dir = base / ".git"
|
|
80
|
+
if not git_dir.exists():
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
try:
|
|
84
|
+
# Get current branch
|
|
85
|
+
branch = subprocess.run(
|
|
86
|
+
["git", "branch", "--show-current"],
|
|
87
|
+
capture_output=True,
|
|
88
|
+
text=True,
|
|
89
|
+
cwd=base,
|
|
90
|
+
timeout=5,
|
|
91
|
+
)
|
|
92
|
+
branch_name = branch.stdout.strip() if branch.returncode == 0 else "unknown"
|
|
93
|
+
|
|
94
|
+
# Get status
|
|
95
|
+
status = subprocess.run(
|
|
96
|
+
["git", "status", "--short"],
|
|
97
|
+
capture_output=True,
|
|
98
|
+
text=True,
|
|
99
|
+
cwd=base,
|
|
100
|
+
timeout=5,
|
|
101
|
+
)
|
|
102
|
+
status_output = status.stdout.strip() if status.returncode == 0 else ""
|
|
103
|
+
|
|
104
|
+
# Get recent commits (last 3)
|
|
105
|
+
log = subprocess.run(
|
|
106
|
+
["git", "log", "--oneline", "-3"],
|
|
107
|
+
capture_output=True,
|
|
108
|
+
text=True,
|
|
109
|
+
cwd=base,
|
|
110
|
+
timeout=5,
|
|
111
|
+
)
|
|
112
|
+
log_output = log.stdout.strip() if log.returncode == 0 else ""
|
|
113
|
+
|
|
114
|
+
result = f"# Git Status\n\nBranch: {branch_name}"
|
|
115
|
+
|
|
116
|
+
if status_output:
|
|
117
|
+
result += f"\n\nChanges:\n```\n{status_output}\n```"
|
|
118
|
+
else:
|
|
119
|
+
result += "\n\nNo uncommitted changes."
|
|
120
|
+
|
|
121
|
+
if log_output:
|
|
122
|
+
result += f"\n\nRecent commits:\n```\n{log_output}\n```"
|
|
123
|
+
|
|
124
|
+
return result
|
|
125
|
+
|
|
126
|
+
except (subprocess.TimeoutExpired, FileNotFoundError):
|
|
127
|
+
return None
|