langbot-plugin 0.4.5__tar.gz → 0.4.7__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 (252) hide show
  1. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/.github/workflows/test.yml +14 -0
  2. langbot_plugin-0.4.7/AGENTS.md +121 -0
  3. langbot_plugin-0.4.7/ARCHITECTURE.md +225 -0
  4. langbot_plugin-0.4.7/PKG-INFO +115 -0
  5. langbot_plugin-0.4.7/README.md +86 -0
  6. langbot_plugin-0.4.7/README_CN.md +83 -0
  7. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/docs/communication/apis/lb2rt.md +22 -1
  8. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/pyproject.toml +1 -1
  9. langbot_plugin-0.4.7/scripts/check_action_consistency.py +277 -0
  10. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/command/errors.py +0 -1
  11. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/backend.py +28 -5
  12. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/runtime.py +331 -77
  13. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/server.py +1 -0
  14. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/run/handler.py +37 -0
  15. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/entities/io/actions/enums.py +2 -0
  16. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/handlers/control.py +11 -4
  17. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/handlers/plugin.py +19 -1
  18. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/plugin/logbuffer.py +19 -0
  19. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/plugin/mgr.py +158 -2
  20. langbot_plugin-0.4.7/src/langbot_plugin/version.py +1 -0
  21. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/box/test_backend.py +62 -7
  22. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/box/test_backend_selection.py +7 -4
  23. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/box/test_runtime.py +327 -6
  24. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/run/test_runtime_handler.py +29 -0
  25. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/runtime/io/handlers/test_control_handler.py +40 -1
  26. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/runtime/io/handlers/test_plugin_handler.py +16 -0
  27. langbot_plugin-0.4.7/tests/runtime/io/test_action_consistency.py +79 -0
  28. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/runtime/plugin/test_manager.py +166 -2
  29. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/test_plugin_logbuffer.py +28 -0
  30. langbot_plugin-0.4.5/AGENTS.md +0 -1117
  31. langbot_plugin-0.4.5/PKG-INFO +0 -38
  32. langbot_plugin-0.4.5/README.md +0 -9
  33. langbot_plugin-0.4.5/src/langbot_plugin/version.py +0 -1
  34. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/.github/workflows/cla.yml +0 -0
  35. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/.github/workflows/publish-pypi.yaml +0 -0
  36. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/.gitignore +0 -0
  37. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/.python-version +0 -0
  38. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/CLAUDE.md +0 -0
  39. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/CONTRIBUTING.md +0 -0
  40. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/LICENSE +0 -0
  41. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/data/.env.example +0 -0
  42. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/docs/Message.md +0 -0
  43. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/docs/PluginPages.md +0 -0
  44. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/docs/communication/runtime_plugin.md +0 -0
  45. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/docs/dependency-management.md +0 -0
  46. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/docs/langbot-plugin-social.png +0 -0
  47. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/__init__.py +0 -0
  48. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/__init__.py +0 -0
  49. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/__init__.py +0 -0
  50. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/abstract/__init__.py +0 -0
  51. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/abstract/platform/__init__.py +0 -0
  52. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/abstract/platform/adapter.py +0 -0
  53. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/abstract/platform/event_logger.py +0 -0
  54. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/__init__.py +0 -0
  55. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/base.py +0 -0
  56. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/command/__init__.py +0 -0
  57. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/command/command.py +0 -0
  58. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/common/__init__.py +0 -0
  59. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/common/event_listener.py +0 -0
  60. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/knowledge_engine/__init__.py +0 -0
  61. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/knowledge_engine/engine.py +0 -0
  62. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/manifest.py +0 -0
  63. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/page/__init__.py +0 -0
  64. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/parser/__init__.py +0 -0
  65. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/parser/parser.py +0 -0
  66. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/tool/__init__.py +0 -0
  67. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/components/tool/tool.py +0 -0
  68. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/definition/plugin.py +0 -0
  69. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/__init__.py +0 -0
  70. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/__init__.py +0 -0
  71. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/command/__init__.py +0 -0
  72. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/command/context.py +0 -0
  73. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/pipeline/__init__.py +0 -0
  74. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/pipeline/query.py +0 -0
  75. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/platform/__init__.py +0 -0
  76. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/platform/entities.py +0 -0
  77. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/platform/events.py +0 -0
  78. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/platform/logger.py +0 -0
  79. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/platform/message.py +0 -0
  80. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/provider/__init__.py +0 -0
  81. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/provider/message.py +0 -0
  82. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/provider/prompt.py +0 -0
  83. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/provider/session.py +0 -0
  84. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/rag/__init__.py +0 -0
  85. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/rag/context.py +0 -0
  86. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/rag/enums.py +0 -0
  87. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/rag/errors.py +0 -0
  88. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/rag/models.py +0 -0
  89. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/resource/__init__.py +0 -0
  90. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/builtin/resource/tool.py +0 -0
  91. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/context.py +0 -0
  92. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/entities/events.py +0 -0
  93. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/proxies/__init__.py +0 -0
  94. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/proxies/base.py +0 -0
  95. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/proxies/event_context.py +0 -0
  96. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/proxies/execute_context.py +0 -0
  97. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/proxies/langbot_api.py +0 -0
  98. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/api/proxies/query_based_api.py +0 -0
  99. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/__init__.py +0 -0
  100. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/langbot-page-sdk.js +0 -0
  101. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/.env.example.example +0 -0
  102. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/.github/workflows/release.yml.example +0 -0
  103. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/.gitignore.example +0 -0
  104. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/.vscode/launch.json.example +0 -0
  105. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/README.md.example +0 -0
  106. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/__init__.py +0 -0
  107. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/assets/icon.svg.example +0 -0
  108. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/__init__.py +0 -0
  109. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/commands/__init__.py +0 -0
  110. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.py.example +0 -0
  111. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.yaml.example +0 -0
  112. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/event_listener/__init__.py +0 -0
  113. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/event_listener/default.py.example +0 -0
  114. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/event_listener/default.yaml.example +0 -0
  115. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/knowledge_engine/__init__.py +0 -0
  116. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.py.example +0 -0
  117. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.yaml.example +0 -0
  118. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/pages/{page_name}.html.example +0 -0
  119. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/pages/{page_name}.yaml.example +0 -0
  120. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/parser/__init__.py +0 -0
  121. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.py.example +0 -0
  122. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.yaml.example +0 -0
  123. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/tools/__init__.py +0 -0
  124. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.py.example +0 -0
  125. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.yaml.example +0 -0
  126. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/main.py.example +0 -0
  127. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/manifest.yaml.example +0 -0
  128. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/readme/README_zh_Hans.md.example +0 -0
  129. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/assets/templates/requirements.txt.example +0 -0
  130. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/__init__.py +0 -0
  131. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/actions.py +0 -0
  132. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/client.py +0 -0
  133. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/e2b_backend.py +0 -0
  134. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/errors.py +0 -0
  135. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/models.py +0 -0
  136. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/nsjail_backend.py +0 -0
  137. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/security.py +0 -0
  138. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/box/skill_store.py +0 -0
  139. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/__init__.py +0 -0
  140. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/__main__.py +0 -0
  141. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/commands/__init__.py +0 -0
  142. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/commands/buildplugin.py +0 -0
  143. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/commands/gencomponent.py +0 -0
  144. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/commands/initplugin.py +0 -0
  145. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/commands/login.py +0 -0
  146. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/commands/logout.py +0 -0
  147. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/commands/publish.py +0 -0
  148. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/commands/runplugin.py +0 -0
  149. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/gen/__init__.py +0 -0
  150. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/gen/renderer.py +0 -0
  151. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/i18n.py +0 -0
  152. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/locales/__init__.py +0 -0
  153. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/locales/en_US.py +0 -0
  154. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/locales/es_ES.py +0 -0
  155. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/locales/ja_JP.py +0 -0
  156. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/locales/th_TH.py +0 -0
  157. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/locales/vi_VN.py +0 -0
  158. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/locales/zh_Hans.py +0 -0
  159. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/locales/zh_Hant.py +0 -0
  160. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/run/__init__.py +0 -0
  161. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/run/controller.py +0 -0
  162. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/run/hotreload.py +0 -0
  163. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/utils/__init__.py +0 -0
  164. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/utils/cloudsv.py +0 -0
  165. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/utils/form.py +0 -0
  166. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/cli/utils/page_components.py +0 -0
  167. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/entities/__init__.py +0 -0
  168. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/entities/io/__init__.py +0 -0
  169. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/entities/io/actions/__init__.py +0 -0
  170. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/entities/io/errors.py +0 -0
  171. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/entities/io/req.py +0 -0
  172. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/entities/io/resp.py +0 -0
  173. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/entities/marketplace.py +0 -0
  174. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/LICENSE +0 -0
  175. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/README.md +0 -0
  176. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/__init__.py +0 -0
  177. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/app.py +0 -0
  178. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/context.py +0 -0
  179. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/helper/__init__.py +0 -0
  180. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/helper/marketplace.py +0 -0
  181. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/helper/pkgmgr.py +0 -0
  182. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/__init__.py +0 -0
  183. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/connection.py +0 -0
  184. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/connections/__init__.py +0 -0
  185. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/connections/stdio.py +0 -0
  186. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/connections/ws.py +0 -0
  187. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/controller.py +0 -0
  188. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/controllers/__init__.py +0 -0
  189. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/controllers/stdio/__init__.py +0 -0
  190. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/controllers/stdio/client.py +0 -0
  191. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/controllers/stdio/server.py +0 -0
  192. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/controllers/ws/__init__.py +0 -0
  193. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/controllers/ws/client.py +0 -0
  194. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/controllers/ws/server.py +0 -0
  195. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/handler.py +0 -0
  196. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/io/handlers/__init__.py +0 -0
  197. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/plugin/__init__.py +0 -0
  198. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/plugin/container.py +0 -0
  199. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/runtime/settings.py +0 -0
  200. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/utils/__init__.py +0 -0
  201. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/utils/discover/__init__.py +0 -0
  202. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/utils/discover/engine.py +0 -0
  203. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/utils/importutil.py +0 -0
  204. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/utils/log.py +0 -0
  205. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/src/langbot_plugin/utils/platform.py +0 -0
  206. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/__init__.py +0 -0
  207. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/api/definition/components/test_components.py +0 -0
  208. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/api/definition/test_manifest.py +0 -0
  209. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/api/entities/builtin/test_command_context.py +0 -0
  210. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/api/entities/builtin/test_platform_logger.py +0 -0
  211. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/api/entities/builtin/test_provider_message.py +0 -0
  212. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/api/entities/builtin/test_rag_models.py +0 -0
  213. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/api/entities/test_context.py +0 -0
  214. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/api/entities/test_events.py +0 -0
  215. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/api/proxies/test_base.py +0 -0
  216. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/api/proxies/test_langbot_api.py +0 -0
  217. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/api/proxies/test_query_based_api.py +0 -0
  218. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/box/__init__.py +0 -0
  219. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/box/test_client.py +0 -0
  220. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/box/test_e2b_backend.py +0 -0
  221. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/box/test_nsjail_backend.py +0 -0
  222. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/box/test_server.py +0 -0
  223. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/box/test_skill_store.py +0 -0
  224. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/run/test_controller.py +0 -0
  225. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/run/test_hotreload.py +0 -0
  226. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/test_buildplugin.py +0 -0
  227. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/test_gencomponent.py +0 -0
  228. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/test_i18n_form.py +0 -0
  229. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/test_initplugin.py +0 -0
  230. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/test_login.py +0 -0
  231. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/test_logout_publish.py +0 -0
  232. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/test_page_components.py +0 -0
  233. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/test_renderer.py +0 -0
  234. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/cli/test_runplugin.py +0 -0
  235. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/entities/io/test_dependency_errors.py +0 -0
  236. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/entities/io/test_protocol.py +0 -0
  237. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/helpers/__init__.py +0 -0
  238. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/helpers/protocol.py +0 -0
  239. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/packaging/test_installed_cli_blackbox.py +0 -0
  240. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/runtime/helper/test_marketplace.py +0 -0
  241. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/runtime/helper/test_pkgmgr.py +0 -0
  242. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/runtime/io/handlers/test_import_contracts.py +0 -0
  243. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/runtime/io/test_connections.py +0 -0
  244. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/runtime/io/test_controllers.py +0 -0
  245. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/runtime/io/test_handler.py +0 -0
  246. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/runtime/plugin/test_container.py +0 -0
  247. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/runtime/test_app.py +0 -0
  248. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/test_log.py +0 -0
  249. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/test_message.py +0 -0
  250. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/utils/test_discovery.py +0 -0
  251. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/utils/test_importutil.py +0 -0
  252. {langbot_plugin-0.4.5 → langbot_plugin-0.4.7}/tests/utils/test_platform.py +0 -0
@@ -77,3 +77,17 @@ jobs:
77
77
  src/langbot_plugin/entities/io \
78
78
  src/langbot_plugin/runtime/plugin/logbuffer.py \
79
79
  src/langbot_plugin/utils/platform.py
80
+
81
+ action-consistency:
82
+ name: Action Protocol Consistency
83
+ runs-on: ubuntu-latest
84
+ steps:
85
+ - uses: actions/checkout@v4
86
+ with:
87
+ persist-credentials: false
88
+ - name: Set up Python
89
+ uses: actions/setup-python@v5
90
+ with:
91
+ python-version: "3.12"
92
+ - name: Check action enum / proxy / handler consistency
93
+ run: python scripts/check_action_consistency.py
@@ -0,0 +1,121 @@
1
+ # AGENTS.md
2
+
3
+ This file guides code agents working in the `langbot-plugin-sdk` repository. `CLAUDE.md` is a symlink to this file.
4
+
5
+ Read `ARCHITECTURE.md` before non-trivial SDK, CLI, Plugin Runtime, Box Runtime, protocol, or cross-repo LangBot changes. This file is the working checklist; `ARCHITECTURE.md` is the system map.
6
+
7
+ ## Quick Facts
8
+
9
+ - Package name: `langbot-plugin`.
10
+ - Python: `>=3.10`.
11
+ - CLI entrypoint: `lbp = langbot_plugin.cli:main`.
12
+ - Main consumers: LangBot main repo and third-party plugins.
13
+ - Runtime license: `src/langbot_plugin/runtime/` is AGPL; the rest is Apache 2.0.
14
+ - LangBot pins this package in its `pyproject.toml`; local cross-repo testing needs a local install into LangBot's venv.
15
+
16
+ ## Essential Commands
17
+
18
+ ```bash
19
+ uv sync --dev
20
+ uv run lbp --help
21
+ uv run lbp ver
22
+ uv run lbp init MyPlugin
23
+ uv run lbp comp Command
24
+ uv run lbp run
25
+ uv run lbp build
26
+ uv run lbp publish
27
+ uv run lbp rt
28
+ uv run lbp box
29
+ ```
30
+
31
+ Focused validation:
32
+
33
+ ```bash
34
+ uv run pytest tests/api -q
35
+ uv run pytest tests/cli -q
36
+ uv run pytest tests/runtime -q
37
+ uv run pytest tests/box -q
38
+ uv run pytest tests/packaging/test_installed_cli_blackbox.py -q
39
+ uv run python scripts/check_action_consistency.py
40
+ ```
41
+
42
+ ## Where to Look
43
+
44
+ - Architecture map: `ARCHITECTURE.md`.
45
+ - CLI entrypoint and flags: `src/langbot_plugin/cli/__init__.py`.
46
+ - Plugin SDK APIs: `src/langbot_plugin/api/`.
47
+ - Plugin Runtime: `src/langbot_plugin/runtime/`.
48
+ - Box Runtime: `src/langbot_plugin/box/`.
49
+ - Action protocol: `src/langbot_plugin/entities/io/` and `src/langbot_plugin/runtime/io/handler.py`.
50
+ - Plugin tutorial: https://docs.langbot.app/zh/plugin/dev/tutor.
51
+ - Runtime/CLI/SDK debugging: https://docs.langbot.app/zh/develop/plugin-runtime.
52
+ - LangBot main repo: `../LangBot/`.
53
+
54
+ ## Cross-Repo LangBot Testing
55
+
56
+ Use sibling repos:
57
+
58
+ ```text
59
+ langbot-projects/
60
+ ├── LangBot/
61
+ └── langbot-plugin-sdk/
62
+ ```
63
+
64
+ When changing shared entities, component contracts, action payloads, Plugin Runtime, or Box Runtime:
65
+
66
+ ```bash
67
+ # from langbot-plugin-sdk, with LangBot's .venv active
68
+ uv pip install .
69
+
70
+ # from LangBot; keep local SDK installed
71
+ uv run --no-sync main.py
72
+ ```
73
+
74
+ Standalone runtime flows:
75
+
76
+ ```bash
77
+ # Plugin Runtime, default control :5400 and debug :5401
78
+ uv run --no-sync lbp rt
79
+
80
+ # Box Runtime, default :5410
81
+ uv run --no-sync lbp box
82
+ ```
83
+
84
+ Then configure LangBot as needed:
85
+
86
+ - Plugin runtime: `plugin.runtime_ws_url: ws://localhost:5400/control/ws`, launch LangBot with `--standalone-runtime`.
87
+ - Box runtime: `box.runtime.endpoint: ws://127.0.0.1:5410`, choose `box.backend`, launch LangBot with `--standalone-box`.
88
+
89
+ ## Change Rules
90
+
91
+ - Treat action enums and Pydantic models as cross-process API contracts; update callers, handlers, and tests together.
92
+ - Do not duplicate action strings outside the enum definitions.
93
+ - Keep generated plugin templates, component base classes, CLI renderer behavior, and docs consistent when component contracts change.
94
+ - Preserve `uv run --no-sync` guidance for local SDK testing; otherwise LangBot may reinstall the pinned PyPI package.
95
+ - Keep comments/docstrings in English and user-facing labels/descriptions i18n-ready.
96
+ - Commit message format: `<type>(<scope>): <subject>`.
97
+
98
+ ## Runtime Pitfalls
99
+
100
+ - Direct local LangBot runs often spawn Plugin Runtime over stdio; stdio disconnects cannot auto-reconnect.
101
+ - Orphan Runtime processes holding `5400`/`5401` commonly break `lbp run` debugging.
102
+ - Docker deployments use `langbot_plugin_runtime:5400/control/ws` and `langbot_box:5410` as service hosts.
103
+ - A false Box “no backend” often means Docker socket permission is missing, not that Docker is unavailable.
104
+ - nsjail inside containers needs host cgroup namespace for cgroup v2 limits; do not fake memory limits with `RLIMIT_AS` because it breaks tools that reserve large virtual memory.
105
+ - There is no supported `python -m langbot_plugin.box` entrypoint; use `lbp box`.
106
+ - `CLAUDE.md` is a symlink to this file; edit `AGENTS.md`, not the symlink.
107
+
108
+ ## Principles
109
+
110
+ - Keep it simple, stupid.
111
+ - Entities should not be multiplied unnecessarily.
112
+ - 八荣八耻
113
+
114
+ 以瞎猜接口为耻,以认真查询为荣。
115
+ 以模糊执行为耻,以寻求确认为荣。
116
+ 以臆想业务为耻,以人类确认为荣。
117
+ 以创造接口为耻,以复用现有为荣。
118
+ 以跳过验证为耻,以主动测试为荣。
119
+ 以破坏架构为耻,以遵循规范为荣。
120
+ 以假装理解为耻,以诚实无知为荣。
121
+ 以盲目修改为耻,以谨慎重构为荣。
@@ -0,0 +1,225 @@
1
+ # Architecture
2
+
3
+ This document maps the `langbot-plugin-sdk` repository. It explains the durable structure and cross-process contracts. For working rules, commands, and pitfalls, see `AGENTS.md`.
4
+
5
+ ## What This Repository Is
6
+
7
+ `langbot-plugin-sdk` is the infrastructure package behind LangBot's plugin and sandbox systems. It is published to PyPI as `langbot-plugin` and pinned by the LangBot main repo.
8
+
9
+ The package has four roles:
10
+
11
+ - **Plugin SDK**: public APIs and entities imported by plugin authors.
12
+ - **CLI**: `lbp`, used to scaffold, run, debug, build, publish, and launch runtimes.
13
+ - **Plugin Runtime**: `lbp rt`, the host process that manages plugin packages and plugin processes.
14
+ - **Box Runtime**: `lbp box`, the sandbox runtime used by LangBot's Box subsystem.
15
+
16
+ The runtime code under `src/langbot_plugin/runtime/` is AGPL; the rest of the repo is Apache 2.0.
17
+
18
+ ## Repository Boundary
19
+
20
+ This repo is coupled to LangBot but owns different things.
21
+
22
+ - The LangBot main repo owns product behavior, HTTP API, web UI, platform adapters, pipeline execution, model/tool orchestration, persistence, skills integration, and the LangBot-side runtime connectors.
23
+ - This SDK repo owns plugin author APIs, shared message/event/context entities, the action RPC protocol, `lbp`, Plugin Runtime implementation, and Box Runtime implementation.
24
+ - Plugins import this package directly; LangBot also imports it for shared entities and runtime protocols.
25
+
26
+ If a change alters shared entities, component contracts, action names/payloads, runtime behavior, or Box models, update/test both repos in lockstep.
27
+
28
+ ## Top-Level Layout
29
+
30
+ ```text
31
+ langbot-plugin-sdk/
32
+ ├── src/langbot_plugin/
33
+ │ ├── api/ # Public plugin-author SDK
34
+ │ │ ├── definition/ # BasePlugin, components, manifests
35
+ │ │ ├── entities/ # Contexts, events, builtin platform/provider models
36
+ │ │ └── proxies/ # APIs exposed to plugin code
37
+ │ ├── cli/ # `lbp` entrypoint and subcommands
38
+ │ ├── runtime/ # Plugin Runtime (`lbp rt`)
39
+ │ ├── box/ # Box Runtime (`lbp box`)
40
+ │ ├── entities/io/ # Action RPC request/response/error/action models
41
+ │ ├── assets/ # Scaffolding templates and page SDK asset
42
+ │ └── utils/
43
+ ├── docs/ # Supplemental protocol/component docs
44
+ ├── tests/ # Unit and black-box tests
45
+ ├── pyproject.toml
46
+ └── README.md
47
+ ```
48
+
49
+ ## Public Plugin SDK
50
+
51
+ Plugin-facing APIs live under `src/langbot_plugin/api/`.
52
+
53
+ - `definition/plugin.py` defines `BasePlugin`.
54
+ - `definition/components/` defines component base classes.
55
+ - `definition/components/manifest.py` defines component manifest models.
56
+ - `entities/` defines event/context/message/provider data models passed across LangBot, runtime, and plugin code.
57
+ - `proxies/` defines methods plugins can call back into LangBot, such as messaging, storage, model invocation, tools, RAG, parser, and query-scoped APIs.
58
+
59
+ Plugins extend LangBot through six component types:
60
+
61
+ - `Command`
62
+ - `Tool`
63
+ - `EventListener`
64
+ - `KnowledgeEngine`
65
+ - `Parser`
66
+ - `Page`
67
+
68
+ The CLI scaffolds components via `lbp comp <Type>`. Component templates live under `src/langbot_plugin/assets/templates/`; generation logic lives under `src/langbot_plugin/cli/gen/`.
69
+
70
+ ## CLI Architecture
71
+
72
+ `lbp` is declared in `pyproject.toml` and enters at `src/langbot_plugin/cli:main`, implemented by `src/langbot_plugin/cli/__init__.py`.
73
+
74
+ Subcommands:
75
+
76
+ - `init`: scaffold a plugin project.
77
+ - `comp`: generate a plugin component.
78
+ - `run`: run/remote-debug a plugin against a Runtime debug server.
79
+ - `build`: package a plugin zip.
80
+ - `publish`: publish a plugin to the marketplace.
81
+ - `login` / `logout`: marketplace authentication.
82
+ - `rt`: launch the Plugin Runtime.
83
+ - `box`: launch the Box Runtime.
84
+ - `ver`: print package version.
85
+
86
+ Subcommand implementations live under `cli/commands/`, `cli/run/`, and `cli/gen/`. CLI i18n lives under `cli/locales/`.
87
+
88
+ ## Action RPC Protocol
89
+
90
+ The runtime protocol is a bidirectional action RPC protocol over stdio or WebSocket. It is implemented by `runtime/io/handler.py` and data models under `entities/io/`.
91
+
92
+ Request shape:
93
+
94
+ ```json
95
+ { "seq_id": 1, "action": "action_name", "data": {} }
96
+ ```
97
+
98
+ Response shape:
99
+
100
+ ```json
101
+ { "seq_id": 1, "code": 0, "message": "success", "data": {}, "chunk_status": "continue" }
102
+ ```
103
+
104
+ Core mechanics:
105
+
106
+ - `seq_id` correlates responses to requests.
107
+ - Messages with `action` are requests; messages with `code` are responses.
108
+ - Each peer may initiate requests on the same connection.
109
+ - `Handler.call_action()` waits for one response.
110
+ - `Handler.call_action_generator()` consumes streamed responses.
111
+ - Streaming emits `chunk_status: "continue"` chunks and ends with `"end"`.
112
+ - File transfer uses `CommonAction.FILE_CHUNK` with 16KB base64 chunks stored under `data/temp/lbp/`.
113
+
114
+ Action enums are the protocol contract:
115
+
116
+ - `CommonAction`
117
+ - `PluginToRuntimeAction`
118
+ - `RuntimeToPluginAction`
119
+ - `LangBotToRuntimeAction`
120
+ - `RuntimeToLangBotAction`
121
+ - `LangBotToBoxAction`
122
+
123
+ Do not duplicate action strings outside these enums.
124
+
125
+ ## Plugin Runtime
126
+
127
+ `lbp rt` enters `runtime/app.py::main()` and builds `RuntimeApplication`.
128
+
129
+ Runtime graph:
130
+
131
+ ```text
132
+ LangBot PluginRuntimeConnector
133
+ ↔ control connection
134
+ ↔ RuntimeApplication
135
+ → PluginManager
136
+ → PluginContainer(s)
137
+ ↔ PluginConnectionHandler(s)
138
+ ↔ plugin process(es)
139
+ ```
140
+
141
+ Important modules:
142
+
143
+ - `runtime/app.py`: selects stdio vs WebSocket control transport, starts control/debug servers, launches plugin manager tasks.
144
+ - `runtime/context.py`: shared runtime context object.
145
+ - `runtime/settings.py`: runtime settings, including marketplace/cloud URL.
146
+ - `runtime/plugin/mgr.py`: plugin discovery, installation, dependency checks, launch, shutdown, event/tool/command/RAG/page dispatch.
147
+ - `runtime/plugin/container.py`: loaded plugin package, manifest, component containers, status.
148
+ - `runtime/io/handlers/control.py`: actions LangBot calls on the Runtime.
149
+ - `runtime/io/handlers/plugin.py`: actions the Runtime calls on plugin processes.
150
+ - `runtime/io/controllers/`: stdio/WebSocket server and client controllers.
151
+ - `runtime/io/connections/`: transport-specific connection implementations.
152
+
153
+ The Runtime has two external channels:
154
+
155
+ - **control channel**: LangBot ↔ Runtime, stdio or `:5400/control/ws` by default.
156
+ - **debug channel**: plugin dev process ↔ Runtime, WebSocket `:5401/plugin/debug/ws` by default.
157
+
158
+ Installed plugins are stored under `data/plugins/{author}__{name}`. Runtime plugin processes normally run as separate Python processes and connect back via stdio or debug WebSocket.
159
+
160
+ ## Box Runtime
161
+
162
+ `lbp box` enters `box/server.py::main()` and serves `BoxRuntime` through action RPC.
163
+
164
+ Box graph:
165
+
166
+ ```text
167
+ LangBot BoxService
168
+ ↔ BoxRuntimeConnector
169
+ ↔ BoxServerHandler
170
+ → BoxRuntime
171
+ → Backend session(s)
172
+ → Docker/Podman, nsjail, or E2B sandbox
173
+ ```
174
+
175
+ Important modules:
176
+
177
+ - `box/server.py`: CLI entrypoint, aiohttp WebSocket routes, `BoxServerHandler` action registration.
178
+ - `box/runtime.py`: session lifecycle, per-session locks, TTL cleanup, command execution, managed processes.
179
+ - `box/models.py`: `BoxSpec`, execution results, managed-process specs.
180
+ - `box/client.py`: action-RPC client used by LangBot-side connector/service.
181
+ - `box/actions.py`: `LangBotToBoxAction` enum.
182
+ - `box/backend.py`: backend abstraction and local backend selection.
183
+ - `box/nsjail_backend.py`: nsjail backend.
184
+ - `box/e2b_backend.py`: E2B backend.
185
+ - `box/skill_store.py`: Box-owned skill package CRUD and install/preview helpers.
186
+ - `box/security.py`: path/security helper logic.
187
+
188
+ Default Box WebSocket endpoints on port `5410`:
189
+
190
+ - `/rpc/ws`: action RPC control channel.
191
+ - `/v1/sessions/{session_id}/managed-process/ws`: legacy default process stdio relay.
192
+ - `/v1/sessions/{session_id}/managed-process/{process_id}/ws`: named process stdio relay.
193
+
194
+ There is no supported `python -m langbot_plugin.box` entrypoint; use `lbp box`.
195
+
196
+ ## Backend Selection
197
+
198
+ Box can execute through multiple sandbox backends:
199
+
200
+ - Docker/Podman through the local CLI backend path.
201
+ - nsjail for local Linux sandboxing.
202
+ - E2B for remote cloud sandboxes.
203
+
204
+ LangBot sends Box config during initialization. Backend selection is controlled by LangBot's `box.backend` config (`local`, `docker`, `nsjail`, `e2b`) and the Box runtime's backend availability probes.
205
+
206
+ A false “no backend” often means Docker exists but the user cannot access the Docker socket. nsjail inside containers requires host cgroup namespace for cgroup v2 limits if hard memory/pid/cpu enforcement is expected.
207
+
208
+ ## Cross-Repo Development Flow
209
+
210
+ When changing shared contracts:
211
+
212
+ 1. Change this SDK repo first or in the same branch set.
213
+ 2. Install the local SDK into LangBot's virtualenv: `uv pip install .` from this repo while LangBot's `.venv` is active.
214
+ 3. Run LangBot with `uv run --no-sync ...` so `uv` does not replace the local SDK with the pinned PyPI package.
215
+ 4. Exercise the exact path changed: plugin stdio, plugin WebSocket, `lbp run`, `lbp rt`, `lbp box`, Box WebSocket, or Box stdio.
216
+
217
+ The SDK `AGENTS.md` keeps the short command checklist; this file keeps the structural map.
218
+
219
+ ## Design Biases
220
+
221
+ - Keep plugin-author SDK APIs stable and explicit.
222
+ - Treat action enums and Pydantic models as cross-process API contracts.
223
+ - Keep runtime process management separate from LangBot product logic.
224
+ - Keep Box sandbox semantics in `box/`; LangBot should call Box through the service/client protocol.
225
+ - Prefer tests around protocol shape and black-box CLI behavior when changing runtime boundaries.
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: langbot-plugin
3
+ Version: 0.4.7
4
+ Summary: This package contains the SDK, CLI for building plugins for LangBot, plus the runtime for hosting LangBot plugins
5
+ Project-URL: Homepage, https://langbot.app
6
+ Project-URL: Repository, https://github.com/langbot-app/langbot-plugin-sdk
7
+ Project-URL: Issues, https://github.com/langbot-app/langbot-plugin-sdk/issues
8
+ Author-email: Junyan Qin <rockchinq@gmail.com>
9
+ License-File: LICENSE
10
+ Requires-Python: >=3.10
11
+ Requires-Dist: aiofiles>=24.1.0
12
+ Requires-Dist: aiohttp>=3.9.0
13
+ Requires-Dist: dotenv>=0.9.9
14
+ Requires-Dist: e2b>=2.15
15
+ Requires-Dist: httpx>=0.28.1
16
+ Requires-Dist: jinja2>=3.1.6
17
+ Requires-Dist: packaging>=24.0
18
+ Requires-Dist: pip>=25.2
19
+ Requires-Dist: pydantic-settings>=2.10.1
20
+ Requires-Dist: pydantic>=2.11.5
21
+ Requires-Dist: pytest>=8.4.0
22
+ Requires-Dist: pyyaml>=6.0.2
23
+ Requires-Dist: textual>=3.2.0
24
+ Requires-Dist: types-aiofiles>=24.1.0.20250516
25
+ Requires-Dist: types-pyyaml>=6.0.12.20250516
26
+ Requires-Dist: watchdog>=6.0.0
27
+ Requires-Dist: websockets>=15.0.1
28
+ Description-Content-Type: text/markdown
29
+
30
+ <div align="center">
31
+
32
+ <h1>LangBot Plugin Infra</h1>
33
+
34
+ <p>Plugin SDK, CLI, Plugin Runtime and Box sandbox runtime for <a href="https://github.com/langbot-app/LangBot">LangBot</a>.</p>
35
+
36
+ [![PyPI](https://img.shields.io/pypi/v/langbot-plugin)](https://pypi.org/project/langbot-plugin/)
37
+ [![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
38
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE)
39
+
40
+ English / [简体中文](README_CN.md)
41
+
42
+ [Documentation](https://docs.langbot.app/zh/plugin/dev/tutor) ·
43
+ [Plugin Market](https://space.langbot.app) ·
44
+ [LangBot](https://github.com/langbot-app/LangBot)
45
+
46
+ </div>
47
+
48
+ ## Overview
49
+
50
+ This repository is the shared infrastructure powering LangBot's plugin and
51
+ sandbox subsystems. It is published to PyPI as the single
52
+ [`langbot-plugin`](https://pypi.org/project/langbot-plugin/) package and ships
53
+ three things:
54
+
55
+ - **Plugin SDK & CLI** (`lbp`) — Python APIs, base classes and the `lbp`
56
+ command for scaffolding, building, debugging and publishing plugins.
57
+ - **Plugin Runtime** (`lbp rt`) — the host process that discovers, installs and
58
+ runs plugins, bridging them to LangBot over stdio or WebSocket.
59
+ - **Box Runtime** (`lbp box`) — the code-sandbox service backing LangBot's Box
60
+ subsystem, executing untrusted code via Docker / nsjail / E2B backends.
61
+
62
+ LangBot depends on this package as the pinned `langbot-plugin==<x.y.z>` in its
63
+ `pyproject.toml`; the canonical version lives in this repo's `pyproject.toml`.
64
+
65
+ > The **Runtime** component (`src/langbot_plugin/runtime/`) is licensed
66
+ > separately under **AGPL**; everything else in this repository is **Apache 2.0**.
67
+ > See [`src/langbot_plugin/runtime/README.md`](src/langbot_plugin/runtime/README.md).
68
+
69
+ ## Install
70
+
71
+ ```bash
72
+ pip install langbot-plugin
73
+ # or, recommended
74
+ uv tool install langbot-plugin
75
+
76
+ lbp --help
77
+ ```
78
+
79
+ ## CLI at a glance
80
+
81
+ | Command | Purpose |
82
+ | --- | --- |
83
+ | `lbp init <name>` | Scaffold a new plugin project |
84
+ | `lbp comp <Type>` | Generate a component (Command / Tool / EventListener / KnowledgeEngine / Parser / Page) |
85
+ | `lbp run` | Run / remote-debug a plugin against a running LangBot |
86
+ | `lbp build` | Package the plugin into a distributable zip |
87
+ | `lbp publish` | Publish to the LangBot Plugin Market |
88
+ | `lbp login` / `lbp logout` | Authenticate with your LangBot account |
89
+ | `lbp rt` | Launch a standalone Plugin Runtime (control `5400`, debug `5401`) |
90
+ | `lbp box` | Launch a standalone Box sandbox runtime (default port `5410`) |
91
+ | `lbp ver` | Print the CLI / package version |
92
+
93
+ ## Component types
94
+
95
+ Plugins extend LangBot through six component types, scaffolded with
96
+ `lbp comp <Type>`:
97
+
98
+ - **Command** — user-triggered actions (e.g. `!weather tokyo`)
99
+ - **Tool** — LLM-callable functions for AI agents
100
+ - **EventListener** — handlers for message-pipeline events
101
+ - **KnowledgeEngine** — custom knowledge-base retrieval for RAG
102
+ - **Parser** — custom message / content parsing
103
+ - **Page** — custom web page embedded in the LangBot admin panel
104
+
105
+ ## Documentation
106
+
107
+ - Plugin development tutorial — https://docs.langbot.app/zh/plugin/dev/tutor
108
+ - Debugging the Runtime / CLI / SDK — https://docs.langbot.app/zh/develop/plugin-runtime
109
+ - Dev environment setup — https://docs.langbot.app/zh/develop/dev-config
110
+
111
+ ## License
112
+
113
+ Apache 2.0, except the Plugin Runtime (`src/langbot_plugin/runtime/`) which is
114
+ AGPL. See [LICENSE](LICENSE) and the
115
+ [Runtime README](src/langbot_plugin/runtime/README.md).
@@ -0,0 +1,86 @@
1
+ <div align="center">
2
+
3
+ <h1>LangBot Plugin Infra</h1>
4
+
5
+ <p>Plugin SDK, CLI, Plugin Runtime and Box sandbox runtime for <a href="https://github.com/langbot-app/LangBot">LangBot</a>.</p>
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/langbot-plugin)](https://pypi.org/project/langbot-plugin/)
8
+ [![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
9
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE)
10
+
11
+ English / [简体中文](README_CN.md)
12
+
13
+ [Documentation](https://docs.langbot.app/zh/plugin/dev/tutor) ·
14
+ [Plugin Market](https://space.langbot.app) ·
15
+ [LangBot](https://github.com/langbot-app/LangBot)
16
+
17
+ </div>
18
+
19
+ ## Overview
20
+
21
+ This repository is the shared infrastructure powering LangBot's plugin and
22
+ sandbox subsystems. It is published to PyPI as the single
23
+ [`langbot-plugin`](https://pypi.org/project/langbot-plugin/) package and ships
24
+ three things:
25
+
26
+ - **Plugin SDK & CLI** (`lbp`) — Python APIs, base classes and the `lbp`
27
+ command for scaffolding, building, debugging and publishing plugins.
28
+ - **Plugin Runtime** (`lbp rt`) — the host process that discovers, installs and
29
+ runs plugins, bridging them to LangBot over stdio or WebSocket.
30
+ - **Box Runtime** (`lbp box`) — the code-sandbox service backing LangBot's Box
31
+ subsystem, executing untrusted code via Docker / nsjail / E2B backends.
32
+
33
+ LangBot depends on this package as the pinned `langbot-plugin==<x.y.z>` in its
34
+ `pyproject.toml`; the canonical version lives in this repo's `pyproject.toml`.
35
+
36
+ > The **Runtime** component (`src/langbot_plugin/runtime/`) is licensed
37
+ > separately under **AGPL**; everything else in this repository is **Apache 2.0**.
38
+ > See [`src/langbot_plugin/runtime/README.md`](src/langbot_plugin/runtime/README.md).
39
+
40
+ ## Install
41
+
42
+ ```bash
43
+ pip install langbot-plugin
44
+ # or, recommended
45
+ uv tool install langbot-plugin
46
+
47
+ lbp --help
48
+ ```
49
+
50
+ ## CLI at a glance
51
+
52
+ | Command | Purpose |
53
+ | --- | --- |
54
+ | `lbp init <name>` | Scaffold a new plugin project |
55
+ | `lbp comp <Type>` | Generate a component (Command / Tool / EventListener / KnowledgeEngine / Parser / Page) |
56
+ | `lbp run` | Run / remote-debug a plugin against a running LangBot |
57
+ | `lbp build` | Package the plugin into a distributable zip |
58
+ | `lbp publish` | Publish to the LangBot Plugin Market |
59
+ | `lbp login` / `lbp logout` | Authenticate with your LangBot account |
60
+ | `lbp rt` | Launch a standalone Plugin Runtime (control `5400`, debug `5401`) |
61
+ | `lbp box` | Launch a standalone Box sandbox runtime (default port `5410`) |
62
+ | `lbp ver` | Print the CLI / package version |
63
+
64
+ ## Component types
65
+
66
+ Plugins extend LangBot through six component types, scaffolded with
67
+ `lbp comp <Type>`:
68
+
69
+ - **Command** — user-triggered actions (e.g. `!weather tokyo`)
70
+ - **Tool** — LLM-callable functions for AI agents
71
+ - **EventListener** — handlers for message-pipeline events
72
+ - **KnowledgeEngine** — custom knowledge-base retrieval for RAG
73
+ - **Parser** — custom message / content parsing
74
+ - **Page** — custom web page embedded in the LangBot admin panel
75
+
76
+ ## Documentation
77
+
78
+ - Plugin development tutorial — https://docs.langbot.app/zh/plugin/dev/tutor
79
+ - Debugging the Runtime / CLI / SDK — https://docs.langbot.app/zh/develop/plugin-runtime
80
+ - Dev environment setup — https://docs.langbot.app/zh/develop/dev-config
81
+
82
+ ## License
83
+
84
+ Apache 2.0, except the Plugin Runtime (`src/langbot_plugin/runtime/`) which is
85
+ AGPL. See [LICENSE](LICENSE) and the
86
+ [Runtime README](src/langbot_plugin/runtime/README.md).
@@ -0,0 +1,83 @@
1
+ <div align="center">
2
+
3
+ <h1>LangBot Plugin Infra</h1>
4
+
5
+ <p>为 <a href="https://github.com/langbot-app/LangBot">LangBot</a> 提供插件 SDK、CLI、插件运行时与 Box 代码沙箱运行时。</p>
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/langbot-plugin)](https://pypi.org/project/langbot-plugin/)
8
+ [![Python](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
9
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE)
10
+
11
+ [English](README.md) / 简体中文
12
+
13
+ [文档](https://docs.langbot.app/zh/plugin/dev/tutor) ·
14
+ [插件市场](https://space.langbot.app) ·
15
+ [LangBot](https://github.com/langbot-app/LangBot)
16
+
17
+ </div>
18
+
19
+ ## 简介
20
+
21
+ 此仓库是支撑 LangBot **插件系统**与**代码沙箱**的共享基础设施,以单一的
22
+ [`langbot-plugin`](https://pypi.org/project/langbot-plugin/) 包发布到 PyPI,包含三部分:
23
+
24
+ - **插件 SDK 与 CLI**(`lbp`)—— 插件开发的 Python API、基类,以及用于脚手架、
25
+ 构建、调试和发布插件的 `lbp` 命令。
26
+ - **插件运行时**(`lbp rt`)—— 负责发现、安装并运行插件的宿主进程,通过 stdio
27
+ 或 WebSocket 与 LangBot 通信。
28
+ - **Box 运行时**(`lbp box`)—— 支撑 LangBot Box 子系统的代码沙箱服务,通过
29
+ Docker / nsjail / E2B 后端执行不受信任的代码。
30
+
31
+ LangBot 通过 `pyproject.toml` 中固定的 `langbot-plugin==<x.y.z>` 依赖此包;
32
+ 版本号以本仓库的 `pyproject.toml` 为准。
33
+
34
+ > **运行时**组件(`src/langbot_plugin/runtime/`)单独采用 **AGPL** 许可证,
35
+ > 本仓库其余部分采用 **Apache 2.0**,详见
36
+ > [`src/langbot_plugin/runtime/README.md`](src/langbot_plugin/runtime/README.md)。
37
+
38
+ ## 安装
39
+
40
+ ```bash
41
+ pip install langbot-plugin
42
+ # 或(推荐)
43
+ uv tool install langbot-plugin
44
+
45
+ lbp --help
46
+ ```
47
+
48
+ ## CLI 速览
49
+
50
+ | 命令 | 作用 |
51
+ | --- | --- |
52
+ | `lbp init <name>` | 初始化一个插件项目 |
53
+ | `lbp comp <Type>` | 生成组件(Command / Tool / EventListener / KnowledgeEngine / Parser / Page) |
54
+ | `lbp run` | 针对运行中的 LangBot 运行 / 远程调试插件 |
55
+ | `lbp build` | 将插件打包为可分发的 zip |
56
+ | `lbp publish` | 发布到 LangBot 插件市场 |
57
+ | `lbp login` / `lbp logout` | 登录 / 登出 LangBot 账号 |
58
+ | `lbp rt` | 启动独立的插件运行时(控制端口 `5400`,调试端口 `5401`) |
59
+ | `lbp box` | 启动独立的 Box 代码沙箱运行时(默认端口 `5410`) |
60
+ | `lbp ver` | 打印 CLI / 包版本 |
61
+
62
+ ## 组件类型
63
+
64
+ 插件通过六种组件类型扩展 LangBot,使用 `lbp comp <Type>` 生成:
65
+
66
+ - **Command** —— 用户触发的指令(如 `!weather tokyo`)
67
+ - **Tool** —— 供 AI Agent 调用的 LLM 工具函数
68
+ - **EventListener** —— 消息流水线事件的处理器
69
+ - **KnowledgeEngine** —— 用于 RAG 的自定义知识库检索
70
+ - **Parser** —— 自定义消息 / 内容解析
71
+ - **Page** —— 嵌入 LangBot 管理面板的自定义网页
72
+
73
+ ## 文档
74
+
75
+ - 插件开发教程 —— https://docs.langbot.app/zh/plugin/dev/tutor
76
+ - 调试运行时 / CLI / SDK —— https://docs.langbot.app/zh/develop/plugin-runtime
77
+ - 开发环境配置 —— https://docs.langbot.app/zh/develop/dev-config
78
+
79
+ ## 许可证
80
+
81
+ 本仓库采用 Apache 2.0,但插件运行时(`src/langbot_plugin/runtime/`)单独采用
82
+ AGPL。详见 [LICENSE](LICENSE) 与
83
+ [运行时 README](src/langbot_plugin/runtime/README.md)。