connectonion 0.6.2__py3-none-any.whl → 0.6.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) hide show
  1. connectonion/__init__.py +46 -9
  2. connectonion/cli/__init__.py +11 -1
  3. connectonion/cli/browser_agent/__init__.py +11 -1
  4. connectonion/cli/browser_agent/browser.py +13 -3
  5. connectonion/cli/browser_agent/element_finder.py +8 -0
  6. connectonion/cli/browser_agent/highlight_screenshot.py +9 -1
  7. connectonion/cli/browser_agent/scroll.py +8 -0
  8. connectonion/cli/co_ai/__init__.py +6 -0
  9. connectonion/cli/co_ai/agent.py +87 -0
  10. connectonion/cli/co_ai/agents/__init__.py +5 -0
  11. connectonion/cli/co_ai/agents/registry.py +57 -0
  12. connectonion/cli/co_ai/commands/__init__.py +45 -0
  13. connectonion/cli/co_ai/commands/compact.py +173 -0
  14. connectonion/cli/co_ai/commands/cost.py +77 -0
  15. connectonion/cli/co_ai/commands/export.py +60 -0
  16. connectonion/cli/co_ai/commands/help.py +80 -0
  17. connectonion/cli/co_ai/commands/init.py +101 -0
  18. connectonion/cli/co_ai/commands/sessions.py +55 -0
  19. connectonion/cli/co_ai/commands/tasks.py +63 -0
  20. connectonion/cli/co_ai/commands/undo.py +103 -0
  21. connectonion/cli/co_ai/context.py +127 -0
  22. connectonion/cli/co_ai/main.py +52 -0
  23. connectonion/cli/co_ai/plugins/__init__.py +6 -0
  24. connectonion/cli/co_ai/plugins/reminder.py +76 -0
  25. connectonion/cli/co_ai/plugins/shell_approval.py +105 -0
  26. connectonion/cli/co_ai/prompts/agents/explore.md +79 -0
  27. connectonion/cli/co_ai/prompts/agents/plan.md +60 -0
  28. connectonion/cli/co_ai/prompts/assembler.py +303 -0
  29. connectonion/cli/{docs/co-vibecoding-principles-docs-contexts-all-in-one.md → co_ai/prompts/connectonion/README.md} +26 -0
  30. connectonion/cli/co_ai/prompts/connectonion/api.md +457 -0
  31. connectonion/cli/co_ai/prompts/connectonion/cli/README.md +805 -0
  32. connectonion/cli/co_ai/prompts/connectonion/cli/auth.md +46 -0
  33. connectonion/cli/co_ai/prompts/connectonion/cli/browser.md +235 -0
  34. connectonion/cli/co_ai/prompts/connectonion/cli/copy.md +184 -0
  35. connectonion/cli/co_ai/prompts/connectonion/cli/create.md +335 -0
  36. connectonion/cli/co_ai/prompts/connectonion/cli/init.md +431 -0
  37. connectonion/cli/co_ai/prompts/connectonion/co-directory-structure.md +214 -0
  38. connectonion/cli/co_ai/prompts/connectonion/concepts/agent.md +1078 -0
  39. connectonion/cli/co_ai/prompts/connectonion/concepts/events.md +816 -0
  40. connectonion/cli/co_ai/prompts/connectonion/concepts/llm_do.md +256 -0
  41. connectonion/cli/co_ai/prompts/connectonion/concepts/max_iterations.md +362 -0
  42. connectonion/cli/co_ai/prompts/connectonion/concepts/models.md +641 -0
  43. connectonion/cli/co_ai/prompts/connectonion/concepts/plugins.md +100 -0
  44. connectonion/cli/co_ai/prompts/connectonion/concepts/prompts.md +122 -0
  45. connectonion/cli/co_ai/prompts/connectonion/concepts/tools.md +512 -0
  46. connectonion/cli/co_ai/prompts/connectonion/concepts/transcribe.md +156 -0
  47. connectonion/cli/co_ai/prompts/connectonion/concepts/trust.md +291 -0
  48. connectonion/cli/co_ai/prompts/connectonion/debug/README.md +18 -0
  49. connectonion/cli/co_ai/prompts/connectonion/debug/auto_debug.md +1026 -0
  50. connectonion/cli/co_ai/prompts/connectonion/debug/console.md +129 -0
  51. connectonion/cli/co_ai/prompts/connectonion/debug/eval-format.md +178 -0
  52. connectonion/cli/co_ai/prompts/connectonion/debug/eval.md +230 -0
  53. connectonion/cli/co_ai/prompts/connectonion/debug/exceptions.md +307 -0
  54. connectonion/cli/co_ai/prompts/connectonion/debug/log.md +117 -0
  55. connectonion/cli/co_ai/prompts/connectonion/debug/xray.md +215 -0
  56. connectonion/cli/co_ai/prompts/connectonion/design-decisions/001-choosing-input-method.md +202 -0
  57. connectonion/cli/co_ai/prompts/connectonion/design-decisions/002-choosing-llm-function-name.md +202 -0
  58. connectonion/cli/co_ai/prompts/connectonion/design-decisions/003-choosing-trust-keyword.md +141 -0
  59. connectonion/cli/co_ai/prompts/connectonion/design-decisions/004-cli-create-flow.md +117 -0
  60. connectonion/cli/co_ai/prompts/connectonion/design-decisions/005-designing-agent-network-protocol.md +503 -0
  61. connectonion/cli/co_ai/prompts/connectonion/design-decisions/006-agent-address-format.md +305 -0
  62. connectonion/cli/co_ai/prompts/connectonion/design-decisions/007-authentication-backend-design.md +240 -0
  63. connectonion/cli/co_ai/prompts/connectonion/design-decisions/008-naming-is-hard.md +228 -0
  64. connectonion/cli/co_ai/prompts/connectonion/design-decisions/009-why-connect-function.md +167 -0
  65. connectonion/cli/co_ai/prompts/connectonion/design-decisions/010-cli-ux-progressive-disclosure.md +176 -0
  66. connectonion/cli/co_ai/prompts/connectonion/design-decisions/011-global-config-identity-management.md +357 -0
  67. connectonion/cli/co_ai/prompts/connectonion/design-decisions/012-tool-execution-separation.md +259 -0
  68. connectonion/cli/co_ai/prompts/connectonion/design-decisions/013-debug-and-logging-design.md +253 -0
  69. connectonion/cli/co_ai/prompts/connectonion/design-decisions/014-hook-system-design.md +510 -0
  70. connectonion/cli/co_ai/prompts/connectonion/design-decisions/015-interactive-auto-debug-design.md +837 -0
  71. connectonion/cli/co_ai/prompts/connectonion/design-decisions/016-why-no-zero-knowledge-proofs.md +358 -0
  72. connectonion/cli/co_ai/prompts/connectonion/design-decisions/017-session-logging-and-eval-format.md +120 -0
  73. connectonion/cli/co_ai/prompts/connectonion/design-decisions/018-event-api-naming.md +274 -0
  74. connectonion/cli/co_ai/prompts/connectonion/design-decisions/019-agent-lifecycle-design.md +655 -0
  75. connectonion/cli/co_ai/prompts/connectonion/design-decisions/020-trust-system-and-network-architecture.md +503 -0
  76. connectonion/cli/co_ai/prompts/connectonion/design-decisions/021-task-storage-jsonl-design.md +496 -0
  77. connectonion/cli/co_ai/prompts/connectonion/design-decisions/022-raw-asgi-implementation.md +273 -0
  78. connectonion/cli/co_ai/prompts/connectonion/examples/agent_reasoning.md +62 -0
  79. connectonion/cli/co_ai/prompts/connectonion/examples/atomic_tools.md +24 -0
  80. connectonion/cli/co_ai/prompts/connectonion/examples/load_guide.md +18 -0
  81. connectonion/cli/co_ai/prompts/connectonion/examples.md +0 -0
  82. connectonion/cli/co_ai/prompts/connectonion/hook-system-options.md +364 -0
  83. connectonion/cli/co_ai/prompts/connectonion/index.md +162 -0
  84. connectonion/cli/co_ai/prompts/connectonion/integrations/README.md +12 -0
  85. connectonion/cli/co_ai/prompts/connectonion/integrations/auth.md +450 -0
  86. connectonion/cli/co_ai/prompts/connectonion/integrations/google.md +431 -0
  87. connectonion/cli/co_ai/prompts/connectonion/integrations/microsoft.md +370 -0
  88. connectonion/cli/co_ai/prompts/connectonion/network/README.md +14 -0
  89. connectonion/cli/co_ai/prompts/connectonion/network/connect.md +543 -0
  90. connectonion/cli/co_ai/prompts/connectonion/network/connection.md +538 -0
  91. connectonion/cli/co_ai/prompts/connectonion/network/deploy.md +123 -0
  92. connectonion/cli/co_ai/prompts/connectonion/network/host.md +1049 -0
  93. connectonion/cli/co_ai/prompts/connectonion/network/protocol/agent-relay-protocol.md +495 -0
  94. connectonion/cli/co_ai/prompts/connectonion/network/protocol/announce-message.md +115 -0
  95. connectonion/cli/co_ai/prompts/connectonion/principles.md +124 -0
  96. connectonion/cli/co_ai/prompts/connectonion/quickstart.md +261 -0
  97. connectonion/cli/co_ai/prompts/connectonion/roadmap.md +81 -0
  98. connectonion/cli/co_ai/prompts/connectonion/templates/README.md +77 -0
  99. connectonion/cli/co_ai/prompts/connectonion/templates/meta-agent.md +152 -0
  100. connectonion/cli/co_ai/prompts/connectonion/templates/minimal.md +105 -0
  101. connectonion/cli/co_ai/prompts/connectonion/templates/playwright.md +130 -0
  102. connectonion/cli/co_ai/prompts/connectonion/templates/web-research.md +144 -0
  103. connectonion/cli/co_ai/prompts/connectonion/tui/README.md +95 -0
  104. connectonion/cli/co_ai/prompts/connectonion/tui/chat.md +181 -0
  105. connectonion/cli/co_ai/prompts/connectonion/tui/divider.md +63 -0
  106. connectonion/cli/co_ai/prompts/connectonion/tui/dropdown.md +83 -0
  107. connectonion/cli/co_ai/prompts/connectonion/tui/footer.md +44 -0
  108. connectonion/cli/co_ai/prompts/connectonion/tui/fuzzy.md +68 -0
  109. connectonion/cli/co_ai/prompts/connectonion/tui/input.md +84 -0
  110. connectonion/cli/co_ai/prompts/connectonion/tui/keys.md +77 -0
  111. connectonion/cli/co_ai/prompts/connectonion/tui/pick.md +71 -0
  112. connectonion/cli/co_ai/prompts/connectonion/tui/providers.md +89 -0
  113. connectonion/cli/co_ai/prompts/connectonion/tui/status_bar.md +67 -0
  114. connectonion/cli/co_ai/prompts/connectonion/useful_plugins/README.md +156 -0
  115. connectonion/cli/co_ai/prompts/connectonion/useful_plugins/calendar_plugin.md +68 -0
  116. connectonion/cli/co_ai/prompts/connectonion/useful_plugins/eval.md +89 -0
  117. connectonion/cli/co_ai/prompts/connectonion/useful_plugins/gmail_plugin.md +68 -0
  118. connectonion/cli/co_ai/prompts/connectonion/useful_plugins/image_result_formatter.md +74 -0
  119. connectonion/cli/co_ai/prompts/connectonion/useful_plugins/re_act.md +86 -0
  120. connectonion/cli/co_ai/prompts/connectonion/useful_plugins/shell_approval.md +69 -0
  121. connectonion/cli/co_ai/prompts/connectonion/useful_tools/README.md +81 -0
  122. connectonion/cli/co_ai/prompts/connectonion/useful_tools/diff_writer.md +138 -0
  123. connectonion/cli/co_ai/prompts/connectonion/useful_tools/get_emails.md +499 -0
  124. connectonion/cli/co_ai/prompts/connectonion/useful_tools/gmail.md +135 -0
  125. connectonion/cli/co_ai/prompts/connectonion/useful_tools/google_calendar.md +106 -0
  126. connectonion/cli/co_ai/prompts/connectonion/useful_tools/memory.md +486 -0
  127. connectonion/cli/co_ai/prompts/connectonion/useful_tools/microsoft_calendar.md +106 -0
  128. connectonion/cli/co_ai/prompts/connectonion/useful_tools/outlook.md +120 -0
  129. connectonion/cli/co_ai/prompts/connectonion/useful_tools/send_email.md +403 -0
  130. connectonion/cli/co_ai/prompts/connectonion/useful_tools/shell.md +95 -0
  131. connectonion/cli/co_ai/prompts/connectonion/useful_tools/slash_command.md +96 -0
  132. connectonion/cli/co_ai/prompts/connectonion/useful_tools/terminal.md +97 -0
  133. connectonion/cli/co_ai/prompts/connectonion/useful_tools/todo_list.md +252 -0
  134. connectonion/cli/co_ai/prompts/connectonion/useful_tools/web_fetch.md +130 -0
  135. connectonion/cli/co_ai/prompts/connectonion/vibe-coding-guide.md +97 -0
  136. connectonion/cli/co_ai/prompts/connectonion/windows-support.md +258 -0
  137. connectonion/cli/co_ai/prompts/main.md +247 -0
  138. connectonion/cli/co_ai/prompts/reminders/plan_mode.md +34 -0
  139. connectonion/cli/co_ai/prompts/summarization.md +55 -0
  140. connectonion/cli/co_ai/prompts/tools/ask_user.md +61 -0
  141. connectonion/cli/co_ai/prompts/tools/background.md +57 -0
  142. connectonion/cli/co_ai/prompts/tools/edit.md +90 -0
  143. connectonion/cli/co_ai/prompts/tools/glob.md +52 -0
  144. connectonion/cli/co_ai/prompts/tools/grep.md +55 -0
  145. connectonion/cli/co_ai/prompts/tools/plan_mode.md +80 -0
  146. connectonion/cli/co_ai/prompts/tools/read.md +40 -0
  147. connectonion/cli/co_ai/prompts/tools/shell.md +67 -0
  148. connectonion/cli/co_ai/prompts/tools/task.md +51 -0
  149. connectonion/cli/co_ai/prompts/tools/todo.md +139 -0
  150. connectonion/cli/co_ai/prompts/tools/write.md +47 -0
  151. connectonion/cli/co_ai/prompts/workflow.md +89 -0
  152. connectonion/cli/co_ai/reminders.py +159 -0
  153. connectonion/cli/co_ai/sessions.py +110 -0
  154. connectonion/cli/co_ai/skills/__init__.py +37 -0
  155. connectonion/cli/co_ai/skills/builtin/commit/SKILL.md +63 -0
  156. connectonion/cli/co_ai/skills/builtin/review-pr/SKILL.md +76 -0
  157. connectonion/cli/co_ai/skills/loader.py +166 -0
  158. connectonion/cli/co_ai/skills/tool.py +46 -0
  159. connectonion/cli/co_ai/tools/__init__.py +92 -0
  160. connectonion/cli/co_ai/tools/ask_user.py +35 -0
  161. connectonion/cli/co_ai/tools/background.py +201 -0
  162. connectonion/cli/co_ai/tools/diff_writer.py +291 -0
  163. connectonion/cli/co_ai/tools/edit.py +89 -0
  164. connectonion/cli/co_ai/tools/glob.py +84 -0
  165. connectonion/cli/co_ai/tools/grep.py +158 -0
  166. connectonion/cli/co_ai/tools/load_guide.py +23 -0
  167. connectonion/cli/co_ai/tools/multi_edit.py +116 -0
  168. connectonion/cli/co_ai/tools/plan_mode.py +172 -0
  169. connectonion/cli/co_ai/tools/read.py +67 -0
  170. connectonion/cli/co_ai/tools/task.py +59 -0
  171. connectonion/cli/co_ai/tools/todo_list.py +159 -0
  172. connectonion/cli/co_ai/tools/write.py +126 -0
  173. connectonion/cli/commands/__init__.py +11 -1
  174. connectonion/cli/commands/ai_commands.py +34 -0
  175. connectonion/cli/commands/copy_commands.py +55 -6
  176. connectonion/cli/commands/create.py +20 -17
  177. connectonion/cli/commands/init.py +19 -22
  178. connectonion/cli/commands/project_cmd_lib.py +15 -0
  179. connectonion/cli/main.py +11 -0
  180. connectonion/console.py +15 -1
  181. connectonion/core/__init__.py +10 -1
  182. connectonion/core/agent.py +37 -16
  183. connectonion/core/exceptions.py +74 -0
  184. connectonion/core/llm.py +54 -6
  185. connectonion/core/tool_executor.py +32 -31
  186. connectonion/core/tool_factory.py +47 -10
  187. connectonion/debug/__init__.py +10 -1
  188. connectonion/debug/debug_explainer/__init__.py +10 -1
  189. connectonion/debug/execution_analyzer/__init__.py +10 -1
  190. connectonion/debug/execution_analyzer/execution_analysis.py +5 -2
  191. connectonion/debug/runtime_inspector/__init__.py +10 -1
  192. connectonion/docs/.package-ignore +6 -0
  193. connectonion/docs/README.md +2036 -0
  194. connectonion/docs/api.md +457 -0
  195. connectonion/docs/archive/001-ai-agent-is-just-prompt-plus-function.md +249 -0
  196. connectonion/docs/archive/README.md +53 -0
  197. connectonion/docs/archive/archive/consolidation-plan.md +72 -0
  198. connectonion/docs/archive/archive/core-principles-extracted.md +239 -0
  199. connectonion/docs/archive/archive/master-principles.md +222 -0
  200. connectonion/docs/archive/archive/principles.md +293 -0
  201. connectonion/docs/archive/archive/simplicity-principles.md +221 -0
  202. connectonion/docs/archive/attack-defense-insights.md +410 -0
  203. connectonion/docs/archive/business-model.md +305 -0
  204. connectonion/docs/archive/core-principles-unified.md +190 -0
  205. connectonion/docs/archive/discussion-journey.md +178 -0
  206. connectonion/docs/archive/economic-analysis.md +323 -0
  207. connectonion/docs/archive/features/01-share-and-find.md +256 -0
  208. connectonion/docs/archive/features/02-agent-authentication.md +93 -0
  209. connectonion/docs/archive/features/03-test-before-trust.md +71 -0
  210. connectonion/docs/archive/features/06-reliability-and-offline.md +197 -0
  211. connectonion/docs/archive/features/README.md +46 -0
  212. connectonion/docs/archive/features-roadmap.md +247 -0
  213. connectonion/docs/archive/mcp-comparison-insights.md +215 -0
  214. connectonion/docs/archive/migration-strategy.md +571 -0
  215. connectonion/docs/archive/mini-whitepaper.md +293 -0
  216. connectonion/docs/archive/network-protocol.md +394 -0
  217. connectonion/docs/archive/semantic-revolution.md +367 -0
  218. connectonion/docs/archive/technical-architecture.md +453 -0
  219. connectonion/docs/archive/the-semantic-insight.md +207 -0
  220. connectonion/docs/archive/threat-model.md +164 -0
  221. connectonion/docs/cli/README.md +805 -0
  222. connectonion/docs/cli/auth.md +46 -0
  223. connectonion/docs/cli/browser.md +235 -0
  224. connectonion/docs/cli/copy.md +232 -0
  225. connectonion/docs/cli/create.md +335 -0
  226. connectonion/docs/cli/init.md +431 -0
  227. connectonion/docs/co-directory-structure.md +214 -0
  228. connectonion/docs/concepts/agent.md +1078 -0
  229. connectonion/docs/concepts/events.md +699 -0
  230. connectonion/docs/concepts/llm_do.md +256 -0
  231. connectonion/docs/concepts/max_iterations.md +362 -0
  232. connectonion/docs/concepts/models.md +641 -0
  233. connectonion/docs/concepts/plugins.md +100 -0
  234. connectonion/docs/concepts/prompts.md +122 -0
  235. connectonion/docs/concepts/session.md +428 -0
  236. connectonion/docs/concepts/tools.md +512 -0
  237. connectonion/docs/concepts/transcribe.md +156 -0
  238. connectonion/docs/concepts/trust.md +291 -0
  239. connectonion/docs/connectonion.md +1256 -0
  240. connectonion/docs/debug/README.md +18 -0
  241. connectonion/docs/debug/auto_debug.md +1026 -0
  242. connectonion/docs/debug/console.md +129 -0
  243. connectonion/docs/debug/eval-format.md +178 -0
  244. connectonion/docs/debug/eval.md +230 -0
  245. connectonion/docs/debug/exceptions.md +307 -0
  246. connectonion/docs/debug/log.md +117 -0
  247. connectonion/docs/debug/xray.md +215 -0
  248. connectonion/docs/design-decisions/001-choosing-input-method.md +202 -0
  249. connectonion/docs/design-decisions/002-choosing-llm-function-name.md +202 -0
  250. connectonion/docs/design-decisions/003-choosing-trust-keyword.md +141 -0
  251. connectonion/docs/design-decisions/004-cli-create-flow.md +117 -0
  252. connectonion/docs/design-decisions/005-designing-agent-network-protocol.md +503 -0
  253. connectonion/docs/design-decisions/006-agent-address-format.md +305 -0
  254. connectonion/docs/design-decisions/007-authentication-backend-design.md +240 -0
  255. connectonion/docs/design-decisions/008-naming-is-hard.md +228 -0
  256. connectonion/docs/design-decisions/009-why-connect-function.md +167 -0
  257. connectonion/docs/design-decisions/010-cli-ux-progressive-disclosure.md +176 -0
  258. connectonion/docs/design-decisions/011-global-config-identity-management.md +357 -0
  259. connectonion/docs/design-decisions/012-tool-execution-separation.md +259 -0
  260. connectonion/docs/design-decisions/013-debug-and-logging-design.md +253 -0
  261. connectonion/docs/design-decisions/014-hook-system-design.md +510 -0
  262. connectonion/docs/design-decisions/015-interactive-auto-debug-design.md +837 -0
  263. connectonion/docs/design-decisions/016-why-no-zero-knowledge-proofs.md +358 -0
  264. connectonion/docs/design-decisions/017-session-logging-and-eval-format.md +120 -0
  265. connectonion/docs/design-decisions/018-event-api-naming.md +274 -0
  266. connectonion/docs/design-decisions/019-agent-lifecycle-design.md +655 -0
  267. connectonion/docs/design-decisions/020-trust-system-and-network-architecture.md +503 -0
  268. connectonion/docs/design-decisions/021-task-storage-jsonl-design.md +496 -0
  269. connectonion/docs/design-decisions/022-raw-asgi-implementation.md +273 -0
  270. connectonion/docs/examples.md +0 -0
  271. connectonion/docs/hook-system-options.md +364 -0
  272. connectonion/docs/integrations/README.md +12 -0
  273. connectonion/docs/integrations/auth.md +450 -0
  274. connectonion/docs/integrations/google.md +431 -0
  275. connectonion/docs/integrations/microsoft.md +370 -0
  276. connectonion/docs/network/README.md +14 -0
  277. connectonion/docs/network/connect.md +629 -0
  278. connectonion/docs/network/deploy.md +124 -0
  279. connectonion/docs/network/host.md +1087 -0
  280. connectonion/docs/network/io.md +538 -0
  281. connectonion/docs/network/protocol/agent-relay-protocol.md +495 -0
  282. connectonion/docs/network/protocol/announce-message.md +115 -0
  283. connectonion/docs/principles.md +124 -0
  284. connectonion/docs/quickstart.md +261 -0
  285. connectonion/docs/roadmap.md +81 -0
  286. connectonion/docs/templates/README.md +77 -0
  287. connectonion/docs/templates/meta-agent.md +152 -0
  288. connectonion/docs/templates/minimal.md +105 -0
  289. connectonion/docs/templates/playwright.md +130 -0
  290. connectonion/docs/templates/web-research.md +144 -0
  291. connectonion/docs/tui/README.md +95 -0
  292. connectonion/docs/tui/chat.md +181 -0
  293. connectonion/docs/tui/divider.md +63 -0
  294. connectonion/docs/tui/dropdown.md +83 -0
  295. connectonion/docs/tui/footer.md +44 -0
  296. connectonion/docs/tui/fuzzy.md +68 -0
  297. connectonion/docs/tui/input.md +84 -0
  298. connectonion/docs/tui/keys.md +77 -0
  299. connectonion/docs/tui/pick.md +71 -0
  300. connectonion/docs/tui/providers.md +89 -0
  301. connectonion/docs/tui/status_bar.md +67 -0
  302. connectonion/docs/useful_plugins/README.md +160 -0
  303. connectonion/docs/useful_plugins/calendar_plugin.md +68 -0
  304. connectonion/docs/useful_plugins/eval.md +89 -0
  305. connectonion/docs/useful_plugins/gmail_plugin.md +68 -0
  306. connectonion/docs/useful_plugins/image_result_formatter.md +74 -0
  307. connectonion/docs/useful_plugins/re_act.md +86 -0
  308. connectonion/docs/useful_plugins/shell_approval.md +69 -0
  309. connectonion/docs/useful_plugins/system_reminder.md +210 -0
  310. connectonion/docs/useful_prompts/README.md +127 -0
  311. connectonion/docs/useful_prompts/coding_agent.md +214 -0
  312. connectonion/docs/useful_tools/README.md +81 -0
  313. connectonion/docs/useful_tools/ask_user.md +103 -0
  314. connectonion/docs/useful_tools/diff_writer.md +158 -0
  315. connectonion/docs/useful_tools/get_emails.md +519 -0
  316. connectonion/docs/useful_tools/gmail.md +155 -0
  317. connectonion/docs/useful_tools/google_calendar.md +126 -0
  318. connectonion/docs/useful_tools/memory.md +506 -0
  319. connectonion/docs/useful_tools/microsoft_calendar.md +126 -0
  320. connectonion/docs/useful_tools/outlook.md +140 -0
  321. connectonion/docs/useful_tools/send_email.md +423 -0
  322. connectonion/docs/useful_tools/shell.md +115 -0
  323. connectonion/docs/useful_tools/slash_command.md +116 -0
  324. connectonion/docs/useful_tools/terminal.md +115 -0
  325. connectonion/docs/useful_tools/todo_list.md +272 -0
  326. connectonion/docs/useful_tools/web_fetch.md +150 -0
  327. connectonion/docs/vibe-coding-guide.md +97 -0
  328. connectonion/docs/windows-support.md +258 -0
  329. connectonion/logger.py +3 -3
  330. connectonion/network/__init__.py +19 -6
  331. connectonion/network/asgi/__init__.py +81 -0
  332. connectonion/network/asgi/http.py +205 -0
  333. connectonion/network/asgi/websocket.py +217 -0
  334. connectonion/network/connect.py +232 -185
  335. connectonion/network/host/__init__.py +59 -0
  336. connectonion/network/host/auth.py +191 -0
  337. connectonion/network/host/routes.py +135 -0
  338. connectonion/network/host/server.py +289 -0
  339. connectonion/network/host/session.py +78 -0
  340. connectonion/network/io/__init__.py +21 -0
  341. connectonion/network/{connection.py → io/base.py} +17 -42
  342. connectonion/network/io/websocket.py +55 -0
  343. connectonion/network/relay.py +37 -16
  344. connectonion/network/trust/__init__.py +30 -0
  345. connectonion/network/trust/factory.py +138 -0
  346. connectonion/network/{trust_agents.py → trust/prompts.py} +3 -3
  347. connectonion/network/{trust_functions.py → trust/tools.py} +2 -2
  348. connectonion/prompt_files/__init__.py +11 -1
  349. connectonion/prompt_files/react_acknowledge.md +26 -0
  350. connectonion/prompts.py +10 -1
  351. connectonion/tui/chat.py +10 -1
  352. connectonion/tui/divider.py +10 -1
  353. connectonion/tui/dropdown.py +10 -1
  354. connectonion/tui/footer.py +8 -0
  355. connectonion/tui/fuzzy.py +11 -1
  356. connectonion/tui/input.py +118 -70
  357. connectonion/tui/keys.py +133 -6
  358. connectonion/tui/providers.py +11 -1
  359. connectonion/tui/status_bar.py +10 -1
  360. connectonion/useful_events_handlers/__init__.py +8 -0
  361. connectonion/useful_events_handlers/reflect.py +19 -4
  362. connectonion/useful_plugins/__init__.py +2 -1
  363. connectonion/useful_plugins/eval.py +2 -2
  364. connectonion/useful_plugins/gmail_plugin.py +3 -3
  365. connectonion/useful_plugins/image_result_formatter.py +3 -3
  366. connectonion/useful_plugins/re_act.py +114 -28
  367. connectonion/useful_plugins/shell_approval.py +2 -2
  368. connectonion/useful_plugins/system_reminder.py +103 -0
  369. connectonion/useful_plugins/ui_stream.py +18 -133
  370. connectonion/useful_prompts/README.md +61 -0
  371. connectonion/useful_prompts/__init__.py +45 -0
  372. connectonion/useful_prompts/coding_agent/README.md +106 -0
  373. connectonion/useful_prompts/coding_agent/assembler.py +123 -0
  374. connectonion/useful_prompts/coding_agent/prompts/main.md +227 -0
  375. connectonion/useful_prompts/coding_agent/prompts/tools/ask_user.md +61 -0
  376. connectonion/useful_prompts/coding_agent/prompts/tools/background.md +57 -0
  377. connectonion/useful_prompts/coding_agent/prompts/tools/edit.md +90 -0
  378. connectonion/useful_prompts/coding_agent/prompts/tools/glob.md +52 -0
  379. connectonion/useful_prompts/coding_agent/prompts/tools/grep.md +55 -0
  380. connectonion/useful_prompts/coding_agent/prompts/tools/plan_mode.md +80 -0
  381. connectonion/useful_prompts/coding_agent/prompts/tools/read.md +40 -0
  382. connectonion/useful_prompts/coding_agent/prompts/tools/shell.md +67 -0
  383. connectonion/useful_prompts/coding_agent/prompts/tools/task.md +51 -0
  384. connectonion/useful_prompts/coding_agent/prompts/tools/todo.md +139 -0
  385. connectonion/useful_prompts/coding_agent/prompts/tools/write.md +48 -0
  386. connectonion/useful_prompts/system-reminders/security-warning.md +14 -0
  387. connectonion/useful_prompts/system-reminders/test-reminder.md +11 -0
  388. connectonion/useful_tools/__init__.py +31 -4
  389. connectonion/useful_tools/ask_user.py +35 -0
  390. connectonion/useful_tools/bash.py +69 -0
  391. connectonion/useful_tools/diff_writer.py +186 -94
  392. connectonion/useful_tools/edit.py +102 -0
  393. connectonion/useful_tools/glob_files.py +97 -0
  394. connectonion/useful_tools/grep_files.py +171 -0
  395. connectonion/useful_tools/multi_edit.py +116 -0
  396. connectonion/useful_tools/read_file.py +73 -0
  397. connectonion/useful_tools/shell.py +50 -45
  398. connectonion/useful_tools/write_file.py +129 -0
  399. {connectonion-0.6.2.dist-info → connectonion-0.6.3.dist-info}/METADATA +10 -3
  400. connectonion-0.6.3.dist-info/RECORD +469 -0
  401. connectonion/network/asgi.py +0 -407
  402. connectonion/network/host.py +0 -616
  403. connectonion/network/trust.py +0 -166
  404. connectonion-0.6.2.dist-info/RECORD +0 -129
  405. /connectonion/cli/{docs → co_ai/prompts/connectonion}/connectonion.md +0 -0
  406. {connectonion-0.6.2.dist-info → connectonion-0.6.3.dist-info}/WHEEL +0 -0
  407. {connectonion-0.6.2.dist-info → connectonion-0.6.3.dist-info}/entry_points.txt +0 -0
connectonion/__init__.py CHANGED
@@ -1,13 +1,23 @@
1
- """ConnectOnion - A simple agent framework with behavior tracking."""
1
+ """
2
+ Purpose: Main package entry point exposing public API for ConnectOnion framework
3
+ LLM-Note:
4
+ Dependencies: imports from [core/, logger.py, llm_do.py, transcribe.py, prompts.py, debug/, useful_tools/, network/, address.py] | imported by [user code, tests/, examples/] | no direct tests (integration tests import from here)
5
+ Data flow: loads .env from cwd via load_dotenv() → exports all public API symbols → user imports `from connectonion import Agent, llm_do, ...`
6
+ State/Effects: auto-loads .env file from current working directory (NOT module directory) at import time
7
+ Integration: exposes complete public API: Agent, LLM, Logger, create_tool_from_function, llm_do, transcribe, xray, event decorators, built-in tools, networking functions | __all__ defines explicit public exports
8
+ Performance: .env loading happens once at first import (dotenv caches)
9
+ Errors: none (import errors bubble from submodules)
10
+ ConnectOnion - A simple agent framework with behavior tracking.
11
+ """
2
12
 
3
- __version__ = "0.6.2"
13
+ __version__ = "0.6.3"
4
14
 
5
15
  # Auto-load .env files for the entire framework
6
16
  from dotenv import load_dotenv
7
17
  from pathlib import Path as _Path
8
18
 
9
- # Load from current working directory (where user runs their script)
10
- # NOT from the module's location (framework directory)
19
+ # SDK only loads from current working directory (where user runs their script)
20
+ # CLI commands (co ai, co browser, etc.) handle global fallback separately
11
21
  load_dotenv(_Path.cwd() / ".env")
12
22
 
13
23
  from .core import Agent, LLM, create_tool_from_function
@@ -27,12 +37,20 @@ from .llm_do import llm_do
27
37
  from .transcribe import transcribe
28
38
  from .prompts import load_system_prompt
29
39
  from .debug import xray, auto_debug_exception, replay, xray_replay
30
- from .useful_tools import send_email, get_emails, mark_read, mark_unread, Memory, Gmail, GoogleCalendar, Outlook, MicrosoftCalendar, WebFetch, Shell, DiffWriter, pick, yes_no, autocomplete, TodoList, SlashCommand
31
- from .network import connect, RemoteAgent, host, create_app, Connection
40
+ from .useful_tools import (
41
+ send_email, get_emails, mark_read, mark_unread,
42
+ Memory, Gmail, GoogleCalendar, Outlook, MicrosoftCalendar,
43
+ WebFetch, Shell, bash, DiffWriter, MODE_NORMAL, MODE_AUTO, MODE_PLAN,
44
+ pick, yes_no, autocomplete, TodoList, SlashCommand,
45
+ # Claude Code-style file tools
46
+ read_file, edit, multi_edit, glob, grep, write, FileWriter,
47
+ )
48
+ from .network import connect, RemoteAgent, Response, host, create_app, IO
32
49
  from .network import relay, announce
33
50
  from . import address
34
51
 
35
52
  __all__ = [
53
+ # Core
36
54
  "Agent",
37
55
  "LLM",
38
56
  "Logger",
@@ -43,10 +61,13 @@ __all__ = [
43
61
  "xray",
44
62
  "replay",
45
63
  "xray_replay",
64
+ "auto_debug_exception",
65
+ # Email tools
46
66
  "send_email",
47
67
  "get_emails",
48
68
  "mark_read",
49
69
  "mark_unread",
70
+ # Class-based tools
50
71
  "Memory",
51
72
  "Gmail",
52
73
  "GoogleCalendar",
@@ -54,21 +75,37 @@ __all__ = [
54
75
  "MicrosoftCalendar",
55
76
  "WebFetch",
56
77
  "Shell",
78
+ "bash",
57
79
  "DiffWriter",
80
+ "MODE_NORMAL",
81
+ "MODE_AUTO",
82
+ "MODE_PLAN",
83
+ # TUI helpers
58
84
  "pick",
59
85
  "yes_no",
60
86
  "autocomplete",
87
+ # Task management
61
88
  "TodoList",
62
89
  "SlashCommand",
63
- "auto_debug_exception",
90
+ # Claude Code-style file tools
91
+ "read_file",
92
+ "edit",
93
+ "multi_edit",
94
+ "glob",
95
+ "grep",
96
+ "write",
97
+ "FileWriter",
98
+ # Networking
64
99
  "connect",
65
100
  "RemoteAgent",
101
+ "Response",
66
102
  "host",
67
103
  "create_app",
68
- "Connection",
104
+ "IO",
69
105
  "relay",
70
106
  "announce",
71
107
  "address",
108
+ # Event decorators
72
109
  "after_user_input",
73
110
  "before_llm",
74
111
  "after_llm",
@@ -77,5 +114,5 @@ __all__ = [
77
114
  "after_each_tool",
78
115
  "after_tools",
79
116
  "on_error",
80
- "on_complete"
117
+ "on_complete",
81
118
  ]
@@ -1,3 +1,13 @@
1
- """ConnectOnion CLI module."""
1
+ """
2
+ Purpose: CLI module entry point with version metadata
3
+ LLM-Note:
4
+ Dependencies: none | imported by [cli/main.py, setup.py] | no direct tests
5
+ Data flow: pure metadata (version string)
6
+ State/Effects: no state
7
+ Integration: exposes __version__ for CLI about/version commands
8
+ Performance: trivial
9
+ Errors: none
10
+ ConnectOnion CLI module.
11
+ """
2
12
 
3
13
  __version__ = "0.0.1b5"
@@ -1,4 +1,14 @@
1
- """Browser agent module for ConnectOnion CLI."""
1
+ """
2
+ Purpose: Browser agent module exports for CLI browser automation
3
+ LLM-Note:
4
+ Dependencies: imports from [browser.py] | imported by [cli/commands/browser_commands.py] | no direct tests
5
+ Data flow: re-exports execute_browser_command and BrowserAutomation
6
+ State/Effects: no state
7
+ Integration: exposes execute_browser_command(), BrowserAutomation class for `co browser` command
8
+ Performance: trivial
9
+ Errors: none
10
+ Browser agent module for ConnectOnion CLI.
11
+ """
2
12
 
3
13
  from .browser import execute_browser_command, BrowserAutomation
4
14
 
@@ -1,4 +1,13 @@
1
- """Browser Agent for CLI - Natural language browser automation.
1
+ """
2
+ Purpose: Natural language browser automation via Playwright with Chrome profile support
3
+ LLM-Note:
4
+ Dependencies: imports from [playwright.sync_api, connectonion Agent/llm_do, cli/browser_agent/element_finder, pydantic, pathlib, dotenv] | imported by [cli/commands/browser_commands.py] | tested by [tests/cli/test_browser_agent.py]
5
+ Data flow: BrowserAutomation() initializes Playwright → copies Chrome profile to .browser_agent_profile/ → opens browser with context → provides tools (navigate, find_element, fill_form, screenshot, scroll, wait_for_login) → Agent uses these tools via natural language → element_finder.py uses vision LLM to locate elements | screenshots saved to .tmp/ directory
6
+ State/Effects: maintains browser/page/context state | copies Chrome profile on first run | writes screenshots to .tmp/{timestamp}.png | modifies form_data dict for form fills | auto-closes browser in __del__
7
+ Integration: exposes BrowserAutomation(use_chrome_profile, headless) with methods: navigate(url), find_element(description), fill_form(field_values), screenshot(viewport), scroll(direction, description), click(description), type_text(description, text), wait_for_login(seconds) | FormField Pydantic model for form parsing | used by `co browser` CLI command
8
+ Performance: headless by default (faster) | Chrome profile copy (one-time, slow first run) | vision model for element finding (slower but accurate) | screenshots base64-encoded for LLM analysis
9
+ Errors: returns error string if Playwright not installed | returns "Browser already open" if reinitializing | element not found returns descriptive error | Chrome must be closed when using profile
10
+ Browser Agent for CLI - Natural language browser automation.
2
11
 
3
12
  This module provides a browser automation agent that understands natural language
4
13
  requests for browser operations via the ConnectOnion CLI.
@@ -96,8 +105,9 @@ class BrowserAutomation:
96
105
  self.playwright = sync_playwright().start()
97
106
 
98
107
  if self.use_chrome_profile:
99
- # Use Chromium with Chrome profile copy
100
- chromium_profile = Path.cwd() / "chromium_automation_profile"
108
+ # Use Chromium with Chrome profile copy in global ~/.co/ folder
109
+ chromium_profile = Path.home() / ".co" / "browser_profile"
110
+ chromium_profile.parent.mkdir(parents=True, exist_ok=True)
101
111
 
102
112
  if not chromium_profile.exists():
103
113
  import shutil
@@ -1,4 +1,12 @@
1
1
  """
2
+ Purpose: Find interactive elements on web pages using natural language descriptions via vision LLM
3
+ LLM-Note:
4
+ Dependencies: imports from [playwright.sync_api Page, connectonion llm_do, pydantic, pathlib] | imported by [cli/browser_agent/browser.py] | tested by [tests/cli/test_element_finder.py]
5
+ Data flow: extract_elements(page) → evaluates extract_elements.js → injects data-browser-agent-id on all interactive elements → returns list[InteractiveElement] with locators | find_element(page, description, elements) → formats elements for LLM → calls llm_do with vision model + screenshot → LLM selects matching element by index → returns InteractiveElement with pre-built locator
6
+ State/Effects: modifies DOM by injecting data-browser-agent-id attributes (temporary, removed on navigation) | takes screenshot for vision analysis | no persistent state
7
+ Integration: exposes extract_elements(page) → list[InteractiveElement], find_element(page, description, elements, screenshot) → InteractiveElement|None, highlight_element(page, element) for visual feedback | InteractiveElement model has tag, text, role, aria_label, placeholder, x, y, width, height, locator | ElementMatch model for LLM response
8
+ Performance: JavaScript extraction is fast | LLM matching uses vision model (slower) | limits to 150 elements for context window | pre-built locators (no retry needed)
9
+ Errors: returns None if no matching element found | raises if Playwright page not available | element may be stale if page navigates
2
10
  Element Finder - Find interactive elements by natural language description.
3
11
 
4
12
  Inspired by browser-use (https://github.com/browser-use/browser-use).
@@ -1,4 +1,12 @@
1
1
  """
2
+ Purpose: Draw bounding boxes and element indices on screenshots for visual element identification
3
+ LLM-Note:
4
+ Dependencies: imports from [PIL Image/ImageDraw/ImageFont, pathlib, cli/browser_agent/element_finder] | imported by [cli/browser_agent/browser.py] | tested by [tests/cli/test_highlight.py]
5
+ Data flow: highlight_screenshot(screenshot_path, elements) → loads PNG image → iterates InteractiveElement list → draws dashed rectangle around each element → draws index label with colored background → saves highlighted image | highlight_current_page(page) → takes screenshot → extracts elements → calls highlight_screenshot() → returns path
6
+ State/Effects: reads screenshot PNG from disk | writes highlighted PNG to disk | deletes raw screenshot after highlighting | creates screenshots/ directory if missing
7
+ Integration: exposes highlight_screenshot(screenshot_path, elements, output_path) → str, highlight_current_page(page, output_path) → str | ELEMENT_COLORS dict maps tag names to hex colors | get_font(size) → ImageFont for cross-platform text rendering | draw_dashed_rect() utility for styled boxes
8
+ Performance: PIL image processing (fast for typical webpage screenshots) | processes all elements in one pass | minimal memory (single image in RAM)
9
+ Errors: skips elements with width/height < 5px (too small to render) | falls back to default font if system fonts unavailable | raises if PIL/Pillow not installed
2
10
  Screenshot highlighting - draw bounding boxes and indices on screenshots.
3
11
  Inspired by browser-use's python_highlights.py approach.
4
12
  """
@@ -6,7 +14,7 @@ Inspired by browser-use's python_highlights.py approach.
6
14
  from PIL import Image, ImageDraw, ImageFont
7
15
  from pathlib import Path
8
16
  from typing import List
9
- import element_finder
17
+ from . import element_finder
10
18
 
11
19
  # Color scheme for different element types
12
20
  ELEMENT_COLORS = {
@@ -1,4 +1,12 @@
1
1
  """
2
+ Purpose: Intelligent page scrolling with AI strategy selection and fallback mechanisms
3
+ LLM-Note:
4
+ Dependencies: imports from [playwright Page, connectonion llm_do, pydantic, pathlib, PIL Image] | imported by [cli/browser_agent/browser.py] | tested by [tests/cli/test_scroll.py]
5
+ Data flow: scroll(page, take_screenshot, times, description) → takes before screenshot → tries strategies: AI-generated JS → element scroll → page scroll → takes after screenshot → compares via _screenshots_different() → returns on first successful change | _ai_scroll() extracts scrollable elements + HTML → llm_do generates ScrollStrategy → executes JS | fallbacks use simpler JS approaches
6
+ State/Effects: writes before/after screenshots to screenshots/ directory | executes JavaScript on page (modifies scrollTop or window.scrollY) | no persistent state
7
+ Integration: exposes scroll(page, take_screenshot, times, description) → str | ScrollStrategy Pydantic model with method, selector, javascript, explanation | uses scroll_strategy.md prompt for LLM | verifies success via pixel difference (>1% change threshold)
8
+ Performance: tries AI first (slower but accurate) → falls back to faster heuristics | 0.5-1s sleep between scrolls for content loading | PIL pixel comparison (fast for typical screenshots)
9
+ Errors: returns "Browser not open" if page None | returns "All scroll strategies failed" if no strategy changes content | prints strategy attempts for debugging | catches exceptions per strategy and continues
2
10
  Unified scroll module - AI-powered with fallback strategies.
3
11
 
4
12
  Usage:
@@ -0,0 +1,6 @@
1
+ """co-ai: AI coding agent built with ConnectOnion framework."""
2
+
3
+ from connectonion.cli.co_ai.agent import create_coding_agent
4
+
5
+ __version__ = "0.1.0"
6
+ __all__ = ["create_coding_agent"]
@@ -0,0 +1,87 @@
1
+ """Main coding agent module."""
2
+
3
+ from pathlib import Path
4
+
5
+ from .context import load_project_context
6
+ from .prompts.assembler import assemble_prompt
7
+ from .tools import (
8
+ glob, grep, edit, read_file, task,
9
+ enter_plan_mode, exit_plan_mode, write_plan,
10
+ ask_user,
11
+ run_background, task_output, kill_task,
12
+ load_guide,
13
+ )
14
+ from .skills import skill
15
+ from .plugins import reminder_plugin
16
+ from connectonion import Agent, bash, after_user_input, FileWriter, MODE_AUTO, MODE_NORMAL, TodoList
17
+ from connectonion.useful_plugins import re_act, eval
18
+
19
+
20
+ PROMPTS_DIR = Path(__file__).parent / "prompts"
21
+
22
+
23
+ @after_user_input
24
+ def _sync_tool_io(agent) -> None:
25
+ io = getattr(agent, "io", None) or getattr(agent, "connection", None)
26
+ if not io:
27
+ return
28
+ # ToolRegistry does not expose instances publicly; use best-effort access.
29
+ instances = getattr(agent.tools, "_instances", {})
30
+ for instance in instances.values():
31
+ if hasattr(instance, "io"):
32
+ instance.io = io
33
+
34
+
35
+ def create_coding_agent(
36
+ model: str = "co/claude-opus-4-5",
37
+ max_iterations: int = 20,
38
+ auto_approve: bool = False,
39
+ web_mode: bool = False,
40
+ ) -> Agent:
41
+ writer = FileWriter(mode=MODE_AUTO if auto_approve else MODE_NORMAL)
42
+ todo = TodoList()
43
+
44
+ tools = [
45
+ glob,
46
+ grep,
47
+ read_file,
48
+ edit,
49
+ writer,
50
+ bash,
51
+ task,
52
+ enter_plan_mode,
53
+ exit_plan_mode,
54
+ write_plan,
55
+ todo,
56
+ skill,
57
+ run_background,
58
+ task_output,
59
+ kill_task,
60
+ load_guide,
61
+ ask_user,
62
+ ]
63
+
64
+ base_prompt = assemble_prompt(
65
+ prompts_dir=str(PROMPTS_DIR),
66
+ tools=tools,
67
+ )
68
+
69
+ project_context = load_project_context()
70
+ system_prompt = base_prompt
71
+ if project_context:
72
+ system_prompt += f"\n\n---\n\n{project_context}"
73
+
74
+ plugins = [re_act, eval, reminder_plugin]
75
+
76
+ agent = Agent(
77
+ name="oo",
78
+ tools=tools,
79
+ plugins=plugins,
80
+ on_events=[_sync_tool_io],
81
+ system_prompt=system_prompt,
82
+ model=model,
83
+ max_iterations=max_iterations,
84
+ )
85
+
86
+ agent.writer = writer
87
+ return agent
@@ -0,0 +1,5 @@
1
+ """Sub-agents for OO."""
2
+
3
+ from connectonion.cli.co_ai.agents.registry import SUBAGENTS, get_subagent
4
+
5
+ __all__ = ["SUBAGENTS", "get_subagent"]
@@ -0,0 +1,57 @@
1
+ """Sub-agent registry and factory."""
2
+
3
+ from typing import Dict, Any, Optional
4
+ from connectonion import Agent
5
+
6
+ from connectonion.cli.co_ai.tools import glob, grep, read_file
7
+
8
+
9
+ # Sub-agent configurations
10
+ SUBAGENTS: Dict[str, Dict[str, Any]] = {
11
+ "explore": {
12
+ "description": "Fast agent for exploring codebases. Find files, search code, answer questions about structure.",
13
+ "tools": [glob, grep, read_file],
14
+ "model": "co/gemini-2.5-flash", # Fast model for exploration
15
+ "max_iterations": 15,
16
+ },
17
+ "plan": {
18
+ "description": "Design implementation plans. Analyze architecture, identify files to change, plan steps.",
19
+ "tools": [glob, grep, read_file],
20
+ "model": "co/gemini-2.5-pro", # Smarter model for planning
21
+ "max_iterations": 10,
22
+ },
23
+ }
24
+
25
+
26
+ def get_subagent(agent_type: str) -> Optional[Agent]:
27
+ """
28
+ Create a sub-agent instance by type.
29
+
30
+ Args:
31
+ agent_type: Type of sub-agent ("explore", "plan", etc.)
32
+
33
+ Returns:
34
+ Configured Agent instance or None if type not found
35
+ """
36
+ if agent_type not in SUBAGENTS:
37
+ return None
38
+
39
+ config = SUBAGENTS[agent_type]
40
+
41
+ # Load prompt from co_ai/prompts/agents/
42
+ from pathlib import Path
43
+ prompt_path = Path(__file__).parent.parent / "prompts" / "agents" / f"{agent_type}.md"
44
+
45
+ if prompt_path.exists():
46
+ system_prompt = prompt_path.read_text(encoding="utf-8")
47
+ else:
48
+ system_prompt = f"You are an {agent_type} agent. {config['description']}"
49
+
50
+ return Agent(
51
+ name=f"oo-{agent_type}",
52
+ tools=config["tools"],
53
+ plugins=[],
54
+ system_prompt=system_prompt,
55
+ model=config["model"],
56
+ max_iterations=config["max_iterations"],
57
+ )
@@ -0,0 +1,45 @@
1
+ """Built-in commands for OO CLI."""
2
+
3
+ from connectonion.cli.co_ai.commands.init import cmd_init
4
+ from connectonion.cli.co_ai.commands.help import cmd_help
5
+ from connectonion.cli.co_ai.commands.cost import cmd_cost, set_agent as set_cost_agent
6
+ from connectonion.cli.co_ai.commands.compact import cmd_compact, set_agent as set_compact_agent
7
+ from connectonion.cli.co_ai.commands.tasks import cmd_tasks
8
+ from connectonion.cli.co_ai.commands.export import cmd_export, set_agent as set_export_agent
9
+ from connectonion.cli.co_ai.commands.sessions import cmd_sessions, cmd_new, cmd_resume, set_agent as set_sessions_agent
10
+ from connectonion.cli.co_ai.commands.undo import cmd_undo, cmd_redo, set_agent as set_undo_agent
11
+
12
+ BUILTIN_COMMANDS = {
13
+ "init": cmd_init,
14
+ "help": cmd_help,
15
+ "cost": cmd_cost,
16
+ "compact": cmd_compact,
17
+ "tasks": cmd_tasks,
18
+ "export": cmd_export,
19
+ "sessions": cmd_sessions,
20
+ "new": cmd_new,
21
+ "resume": cmd_resume,
22
+ "undo": cmd_undo,
23
+ "redo": cmd_redo,
24
+ }
25
+
26
+
27
+ def set_agent_for_commands(agent):
28
+ """Set agent reference for commands that need it."""
29
+ set_cost_agent(agent)
30
+ set_compact_agent(agent)
31
+ set_export_agent(agent)
32
+ set_sessions_agent(agent)
33
+ set_undo_agent(agent)
34
+
35
+
36
+ __all__ = [
37
+ "BUILTIN_COMMANDS",
38
+ "cmd_init",
39
+ "cmd_help",
40
+ "cmd_cost",
41
+ "cmd_compact",
42
+ "cmd_tasks",
43
+ "cmd_export",
44
+ "set_agent_for_commands",
45
+ ]
@@ -0,0 +1,173 @@
1
+ """Compact command for compressing conversation context using LLM summarization."""
2
+
3
+ from pathlib import Path
4
+ from rich.console import Console
5
+ from rich.panel import Panel
6
+ from connectonion import llm_do
7
+
8
+ console = Console()
9
+
10
+ # Module-level storage for agent reference
11
+ _current_agent = None
12
+
13
+ # Summarization prompt
14
+ SUMMARIZATION_PROMPT = Path(__file__).parent.parent / "prompts" / "summarization.md"
15
+
16
+
17
+ def set_agent(agent):
18
+ """Set the current agent for compact operation."""
19
+ global _current_agent
20
+ _current_agent = agent
21
+
22
+
23
+ def _format_messages_for_summary(messages: list) -> str:
24
+ """Format messages into a readable format for summarization."""
25
+ formatted = []
26
+ for msg in messages:
27
+ role = msg.get('role', 'unknown')
28
+ content = msg.get('content', '')
29
+
30
+ # Handle tool_calls in assistant messages
31
+ if role == 'assistant' and 'tool_calls' in msg:
32
+ tool_calls = msg.get('tool_calls', [])
33
+ tools_str = ", ".join(tc.get('function', {}).get('name', 'unknown') for tc in tool_calls)
34
+ formatted.append(f"[assistant] Called tools: {tools_str}")
35
+ if content:
36
+ formatted.append(f"[assistant] {content[:500]}...")
37
+ elif role == 'tool':
38
+ # Truncate long tool results
39
+ tool_name = msg.get('name', 'unknown')
40
+ result = content[:200] + "..." if len(content) > 200 else content
41
+ formatted.append(f"[tool:{tool_name}] {result}")
42
+ elif role == 'system':
43
+ # Keep system messages brief
44
+ formatted.append(f"[system] {content[:300]}...")
45
+ else:
46
+ formatted.append(f"[{role}] {content}")
47
+
48
+ return "\n\n".join(formatted)
49
+
50
+
51
+ def _create_summary_message(summary: str) -> dict:
52
+ """Create a summary message to replace old context."""
53
+ return {
54
+ 'role': 'user',
55
+ 'content': f"""## Previous Conversation Summary
56
+
57
+ {summary}
58
+
59
+ ---
60
+ *The conversation continues below. Use the summary above for context.*"""
61
+ }
62
+
63
+
64
+ def cmd_compact(args: str = "") -> str:
65
+ """
66
+ Compress conversation history using LLM summarization.
67
+
68
+ This creates an intelligent summary of older messages while preserving:
69
+ - User's explicit requests and intents
70
+ - Key technical decisions and code patterns
71
+ - File names and important code snippets
72
+ - Errors encountered and how they were fixed
73
+ - Recent messages (last 5)
74
+
75
+ Use when context usage is high (>70%).
76
+ """
77
+ if _current_agent is None:
78
+ console.print("[yellow]No agent session active.[/]")
79
+ return "No session"
80
+
81
+ agent = _current_agent
82
+
83
+ # Check if we have a session
84
+ if not hasattr(agent, 'current_session') or not agent.current_session:
85
+ console.print("[yellow]No conversation history to compact.[/]")
86
+ return "No history"
87
+
88
+ messages = agent.current_session.get('messages', [])
89
+ if len(messages) < 8:
90
+ console.print("[yellow]Conversation too short to compact (< 8 messages).[/]")
91
+ return "Too short"
92
+
93
+ # Get context usage before
94
+ context_before = getattr(agent, 'context_percent', 0)
95
+
96
+ # Separate messages
97
+ system_msg = messages[0] if messages and messages[0].get('role') == 'system' else None
98
+ recent_count = 5
99
+ recent_msgs = messages[-recent_count:]
100
+ old_msgs = messages[1:-recent_count] if system_msg else messages[:-recent_count]
101
+
102
+ if len(old_msgs) < 3:
103
+ console.print("[yellow]Not enough old messages to compact.[/]")
104
+ return "Nothing to compact"
105
+
106
+ console.print("[cyan]Summarizing conversation...[/]")
107
+
108
+ # Load summarization prompt
109
+ summarization_instructions = ""
110
+ if SUMMARIZATION_PROMPT.exists():
111
+ summarization_instructions = SUMMARIZATION_PROMPT.read_text(encoding="utf-8")
112
+
113
+ # Format messages for summarization
114
+ conversation_text = _format_messages_for_summary(old_msgs)
115
+
116
+ # Use LLM to create intelligent summary
117
+ summary_prompt = f"""{summarization_instructions}
118
+
119
+ ## Conversation to Summarize
120
+
121
+ {conversation_text}
122
+
123
+ ---
124
+
125
+ Create a concise but complete summary following the structure above. Focus on:
126
+ 1. What the user wanted to accomplish
127
+ 2. Key files and code that were discussed or modified
128
+ 3. Any errors and how they were fixed
129
+ 4. Important decisions made
130
+
131
+ Keep the summary under 1000 words but preserve all critical technical details."""
132
+
133
+ summary = llm_do(
134
+ summary_prompt,
135
+ model="co/gemini-2.5-flash", # Fast model for summarization
136
+ )
137
+
138
+ # Create compacted messages
139
+ summary_message = _create_summary_message(summary)
140
+
141
+ new_messages = []
142
+ if system_msg:
143
+ new_messages.append(system_msg)
144
+ new_messages.append(summary_message)
145
+ new_messages.extend(recent_msgs)
146
+
147
+ # Update agent session
148
+ agent.current_session['messages'] = new_messages
149
+
150
+ # Calculate savings
151
+ old_count = len(messages)
152
+ new_count = len(new_messages)
153
+ saved = old_count - new_count
154
+
155
+ # Display result
156
+ console.print(Panel(
157
+ f"[green]✓ Conversation compacted[/]\n\n"
158
+ f"Messages: {old_count} → {new_count} ([green]-{saved}[/])\n"
159
+ f"Context before: {context_before:.0f}%\n\n"
160
+ f"[dim]Preserved:[/]\n"
161
+ f" • System prompt\n"
162
+ f" • AI-generated summary of older context\n"
163
+ f" • Recent {recent_count} messages\n\n"
164
+ f"[dim]Summary includes:[/]\n"
165
+ f" • User requests and intents\n"
166
+ f" • Key files and code patterns\n"
167
+ f" • Errors and fixes\n"
168
+ f" • Technical decisions",
169
+ title="📦 Compact",
170
+ border_style="green"
171
+ ))
172
+
173
+ return f"Compacted: {old_count} → {new_count} messages"