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
@@ -0,0 +1,1087 @@
1
+ # host()
2
+
3
+ > Make your agent accessible over the network. One function call.
4
+
5
+ **Looking to deploy?** See [Deploy Your Agent](deploy.md) for production deployment options.
6
+
7
+ ---
8
+
9
+ ## Quick Start (60 Seconds)
10
+
11
+ ```python
12
+ from connectonion import Agent, host
13
+
14
+ # Define your agent
15
+ def create_agent():
16
+ return Agent("translator", tools=[translate])
17
+
18
+ # Make it network-accessible
19
+ host(create_agent)
20
+ ```
21
+
22
+ **Output:**
23
+ ```
24
+ ╭─────────────────────────────────────────────────────────╮
25
+ │ Agent 'translator' is now hosted │
26
+ ├─────────────────────────────────────────────────────────┤
27
+ │ │
28
+ │ Address: 0x3d4017c3e843895a92b70aa74d1b7ebc9c98... │
29
+ │ │
30
+ │ HTTP Endpoints: │
31
+ │ POST http://localhost:8000/input │
32
+ │ GET http://localhost:8000/sessions/{session_id} │
33
+ │ GET http://localhost:8000/sessions │
34
+ │ GET http://localhost:8000/health │
35
+ │ GET http://localhost:8000/info │
36
+ │ GET http://localhost:8000/admin/logs (API key) │
37
+ │ GET http://localhost:8000/admin/sessions (API key) │
38
+ │ WS ws://localhost:8000/ws │
39
+ │ │
40
+ │ Interactive UI: │
41
+ │ http://localhost:8000/docs │
42
+ │ │
43
+ │ P2P Relay: │
44
+ │ wss://oo.openonion.ai/ws/announce │
45
+ │ │
46
+ ╰─────────────────────────────────────────────────────────╯
47
+
48
+ Waiting for tasks...
49
+ ```
50
+
51
+ **That's it.** Your agent is now accessible via HTTP, WebSocket, and P2P relay.
52
+
53
+ ---
54
+
55
+ ## Function Signature
56
+
57
+ ```python
58
+ def host(
59
+ create_agent: Callable[[], Agent], # Factory that returns fresh Agent
60
+
61
+ # Trust
62
+ trust: Union[str, Agent] = "careful",
63
+ blacklist: list = None,
64
+ whitelist: list = None,
65
+
66
+ # Server
67
+ port: int = 8000,
68
+ workers: int = 1,
69
+
70
+ # Storage
71
+ result_ttl: int = 86400, # 24 hours (how long server keeps results)
72
+
73
+ # P2P Discovery
74
+ relay_url: str = "wss://oo.openonion.ai/ws/announce",
75
+
76
+ # Development
77
+ reload: bool = False,
78
+ ) -> None:
79
+ ```
80
+
81
+ ---
82
+
83
+ ## How It Works
84
+
85
+ ```
86
+ ┌─────────────────────────────────────────────────────────┐
87
+ │ host(create_agent) │
88
+ ├─────────────────────────────────────────────────────────┤
89
+ │ │
90
+ │ 1. Request arrives (HTTP or WebSocket) │
91
+ │ 2. Trust check (blacklist/whitelist/policy) │
92
+ │ 3. Call create_agent() for fresh instance │
93
+ │ 4. Server generates session_id (or uses existing one) │
94
+ │ 5. Execute agent.input(prompt, session) │
95
+ │ 6. Append result to session_results.jsonl │
96
+ │ 7. Return result with session (includes session_id) │
97
+ │ │
98
+ └─────────────────────────────────────────────────────────┘
99
+ ```
100
+
101
+ **Results are always saved first.** If connection drops, client can fetch later via HTTP.
102
+
103
+ ### Worker Isolation
104
+
105
+ Each request calls your function to get a **fresh agent instance**. This ensures:
106
+
107
+ - **No shared state** between concurrent requests
108
+ - **Stateful tools work correctly** (e.g., browser tools with page state)
109
+ - **Complete isolation** - one request can't affect another
110
+
111
+ ```python
112
+ # Request A and B arrive simultaneously
113
+ # Each calls create_agent() and gets its own fresh agent
114
+ # No interference, no race conditions
115
+ ```
116
+
117
+ ### State Control
118
+
119
+ You control what's isolated vs shared via closure:
120
+
121
+ ```python
122
+ # Isolated state (default, safest) - create tools inside:
123
+ def create_agent():
124
+ browser = BrowserTool() # Fresh per request
125
+ return Agent("assistant", tools=[browser])
126
+
127
+ # Shared state (advanced) - create tools outside:
128
+ browser = BrowserTool() # Expensive resource, shared across requests
129
+ def create_agent():
130
+ return Agent("assistant", tools=[browser])
131
+ ```
132
+
133
+ For horizontal scaling, use uvicorn `workers`:
134
+
135
+ ```python
136
+ host(create_agent, workers=4) # 4 OS processes, each with isolated agents
137
+ ```
138
+
139
+ ---
140
+
141
+ ## HTTP API
142
+
143
+ ### POST /input
144
+
145
+ Submit input. Creates a session, returns session_id.
146
+
147
+ ```bash
148
+ curl -X POST http://localhost:8000/input \
149
+ -H "Content-Type: application/json" \
150
+ -d '{"prompt": "Translate hello to Spanish"}'
151
+ ```
152
+
153
+ **Response:**
154
+ ```json
155
+ {
156
+ "session_id": "550e8400-e29b-41d4-a716-446655440000",
157
+ "status": "done",
158
+ "result": "Hola",
159
+ "duration_ms": 1250,
160
+ "session": {
161
+ "session_id": "550e8400-e29b-41d4-a716-446655440000",
162
+ "messages": [...],
163
+ "trace": [...],
164
+ "turn": 1
165
+ }
166
+ }
167
+ ```
168
+
169
+ #### Multi-turn Conversations
170
+
171
+ To continue a conversation, pass the `session` from the previous response:
172
+
173
+ ```bash
174
+ # First request
175
+ curl -X POST http://localhost:8000/input \
176
+ -H "Content-Type: application/json" \
177
+ -d '{"prompt": "My name is John"}'
178
+
179
+ # Response includes session
180
+ # {"result": "Nice to meet you, John!", "session": {...}}
181
+
182
+ # Second request - pass session back
183
+ curl -X POST http://localhost:8000/input \
184
+ -H "Content-Type: application/json" \
185
+ -d '{
186
+ "prompt": "What is my name?",
187
+ "session": {...}
188
+ }'
189
+
190
+ # Agent remembers: "Your name is John"
191
+ ```
192
+
193
+ **Request format:**
194
+ ```json
195
+ {
196
+ "prompt": "What is my name?",
197
+ "session": { // Optional - pass previous session to continue
198
+ "session_id": "abc-123", // Server-generated, included in session
199
+ "messages": [...],
200
+ "trace": [...],
201
+ "turn": 1
202
+ }
203
+ }
204
+ ```
205
+
206
+ **Note:** `session_id` is always generated by the server. For new conversations, omit `session`. For continuations, pass the entire `session` object from the previous response.
207
+
208
+ **Response format:**
209
+ ```json
210
+ {
211
+ "session_id": "abc-123",
212
+ "status": "done",
213
+ "result": "Your name is John",
214
+ "duration_ms": 850,
215
+ "session": { // Always returned - save for next request
216
+ "session_id": "abc-123",
217
+ "messages": [...],
218
+ "trace": [...],
219
+ "turn": 2
220
+ }
221
+ }
222
+ ```
223
+
224
+ ### GET /sessions/{session_id}
225
+
226
+ Fetch session result anytime.
227
+
228
+ ```bash
229
+ curl http://localhost:8000/sessions/550e8400-e29b-41d4-a716-446655440000
230
+ ```
231
+
232
+ **Response (running):**
233
+ ```json
234
+ {
235
+ "session_id": "550e8400-e29b-41d4-a716-446655440000",
236
+ "status": "running"
237
+ }
238
+ ```
239
+
240
+ **Response (done):**
241
+ ```json
242
+ {
243
+ "session_id": "550e8400-e29b-41d4-a716-446655440000",
244
+ "status": "done",
245
+ "result": "Hola",
246
+ "duration_ms": 1250
247
+ }
248
+ ```
249
+
250
+ ### GET /sessions
251
+
252
+ List recent sessions.
253
+
254
+ ```bash
255
+ curl http://localhost:8000/sessions
256
+ ```
257
+
258
+ **Response:**
259
+ ```json
260
+ {
261
+ "sessions": [
262
+ {"session_id": "abc-123", "status": "done", "created": 1702234567},
263
+ {"session_id": "def-456", "status": "running", "created": 1702234570}
264
+ ]
265
+ }
266
+ ```
267
+
268
+ ### GET /health
269
+
270
+ Health check for load balancers.
271
+
272
+ ```bash
273
+ curl http://localhost:8000/health
274
+ ```
275
+
276
+ **Response:**
277
+ ```json
278
+ {
279
+ "status": "healthy",
280
+ "agent": "translator",
281
+ "uptime": 3600
282
+ }
283
+ ```
284
+
285
+ ### GET /info
286
+
287
+ Agent capabilities and metadata.
288
+
289
+ ```bash
290
+ curl http://localhost:8000/info
291
+ ```
292
+
293
+ **Response:**
294
+ ```json
295
+ {
296
+ "name": "translator",
297
+ "address": "0x3d4017c3...",
298
+ "tools": ["translate", "detect_language"],
299
+ "trust": "careful",
300
+ "version": "0.4.1"
301
+ }
302
+ ```
303
+
304
+ ### GET /docs
305
+
306
+ Interactive UI to test your agent in the browser.
307
+
308
+ ```
309
+ http://localhost:8000/docs
310
+ ```
311
+
312
+ ### GET /admin/logs (Requires API Key)
313
+
314
+ Fetch agent activity logs (plain text). Requires `OPENONION_API_KEY` authentication.
315
+
316
+ ```bash
317
+ curl http://localhost:8000/admin/logs \
318
+ -H "Authorization: Bearer YOUR_OPENONION_API_KEY"
319
+ ```
320
+
321
+ **Response:**
322
+ ```
323
+ 2024-01-15 10:23:45 [translator] Processing: Translate hello
324
+ 2024-01-15 10:23:46 [translator] Tool: translate_text executed (450ms)
325
+ 2024-01-15 10:23:46 [translator] Result: Hola
326
+ ```
327
+
328
+ ### GET /admin/sessions (Requires API Key)
329
+
330
+ Fetch eval sessions from `.co/evals` as JSON array. Requires `OPENONION_API_KEY` authentication.
331
+
332
+ ```bash
333
+ curl http://localhost:8000/admin/sessions \
334
+ -H "Authorization: Bearer YOUR_OPENONION_API_KEY"
335
+ ```
336
+
337
+ **Response:**
338
+ ```json
339
+ {
340
+ "sessions": [
341
+ {
342
+ "name": "translator",
343
+ "created": "2024-01-15T10:23:45Z",
344
+ "updated": "2024-01-15T10:23:46Z",
345
+ "total_cost": 0.0012,
346
+ "total_tokens": 215,
347
+ "turns": [
348
+ {"role": "user", "content": "Translate hello to Spanish"},
349
+ {"role": "assistant", "content": "Hola"}
350
+ ]
351
+ }
352
+ ]
353
+ }
354
+ ```
355
+
356
+ **Note:** These endpoints require setting `OPENONION_API_KEY` as an environment variable when running your agent. The same key must be used to authenticate requests.
357
+
358
+ ---
359
+
360
+ ## WebSocket API
361
+
362
+ WebSocket provides real-time communication. Connection stays alive via ping/pong (automatic).
363
+
364
+ ### Connect
365
+
366
+ ```javascript
367
+ const ws = new WebSocket("ws://localhost:8000/ws");
368
+ ```
369
+
370
+ ### Send INPUT
371
+
372
+ ```javascript
373
+ ws.send(JSON.stringify({
374
+ type: "INPUT",
375
+ prompt: "Translate hello to Spanish"
376
+ }));
377
+ ```
378
+
379
+ ### Receive Messages
380
+
381
+ ```javascript
382
+ ws.onmessage = (event) => {
383
+ const msg = JSON.parse(event.data);
384
+
385
+ if (msg.type === "OUTPUT") {
386
+ console.log("Result:", msg.result);
387
+ } else if (msg.type === "ERROR") {
388
+ console.error("Error:", msg.message);
389
+ } else {
390
+ // tool_call, tool_result, thinking, ask_user, approval_needed, etc.
391
+ console.log("Event:", msg);
392
+ }
393
+ };
394
+ ```
395
+
396
+ ### Message Types
397
+
398
+ | Type | Direction | Purpose |
399
+ |------|-----------|---------|
400
+ | INPUT | Client → Agent | Send prompt |
401
+ | OUTPUT | Agent → Client | Final result + session data |
402
+ | tool_call | Agent → Client | Tool started |
403
+ | tool_result | Agent → Client | Tool completed |
404
+ | thinking | Agent → Client | Agent is processing |
405
+ | ask_user | Agent → Client | Agent needs input |
406
+ | approval_needed | Agent → Client | Tool approval required |
407
+ | ERROR | Agent → Client | Error message |
408
+
409
+ ---
410
+
411
+ ## Design: Stateless Sessions
412
+
413
+ ConnectOnion uses **client-managed sessions** for multi-turn conversations. This section explains why.
414
+
415
+ ### Why Full `session` Instead of Just `messages`?
416
+
417
+ You might expect an API like Anthropic or OpenAI that only passes `messages`:
418
+
419
+ ```json
420
+ // What Anthropic/OpenAI do
421
+ {"messages": [...]}
422
+ ```
423
+
424
+ But ConnectOnion passes the full session:
425
+
426
+ ```json
427
+ // What ConnectOnion does
428
+ {"session": {"messages": [...], "trace": [...], "turn": 2}}
429
+ ```
430
+
431
+ **The reason:** ConnectOnion is not just an LLM API wrapper. It's an agent framework with:
432
+
433
+ | Feature | Needs Session Data |
434
+ |---------|-------------------|
435
+ | Activity logging | `trace` - tool executions, timings |
436
+ | Turn tracking | `turn` - conversation turn count |
437
+ | XRay debugging | Full execution context |
438
+ | Session replay | Complete session history |
439
+
440
+ If we stripped down to just `messages`, we'd lose:
441
+ - Execution trace (which tools ran, how long they took)
442
+ - Turn count (for accurate logging)
443
+ - Debugging context (for XRay inspection)
444
+
445
+ **ConnectOnion's value is debugging and observability.** The full session preserves that.
446
+
447
+ ### Why Client-Managed State?
448
+
449
+ The server doesn't store your session. You store it, you send it back. Like:
450
+
451
+ | Pattern | How It Works |
452
+ |---------|--------------|
453
+ | **JWT tokens** | Server gives you a token, you send it with each request |
454
+ | **Game save files** | Game gives you save data, you store it, you load it |
455
+ | **ConnectOnion sessions** | Server gives you session, you store it, you send it back |
456
+
457
+ **Benefits:**
458
+
459
+ 1. **Infinitely scalable** - No server-side session storage
460
+ 2. **Client transparency** - You can inspect the session, see exactly what's happening
461
+ 3. **Coherent logs** - Server logs preserve turn count, trace
462
+ 4. **Easy debugging** - Session contains full execution history
463
+ 5. **No session cleanup** - No TTL, no expiry, no "session not found" errors
464
+
465
+ ### Comparison
466
+
467
+ | API | Approach | State Storage |
468
+ |-----|----------|---------------|
469
+ | Anthropic Messages API | `messages` array | Client |
470
+ | OpenAI Chat API | `messages` array | Client |
471
+ | OpenAI Assistants API | `thread_id` | Server |
472
+ | **ConnectOnion** | `session` object | Client |
473
+
474
+ We chose client-managed state like Anthropic/OpenAI's Messages API, but with the full session object to preserve ConnectOnion's debugging features.
475
+
476
+ ### When to Use Sessions
477
+
478
+ ```python
479
+ # Single request - no session needed
480
+ {"prompt": "Translate hello to Spanish"}
481
+
482
+ # Multi-turn conversation - pass session
483
+ {"prompt": "What did I ask you?", "session": {...}}
484
+
485
+ # Start fresh - omit session
486
+ {"prompt": "New conversation"}
487
+ ```
488
+
489
+ **Simple rule:** Save the `session` from each response. Pass it back if you want to continue.
490
+
491
+ ---
492
+
493
+ ## Project Structure
494
+
495
+ When you run `host(agent)`, these files are used:
496
+
497
+ ```
498
+ your-project/
499
+ ├── agent.py # Your agent code
500
+ ├── .co/ # ConnectOnion data folder
501
+ │ ├── session_results.jsonl # Session result storage (created by host)
502
+ │ ├── logs/ # Activity logs (existing)
503
+ │ └── sessions/ # Session YAML (full conversation history)
504
+ └── .env # API keys (optional)
505
+ ```
506
+
507
+ **On the network:**
508
+
509
+ ```
510
+ ┌─────────────────────────────────────────────────────────────┐
511
+ │ Your Agent │
512
+ │ host(agent) │
513
+ ├─────────────────────────────────────────────────────────────┤
514
+ │ │
515
+ │ HTTP Server (localhost:8000) │
516
+ │ ├── POST /input ← Submit prompts │
517
+ │ ├── GET /sessions/{id} ← Fetch results │
518
+ │ ├── GET /sessions ← List sessions │
519
+ │ ├── GET /health ← Health check │
520
+ │ ├── GET /info ← Agent info │
521
+ │ ├── GET /docs ← Interactive UI │
522
+ │ ├── GET /admin/logs ← Activity logs (API key auth) │
523
+ │ ├── GET /admin/sessions ← Session logs (API key auth) │
524
+ │ └── WS /ws ← Real-time WebSocket │
525
+ │ │
526
+ │ P2P Relay Connection │
527
+ │ └── wss://oo.openonion.ai/ws/announce │
528
+ │ │
529
+ └─────────────────────────────────────────────────────────────┘
530
+ ```
531
+
532
+ ---
533
+
534
+ ## Session Result Storage
535
+
536
+ Results are stored locally in `.co/session_results.jsonl` (JSON Lines format):
537
+
538
+ ```jsonl
539
+ {"session_id":"550e8400","prompt":"Translate hello","status":"running","created":1702234567,"expires":1702320967}
540
+ {"session_id":"550e8400","prompt":"Translate hello","status":"done","result":"Hola","created":1702234567,"expires":1702320967}
541
+ ```
542
+
543
+ **Why `.co/` folder?**
544
+ - Consistent with `.co/logs/` and `.co/evals/` (existing patterns)
545
+ - Project-specific (each project has its own results)
546
+ - Already in `.gitignore`
547
+ - Easy to find (in project directory)
548
+
549
+ **Why JSON Lines?**
550
+ - Human readable (`cat session_results.jsonl`)
551
+ - Append-only (safe for multiple workers)
552
+ - Single file (easy to manage)
553
+ - Queryable (`grep "550e8400" session_results.jsonl`)
554
+
555
+ **Benefits:**
556
+ - Connection drops? Fetch result later via `GET /sessions/{session_id}`
557
+ - Client restarts? Results still there
558
+ - Debug issues? Read the file directly
559
+ - Multiple workers? Append-only = no race conditions
560
+
561
+ ### TTL Expiry
562
+
563
+ Each result has an `expires` timestamp. Default: 24 hours after creation.
564
+
565
+ ```python
566
+ host(agent) # Default: 24h TTL
567
+ host(agent, result_ttl=3600) # 1 hour
568
+ host(agent, result_ttl=604800) # 7 days
569
+ ```
570
+
571
+ Expired results are automatically cleaned up. Running sessions are never cleaned even if expired.
572
+
573
+ ### View Results
574
+
575
+ ```bash
576
+ # See all results
577
+ cat .co/session_results.jsonl
578
+
579
+ # Find specific session
580
+ grep "550e8400" .co/session_results.jsonl | tail -1
581
+
582
+ # See running sessions
583
+ grep '"status":"running"' .co/session_results.jsonl
584
+
585
+ # Pretty print
586
+ cat .co/session_results.jsonl | jq .
587
+ ```
588
+
589
+ ---
590
+
591
+ ## Authentication (Signed Requests)
592
+
593
+ For secure communication, requests can be signed with Ed25519.
594
+
595
+ ### Signed Request Format
596
+
597
+ ```json
598
+ {
599
+ "payload": {
600
+ "prompt": "Translate hello",
601
+ "to": "0xAgentPublicKey",
602
+ "timestamp": 1702234567
603
+ },
604
+ "from": "0xClientPublicKey",
605
+ "signature": "0x..."
606
+ }
607
+ ```
608
+
609
+ ### How Signing Works
610
+
611
+ ```python
612
+ import json
613
+ from nacl.signing import SigningKey
614
+
615
+ # Sign the payload directly
616
+ payload = {"prompt": "...", "to": "...", "timestamp": ...}
617
+ canonical = json.dumps(payload, sort_keys=True, separators=(',', ':'))
618
+ signature = signing_key.sign(canonical.encode()).signature.hex()
619
+ ```
620
+
621
+ ### Authentication Modes
622
+
623
+ | Trust Level | Required Auth |
624
+ |-------------|---------------|
625
+ | `open` | None (anonymous OK) |
626
+ | `careful` | Signature recommended |
627
+ | `strict` | Signature required |
628
+
629
+ ---
630
+
631
+ ## The `trust` Parameter
632
+
633
+ Trust controls **who can access your agent**. All forms of trust use a trust agent behind the scenes.
634
+
635
+ See [Trust in ConnectOnion](/docs/concepts/trust.md) for the complete trust system documentation.
636
+
637
+ ### 1. Trust Level (string)
638
+
639
+ Pre-configured trust agents for common scenarios:
640
+
641
+ ```python
642
+ host(agent, trust="open") # Accept all (development)
643
+ host(agent, trust="careful") # Recommend signature, accept unsigned (default)
644
+ host(agent, trust="strict") # Require valid signature (production)
645
+ ```
646
+
647
+ | Level | Behavior |
648
+ |-------|----------|
649
+ | `open` | Accept all requests, no verification |
650
+ | `careful` | Recommend signature, accept unsigned requests |
651
+ | `strict` | Require identity and valid signature |
652
+
653
+ ### 2. Trust Policy (natural language)
654
+
655
+ Express requirements in plain English - an LLM evaluates each request:
656
+
657
+ ```python
658
+ host(agent, trust="""
659
+ I trust requests that:
660
+ - Come from known contacts with good history
661
+ - Have valid signatures
662
+ - Are on my whitelist OR from local network
663
+
664
+ I reject requests that:
665
+ - Come from blacklisted addresses
666
+ - Have no identity in production
667
+ """)
668
+
669
+ # Or from a file
670
+ host(agent, trust="./trust_policy.md")
671
+ ```
672
+
673
+ ### 3. Trust Agent (custom)
674
+
675
+ Full control with your own verification agent:
676
+
677
+ ```python
678
+ guardian = Agent(
679
+ "my_guardian",
680
+ tools=[check_whitelist, verify_identity, check_reputation],
681
+ system_prompt="""
682
+ You verify requests before allowing interaction.
683
+ Return ACCEPT or REJECT with reason.
684
+ """
685
+ )
686
+
687
+ host(agent, trust=guardian)
688
+ ```
689
+
690
+ ### Environment-Based Defaults
691
+
692
+ ```python
693
+ # No trust parameter needed - auto-detected!
694
+ host(agent)
695
+
696
+ # CONNECTONION_ENV=development → trust="open"
697
+ # CONNECTONION_ENV=test → trust="careful"
698
+ # CONNECTONION_ENV=staging → trust="careful"
699
+ # CONNECTONION_ENV=production → trust="strict"
700
+ ```
701
+
702
+ ---
703
+
704
+ ## Trust Flow
705
+
706
+ ```
707
+ Request arrives
708
+
709
+
710
+ ┌─────────────────┐
711
+ │ Blacklist? │─── Yes ──▶ REJECT (403 forbidden)
712
+ └─────────────────┘
713
+ │ No
714
+
715
+ ┌─────────────────┐
716
+ │ Whitelist? │─── Yes ──▶ ACCEPT (bypass trust agent)
717
+ └─────────────────┘
718
+ │ No
719
+
720
+ ┌─────────────────┐
721
+ │ Signed request? │─── Yes ──▶ Verify signature
722
+ └─────────────────┘ │
723
+ │ No ├─ Invalid ──▶ REJECT (401)
724
+ │ │
725
+ ▼ ▼
726
+ ┌─────────────────────────────────────┐
727
+ │ Trust Agent evaluates request │
728
+ │ │
729
+ │ - Level? → Pre-configured agent │
730
+ │ - Policy? → LLM interprets policy │
731
+ │ - Agent? → Custom agent decides │
732
+ │ │
733
+ │ Input: prompt, identity, sig_valid │
734
+ │ Output: ACCEPT or REJECT │
735
+ └─────────────────────────────────────┘
736
+
737
+ ├─ ACCEPT ──▶ Execute agent.input(prompt)
738
+ └─ REJECT ──▶ Return 403 forbidden
739
+ ```
740
+
741
+ ---
742
+
743
+ ## Progress Updates (Custom)
744
+
745
+ The framework provides event hooks. You decide what progress to send.
746
+
747
+ ```python
748
+ from connectonion import Agent, host, after_each_tool
749
+
750
+ def send_progress(agent):
751
+ # Your custom progress logic
752
+ iteration = agent.current_session["iteration"]
753
+ print(f"Progress: iteration {iteration}")
754
+ # Or send via your own WebSocket, webhook, etc.
755
+
756
+ agent = Agent("worker", on_events=[after_each_tool(send_progress)])
757
+ host(agent)
758
+ ```
759
+
760
+ Available events:
761
+ - `after_user_input` - After receiving input
762
+ - `before_llm` - Before each LLM call
763
+ - `after_llm` - After each LLM call
764
+ - `before_each_tool` - Before each tool execution
765
+ - `after_each_tool` - After each tool execution
766
+
767
+ ---
768
+
769
+ ## Progressive Disclosure
770
+
771
+ ### Level 0: Just Works
772
+
773
+ ```python
774
+ host(create_agent)
775
+ ```
776
+
777
+ ### Level 1: Trust Control
778
+
779
+ ```python
780
+ host(create_agent, trust="strict")
781
+ ```
782
+
783
+ ### Level 2: Access Control
784
+
785
+ ```python
786
+ host(create_agent, blacklist=["0xbad..."], whitelist=["0xgood..."])
787
+ ```
788
+
789
+ ### Level 3: Production Scaling
790
+
791
+ ```python
792
+ host(create_agent, workers=4, port=8000) # 4 uvicorn workers
793
+ ```
794
+
795
+ Each worker is an OS process with isolated memory. Within each worker, each request calls `create_agent()` for a fresh instance.
796
+
797
+ ### Level 4: Custom Trust Logic
798
+
799
+ ```python
800
+ host(create_agent, trust=my_guardian_agent)
801
+ ```
802
+
803
+ ---
804
+
805
+ ## Accessing Your Agent
806
+
807
+ ### HTTP (Simple)
808
+
809
+ ```python
810
+ import requests
811
+
812
+ # Single request
813
+ response = requests.post("http://localhost:8000/input", json={
814
+ "prompt": "Translate hello to Spanish"
815
+ })
816
+ print(response.json()["result"]) # "Hola"
817
+ ```
818
+
819
+ ### HTTP (Multi-turn)
820
+
821
+ ```python
822
+ import requests
823
+
824
+ # First request
825
+ r1 = requests.post("http://localhost:8000/input", json={
826
+ "prompt": "My name is John"
827
+ })
828
+ session = r1.json()["session"] # Save session
829
+
830
+ # Second request - pass session back
831
+ r2 = requests.post("http://localhost:8000/input", json={
832
+ "prompt": "What is my name?",
833
+ "session": session # Continue conversation
834
+ })
835
+ print(r2.json()["result"]) # "Your name is John"
836
+ session = r2.json()["session"] # Update session for next request
837
+ ```
838
+
839
+ ### WebSocket (Real-time)
840
+
841
+ ```python
842
+ import websockets
843
+ import json
844
+
845
+ async with websockets.connect("ws://localhost:8000/ws") as ws:
846
+ await ws.send(json.dumps({"type": "INPUT", "prompt": "Translate hello"}))
847
+
848
+ while True:
849
+ msg = json.loads(await ws.recv())
850
+ if msg["type"] == "OUTPUT":
851
+ print(msg["result"])
852
+ break
853
+ elif msg["type"] == "ERROR":
854
+ raise RuntimeError(msg.get("message", "Unknown error"))
855
+ else:
856
+ print("Event:", msg)
857
+ ```
858
+
859
+ ### P2P Relay (From Anywhere)
860
+
861
+ ```python
862
+ from connectonion import connect
863
+
864
+ translator = connect("0x3d4017c3...660c")
865
+ result = translator.input("Translate hello to Spanish")
866
+ ```
867
+
868
+ ---
869
+
870
+ ## Development vs Production
871
+
872
+ ### Development
873
+
874
+ ```python
875
+ host(create_agent, reload=True, trust="open")
876
+ ```
877
+
878
+ - Auto-reloads on code changes
879
+ - No authentication required
880
+
881
+ ### Production
882
+
883
+ ```python
884
+ host(create_agent, workers=4, trust="strict")
885
+ ```
886
+
887
+ - Multiple workers for parallel requests (OS-level isolation)
888
+ - Each request calls `create_agent()` for fresh instance (request-level isolation)
889
+ - Strict authentication and limits
890
+
891
+ ---
892
+
893
+ ## Deployment
894
+
895
+ ### Direct
896
+
897
+ ```bash
898
+ python myagent.py
899
+ ```
900
+
901
+ ### Standard Tooling
902
+
903
+ ```python
904
+ # myagent.py
905
+ from connectonion import Agent
906
+ from connectonion.network import host, create_app
907
+
908
+ def create_agent():
909
+ return Agent("translator", tools=[translate])
910
+
911
+ # Export ASGI app for uvicorn/gunicorn
912
+ app = create_app(create_agent)
913
+
914
+ if __name__ == "__main__":
915
+ host(create_agent)
916
+ ```
917
+
918
+ ```bash
919
+ # Uvicorn
920
+ uvicorn myagent:app --workers 4
921
+
922
+ # Gunicorn
923
+ gunicorn myagent:app -w 4 -k uvicorn.workers.UvicornWorker
924
+ ```
925
+
926
+ ### Docker
927
+
928
+ ```dockerfile
929
+ FROM python:3.11-slim
930
+ RUN pip install connectonion
931
+ COPY myagent.py .
932
+ CMD ["python", "myagent.py"]
933
+ ```
934
+
935
+ ```yaml
936
+ # docker-compose.yml
937
+ services:
938
+ agent:
939
+ build: .
940
+ ports:
941
+ - "8000:8000"
942
+ environment:
943
+ - CONNECTONION_ENV=production
944
+ ```
945
+
946
+ ### Reverse Proxy (Caddy)
947
+
948
+ ```
949
+ # Caddyfile
950
+ agent.example.com {
951
+ reverse_proxy localhost:8000
952
+ }
953
+ ```
954
+
955
+ ### systemd Service
956
+
957
+ ```ini
958
+ # /etc/systemd/system/myagent.service
959
+ [Unit]
960
+ Description=My ConnectOnion Agent
961
+ After=network.target
962
+
963
+ [Service]
964
+ User=app
965
+ WorkingDirectory=/app
966
+ ExecStart=/usr/bin/python myagent.py
967
+ Restart=always
968
+ RestartSec=5
969
+
970
+ [Install]
971
+ WantedBy=multi-user.target
972
+ ```
973
+
974
+ ```bash
975
+ sudo systemctl enable myagent
976
+ sudo systemctl start myagent
977
+ ```
978
+
979
+ ---
980
+
981
+ ## API Reference
982
+
983
+ ### host()
984
+
985
+ ```python
986
+ def host(
987
+ create_agent: Callable[[], Agent],
988
+ trust: Union[str, Agent] = "careful",
989
+ blacklist: list = None,
990
+ whitelist: list = None,
991
+ port: int = 8000,
992
+ workers: int = 1,
993
+ result_ttl: int = 86400,
994
+ relay_url: str = "wss://oo.openonion.ai/ws/announce",
995
+ reload: bool = False,
996
+ ) -> None
997
+ ```
998
+
999
+ | Parameter | Type | Default | Description |
1000
+ |-----------|------|---------|-------------|
1001
+ | `create_agent` | `Callable[[], Agent]` | required | Function that returns a fresh Agent instance |
1002
+ | `trust` | `str` or `Agent` | `"careful"` | Trust level, policy, or agent |
1003
+ | `blacklist` | `list` | `None` | Addresses to always reject |
1004
+ | `whitelist` | `list` | `None` | Addresses to always accept |
1005
+ | `port` | `int` | `8000` | HTTP port |
1006
+ | `workers` | `int` | `1` | Number of uvicorn worker processes |
1007
+ | `result_ttl` | `int` | `86400` | How long server keeps results (24h) |
1008
+ | `relay_url` | `str` | production | P2P relay server |
1009
+ | `reload` | `bool` | `False` | Auto-reload on changes |
1010
+
1011
+ ### create_app()
1012
+
1013
+ ```python
1014
+ from connectonion.network import create_app
1015
+
1016
+ def create_agent():
1017
+ return Agent("assistant", tools=[search])
1018
+
1019
+ app = create_app(
1020
+ create_agent: Callable[[], Agent],
1021
+ trust: Union[str, Agent] = "careful",
1022
+ blacklist: list = None,
1023
+ whitelist: list = None,
1024
+ result_ttl: int = 86400,
1025
+ ) -> ASGIApp
1026
+ ```
1027
+
1028
+ Returns ASGI app for use with uvicorn/gunicorn directly.
1029
+
1030
+ ---
1031
+
1032
+ ## Examples
1033
+
1034
+ ### Minimal
1035
+
1036
+ ```python
1037
+ from connectonion import Agent, host
1038
+
1039
+ def create_agent():
1040
+ return Agent("helper", tools=[search])
1041
+
1042
+ host(create_agent)
1043
+ ```
1044
+
1045
+ ### With Trust
1046
+
1047
+ ```python
1048
+ host(create_agent, trust="strict")
1049
+ ```
1050
+
1051
+ ### With Access Control
1052
+
1053
+ ```python
1054
+ host(create_agent, blacklist=["0xbad..."], whitelist=["0xpartner..."])
1055
+ ```
1056
+
1057
+ ### Production
1058
+
1059
+ ```python
1060
+ host(create_agent, workers=4, trust="strict", reload=False)
1061
+ ```
1062
+
1063
+ ### Custom Trust Policy
1064
+
1065
+ ```python
1066
+ host(create_agent, trust="Only accept from known contacts with >10 successful tasks")
1067
+ ```
1068
+
1069
+ ### Development
1070
+
1071
+ ```python
1072
+ host(create_agent, reload=True, trust="open")
1073
+ ```
1074
+
1075
+ ---
1076
+
1077
+ ## Comparison with Other Frameworks
1078
+
1079
+ | Framework | To Deploy |
1080
+ |-----------|-----------|
1081
+ | FastAPI | Learn uvicorn, ASGI, workers |
1082
+ | Django | `runserver` vs gunicorn |
1083
+ | LangServe | FastAPI + uvicorn |
1084
+ | PydanticAI | Build everything yourself |
1085
+ | **ConnectOnion** | `host(agent)` |
1086
+
1087
+ **We hide the complexity. You just host.**