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,293 @@
1
+ # ConnectOnion: A Cost-Centric Analysis of Agent Collaboration
2
+
3
+ ## Executive Summary
4
+
5
+ The AI agent ecosystem faces a fundamental economic problem: the cost of integration grows quadratically with the number of agents (O(n²)), making widespread collaboration economically unviable. ConnectOnion solves this by transforming integration cost to O(1) through behavioral discovery, enabling a new economic reality where agent collaboration becomes frictionless.
6
+
7
+ ## Part I: The Cost Structure of Digital Collaboration
8
+
9
+ ### The Hidden Tax on Innovation
10
+
11
+ Every time two pieces of software need to work together, someone pays a cost:
12
+
13
+ ```
14
+ Traditional Integration Cost = Time × Complexity × Maintenance
15
+ = 10 hours × n agents × ∞
16
+ = Exponential burden
17
+ ```
18
+
19
+ This cost is invisible in GDP statistics but devastating to innovation velocity.
20
+
21
+ ### The Three Cost Laws
22
+
23
+ **Law 1: Costs Can Only Transfer, Not Disappear**
24
+ - Platform complexity → Developer time
25
+ - API simplicity → Platform maintenance
26
+ - Someone always pays
27
+
28
+ **Law 2: Integration Costs Grow Quadratically**
29
+ - 10 agents = 45 possible connections
30
+ - 100 agents = 4,950 connections
31
+ - 1,000 agents = 499,500 connections
32
+ - Current approach: Unscalable
33
+
34
+ **Law 3: Friction Compounds Negatively**
35
+ - Each integration barrier reduces total value
36
+ - Network effects work in reverse
37
+ - Most potential collaborations never happen
38
+
39
+ ## Part II: The ConnectOnion Revolution
40
+
41
+ ### The Core Innovation: Behavioral Discovery
42
+
43
+ Instead of managing connections, we eliminate them:
44
+
45
+ ```python
46
+ # Traditional: O(n²) complexity
47
+ def integrate_traditional():
48
+ for service in all_services:
49
+ learn_api(service)
50
+ write_integration(service)
51
+ maintain_forever(service)
52
+
53
+ # ConnectOnion: O(1) complexity
54
+ def integrate_behavioral():
55
+ agent = discover("what I need")
56
+ result = agent(my_input)
57
+ ```
58
+
59
+ ### The Four Pillars
60
+
61
+ **1. Sandbox Testing → Verified Capabilities**
62
+ ```python
63
+ def verify_agent(candidate):
64
+ # Test with real task
65
+ result = candidate.demonstrate(sample_task)
66
+ return result.meets_requirements()
67
+ ```
68
+ No credentials needed. Performance is proof.
69
+
70
+ **2. Topology Limits → Natural Boundaries**
71
+ - Each agent connects to ~150 others max (Dunbar's number)
72
+ - Attacks limited to local scope
73
+ - No global manipulation possible
74
+
75
+ **3. Local Experience → Trustless Trust**
76
+ ```python
77
+ my_trust = my_experience(agent) # 100% weight
78
+ friend_trust = friend_experience(agent) # 30% weight
79
+ network_trust = global_reputation(agent) # 0% weight
80
+
81
+ # We don't use global reputation at all!
82
+ ```
83
+
84
+ **4. Selection Cost → Quality Filter**
85
+ - Finding agents requires semantic matching
86
+ - Using agents requires passing tests
87
+ - Bad actors filtered by effort required
88
+
89
+ ## Part III: Economic Transformation
90
+
91
+ ### Developer Time Liberation
92
+
93
+ **Traditional Development**
94
+ ```
95
+ Learning curve: 2-4 hours per API
96
+ Implementation: 4-8 hours per integration
97
+ Debugging: 2-4 hours per integration
98
+ Maintenance: ∞ hours
99
+
100
+ Total: 1,000+ hours for 100 integrations
101
+ Cost: $150,000 at $150/hour
102
+ ```
103
+
104
+ **ConnectOnion Development**
105
+ ```
106
+ Learning curve: 1 hour (once)
107
+ Implementation: 1 minute per agent
108
+ Debugging: Handled by protocol
109
+ Maintenance: Zero
110
+
111
+ Total: 3 hours for 100 agents
112
+ Cost: $450
113
+ Savings: 99.7%
114
+ ```
115
+
116
+ ### The Compound Effect
117
+
118
+ When integration is free, innovation accelerates:
119
+
120
+ 1. **Experimentation Cost → Zero**
121
+ - Try 100 solutions instead of 3
122
+ - Fail fast without penalty
123
+ - Find optimal combinations
124
+
125
+ 2. **Composition Becomes Trivial**
126
+ ```python
127
+ # Build complex systems instantly
128
+ translator = discover("translation")
129
+ analyzer = discover("sentiment")
130
+ summarizer = discover("summary")
131
+
132
+ def process(text):
133
+ return summarizer(analyzer(translator(text)))
134
+ ```
135
+
136
+ 3. **Network Effects Compound**
137
+ - Each new agent helps all others
138
+ - Value grows exponentially
139
+ - No platform lock-in
140
+
141
+ ### Market Size Expansion
142
+
143
+ **Traditional Market**
144
+ - Addressable: Developers willing to integrate (5%)
145
+ - Barrier: High integration cost
146
+ - Result: Small, specialized market
147
+
148
+ **ConnectOnion Market**
149
+ - Addressable: Anyone who can call a function (95%)
150
+ - Barrier: None
151
+ - Result: 20x market expansion
152
+
153
+ ## Part IV: Why This Can't Be Copied
154
+
155
+ ### The Simplicity Moat
156
+
157
+ Adding features is easy. Removing them is hard. We started simple.
158
+
159
+ ```
160
+ MCP: 500+ page specification
161
+ ConnectOnion: 100 lines of code
162
+ ```
163
+
164
+ ### The Network Effect Moat
165
+
166
+ Every day the network grows stronger:
167
+ - More agents → More value
168
+ - More interactions → Better matching
169
+ - More history → Stronger trust
170
+
171
+ Traditional platforms can't replicate this without abandoning their business model.
172
+
173
+ ### The Behavioral Data Moat
174
+
175
+ Trust history can't be faked:
176
+ - Built through real interactions
177
+ - Verified through actual work
178
+ - Accumulated over time
179
+
180
+ ## Part V: System Design
181
+
182
+ ### The Minimal Viable Protocol
183
+
184
+ ```python
185
+ class Agent:
186
+ def __init__(self):
187
+ self.experience = {}
188
+
189
+ def discover(self, need):
190
+ # Ask neighbors
191
+ candidates = self.ask_neighbors(need)
192
+
193
+ # Test them
194
+ results = [c.test() for c in candidates]
195
+
196
+ # Use best
197
+ best = max(results)
198
+
199
+ # Remember
200
+ self.experience[best] = "good"
201
+
202
+ return best
203
+ ```
204
+
205
+ That's it. 100 lines implement the entire protocol.
206
+
207
+ ### Natural Evolution
208
+
209
+ The system evolves without central planning:
210
+
211
+ 1. **Good agents** get recommended more
212
+ 2. **Bad agents** fail tests and disappear
213
+ 3. **New agents** prove themselves through work
214
+ 4. **The network** becomes smarter over time
215
+
216
+ ### Attack Immunity
217
+
218
+ Instead of preventing attacks, we make them pointless:
219
+
220
+ **Sybil Attack Attempt:**
221
+ - Create 1000 fake agents
222
+ - Each must pass real tests
223
+ - Each must do real work
224
+ - Result: You created 1000 real agents!
225
+
226
+ **Reputation Gaming:**
227
+ - No global reputation to game
228
+ - Local experience can't be faked
229
+ - Trust requires actual interaction
230
+
231
+ ## Part VI: Implementation Roadmap
232
+
233
+ ### Phase 1: Proof of Concept (Now)
234
+ - Local network discovery
235
+ - Basic behavioral matching
236
+ - Simple test framework
237
+
238
+ ### Phase 2: Network Growth (Q1 2025)
239
+ - 1,000+ agents
240
+ - Cross-network discovery
241
+ - Performance optimization
242
+
243
+ ### Phase 3: Critical Mass (Q2 2025)
244
+ - 10,000+ agents
245
+ - Enterprise adoption
246
+ - Behavioral analytics
247
+
248
+ ### Phase 4: Ubiquity (2026)
249
+ - Default protocol for AI collaboration
250
+ - Million+ agents
251
+ - Self-sustaining ecosystem
252
+
253
+ ## Part VII: The New Economics
254
+
255
+ ### Cost Flows
256
+
257
+ **Traditional:**
258
+ ```
259
+ Complexity → Integration Cost → Developer Time → Higher Prices → Less Innovation
260
+ ```
261
+
262
+ **ConnectOnion:**
263
+ ```
264
+ Simplicity → Zero Integration → Free Time → Lower Prices → More Innovation
265
+ ```
266
+
267
+ ### Value Creation
268
+
269
+ When connection is free, value compounds:
270
+
271
+ 1. **Direct Value**: Save $150k per 100 integrations
272
+ 2. **Opportunity Value**: 180x more innovation time
273
+ 3. **Network Value**: Each agent adds value to all others
274
+ 4. **Compound Value**: Combinations create emergent capabilities
275
+
276
+ ### The Ultimate Metric
277
+
278
+ **Traditional success**: How many APIs integrated?
279
+ **ConnectOnion success**: How many problems solved?
280
+
281
+ When integration is free, the only limit is imagination.
282
+
283
+ ## Conclusion: The Invisible Revolution
284
+
285
+ ConnectOnion doesn't add features—it removes friction. In doing so, it transforms the fundamental economics of software collaboration.
286
+
287
+ The revolution isn't visible in the protocol. It's visible in what developers build when integration cost approaches zero.
288
+
289
+ **The future belongs to those who make complexity disappear.**
290
+
291
+ ---
292
+
293
+ *"The best protocol is one developers don't have to think about."*
@@ -0,0 +1,394 @@
1
+ # ConnectOnion Network Protocol
2
+
3
+ Minimal peer-to-peer protocol using public keys as network addresses.
4
+
5
+ ## Core Design
6
+
7
+ ### Public Keys as Addresses
8
+ Public keys serve as network addresses, similar to IP addresses in TCP/IP. They provide a unique, unforgeable way to route messages between agents. No identity claims, no trust assumptions - just addressing.
9
+
10
+ ### Message-Based Architecture
11
+ The protocol uses stateless, message-based communication similar to email. Each message is self-contained with a unique task ID for correlation. This design naturally supports parallel operations, resilience to failures, and works seamlessly across NAT boundaries. Unlike session-based protocols (HTTP/gRPC), agents don't maintain connection state - they simply exchange signed messages.
12
+
13
+ ### Two-Layer Separation
14
+ **Public Discovery Layer**: ANNOUNCE and FIND messages are unencrypted broadcasts for transparency. Organizations can audit capabilities and network activity.
15
+ **Private Collaboration Layer**: TASK messages carry encrypted payloads between agents. Actual work remains confidential while discovery stays transparent.
16
+
17
+ ### Developer-Controlled Broadcasting
18
+ Agents announce themselves only when developers explicitly call the announce() function. No automatic broadcasts, no hidden network activity.
19
+
20
+ ## Network Topology
21
+
22
+ ### Agent Nodes
23
+ Standard participants in the network. Each agent maintains connections to other agents, divided into:
24
+ - **Contacts**: Agents with established collaborative history
25
+ - **Strangers**: Agents discovered but not yet verified
26
+
27
+ ### Relay Nodes
28
+ Infrastructure nodes that serve as message routers and connection points:
29
+ - **Message Relay**: Forward messages between agents that cannot directly connect (NAT traversal)
30
+ - **Presence Tracking**: Know which agents are currently connected (in memory only)
31
+ - **Initial Discovery**: Help new agents find their first peers
32
+
33
+ Relays maintain no permanent state and can be run by anyone. At scale, relays form a hierarchical network similar to CDN or DNS infrastructure.
34
+
35
+ ## Protocol Messages
36
+
37
+ ### Public Discovery Messages
38
+
39
+ #### ANNOUNCE Message
40
+ Purpose: Public broadcast of agent existence, capabilities, network endpoints, and liveness.
41
+
42
+ **Data Structure:**
43
+ ```
44
+ {
45
+ type: "ANNOUNCE",
46
+ pubkey: <sender's public key>,
47
+ timestamp: <unix timestamp>,
48
+ sequence: <incrementing counter>,
49
+
50
+ // Network Endpoints (for connectivity)
51
+ endpoints: [
52
+ "tcp://73.42.18.9:8001", // Public IP address
53
+ "tcp://192.168.1.100:8001", // Local LAN IP
54
+ "relay://abc123.connectonion.io" // Relay lookup (returns current IP)
55
+ ],
56
+ nat_type: "none" | "full_cone" | "restricted" | "symmetric",
57
+
58
+ // Capabilities
59
+ prompt_summary: <system prompt description>,
60
+ tools: [<list of available tools>],
61
+
62
+ // Liveness
63
+ uptime: <seconds since start>,
64
+ last_activity: {
65
+ type: <"tool_call" | "task_complete">,
66
+ timestamp: <when>,
67
+ tool: <which tool if applicable>
68
+ },
69
+
70
+ // Status
71
+ status: "active" | "idle" | "busy",
72
+ load: <0.0 to 1.0>,
73
+
74
+ // Metadata
75
+ version: <agent version>,
76
+ model: <LLM model used>,
77
+ state_hash: <hash for change detection>
78
+ }
79
+ ```
80
+
81
+ **Characteristics:**
82
+ - Unencrypted for transparency
83
+ - Single-hop forwarding maximum
84
+ - Sent on developer trigger (startup, task completion, changes, IP address change)
85
+
86
+ #### FIND Message
87
+ Purpose: Query network for specific capabilities.
88
+
89
+ **Data Structure:**
90
+ ```
91
+ {
92
+ type: "FIND",
93
+ pubkey: <requester's public key>,
94
+ query_id: <unique query identifier>,
95
+ capability: <natural language description>,
96
+ ttl: <hop counter, typically 3-4>,
97
+ timestamp: <unix timestamp>
98
+ }
99
+ ```
100
+
101
+ **Characteristics:**
102
+ - Propagates through network (TTL-limited)
103
+ - Small size for efficient flooding
104
+ - Responses return via ANNOUNCE
105
+
106
+ ### Private Collaboration Messages
107
+
108
+ #### TASK Message
109
+ Purpose: Carry actual work between agents.
110
+
111
+ **Data Structure:**
112
+ ```
113
+ {
114
+ type: "TASK",
115
+ from: <sender pubkey>,
116
+ to: <recipient pubkey>,
117
+
118
+ // Correlation
119
+ task_id: <unique task identifier>,
120
+ thread_id: <optional conversation context>,
121
+
122
+ // Payload
123
+ task_type: "request" | "response" | "error",
124
+ encrypted_payload: <encrypted with recipient's public key>,
125
+
126
+ // Metadata
127
+ timestamp: <when sent>,
128
+ ttl: <message expiry>,
129
+ priority: "high" | "normal" | "low",
130
+
131
+ // Security
132
+ signature: <sign(all above fields)>
133
+ }
134
+ ```
135
+
136
+ **Why Message-Based:**
137
+ - **Parallel by Design**: Each task has unique ID, enabling concurrent operations
138
+ - **Stateless**: No session management, agents can restart without losing work
139
+ - **NAT-Friendly**: Works through relays without persistent connections
140
+ - **Simple Mental Model**: Like email with threading and signatures
141
+ - **Resilient**: Messages can be queued, retried, and delivered asynchronously
142
+
143
+ ## Data Storage
144
+
145
+ ### Contact Records
146
+
147
+ Information about agents with established collaboration:
148
+
149
+ ```
150
+ {
151
+ pubkey: <public key>,
152
+
153
+ // Network information
154
+ endpoints: [<known connection methods>],
155
+ last_seen: <timestamp>,
156
+
157
+ // Collaboration history
158
+ successful_tasks: <count>,
159
+ failed_tasks: <count>,
160
+ last_collaboration: <timestamp>,
161
+
162
+ // Performance metrics
163
+ avg_response_time: <milliseconds>,
164
+ reliability_score: <0.0 to 1.0>
165
+ }
166
+ ```
167
+
168
+ Storage: Persistent, limited to ~150 entries (Dunbar's number)
169
+
170
+ ### Stranger Cache
171
+
172
+ Temporary information about discovered agents:
173
+
174
+ ```
175
+ {
176
+ pubkey: <public key>,
177
+
178
+ // Discovery information
179
+ discovered_via: <which contact>,
180
+ first_heard: <timestamp>,
181
+ last_heard: <timestamp>,
182
+
183
+ // Claimed capabilities (unverified)
184
+ prompt_summary: <their claim>,
185
+ tools: [<claimed tools>]
186
+ }
187
+ ```
188
+
189
+ Storage: Ephemeral, maximum 500 entries, auto-expire after 1 hour
190
+
191
+ ### Path Cache
192
+
193
+ Routing information for message delivery:
194
+
195
+ ```
196
+ {
197
+ target_pubkey: <destination>,
198
+ next_hop: <immediate neighbor to route through>,
199
+ confidence: <0.0 to 1.0>,
200
+ expires_at: <timestamp>
201
+ }
202
+ ```
203
+
204
+ Storage: Memory only, 5-15 minute TTL
205
+
206
+ ### Endpoint Claims
207
+
208
+ Self-signed assertions about how to connect:
209
+
210
+ ```
211
+ {
212
+ pubkey: <claiming agent>,
213
+ transport: "tcp" | "udp" | "websocket" | "bluetooth",
214
+ endpoint: <connection string>,
215
+ issued_at: <timestamp>,
216
+ expires_at: <timestamp>,
217
+ signature: <signed by claiming agent>
218
+ }
219
+ ```
220
+
221
+ Validation: Must be signed by claimed pubkey, must not be expired
222
+
223
+ ## Message Forwarding
224
+
225
+ ### Single-Hop Rule
226
+ HEARTBEAT messages forward at most one hop. This prevents exponential flooding while allowing immediate neighbors to learn about second-degree connections.
227
+
228
+ ### TTL-Based Propagation
229
+ NEED messages propagate based on TTL, decremented at each hop. This allows controlled network-wide search.
230
+
231
+ ### Selective Forwarding
232
+ Agents forward messages based on:
233
+ - Sender relationship (contact vs stranger)
234
+ - Message relevance
235
+ - Local rate limits
236
+ - Change significance (for HEARTBEATs)
237
+
238
+ ### Deduplication
239
+ Message IDs tracked in a rolling window (5 minutes) to prevent forwarding the same message twice.
240
+
241
+ ## Network Entry
242
+
243
+ ### Via Relay Nodes
244
+ New agents can use relay nodes for address lookup:
245
+ 1. Agents announce their current IP addresses directly
246
+ 2. If IP changes or isn't included, relay provides lookup service
247
+ 3. Relay returns current endpoints for any public key
248
+ 4. Clients connect directly using returned endpoints
249
+
250
+ ### Relay as Lookup Service
251
+ The relay server serves as a simple directory:
252
+ - Stores mapping of public key → current IP addresses
253
+ - Returns endpoints when queried by public key
254
+ - Does NOT proxy actual agent-to-agent traffic
255
+ - Optional paid service for guaranteed availability (future)
256
+
257
+ ### Relay Discovery
258
+ Relays can be discovered through:
259
+ - Default relay server (provided by ConnectOnion)
260
+ - Environment variables for custom relays
261
+ - DNS TXT records
262
+
263
+ ## Rate Limiting
264
+
265
+ ### Per-Agent Limits
266
+ - HEARTBEAT: Maximum 1 per minute
267
+ - NEED: Maximum 10 per minute
268
+ - Forward budget: 100 messages per minute
269
+
270
+ ### Natural Throttling
271
+ - Activity-based announcements (not periodic)
272
+ - Single-hop forwarding
273
+ - TTL limits
274
+ - Selective forwarding
275
+
276
+ ## Transport Layer
277
+
278
+ ### Multi-Transport Support
279
+
280
+ **Relay Communication (Agent ↔ Relay):**
281
+ - WebSocket/WSS (firewall-friendly, persistent connection)
282
+ - Used for: address lookup, NAT traversal coordination
283
+ - Always works through corporate/university firewalls
284
+
285
+ **Direct Agent-to-Agent Communication:**
286
+ - TCP (primary data transfer, reliable)
287
+ - UDP (discovery broadcasts, hole-punching)
288
+ - HTTP/HTTPS (fallback when TCP blocked)
289
+
290
+ **Connection Flow:**
291
+ 1. Agent connects to relay via WebSocket for address lookup
292
+ 2. Relay returns target agent's direct endpoints
293
+ 3. Agents attempt direct connection via TCP/UDP
294
+ 4. Fallback to HTTP if TCP/UDP blocked by firewall
295
+
296
+ ### Connection Priority
297
+ 1. Direct connection to known endpoint
298
+ 2. Recently successful transport
299
+ 3. UDP hole punching attempt
300
+ 4. Relay-mediated connection
301
+ 5. Queue for later delivery
302
+
303
+ ## Memory Requirements
304
+
305
+ ### Typical Agent Storage
306
+ - Contacts: 150 entries × 1KB = 150KB
307
+ - Strangers: 500 entries × 200 bytes = 100KB
308
+ - Path cache: 1000 entries × 64 bytes = 64KB
309
+ - Message IDs: 10,000 entries × 32 bytes = 320KB
310
+ - **Total: ~650KB to 2MB typical**
311
+
312
+ ### Relay Storage (Memory Only)
313
+ - Active connections: 100 bytes per connection
314
+ - 10,000 connections = 1MB
315
+ - 100,000 connections = 10MB
316
+ - **No persistent storage required**
317
+
318
+ ## Protocol Properties
319
+
320
+ ### Scalability
321
+ - No global state required
322
+ - Each agent knows only local neighborhood
323
+ - Natural clustering by collaboration
324
+ - Supports billions of agents
325
+
326
+ ### Performance
327
+ - Message size: HEARTBEAT ~1KB, NEED ~200 bytes
328
+ - Discovery time: 200-500ms typical
329
+ - Direct message: <50ms
330
+ - Network diameter: ~6 hops (small world)
331
+
332
+ ### Resilience
333
+ - No single point of failure
334
+ - Natural redundancy through multiple paths
335
+ - Automatic expiration of stale data
336
+ - Self-healing through gossip
337
+
338
+ ### Privacy
339
+ - No global directory
340
+ - Only next-hop stored in routing
341
+ - Connections visible only to participants
342
+ - No mandatory broadcasts
343
+
344
+ ## Implementation Notes
345
+
346
+ ### Message Serialization
347
+ Messages should be serialized using MessagePack or JSON for interoperability.
348
+
349
+ ### Cryptographic Requirements
350
+ - Ed25519 for public keys (32 bytes)
351
+ - Signatures on endpoint claims
352
+ - No encryption at protocol level (application concern)
353
+
354
+ ### Time Synchronization
355
+ Protocol assumes loose time synchronization (within 5 minutes) for TTL and expiration.
356
+
357
+ ### Connection Persistence
358
+ Connections to contacts should be kept alive when possible to reduce discovery overhead.
359
+
360
+ ## Why Message-Based Architecture
361
+
362
+ ### The Problem with Sessions
363
+ Session-based protocols (HTTP, gRPC, WebSockets) were designed for client-server interactions where:
364
+ - Order matters
365
+ - State is maintained
366
+ - Connections are persistent
367
+ - Operations are sequential
368
+
369
+ AI agents don't fit this model. They naturally handle multiple tasks in parallel, may restart at any time, and often can't maintain direct connections due to NAT.
370
+
371
+ ### Why Message-Based Wins
372
+
373
+ **Natural Parallelism**
374
+ Each task gets a unique ID. Agents can handle hundreds of concurrent tasks without managing session state or connection pools. Responses arrive asynchronously and are correlated by task ID.
375
+
376
+ **Resilience By Default**
377
+ Messages don't require persistent connections. If an agent crashes, messages queue at relays. If the network fails, messages retry. No session state to rebuild, no connection pools to manage.
378
+
379
+ **NAT Traversal Simplicity**
380
+ Messages route through relays without complex hole-punching or session maintenance. The sender doesn't need to know if the recipient is behind NAT - messages find their way.
381
+
382
+ **50-Year Proven Model**
383
+ Email has survived because message-based architecture is fundamentally correct for asynchronous, distributed communication. AI agents have the same requirements: async operation, distributed nodes, unreliable networks.
384
+
385
+ ### The Unix Philosophy Applied
386
+ Like Unix pipes, each agent is a filter that processes messages. Composition is natural, parallelism is free, and the mental model is simple. No complex state machines, no session management, just messages with IDs.
387
+
388
+ ## Summary
389
+
390
+ The ConnectOnion protocol embraces message-based architecture because it perfectly matches how AI agents actually work: parallel task processing, resilient to failures, and simple to understand.
391
+
392
+ Public discovery happens transparently through ANNOUNCE/FIND broadcasts, while private work flows through encrypted TASK messages. This separation gives organizations the auditing they need while preserving the confidentiality of actual work.
393
+
394
+ With public keys as addresses and messages as the communication primitive, the protocol provides just enough infrastructure for agents to find and collaborate with each other, without the complexity of session management or the overhead of persistent connections.