langbot-plugin 0.4.2b4__tar.gz → 0.5.0a2__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 (258) hide show
  1. langbot_plugin-0.5.0a2/.github/workflows/cla.yml +41 -0
  2. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/AGENTS.md +37 -22
  3. langbot_plugin-0.5.0a2/CONTRIBUTING.md +15 -0
  4. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/PKG-INFO +2 -1
  5. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/pyproject.toml +2 -1
  6. langbot_plugin-0.5.0a2/src/langbot_plugin/api/definition/abstract/platform/adapter.py +386 -0
  7. langbot_plugin-0.5.0a2/src/langbot_plugin/api/entities/builtin/platform/entities.py +181 -0
  8. langbot_plugin-0.5.0a2/src/langbot_plugin/api/entities/builtin/platform/errors.py +6 -0
  9. langbot_plugin-0.5.0a2/src/langbot_plugin/api/entities/builtin/platform/events.py +538 -0
  10. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/platform/message.py +1 -0
  11. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/context.py +2 -2
  12. langbot_plugin-0.5.0a2/src/langbot_plugin/api/entities/events.py +607 -0
  13. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/proxies/langbot_api.py +36 -10
  14. langbot_plugin-0.5.0a2/src/langbot_plugin/assets/templates/.github/workflows/release.yml.example +77 -0
  15. langbot_plugin-0.5.0a2/src/langbot_plugin/assets/templates/README.md.example +15 -0
  16. langbot_plugin-0.5.0a2/src/langbot_plugin/assets/templates/readme/README_zh_Hans.md.example +15 -0
  17. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/commands/initplugin.py +4 -0
  18. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/gen/renderer.py +2 -0
  19. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/entities/io/actions/enums.py +1 -0
  20. langbot_plugin-0.5.0a2/src/langbot_plugin/entities/io/errors.py +91 -0
  21. langbot_plugin-0.5.0a2/src/langbot_plugin/runtime/helper/pkgmgr.py +369 -0
  22. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/handlers/plugin.py +10 -0
  23. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/plugin/mgr.py +78 -12
  24. langbot_plugin-0.5.0a2/src/langbot_plugin/version.py +1 -0
  25. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/api/entities/test_events.py +173 -0
  26. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/cli/test_initplugin.py +2 -0
  27. langbot_plugin-0.5.0a2/tests/e2e/standalone_runtime_eba_probe.py +196 -0
  28. langbot_plugin-0.5.0a2/tests/entities/io/test_dependency_errors.py +59 -0
  29. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/.gitignore +1 -0
  30. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/assets/icon.svg +4 -0
  31. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/components/event_listener/default.py +41 -0
  32. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/components/event_listener/default.yaml +12 -0
  33. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/main.py +8 -0
  34. langbot_plugin-0.5.0a2/tests/fixtures/eba_event_probe_plugin/manifest.yaml +24 -0
  35. langbot_plugin-0.5.0a2/tests/runtime/helper/test_pkgmgr.py +388 -0
  36. langbot_plugin-0.5.0a2/tests/runtime/io/test_handler.py +578 -0
  37. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/runtime/plugin/test_manager.py +62 -2
  38. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/test_message.py +12 -7
  39. langbot_plugin-0.4.2b4/src/langbot_plugin/api/definition/abstract/platform/adapter.py +0 -194
  40. langbot_plugin-0.4.2b4/src/langbot_plugin/api/entities/builtin/platform/entities.py +0 -76
  41. langbot_plugin-0.4.2b4/src/langbot_plugin/api/entities/builtin/platform/events.py +0 -183
  42. langbot_plugin-0.4.2b4/src/langbot_plugin/api/entities/events.py +0 -292
  43. langbot_plugin-0.4.2b4/src/langbot_plugin/assets/templates/README.md.example +0 -3
  44. langbot_plugin-0.4.2b4/src/langbot_plugin/entities/io/errors.py +0 -31
  45. langbot_plugin-0.4.2b4/src/langbot_plugin/runtime/helper/pkgmgr.py +0 -141
  46. langbot_plugin-0.4.2b4/src/langbot_plugin/version.py +0 -1
  47. langbot_plugin-0.4.2b4/tests/runtime/helper/test_pkgmgr.py +0 -109
  48. langbot_plugin-0.4.2b4/tests/runtime/io/test_handler.py +0 -228
  49. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/.github/workflows/publish-pypi.yaml +0 -0
  50. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/.github/workflows/test.yml +0 -0
  51. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/.gitignore +0 -0
  52. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/.python-version +0 -0
  53. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/CLAUDE.md +0 -0
  54. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/LICENSE +0 -0
  55. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/README.md +0 -0
  56. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/data/.env.example +0 -0
  57. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/docs/Message.md +0 -0
  58. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/docs/PluginPages.md +0 -0
  59. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/docs/communication/apis/lb2rt.md +0 -0
  60. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/docs/communication/runtime_plugin.md +0 -0
  61. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/docs/dependency-management.md +0 -0
  62. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/docs/langbot-plugin-social.png +0 -0
  63. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/__init__.py +0 -0
  64. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/__init__.py +0 -0
  65. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/__init__.py +0 -0
  66. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/abstract/__init__.py +0 -0
  67. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/abstract/platform/__init__.py +0 -0
  68. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/abstract/platform/event_logger.py +0 -0
  69. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/__init__.py +0 -0
  70. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/base.py +0 -0
  71. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/command/__init__.py +0 -0
  72. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/command/command.py +0 -0
  73. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/common/__init__.py +0 -0
  74. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/common/event_listener.py +0 -0
  75. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/knowledge_engine/__init__.py +0 -0
  76. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/knowledge_engine/engine.py +0 -0
  77. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/manifest.py +0 -0
  78. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/page/__init__.py +0 -0
  79. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/parser/__init__.py +0 -0
  80. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/parser/parser.py +0 -0
  81. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/tool/__init__.py +0 -0
  82. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/components/tool/tool.py +0 -0
  83. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/definition/plugin.py +0 -0
  84. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/__init__.py +0 -0
  85. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/__init__.py +0 -0
  86. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/command/__init__.py +0 -0
  87. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/command/context.py +0 -0
  88. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/command/errors.py +0 -0
  89. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/pipeline/__init__.py +0 -0
  90. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/pipeline/query.py +0 -0
  91. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/platform/__init__.py +0 -0
  92. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/platform/logger.py +0 -0
  93. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/provider/__init__.py +0 -0
  94. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/provider/message.py +0 -0
  95. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/provider/prompt.py +0 -0
  96. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/provider/session.py +0 -0
  97. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/rag/__init__.py +0 -0
  98. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/rag/context.py +0 -0
  99. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/rag/enums.py +0 -0
  100. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/rag/errors.py +0 -0
  101. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/rag/models.py +0 -0
  102. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/resource/__init__.py +0 -0
  103. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/entities/builtin/resource/tool.py +0 -0
  104. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/proxies/__init__.py +0 -0
  105. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/proxies/base.py +0 -0
  106. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/proxies/event_context.py +0 -0
  107. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/proxies/execute_context.py +0 -0
  108. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/api/proxies/query_based_api.py +0 -0
  109. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/__init__.py +0 -0
  110. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/langbot-page-sdk.js +0 -0
  111. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/.env.example.example +0 -0
  112. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/.gitignore.example +0 -0
  113. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/.vscode/launch.json.example +0 -0
  114. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/__init__.py +0 -0
  115. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/assets/icon.svg.example +0 -0
  116. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/__init__.py +0 -0
  117. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/commands/__init__.py +0 -0
  118. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.py.example +0 -0
  119. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.yaml.example +0 -0
  120. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/event_listener/__init__.py +0 -0
  121. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/event_listener/default.py.example +0 -0
  122. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/event_listener/default.yaml.example +0 -0
  123. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/knowledge_engine/__init__.py +0 -0
  124. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.py.example +0 -0
  125. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.yaml.example +0 -0
  126. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/pages/{page_name}.html.example +0 -0
  127. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/pages/{page_name}.yaml.example +0 -0
  128. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/parser/__init__.py +0 -0
  129. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.py.example +0 -0
  130. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.yaml.example +0 -0
  131. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/tools/__init__.py +0 -0
  132. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.py.example +0 -0
  133. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.yaml.example +0 -0
  134. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/main.py.example +0 -0
  135. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/manifest.yaml.example +0 -0
  136. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/assets/templates/requirements.txt.example +0 -0
  137. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/__init__.py +0 -0
  138. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/actions.py +0 -0
  139. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/backend.py +0 -0
  140. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/client.py +0 -0
  141. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/e2b_backend.py +0 -0
  142. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/errors.py +0 -0
  143. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/models.py +0 -0
  144. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/nsjail_backend.py +0 -0
  145. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/runtime.py +0 -0
  146. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/security.py +0 -0
  147. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/server.py +0 -0
  148. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/box/skill_store.py +0 -0
  149. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/__init__.py +0 -0
  150. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/__main__.py +0 -0
  151. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/commands/__init__.py +0 -0
  152. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/commands/buildplugin.py +0 -0
  153. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/commands/gencomponent.py +0 -0
  154. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/commands/login.py +0 -0
  155. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/commands/logout.py +0 -0
  156. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/commands/publish.py +0 -0
  157. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/commands/runplugin.py +0 -0
  158. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/gen/__init__.py +0 -0
  159. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/i18n.py +0 -0
  160. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/locales/__init__.py +0 -0
  161. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/locales/en_US.py +0 -0
  162. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/locales/es_ES.py +0 -0
  163. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/locales/ja_JP.py +0 -0
  164. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/locales/th_TH.py +0 -0
  165. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/locales/vi_VN.py +0 -0
  166. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/locales/zh_Hans.py +0 -0
  167. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/locales/zh_Hant.py +0 -0
  168. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/run/__init__.py +0 -0
  169. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/run/controller.py +0 -0
  170. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/run/handler.py +0 -0
  171. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/run/hotreload.py +0 -0
  172. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/utils/__init__.py +0 -0
  173. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/utils/cloudsv.py +0 -0
  174. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/utils/form.py +0 -0
  175. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/cli/utils/page_components.py +0 -0
  176. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/entities/__init__.py +0 -0
  177. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/entities/io/__init__.py +0 -0
  178. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/entities/io/actions/__init__.py +0 -0
  179. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/entities/io/req.py +0 -0
  180. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/entities/io/resp.py +0 -0
  181. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/entities/marketplace.py +0 -0
  182. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/LICENSE +0 -0
  183. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/README.md +0 -0
  184. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/__init__.py +0 -0
  185. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/app.py +0 -0
  186. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/context.py +0 -0
  187. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/helper/__init__.py +0 -0
  188. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/helper/marketplace.py +0 -0
  189. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/__init__.py +0 -0
  190. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/connection.py +0 -0
  191. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/connections/__init__.py +0 -0
  192. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/connections/stdio.py +0 -0
  193. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/connections/ws.py +0 -0
  194. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/controller.py +0 -0
  195. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/controllers/__init__.py +0 -0
  196. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/controllers/stdio/__init__.py +0 -0
  197. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/controllers/stdio/client.py +0 -0
  198. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/controllers/stdio/server.py +0 -0
  199. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/controllers/ws/__init__.py +0 -0
  200. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/controllers/ws/client.py +0 -0
  201. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/controllers/ws/server.py +0 -0
  202. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/handler.py +0 -0
  203. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/handlers/__init__.py +0 -0
  204. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/io/handlers/control.py +0 -0
  205. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/plugin/__init__.py +0 -0
  206. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/plugin/container.py +0 -0
  207. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/runtime/settings.py +0 -0
  208. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/utils/__init__.py +0 -0
  209. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/utils/discover/__init__.py +0 -0
  210. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/utils/discover/engine.py +0 -0
  211. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/utils/importutil.py +0 -0
  212. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/utils/log.py +0 -0
  213. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/src/langbot_plugin/utils/platform.py +0 -0
  214. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/__init__.py +0 -0
  215. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/api/definition/components/test_components.py +0 -0
  216. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/api/definition/test_manifest.py +0 -0
  217. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/api/entities/builtin/test_command_context.py +0 -0
  218. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/api/entities/builtin/test_platform_logger.py +0 -0
  219. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/api/entities/builtin/test_provider_message.py +0 -0
  220. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/api/entities/builtin/test_rag_models.py +0 -0
  221. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/api/entities/test_context.py +0 -0
  222. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/api/proxies/test_base.py +0 -0
  223. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/api/proxies/test_langbot_api.py +0 -0
  224. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/api/proxies/test_query_based_api.py +0 -0
  225. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/box/__init__.py +0 -0
  226. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/box/test_backend.py +0 -0
  227. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/box/test_backend_selection.py +0 -0
  228. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/box/test_client.py +0 -0
  229. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/box/test_e2b_backend.py +0 -0
  230. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/box/test_nsjail_backend.py +0 -0
  231. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/box/test_runtime.py +0 -0
  232. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/box/test_server.py +0 -0
  233. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/box/test_skill_store.py +0 -0
  234. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/cli/run/test_controller.py +0 -0
  235. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/cli/run/test_runtime_handler.py +0 -0
  236. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/cli/test_buildplugin.py +0 -0
  237. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/cli/test_gencomponent.py +0 -0
  238. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/cli/test_i18n_form.py +0 -0
  239. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/cli/test_login.py +0 -0
  240. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/cli/test_logout_publish.py +0 -0
  241. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/cli/test_page_components.py +0 -0
  242. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/cli/test_renderer.py +0 -0
  243. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/cli/test_runplugin.py +0 -0
  244. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/entities/io/test_protocol.py +0 -0
  245. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/helpers/__init__.py +0 -0
  246. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/helpers/protocol.py +0 -0
  247. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/runtime/helper/test_marketplace.py +0 -0
  248. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/runtime/io/handlers/test_control_handler.py +0 -0
  249. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/runtime/io/handlers/test_import_contracts.py +0 -0
  250. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/runtime/io/handlers/test_plugin_handler.py +0 -0
  251. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/runtime/io/test_connections.py +0 -0
  252. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/runtime/io/test_controllers.py +0 -0
  253. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/runtime/plugin/test_container.py +0 -0
  254. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/runtime/test_app.py +0 -0
  255. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/test_log.py +0 -0
  256. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/utils/test_discovery.py +0 -0
  257. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/utils/test_importutil.py +0 -0
  258. {langbot_plugin-0.4.2b4 → langbot_plugin-0.5.0a2}/tests/utils/test_platform.py +0 -0
@@ -0,0 +1,41 @@
1
+ name: "CLA Assistant"
2
+ on:
3
+ issue_comment:
4
+ types: [created]
5
+ pull_request_target:
6
+ types: [opened, closed, synchronize, reopened]
7
+
8
+ permissions:
9
+ actions: write # re-run the failed CLA check after signing
10
+ contents: read # signatures are stored in the remote langbot-app/cla repo
11
+ pull-requests: write # post guidance comments, lock PR after merge
12
+ statuses: write # set the commit status
13
+
14
+ jobs:
15
+ CLAAssistant:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: "CLA Assistant"
19
+ if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
20
+ # Upstream repo was archived in 2026-03; pin to the v2.6.1 commit SHA.
21
+ uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1
22
+ env:
23
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24
+ # repo-scope PAT with write access to langbot-app/cla
25
+ PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_PAT }}
26
+ with:
27
+ path-to-document: 'https://github.com/langbot-app/LangBot/blob/master/CLA.md'
28
+ remote-organization-name: 'langbot-app'
29
+ remote-repository-name: 'cla'
30
+ path-to-signatures: 'signatures/version1/cla.json'
31
+ branch: 'main'
32
+ allowlist: 'dependabot[bot],github-actions[bot],devin-ai-integration[bot],Copilot,renovate[bot],bot*'
33
+ custom-notsigned-prcomment: |
34
+ Thank you for your contribution! :heart: Before we can merge this pull request, we need you to sign the [LangBot Contributor License Agreement (CLA)](https://github.com/langbot-app/LangBot/blob/master/CLA.md). You keep full copyright of your code — the CLA grants us a license to use and distribute your contribution. Signing takes 10 seconds and covers all repositories in this organization, permanently.
35
+
36
+ 感谢您的贡献!合并前请阅读并签署[贡献者许可协议(CLA)](https://github.com/langbot-app/LangBot/blob/master/CLA.md)。您保留代码的全部版权,签署仅需回复下方指定内容,一次签署对本组织全部仓库永久有效。
37
+ custom-allsigned-prcomment: 'All contributors have signed the CLA. :white_check_mark: 所有贡献者均已签署 CLA。'
38
+ lock-pullrequest-aftermerge: true
39
+ # SECURITY: this workflow runs on pull_request_target (it holds secrets and has
40
+ # write access to the base repository). NEVER add an actions/checkout step that
41
+ # checks out the PR's code here.
@@ -816,34 +816,49 @@ Encapsulates plugin instance with:
816
816
 
817
817
  ### Communication Protocol (`runtime/io/`)
818
818
 
819
- **Action-Based Protocol**:
820
- - Bidirectional JSON messages
821
- - Request-response with sequence IDs
822
- - Streaming support via chunk status
823
- - File transfer (16KB chunks)
824
-
825
- **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`):
826
840
  ```json
827
- {
828
- "action": "action_name",
829
- "seq": 12345,
830
- "data": {...},
831
- "chunk_status": "start|continue|end"
832
- }
841
+ { "seq_id": 12345, "action": "action_name", "data": {} }
833
842
  ```
834
843
 
835
- **Response Structure**:
844
+ **Response** (`ActionResponse`, `entities/io/resp.py`):
836
845
  ```json
837
- {
838
- "seq": 12345,
839
- "ok": true,
840
- "data": {...}
841
- }
846
+ { "seq_id": 12345, "code": 0, "message": "success", "data": {}, "chunk_status": "continue" }
842
847
  ```
843
848
 
844
- **Transport Implementations**:
845
- - `StdioHandler`: stdin/stdout communication
846
- - `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
847
862
 
848
863
  ## CLI Tools
849
864
 
@@ -0,0 +1,15 @@
1
+ # Contributing to langbot-plugin-sdk
2
+
3
+ Thank you for your interest in contributing! For general contribution guidelines, please refer to the [LangBot contribution guide](https://github.com/langbot-app/LangBot/blob/master/CONTRIBUTING.md).
4
+
5
+ 感谢您有意参与贡献!通用贡献指引请参阅 [LangBot 贡献指南](https://github.com/langbot-app/LangBot/blob/master/CONTRIBUTING.md)。
6
+
7
+ ## Contributor License Agreement (CLA)
8
+
9
+ To protect the project and every contributor, we require all code contributors to sign the [LangBot Contributor License Agreement](https://github.com/langbot-app/LangBot/blob/master/CLA.md). You keep full copyright of your code — the CLA only grants us a license to use and distribute your contribution.
10
+
11
+ Signing takes 10 seconds: when you open your first PR, a bot will guide you to reply with a single comment. One signature covers all repositories in this organization, permanently.
12
+
13
+ 为了保护项目和每一位贡献者,我们要求所有代码贡献者签署 [LangBot 贡献者许可协议(CLA)](https://github.com/langbot-app/LangBot/blob/master/CLA.md)。您保留自己代码的全部版权,CLA 仅授予项目使用、分发您贡献的许可。
14
+
15
+ 签署只需 10 秒:首次提交 PR 时,机器人会自动评论提示,按提示回复一句话即完成签署,此后对本组织所有仓库永久有效。
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langbot-plugin
3
- Version: 0.4.2b4
3
+ Version: 0.5.0a2
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "langbot-plugin"
3
- version = "0.4.2b4"
3
+ version = "0.5.0a2"
4
4
  description = "This package contains the SDK, CLI for building plugins for LangBot, plus the runtime for hosting LangBot plugins"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -14,6 +14,7 @@ dependencies = [
14
14
  "e2b>=2.15",
15
15
  "httpx>=0.28.1",
16
16
  "jinja2>=3.1.6",
17
+ "packaging>=24.0",
17
18
  "pip>=25.2",
18
19
  "pydantic>=2.11.5",
19
20
  "pydantic-settings>=2.10.1",
@@ -0,0 +1,386 @@
1
+ from __future__ import annotations
2
+
3
+ # Platform adapter abstract base classes
4
+ import typing
5
+ import abc
6
+ import pydantic
7
+
8
+ import langbot_plugin.api.entities.builtin.platform.message as platform_message
9
+ import langbot_plugin.api.entities.builtin.platform.events as platform_events
10
+ import langbot_plugin.api.entities.builtin.platform.entities as platform_entities
11
+ import langbot_plugin.api.definition.abstract.platform.event_logger as abstract_platform_logger
12
+ from langbot_plugin.api.entities.builtin.platform.errors import NotSupportedError
13
+
14
+
15
+ class AbstractMessagePlatformAdapter(pydantic.BaseModel, metaclass=abc.ABCMeta):
16
+ """Message platform adapter base class."""
17
+
18
+ bot_account_id: str = pydantic.Field(default="")
19
+ """Bot account ID, should be set during initialization."""
20
+
21
+ config: dict
22
+
23
+ logger: abstract_platform_logger.AbstractEventLogger = pydantic.Field(exclude=True)
24
+
25
+ class Config:
26
+ arbitrary_types_allowed = True
27
+
28
+ def __init__(self, *args, **kwargs):
29
+ super().__init__(*args, **kwargs)
30
+
31
+ @abc.abstractmethod
32
+ async def send_message(
33
+ self, target_type: str, target_id: str, message: platform_message.MessageChain
34
+ ):
35
+ """Send a message proactively.
36
+
37
+ Args:
38
+ target_type: Target type, 'person' or 'group'.
39
+ target_id: Target ID.
40
+ message: Message chain to send.
41
+ """
42
+ raise NotImplementedError
43
+
44
+ @abc.abstractmethod
45
+ async def reply_message(
46
+ self,
47
+ message_source: platform_events.MessageEvent,
48
+ message: platform_message.MessageChain,
49
+ quote_origin: bool = False,
50
+ ):
51
+ """Reply to a message.
52
+
53
+ Args:
54
+ message_source: The source message event to reply to.
55
+ message: Message chain to send.
56
+ quote_origin: Whether to quote the original message. Defaults to False.
57
+ """
58
+ raise NotImplementedError
59
+
60
+ async def reply_message_chunk(
61
+ self,
62
+ message_source: platform_events.MessageEvent,
63
+ bot_message: dict,
64
+ message: platform_message.MessageChain,
65
+ quote_origin: bool = False,
66
+ is_final: bool = False,
67
+ ):
68
+ """Reply to a message (streaming output).
69
+
70
+ Args:
71
+ message_source: The source message event.
72
+ bot_message: Bot message context.
73
+ message: Message chain to send.
74
+ quote_origin: Whether to quote the original message. Defaults to False.
75
+ is_final: Whether this is the final chunk. Defaults to False.
76
+ """
77
+ raise NotImplementedError
78
+
79
+ async def create_message_card(
80
+ self, message_id: typing.Type[str, int], event: platform_events.MessageEvent
81
+ ) -> bool:
82
+ """Create a card message placeholder for streaming.
83
+
84
+ Args:
85
+ message_id: Message ID.
86
+ event: The source message event.
87
+ """
88
+ return False
89
+
90
+ async def is_muted(self, group_id: int) -> bool:
91
+ """Check if the bot is muted in the specified group."""
92
+ return False
93
+
94
+ @abc.abstractmethod
95
+ def register_listener(
96
+ self,
97
+ event_type: typing.Type[platform_events.Event],
98
+ callback: typing.Callable[
99
+ [platform_events.Event, AbstractMessagePlatformAdapter], None
100
+ ],
101
+ ):
102
+ """Register an event listener.
103
+
104
+ Args:
105
+ event_type: The event type to listen for.
106
+ callback: Callback function that receives the event and adapter.
107
+ """
108
+ raise NotImplementedError
109
+
110
+ @abc.abstractmethod
111
+ def unregister_listener(
112
+ self,
113
+ event_type: typing.Type[platform_events.Event],
114
+ callback: typing.Callable[
115
+ [platform_events.Event, AbstractMessagePlatformAdapter], None
116
+ ],
117
+ ):
118
+ """Unregister an event listener.
119
+
120
+ Args:
121
+ event_type: The event type to stop listening for.
122
+ callback: The callback to remove.
123
+ """
124
+ raise NotImplementedError
125
+
126
+ @abc.abstractmethod
127
+ async def run_async(self):
128
+ """Start the adapter asynchronously."""
129
+ raise NotImplementedError
130
+
131
+ async def is_stream_output_supported(self) -> bool:
132
+ """Check if streaming output is supported."""
133
+ return False
134
+
135
+ @abc.abstractmethod
136
+ async def kill(self) -> bool:
137
+ """Shut down the adapter.
138
+
139
+ Returns:
140
+ True if shutdown succeeded. On hot-reload, returning False
141
+ prevents the underlying MessageSource from being reloaded.
142
+ """
143
+ raise NotImplementedError
144
+
145
+
146
+ class AbstractPlatformAdapter(AbstractMessagePlatformAdapter):
147
+ """Platform adapter base class (EBA version).
148
+
149
+ Compared to the legacy AbstractMessagePlatformAdapter:
150
+ - Adds universal API methods (edit_message, delete_message, get_group_info, etc.)
151
+ - Adds pass-through API (call_platform_api)
152
+ - Adds capability declaration (get_supported_events, get_supported_apis)
153
+ - Event listeners support all event types, not just message events
154
+ """
155
+
156
+ # ---- Capability Declaration ----
157
+
158
+ def get_supported_events(self) -> list[str]:
159
+ """Return the list of event types supported by this adapter."""
160
+ return ["message.received"]
161
+
162
+ def get_supported_apis(self) -> list[str]:
163
+ """Return the list of APIs supported by this adapter."""
164
+ return ["send_message", "reply_message"]
165
+
166
+ # ---- Optional Message Methods ----
167
+
168
+ async def edit_message(
169
+ self,
170
+ chat_type: str,
171
+ chat_id: typing.Union[int, str],
172
+ message_id: typing.Union[int, str],
173
+ new_content: platform_message.MessageChain,
174
+ ) -> None:
175
+ """Edit a previously sent message."""
176
+ raise NotSupportedError("edit_message")
177
+
178
+ async def delete_message(
179
+ self,
180
+ chat_type: str,
181
+ chat_id: typing.Union[int, str],
182
+ message_id: typing.Union[int, str],
183
+ ) -> None:
184
+ """Delete / recall a message."""
185
+ raise NotSupportedError("delete_message")
186
+
187
+ async def forward_message(
188
+ self,
189
+ from_chat_type: str,
190
+ from_chat_id: typing.Union[int, str],
191
+ message_id: typing.Union[int, str],
192
+ to_chat_type: str,
193
+ to_chat_id: typing.Union[int, str],
194
+ ) -> platform_events.MessageResult:
195
+ """Forward a message."""
196
+ raise NotSupportedError("forward_message")
197
+
198
+ async def get_message(
199
+ self,
200
+ chat_type: str,
201
+ chat_id: typing.Union[int, str],
202
+ message_id: typing.Union[int, str],
203
+ ) -> platform_events.MessageReceivedEvent:
204
+ """Retrieve a specific message."""
205
+ raise NotSupportedError("get_message")
206
+
207
+ # ---- Optional Group Methods ----
208
+
209
+ async def get_group_info(
210
+ self,
211
+ group_id: typing.Union[int, str],
212
+ ) -> platform_entities.UserGroup:
213
+ """Get group information."""
214
+ raise NotSupportedError("get_group_info")
215
+
216
+ async def get_group_list(self) -> list[platform_entities.UserGroup]:
217
+ """Get the list of groups the bot has joined."""
218
+ raise NotSupportedError("get_group_list")
219
+
220
+ async def get_group_member_list(
221
+ self,
222
+ group_id: typing.Union[int, str],
223
+ ) -> list[platform_entities.UserGroupMember]:
224
+ """Get the member list of a group."""
225
+ raise NotSupportedError("get_group_member_list")
226
+
227
+ async def get_group_member_info(
228
+ self,
229
+ group_id: typing.Union[int, str],
230
+ user_id: typing.Union[int, str],
231
+ ) -> platform_entities.UserGroupMember:
232
+ """Get information about a specific group member."""
233
+ raise NotSupportedError("get_group_member_info")
234
+
235
+ async def set_group_name(
236
+ self,
237
+ group_id: typing.Union[int, str],
238
+ name: str,
239
+ ) -> None:
240
+ """Set the group name."""
241
+ raise NotSupportedError("set_group_name")
242
+
243
+ async def mute_member(
244
+ self,
245
+ group_id: typing.Union[int, str],
246
+ user_id: typing.Union[int, str],
247
+ duration: int = 0,
248
+ ) -> None:
249
+ """Mute a group member."""
250
+ raise NotSupportedError("mute_member")
251
+
252
+ async def unmute_member(
253
+ self,
254
+ group_id: typing.Union[int, str],
255
+ user_id: typing.Union[int, str],
256
+ ) -> None:
257
+ """Unmute a group member."""
258
+ raise NotSupportedError("unmute_member")
259
+
260
+ async def kick_member(
261
+ self,
262
+ group_id: typing.Union[int, str],
263
+ user_id: typing.Union[int, str],
264
+ ) -> None:
265
+ """Kick a member from the group."""
266
+ raise NotSupportedError("kick_member")
267
+
268
+ async def leave_group(
269
+ self,
270
+ group_id: typing.Union[int, str],
271
+ ) -> None:
272
+ """Make the bot leave a group."""
273
+ raise NotSupportedError("leave_group")
274
+
275
+ # ---- Optional User Methods ----
276
+
277
+ async def get_user_info(
278
+ self,
279
+ user_id: typing.Union[int, str],
280
+ ) -> platform_entities.User:
281
+ """Get user information."""
282
+ raise NotSupportedError("get_user_info")
283
+
284
+ async def get_friend_list(self) -> list[platform_entities.User]:
285
+ """Get the bot's friend list."""
286
+ raise NotSupportedError("get_friend_list")
287
+
288
+ async def approve_friend_request(
289
+ self,
290
+ request_id: typing.Union[int, str],
291
+ approve: bool = True,
292
+ remark: typing.Optional[str] = None,
293
+ ) -> None:
294
+ """Handle a friend request."""
295
+ raise NotSupportedError("approve_friend_request")
296
+
297
+ async def approve_group_invite(
298
+ self,
299
+ request_id: typing.Union[int, str],
300
+ approve: bool = True,
301
+ ) -> None:
302
+ """Handle a group invitation."""
303
+ raise NotSupportedError("approve_group_invite")
304
+
305
+ # ---- Optional Media Methods ----
306
+
307
+ async def upload_file(
308
+ self,
309
+ file_data: bytes,
310
+ filename: str,
311
+ ) -> str:
312
+ """Upload a file. Returns file ID or URL."""
313
+ raise NotSupportedError("upload_file")
314
+
315
+ async def get_file_url(
316
+ self,
317
+ file_id: str,
318
+ ) -> str:
319
+ """Get a file download URL."""
320
+ raise NotSupportedError("get_file_url")
321
+
322
+ # ---- Pass-through API ----
323
+
324
+ async def call_platform_api(
325
+ self,
326
+ action: str,
327
+ params: dict = {},
328
+ ) -> dict:
329
+ """Call an adapter-specific platform API."""
330
+ raise NotSupportedError("call_platform_api")
331
+
332
+
333
+ class AbstractMessageConverter:
334
+ """Message chain converter base class."""
335
+
336
+ @staticmethod
337
+ def yiri2target(message_chain: platform_message.MessageChain):
338
+ """Convert internal message chain to platform-specific format.
339
+
340
+ Args:
341
+ message_chain: Internal message chain.
342
+
343
+ Returns:
344
+ Platform-specific message representation.
345
+ """
346
+ raise NotImplementedError
347
+
348
+ @staticmethod
349
+ def target2yiri(message_chain: typing.Any) -> platform_message.MessageChain:
350
+ """Convert platform-specific message to internal message chain.
351
+
352
+ Args:
353
+ message_chain: Platform-specific message.
354
+
355
+ Returns:
356
+ Internal message chain.
357
+ """
358
+ raise NotImplementedError
359
+
360
+
361
+ class AbstractEventConverter:
362
+ """Event converter base class."""
363
+
364
+ @staticmethod
365
+ def yiri2target(event: typing.Type[platform_events.Event]):
366
+ """Convert internal event to platform-specific event.
367
+
368
+ Args:
369
+ event: Internal event.
370
+
371
+ Returns:
372
+ Platform-specific event.
373
+ """
374
+ raise NotImplementedError
375
+
376
+ @staticmethod
377
+ def target2yiri(event: typing.Any) -> platform_events.Event:
378
+ """Convert platform-specific event to internal event.
379
+
380
+ Args:
381
+ event: Platform-specific event.
382
+
383
+ Returns:
384
+ Internal event.
385
+ """
386
+ raise NotImplementedError