mindroot 9.22.0__py3-none-any.whl → 10.14.0__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 (331) hide show
  1. mindroot/coreplugins/admin/static/js/agent-form.js +26 -1
  2. mindroot/coreplugins/admin/static/js/persona-editor.js +14 -1
  3. mindroot/coreplugins/agent/agent.py +59 -18
  4. mindroot/coreplugins/agent/agent.py.bak +507 -0
  5. mindroot/coreplugins/agent/buagentz1.py +540 -0
  6. mindroot/coreplugins/agent/speech_to_speech.py +77 -0
  7. mindroot/coreplugins/agent/speech_to_speech.py.backup +46 -0
  8. mindroot/coreplugins/chat/buservices.py +625 -0
  9. mindroot/coreplugins/chat/buwidget_routes.py +287 -0
  10. mindroot/coreplugins/chat/commands.py +4 -0
  11. mindroot/coreplugins/chat/services.py +178 -8
  12. mindroot/coreplugins/chat/static/css/dark.css +90 -1
  13. mindroot/coreplugins/chat/static/css/default.css +90 -1
  14. mindroot/coreplugins/chat/static/css/light.css +724 -0
  15. mindroot/coreplugins/chat/static/css/mobile.css +37 -0
  16. mindroot/coreplugins/chat/static/js/chat.js +150 -89
  17. mindroot/coreplugins/chat/static/js/chatform.js +1 -1
  18. mindroot/coreplugins/chat/static/js/throttle.js +4 -2
  19. mindroot/coreplugins/chat/templates/chat.jinja2 +9 -1
  20. mindroot/coreplugins/chat/widget_routes.py +54 -10
  21. mindroot/coreplugins/check_list/helpers.py +221 -0
  22. mindroot/coreplugins/check_list/mod.py +435 -126
  23. mindroot/coreplugins/check_list/mod.py.backup +378 -0
  24. mindroot/coreplugins/check_list/mod.py.backup2 +506 -0
  25. mindroot/coreplugins/check_list/mod.py.backup3 +506 -0
  26. mindroot/coreplugins/check_list/mod_create_checklist_lol.py +756 -0
  27. mindroot/coreplugins/check_list/plugin_info.json +15 -0
  28. mindroot/coreplugins/jwt_auth/middleware.py +1 -1
  29. mindroot/docs/.env +1 -0
  30. mindroot/docs/.gitignore +1 -0
  31. mindroot/docs/_build/doctrees/chat_with_assistant.doctree +0 -0
  32. mindroot/docs/_build/doctrees/developer_documentation.doctree +0 -0
  33. mindroot/docs/_build/doctrees/embed_chat.doctree +0 -0
  34. mindroot/docs/_build/doctrees/environment.pickle +0 -0
  35. mindroot/docs/_build/doctrees/getting_started.doctree +0 -0
  36. mindroot/docs/_build/doctrees/index.doctree +0 -0
  37. mindroot/docs/_build/doctrees/install_plugins_with_tools.doctree +0 -0
  38. mindroot/docs/_build/doctrees/installation.doctree +0 -0
  39. mindroot/docs/_build/doctrees/llm_api_key.doctree +0 -0
  40. mindroot/docs/_build/doctrees/llm_plugin_installation.doctree +0 -0
  41. mindroot/docs/_build/doctrees/programming_task.doctree +0 -0
  42. mindroot/docs/_build/doctrees/source/ahp.doctree +0 -0
  43. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.admin.doctree +0 -0
  44. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.api_keys.doctree +0 -0
  45. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.chat.doctree +0 -0
  46. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.chat_avatar.doctree +0 -0
  47. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.check_list.doctree +0 -0
  48. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.credits.doctree +0 -0
  49. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.doctree +0 -0
  50. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.email.doctree +0 -0
  51. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.env_manager.doctree +0 -0
  52. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.events.doctree +0 -0
  53. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.index.doctree +0 -0
  54. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.index.handlers.doctree +0 -0
  55. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.jwt_auth.doctree +0 -0
  56. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.l8n.doctree +0 -0
  57. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.mcp_.doctree +0 -0
  58. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.persona.doctree +0 -0
  59. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.startup.doctree +0 -0
  60. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.subscriptions.doctree +0 -0
  61. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.usage.doctree +0 -0
  62. mindroot/docs/_build/doctrees/source/mindroot.coreplugins.user_service.doctree +0 -0
  63. mindroot/docs/_build/doctrees/source/mindroot.doctree +0 -0
  64. mindroot/docs/_build/doctrees/source/mindroot.lib.auth.doctree +0 -0
  65. mindroot/docs/_build/doctrees/source/mindroot.lib.doctree +0 -0
  66. mindroot/docs/_build/doctrees/source/mindroot.lib.json_str_block.doctree +0 -0
  67. mindroot/docs/_build/doctrees/source/mindroot.lib.plugins.doctree +0 -0
  68. mindroot/docs/_build/doctrees/source/mindroot.lib.providers.backup.doctree +0 -0
  69. mindroot/docs/_build/doctrees/source/mindroot.lib.providers.doctree +0 -0
  70. mindroot/docs/_build/doctrees/source/mindroot.registry.doctree +0 -0
  71. mindroot/docs/_build/doctrees/source/modules.doctree +0 -0
  72. mindroot/docs/_build/doctrees/source/mr_agent_expert_instr.doctree +0 -0
  73. mindroot/docs/_build/doctrees/starting_mindroot.doctree +0 -0
  74. mindroot/docs/_build/doctrees/user_documentation.doctree +0 -0
  75. mindroot/docs/_build/html/_images/apikey.png +0 -0
  76. mindroot/docs/_build/html/_images/chatwidgetx.png +0 -0
  77. mindroot/docs/_build/html/_images/disablechatavatar.png +0 -0
  78. mindroot/docs/_build/html/_images/widgetform.png +0 -0
  79. mindroot/docs/_build/html/_images/widgetonpage.png +0 -0
  80. mindroot/docs/_build/html/_modules/index.html +1 -0
  81. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/agent_importer.html +282 -86
  82. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/agent_router.html +281 -88
  83. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/asset_manager.html +280 -84
  84. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/command_router.html +281 -88
  85. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/mcp_catalog_routes.html +279 -86
  86. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/mcp_publish_routes.html +284 -91
  87. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/mcp_registry_routes.html +284 -91
  88. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/mcp_routes.html +281 -88
  89. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/mod.html +280 -84
  90. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/oauth_callback_router.html +280 -87
  91. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/persona_handler.html +282 -86
  92. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/persona_router.html +285 -89
  93. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/plugin_manager.html +281 -88
  94. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/plugin_router.html +280 -87
  95. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/plugin_routes.html +280 -87
  96. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/registry_settings_routes.html +280 -87
  97. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/router.html +281 -88
  98. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/server_router.html +280 -84
  99. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/service_models.html +280 -87
  100. mindroot/docs/_build/html/_modules/mindroot/coreplugins/admin/settings_router.html +288 -89
  101. mindroot/docs/_build/html/_modules/mindroot/coreplugins/api_keys/api_key_manager.html +280 -87
  102. mindroot/docs/_build/html/_modules/mindroot/coreplugins/api_keys/mod.html +279 -86
  103. mindroot/docs/_build/html/_modules/mindroot/coreplugins/api_keys/router.html +280 -87
  104. mindroot/docs/_build/html/_modules/mindroot/coreplugins/chat/commands.html +281 -88
  105. mindroot/docs/_build/html/_modules/mindroot/coreplugins/chat/mod.html +279 -86
  106. mindroot/docs/_build/html/_modules/mindroot/coreplugins/chat/models.html +280 -87
  107. mindroot/docs/_build/html/_modules/mindroot/coreplugins/chat/router.html +281 -88
  108. mindroot/docs/_build/html/_modules/mindroot/coreplugins/chat/services.html +283 -90
  109. mindroot/docs/_build/html/_modules/mindroot/coreplugins/chat/widget_manager.html +279 -86
  110. mindroot/docs/_build/html/_modules/mindroot/coreplugins/chat/widget_routes.html +279 -86
  111. mindroot/docs/_build/html/_modules/mindroot/coreplugins/check_list/mod.html +669 -213
  112. mindroot/docs/_build/html/_modules/mindroot/coreplugins/credits/conversion.html +280 -87
  113. mindroot/docs/_build/html/_modules/mindroot/coreplugins/credits/ledger.html +281 -88
  114. mindroot/docs/_build/html/_modules/mindroot/coreplugins/credits/mod.html +281 -88
  115. mindroot/docs/_build/html/_modules/mindroot/coreplugins/credits/models.html +279 -86
  116. mindroot/docs/_build/html/_modules/mindroot/coreplugins/credits/router.html +279 -86
  117. mindroot/docs/_build/html/_modules/mindroot/coreplugins/credits/storage.html +279 -86
  118. mindroot/docs/_build/html/_modules/mindroot/coreplugins/email/email_provider.html +280 -87
  119. mindroot/docs/_build/html/_modules/mindroot/coreplugins/email/imap_handler.html +284 -91
  120. mindroot/docs/_build/html/_modules/mindroot/coreplugins/email/mod.html +280 -87
  121. mindroot/docs/_build/html/_modules/mindroot/coreplugins/email/services.html +280 -87
  122. mindroot/docs/_build/html/_modules/mindroot/coreplugins/email/smtp_handler.html +280 -87
  123. mindroot/docs/_build/html/_modules/mindroot/coreplugins/email/test_email_service.html +280 -87
  124. mindroot/docs/_build/html/_modules/mindroot/coreplugins/env_manager/mod.html +281 -88
  125. mindroot/docs/_build/html/_modules/mindroot/coreplugins/env_manager/router.html +280 -87
  126. mindroot/docs/_build/html/_modules/mindroot/coreplugins/events/router.html +280 -87
  127. mindroot/docs/_build/html/_modules/mindroot/coreplugins/index/handlers/agent_ops.html +280 -87
  128. mindroot/docs/_build/html/_modules/mindroot/coreplugins/index/handlers/index_ops.html +280 -87
  129. mindroot/docs/_build/html/_modules/mindroot/coreplugins/index/handlers/plugin_ops.html +284 -91
  130. mindroot/docs/_build/html/_modules/mindroot/coreplugins/index/handlers/publish.html +281 -88
  131. mindroot/docs/_build/html/_modules/mindroot/coreplugins/index/mod.html +279 -86
  132. mindroot/docs/_build/html/_modules/mindroot/coreplugins/index/models.html +282 -86
  133. mindroot/docs/_build/html/_modules/mindroot/coreplugins/index/router.html +284 -91
  134. mindroot/docs/_build/html/_modules/mindroot/coreplugins/index/utils.html +282 -86
  135. mindroot/docs/_build/html/_modules/mindroot/coreplugins/jwt_auth/middleware.html +282 -89
  136. mindroot/docs/_build/html/_modules/mindroot/coreplugins/jwt_auth/mod.html +279 -86
  137. mindroot/docs/_build/html/_modules/mindroot/coreplugins/jwt_auth/router.html +280 -87
  138. mindroot/docs/_build/html/_modules/mindroot/coreplugins/l8n/language_detection.html +280 -84
  139. mindroot/docs/_build/html/_modules/mindroot/coreplugins/l8n/middleware.html +280 -84
  140. mindroot/docs/_build/html/_modules/mindroot/coreplugins/l8n/mod.html +282 -86
  141. mindroot/docs/_build/html/_modules/mindroot/coreplugins/l8n/test_enhanced.html +280 -84
  142. mindroot/docs/_build/html/_modules/mindroot/coreplugins/l8n/test_l8n_standalone.html +282 -86
  143. mindroot/docs/_build/html/_modules/mindroot/coreplugins/l8n/test_middleware.html +282 -86
  144. mindroot/docs/_build/html/_modules/mindroot/coreplugins/l8n/utils.html +280 -84
  145. mindroot/docs/_build/html/_modules/mindroot/coreplugins/mcp_/catalog_commands.html +282 -86
  146. mindroot/docs/_build/html/_modules/mindroot/coreplugins/mcp_/catalog_manager.html +280 -84
  147. mindroot/docs/_build/html/_modules/mindroot/coreplugins/mcp_/dynamic_commands.html +280 -84
  148. mindroot/docs/_build/html/_modules/mindroot/coreplugins/mcp_/mcp_manager.html +282 -86
  149. mindroot/docs/_build/html/_modules/mindroot/coreplugins/mcp_/mod.html +282 -86
  150. mindroot/docs/_build/html/_modules/mindroot/coreplugins/mcp_/oauth_storage.html +280 -84
  151. mindroot/docs/_build/html/_modules/mindroot/coreplugins/mcp_/server_installer.html +282 -86
  152. mindroot/docs/_build/html/_modules/mindroot/coreplugins/mcp_/testmcpclient.html +285 -89
  153. mindroot/docs/_build/html/_modules/mindroot/coreplugins/persona/init_persona.html +280 -84
  154. mindroot/docs/_build/html/_modules/mindroot/coreplugins/persona/mod.html +282 -86
  155. mindroot/docs/_build/html/_modules/mindroot/coreplugins/startup/mod.html +282 -86
  156. mindroot/docs/_build/html/_modules/mindroot/coreplugins/subscriptions/credit_integration.html +280 -84
  157. mindroot/docs/_build/html/_modules/mindroot/coreplugins/subscriptions/mod.html +282 -86
  158. mindroot/docs/_build/html/_modules/mindroot/coreplugins/subscriptions/models.html +280 -84
  159. mindroot/docs/_build/html/_modules/mindroot/coreplugins/subscriptions/router.html +285 -89
  160. mindroot/docs/_build/html/_modules/mindroot/coreplugins/subscriptions/storage.html +282 -86
  161. mindroot/docs/_build/html/_modules/mindroot/coreplugins/subscriptions/stripe_integration.html +280 -84
  162. mindroot/docs/_build/html/_modules/mindroot/coreplugins/subscriptions/subscription_manager.html +280 -84
  163. mindroot/docs/_build/html/_modules/mindroot/coreplugins/subscriptions/webhook_handler.html +280 -84
  164. mindroot/docs/_build/html/_modules/mindroot/coreplugins/usage/handlers.html +282 -86
  165. mindroot/docs/_build/html/_modules/mindroot/coreplugins/usage/mod.html +282 -86
  166. mindroot/docs/_build/html/_modules/mindroot/coreplugins/usage/models.html +282 -86
  167. mindroot/docs/_build/html/_modules/mindroot/coreplugins/usage/reporting.html +282 -86
  168. mindroot/docs/_build/html/_modules/mindroot/coreplugins/usage/router.html +282 -86
  169. mindroot/docs/_build/html/_modules/mindroot/coreplugins/usage/storage.html +285 -89
  170. mindroot/docs/_build/html/_modules/mindroot/coreplugins/user_service/admin_init.html +282 -86
  171. mindroot/docs/_build/html/_modules/mindroot/coreplugins/user_service/email_service.html +282 -86
  172. mindroot/docs/_build/html/_modules/mindroot/coreplugins/user_service/mod.html +280 -84
  173. mindroot/docs/_build/html/_modules/mindroot/coreplugins/user_service/models.html +282 -86
  174. mindroot/docs/_build/html/_modules/mindroot/coreplugins/user_service/password_reset_service.html +282 -86
  175. mindroot/docs/_build/html/_modules/mindroot/coreplugins/user_service/role_service.html +282 -86
  176. mindroot/docs/_build/html/_modules/mindroot/coreplugins/user_service/router.html +282 -86
  177. mindroot/docs/_build/html/_modules/mindroot/lib/auth/api_key.html +280 -84
  178. mindroot/docs/_build/html/_modules/mindroot/lib/auth/auth.html +282 -86
  179. mindroot/docs/_build/html/_modules/mindroot/lib/buchatlog.html +285 -89
  180. mindroot/docs/_build/html/_modules/mindroot/lib/buchatlog2.html +282 -86
  181. mindroot/docs/_build/html/_modules/mindroot/lib/butemplates.html +282 -86
  182. mindroot/docs/_build/html/_modules/mindroot/lib/chatcontext.html +285 -89
  183. mindroot/docs/_build/html/_modules/mindroot/lib/chatlog.html +440 -91
  184. mindroot/docs/_build/html/_modules/mindroot/lib/chatlog_optimized.html +282 -86
  185. mindroot/docs/_build/html/_modules/mindroot/lib/json_escape.html +280 -84
  186. mindroot/docs/_build/html/_modules/mindroot/lib/json_str_block/json_str_block.html +282 -86
  187. mindroot/docs/_build/html/_modules/mindroot/lib/parent_templates.html +282 -86
  188. mindroot/docs/_build/html/_modules/mindroot/lib/plugins/installation.html +280 -84
  189. mindroot/docs/_build/html/_modules/mindroot/lib/plugins/l8n_static_handler.html +280 -84
  190. mindroot/docs/_build/html/_modules/mindroot/lib/plugins/loader.html +282 -86
  191. mindroot/docs/_build/html/_modules/mindroot/lib/plugins/loader_with_l8n.html +282 -86
  192. mindroot/docs/_build/html/_modules/mindroot/lib/plugins/manifest.html +282 -86
  193. mindroot/docs/_build/html/_modules/mindroot/lib/plugins/mapping.html +280 -84
  194. mindroot/docs/_build/html/_modules/mindroot/lib/plugins/paths.html +282 -86
  195. mindroot/docs/_build/html/_modules/mindroot/lib/plugins_install.html +282 -86
  196. mindroot/docs/_build/html/_modules/mindroot/lib/providers/commands.html +282 -87
  197. mindroot/docs/_build/html/_modules/mindroot/lib/providers/hooks.html +280 -85
  198. mindroot/docs/_build/html/_modules/mindroot/lib/providers/missing.html +282 -87
  199. mindroot/docs/_build/html/_modules/mindroot/lib/providers/model_preferences_v2.html +294 -91
  200. mindroot/docs/_build/html/_modules/mindroot/lib/providers/services.html +282 -87
  201. mindroot/docs/_build/html/_modules/mindroot/lib/providers.html +285 -89
  202. mindroot/docs/_build/html/_modules/mindroot/lib/route_decorators.html +282 -86
  203. mindroot/docs/_build/html/_modules/mindroot/lib/session_files.html +282 -86
  204. mindroot/docs/_build/html/_modules/mindroot/lib/streamcmd.html +282 -86
  205. mindroot/docs/_build/html/_modules/mindroot/lib/templates.html +343 -98
  206. mindroot/docs/_build/html/_modules/mindroot/lib/token_counter.html +280 -84
  207. mindroot/docs/_build/html/_modules/mindroot/migrate.html +282 -86
  208. mindroot/docs/_build/html/_modules/mindroot/registry/component_manager.html +282 -86
  209. mindroot/docs/_build/html/_modules/mindroot/registry/data_access.html +285 -89
  210. mindroot/docs/_build/html/_modules/mindroot/server.html +292 -87
  211. mindroot/docs/_build/html/_modules/mindroot/server_missing_normal_args.html +282 -86
  212. mindroot/docs/_build/html/_modules/mindroot/server_prev.html +282 -86
  213. mindroot/docs/_build/html/_sources/developer_documentation.rst.txt +21 -1
  214. mindroot/docs/_build/html/_sources/embed_chat.rst.txt +54 -0
  215. mindroot/docs/_build/html/_sources/user_documentation.rst.txt +6 -1
  216. mindroot/docs/_build/html/chat_with_assistant.html +1 -0
  217. mindroot/docs/_build/html/developer_documentation.html +45 -4
  218. mindroot/docs/_build/html/embed_chat.html +381 -0
  219. mindroot/docs/_build/html/genindex.html +9 -2
  220. mindroot/docs/_build/html/getting_started.html +19 -15
  221. mindroot/docs/_build/html/index.html +3 -0
  222. mindroot/docs/_build/html/install_plugins_with_tools.html +1 -0
  223. mindroot/docs/_build/html/installation.html +1 -0
  224. mindroot/docs/_build/html/llm_api_key.html +1 -0
  225. mindroot/docs/_build/html/llm_plugin_installation.html +1 -0
  226. mindroot/docs/_build/html/objects.inv +0 -0
  227. mindroot/docs/_build/html/programming_task.html +4 -3
  228. mindroot/docs/_build/html/py-modindex.html +2 -1
  229. mindroot/docs/_build/html/search.html +1 -0
  230. mindroot/docs/_build/html/searchindex.js +1 -1
  231. mindroot/docs/_build/html/source/ahp.html +1 -0
  232. mindroot/docs/_build/html/source/mindroot.coreplugins.admin.html +1 -0
  233. mindroot/docs/_build/html/source/mindroot.coreplugins.api_keys.html +16 -2
  234. mindroot/docs/_build/html/source/mindroot.coreplugins.chat.html +1 -0
  235. mindroot/docs/_build/html/source/mindroot.coreplugins.chat_avatar.html +16 -2
  236. mindroot/docs/_build/html/source/mindroot.coreplugins.check_list.html +91 -47
  237. mindroot/docs/_build/html/source/mindroot.coreplugins.credits.html +16 -2
  238. mindroot/docs/_build/html/source/mindroot.coreplugins.email.html +1 -0
  239. mindroot/docs/_build/html/source/mindroot.coreplugins.env_manager.html +16 -2
  240. mindroot/docs/_build/html/source/mindroot.coreplugins.events.html +16 -2
  241. mindroot/docs/_build/html/source/mindroot.coreplugins.html +3 -0
  242. mindroot/docs/_build/html/source/mindroot.coreplugins.index.handlers.html +16 -2
  243. mindroot/docs/_build/html/source/mindroot.coreplugins.index.html +16 -2
  244. mindroot/docs/_build/html/source/mindroot.coreplugins.jwt_auth.html +1 -0
  245. mindroot/docs/_build/html/source/mindroot.coreplugins.l8n.html +1 -0
  246. mindroot/docs/_build/html/source/mindroot.coreplugins.mcp_.html +1 -0
  247. mindroot/docs/_build/html/source/mindroot.coreplugins.persona.html +16 -2
  248. mindroot/docs/_build/html/source/mindroot.coreplugins.startup.html +16 -2
  249. mindroot/docs/_build/html/source/mindroot.coreplugins.subscriptions.html +16 -2
  250. mindroot/docs/_build/html/source/mindroot.coreplugins.usage.html +16 -2
  251. mindroot/docs/_build/html/source/mindroot.coreplugins.user_service.html +16 -2
  252. mindroot/docs/_build/html/source/mindroot.html +2 -0
  253. mindroot/docs/_build/html/source/mindroot.lib.auth.html +16 -2
  254. mindroot/docs/_build/html/source/mindroot.lib.html +36 -4
  255. mindroot/docs/_build/html/source/mindroot.lib.json_str_block.html +16 -2
  256. mindroot/docs/_build/html/source/mindroot.lib.plugins.html +16 -2
  257. mindroot/docs/_build/html/source/mindroot.lib.providers.backup.html +1 -0
  258. mindroot/docs/_build/html/source/mindroot.lib.providers.html +1 -0
  259. mindroot/docs/_build/html/source/mindroot.registry.html +16 -2
  260. mindroot/docs/_build/html/source/modules.html +16 -2
  261. mindroot/docs/_build/html/source/mr_agent_expert_instr.html +1 -0
  262. mindroot/docs/_build/html/starting_mindroot.html +1 -0
  263. mindroot/docs/_build/html/user_documentation.html +9 -0
  264. mindroot/docs/apikey.png +0 -0
  265. mindroot/docs/chatwidget1.png +0 -0
  266. mindroot/docs/chatwidgetx.png +0 -0
  267. mindroot/docs/developer_documentation.rst +21 -1
  268. mindroot/docs/disablechatavatar.png +0 -0
  269. mindroot/docs/embed_chat.rst +54 -0
  270. mindroot/docs/user_documentation.rst +6 -1
  271. mindroot/docs/widgetform.png +0 -0
  272. mindroot/docs/widgetonpage.png +0 -0
  273. mindroot/lib/buchatlog3.py +592 -0
  274. mindroot/lib/chatcontext.py +1 -0
  275. mindroot/lib/chatlog.py +195 -5
  276. mindroot/lib/logging/logfiles.py +1 -0
  277. {mindroot-9.22.0.dist-info → mindroot-10.14.0.dist-info}/METADATA +1 -1
  278. {mindroot-9.22.0.dist-info → mindroot-10.14.0.dist-info}/RECORD +282 -300
  279. mindroot/docs/_build/html/.buildinfo.bak +0 -4
  280. mindroot/docs/_build/html/_static/_sphinx_javascript_frameworks_compat.js +0 -123
  281. mindroot/docs/_build/html/_static/css/badge_only.css +0 -1
  282. mindroot/docs/_build/html/_static/css/fonts/Roboto-Slab-Bold.woff +0 -0
  283. mindroot/docs/_build/html/_static/css/fonts/Roboto-Slab-Bold.woff2 +0 -0
  284. mindroot/docs/_build/html/_static/css/fonts/Roboto-Slab-Regular.woff +0 -0
  285. mindroot/docs/_build/html/_static/css/fonts/Roboto-Slab-Regular.woff2 +0 -0
  286. mindroot/docs/_build/html/_static/css/fonts/fontawesome-webfont.eot +0 -0
  287. mindroot/docs/_build/html/_static/css/fonts/fontawesome-webfont.svg +0 -2671
  288. mindroot/docs/_build/html/_static/css/fonts/fontawesome-webfont.ttf +0 -0
  289. mindroot/docs/_build/html/_static/css/fonts/fontawesome-webfont.woff +0 -0
  290. mindroot/docs/_build/html/_static/css/fonts/fontawesome-webfont.woff2 +0 -0
  291. mindroot/docs/_build/html/_static/css/fonts/lato-bold-italic.woff +0 -0
  292. mindroot/docs/_build/html/_static/css/fonts/lato-bold-italic.woff2 +0 -0
  293. mindroot/docs/_build/html/_static/css/fonts/lato-bold.woff +0 -0
  294. mindroot/docs/_build/html/_static/css/fonts/lato-bold.woff2 +0 -0
  295. mindroot/docs/_build/html/_static/css/fonts/lato-normal-italic.woff +0 -0
  296. mindroot/docs/_build/html/_static/css/fonts/lato-normal-italic.woff2 +0 -0
  297. mindroot/docs/_build/html/_static/css/fonts/lato-normal.woff +0 -0
  298. mindroot/docs/_build/html/_static/css/fonts/lato-normal.woff2 +0 -0
  299. mindroot/docs/_build/html/_static/css/theme.css +0 -4
  300. mindroot/docs/_build/html/_static/fonts/Lato/lato-bold.eot +0 -0
  301. mindroot/docs/_build/html/_static/fonts/Lato/lato-bold.ttf +0 -0
  302. mindroot/docs/_build/html/_static/fonts/Lato/lato-bold.woff +0 -0
  303. mindroot/docs/_build/html/_static/fonts/Lato/lato-bold.woff2 +0 -0
  304. mindroot/docs/_build/html/_static/fonts/Lato/lato-bolditalic.eot +0 -0
  305. mindroot/docs/_build/html/_static/fonts/Lato/lato-bolditalic.ttf +0 -0
  306. mindroot/docs/_build/html/_static/fonts/Lato/lato-bolditalic.woff +0 -0
  307. mindroot/docs/_build/html/_static/fonts/Lato/lato-bolditalic.woff2 +0 -0
  308. mindroot/docs/_build/html/_static/fonts/Lato/lato-italic.eot +0 -0
  309. mindroot/docs/_build/html/_static/fonts/Lato/lato-italic.ttf +0 -0
  310. mindroot/docs/_build/html/_static/fonts/Lato/lato-italic.woff +0 -0
  311. mindroot/docs/_build/html/_static/fonts/Lato/lato-italic.woff2 +0 -0
  312. mindroot/docs/_build/html/_static/fonts/Lato/lato-regular.eot +0 -0
  313. mindroot/docs/_build/html/_static/fonts/Lato/lato-regular.ttf +0 -0
  314. mindroot/docs/_build/html/_static/fonts/Lato/lato-regular.woff +0 -0
  315. mindroot/docs/_build/html/_static/fonts/Lato/lato-regular.woff2 +0 -0
  316. mindroot/docs/_build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot +0 -0
  317. mindroot/docs/_build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf +0 -0
  318. mindroot/docs/_build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff +0 -0
  319. mindroot/docs/_build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 +0 -0
  320. mindroot/docs/_build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot +0 -0
  321. mindroot/docs/_build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf +0 -0
  322. mindroot/docs/_build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff +0 -0
  323. mindroot/docs/_build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 +0 -0
  324. mindroot/docs/_build/html/_static/jquery.js +0 -2
  325. mindroot/docs/_build/html/_static/js/badge_only.js +0 -1
  326. mindroot/docs/_build/html/_static/js/theme.js +0 -1
  327. mindroot/docs/_build/html/_static/js/versions.js +0 -228
  328. {mindroot-9.22.0.dist-info → mindroot-10.14.0.dist-info}/WHEEL +0 -0
  329. {mindroot-9.22.0.dist-info → mindroot-10.14.0.dist-info}/entry_points.txt +0 -0
  330. {mindroot-9.22.0.dist-info → mindroot-10.14.0.dist-info}/licenses/LICENSE +0 -0
  331. {mindroot-9.22.0.dist-info → mindroot-10.14.0.dist-info}/top_level.txt +0 -0
mindroot/lib/chatlog.py CHANGED
@@ -62,6 +62,8 @@ class ChatLog:
62
62
  self.agent = log_data.get('agent')
63
63
  self.messages = log_data.get('messages', [])
64
64
  self.parent_log_id = log_data.get('parent_log_id', None)
65
+ # we need the last modification time of the file
66
+ self.last_modified = os.path.getmtime(log_file)
65
67
  print("Loaded log file at ", log_file)
66
68
  print("Message length: ", len(self.messages))
67
69
  else:
@@ -71,12 +73,23 @@ class ChatLog:
71
73
  def _save_log_sync(self) -> None:
72
74
  """Synchronous version for backward compatibility"""
73
75
  log_file = os.path.join(self.log_dir, f'chatlog_{self.log_id}.json')
76
+ self.last_modified = time.time()
74
77
  with open(log_file, 'w') as f:
75
78
  json.dump(self._get_log_data(), f, indent=2)
76
79
 
80
+
81
+ def add_message_role(self, message: Dict[str, str]) -> None:
82
+ for i in range(len(self.messages)-1, -1, -1):
83
+ if self.messages[i]['role'] == message.get('role'):
84
+ self.messages[i]['content'].append(message)
85
+ self.last_modified = time.time()
86
+ self._save_log_sync()
87
+ return
88
+
77
89
  def add_message(self, message: Dict[str, str]) -> None:
78
90
  """Synchronous version for backward compatibility"""
79
91
  should_save = self._add_message_impl(message)
92
+ self.last_modified = time.time()
80
93
  if should_save:
81
94
  self._save_log_sync()
82
95
  else:
@@ -133,6 +146,7 @@ class ChatLog:
133
146
  debug_box("5")
134
147
  self.messages.append(message)
135
148
  self._save_log_sync()
149
+
136
150
  async def add_message_async(self, message: Dict[str, str]) -> None:
137
151
  """Async version for new code that needs non-blocking operations"""
138
152
  should_save = self._add_message_impl(message)
@@ -145,10 +159,36 @@ class ChatLog:
145
159
  len(self.messages[-1]['content']) > 0 and
146
160
  self.messages[-1]['content'][0].get('type') == 'image'):
147
161
  await self.save_log()
162
+
163
+ async def drop_last(self, role) -> None:
164
+ if len(self.messages) == 0:
165
+ return
166
+ if self.messages[-1]['role'] == role:
167
+ self.messages = self.messages[:-1]
168
+ await self.save_log()
148
169
 
149
170
  def get_history(self) -> List[Dict[str, str]]:
150
171
  return self.messages
151
172
 
173
+
174
+ def parsed_commands(self) -> List[Dict[str, any]]:
175
+ commands = []
176
+ filtered = [m for m in self.messages if m['role'] == 'assistant']
177
+ for message in filtered:
178
+ content = message['content']
179
+ if isinstance(content, list) and len(content) > 0 and 'text' in content[0]:
180
+ text = content[0]['text']
181
+ else:
182
+ continue
183
+ try:
184
+ cmd_list = json.loads(text)
185
+ if not isinstance(cmd_list, list):
186
+ cmd_list = [cmd_list]
187
+ commands.extend(cmd_list)
188
+ except (json.JSONDecodeError, TypeError):
189
+ continue
190
+ return commands
191
+
152
192
  def get_recent(self, max_tokens: int = 4096) -> List[Dict[str, str]]:
153
193
  recent_messages = []
154
194
  total_length = 0
@@ -281,7 +321,7 @@ async def find_child_logs_by_parent_id(parent_log_id: str) -> List[str]:
281
321
 
282
322
  def extract_delegate_task_log_ids(messages: List[Dict]) -> List[str]:
283
323
  """
284
- Extract log IDs from delegate_task commands in messages.
324
+ Extract log IDs from delegate_task and delegate_subtask commands in messages.
285
325
 
286
326
  Args:
287
327
  messages: List of chat messages
@@ -312,10 +352,15 @@ def extract_delegate_task_log_ids(messages: List[Dict]) -> List[str]:
312
352
  for key, value in cmd.items():
313
353
  if key == 'delegate_task' and 'log_id' in value:
314
354
  log_ids.append(value['log_id'])
355
+ elif key == 'delegate_subtask' and 'log_id' in value:
356
+ log_ids.append(value['log_id'])
315
357
  except (json.JSONDecodeError, TypeError, KeyError):
316
358
  # If not JSON, try regex to find log_ids in delegate_task commands
317
359
  matches = re.findall(r'"delegate_task"\s*:\s*{\s*"log_id"\s*:\s*"([^"]+)"', text)
318
360
  log_ids.extend(matches)
361
+ # Also check for delegate_subtask commands
362
+ matches = re.findall(r'"delegate_subtask"\s*:\s*{\s*"log_id"\s*:\s*"([^"]+)"', text)
363
+ log_ids.extend(matches)
319
364
 
320
365
  return log_ids
321
366
 
@@ -389,7 +434,119 @@ async def save_token_counts_to_cache(log_id: str, token_counts: Dict[str, int])
389
434
  async with aiofiles.open(cache_path, 'w') as f:
390
435
  await f.write(json.dumps(token_counts))
391
436
 
392
- async def count_tokens_for_log_id(log_id: str) -> Dict[str, int]:
437
+ async def build_token_hierarchy(log_id: str, user: str = None, visited: set = None) -> Dict:
438
+ """
439
+ Build a hierarchical token count structure for a log and its children.
440
+
441
+ Args:
442
+ log_id: The log ID to build hierarchy for
443
+ user: User for the log
444
+ visited: Set of already visited log IDs to prevent infinite recursion
445
+
446
+ Returns:
447
+ Dictionary with hierarchical structure containing:
448
+ - log_id: The log ID
449
+ - individual_counts: Token counts for this log only
450
+ - cumulative_counts: Token counts including all children
451
+ - children: List of child hierarchies
452
+ """
453
+ if visited is None:
454
+ visited = set()
455
+
456
+ if log_id in visited:
457
+ return None # Prevent infinite recursion
458
+
459
+ visited.add(log_id)
460
+
461
+ # Find the chatlog file
462
+ chatlog_path = await find_chatlog_file(log_id)
463
+ if not chatlog_path:
464
+ return None
465
+
466
+ # Load the chat log
467
+ async with aiofiles.open(chatlog_path, 'r') as f:
468
+ content = await f.read()
469
+ log_data = json.loads(content)
470
+
471
+ # Check if we have cached individual counts for this specific session
472
+ cached_individual = await get_cached_token_counts(log_id, chatlog_path)
473
+ if cached_individual and 'input_tokens_sequence' in cached_individual:
474
+ print(f"Using cached individual token counts for session {log_id}")
475
+ individual_counts = {
476
+ 'input_tokens_sequence': cached_individual['input_tokens_sequence'],
477
+ 'output_tokens_sequence': cached_individual['output_tokens_sequence'],
478
+ 'input_tokens_total': cached_individual['input_tokens_total']
479
+ }
480
+ else:
481
+ # Calculate individual counts for this session
482
+ if user is None:
483
+ try:
484
+ path_parts = chatlog_path.split(os.sep)
485
+ if len(path_parts) >= 4 and path_parts[-4] == 'chat':
486
+ user = path_parts[-3]
487
+ else:
488
+ user = "system"
489
+ except Exception:
490
+ user = "system"
491
+
492
+ temp_log = ChatLog(log_id=log_id, user=user, agent=log_data.get('agent', 'unknown'))
493
+ temp_log.messages = log_data.get('messages', [])
494
+
495
+ # Count tokens for this log only
496
+ individual_counts = temp_log.count_tokens()
497
+
498
+ # Cache the individual session counts
499
+ individual_cache_data = {
500
+ 'input_tokens_sequence': individual_counts['input_tokens_sequence'],
501
+ 'output_tokens_sequence': individual_counts['output_tokens_sequence'],
502
+ 'input_tokens_total': individual_counts['input_tokens_total']
503
+ }
504
+ await save_token_counts_to_cache(log_id, individual_cache_data)
505
+ print(f"Cached individual token counts for session {log_id}")
506
+
507
+ # Find all child log IDs
508
+ if user is None:
509
+ try:
510
+ path_parts = chatlog_path.split(os.sep)
511
+ if len(path_parts) >= 4 and path_parts[-4] == 'chat':
512
+ user = path_parts[-3]
513
+ else:
514
+ user = "system"
515
+ except Exception:
516
+ user = "system"
517
+
518
+ temp_log = ChatLog(log_id=log_id, user=user, agent=log_data.get('agent', 'unknown'))
519
+ temp_log.messages = log_data.get('messages', [])
520
+ delegated_log_ids = extract_delegate_task_log_ids(temp_log.messages)
521
+ child_logs_by_parent = await find_child_logs_by_parent_id(log_id)
522
+ all_child_log_ids = list(set(delegated_log_ids) | set(child_logs_by_parent))
523
+
524
+ # Build child hierarchies
525
+ children = []
526
+ cumulative_counts = {
527
+ 'input_tokens_sequence': individual_counts['input_tokens_sequence'],
528
+ 'output_tokens_sequence': individual_counts['output_tokens_sequence'],
529
+ 'input_tokens_total': individual_counts['input_tokens_total']
530
+ }
531
+
532
+ for child_id in all_child_log_ids:
533
+ child_hierarchy = await build_token_hierarchy(child_id, user, visited.copy())
534
+ if child_hierarchy:
535
+ children.append(child_hierarchy)
536
+ # Add child's cumulative counts to our cumulative counts
537
+ cumulative_counts['input_tokens_sequence'] += child_hierarchy['cumulative_counts']['input_tokens_sequence']
538
+ cumulative_counts['output_tokens_sequence'] += child_hierarchy['cumulative_counts']['output_tokens_sequence']
539
+ cumulative_counts['input_tokens_total'] += child_hierarchy['cumulative_counts']['input_tokens_total']
540
+
541
+ return {
542
+ 'log_id': log_id,
543
+ 'agent': log_data.get('agent', 'unknown'),
544
+ 'individual_counts': individual_counts,
545
+ 'cumulative_counts': cumulative_counts,
546
+ 'children': children
547
+ }
548
+
549
+ async def count_tokens_for_log_id(log_id: str, user: str = None, hierarchical: bool = False) -> Dict[str, int]:
393
550
  """
394
551
  Count tokens for a chat log identified by log_id, including any delegated tasks.
395
552
 
@@ -397,13 +554,32 @@ async def count_tokens_for_log_id(log_id: str) -> Dict[str, int]:
397
554
  log_id: The log ID to count tokens for
398
555
 
399
556
  Returns:
400
- Dictionary with token counts or None if log not found
557
+ Dictionary with token counts or None if log not found.
558
+ If hierarchical=True, includes 'hierarchy' key with tree structure.
559
+ If hierarchical=False (default), returns flat structure for backwards compatibility.
401
560
  """
402
561
  # Find the chatlog file
403
562
  chatlog_path = await find_chatlog_file(log_id)
404
563
  if not chatlog_path:
405
564
  return None
406
565
 
566
+ # If hierarchical structure is requested, build and return it
567
+ if hierarchical:
568
+ # Check cache first for hierarchical data
569
+ cached_counts = await get_cached_token_counts(log_id, chatlog_path)
570
+ if cached_counts and 'hierarchy' in cached_counts:
571
+ print(f"Using cached hierarchical token counts for {log_id}")
572
+ return cached_counts
573
+
574
+ print(f"Calculating hierarchical token counts for {log_id}")
575
+ hierarchy = await build_token_hierarchy(log_id, user)
576
+ if hierarchy:
577
+ result = {'hierarchy': hierarchy}
578
+ # Save hierarchical data to cache
579
+ await save_token_counts_to_cache(log_id, result)
580
+ return result
581
+ return None
582
+
407
583
  # Check cache first
408
584
  cached_counts = await get_cached_token_counts(log_id, chatlog_path)
409
585
  if cached_counts:
@@ -421,7 +597,21 @@ async def count_tokens_for_log_id(log_id: str) -> Dict[str, int]:
421
597
  parent_log_id = log_data.get('parent_log_id')
422
598
 
423
599
  # Create a temporary ChatLog instance to count tokens
424
- temp_log = ChatLog(log_id=log_id, user="system", agent=log_data.get('agent', 'unknown'))
600
+ # Use provided user or try to determine from chatlog path or fallback to "system"
601
+ if user is None:
602
+ # Try to extract user from chatlog path: data/chat/{user}/{agent}/chatlog_{log_id}.json
603
+ try:
604
+ path_parts = chatlog_path.split(os.sep)
605
+ if len(path_parts) >= 4 and path_parts[-4] == 'chat':
606
+ extracted_user = path_parts[-3] # User is third from the end
607
+ user = extracted_user
608
+ print(f"Extracted user '{user}' from chatlog path: {chatlog_path}")
609
+ else:
610
+ user = "system" # Default fallback
611
+ except Exception as e:
612
+ print(f"Error extracting user from path {chatlog_path}: {e}")
613
+ user = "system" # Default fallback
614
+ temp_log = ChatLog(log_id=log_id, user=user, agent=log_data.get('agent', 'unknown'))
425
615
  temp_log.messages = log_data.get('messages', [])
426
616
 
427
617
  # Count tokens for this log
@@ -449,7 +639,7 @@ async def count_tokens_for_log_id(log_id: str) -> Dict[str, int]:
449
639
 
450
640
  # Recursively count tokens for all child tasks
451
641
  for child_id in all_child_log_ids:
452
- delegated_counts = await count_tokens_for_log_id(child_id)
642
+ delegated_counts = await count_tokens_for_log_id(child_id, user=user)
453
643
  if delegated_counts:
454
644
  combined_counts['input_tokens_sequence'] += delegated_counts['input_tokens_sequence']
455
645
  combined_counts['output_tokens_sequence'] += delegated_counts['output_tokens_sequence']
@@ -24,6 +24,7 @@ def json_sink(message):
24
24
  logger.info("This is a test log message")
25
25
 
26
26
  logger.add(json_sink, level="DEBUG")
27
+ #logger.add(json_sink, level="ERROR")
27
28
 
28
29
  def generate_file_name(timestamp):
29
30
  return f"logs/log_{timestamp.strftime('%Y-%m-%d_%H')}.json"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mindroot
3
- Version: 9.22.0
3
+ Version: 10.14.0
4
4
  Summary: MindRoot AI Agent Framework
5
5
  Requires-Python: >=3.9
6
6
  License-File: LICENSE