langbot-plugin 0.4.0b1__tar.gz → 0.4.2__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 (244) hide show
  1. langbot_plugin-0.4.2/.github/workflows/test.yml +46 -0
  2. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/AGENTS.md +173 -83
  3. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/PKG-INFO +2 -1
  4. langbot_plugin-0.4.2/docs/PluginPages.md +465 -0
  5. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/pyproject.toml +19 -2
  6. langbot_plugin-0.4.2/src/langbot_plugin/api/definition/components/page/__init__.py +70 -0
  7. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/command/context.py +2 -3
  8. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/command/errors.py +4 -4
  9. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/provider/message.py +4 -1
  10. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/proxies/langbot_api.py +3 -1
  11. langbot_plugin-0.4.2/src/langbot_plugin/assets/langbot-page-sdk.js +271 -0
  12. langbot_plugin-0.4.2/src/langbot_plugin/assets/templates/.github/workflows/release.yml.example +77 -0
  13. langbot_plugin-0.4.2/src/langbot_plugin/assets/templates/README.md.example +15 -0
  14. langbot_plugin-0.4.2/src/langbot_plugin/assets/templates/components/pages/{page_name}.html.example +31 -0
  15. langbot_plugin-0.4.2/src/langbot_plugin/assets/templates/components/pages/{page_name}.yaml.example +12 -0
  16. langbot_plugin-0.4.2/src/langbot_plugin/assets/templates/readme/README_zh_Hans.md.example +15 -0
  17. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/client.py +6 -0
  18. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/nsjail_backend.py +80 -14
  19. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/runtime.py +4 -5
  20. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/__init__.py +31 -1
  21. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/commands/buildplugin.py +23 -0
  22. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/commands/gencomponent.py +9 -7
  23. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/commands/initplugin.py +4 -0
  24. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/commands/runplugin.py +30 -12
  25. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/gen/renderer.py +51 -0
  26. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/run/controller.py +2 -0
  27. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/run/handler.py +73 -4
  28. langbot_plugin-0.4.2/src/langbot_plugin/cli/utils/page_components.py +56 -0
  29. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/entities/io/actions/enums.py +10 -0
  30. langbot_plugin-0.4.2/src/langbot_plugin/entities/io/errors.py +91 -0
  31. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/app.py +5 -0
  32. langbot_plugin-0.4.2/src/langbot_plugin/runtime/helper/pkgmgr.py +369 -0
  33. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/controllers/ws/client.py +10 -1
  34. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/handler.py +4 -0
  35. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/handlers/control.py +37 -0
  36. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/handlers/plugin.py +21 -2
  37. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/plugin/container.py +3 -4
  38. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/plugin/mgr.py +128 -25
  39. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/utils/discover/engine.py +3 -0
  40. langbot_plugin-0.4.2/src/langbot_plugin/utils/importutil.py +52 -0
  41. langbot_plugin-0.4.2/src/langbot_plugin/version.py +1 -0
  42. langbot_plugin-0.4.2/tests/__init__.py +1 -0
  43. langbot_plugin-0.4.2/tests/api/definition/components/test_components.py +97 -0
  44. langbot_plugin-0.4.2/tests/api/definition/test_manifest.py +124 -0
  45. langbot_plugin-0.4.2/tests/api/entities/builtin/test_command_context.py +77 -0
  46. langbot_plugin-0.4.2/tests/api/entities/builtin/test_platform_logger.py +23 -0
  47. langbot_plugin-0.4.2/tests/api/entities/builtin/test_provider_message.py +107 -0
  48. langbot_plugin-0.4.2/tests/api/entities/builtin/test_rag_models.py +133 -0
  49. langbot_plugin-0.4.2/tests/api/entities/test_context.py +163 -0
  50. langbot_plugin-0.4.2/tests/api/proxies/test_base.py +11 -0
  51. langbot_plugin-0.4.2/tests/api/proxies/test_langbot_api.py +218 -0
  52. langbot_plugin-0.4.2/tests/api/proxies/test_query_based_api.py +96 -0
  53. langbot_plugin-0.4.2/tests/box/test_backend.py +865 -0
  54. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/tests/box/test_backend_selection.py +37 -17
  55. langbot_plugin-0.4.2/tests/box/test_client.py +658 -0
  56. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/tests/box/test_e2b_backend.py +6 -6
  57. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/tests/box/test_nsjail_backend.py +117 -24
  58. langbot_plugin-0.4.2/tests/box/test_runtime.py +805 -0
  59. langbot_plugin-0.4.2/tests/box/test_server.py +859 -0
  60. langbot_plugin-0.4.2/tests/box/test_skill_store.py +914 -0
  61. langbot_plugin-0.4.2/tests/cli/run/test_controller.py +172 -0
  62. langbot_plugin-0.4.2/tests/cli/run/test_runtime_handler.py +338 -0
  63. langbot_plugin-0.4.2/tests/cli/test_buildplugin.py +81 -0
  64. langbot_plugin-0.4.2/tests/cli/test_gencomponent.py +90 -0
  65. langbot_plugin-0.4.2/tests/cli/test_i18n_form.py +63 -0
  66. langbot_plugin-0.4.2/tests/cli/test_initplugin.py +104 -0
  67. langbot_plugin-0.4.2/tests/cli/test_login.py +516 -0
  68. langbot_plugin-0.4.2/tests/cli/test_logout_publish.py +184 -0
  69. langbot_plugin-0.4.2/tests/cli/test_page_components.py +63 -0
  70. langbot_plugin-0.4.2/tests/cli/test_renderer.py +64 -0
  71. langbot_plugin-0.4.2/tests/cli/test_runplugin.py +257 -0
  72. langbot_plugin-0.4.2/tests/entities/io/test_dependency_errors.py +59 -0
  73. langbot_plugin-0.4.2/tests/entities/io/test_protocol.py +88 -0
  74. langbot_plugin-0.4.2/tests/helpers/__init__.py +1 -0
  75. langbot_plugin-0.4.2/tests/helpers/protocol.py +120 -0
  76. langbot_plugin-0.4.2/tests/runtime/helper/test_marketplace.py +131 -0
  77. langbot_plugin-0.4.2/tests/runtime/helper/test_pkgmgr.py +388 -0
  78. langbot_plugin-0.4.2/tests/runtime/io/handlers/test_control_handler.py +452 -0
  79. langbot_plugin-0.4.2/tests/runtime/io/handlers/test_import_contracts.py +24 -0
  80. langbot_plugin-0.4.2/tests/runtime/io/handlers/test_plugin_handler.py +317 -0
  81. langbot_plugin-0.4.2/tests/runtime/io/test_connections.py +148 -0
  82. langbot_plugin-0.4.2/tests/runtime/io/test_controllers.py +196 -0
  83. langbot_plugin-0.4.2/tests/runtime/io/test_handler.py +578 -0
  84. langbot_plugin-0.4.2/tests/runtime/plugin/test_container.py +124 -0
  85. langbot_plugin-0.4.2/tests/runtime/plugin/test_manager.py +596 -0
  86. langbot_plugin-0.4.2/tests/runtime/test_app.py +389 -0
  87. langbot_plugin-0.4.2/tests/utils/test_discovery.py +120 -0
  88. langbot_plugin-0.4.2/tests/utils/test_importutil.py +54 -0
  89. langbot_plugin-0.4.2/tests/utils/test_platform.py +9 -0
  90. langbot_plugin-0.4.0b1/src/langbot_plugin/assets/templates/README.md.example +0 -3
  91. langbot_plugin-0.4.0b1/src/langbot_plugin/entities/io/errors.py +0 -31
  92. langbot_plugin-0.4.0b1/src/langbot_plugin/runtime/helper/pkgmgr.py +0 -129
  93. langbot_plugin-0.4.0b1/src/langbot_plugin/utils/importutil.py +0 -38
  94. langbot_plugin-0.4.0b1/src/langbot_plugin/version.py +0 -1
  95. langbot_plugin-0.4.0b1/tests/box/test_skill_store.py +0 -88
  96. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/.github/workflows/publish-pypi.yaml +0 -0
  97. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/.gitignore +0 -0
  98. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/.python-version +0 -0
  99. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/CLAUDE.md +0 -0
  100. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/LICENSE +0 -0
  101. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/README.md +0 -0
  102. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/data/.env.example +0 -0
  103. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/docs/Message.md +0 -0
  104. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/docs/communication/apis/lb2rt.md +0 -0
  105. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/docs/communication/runtime_plugin.md +0 -0
  106. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/docs/dependency-management.md +0 -0
  107. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/docs/langbot-plugin-social.png +0 -0
  108. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/__init__.py +0 -0
  109. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/__init__.py +0 -0
  110. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/__init__.py +0 -0
  111. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/abstract/__init__.py +0 -0
  112. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/abstract/platform/__init__.py +0 -0
  113. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/abstract/platform/adapter.py +0 -0
  114. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/abstract/platform/event_logger.py +0 -0
  115. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/__init__.py +0 -0
  116. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/base.py +0 -0
  117. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/command/__init__.py +0 -0
  118. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/command/command.py +0 -0
  119. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/common/__init__.py +0 -0
  120. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/common/event_listener.py +0 -0
  121. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/knowledge_engine/__init__.py +0 -0
  122. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/knowledge_engine/engine.py +0 -0
  123. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/manifest.py +0 -0
  124. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/parser/__init__.py +0 -0
  125. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/parser/parser.py +0 -0
  126. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/tool/__init__.py +0 -0
  127. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/components/tool/tool.py +0 -0
  128. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/definition/plugin.py +0 -0
  129. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/__init__.py +0 -0
  130. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/__init__.py +0 -0
  131. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/command/__init__.py +0 -0
  132. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/pipeline/__init__.py +0 -0
  133. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/pipeline/query.py +0 -0
  134. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/platform/__init__.py +0 -0
  135. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/platform/entities.py +0 -0
  136. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/platform/events.py +0 -0
  137. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/platform/logger.py +0 -0
  138. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/platform/message.py +0 -0
  139. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/provider/__init__.py +0 -0
  140. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/provider/prompt.py +0 -0
  141. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/provider/session.py +0 -0
  142. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/rag/__init__.py +0 -0
  143. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/rag/context.py +0 -0
  144. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/rag/enums.py +0 -0
  145. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/rag/errors.py +0 -0
  146. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/rag/models.py +0 -0
  147. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/resource/__init__.py +0 -0
  148. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/builtin/resource/tool.py +0 -0
  149. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/context.py +0 -0
  150. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/entities/events.py +0 -0
  151. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/proxies/__init__.py +0 -0
  152. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/proxies/base.py +0 -0
  153. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/proxies/event_context.py +0 -0
  154. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/proxies/execute_context.py +0 -0
  155. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/api/proxies/query_based_api.py +0 -0
  156. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/__init__.py +0 -0
  157. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/.env.example.example +0 -0
  158. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/.gitignore.example +0 -0
  159. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/.vscode/launch.json.example +0 -0
  160. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/__init__.py +0 -0
  161. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/assets/icon.svg.example +0 -0
  162. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/__init__.py +0 -0
  163. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/commands/__init__.py +0 -0
  164. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.py.example +0 -0
  165. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.yaml.example +0 -0
  166. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/event_listener/__init__.py +0 -0
  167. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/event_listener/default.py.example +0 -0
  168. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/event_listener/default.yaml.example +0 -0
  169. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/knowledge_engine/__init__.py +0 -0
  170. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.py.example +0 -0
  171. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.yaml.example +0 -0
  172. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/parser/__init__.py +0 -0
  173. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.py.example +0 -0
  174. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.yaml.example +0 -0
  175. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/tools/__init__.py +0 -0
  176. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.py.example +0 -0
  177. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.yaml.example +0 -0
  178. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/main.py.example +0 -0
  179. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/manifest.yaml.example +0 -0
  180. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/assets/templates/requirements.txt.example +0 -0
  181. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/__init__.py +0 -0
  182. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/actions.py +0 -0
  183. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/backend.py +0 -0
  184. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/e2b_backend.py +0 -0
  185. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/errors.py +0 -0
  186. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/models.py +0 -0
  187. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/security.py +0 -0
  188. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/server.py +0 -0
  189. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/box/skill_store.py +0 -0
  190. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/__main__.py +0 -0
  191. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/commands/__init__.py +0 -0
  192. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/commands/login.py +0 -0
  193. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/commands/logout.py +0 -0
  194. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/commands/publish.py +0 -0
  195. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/gen/__init__.py +0 -0
  196. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/i18n.py +0 -0
  197. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/locales/__init__.py +0 -0
  198. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/locales/en_US.py +0 -0
  199. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/locales/es_ES.py +0 -0
  200. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/locales/ja_JP.py +0 -0
  201. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/locales/th_TH.py +0 -0
  202. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/locales/vi_VN.py +0 -0
  203. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/locales/zh_Hans.py +0 -0
  204. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/locales/zh_Hant.py +0 -0
  205. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/run/__init__.py +0 -0
  206. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/run/hotreload.py +0 -0
  207. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/utils/__init__.py +0 -0
  208. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/utils/cloudsv.py +0 -0
  209. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/cli/utils/form.py +0 -0
  210. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/entities/__init__.py +0 -0
  211. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/entities/io/__init__.py +0 -0
  212. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/entities/io/actions/__init__.py +0 -0
  213. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/entities/io/req.py +0 -0
  214. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/entities/io/resp.py +0 -0
  215. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/entities/marketplace.py +0 -0
  216. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/LICENSE +0 -0
  217. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/README.md +0 -0
  218. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/__init__.py +0 -0
  219. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/context.py +0 -0
  220. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/helper/__init__.py +0 -0
  221. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/helper/marketplace.py +0 -0
  222. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/__init__.py +0 -0
  223. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/connection.py +0 -0
  224. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/connections/__init__.py +0 -0
  225. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/connections/stdio.py +0 -0
  226. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/connections/ws.py +0 -0
  227. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/controller.py +0 -0
  228. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/controllers/__init__.py +0 -0
  229. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/controllers/stdio/__init__.py +0 -0
  230. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/controllers/stdio/client.py +0 -0
  231. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/controllers/stdio/server.py +0 -0
  232. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/controllers/ws/__init__.py +0 -0
  233. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/controllers/ws/server.py +0 -0
  234. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/io/handlers/__init__.py +0 -0
  235. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/plugin/__init__.py +0 -0
  236. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/runtime/settings.py +0 -0
  237. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/utils/__init__.py +0 -0
  238. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/utils/discover/__init__.py +0 -0
  239. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/utils/log.py +0 -0
  240. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/src/langbot_plugin/utils/platform.py +0 -0
  241. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/tests/api/entities/test_events.py +0 -0
  242. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/tests/box/__init__.py +0 -0
  243. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/tests/test_log.py +0 -0
  244. {langbot_plugin-0.4.0b1 → langbot_plugin-0.4.2}/tests/test_message.py +0 -0
@@ -0,0 +1,46 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - test-build
8
+ pull_request:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ unit-tests:
15
+ name: Unit Tests
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ python-version: ["3.10", "3.11", "3.12"]
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+ with:
24
+ persist-credentials: false
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@v6
27
+ - name: Set up Python
28
+ run: uv python install ${{ matrix.python-version }}
29
+ - name: Run tests with coverage
30
+ run: |
31
+ uv run --python ${{ matrix.python-version }} pytest \
32
+ --cov=langbot_plugin \
33
+ --cov-report=term-missing \
34
+ --cov-fail-under=75
35
+
36
+ test-lint:
37
+ name: Test Lint
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+ with:
42
+ persist-credentials: false
43
+ - name: Install uv
44
+ uses: astral-sh/setup-uv@v6
45
+ - name: Ruff tests
46
+ run: uv run ruff check tests --output-format=concise
@@ -1,21 +1,29 @@
1
1
  # AGENTS.md
2
2
 
3
- This file is for guiding code agents (like Claude Code, GitHub Copilot, OpenAI Codex, etc.) to work in the langbot-plugin-sdk project.
3
+ This file is for guiding code agents (like Claude Code, GitHub Copilot, OpenAI Codex, etc.) to work in the langbot-plugin-sdk project. `CLAUDE.md` is a symlink to this file.
4
4
 
5
- **IMPORTANT**: This document may contain outdated information and may differ from the actual content. Please refer to the actual situation for accuracy.
5
+ > Always verify specifics (file paths, CLI flags, function signatures) against the actual source before relying on them. When you find this doc out of date, fix it as part of your change.
6
6
 
7
7
  ## Project Overview
8
8
 
9
9
  LangBot Plugin SDK is the infrastructure for LangBot's plugin system, providing:
10
10
  - **Plugin SDK**: Python APIs and interfaces for plugin development
11
- - **Plugin Runtime**: Execution environment managing plugin lifecycle
12
- - **CLI Tools**: `lbp` command for scaffolding, building, and debugging plugins
11
+ - **Plugin Runtime**: Execution environment managing plugin lifecycle (`lbp rt`)
12
+ - **Box Runtime**: Code-sandbox runtime service backing LangBot's Box subsystem (`lbp box`)
13
+ - **CLI Tools**: `lbp` command for scaffolding, building, debugging, and running runtimes
13
14
  - **Communication Protocol**: Bidirectional action-based protocol (stdio/WebSocket)
14
15
 
15
- The SDK enables developers to extend LangBot with custom:
16
- - **Commands**: User-triggered actions (e.g., `!weather tokyo`)
17
- - **Tools**: LLM-callable functions for AI agents (e.g., web search, database queries)
18
- - **Event Listeners**: Handlers for message events (e.g., auto-reply, content filtering)
16
+ This SDK is the shared dependency between LangBot and plugins; LangBot pins it as `langbot-plugin==<x.y.z>` in its `pyproject.toml`. The package version lives in this repo's `pyproject.toml`.
17
+
18
+ The SDK enables developers to extend LangBot with custom components. Six component types are supported (scaffold any of them with `lbp comp <Type>`):
19
+ - **Command**: User-triggered actions (e.g., `!weather tokyo`)
20
+ - **Tool**: LLM-callable functions for AI agents (e.g., web search, database queries)
21
+ - **EventListener**: Handlers for message-pipeline events (e.g., auto-reply, content filtering)
22
+ - **KnowledgeEngine**: Custom knowledge-base retrieval/integration used by RAG
23
+ - **Parser**: Custom parsing of messages/content
24
+ - **Page**: Custom web page embeddable in the LangBot admin panel
25
+
26
+ Component base classes live in `src/langbot_plugin/api/definition/components/` (`command/`, `tool/`, `common/event_listener.py`, `knowledge_engine/`, `parser/`, `page/`).
19
27
 
20
28
  ## Technology Stack
21
29
 
@@ -47,31 +55,33 @@ langbot-plugin-sdk/
47
55
  │ │ │ ├── command/ # CommandReturn
48
56
  │ │ │ └── provider/ # Session, Conversation
49
57
  │ │ └── proxies/ # API proxy classes
50
- │ │ ├── langbot_api.py # LangBotAPIProxy
51
- │ │ └── query_based.py # QueryBasedAPIProxy
52
58
  │ ├── runtime/ # Plugin runtime system
53
- │ │ ├── plugin/ # Plugin management
54
- │ │ ├── mgr.py # PluginManager
55
- │ │ │ ├── container.py # PluginContainer
56
- │ │ │ └── installer.py # Plugin installation
59
+ │ │ ├── app.py # `lbp rt` entrypoint (runtime_app.main)
60
+ │ │ ├── plugin/ # Plugin management (mgr.py, container.py, installer)
57
61
  │ │ ├── io/ # Communication layer
58
- │ │ │ ├── handler.py # Action handler
59
- │ │ │ ├── stdio.py # Stdio transport
60
- │ │ │ └── websocket.py # WebSocket transport
61
- │ │ └── event/ # Event dispatching
62
- ├── cli/ # Command-line tools
63
- ├── main.py # lbp entrypoint
64
- │ │ ├── init.py # Plugin initialization
65
- │ │ ├── gen/ # Component generation
66
- │ │ └── run.py # Plugin debugging
62
+ │ │ │ ├── connection.py # Base connection
63
+ │ │ │ ├── connections/ # stdio / ws connection impls
64
+ │ │ │ ├── controller.py , controllers/ # client/server controllers (stdio, ws)
65
+ │ │ │ ├── handler.py , handlers/ # action handlers
66
+ │ └── helper/
67
+ │ ├── box/ # Box (code-sandbox) runtime — `lbp box`
68
+ │ │ ├── server.py # `lbp box` entrypoint (box_main)
69
+ │ │ ├── backend.py # Backend abstraction + selection (Docker handled here/runtime)
70
+ │ │ ├── nsjail_backend.py / e2b_backend.py # sandbox backend impls
71
+ │ │ ├── runtime.py , client.py , actions.py , models.py , errors.py , security.py , skill_store.py
72
+ │ ├── cli/ # Command-line tools (`lbp`)
73
+ │ │ ├── __init__.py # lbp entrypoint + argparse subcommands
74
+ │ │ ├── commands/ # init / comp / build / publish / login / logout impls
75
+ │ │ ├── run/ # plugin run (remote-debug) impl
76
+ │ │ ├── gen/ # component generation (Jinja2)
77
+ │ │ ├── i18n.py , locales/ # CLI i18n
78
+ │ │ └── utils/
67
79
  │ ├── entities/ # Internal data structures
68
- │ │ ├── io/ # Communication protocol
69
- │ └── plugin/ # Plugin metadata
70
- │ └── utils/ # Utilities
71
- │ ├── discover/ # Component discovery
72
- │ └── network/ # Network helpers
80
+ │ │ └── io/ # Communication protocol (actions, errors, resp)
81
+ ├── assets/templates/ # Plugin scaffolding templates
82
+ │ └── utils/ # Utilities (discover/, network, log, ...)
73
83
  ├── docs/ # Documentation
74
- ├── pyproject.toml # Python project config
84
+ ├── pyproject.toml # Python project config (version, requires-python >=3.10)
75
85
  └── README.md
76
86
  ```
77
87
 
@@ -113,12 +123,12 @@ langbot-plugin-sdk/
113
123
 
114
124
  ```
115
125
  BasePlugin
116
- ├── Command (1+ per plugin)
117
- │ └── Subcommand handlers
118
- ├── Tool (0+ per plugin)
119
- │ └── call() method
120
- └── EventListener (1 per plugin)
121
- └── Event handlers
126
+ ├── Command Subcommand handlers
127
+ ├── Tool → call() method
128
+ ├── EventListener → event handlers
129
+ ├── KnowledgeEngine → knowledge-base retrieval/integration (RAG)
130
+ ├── Parser → message/content parsing
131
+ └── Page → custom admin-panel web page
122
132
  ```
123
133
 
124
134
  ## SDK Development
@@ -806,84 +816,164 @@ Encapsulates plugin instance with:
806
816
 
807
817
  ### Communication Protocol (`runtime/io/`)
808
818
 
809
- **Action-Based Protocol**:
810
- - Bidirectional JSON messages
811
- - Request-response with sequence IDs
812
- - Streaming support via chunk status
813
- - File transfer (16KB chunks)
814
-
815
- **Action Structure**:
819
+ This protocol is **JSON-RPC 2.0 in all but field names** — a bidirectional, action-based
820
+ RPC carried over a single connection. It is the same shape the Language Server Protocol
821
+ (LSP) and the Model Context Protocol (MCP) use: JSON-RPC 2.0 over stdio / WebSocket, with
822
+ either peer free to initiate calls. We did not adopt the spec verbatim, but the semantics
823
+ map 1:1, and it is useful to think of it that way:
824
+
825
+ | Our field (`entities/io`) | JSON-RPC 2.0 | Meaning |
826
+ |----------------------------|--------------------------|---------|
827
+ | `seq_id` | `id` | Correlates a response back to its request |
828
+ | `action` | `method` | Which action to invoke |
829
+ | `data` (in a request) | `params` | Call arguments |
830
+ | `data` (in a response) | `result` | Return value (when `code == 0`) |
831
+ | `code` + `message` | `error.{code,message}` | `code == 0` is success; non-zero carries the failure in `message` |
832
+ | `chunk_status` | (MCP-style streaming ext.) | `continue` per chunk, `end` closes a streamed response |
833
+
834
+ Both peers share one connection and may call each other's actions. Requests and responses
835
+ are told apart by shape: a message carrying `action` is an inbound request, one carrying
836
+ `code` is a response. Each side allocates `seq_id` from its own incrementing counter, so the
837
+ two id spaces are dispatched independently and never collide.
838
+
839
+ **Request** (`ActionRequest`, `entities/io/req.py`):
816
840
  ```json
817
- {
818
- "action": "action_name",
819
- "seq": 12345,
820
- "data": {...},
821
- "chunk_status": "start|continue|end"
822
- }
841
+ { "seq_id": 12345, "action": "action_name", "data": {} }
823
842
  ```
824
843
 
825
- **Response Structure**:
844
+ **Response** (`ActionResponse`, `entities/io/resp.py`):
826
845
  ```json
827
- {
828
- "seq": 12345,
829
- "ok": true,
830
- "data": {...}
831
- }
846
+ { "seq_id": 12345, "code": 0, "message": "success", "data": {}, "chunk_status": "continue" }
832
847
  ```
833
848
 
834
- **Transport Implementations**:
835
- - `StdioHandler`: stdin/stdout communication
836
- - `WebSocketHandler`: WebSocket client/server
849
+ - `code == 0` → success, payload in `data`; non-zero → error, human-readable text in `message`.
850
+ - **Streaming**: the responder emits N chunks with `chunk_status: "continue"`, then a final
851
+ `chunk_status: "end"` (consumed by `Handler.call_action_generator`).
852
+ - **File transfer**: large blobs travel as `__file_chunk` actions — 16KB base64 chunks,
853
+ reassembled to `data/temp/lbp/<file_key>` on the receiving side.
854
+
855
+ **Core engine**: `runtime/io/handler.py` (`Handler`) owns `seq_id` allocation, the
856
+ `resp_waiters` (single response) and `resp_queues` (streamed response) correlation maps,
857
+ timeouts, and the receive loop (`Handler.run`).
858
+
859
+ **Transport Implementations** (`Connection` subclasses, `runtime/io/connections/`):
860
+ - `stdio.py`: stdin/stdout — default for subprocess (personal / lightweight) plugins
861
+ - `ws.py`: WebSocket — for containerized / remote plugin deployments
837
862
 
838
863
  ## CLI Tools
839
864
 
840
- ### lbp Commands
865
+ ### `lbp` Commands
841
866
 
842
867
  ```bash
843
- # Initialize new plugin
844
- lbp init [plugin_name]
868
+ lbp init [plugin_name] # Scaffold a new plugin
869
+ lbp comp <Command|Tool|EventListener> # Generate a component
870
+ lbp run [-s] # Run/remote-debug the plugin against a running Runtime
871
+ lbp build [-o dist] # Build the plugin into a zip
872
+ lbp publish [-o dist] # Publish to LangBot Marketplace (login first: lbp login)
873
+ lbp login [-t TOKEN] / lbp logout # Marketplace account auth
874
+ lbp rt [...] # Run the Plugin Runtime (see below)
875
+ lbp box [...] # Run the Box (sandbox) Runtime (see below)
876
+ lbp ver # Print SDK version
877
+ ```
845
878
 
846
- # Generate component
847
- lbp comp [Command|Tool|EventListener]
879
+ The CLI entrypoint is `src/langbot_plugin/cli/__init__.py` (argparse). `lbp rt` dispatches to `langbot_plugin.runtime.app.main`; `lbp box` dispatches to `langbot_plugin.box.server.main`. Subcommand implementations live under `cli/commands/`, `cli/run/`, and `cli/gen/`.
848
880
 
849
- # Run plugin locally (requires running LangBot)
850
- lbp run [-s]
881
+ ## Debugging the Runtime, CLI & SDK
851
882
 
852
- # Build plugin for distribution
853
- lbp build
883
+ This is the canonical place for runtime/CLI/box debugging detail (LangBot's own `AGENTS.md` only indexes this section). The corresponding user-facing wiki page is ["调试插件运行时、CLI、SDK"](https://docs.langbot.app/zh/develop/plugin-runtime).
854
884
 
855
- # Publish to marketplace
856
- lbp publish
885
+ ### Recommended workspace layout
886
+
887
+ Because LangBot depends on entities defined here, clone both repos as siblings under one parent dir and open that parent in your editor:
888
+
889
+ ```
890
+ langbot-projects/
891
+ ├── LangBot
892
+ └── langbot-plugin-sdk
893
+ ```
894
+
895
+ Set up LangBot's venv (`cd LangBot && uv sync --dev`) and point your editor's Python interpreter at LangBot's `.venv`.
896
+
897
+ ### Plugin Runtime — `lbp rt`
898
+
899
+ Start a standalone Plugin Runtime from this repo:
857
900
 
858
- # Start runtime (for WebSocket mode)
859
- lbp rt
901
+ ```bash
902
+ uv run --no-sync lbp rt
903
+ # equivalent: python -m langbot_plugin.cli.__init__ rt
860
904
  ```
861
905
 
862
- ### Template System (`cli/gen/`)
906
+ `lbp rt` flags (see `cli/__init__.py`):
907
+
908
+ - `-s`, `--stdio-control`: use stdio for the control connection. **Production only** — in a container LangBot pipes the runtime over stdio.
909
+ - `--ws-control-port` (default `5400`): control port LangBot's main process connects to.
910
+ - `--ws-debug-port` (default `5401`): debug port for `lbp run` to attach a plugin under development.
911
+ - `--debug-only`: do not auto-start plugins in `data/plugins/`; only accept plugins via debug connections.
912
+ - `--skip-deps-check`: skip the per-startup check/install of every installed plugin's dependencies.
913
+ - `--pypi-index-url` / `--pypi-trusted-host`: customize the index used for plugin dependency installs.
863
914
 
864
- - Jinja2-based templates in `assets/templates/`
865
- - Variables: plugin_name, plugin_author, component_name
866
- - Generates boilerplate code and manifests
915
+ > **Transport note:** When LangBot is run directly (not in a container), it spawns the runtime itself and talks **stdio**, which **cannot auto-reconnect** — on disconnect it logs "please restart LangBot". A frequent cause is an **orphan runtime** from a previous backend still holding `5400`/`5401`; kill it and restart.
867
916
 
868
- ## Testing & Debugging
917
+ ### Make LangBot use your locally-modified SDK
869
918
 
870
- ### Local Testing
919
+ If you change shared definitions (message entities, plugin data models, etc.), install your local SDK into LangBot's environment so data formats stay compatible at runtime:
871
920
 
872
- 1. Start LangBot:
873
921
  ```bash
874
- cd /path/to/LangBot
875
- uv run main.py
922
+ # In a terminal where LangBot's .venv is ACTIVE, from the langbot-plugin-sdk dir:
923
+ uv pip install .
924
+ ```
925
+
926
+ ### Make LangBot connect to your standalone Runtime (WebSocket)
927
+
928
+ 1. In LangBot's `data/config.yaml`, set the control URL:
929
+
930
+ ```yaml
931
+ plugin:
932
+ runtime_ws_url: ws://localhost:5400/control/ws
933
+ ```
934
+
935
+ 2. Launch LangBot with `--standalone-runtime` and `--no-sync` (the latter prevents `uv` from overwriting your locally-installed SDK):
936
+
937
+ ```bash
938
+ uv run --no-sync main.py --standalone-runtime
939
+ ```
940
+
941
+ Restart LangBot; it now connects to your `lbp rt` over WebSocket, so you can iterate on the runtime/SDK independently.
942
+
943
+ ### Box Runtime — `lbp box`
944
+
945
+ The Box Runtime is the sandbox service backing LangBot's `pkg/box` subsystem (`src/langbot_plugin/box/`). Start it with:
946
+
947
+ ```bash
948
+ lbp box # WebSocket control transport (default)
949
+ lbp box -s # stdio control transport
876
950
  ```
877
951
 
878
- 2. Run plugin:
952
+ `lbp box` flags:
953
+
954
+ - `--host` (default `0.0.0.0`): bind address.
955
+ - `-s`, `--stdio-control`: use stdio for the control connection (instead of WebSocket).
956
+ - `--ws-control-port` (default `5410`): control port.
957
+
958
+ All Box WebSocket endpoints share one port (default `5410`): `/rpc/ws` (action RPC control channel) plus managed-process stdio relay endpoints under `/v1/sessions/...`. There is **no** `python -m langbot_plugin.box` launch path — `lbp box` is the only supported entrypoint.
959
+
960
+ Box selects the first available sandbox backend among **Docker / nsjail / E2B**. Backends live in `box/backend.py`, `box/nsjail_backend.py`, `box/e2b_backend.py`. A common false "no backend" on the LangBot side is Docker running but the user not in the `docker` group (socket permission denied) — that's a host-permissions issue, not a Box bug.
961
+
962
+ To make LangBot connect to a standalone Box runtime (mirrors the plugin-runtime flow): in LangBot's `data/config.yaml` set `box.runtime.endpoint` to the runtime's base URL (e.g. `ws://127.0.0.1:5410`), pick `box.backend` (`'local'`/`'docker'`/`'nsjail'`/`'e2b'`), and start LangBot with `--standalone-box`. In Docker deployments LangBot reaches the Box runtime at host `langbot_box:5410`.
963
+
964
+ ### Plugin development loop
965
+
879
966
  ```bash
967
+ # 1. Start a LangBot instance (which spawns or connects to a Runtime)
968
+ cd /path/to/LangBot
969
+ uv run main.py
970
+
971
+ # 2. In your plugin dir, attach it to the Runtime's debug port for live debugging
880
972
  cd /path/to/your-plugin
881
973
  lbp run
882
974
  ```
883
975
 
884
- Plugin connects to LangBot via stdio for testing.
885
-
886
- ### Debugging Tips
976
+ ### Debugging tips
887
977
 
888
978
  - Use `print()` statements (output to stderr for visibility)
889
979
  - Check LangBot logs for plugin errors
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langbot-plugin
3
- Version: 0.4.0b1
3
+ Version: 0.4.2
4
4
  Summary: This package contains the SDK, CLI for building plugins for LangBot, plus the runtime for hosting LangBot plugins
5
5
  Project-URL: Homepage, https://langbot.app
6
6
  Project-URL: Repository, https://github.com/langbot-app/langbot-plugin-sdk
@@ -14,6 +14,7 @@ Requires-Dist: dotenv>=0.9.9
14
14
  Requires-Dist: e2b>=2.15
15
15
  Requires-Dist: httpx>=0.28.1
16
16
  Requires-Dist: jinja2>=3.1.6
17
+ Requires-Dist: packaging>=24.0
17
18
  Requires-Dist: pip>=25.2
18
19
  Requires-Dist: pydantic-settings>=2.10.1
19
20
  Requires-Dist: pydantic>=2.11.5