langbot-plugin 0.5.0a2__tar.gz → 0.5.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 (316) hide show
  1. langbot_plugin-0.5.2/.github/workflows/publish.yml +23 -0
  2. langbot_plugin-0.5.2/.github/workflows/test.yml +93 -0
  3. langbot_plugin-0.5.2/AGENTS.md +121 -0
  4. langbot_plugin-0.5.2/ARCHITECTURE.md +378 -0
  5. langbot_plugin-0.5.2/PKG-INFO +115 -0
  6. langbot_plugin-0.5.2/README.md +86 -0
  7. langbot_plugin-0.5.2/README_CN.md +83 -0
  8. langbot_plugin-0.5.2/docs/communication/apis/lb2rt.md +252 -0
  9. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/docs/dependency-management.md +28 -1
  10. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/pyproject.toml +6 -2
  11. langbot_plugin-0.5.2/scripts/check_action_consistency.py +280 -0
  12. langbot_plugin-0.5.2/scripts/runtime_resource_probe.py +449 -0
  13. langbot_plugin-0.5.2/src/langbot_plugin/api/definition/abstract/platform/adapter.py +194 -0
  14. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/command/context.py +11 -1
  15. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/command/errors.py +0 -1
  16. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/pipeline/query.py +22 -1
  17. langbot_plugin-0.5.2/src/langbot_plugin/api/entities/builtin/platform/entities.py +76 -0
  18. langbot_plugin-0.5.2/src/langbot_plugin/api/entities/builtin/platform/events.py +184 -0
  19. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/platform/message.py +49 -8
  20. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/provider/message.py +67 -1
  21. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/provider/session.py +5 -1
  22. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/context.py +30 -4
  23. langbot_plugin-0.5.2/src/langbot_plugin/api/entities/events.py +310 -0
  24. langbot_plugin-0.5.2/src/langbot_plugin/api/entities/execution.py +64 -0
  25. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/proxies/langbot_api.py +139 -52
  26. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/proxies/query_based_api.py +22 -16
  27. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/.env.example.example +2 -2
  28. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/box/__init__.py +1 -1
  29. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/box/actions.py +3 -0
  30. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/box/backend.py +186 -86
  31. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/box/client.py +244 -51
  32. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/box/e2b_backend.py +205 -89
  33. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/box/errors.py +12 -0
  34. langbot_plugin-0.5.2/src/langbot_plugin/box/models.py +552 -0
  35. langbot_plugin-0.5.2/src/langbot_plugin/box/nsjail_backend.py +970 -0
  36. langbot_plugin-0.5.2/src/langbot_plugin/box/runtime.py +2047 -0
  37. langbot_plugin-0.5.2/src/langbot_plugin/box/security.py +105 -0
  38. langbot_plugin-0.5.2/src/langbot_plugin/box/server.py +1299 -0
  39. langbot_plugin-0.5.2/src/langbot_plugin/box/skill_store.py +1015 -0
  40. langbot_plugin-0.5.2/src/langbot_plugin/box/tenancy.py +75 -0
  41. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/__init__.py +6 -8
  42. langbot_plugin-0.5.2/src/langbot_plugin/cli/commands/publish.py +92 -0
  43. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/commands/runplugin.py +17 -5
  44. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/i18n.py +2 -2
  45. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/run/controller.py +41 -3
  46. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/run/handler.py +102 -20
  47. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/run/hotreload.py +8 -4
  48. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/entities/io/actions/enums.py +10 -1
  49. langbot_plugin-0.5.2/src/langbot_plugin/entities/io/context.py +403 -0
  50. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/entities/io/errors.py +3 -1
  51. langbot_plugin-0.5.2/src/langbot_plugin/entities/io/req.py +44 -0
  52. langbot_plugin-0.5.2/src/langbot_plugin/runtime/app.py +350 -0
  53. langbot_plugin-0.5.2/src/langbot_plugin/runtime/bounded_executor.py +334 -0
  54. langbot_plugin-0.5.2/src/langbot_plugin/runtime/context.py +358 -0
  55. langbot_plugin-0.5.2/src/langbot_plugin/runtime/event_loop_monitor.py +98 -0
  56. langbot_plugin-0.5.2/src/langbot_plugin/runtime/helper/marketplace.py +150 -0
  57. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/helper/pkgmgr.py +307 -13
  58. langbot_plugin-0.5.2/src/langbot_plugin/runtime/io/connection.py +49 -0
  59. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/connections/stdio.py +97 -26
  60. langbot_plugin-0.5.2/src/langbot_plugin/runtime/io/connections/ws.py +94 -0
  61. langbot_plugin-0.5.2/src/langbot_plugin/runtime/io/controllers/stdio/client.py +115 -0
  62. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/controllers/ws/client.py +10 -1
  63. langbot_plugin-0.5.2/src/langbot_plugin/runtime/io/controllers/ws/server.py +122 -0
  64. langbot_plugin-0.5.2/src/langbot_plugin/runtime/io/handler.py +838 -0
  65. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/handlers/control.py +346 -32
  66. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/handlers/plugin.py +326 -98
  67. langbot_plugin-0.5.2/src/langbot_plugin/runtime/plugin/artifact.py +373 -0
  68. langbot_plugin-0.5.2/src/langbot_plugin/runtime/plugin/dependency_environment.py +408 -0
  69. langbot_plugin-0.5.2/src/langbot_plugin/runtime/plugin/logbuffer.py +169 -0
  70. langbot_plugin-0.5.2/src/langbot_plugin/runtime/plugin/mgr.py +2932 -0
  71. langbot_plugin-0.5.2/src/langbot_plugin/runtime/plugin/restart_coordinator.py +418 -0
  72. langbot_plugin-0.5.2/src/langbot_plugin/runtime/plugin/worker_launcher.py +588 -0
  73. langbot_plugin-0.5.2/src/langbot_plugin/runtime/security.py +96 -0
  74. langbot_plugin-0.5.2/src/langbot_plugin/version.py +1 -0
  75. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/api/definition/components/test_components.py +12 -5
  76. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/api/entities/builtin/test_command_context.py +21 -0
  77. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/api/entities/builtin/test_rag_models.py +8 -5
  78. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/api/entities/test_context.py +102 -1
  79. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/api/entities/test_events.py +0 -173
  80. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/api/proxies/test_langbot_api.py +46 -0
  81. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/api/proxies/test_query_based_api.py +26 -2
  82. langbot_plugin-0.5.2/tests/box/test_admission.py +553 -0
  83. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/box/test_backend.py +310 -210
  84. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/box/test_backend_selection.py +66 -55
  85. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/box/test_client.py +277 -190
  86. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/box/test_e2b_backend.py +216 -135
  87. langbot_plugin-0.5.2/tests/box/test_nsjail_backend.py +852 -0
  88. langbot_plugin-0.5.2/tests/box/test_runtime.py +1575 -0
  89. langbot_plugin-0.5.2/tests/box/test_server.py +1985 -0
  90. langbot_plugin-0.5.2/tests/box/test_skill_store.py +1158 -0
  91. langbot_plugin-0.5.2/tests/cli/run/test_controller.py +536 -0
  92. langbot_plugin-0.5.2/tests/cli/run/test_hotreload.py +180 -0
  93. langbot_plugin-0.5.2/tests/cli/run/test_runtime_handler.py +769 -0
  94. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/cli/test_buildplugin.py +1 -3
  95. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/cli/test_initplugin.py +8 -2
  96. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/cli/test_login.py +1 -3
  97. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/cli/test_logout_publish.py +69 -11
  98. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/cli/test_renderer.py +24 -13
  99. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/cli/test_runplugin.py +39 -6
  100. langbot_plugin-0.5.2/tests/entities/io/test_protocol.py +409 -0
  101. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/helpers/protocol.py +35 -5
  102. langbot_plugin-0.5.2/tests/packaging/test_installed_cli_blackbox.py +357 -0
  103. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/runtime/helper/test_marketplace.py +16 -1
  104. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/runtime/helper/test_pkgmgr.py +170 -11
  105. langbot_plugin-0.5.2/tests/runtime/io/handlers/test_control_handler.py +1375 -0
  106. langbot_plugin-0.5.2/tests/runtime/io/handlers/test_plugin_handler.py +962 -0
  107. langbot_plugin-0.5.2/tests/runtime/io/test_action_consistency.py +96 -0
  108. langbot_plugin-0.5.2/tests/runtime/io/test_connections.py +281 -0
  109. langbot_plugin-0.5.2/tests/runtime/io/test_controllers.py +539 -0
  110. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/runtime/io/test_handler.py +487 -5
  111. langbot_plugin-0.5.2/tests/runtime/plugin/test_artifact_store.py +265 -0
  112. langbot_plugin-0.5.2/tests/runtime/plugin/test_dependency_environment.py +264 -0
  113. langbot_plugin-0.5.2/tests/runtime/plugin/test_installation_manager.py +1480 -0
  114. langbot_plugin-0.5.2/tests/runtime/plugin/test_manager.py +1738 -0
  115. langbot_plugin-0.5.2/tests/runtime/plugin/test_restart_coordinator.py +351 -0
  116. langbot_plugin-0.5.2/tests/runtime/plugin/test_worker_launcher.py +632 -0
  117. langbot_plugin-0.5.2/tests/runtime/test_app.py +692 -0
  118. langbot_plugin-0.5.2/tests/runtime/test_bounded_executor.py +292 -0
  119. langbot_plugin-0.5.2/tests/runtime/test_event_loop_monitor.py +75 -0
  120. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/test_message.py +17 -12
  121. langbot_plugin-0.5.2/tests/test_plugin_logbuffer.py +116 -0
  122. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/utils/test_discovery.py +7 -6
  123. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/utils/test_importutil.py +3 -1
  124. langbot_plugin-0.5.0a2/.github/workflows/test.yml +0 -46
  125. langbot_plugin-0.5.0a2/AGENTS.md +0 -1108
  126. langbot_plugin-0.5.0a2/PKG-INFO +0 -38
  127. langbot_plugin-0.5.0a2/README.md +0 -9
  128. langbot_plugin-0.5.0a2/docs/communication/apis/lb2rt.md +0 -71
  129. langbot_plugin-0.5.0a2/src/langbot_plugin/api/definition/abstract/platform/adapter.py +0 -386
  130. langbot_plugin-0.5.0a2/src/langbot_plugin/api/entities/builtin/platform/entities.py +0 -181
  131. langbot_plugin-0.5.0a2/src/langbot_plugin/api/entities/builtin/platform/errors.py +0 -6
  132. langbot_plugin-0.5.0a2/src/langbot_plugin/api/entities/builtin/platform/events.py +0 -538
  133. langbot_plugin-0.5.0a2/src/langbot_plugin/api/entities/events.py +0 -607
  134. langbot_plugin-0.5.0a2/src/langbot_plugin/box/models.py +0 -331
  135. langbot_plugin-0.5.0a2/src/langbot_plugin/box/nsjail_backend.py +0 -618
  136. langbot_plugin-0.5.0a2/src/langbot_plugin/box/runtime.py +0 -598
  137. langbot_plugin-0.5.0a2/src/langbot_plugin/box/security.py +0 -52
  138. langbot_plugin-0.5.0a2/src/langbot_plugin/box/server.py +0 -494
  139. langbot_plugin-0.5.0a2/src/langbot_plugin/box/skill_store.py +0 -647
  140. langbot_plugin-0.5.0a2/src/langbot_plugin/cli/commands/publish.py +0 -77
  141. langbot_plugin-0.5.0a2/src/langbot_plugin/entities/io/req.py +0 -16
  142. langbot_plugin-0.5.0a2/src/langbot_plugin/runtime/app.py +0 -144
  143. langbot_plugin-0.5.0a2/src/langbot_plugin/runtime/context.py +0 -31
  144. langbot_plugin-0.5.0a2/src/langbot_plugin/runtime/helper/marketplace.py +0 -99
  145. langbot_plugin-0.5.0a2/src/langbot_plugin/runtime/io/connection.py +0 -19
  146. langbot_plugin-0.5.0a2/src/langbot_plugin/runtime/io/connections/ws.py +0 -81
  147. langbot_plugin-0.5.0a2/src/langbot_plugin/runtime/io/controllers/stdio/client.py +0 -47
  148. langbot_plugin-0.5.0a2/src/langbot_plugin/runtime/io/controllers/ws/server.py +0 -35
  149. langbot_plugin-0.5.0a2/src/langbot_plugin/runtime/io/handler.py +0 -319
  150. langbot_plugin-0.5.0a2/src/langbot_plugin/runtime/plugin/mgr.py +0 -1139
  151. langbot_plugin-0.5.0a2/src/langbot_plugin/version.py +0 -1
  152. langbot_plugin-0.5.0a2/tests/box/test_nsjail_backend.py +0 -545
  153. langbot_plugin-0.5.0a2/tests/box/test_runtime.py +0 -805
  154. langbot_plugin-0.5.0a2/tests/box/test_server.py +0 -859
  155. langbot_plugin-0.5.0a2/tests/box/test_skill_store.py +0 -914
  156. langbot_plugin-0.5.0a2/tests/cli/run/test_controller.py +0 -172
  157. langbot_plugin-0.5.0a2/tests/cli/run/test_runtime_handler.py +0 -338
  158. langbot_plugin-0.5.0a2/tests/e2e/standalone_runtime_eba_probe.py +0 -196
  159. langbot_plugin-0.5.0a2/tests/entities/io/test_protocol.py +0 -88
  160. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/.gitignore +0 -1
  161. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/assets/icon.svg +0 -4
  162. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/components/event_listener/default.py +0 -41
  163. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/components/event_listener/default.yaml +0 -12
  164. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/main.py +0 -8
  165. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/manifest.yaml +0 -24
  166. langbot_plugin-0.5.0a2/tests/runtime/io/handlers/test_control_handler.py +0 -452
  167. langbot_plugin-0.5.0a2/tests/runtime/io/handlers/test_plugin_handler.py +0 -317
  168. langbot_plugin-0.5.0a2/tests/runtime/io/test_connections.py +0 -148
  169. langbot_plugin-0.5.0a2/tests/runtime/io/test_controllers.py +0 -196
  170. langbot_plugin-0.5.0a2/tests/runtime/plugin/test_manager.py +0 -596
  171. langbot_plugin-0.5.0a2/tests/runtime/test_app.py +0 -389
  172. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/.github/workflows/cla.yml +0 -0
  173. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/.github/workflows/publish-pypi.yaml +0 -0
  174. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/.gitignore +0 -0
  175. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/.python-version +0 -0
  176. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/CLAUDE.md +0 -0
  177. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/CONTRIBUTING.md +0 -0
  178. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/LICENSE +0 -0
  179. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/data/.env.example +0 -0
  180. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/docs/Message.md +0 -0
  181. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/docs/PluginPages.md +0 -0
  182. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/docs/communication/runtime_plugin.md +0 -0
  183. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/docs/langbot-plugin-social.png +0 -0
  184. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/__init__.py +0 -0
  185. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/__init__.py +0 -0
  186. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/__init__.py +0 -0
  187. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/abstract/__init__.py +0 -0
  188. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/abstract/platform/__init__.py +0 -0
  189. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/abstract/platform/event_logger.py +0 -0
  190. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/__init__.py +0 -0
  191. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/base.py +0 -0
  192. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/command/__init__.py +0 -0
  193. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/command/command.py +0 -0
  194. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/common/__init__.py +0 -0
  195. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/common/event_listener.py +0 -0
  196. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/knowledge_engine/__init__.py +0 -0
  197. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/knowledge_engine/engine.py +0 -0
  198. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/manifest.py +0 -0
  199. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/page/__init__.py +0 -0
  200. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/parser/__init__.py +0 -0
  201. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/parser/parser.py +0 -0
  202. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/tool/__init__.py +0 -0
  203. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/components/tool/tool.py +0 -0
  204. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/definition/plugin.py +0 -0
  205. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/__init__.py +0 -0
  206. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/__init__.py +0 -0
  207. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/command/__init__.py +0 -0
  208. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/pipeline/__init__.py +0 -0
  209. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/platform/__init__.py +0 -0
  210. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/platform/logger.py +0 -0
  211. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/provider/__init__.py +0 -0
  212. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/provider/prompt.py +0 -0
  213. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/rag/__init__.py +0 -0
  214. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/rag/context.py +0 -0
  215. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/rag/enums.py +0 -0
  216. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/rag/errors.py +0 -0
  217. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/rag/models.py +0 -0
  218. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/resource/__init__.py +0 -0
  219. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/entities/builtin/resource/tool.py +0 -0
  220. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/proxies/__init__.py +0 -0
  221. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/proxies/base.py +0 -0
  222. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/proxies/event_context.py +0 -0
  223. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/api/proxies/execute_context.py +0 -0
  224. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/__init__.py +0 -0
  225. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/langbot-page-sdk.js +0 -0
  226. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/.github/workflows/release.yml.example +0 -0
  227. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/.gitignore.example +0 -0
  228. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/.vscode/launch.json.example +0 -0
  229. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/README.md.example +0 -0
  230. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/__init__.py +0 -0
  231. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/assets/icon.svg.example +0 -0
  232. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/__init__.py +0 -0
  233. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/commands/__init__.py +0 -0
  234. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.py.example +0 -0
  235. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.yaml.example +0 -0
  236. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/event_listener/__init__.py +0 -0
  237. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/event_listener/default.py.example +0 -0
  238. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/event_listener/default.yaml.example +0 -0
  239. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/knowledge_engine/__init__.py +0 -0
  240. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.py.example +0 -0
  241. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.yaml.example +0 -0
  242. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/pages/{page_name}.html.example +0 -0
  243. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/pages/{page_name}.yaml.example +0 -0
  244. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/parser/__init__.py +0 -0
  245. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.py.example +0 -0
  246. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.yaml.example +0 -0
  247. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/tools/__init__.py +0 -0
  248. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.py.example +0 -0
  249. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.yaml.example +0 -0
  250. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/main.py.example +0 -0
  251. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/manifest.yaml.example +0 -0
  252. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/readme/README_zh_Hans.md.example +0 -0
  253. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/assets/templates/requirements.txt.example +0 -0
  254. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/__main__.py +0 -0
  255. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/commands/__init__.py +0 -0
  256. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/commands/buildplugin.py +0 -0
  257. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/commands/gencomponent.py +0 -0
  258. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/commands/initplugin.py +0 -0
  259. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/commands/login.py +0 -0
  260. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/commands/logout.py +0 -0
  261. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/gen/__init__.py +0 -0
  262. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/gen/renderer.py +0 -0
  263. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/locales/__init__.py +0 -0
  264. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/locales/en_US.py +0 -0
  265. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/locales/es_ES.py +0 -0
  266. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/locales/ja_JP.py +0 -0
  267. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/locales/th_TH.py +0 -0
  268. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/locales/vi_VN.py +0 -0
  269. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/locales/zh_Hans.py +0 -0
  270. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/locales/zh_Hant.py +0 -0
  271. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/run/__init__.py +0 -0
  272. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/utils/__init__.py +0 -0
  273. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/utils/cloudsv.py +0 -0
  274. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/utils/form.py +0 -0
  275. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/cli/utils/page_components.py +0 -0
  276. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/entities/__init__.py +0 -0
  277. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/entities/io/__init__.py +0 -0
  278. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/entities/io/actions/__init__.py +0 -0
  279. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/entities/io/resp.py +0 -0
  280. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/entities/marketplace.py +0 -0
  281. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/LICENSE +0 -0
  282. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/README.md +0 -0
  283. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/__init__.py +0 -0
  284. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/helper/__init__.py +0 -0
  285. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/__init__.py +0 -0
  286. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/connections/__init__.py +0 -0
  287. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/controller.py +0 -0
  288. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/controllers/__init__.py +0 -0
  289. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/controllers/stdio/__init__.py +0 -0
  290. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/controllers/stdio/server.py +0 -0
  291. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/controllers/ws/__init__.py +0 -0
  292. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/io/handlers/__init__.py +0 -0
  293. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/plugin/__init__.py +0 -0
  294. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/plugin/container.py +0 -0
  295. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/runtime/settings.py +0 -0
  296. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/utils/__init__.py +0 -0
  297. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/utils/discover/__init__.py +0 -0
  298. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/utils/discover/engine.py +0 -0
  299. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/utils/importutil.py +0 -0
  300. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/utils/log.py +0 -0
  301. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/src/langbot_plugin/utils/platform.py +0 -0
  302. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/__init__.py +0 -0
  303. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/api/definition/test_manifest.py +0 -0
  304. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/api/entities/builtin/test_platform_logger.py +0 -0
  305. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/api/entities/builtin/test_provider_message.py +0 -0
  306. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/api/proxies/test_base.py +0 -0
  307. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/box/__init__.py +0 -0
  308. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/cli/test_gencomponent.py +0 -0
  309. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/cli/test_i18n_form.py +0 -0
  310. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/cli/test_page_components.py +0 -0
  311. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/entities/io/test_dependency_errors.py +0 -0
  312. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/helpers/__init__.py +0 -0
  313. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/runtime/io/handlers/test_import_contracts.py +0 -0
  314. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/runtime/plugin/test_container.py +0 -0
  315. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/test_log.py +0 -0
  316. {langbot_plugin-0.5.0a2 → langbot_plugin-0.5.2}/tests/utils/test_platform.py +0 -0
@@ -0,0 +1,23 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "[0-9]+.[0-9]+.[0-9]+"
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ pypi:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: astral-sh/setup-uv@v6
18
+ - name: Build distributions
19
+ run: uv build
20
+ - name: Publish to PyPI
21
+ run: uv publish --token "$UV_PUBLISH_TOKEN"
22
+ env:
23
+ UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
@@ -0,0 +1,93 @@
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
+ --ignore=tests/packaging \
33
+ --cov=langbot_plugin \
34
+ --cov-report=term-missing \
35
+ --cov-fail-under=84
36
+
37
+ test-lint:
38
+ name: Lint and Format
39
+ runs-on: ubuntu-latest
40
+ steps:
41
+ - uses: actions/checkout@v4
42
+ with:
43
+ persist-credentials: false
44
+ - name: Install uv
45
+ uses: astral-sh/setup-uv@v6
46
+ - name: Ruff check
47
+ run: uv run ruff check src tests --output-format=concise
48
+ - name: Ruff format check
49
+ run: uv run ruff format --check src tests
50
+
51
+ package-smoke:
52
+ name: Package Smoke
53
+ runs-on: ubuntu-latest
54
+ steps:
55
+ - uses: actions/checkout@v4
56
+ with:
57
+ persist-credentials: false
58
+ - name: Install uv
59
+ uses: astral-sh/setup-uv@v6
60
+ - name: Set up Python
61
+ run: uv python install 3.12
62
+ - name: Installed wheel CLI smoke
63
+ run: uv run --python 3.12 pytest -q tests/packaging
64
+
65
+ scoped-type-check:
66
+ name: Scoped Type Check
67
+ runs-on: ubuntu-latest
68
+ steps:
69
+ - uses: actions/checkout@v4
70
+ with:
71
+ persist-credentials: false
72
+ - name: Install uv
73
+ uses: astral-sh/setup-uv@v6
74
+ - name: Mypy stable protocol modules
75
+ run: |
76
+ uv run mypy \
77
+ src/langbot_plugin/entities/io \
78
+ src/langbot_plugin/runtime/plugin/logbuffer.py \
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,378 @@
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
+ Tenant-scoped control actions must carry a complete, trusted installation
99
+ binding without placing authority in the action payload:
100
+
101
+ ```json
102
+ {
103
+ "seq_id": 1,
104
+ "action": "action_name",
105
+ "data": {},
106
+ "context": {
107
+ "instance_uuid": "instance-id",
108
+ "workspace_uuid": "workspace-id",
109
+ "placement_generation": 1,
110
+ "installation_uuid": "installation-id",
111
+ "runtime_revision": 1,
112
+ "artifact_digest": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
113
+ }
114
+ }
115
+ ```
116
+
117
+ `SET_RUNTIME_CONFIG` is the instance-scoped handshake. It carries no Workspace
118
+ context and accepts this frozen payload:
119
+
120
+ ```json
121
+ {
122
+ "runtime_identity": {
123
+ "instance_uuid": "instance-id",
124
+ "runtime_id": "short-lived-runtime-id"
125
+ },
126
+ "worker_policy": {
127
+ "max_cpus": 1.0,
128
+ "max_memory_mb": 512,
129
+ "max_pids": 128,
130
+ "max_open_files": 256,
131
+ "max_file_size_mb": 512,
132
+ "max_concurrent_restarts": 1,
133
+ "restart_failure_threshold": 8,
134
+ "restart_failure_window_seconds": 30.0,
135
+ "restart_circuit_open_seconds": 60.0,
136
+ "require_hard_limits": true
137
+ },
138
+ "runtime_profile": "shared",
139
+ "cloud_service_url": "https://space.langbot.app"
140
+ }
141
+ ```
142
+
143
+ The Runtime identity and worker policy can be repeated exactly after a control
144
+ reconnect but cannot be changed for the life of the Runtime process. A new
145
+ authenticated control handler atomically supersedes the old handler; old
146
+ requests fail even if the old transport has not finished closing.
147
+
148
+ After the handshake, every tenant-scoped LangBot-to-Runtime action (including
149
+ file chunks) requires the complete immutable tuple
150
+ `(instance_uuid, workspace_uuid, placement_generation, installation_uuid,
151
+ runtime_revision, artifact_digest)`. Missing context, a different instance, or
152
+ an attempted generation/revision/artifact rebind fails closed. Instance-scoped
153
+ actions reject tenant context. Plugin payload fields are never authoritative
154
+ for these bindings.
155
+
156
+ In the `shared` profile, `PluginManager` indexes desired state by the complete
157
+ installation binding. The instance-scoped `RECONCILE_PLUGIN_INSTALLATIONS`
158
+ action replays the authoritative set, while tenant-scoped
159
+ `APPLY_PLUGIN_INSTALLATION` and `REMOVE_PLUGIN_INSTALLATION` actions change one
160
+ installation. Newer placement generations or Runtime revisions fence the old
161
+ worker immediately; stale or cross-Workspace transitions fail closed.
162
+
163
+ Each enabled installation is owned by an installation-scoped Supervisor.
164
+ Unexpected worker exit is recovered with bounded exponential backoff. Disable,
165
+ remove, placement generation changes, Runtime revision changes, and shutdown
166
+ fence the old Supervisor before it can relaunch, while reconcile and control
167
+ reconnect restore the authoritative desired set.
168
+
169
+ Restart attempts also pass through one Runtime-wide coordinator. Launches are
170
+ globally bounded until a worker completes initialization; repeated unexpected
171
+ exits in the configured window open a circuit. After cooldown, exactly one
172
+ half-open probe may launch, and it must remain stable before the circuit closes.
173
+ A child that does not become ready within 30 seconds is cancelled and reaped.
174
+ Aggregate coordinator counters are exposed through Runtime health without
175
+ installation or Workspace identity.
176
+
177
+ Plugin packages are verified against `artifact_digest` and extracted once into
178
+ a read-only `artifacts/sha256/<digest>/code` tree. Installations may share that
179
+ code tree, but each gets a separate process and private `home`, `tmp`, and `data`
180
+ directories. A worker receives a short-lived, one-use registration capability
181
+ bound to the complete installation tuple; it cannot select its own tenant scope.
182
+
183
+ Before a shared worker is launched, the Runtime prepares dependencies in a
184
+ separate nsjail. The resulting `site-packages` tree is keyed by the verified
185
+ artifact, requirements bytes, Python ABI, Runtime version, and installer schema,
186
+ then atomically published under `environments/sha256/<environment-digest>`.
187
+ Concurrent installations reuse the same ready tree. Workers mount it read-only;
188
+ failed or partial preparations are removed and reported as the stable
189
+ `dependency_prepare_failed` desired-state failure. Pip control options in an
190
+ artifact's `requirements.txt` are rejected because only Runtime configuration
191
+ may select indexes or trusted hosts.
192
+
193
+ Shared workers launch through nsjail with policy-owned cgroup CPU, memory, and
194
+ PID limits plus file/process rlimits. If `require_hard_limits` is true, missing
195
+ nsjail or cgroup v2 delegation makes configuration fail closed. Artifact `.env`
196
+ files are not loaded in the shared profile. The default `oss_dev` profile keeps
197
+ the direct-process and `.env` behavior needed for local open-source development.
198
+ The Runtime waits for this immutable profile handshake before inspecting legacy
199
+ plugin state. A shared Runtime never scans, installs dependencies for, or
200
+ launches the global `data/plugins` tree; only apply/reconcile desired state may
201
+ start an installation worker.
202
+
203
+ Response shape:
204
+
205
+ ```json
206
+ { "seq_id": 1, "code": 0, "message": "success", "data": {}, "chunk_status": "continue" }
207
+ ```
208
+
209
+ Core mechanics:
210
+
211
+ - `seq_id` correlates responses to requests.
212
+ - `context` carries trusted tenant/installation authority independently of
213
+ plugin-controlled `data`; it is mandatory on tenant control actions.
214
+ - Messages with `action` are requests; messages with `code` are responses.
215
+ - Each peer may initiate requests on the same connection.
216
+ - `Handler.call_action()` waits for one response.
217
+ - `Handler.call_action_generator()` consumes streamed responses.
218
+ - Streaming emits `chunk_status: "continue"` chunks and ends with `"end"`.
219
+ - File transfer uses `CommonAction.FILE_CHUNK` with 16KB base64 chunks stored
220
+ under `data/temp/lbp/`. Transfer keys are high-entropy opaque basenames; the
221
+ receiver rejects absolute paths, separators, `..`, and unsafe extensions.
222
+
223
+ Action enums are the protocol contract:
224
+
225
+ - `CommonAction`
226
+ - `PluginToRuntimeAction`
227
+ - `RuntimeToPluginAction`
228
+ - `LangBotToRuntimeAction`
229
+ - `RuntimeToLangBotAction`
230
+ - `LangBotToBoxAction`
231
+
232
+ Do not duplicate action strings outside these enums.
233
+
234
+ ## Plugin Runtime
235
+
236
+ `lbp rt` enters `runtime/app.py::main()` and builds `RuntimeApplication`.
237
+
238
+ Runtime graph:
239
+
240
+ ```text
241
+ LangBot PluginRuntimeConnector
242
+ ↔ control connection
243
+ ↔ RuntimeApplication
244
+ → PluginManager
245
+ → PluginContainer(s)
246
+ ↔ PluginConnectionHandler(s)
247
+ ↔ plugin process(es)
248
+ ```
249
+
250
+ Important modules:
251
+
252
+ - `runtime/app.py`: selects stdio vs WebSocket control transport, starts control/debug servers, launches plugin manager tasks.
253
+ - `runtime/context.py`: shared runtime context object.
254
+ - `runtime/settings.py`: runtime settings, including marketplace/cloud URL.
255
+ - `runtime/plugin/mgr.py`: plugin discovery, installation, dependency checks, launch, shutdown, event/tool/command/RAG/page dispatch.
256
+ - `runtime/plugin/container.py`: loaded plugin package, manifest, component containers, status.
257
+ - `runtime/io/handlers/control.py`: actions LangBot calls on the Runtime.
258
+ - `runtime/io/handlers/plugin.py`: actions the Runtime calls on plugin processes.
259
+ - `runtime/io/controllers/`: stdio/WebSocket server and client controllers.
260
+ - `runtime/io/connections/`: transport-specific connection implementations.
261
+
262
+ The Runtime has two external channels:
263
+
264
+ - **control channel**: LangBot ↔ Runtime, stdio or `:5400/control/ws` by default.
265
+ - **debug channel**: plugin dev process ↔ Runtime, WebSocket `:5401/plugin/debug/ws` by default.
266
+
267
+ Installed plugin processes do not authenticate with the shared debug key. For
268
+ each child launch, the Runtime reads the installed `manifest.yaml`, issues a
269
+ short-lived one-use registration capability bound to that author/name, and
270
+ passes only that capability to the child. The capability is consumed before
271
+ Host settings are requested, cannot be replayed, and the plugin must preserve
272
+ the same manifest identity after initialization. On Windows the child receives
273
+ an explicit environment allowlist, so Runtime and Box control secrets are not
274
+ inherited.
275
+
276
+ WebSocket control may use the high-entropy
277
+ `LANGBOT_PLUGIN_RUNTIME_CONTROL_TOKEN` in the
278
+ `X-LangBot-Plugin-Runtime-Token` handshake header. OSS defaults to no control
279
+ token when both LangBot and Runtime leave it unset; if either side configures
280
+ one, both sides must use the same value. The debug server instead accepts only
281
+ Workspace-scoped random credentials issued through the authenticated control
282
+ channel. Each Workspace gets a different token, valid for two hours, and
283
+ `lbp run` sends it in the `X-LangBot-Plugin-Debug-Key` handshake header
284
+ sessions. Windows production children use their one-use registration
285
+ capability in `X-LangBot-Plugin-Registration-Capability` instead. The
286
+ instance-scoped `SET_RUNTIME_CONFIG` handshake and per-action installation
287
+ bindings are authorization fences after transport authentication; neither is a
288
+ substitute for authenticating the peer.
289
+
290
+ Legacy OSS plugins are stored under `data/plugins/{author}__{name}`. Runtime
291
+ plugin processes normally run as separate Python processes and connect back via
292
+ stdio or debug WebSocket. Shared workers instead use the digest-addressed
293
+ artifact tree and installation-private paths described above. RPC transfer files
294
+ created inside a shared worker use its private writable tmp mount; files accepted
295
+ by the Supervisor are stored in an installation-private Runtime directory and
296
+ enforce the instance file-size policy.
297
+
298
+ ## Box Runtime
299
+
300
+ `lbp box` enters `box/server.py::main()` and serves `BoxRuntime` through action RPC.
301
+
302
+ Box graph:
303
+
304
+ ```text
305
+ LangBot BoxService
306
+ ↔ BoxRuntimeConnector
307
+ ↔ BoxServerHandler
308
+ → BoxRuntime
309
+ → Backend session(s)
310
+ → Docker/Podman, nsjail, or E2B sandbox
311
+ ```
312
+
313
+ Important modules:
314
+
315
+ - `box/server.py`: CLI entrypoint, aiohttp WebSocket routes, `BoxServerHandler` action registration.
316
+ - `box/runtime.py`: session lifecycle, per-session locks, TTL cleanup, command execution, managed processes.
317
+ - `box/models.py`: `BoxSpec`, execution results, managed-process specs.
318
+ - `box/client.py`: action-RPC client used by LangBot-side connector/service.
319
+ - `box/actions.py`: `LangBotToBoxAction` enum.
320
+ - `box/backend.py`: backend abstraction and local backend selection.
321
+ - `box/nsjail_backend.py`: nsjail backend.
322
+ - `box/e2b_backend.py`: E2B backend.
323
+ - `box/skill_store.py`: Box-owned skill package CRUD and install/preview helpers.
324
+ - `box/security.py`: path/security helper logic.
325
+
326
+ Default Box WebSocket endpoints on port `5410`:
327
+
328
+ - `/rpc/ws`: action RPC control channel.
329
+ - `/v1/sessions/{session_id}/managed-process/ws`: legacy default process stdio relay.
330
+ - `/v1/sessions/{session_id}/managed-process/{process_id}/ws`: named process stdio relay.
331
+
332
+ Box keeps durable skill/storage paths in an `(instance, workspace)` namespace,
333
+ while sandbox sessions and managed processes use an
334
+ `(instance, workspace, placement_generation)` namespace. Authenticated tenant
335
+ RPCs advance a monotonic generation fence, cancel in-flight older RPCs, and
336
+ retire older sessions. Managed-process relay handshakes carry Workspace and
337
+ generation in authenticated headers; an attached relay closes as soon as that
338
+ generation becomes stale.
339
+
340
+ There is no supported `python -m langbot_plugin.box` entrypoint; use `lbp box`.
341
+
342
+ ## Backend Selection
343
+
344
+ Box can execute through multiple sandbox backends:
345
+
346
+ - Docker/Podman through the local CLI backend path.
347
+ - nsjail for local Linux sandboxing.
348
+ - E2B for remote cloud sandboxes.
349
+
350
+ 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.
351
+
352
+ 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.
353
+
354
+ ## Cross-Repo Development Flow
355
+
356
+ When changing shared contracts:
357
+
358
+ 1. Change this SDK repo first or in the same branch set.
359
+ 2. Install the local SDK into LangBot's virtualenv: `uv pip install .` from this repo while LangBot's `.venv` is active.
360
+ 3. Run LangBot with `uv run --no-sync ...` so `uv` does not replace the local SDK with the pinned PyPI package.
361
+ 4. Exercise the exact path changed: plugin stdio, plugin WebSocket, `lbp run`, `lbp rt`, `lbp box`, Box WebSocket, or Box stdio.
362
+
363
+ Workspace action-context support starts in SDK `0.4.15`. The instance-scoped
364
+ Runtime handshake and complete `InstallationBinding` extend that protocol on
365
+ the multi-tenant branch and require a coordinated LangBot Core change before
366
+ release. Until a matching SDK version is published, Core must pin the exact
367
+ pushed SDK commit; the already-published `0.4.14` artifact does not contain any
368
+ of these contracts and must not be used as a compatibility alias.
369
+
370
+ The SDK `AGENTS.md` keeps the short command checklist; this file keeps the structural map.
371
+
372
+ ## Design Biases
373
+
374
+ - Keep plugin-author SDK APIs stable and explicit.
375
+ - Treat action enums and Pydantic models as cross-process API contracts.
376
+ - Keep runtime process management separate from LangBot product logic.
377
+ - Keep Box sandbox semantics in `box/`; LangBot should call Box through the service/client protocol.
378
+ - Prefer tests around protocol shape and black-box CLI behavior when changing runtime boundaries.