cube-agent-harness 0.1.0__tar.gz

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 (373) hide show
  1. cube_agent_harness-0.1.0/.gitignore +41 -0
  2. cube_agent_harness-0.1.0/LICENSE +21 -0
  3. cube_agent_harness-0.1.0/PKG-INFO +331 -0
  4. cube_agent_harness-0.1.0/README.md +260 -0
  5. cube_agent_harness-0.1.0/cube/README.md +369 -0
  6. cube_agent_harness-0.1.0/cube/__init__.py +1 -0
  7. cube_agent_harness-0.1.0/cube/_optional.py +17 -0
  8. cube_agent_harness-0.1.0/cube/cluster/README.md +277 -0
  9. cube_agent_harness-0.1.0/cube/cluster/__init__.py +52 -0
  10. cube_agent_harness-0.1.0/cube/cluster/_config.py +118 -0
  11. cube_agent_harness-0.1.0/cube/cluster/_health.py +39 -0
  12. cube_agent_harness-0.1.0/cube/cluster/_schema.py +51 -0
  13. cube_agent_harness-0.1.0/cube/cluster/_services.py +25 -0
  14. cube_agent_harness-0.1.0/cube/cluster/gateway/__init__.py +3 -0
  15. cube_agent_harness-0.1.0/cube/cluster/gateway/_events.py +58 -0
  16. cube_agent_harness-0.1.0/cube/cluster/gateway/_gateway.py +365 -0
  17. cube_agent_harness-0.1.0/cube/cluster/gateway/_pending.py +26 -0
  18. cube_agent_harness-0.1.0/cube/cluster/mysql/__init__.py +4 -0
  19. cube_agent_harness-0.1.0/cube/cluster/mysql/_config.py +31 -0
  20. cube_agent_harness-0.1.0/cube/cluster/mysql/_provider.py +55 -0
  21. cube_agent_harness-0.1.0/cube/cluster/protocol/__init__.py +16 -0
  22. cube_agent_harness-0.1.0/cube/cluster/protocol/_codec.py +20 -0
  23. cube_agent_harness-0.1.0/cube/cluster/protocol/_constants.py +3 -0
  24. cube_agent_harness-0.1.0/cube/cluster/protocol/_envelope.py +50 -0
  25. cube_agent_harness-0.1.0/cube/cluster/redis/__init__.py +6 -0
  26. cube_agent_harness-0.1.0/cube/cluster/redis/_client.py +46 -0
  27. cube_agent_harness-0.1.0/cube/cluster/redis/_config.py +15 -0
  28. cube_agent_harness-0.1.0/cube/cluster/redis/_keys.py +44 -0
  29. cube_agent_harness-0.1.0/cube/cluster/redis/_request_cache.py +31 -0
  30. cube_agent_harness-0.1.0/cube/cluster/routing/__init__.py +21 -0
  31. cube_agent_harness-0.1.0/cube/cluster/routing/_directory.py +60 -0
  32. cube_agent_harness-0.1.0/cube/cluster/routing/_lease.py +129 -0
  33. cube_agent_harness-0.1.0/cube/cluster/routing/_resolver.py +86 -0
  34. cube_agent_harness-0.1.0/cube/cluster/routing/_worker_select.py +41 -0
  35. cube_agent_harness-0.1.0/cube/cluster/worker/__init__.py +3 -0
  36. cube_agent_harness-0.1.0/cube/cluster/worker/__main__.py +4 -0
  37. cube_agent_harness-0.1.0/cube/cluster/worker/_drain.py +16 -0
  38. cube_agent_harness-0.1.0/cube/cluster/worker/_entrypoint.py +19 -0
  39. cube_agent_harness-0.1.0/cube/cluster/worker/_env.py +98 -0
  40. cube_agent_harness-0.1.0/cube/cluster/worker/_worker.py +661 -0
  41. cube_agent_harness-0.1.0/cube/core/README.md +116 -0
  42. cube_agent_harness-0.1.0/cube/core/__init__.py +168 -0
  43. cube_agent_harness-0.1.0/cube/core/common/__init__.py +23 -0
  44. cube_agent_harness-0.1.0/cube/core/common/_cancellation.py +56 -0
  45. cube_agent_harness-0.1.0/cube/core/common/_event_bus.py +220 -0
  46. cube_agent_harness-0.1.0/cube/core/common/_event_registry.py +69 -0
  47. cube_agent_harness-0.1.0/cube/core/common/_id.py +18 -0
  48. cube_agent_harness-0.1.0/cube/core/common/_status.py +14 -0
  49. cube_agent_harness-0.1.0/cube/core/common/_time.py +16 -0
  50. cube_agent_harness-0.1.0/cube/core/hook/README.md +152 -0
  51. cube_agent_harness-0.1.0/cube/core/hook/__init__.py +136 -0
  52. cube_agent_harness-0.1.0/cube/core/hook/_core_extensions.py +184 -0
  53. cube_agent_harness-0.1.0/cube/core/hook/_decorators.py +78 -0
  54. cube_agent_harness-0.1.0/cube/core/hook/_dispatch.py +96 -0
  55. cube_agent_harness-0.1.0/cube/core/hook/_extension.py +76 -0
  56. cube_agent_harness-0.1.0/cube/core/hook/_record.py +260 -0
  57. cube_agent_harness-0.1.0/cube/core/hook/_reducer.py +138 -0
  58. cube_agent_harness-0.1.0/cube/core/hook/_registry.py +143 -0
  59. cube_agent_harness-0.1.0/cube/core/hook/_runtime.py +38 -0
  60. cube_agent_harness-0.1.0/cube/core/hook/types.py +342 -0
  61. cube_agent_harness-0.1.0/cube/core/llm/__init__.py +160 -0
  62. cube_agent_harness-0.1.0/cube/core/llm/_base_client.py +536 -0
  63. cube_agent_harness-0.1.0/cube/core/llm/_catalog.py +147 -0
  64. cube_agent_harness-0.1.0/cube/core/llm/_lite_llm_client.py +599 -0
  65. cube_agent_harness-0.1.0/cube/core/llm/_model.py +362 -0
  66. cube_agent_harness-0.1.0/cube/core/llm/_router.py +219 -0
  67. cube_agent_harness-0.1.0/cube/core/llm/_router_client.py +395 -0
  68. cube_agent_harness-0.1.0/cube/core/llm/_router_compile.py +126 -0
  69. cube_agent_harness-0.1.0/cube/core/llm/_token.py +55 -0
  70. cube_agent_harness-0.1.0/cube/core/mcp/__init__.py +27 -0
  71. cube_agent_harness-0.1.0/cube/core/mcp/_adapter.py +90 -0
  72. cube_agent_harness-0.1.0/cube/core/mcp/_config.py +117 -0
  73. cube_agent_harness-0.1.0/cube/core/mcp/_manager.py +319 -0
  74. cube_agent_harness-0.1.0/cube/core/runtime/README.md +138 -0
  75. cube_agent_harness-0.1.0/cube/core/runtime/__init__.py +158 -0
  76. cube_agent_harness-0.1.0/cube/core/runtime/_agent_loop.py +1473 -0
  77. cube_agent_harness-0.1.0/cube/core/runtime/_agent_runtime.py +1359 -0
  78. cube_agent_harness-0.1.0/cube/core/runtime/_background_render.py +61 -0
  79. cube_agent_harness-0.1.0/cube/core/runtime/_compact_contract.py +77 -0
  80. cube_agent_harness-0.1.0/cube/core/runtime/_events.py +353 -0
  81. cube_agent_harness-0.1.0/cube/core/runtime/_llm_msg_adapter.py +301 -0
  82. cube_agent_harness-0.1.0/cube/core/runtime/_message.py +376 -0
  83. cube_agent_harness-0.1.0/cube/core/runtime/_message_registry.py +87 -0
  84. cube_agent_harness-0.1.0/cube/core/runtime/_model.py +577 -0
  85. cube_agent_harness-0.1.0/cube/core/runtime/_shutdown.py +139 -0
  86. cube_agent_harness-0.1.0/cube/core/tool/__init__.py +173 -0
  87. cube_agent_harness-0.1.0/cube/core/tool/_base_tool.py +882 -0
  88. cube_agent_harness-0.1.0/cube/core/tool/_call_executor.py +662 -0
  89. cube_agent_harness-0.1.0/cube/core/tool/_decorator.py +128 -0
  90. cube_agent_harness-0.1.0/cube/core/tool/_dynamic.py +201 -0
  91. cube_agent_harness-0.1.0/cube/core/tool/_file_access.py +173 -0
  92. cube_agent_harness-0.1.0/cube/core/tool/_file_mutation.py +100 -0
  93. cube_agent_harness-0.1.0/cube/core/tool/_orchestrator.py +385 -0
  94. cube_agent_harness-0.1.0/cube/core/tool/_registry.py +192 -0
  95. cube_agent_harness-0.1.0/cube/core/tool/_result_storage.py +308 -0
  96. cube_agent_harness-0.1.0/cube/core/tool/_runtime_access.py +142 -0
  97. cube_agent_harness-0.1.0/cube/core/tool/_tool_runtime.py +1584 -0
  98. cube_agent_harness-0.1.0/cube/core/tool/_tool_task.py +931 -0
  99. cube_agent_harness-0.1.0/cube/platform/README.md +163 -0
  100. cube_agent_harness-0.1.0/cube/platform/__init__.py +77 -0
  101. cube_agent_harness-0.1.0/cube/platform/agency/__init__.py +67 -0
  102. cube_agent_harness-0.1.0/cube/platform/agency/_errors.py +2 -0
  103. cube_agent_harness-0.1.0/cube/platform/agency/_model.py +133 -0
  104. cube_agent_harness-0.1.0/cube/platform/agency/_service.py +842 -0
  105. cube_agent_harness-0.1.0/cube/platform/agency/_skill.py +829 -0
  106. cube_agent_harness-0.1.0/cube/platform/agency/_subagent.py +379 -0
  107. cube_agent_harness-0.1.0/cube/platform/agent/__init__.py +59 -0
  108. cube_agent_harness-0.1.0/cube/platform/agent/_agent.py +377 -0
  109. cube_agent_harness-0.1.0/cube/platform/agent/_option.py +238 -0
  110. cube_agent_harness-0.1.0/cube/platform/agent/_state.py +28 -0
  111. cube_agent_harness-0.1.0/cube/platform/agent/_subagent.py +45 -0
  112. cube_agent_harness-0.1.0/cube/platform/agent/_worker.py +41 -0
  113. cube_agent_harness-0.1.0/cube/platform/assembly/__init__.py +15 -0
  114. cube_agent_harness-0.1.0/cube/platform/assembly/_config.py +22 -0
  115. cube_agent_harness-0.1.0/cube/platform/assembly/_loader.py +49 -0
  116. cube_agent_harness-0.1.0/cube/platform/assembly/_runtime.py +27 -0
  117. cube_agent_harness-0.1.0/cube/platform/assembly/_validation.py +74 -0
  118. cube_agent_harness-0.1.0/cube/platform/channel/__init__.py +13 -0
  119. cube_agent_harness-0.1.0/cube/platform/channel/_coordinator.py +198 -0
  120. cube_agent_harness-0.1.0/cube/platform/channel/_errors.py +2 -0
  121. cube_agent_harness-0.1.0/cube/platform/channel/_model.py +15 -0
  122. cube_agent_harness-0.1.0/cube/platform/channel/_service.py +197 -0
  123. cube_agent_harness-0.1.0/cube/platform/channel/_session_gate.py +51 -0
  124. cube_agent_harness-0.1.0/cube/platform/channel/_state.py +300 -0
  125. cube_agent_harness-0.1.0/cube/platform/command/__init__.py +37 -0
  126. cube_agent_harness-0.1.0/cube/platform/command/_executor.py +384 -0
  127. cube_agent_harness-0.1.0/cube/platform/command/_local.py +29 -0
  128. cube_agent_harness-0.1.0/cube/platform/command/_model.py +180 -0
  129. cube_agent_harness-0.1.0/cube/platform/command/_protocol.py +15 -0
  130. cube_agent_harness-0.1.0/cube/platform/database/README.md +123 -0
  131. cube_agent_harness-0.1.0/cube/platform/database/__init__.py +58 -0
  132. cube_agent_harness-0.1.0/cube/platform/database/_config.py +28 -0
  133. cube_agent_harness-0.1.0/cube/platform/database/_json.py +23 -0
  134. cube_agent_harness-0.1.0/cube/platform/database/_paths.py +12 -0
  135. cube_agent_harness-0.1.0/cube/platform/database/_provider.py +21 -0
  136. cube_agent_harness-0.1.0/cube/platform/database/_providers/__init__.py +3 -0
  137. cube_agent_harness-0.1.0/cube/platform/database/_providers/_sqlite.py +74 -0
  138. cube_agent_harness-0.1.0/cube/platform/database/_retry.py +37 -0
  139. cube_agent_harness-0.1.0/cube/platform/database/_schema.py +364 -0
  140. cube_agent_harness-0.1.0/cube/platform/database/_service.py +138 -0
  141. cube_agent_harness-0.1.0/cube/platform/database/_table_config.py +32 -0
  142. cube_agent_harness-0.1.0/cube/platform/database/_table_init.py +42 -0
  143. cube_agent_harness-0.1.0/cube/platform/database/_table_loader.py +59 -0
  144. cube_agent_harness-0.1.0/cube/platform/database/_table_registry.py +132 -0
  145. cube_agent_harness-0.1.0/cube/platform/database/_table_spec.py +72 -0
  146. cube_agent_harness-0.1.0/cube/platform/database/_tables.py +22 -0
  147. cube_agent_harness-0.1.0/cube/platform/database/_types.py +11 -0
  148. cube_agent_harness-0.1.0/cube/platform/database/repository/__init__.py +47 -0
  149. cube_agent_harness-0.1.0/cube/platform/database/repository/_agency_user_membership_repository.py +65 -0
  150. cube_agent_harness-0.1.0/cube/platform/database/repository/_agent_run_state_repository.py +135 -0
  151. cube_agent_harness-0.1.0/cube/platform/database/repository/_background_tool_task_repository.py +120 -0
  152. cube_agent_harness-0.1.0/cube/platform/database/repository/_base.py +44 -0
  153. cube_agent_harness-0.1.0/cube/platform/database/repository/_config_repository.py +43 -0
  154. cube_agent_harness-0.1.0/cube/platform/database/repository/_llm_call_metric_repository.py +179 -0
  155. cube_agent_harness-0.1.0/cube/platform/database/repository/_notification_repository.py +95 -0
  156. cube_agent_harness-0.1.0/cube/platform/database/repository/_session_member_repository.py +106 -0
  157. cube_agent_harness-0.1.0/cube/platform/database/repository/_session_message_repository.py +168 -0
  158. cube_agent_harness-0.1.0/cube/platform/database/repository/_session_repository.py +61 -0
  159. cube_agent_harness-0.1.0/cube/platform/database/table/__init__.py +38 -0
  160. cube_agent_harness-0.1.0/cube/platform/database/table/_agency_user_membership.py +44 -0
  161. cube_agent_harness-0.1.0/cube/platform/database/table/_agent_run_state.py +21 -0
  162. cube_agent_harness-0.1.0/cube/platform/database/table/_background_tool_task.py +63 -0
  163. cube_agent_harness-0.1.0/cube/platform/database/table/_config.py +23 -0
  164. cube_agent_harness-0.1.0/cube/platform/database/table/_llm_call_metric.py +93 -0
  165. cube_agent_harness-0.1.0/cube/platform/database/table/_notification.py +62 -0
  166. cube_agent_harness-0.1.0/cube/platform/database/table/_session.py +56 -0
  167. cube_agent_harness-0.1.0/cube/platform/database/table/_session_member.py +33 -0
  168. cube_agent_harness-0.1.0/cube/platform/database/table/_session_message.py +53 -0
  169. cube_agent_harness-0.1.0/cube/platform/event/__init__.py +25 -0
  170. cube_agent_harness-0.1.0/cube/platform/event/_local.py +118 -0
  171. cube_agent_harness-0.1.0/cube/platform/event/_model.py +18 -0
  172. cube_agent_harness-0.1.0/cube/platform/event/_protocol.py +36 -0
  173. cube_agent_harness-0.1.0/cube/platform/event/_snapshot.py +49 -0
  174. cube_agent_harness-0.1.0/cube/platform/event/_stream.py +94 -0
  175. cube_agent_harness-0.1.0/cube/platform/host/__init__.py +47 -0
  176. cube_agent_harness-0.1.0/cube/platform/host/_config.py +38 -0
  177. cube_agent_harness-0.1.0/cube/platform/host/_health.py +68 -0
  178. cube_agent_harness-0.1.0/cube/platform/host/_local_app.py +152 -0
  179. cube_agent_harness-0.1.0/cube/platform/host/_runtime.py +306 -0
  180. cube_agent_harness-0.1.0/cube/platform/host/_services.py +180 -0
  181. cube_agent_harness-0.1.0/cube/platform/mcp/__init__.py +15 -0
  182. cube_agent_harness-0.1.0/cube/platform/mcp/_runtime.py +158 -0
  183. cube_agent_harness-0.1.0/cube/platform/notification/__init__.py +23 -0
  184. cube_agent_harness-0.1.0/cube/platform/notification/_events.py +26 -0
  185. cube_agent_harness-0.1.0/cube/platform/notification/_model.py +68 -0
  186. cube_agent_harness-0.1.0/cube/platform/notification/_service.py +203 -0
  187. cube_agent_harness-0.1.0/cube/platform/plugin/README.md +203 -0
  188. cube_agent_harness-0.1.0/cube/platform/plugin/__init__.py +173 -0
  189. cube_agent_harness-0.1.0/cube/platform/plugin/_agent.py +50 -0
  190. cube_agent_harness-0.1.0/cube/platform/plugin/_assembly.py +92 -0
  191. cube_agent_harness-0.1.0/cube/platform/plugin/_catalog.py +60 -0
  192. cube_agent_harness-0.1.0/cube/platform/plugin/_channel.py +287 -0
  193. cube_agent_harness-0.1.0/cube/platform/plugin/_config.py +254 -0
  194. cube_agent_harness-0.1.0/cube/platform/plugin/_context.py +127 -0
  195. cube_agent_harness-0.1.0/cube/platform/plugin/_database.py +37 -0
  196. cube_agent_harness-0.1.0/cube/platform/plugin/_discovery.py +144 -0
  197. cube_agent_harness-0.1.0/cube/platform/plugin/_errors.py +35 -0
  198. cube_agent_harness-0.1.0/cube/platform/plugin/_loader.py +30 -0
  199. cube_agent_harness-0.1.0/cube/platform/plugin/_manager.py +44 -0
  200. cube_agent_harness-0.1.0/cube/platform/plugin/_materializer.py +166 -0
  201. cube_agent_harness-0.1.0/cube/platform/plugin/_model.py +169 -0
  202. cube_agent_harness-0.1.0/cube/platform/plugin/_registration.py +63 -0
  203. cube_agent_harness-0.1.0/cube/platform/plugin/_registry.py +252 -0
  204. cube_agent_harness-0.1.0/cube/platform/plugin/_resolver.py +144 -0
  205. cube_agent_harness-0.1.0/cube/platform/plugin/_selection.py +34 -0
  206. cube_agent_harness-0.1.0/cube/platform/plugin/_session.py +330 -0
  207. cube_agent_harness-0.1.0/cube/platform/sandbox/__init__.py +16 -0
  208. cube_agent_harness-0.1.0/cube/platform/sandbox/_base.py +33 -0
  209. cube_agent_harness-0.1.0/cube/platform/sandbox/_config.py +93 -0
  210. cube_agent_harness-0.1.0/cube/platform/sandbox/_srt.py +448 -0
  211. cube_agent_harness-0.1.0/cube/platform/session/README.md +117 -0
  212. cube_agent_harness-0.1.0/cube/platform/session/__init__.py +163 -0
  213. cube_agent_harness-0.1.0/cube/platform/session/_agent_helpers.py +213 -0
  214. cube_agent_harness-0.1.0/cube/platform/session/_capabilities.py +65 -0
  215. cube_agent_harness-0.1.0/cube/platform/session/_construction.py +42 -0
  216. cube_agent_harness-0.1.0/cube/platform/session/_errors.py +35 -0
  217. cube_agent_harness-0.1.0/cube/platform/session/_file_mounts.py +162 -0
  218. cube_agent_harness-0.1.0/cube/platform/session/_history.py +30 -0
  219. cube_agent_harness-0.1.0/cube/platform/session/_manifest/__init__.py +27 -0
  220. cube_agent_harness-0.1.0/cube/platform/session/_manifest/_registry.py +163 -0
  221. cube_agent_harness-0.1.0/cube/platform/session/_prompt/__init__.py +109 -0
  222. cube_agent_harness-0.1.0/cube/platform/session/_prompt/_build.py +68 -0
  223. cube_agent_harness-0.1.0/cube/platform/session/_prompt/_document.py +118 -0
  224. cube_agent_harness-0.1.0/cube/platform/session/_prompt/_environment.py +277 -0
  225. cube_agent_harness-0.1.0/cube/platform/session/_prompt/_errors.py +5 -0
  226. cube_agent_harness-0.1.0/cube/platform/session/_prompt/_layers.py +672 -0
  227. cube_agent_harness-0.1.0/cube/platform/session/_prompt/_models.py +74 -0
  228. cube_agent_harness-0.1.0/cube/platform/session/_prompt/_snapshot.py +269 -0
  229. cube_agent_harness-0.1.0/cube/platform/session/_prompt/_workspace.py +138 -0
  230. cube_agent_harness-0.1.0/cube/platform/session/_role.py +50 -0
  231. cube_agent_harness-0.1.0/cube/platform/session/_runtime/__init__.py +99 -0
  232. cube_agent_harness-0.1.0/cube/platform/session/_runtime/_async.py +37 -0
  233. cube_agent_harness-0.1.0/cube/platform/session/_runtime/_background.py +237 -0
  234. cube_agent_harness-0.1.0/cube/platform/session/_runtime/_background_control.py +71 -0
  235. cube_agent_harness-0.1.0/cube/platform/session/_runtime/_recovery.py +74 -0
  236. cube_agent_harness-0.1.0/cube/platform/session/_runtime/_registry.py +638 -0
  237. cube_agent_harness-0.1.0/cube/platform/session/_runtime/_run_state.py +614 -0
  238. cube_agent_harness-0.1.0/cube/platform/session/_runtime/_services.py +62 -0
  239. cube_agent_harness-0.1.0/cube/platform/session/_runtime/_tool_access.py +194 -0
  240. cube_agent_harness-0.1.0/cube/platform/session/_schema/__init__.py +69 -0
  241. cube_agent_harness-0.1.0/cube/platform/session/_schema/_events.py +44 -0
  242. cube_agent_harness-0.1.0/cube/platform/session/_schema/_lifecycle.py +58 -0
  243. cube_agent_harness-0.1.0/cube/platform/session/_schema/_messages.py +92 -0
  244. cube_agent_harness-0.1.0/cube/platform/session/_schema/_model.py +176 -0
  245. cube_agent_harness-0.1.0/cube/platform/session/_schema/_receive.py +71 -0
  246. cube_agent_harness-0.1.0/cube/platform/session/_schema/_state.py +39 -0
  247. cube_agent_harness-0.1.0/cube/platform/session/_schema/_workspace.py +30 -0
  248. cube_agent_harness-0.1.0/cube/platform/session/_service.py +688 -0
  249. cube_agent_harness-0.1.0/cube/platform/session/_session.py +1264 -0
  250. cube_agent_harness-0.1.0/cube/platform/session/_transcript/__init__.py +11 -0
  251. cube_agent_harness-0.1.0/cube/platform/session/_transcript/_codec.py +26 -0
  252. cube_agent_harness-0.1.0/cube/platform/session/_transcript/_transcript.py +251 -0
  253. cube_agent_harness-0.1.0/cube/platform/workspace/__init__.py +73 -0
  254. cube_agent_harness-0.1.0/cube/platform/workspace/_agency_workspace.py +99 -0
  255. cube_agent_harness-0.1.0/cube/platform/workspace/_agent_workspace.py +82 -0
  256. cube_agent_harness-0.1.0/cube/platform/workspace/_channel_workspace.py +73 -0
  257. cube_agent_harness-0.1.0/cube/platform/workspace/_coordination.py +727 -0
  258. cube_agent_harness-0.1.0/cube/platform/workspace/_file_workspace.py +347 -0
  259. cube_agent_harness-0.1.0/cube/platform/workspace/_key_file_schema.py +219 -0
  260. cube_agent_harness-0.1.0/cube/platform/workspace/_key_file_service.py +237 -0
  261. cube_agent_harness-0.1.0/cube/platform/workspace/_metadata_cache.py +211 -0
  262. cube_agent_harness-0.1.0/cube/platform/workspace/_vfs.py +110 -0
  263. cube_agent_harness-0.1.0/cube/platform/workspace/_workspace_service.py +111 -0
  264. cube_agent_harness-0.1.0/cube/plugins/README.md +56 -0
  265. cube_agent_harness-0.1.0/cube/plugins/__init__.py +1 -0
  266. cube_agent_harness-0.1.0/cube/plugins/channels/__init__.py +1 -0
  267. cube_agent_harness-0.1.0/cube/plugins/channels/chat/__init__.py +14 -0
  268. cube_agent_harness-0.1.0/cube/plugins/channels/chat/_config.py +14 -0
  269. cube_agent_harness-0.1.0/cube/plugins/channels/chat/_provider.py +92 -0
  270. cube_agent_harness-0.1.0/cube/plugins/channels/chat/plugin.py +54 -0
  271. cube_agent_harness-0.1.0/cube/plugins/channels/project/__init__.py +18 -0
  272. cube_agent_harness-0.1.0/cube/plugins/channels/project/_config.py +10 -0
  273. cube_agent_harness-0.1.0/cube/plugins/channels/project/_provider.py +50 -0
  274. cube_agent_harness-0.1.0/cube/plugins/channels/project/_query_service.py +176 -0
  275. cube_agent_harness-0.1.0/cube/plugins/channels/project/plugin.py +45 -0
  276. cube_agent_harness-0.1.0/cube/plugins/hooks/__init__.py +26 -0
  277. cube_agent_harness-0.1.0/cube/plugins/hooks/compaction/__init__.py +17 -0
  278. cube_agent_harness-0.1.0/cube/plugins/hooks/compaction/_micro.py +57 -0
  279. cube_agent_harness-0.1.0/cube/plugins/hooks/compaction/_policy.py +16 -0
  280. cube_agent_harness-0.1.0/cube/plugins/hooks/compaction/_shared.py +165 -0
  281. cube_agent_harness-0.1.0/cube/plugins/hooks/compaction/_summary.py +131 -0
  282. cube_agent_harness-0.1.0/cube/plugins/hooks/internal_tool_policy.py +58 -0
  283. cube_agent_harness-0.1.0/cube/plugins/hooks/llm_metric_recorder.py +63 -0
  284. cube_agent_harness-0.1.0/cube/plugins/hooks/normalize_tool_input.py +53 -0
  285. cube_agent_harness-0.1.0/cube/plugins/hooks/plugin.py +27 -0
  286. cube_agent_harness-0.1.0/cube/plugins/sessions/__init__.py +3 -0
  287. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/__init__.py +41 -0
  288. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/_compaction.py +31 -0
  289. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/_file_space.py +173 -0
  290. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/_hooks.py +54 -0
  291. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/_llm_msg_adapter.py +140 -0
  292. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/_messages.py +129 -0
  293. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/_model.py +168 -0
  294. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/_prompt.py +102 -0
  295. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/_service.py +151 -0
  296. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/_session.py +1543 -0
  297. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/_state.py +15 -0
  298. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/_workspace.py +54 -0
  299. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/plugin.py +43 -0
  300. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/tools/__init__.py +6 -0
  301. cube_agent_harness-0.1.0/cube/plugins/sessions/chat/tools/send_message.py +309 -0
  302. cube_agent_harness-0.1.0/cube/plugins/sessions/task/README.md +35 -0
  303. cube_agent_harness-0.1.0/cube/plugins/sessions/task/__init__.py +228 -0
  304. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_agent_text.py +18 -0
  305. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_command_service.py +123 -0
  306. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_compaction.py +56 -0
  307. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_event.py +23 -0
  308. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_executor.py +825 -0
  309. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_llm_msg_adapter.py +255 -0
  310. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_messages.py +130 -0
  311. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_models.py +434 -0
  312. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_notification_topics.py +15 -0
  313. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_notifications.py +97 -0
  314. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_persistence_service.py +48 -0
  315. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_query_service.py +120 -0
  316. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_repositories.py +30 -0
  317. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_state.py +67 -0
  318. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_tables.py +11 -0
  319. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_task_file_space.py +114 -0
  320. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_task_prompt.py +101 -0
  321. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_task_session.py +2182 -0
  322. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_task_workspace.py +56 -0
  323. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_workflow_file_space.py +167 -0
  324. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_workflow_messages.py +68 -0
  325. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_workflow_projection.py +305 -0
  326. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_workflow_prompt.py +98 -0
  327. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_workflow_session.py +824 -0
  328. cube_agent_harness-0.1.0/cube/plugins/sessions/task/_workflow_workspace.py +68 -0
  329. cube_agent_harness-0.1.0/cube/plugins/sessions/task/persistence/__init__.py +17 -0
  330. cube_agent_harness-0.1.0/cube/plugins/sessions/task/persistence/_task_run.py +96 -0
  331. cube_agent_harness-0.1.0/cube/plugins/sessions/task/persistence/_task_run_repository.py +118 -0
  332. cube_agent_harness-0.1.0/cube/plugins/sessions/task/persistence/_task_schedule.py +64 -0
  333. cube_agent_harness-0.1.0/cube/plugins/sessions/task/persistence/_task_schedule_repository.py +73 -0
  334. cube_agent_harness-0.1.0/cube/plugins/sessions/task/plugin.py +77 -0
  335. cube_agent_harness-0.1.0/cube/plugins/sessions/task/tools/__init__.py +48 -0
  336. cube_agent_harness-0.1.0/cube/plugins/sessions/task/tools/task_cancel.py +143 -0
  337. cube_agent_harness-0.1.0/cube/plugins/sessions/task/tools/task_create.py +226 -0
  338. cube_agent_harness-0.1.0/cube/plugins/sessions/task/tools/task_list.py +94 -0
  339. cube_agent_harness-0.1.0/cube/plugins/sessions/task/tools/task_start.py +139 -0
  340. cube_agent_harness-0.1.0/cube/plugins/sessions/task/tools/task_status.py +84 -0
  341. cube_agent_harness-0.1.0/cube/plugins/sessions/task/tools/workflow_run.py +406 -0
  342. cube_agent_harness-0.1.0/cube/plugins/subagent/__init__.py +44 -0
  343. cube_agent_harness-0.1.0/cube/plugins/subagent/_assembly.py +121 -0
  344. cube_agent_harness-0.1.0/cube/plugins/subagent/_compaction.py +34 -0
  345. cube_agent_harness-0.1.0/cube/plugins/subagent/_definition.py +140 -0
  346. cube_agent_harness-0.1.0/cube/plugins/subagent/_definition_service.py +94 -0
  347. cube_agent_harness-0.1.0/cube/plugins/subagent/_file_space.py +106 -0
  348. cube_agent_harness-0.1.0/cube/plugins/subagent/_models.py +41 -0
  349. cube_agent_harness-0.1.0/cube/plugins/subagent/_prompt.py +70 -0
  350. cube_agent_harness-0.1.0/cube/plugins/subagent/_provider.py +40 -0
  351. cube_agent_harness-0.1.0/cube/plugins/subagent/_session.py +419 -0
  352. cube_agent_harness-0.1.0/cube/plugins/subagent/_subagent.py +96 -0
  353. cube_agent_harness-0.1.0/cube/plugins/subagent/_workspace.py +52 -0
  354. cube_agent_harness-0.1.0/cube/plugins/subagent/plugin.py +48 -0
  355. cube_agent_harness-0.1.0/cube/plugins/subagent/tools/__init__.py +8 -0
  356. cube_agent_harness-0.1.0/cube/plugins/subagent/tools/subagent.py +138 -0
  357. cube_agent_harness-0.1.0/cube/plugins/tools/README.md +178 -0
  358. cube_agent_harness-0.1.0/cube/plugins/tools/__init__.py +100 -0
  359. cube_agent_harness-0.1.0/cube/plugins/tools/_media_reader.py +293 -0
  360. cube_agent_harness-0.1.0/cube/plugins/tools/_text_reader.py +569 -0
  361. cube_agent_harness-0.1.0/cube/plugins/tools/ask_user.py +243 -0
  362. cube_agent_harness-0.1.0/cube/plugins/tools/background_tool_cancel.py +84 -0
  363. cube_agent_harness-0.1.0/cube/plugins/tools/background_tool_status.py +91 -0
  364. cube_agent_harness-0.1.0/cube/plugins/tools/bash.py +357 -0
  365. cube_agent_harness-0.1.0/cube/plugins/tools/edit.py +282 -0
  366. cube_agent_harness-0.1.0/cube/plugins/tools/glob.py +140 -0
  367. cube_agent_harness-0.1.0/cube/plugins/tools/grep.py +591 -0
  368. cube_agent_harness-0.1.0/cube/plugins/tools/plugin.py +53 -0
  369. cube_agent_harness-0.1.0/cube/plugins/tools/read.py +530 -0
  370. cube_agent_harness-0.1.0/cube/plugins/tools/skill.py +125 -0
  371. cube_agent_harness-0.1.0/cube/plugins/tools/write.py +196 -0
  372. cube_agent_harness-0.1.0/cube/py.typed +1 -0
  373. cube_agent_harness-0.1.0/pyproject.toml +117 -0
@@ -0,0 +1,41 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+
5
+ .venv/
6
+ venv/
7
+ env/
8
+
9
+ .pytest_cache/
10
+ .mypy_cache/
11
+ .ruff_cache/
12
+ *.tsbuildinfo
13
+ .coverage
14
+ htmlcov/
15
+
16
+ build/
17
+ dist/
18
+ *.egg-info/
19
+
20
+ .idea/
21
+ .vscode/
22
+ .DS_Store
23
+
24
+ .claude/
25
+ cube-dev/
26
+ cube-root/
27
+ test-results/
28
+ apps/playground/test-results/
29
+ .env
30
+ .env.*
31
+ !.env.template
32
+
33
+ apps/playground/node_modules/
34
+ apps/playground/.next/
35
+ apps/playground/out/
36
+ apps/playground/.env.local
37
+ .worktrees/
38
+ .superpowers/
39
+ .tmp/
40
+ deploy/local/sandbox-tools/node_modules/
41
+ /apps/playground/docs/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 psh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,331 @@
1
+ Metadata-Version: 2.4
2
+ Name: cube-agent-harness
3
+ Version: 0.1.0
4
+ Summary: Open-source Python SDK for embeddable, plugin-extensible agents
5
+ Project-URL: Homepage, https://github.com/mindshake-ai/cube
6
+ Author: psh
7
+ License: MIT License
8
+
9
+ Copyright (c) 2026 psh
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+ License-File: LICENSE
29
+ Keywords: agents,llm,plugins,sdk,tools
30
+ Classifier: Development Status :: 3 - Alpha
31
+ Classifier: Intended Audience :: Developers
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Operating System :: OS Independent
34
+ Classifier: Programming Language :: Python :: 3
35
+ Classifier: Programming Language :: Python :: 3.12
36
+ Classifier: Programming Language :: Python :: 3.13
37
+ Classifier: Typing :: Typed
38
+ Requires-Python: <3.14,>=3.12
39
+ Requires-Dist: jsonref>=1.1.0
40
+ Requires-Dist: packaging>=24.0
41
+ Requires-Dist: pydantic>=2.12.0
42
+ Provides-Extra: all
43
+ Requires-Dist: aiosqlite<1.0,>=0.21; extra == 'all'
44
+ Requires-Dist: asyncmy<1.0,>=0.2.10; extra == 'all'
45
+ Requires-Dist: litellm>=1.80.0; extra == 'all'
46
+ Requires-Dist: mcp>=1.27.1; extra == 'all'
47
+ Requires-Dist: pymupdf<2,>=1.26.0; extra == 'all'
48
+ Requires-Dist: pyyaml>=6.0.0; extra == 'all'
49
+ Requires-Dist: redis<7.0,>=5.0; extra == 'all'
50
+ Requires-Dist: sqlalchemy[asyncio]<2.2,>=2.0.39; extra == 'all'
51
+ Requires-Dist: sqlmodel>=0.0.38; extra == 'all'
52
+ Provides-Extra: cluster
53
+ Requires-Dist: aiosqlite<1.0,>=0.21; extra == 'cluster'
54
+ Requires-Dist: asyncmy<1.0,>=0.2.10; extra == 'cluster'
55
+ Requires-Dist: pyyaml>=6.0.0; extra == 'cluster'
56
+ Requires-Dist: redis<7.0,>=5.0; extra == 'cluster'
57
+ Requires-Dist: sqlalchemy[asyncio]<2.2,>=2.0.39; extra == 'cluster'
58
+ Requires-Dist: sqlmodel>=0.0.38; extra == 'cluster'
59
+ Provides-Extra: llm
60
+ Requires-Dist: litellm>=1.80.0; extra == 'llm'
61
+ Provides-Extra: mcp
62
+ Requires-Dist: mcp>=1.27.1; extra == 'mcp'
63
+ Provides-Extra: media
64
+ Requires-Dist: pymupdf<2,>=1.26.0; extra == 'media'
65
+ Provides-Extra: platform
66
+ Requires-Dist: aiosqlite<1.0,>=0.21; extra == 'platform'
67
+ Requires-Dist: pyyaml>=6.0.0; extra == 'platform'
68
+ Requires-Dist: sqlalchemy[asyncio]<2.2,>=2.0.39; extra == 'platform'
69
+ Requires-Dist: sqlmodel>=0.0.38; extra == 'platform'
70
+ Description-Content-Type: text/markdown
71
+
72
+ # Cube
73
+
74
+ Cube is an open-source Python agent harness for building embeddable,
75
+ tool-using, plugin-extensible agents. It provides a lightweight runtime kernel,
76
+ an optional local-first application host for durable sessions and workspaces,
77
+ and an optional distributed runtime layer for backend/worker deployments.
78
+
79
+ ## Public Surfaces
80
+
81
+ - `cube.core`: platform-free harness kernel for agent runs, messages, tools,
82
+ hooks, LLM clients, MCP adapters, events, cancellation, and runtime state.
83
+ - `cube.platform`: Cube's local-first application platform, including the plugin
84
+ SPI/host, agency member projections, channel, durable session, workspace,
85
+ database, and runtime contracts.
86
+ - `cube.cluster`: distributed runtime coordination for backend/worker
87
+ deployments using MySQL, Redis, and a shared POSIX workspace.
88
+ - `cube.plugins`: official concrete capability plugins for tools, hooks,
89
+ channel types, chat, task/workflow, and sub-agents.
90
+ - `apps/cli`: independent official command-line application, distributed as
91
+ `cube-cli` and installed with the `cube` command.
92
+ - `apps/playground`: official full-stack reference application, split into an
93
+ independent FastAPI backend and a Next.js frontend. Neither is part of the
94
+ `cube` wheel.
95
+
96
+ Most developers should extend Cube through plugins. Advanced users can embed
97
+ `cube.platform.CubeLocalApp` for the batteries-included local host, or use
98
+ `cube.core` directly when they only need the harness kernel.
99
+
100
+ ## Install And Run
101
+
102
+ ```bash
103
+ pip install cube-cli
104
+ cube --help
105
+ cube --root-dir ./cube-data init
106
+ cube --root-dir ./cube-data db init
107
+ cube --root-dir ./cube-data user use alice --name "Alice"
108
+ ```
109
+
110
+ The base install is intentionally lightweight:
111
+
112
+ ```bash
113
+ pip install cube-agent-harness
114
+ ```
115
+
116
+ It provides `cube.core` plus lightweight plugin model contracts under
117
+ `cube.platform.plugin`. Install optional
118
+ adapters only when you need them:
119
+
120
+ ```bash
121
+ pip install cube-agent-harness[llm] # LiteLLM clients, router, model catalog
122
+ pip install cube-agent-harness[mcp] # MCP transport clients
123
+ pip install cube-agent-harness[platform] # local-first platform and SQLite
124
+ pip install cube-agent-harness[cluster] # distributed runtime with MySQL/Redis
125
+ pip install cube-agent-harness[all] # every built-in SDK capability extra
126
+ ```
127
+
128
+ The default local database path is:
129
+
130
+ ```text
131
+ <root_dir>/cube.sqlite3
132
+ ```
133
+
134
+ ## Layout
135
+
136
+ ```text
137
+ cube/
138
+ ├── core/ # framework kernel; must not import platform/plugins
139
+ │ ├── runtime/ # AgentRuntime, agent loop, run context, events
140
+ │ ├── tool/ # Tool protocol, ToolRuntime, ToolTask lifecycle
141
+ │ ├── hook/ # hook types, dispatcher, reducers, HookRegistry
142
+ │ ├── llm/ # LLM client contracts and LiteLLM adapters
143
+ │ ├── mcp/ # MCP adapter/client support
144
+ │ └── common/ # ids, time helpers, EventBus, CancellationToken
145
+ ├── platform/
146
+ │ ├── host/ # CubeLocalApp, PlatformServices, PlatformRuntime, health
147
+ │ ├── assembly/ # manifest-driven plugin/table runtime assembly
148
+ │ ├── command/ # transport-neutral session command contracts
149
+ │ ├── event/ # live session event stream contracts
150
+ │ ├── agency/ # tenant container and member projections
151
+ │ ├── channel/ # project/room container and session definitions
152
+ │ ├── session/ # durable transcript/session container
153
+ │ ├── notification/ # central durable human inbox
154
+ │ ├── agent/ # default Agent worker implementation
155
+ │ ├── plugin/ # plugin SPI, discovery, resolver, assembly, registry
156
+ │ ├── workspace/ # local file workspace layout
157
+ │ └── database/ # SQLModel/SQLite platform persistence
158
+ ├── cluster/ # distributed Gateway/Worker runtime coordination
159
+ └── plugins/
160
+ ├── tools/ # official filesystem/chat/background tools
161
+ ├── hooks/ # official concrete hooks
162
+ ├── channels/
163
+ │ ├── chat/ # dm and group_chat channel types
164
+ │ └── project/ # project channel type and project query service
165
+ ├── sessions/
166
+ │ ├── chat/ # chat session capability
167
+ │ └── task/ # multi-phase task and workflow capability
168
+ └── subagent/ # complete sub-agent capability and tool-owned session
169
+
170
+ apps/
171
+ ├── cli/ # official cube-cli terminal application
172
+ └── playground/ # official full-stack reference app
173
+ ├── backend/ # project-owned FastAPI/auth/realtime composition
174
+ └── frontend/ # Next.js playground UI
175
+ ```
176
+
177
+ ## Architecture
178
+
179
+ `cube.core` is the agent harness kernel. It has no database, session, channel,
180
+ web framework, CLI, agency, user, plugin loading, or provider-SDK dependency.
181
+ Importing `cube`, `cube.core`, `cube.core.llm`, or
182
+ `cube.platform.plugin.PluginSpec` does
183
+ not load optional adapters such as LiteLLM, FastAPI, SQLModel, MCP, or Typer.
184
+
185
+ `cube.platform` assembles the harness into a durable local application. It does
186
+ not own a global account table, credentials, passwords, or authentication.
187
+ Human identity inside Cube is an agency-scoped member projection stored with
188
+ the agency; embedding applications own accounts and map authenticated users to
189
+ those projections.
190
+ Long-lived, human-editable configuration lives in file workspaces under
191
+ `<root_dir>/`. Runtime transcript, run state, task state, background tool
192
+ state, metrics, and small app records live in SQLite.
193
+
194
+ `cube.platform.plugin` owns the plugin SPI, discovery, selection, dependency
195
+ resolution, transactional registration, and frozen capability registry.
196
+ `cube.plugins` contains Cube's official implementations. Official and user
197
+ plugins use the same `PluginSpec` model and `cube.plugins` entry-point group to
198
+ contribute tools, hooks, hook events, session kinds, channel types, and the
199
+ SubAgent provider. Runtime table registration remains a separate
200
+ `tables.toml` / `TableSpec` path.
201
+ Session-specific message and event types are declared by the session class.
202
+
203
+ Loading and runtime ownership follow parallel boundaries:
204
+
205
+ ```text
206
+ PluginSpec -> PluginManager -> PluginRegistry
207
+ TableSpec -> TableManager -> TableRegistry
208
+ ```
209
+
210
+ The plugin and table managers load declarations independently.
211
+ `RuntimeAssembly` validates and freezes both registries, `PlatformServices`
212
+ owns that immutable assembly, and `PlatformRuntime` consumes the durable
213
+ service root rather than loading capabilities itself.
214
+
215
+ `apps/cli` and project backends such as `apps/playground/backend` are
216
+ application-owned compositions. They use public `cube.platform` composition
217
+ helpers, while each application owns the default
218
+ `plugins.toml` and `tables.toml` it writes.
219
+
220
+ `cube.cluster` is the optional distributed runtime layer. Backend applications
221
+ compose `PlatformServices` with `ClusterGateway` for command dispatch and live
222
+ event subscription; worker processes run `ClusterWorker`, which owns
223
+ `PlatformRuntime` and executes sessions. Distributed mode uses MySQL for Cube
224
+ durable data, Redis for coordination, and a shared POSIX `root_dir` such as
225
+ NAS. It does not provide a `CubeApp` facade or a local fallback.
226
+
227
+ ## Plugin Development
228
+
229
+ External plugins expose a `PluginSpec` through the `cube.plugins` entry point
230
+ group:
231
+
232
+ ```python
233
+ from cube.platform.plugin import PluginSpec
234
+
235
+
236
+ def register(ctx):
237
+ ctx.tools("finance_controls", my_tool)
238
+
239
+
240
+ plugin = PluginSpec(
241
+ name="my.company.finance",
242
+ version="0.1.0",
243
+ requires_tables=("my.company.finance",),
244
+ register=register,
245
+ )
246
+ ```
247
+
248
+ ```toml
249
+ [project.entry-points."cube.plugins"]
250
+ "my.company.finance" = "my_company_finance.plugin:plugin"
251
+ ```
252
+
253
+ Plugins with persistence export an independent `TableSpec` and list its logical
254
+ name in `requires_tables`. The host must still enable the table module in
255
+ `tables.toml`; runtime composition reports a missing requirement before database
256
+ initialization and never auto-loads plugin tables.
257
+
258
+ Plugin and table loading is manifest-driven. Run the owning host's initializer
259
+ (`cube init` for the CLI or `playground-backend init` for the Playground), or
260
+ write `plugins.toml` / `tables.toml` explicitly before composing the runtime.
261
+
262
+ `SessionContribution.required_tools` and `required_hooks` are session kind
263
+ invariants. They describe capabilities the kind needs to run and are separate
264
+ from `[assembly].default_tools`, which are optional agent tools filtered by
265
+ agent tool-use policy. Default and required hook groups remain distinct during
266
+ capability-name assembly, then runtime materialization combines their handlers
267
+ into one prepared `HookRuntime`; sessions and agents consume that runtime rather
268
+ than assembling hook extension registries themselves.
269
+
270
+ `cube.core` exposes a small stable convenience API. Import provider-specific
271
+ clients and lower-level runtime events from their package-local modules, for
272
+ example `cube.core.llm.LiteLLMClient` or `cube.core.runtime.AgentStartEvent`.
273
+
274
+ ## Development
275
+
276
+ For the fastest full-stack distributed Playground loop on macOS, install `uv`
277
+ and Node.js 20.11 or newer, place the supplied deployment environment at the
278
+ repository-root `.env`, then run:
279
+
280
+ ```bash
281
+ make doctor
282
+ make local-start
283
+ make local-status
284
+ make local-logs
285
+ # Open http://localhost:3000
286
+ make local-restart
287
+ make local-shutdown
288
+ ```
289
+
290
+ `local-start` runs separate ClusterWorker and distributed Playground backend
291
+ processes plus the Next.js development server. It installs the pinned local SRT
292
+ and ripgrep packages inside the repository, preserves existing runtime
293
+ manifests, initializes/validates the MySQL schema, and waits for worker and HTTP
294
+ readiness. Use `ENV_FILE=config/alice.env` for a non-default environment file.
295
+ See [`deploy/README.md`](deploy/README.md) for prerequisites, per-developer
296
+ cluster isolation, troubleshooting, Docker image validation, and Make variable
297
+ overrides.
298
+
299
+ Package and test development commands:
300
+
301
+ ```bash
302
+ uv sync --all-packages --all-extras --dev
303
+ uv run --all-extras pytest tests -q
304
+ uv run --package cube-cli pytest apps/cli/tests -q
305
+ uv run --package cube-playground-backend pytest apps/playground/backend/tests -q
306
+ uv run --all-extras python -m compileall cube tests
307
+ uv run --package cube-cli cube --help
308
+ uv build --package cube
309
+ uv build --package cube-cli
310
+ npm --prefix apps/playground/frontend run typecheck
311
+ npm --prefix apps/playground/frontend run build
312
+ ```
313
+
314
+ Core boundary check:
315
+
316
+ ```bash
317
+ rg -n "^\s*(from|import) cube\.(platform|plugins)" cube/core --glob '*.py'
318
+ ```
319
+
320
+ See also:
321
+
322
+ - `docs/README.md`
323
+ - `docs/api-stability.md`
324
+ - `docs/embedding.md`
325
+ - `docs/cluster-runtime.md`
326
+ - `cube/core/README.md`
327
+ - `cube/platform/README.md`
328
+ - `cube/plugins/README.md`
329
+ - `apps/cli/README.md`
330
+ - `apps/playground/README.md`
331
+ - `deploy/README.md`
@@ -0,0 +1,260 @@
1
+ # Cube
2
+
3
+ Cube is an open-source Python agent harness for building embeddable,
4
+ tool-using, plugin-extensible agents. It provides a lightweight runtime kernel,
5
+ an optional local-first application host for durable sessions and workspaces,
6
+ and an optional distributed runtime layer for backend/worker deployments.
7
+
8
+ ## Public Surfaces
9
+
10
+ - `cube.core`: platform-free harness kernel for agent runs, messages, tools,
11
+ hooks, LLM clients, MCP adapters, events, cancellation, and runtime state.
12
+ - `cube.platform`: Cube's local-first application platform, including the plugin
13
+ SPI/host, agency member projections, channel, durable session, workspace,
14
+ database, and runtime contracts.
15
+ - `cube.cluster`: distributed runtime coordination for backend/worker
16
+ deployments using MySQL, Redis, and a shared POSIX workspace.
17
+ - `cube.plugins`: official concrete capability plugins for tools, hooks,
18
+ channel types, chat, task/workflow, and sub-agents.
19
+ - `apps/cli`: independent official command-line application, distributed as
20
+ `cube-cli` and installed with the `cube` command.
21
+ - `apps/playground`: official full-stack reference application, split into an
22
+ independent FastAPI backend and a Next.js frontend. Neither is part of the
23
+ `cube` wheel.
24
+
25
+ Most developers should extend Cube through plugins. Advanced users can embed
26
+ `cube.platform.CubeLocalApp` for the batteries-included local host, or use
27
+ `cube.core` directly when they only need the harness kernel.
28
+
29
+ ## Install And Run
30
+
31
+ ```bash
32
+ pip install cube-cli
33
+ cube --help
34
+ cube --root-dir ./cube-data init
35
+ cube --root-dir ./cube-data db init
36
+ cube --root-dir ./cube-data user use alice --name "Alice"
37
+ ```
38
+
39
+ The base install is intentionally lightweight:
40
+
41
+ ```bash
42
+ pip install cube-agent-harness
43
+ ```
44
+
45
+ It provides `cube.core` plus lightweight plugin model contracts under
46
+ `cube.platform.plugin`. Install optional
47
+ adapters only when you need them:
48
+
49
+ ```bash
50
+ pip install cube-agent-harness[llm] # LiteLLM clients, router, model catalog
51
+ pip install cube-agent-harness[mcp] # MCP transport clients
52
+ pip install cube-agent-harness[platform] # local-first platform and SQLite
53
+ pip install cube-agent-harness[cluster] # distributed runtime with MySQL/Redis
54
+ pip install cube-agent-harness[all] # every built-in SDK capability extra
55
+ ```
56
+
57
+ The default local database path is:
58
+
59
+ ```text
60
+ <root_dir>/cube.sqlite3
61
+ ```
62
+
63
+ ## Layout
64
+
65
+ ```text
66
+ cube/
67
+ ├── core/ # framework kernel; must not import platform/plugins
68
+ │ ├── runtime/ # AgentRuntime, agent loop, run context, events
69
+ │ ├── tool/ # Tool protocol, ToolRuntime, ToolTask lifecycle
70
+ │ ├── hook/ # hook types, dispatcher, reducers, HookRegistry
71
+ │ ├── llm/ # LLM client contracts and LiteLLM adapters
72
+ │ ├── mcp/ # MCP adapter/client support
73
+ │ └── common/ # ids, time helpers, EventBus, CancellationToken
74
+ ├── platform/
75
+ │ ├── host/ # CubeLocalApp, PlatformServices, PlatformRuntime, health
76
+ │ ├── assembly/ # manifest-driven plugin/table runtime assembly
77
+ │ ├── command/ # transport-neutral session command contracts
78
+ │ ├── event/ # live session event stream contracts
79
+ │ ├── agency/ # tenant container and member projections
80
+ │ ├── channel/ # project/room container and session definitions
81
+ │ ├── session/ # durable transcript/session container
82
+ │ ├── notification/ # central durable human inbox
83
+ │ ├── agent/ # default Agent worker implementation
84
+ │ ├── plugin/ # plugin SPI, discovery, resolver, assembly, registry
85
+ │ ├── workspace/ # local file workspace layout
86
+ │ └── database/ # SQLModel/SQLite platform persistence
87
+ ├── cluster/ # distributed Gateway/Worker runtime coordination
88
+ └── plugins/
89
+ ├── tools/ # official filesystem/chat/background tools
90
+ ├── hooks/ # official concrete hooks
91
+ ├── channels/
92
+ │ ├── chat/ # dm and group_chat channel types
93
+ │ └── project/ # project channel type and project query service
94
+ ├── sessions/
95
+ │ ├── chat/ # chat session capability
96
+ │ └── task/ # multi-phase task and workflow capability
97
+ └── subagent/ # complete sub-agent capability and tool-owned session
98
+
99
+ apps/
100
+ ├── cli/ # official cube-cli terminal application
101
+ └── playground/ # official full-stack reference app
102
+ ├── backend/ # project-owned FastAPI/auth/realtime composition
103
+ └── frontend/ # Next.js playground UI
104
+ ```
105
+
106
+ ## Architecture
107
+
108
+ `cube.core` is the agent harness kernel. It has no database, session, channel,
109
+ web framework, CLI, agency, user, plugin loading, or provider-SDK dependency.
110
+ Importing `cube`, `cube.core`, `cube.core.llm`, or
111
+ `cube.platform.plugin.PluginSpec` does
112
+ not load optional adapters such as LiteLLM, FastAPI, SQLModel, MCP, or Typer.
113
+
114
+ `cube.platform` assembles the harness into a durable local application. It does
115
+ not own a global account table, credentials, passwords, or authentication.
116
+ Human identity inside Cube is an agency-scoped member projection stored with
117
+ the agency; embedding applications own accounts and map authenticated users to
118
+ those projections.
119
+ Long-lived, human-editable configuration lives in file workspaces under
120
+ `<root_dir>/`. Runtime transcript, run state, task state, background tool
121
+ state, metrics, and small app records live in SQLite.
122
+
123
+ `cube.platform.plugin` owns the plugin SPI, discovery, selection, dependency
124
+ resolution, transactional registration, and frozen capability registry.
125
+ `cube.plugins` contains Cube's official implementations. Official and user
126
+ plugins use the same `PluginSpec` model and `cube.plugins` entry-point group to
127
+ contribute tools, hooks, hook events, session kinds, channel types, and the
128
+ SubAgent provider. Runtime table registration remains a separate
129
+ `tables.toml` / `TableSpec` path.
130
+ Session-specific message and event types are declared by the session class.
131
+
132
+ Loading and runtime ownership follow parallel boundaries:
133
+
134
+ ```text
135
+ PluginSpec -> PluginManager -> PluginRegistry
136
+ TableSpec -> TableManager -> TableRegistry
137
+ ```
138
+
139
+ The plugin and table managers load declarations independently.
140
+ `RuntimeAssembly` validates and freezes both registries, `PlatformServices`
141
+ owns that immutable assembly, and `PlatformRuntime` consumes the durable
142
+ service root rather than loading capabilities itself.
143
+
144
+ `apps/cli` and project backends such as `apps/playground/backend` are
145
+ application-owned compositions. They use public `cube.platform` composition
146
+ helpers, while each application owns the default
147
+ `plugins.toml` and `tables.toml` it writes.
148
+
149
+ `cube.cluster` is the optional distributed runtime layer. Backend applications
150
+ compose `PlatformServices` with `ClusterGateway` for command dispatch and live
151
+ event subscription; worker processes run `ClusterWorker`, which owns
152
+ `PlatformRuntime` and executes sessions. Distributed mode uses MySQL for Cube
153
+ durable data, Redis for coordination, and a shared POSIX `root_dir` such as
154
+ NAS. It does not provide a `CubeApp` facade or a local fallback.
155
+
156
+ ## Plugin Development
157
+
158
+ External plugins expose a `PluginSpec` through the `cube.plugins` entry point
159
+ group:
160
+
161
+ ```python
162
+ from cube.platform.plugin import PluginSpec
163
+
164
+
165
+ def register(ctx):
166
+ ctx.tools("finance_controls", my_tool)
167
+
168
+
169
+ plugin = PluginSpec(
170
+ name="my.company.finance",
171
+ version="0.1.0",
172
+ requires_tables=("my.company.finance",),
173
+ register=register,
174
+ )
175
+ ```
176
+
177
+ ```toml
178
+ [project.entry-points."cube.plugins"]
179
+ "my.company.finance" = "my_company_finance.plugin:plugin"
180
+ ```
181
+
182
+ Plugins with persistence export an independent `TableSpec` and list its logical
183
+ name in `requires_tables`. The host must still enable the table module in
184
+ `tables.toml`; runtime composition reports a missing requirement before database
185
+ initialization and never auto-loads plugin tables.
186
+
187
+ Plugin and table loading is manifest-driven. Run the owning host's initializer
188
+ (`cube init` for the CLI or `playground-backend init` for the Playground), or
189
+ write `plugins.toml` / `tables.toml` explicitly before composing the runtime.
190
+
191
+ `SessionContribution.required_tools` and `required_hooks` are session kind
192
+ invariants. They describe capabilities the kind needs to run and are separate
193
+ from `[assembly].default_tools`, which are optional agent tools filtered by
194
+ agent tool-use policy. Default and required hook groups remain distinct during
195
+ capability-name assembly, then runtime materialization combines their handlers
196
+ into one prepared `HookRuntime`; sessions and agents consume that runtime rather
197
+ than assembling hook extension registries themselves.
198
+
199
+ `cube.core` exposes a small stable convenience API. Import provider-specific
200
+ clients and lower-level runtime events from their package-local modules, for
201
+ example `cube.core.llm.LiteLLMClient` or `cube.core.runtime.AgentStartEvent`.
202
+
203
+ ## Development
204
+
205
+ For the fastest full-stack distributed Playground loop on macOS, install `uv`
206
+ and Node.js 20.11 or newer, place the supplied deployment environment at the
207
+ repository-root `.env`, then run:
208
+
209
+ ```bash
210
+ make doctor
211
+ make local-start
212
+ make local-status
213
+ make local-logs
214
+ # Open http://localhost:3000
215
+ make local-restart
216
+ make local-shutdown
217
+ ```
218
+
219
+ `local-start` runs separate ClusterWorker and distributed Playground backend
220
+ processes plus the Next.js development server. It installs the pinned local SRT
221
+ and ripgrep packages inside the repository, preserves existing runtime
222
+ manifests, initializes/validates the MySQL schema, and waits for worker and HTTP
223
+ readiness. Use `ENV_FILE=config/alice.env` for a non-default environment file.
224
+ See [`deploy/README.md`](deploy/README.md) for prerequisites, per-developer
225
+ cluster isolation, troubleshooting, Docker image validation, and Make variable
226
+ overrides.
227
+
228
+ Package and test development commands:
229
+
230
+ ```bash
231
+ uv sync --all-packages --all-extras --dev
232
+ uv run --all-extras pytest tests -q
233
+ uv run --package cube-cli pytest apps/cli/tests -q
234
+ uv run --package cube-playground-backend pytest apps/playground/backend/tests -q
235
+ uv run --all-extras python -m compileall cube tests
236
+ uv run --package cube-cli cube --help
237
+ uv build --package cube
238
+ uv build --package cube-cli
239
+ npm --prefix apps/playground/frontend run typecheck
240
+ npm --prefix apps/playground/frontend run build
241
+ ```
242
+
243
+ Core boundary check:
244
+
245
+ ```bash
246
+ rg -n "^\s*(from|import) cube\.(platform|plugins)" cube/core --glob '*.py'
247
+ ```
248
+
249
+ See also:
250
+
251
+ - `docs/README.md`
252
+ - `docs/api-stability.md`
253
+ - `docs/embedding.md`
254
+ - `docs/cluster-runtime.md`
255
+ - `cube/core/README.md`
256
+ - `cube/platform/README.md`
257
+ - `cube/plugins/README.md`
258
+ - `apps/cli/README.md`
259
+ - `apps/playground/README.md`
260
+ - `deploy/README.md`