langbot-plugin 0.3.4__tar.gz → 0.3.6__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.
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/PKG-INFO +1 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/pyproject.toml +1 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/command/command.py +4 -2
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/knowledge_engine/engine.py +11 -12
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/manifest.py +25 -5
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/tool/tool.py +3 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/command/context.py +5 -4
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/command/errors.py +2 -2
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/platform/entities.py +0 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/platform/events.py +55 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/platform/message.py +7 -3
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/provider/message.py +9 -5
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/rag/models.py +0 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/events.py +12 -8
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.yaml.example +6 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/event_listener/default.yaml.example +3 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.yaml.example +12 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.yaml.example +6 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.yaml.example +6 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/manifest.yaml.example +6 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/__init__.py +14 -4
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/commands/initplugin.py +9 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/commands/login.py +26 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/commands/publish.py +1 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/commands/runplugin.py +9 -4
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/gen/renderer.py +39 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/i18n.py +15 -3
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/locales/__init__.py +4 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/locales/en_US.py +3 -0
- langbot_plugin-0.3.6/src/langbot_plugin/cli/locales/es_ES.py +76 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/locales/ja_JP.py +3 -0
- langbot_plugin-0.3.6/src/langbot_plugin/cli/locales/th_TH.py +76 -0
- langbot_plugin-0.3.6/src/langbot_plugin/cli/locales/vi_VN.py +76 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/locales/zh_Hans.py +3 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/locales/zh_Hant.py +3 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/run/controller.py +27 -10
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/run/handler.py +63 -20
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/run/hotreload.py +5 -7
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/app.py +0 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/context.py +1 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/helper/marketplace.py +45 -0
- langbot_plugin-0.3.6/src/langbot_plugin/runtime/helper/pkgmgr.py +129 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/connections/stdio.py +24 -14
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/connections/ws.py +5 -5
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/handler.py +23 -13
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/handlers/control.py +34 -19
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/handlers/plugin.py +13 -5
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/plugin/container.py +0 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/plugin/mgr.py +208 -68
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/settings.py +1 -3
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/utils/discover/engine.py +4 -2
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/utils/log.py +1 -3
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/utils/platform.py +0 -1
- langbot_plugin-0.3.6/src/langbot_plugin/version.py +1 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/tests/api/entities/test_events.py +4 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/tests/test_log.py +4 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/tests/test_message.py +14 -12
- langbot_plugin-0.3.4/src/langbot_plugin/runtime/helper/pkgmgr.py +0 -38
- langbot_plugin-0.3.4/src/langbot_plugin/version.py +0 -1
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/.github/workflows/publish-pypi.yaml +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/.gitignore +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/.python-version +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/AGENTS.md +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/CLAUDE.md +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/LICENSE +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/README.md +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/data/.env.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/docs/Message.md +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/docs/communication/apis/lb2rt.md +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/docs/communication/runtime_plugin.md +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/docs/dependency-management.md +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/docs/langbot-plugin-social.png +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/abstract/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/abstract/platform/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/abstract/platform/adapter.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/abstract/platform/event_logger.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/base.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/command/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/common/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/common/event_listener.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/knowledge_engine/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/parser/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/parser/parser.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/components/tool/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/definition/plugin.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/command/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/pipeline/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/pipeline/query.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/platform/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/platform/logger.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/provider/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/provider/prompt.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/provider/session.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/rag/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/rag/context.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/rag/enums.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/rag/errors.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/resource/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/builtin/resource/tool.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/entities/context.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/proxies/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/proxies/base.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/proxies/event_context.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/proxies/execute_context.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/proxies/langbot_api.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/api/proxies/query_based_api.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/.env.example.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/.gitignore.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/.vscode/launch.json.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/README.md.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/assets/icon.svg.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/commands/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/commands/{cmd_name}.py.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/event_listener/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/event_listener/default.py.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/knowledge_engine/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/knowledge_engine/{knowledge_engine_name}.py.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/parser/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/parser/{parser_name}.py.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/tools/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/components/tools/{tool_name}.py.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/main.py.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/assets/templates/requirements.txt.example +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/__main__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/commands/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/commands/buildplugin.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/commands/gencomponent.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/commands/logout.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/gen/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/run/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/utils/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/utils/cloudsv.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/cli/utils/form.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/entities/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/entities/io/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/entities/io/actions/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/entities/io/actions/enums.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/entities/io/errors.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/entities/io/req.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/entities/io/resp.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/entities/marketplace.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/LICENSE +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/README.md +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/helper/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/connection.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/connections/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/controller.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/controllers/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/controllers/stdio/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/controllers/stdio/client.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/controllers/stdio/server.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/controllers/ws/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/controllers/ws/client.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/controllers/ws/server.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/io/handlers/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/runtime/plugin/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/utils/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/utils/discover/__init__.py +0 -0
- {langbot_plugin-0.3.4 → langbot_plugin-0.3.6}/src/langbot_plugin/utils/importutil.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langbot-plugin
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
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
|
|
@@ -83,8 +83,10 @@ class Command(BaseComponent):
|
|
|
83
83
|
if next_crt_command not in self.registered_subcommands:
|
|
84
84
|
# find if there is a subcommand with '*' name
|
|
85
85
|
for subcommand in self.registered_subcommands:
|
|
86
|
-
if subcommand ==
|
|
87
|
-
async for return_value in self.registered_subcommands[
|
|
86
|
+
if subcommand == "*":
|
|
87
|
+
async for return_value in self.registered_subcommands[
|
|
88
|
+
subcommand
|
|
89
|
+
].subcommand(self, context):
|
|
88
90
|
yield return_value
|
|
89
91
|
return
|
|
90
92
|
|
|
@@ -70,7 +70,7 @@ class KnowledgeEngine(BaseComponent):
|
|
|
70
70
|
|
|
71
71
|
async def on_knowledge_base_create(self, kb_id: str, config: dict) -> None:
|
|
72
72
|
"""Called when a knowledge base using this engine is created.
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
Args:
|
|
75
75
|
kb_id: The knowledge base identifier.
|
|
76
76
|
config: Creation settings provided by the user.
|
|
@@ -79,7 +79,7 @@ class KnowledgeEngine(BaseComponent):
|
|
|
79
79
|
|
|
80
80
|
async def on_knowledge_base_delete(self, kb_id: str) -> None:
|
|
81
81
|
"""Called when a knowledge base using this engine is deleted.
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
Args:
|
|
84
84
|
kb_id: The knowledge base identifier.
|
|
85
85
|
"""
|
|
@@ -90,16 +90,16 @@ class KnowledgeEngine(BaseComponent):
|
|
|
90
90
|
@abc.abstractmethod
|
|
91
91
|
async def ingest(self, context: IngestionContext) -> IngestionResult:
|
|
92
92
|
"""Ingest a document into the knowledge base.
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
This method should:
|
|
95
95
|
1. Read the file using `await self.plugin.get_knowledge_file_stream(context.file_object.storage_path)`
|
|
96
96
|
2. Parse and chunk the content
|
|
97
97
|
3. Embed using `await self.plugin.invoke_embedding(embedding_model_uuid, [chunk.text for chunk in chunks])`
|
|
98
98
|
4. Store using `await self.plugin.vector_upsert(collection_id=context.get_collection_id(), ...)`
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
Args:
|
|
101
101
|
context: Ingestion context containing file info and settings.
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
Returns:
|
|
104
104
|
Ingestion result with status and metadata.
|
|
105
105
|
"""
|
|
@@ -108,13 +108,13 @@ class KnowledgeEngine(BaseComponent):
|
|
|
108
108
|
@abc.abstractmethod
|
|
109
109
|
async def delete_document(self, kb_id: str, document_id: str) -> bool:
|
|
110
110
|
"""Delete a document and its associated data from the knowledge base.
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
Use `await self.plugin.vector_delete(...)` to clean up vectors.
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
Args:
|
|
115
115
|
kb_id: Knowledge base identifier.
|
|
116
116
|
document_id: Document identifier to delete.
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
Returns:
|
|
119
119
|
True if deletion was successful.
|
|
120
120
|
"""
|
|
@@ -123,17 +123,16 @@ class KnowledgeEngine(BaseComponent):
|
|
|
123
123
|
@abc.abstractmethod
|
|
124
124
|
async def retrieve(self, context: RetrievalContext) -> RetrievalResponse:
|
|
125
125
|
"""Retrieve relevant content from the knowledge base.
|
|
126
|
-
|
|
126
|
+
|
|
127
127
|
This method should:
|
|
128
128
|
1. Embed query using `await self.plugin.invoke_embedding(embedding_model_uuid, [query])`
|
|
129
129
|
2. Search using `await self.plugin.vector_search(kb_id, ...)`
|
|
130
130
|
3. Return structured response
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
Args:
|
|
133
133
|
context: Retrieval context with query and settings.
|
|
134
|
-
|
|
134
|
+
|
|
135
135
|
Returns:
|
|
136
136
|
Structured retrieval response.
|
|
137
137
|
"""
|
|
138
138
|
pass
|
|
139
|
-
|
|
@@ -8,26 +8,46 @@ import sys
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class I18nString(pydantic.BaseModel):
|
|
11
|
-
"""
|
|
11
|
+
"""Internationalized string"""
|
|
12
12
|
|
|
13
13
|
en_US: str
|
|
14
|
-
"""
|
|
14
|
+
"""English"""
|
|
15
15
|
|
|
16
16
|
zh_Hans: typing.Optional[str] = None
|
|
17
|
-
"""
|
|
17
|
+
"""Simplified Chinese"""
|
|
18
|
+
|
|
19
|
+
zh_Hant: typing.Optional[str] = None
|
|
20
|
+
"""Traditional Chinese"""
|
|
18
21
|
|
|
19
22
|
ja_JP: typing.Optional[str] = None
|
|
20
|
-
"""
|
|
23
|
+
"""Japanese"""
|
|
24
|
+
|
|
25
|
+
th_TH: typing.Optional[str] = None
|
|
26
|
+
"""Thai"""
|
|
27
|
+
|
|
28
|
+
vi_VN: typing.Optional[str] = None
|
|
29
|
+
"""Vietnamese"""
|
|
30
|
+
|
|
31
|
+
es_ES: typing.Optional[str] = None
|
|
32
|
+
"""Spanish"""
|
|
21
33
|
|
|
22
34
|
def to_dict(self) -> dict:
|
|
23
|
-
"""
|
|
35
|
+
"""Convert to dictionary"""
|
|
24
36
|
dic = {}
|
|
25
37
|
if self.en_US is not None:
|
|
26
38
|
dic["en_US"] = self.en_US
|
|
27
39
|
if self.zh_Hans is not None:
|
|
28
40
|
dic["zh_Hans"] = self.zh_Hans
|
|
41
|
+
if self.zh_Hant is not None:
|
|
42
|
+
dic["zh_Hant"] = self.zh_Hant
|
|
29
43
|
if self.ja_JP is not None:
|
|
30
44
|
dic["ja_JP"] = self.ja_JP
|
|
45
|
+
if self.th_TH is not None:
|
|
46
|
+
dic["th_TH"] = self.th_TH
|
|
47
|
+
if self.vi_VN is not None:
|
|
48
|
+
dic["vi_VN"] = self.vi_VN
|
|
49
|
+
if self.es_ES is not None:
|
|
50
|
+
dic["es_ES"] = self.es_ES
|
|
31
51
|
return dic
|
|
32
52
|
|
|
33
53
|
|
|
@@ -13,6 +13,8 @@ class Tool(BaseComponent):
|
|
|
13
13
|
__kind__ = "Tool"
|
|
14
14
|
|
|
15
15
|
@abc.abstractmethod
|
|
16
|
-
async def call(
|
|
16
|
+
async def call(
|
|
17
|
+
self, params: dict[str, Any], session: provider_session.Session, query_id: int
|
|
18
|
+
) -> str:
|
|
17
19
|
"""Call the tool."""
|
|
18
20
|
pass
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from typing import Any, Optional
|
|
4
|
-
import typing
|
|
5
4
|
|
|
6
5
|
import pydantic
|
|
7
6
|
|
|
@@ -39,14 +38,16 @@ class CommandReturn(pydantic.BaseModel):
|
|
|
39
38
|
"""
|
|
40
39
|
|
|
41
40
|
@classmethod
|
|
42
|
-
@pydantic.field_validator(
|
|
43
|
-
def _validate_error(
|
|
41
|
+
@pydantic.field_validator("error", mode="before")
|
|
42
|
+
def _validate_error(
|
|
43
|
+
cls, v: Optional[errors.CommandError]
|
|
44
|
+
) -> Optional[errors.CommandError]:
|
|
44
45
|
if v is not None:
|
|
45
46
|
return errors.CommandError(message=v.message)
|
|
46
47
|
return v
|
|
47
48
|
|
|
48
49
|
@classmethod
|
|
49
|
-
@pydantic.field_serializer(
|
|
50
|
+
@pydantic.field_serializer("error")
|
|
50
51
|
def _serialize_error(cls, v: Optional[errors.CommandError]) -> Optional[str]:
|
|
51
52
|
if v is not None:
|
|
52
53
|
return v.message
|
|
@@ -126,3 +126,58 @@ class GroupMessage(MessageEvent):
|
|
|
126
126
|
"message_chain": self.message_chain.model_dump(),
|
|
127
127
|
"time": self.time,
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
###############################
|
|
132
|
+
# Feedback Event
|
|
133
|
+
class FeedbackEvent(Event):
|
|
134
|
+
"""User feedback event (like/dislike).
|
|
135
|
+
|
|
136
|
+
Fired when a user gives feedback (thumbs up / thumbs down) on an AI Bot
|
|
137
|
+
response. Currently only supported by the WeChat Work (WeCom) AI Bot
|
|
138
|
+
adapter, but designed to be platform-agnostic so other adapters can adopt
|
|
139
|
+
it in the future.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
feedback_id: Unique feedback identifier assigned by the platform.
|
|
143
|
+
feedback_type: ``1`` = like (thumbs up), ``2`` = dislike (thumbs down).
|
|
144
|
+
feedback_content: Optional free-form text the user attached.
|
|
145
|
+
inaccurate_reasons: Optional list of predefined "inaccurate" reason
|
|
146
|
+
tags selected by the user (for dislikes).
|
|
147
|
+
user_id: ID of the user who gave feedback.
|
|
148
|
+
session_id: Session / conversation ID (e.g. ``"person_xxx"`` or
|
|
149
|
+
``"group_xxx"``).
|
|
150
|
+
message_id: ID of the message being rated.
|
|
151
|
+
stream_id: Stream ID (for streaming responses).
|
|
152
|
+
source_platform_object: Raw platform-specific object, kept for
|
|
153
|
+
adapter-level introspection.
|
|
154
|
+
"""
|
|
155
|
+
|
|
156
|
+
type: str = "FeedbackEvent"
|
|
157
|
+
|
|
158
|
+
feedback_id: str
|
|
159
|
+
"""Unique feedback identifier from the platform."""
|
|
160
|
+
|
|
161
|
+
feedback_type: int
|
|
162
|
+
"""1 = like, 2 = dislike."""
|
|
163
|
+
|
|
164
|
+
feedback_content: typing.Optional[str] = None
|
|
165
|
+
"""Free-form user feedback text."""
|
|
166
|
+
|
|
167
|
+
inaccurate_reasons: typing.Optional[typing.List[str]] = None
|
|
168
|
+
"""Predefined inaccuracy reasons (for dislikes)."""
|
|
169
|
+
|
|
170
|
+
user_id: typing.Optional[str] = None
|
|
171
|
+
"""ID of the user who submitted the feedback."""
|
|
172
|
+
|
|
173
|
+
session_id: typing.Optional[str] = None
|
|
174
|
+
"""Session / conversation ID."""
|
|
175
|
+
|
|
176
|
+
message_id: typing.Optional[str] = None
|
|
177
|
+
"""ID of the original message being rated."""
|
|
178
|
+
|
|
179
|
+
stream_id: typing.Optional[str] = None
|
|
180
|
+
"""Stream message ID (for streaming responses)."""
|
|
181
|
+
|
|
182
|
+
source_platform_object: typing.Optional[typing.Any] = None
|
|
183
|
+
"""Raw platform event object."""
|
|
@@ -2,7 +2,6 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import base64
|
|
4
4
|
import httpx
|
|
5
|
-
import logging
|
|
6
5
|
import typing
|
|
7
6
|
import aiofiles
|
|
8
7
|
from datetime import datetime
|
|
@@ -188,10 +187,15 @@ class MessageChain(pydantic.RootModel[list[pydantic.SerializeAsAny[MessageCompon
|
|
|
188
187
|
# message_chain inside each ForwardMessageNode
|
|
189
188
|
if component_type == "Forward" and "node_list" in item:
|
|
190
189
|
for node_data in item["node_list"]:
|
|
191
|
-
if
|
|
190
|
+
if (
|
|
191
|
+
isinstance(node_data, dict)
|
|
192
|
+
and "message_chain" in node_data
|
|
193
|
+
):
|
|
192
194
|
mc = node_data["message_chain"]
|
|
193
195
|
if isinstance(mc, list):
|
|
194
|
-
node_data["message_chain"] =
|
|
196
|
+
node_data["message_chain"] = (
|
|
197
|
+
MessageChain.model_validate(mc)
|
|
198
|
+
)
|
|
195
199
|
|
|
196
200
|
# Special processing of the time field of the Source class
|
|
197
201
|
if component_type == "Source" and "time" in item:
|
|
@@ -26,6 +26,7 @@ class ImageURLContentObject(pydantic.BaseModel):
|
|
|
26
26
|
def __str__(self):
|
|
27
27
|
return self.url[:128] + ("..." if len(self.url) > 128 else "")
|
|
28
28
|
|
|
29
|
+
|
|
29
30
|
class ContentElement(pydantic.BaseModel):
|
|
30
31
|
type: str
|
|
31
32
|
"""Type of the content"""
|
|
@@ -48,7 +49,7 @@ class ContentElement(pydantic.BaseModel):
|
|
|
48
49
|
elif self.type == "image_url":
|
|
49
50
|
return f"[Image]({self.image_url})"
|
|
50
51
|
elif self.type == "image_base64":
|
|
51
|
-
return
|
|
52
|
+
return "[Image](base64)"
|
|
52
53
|
elif self.type == "file_url":
|
|
53
54
|
return f"[File]({self.file_url})"
|
|
54
55
|
elif self.type == "file_base64":
|
|
@@ -125,9 +126,11 @@ class Message(pydantic.BaseModel):
|
|
|
125
126
|
if ce.type == "text":
|
|
126
127
|
if ce.text is not None:
|
|
127
128
|
mc.append(platform_message.Plain(text=ce.text))
|
|
128
|
-
elif ce.type ==
|
|
129
|
+
elif ce.type == "file_url":
|
|
129
130
|
if ce.file_url is not None:
|
|
130
|
-
mc.append(
|
|
131
|
+
mc.append(
|
|
132
|
+
platform_message.File(url=ce.file_url, name=ce.file_name)
|
|
133
|
+
)
|
|
131
134
|
elif ce.type == "image_url":
|
|
132
135
|
assert ce.image_url is not None
|
|
133
136
|
if ce.image_url.url.startswith("http"):
|
|
@@ -216,7 +219,9 @@ class MessageChunk(pydantic.BaseModel):
|
|
|
216
219
|
mc.append(platform_message.Plain(text=ce.text))
|
|
217
220
|
elif ce.type == "file_url":
|
|
218
221
|
if ce.file_url is not None:
|
|
219
|
-
mc.append(
|
|
222
|
+
mc.append(
|
|
223
|
+
platform_message.File(url=ce.file_url, name=ce.file_name)
|
|
224
|
+
)
|
|
220
225
|
elif ce.type == "image_url":
|
|
221
226
|
if ce.image_url.url.startswith("http"):
|
|
222
227
|
mc.append(platform_message.Image(url=ce.image_url.url))
|
|
@@ -231,7 +236,6 @@ class MessageChunk(pydantic.BaseModel):
|
|
|
231
236
|
if ce.image_base64 is not None:
|
|
232
237
|
mc.append(platform_message.Image(base64=ce.image_base64))
|
|
233
238
|
|
|
234
|
-
|
|
235
239
|
# 找第一个文字组件
|
|
236
240
|
if prefix_text:
|
|
237
241
|
for i, c in enumerate(mc):
|
|
@@ -102,8 +102,8 @@ class GroupMessageReceived(BaseEventModel):
|
|
|
102
102
|
class _WithReplyMessageChain(BaseEventModel):
|
|
103
103
|
"""事件模型基类,包含回复消息链对象"""
|
|
104
104
|
|
|
105
|
-
reply_message_chain: typing.Optional[platform_message.MessageChain] =
|
|
106
|
-
serialization_alias="reply_message_chain", default=None
|
|
105
|
+
reply_message_chain: typing.Optional[platform_message.MessageChain] = (
|
|
106
|
+
pydantic.Field(serialization_alias="reply_message_chain", default=None)
|
|
107
107
|
)
|
|
108
108
|
"""回复消息链对象,仅在阻止默认行为时有效"""
|
|
109
109
|
|
|
@@ -157,9 +157,11 @@ class PersonNormalMessageReceived(_WithReplyMessageChain):
|
|
|
157
157
|
def validate_message_event(cls, v):
|
|
158
158
|
return platform_events.FriendMessage.model_validate(v)
|
|
159
159
|
|
|
160
|
-
user_message_alter: typing.Optional[
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
user_message_alter: typing.Optional[
|
|
161
|
+
typing.Union[
|
|
162
|
+
provider_message.ContentElement, list[provider_message.ContentElement], str
|
|
163
|
+
]
|
|
164
|
+
] = pydantic.Field(default=None)
|
|
163
165
|
"""修改后的 LLM 消息对象,可用于改写用户消息"""
|
|
164
166
|
|
|
165
167
|
|
|
@@ -199,9 +201,11 @@ class GroupNormalMessageReceived(_WithReplyMessageChain):
|
|
|
199
201
|
def validate_message_event(cls, v):
|
|
200
202
|
return platform_events.GroupMessage.model_validate(v)
|
|
201
203
|
|
|
202
|
-
user_message_alter: typing.Optional[
|
|
203
|
-
|
|
204
|
-
|
|
204
|
+
user_message_alter: typing.Optional[
|
|
205
|
+
typing.Union[
|
|
206
|
+
provider_message.ContentElement, list[provider_message.ContentElement], str
|
|
207
|
+
]
|
|
208
|
+
] = pydantic.Field(default=None)
|
|
205
209
|
"""修改后的 LLM 消息对象,可用于改写用户消息"""
|
|
206
210
|
|
|
207
211
|
|
|
@@ -5,9 +5,15 @@ metadata:
|
|
|
5
5
|
label:
|
|
6
6
|
en_US: {{ cmd_label }}
|
|
7
7
|
zh_Hans: {{ cmd_label }}
|
|
8
|
+
th_TH: {{ cmd_label }}
|
|
9
|
+
vi_VN: {{ cmd_label }}
|
|
10
|
+
es_ES: {{ cmd_label }}
|
|
8
11
|
description:
|
|
9
12
|
en_US: '{{ cmd_description }}'
|
|
10
13
|
zh_Hans: '{{ cmd_description }}'
|
|
14
|
+
th_TH: '{{ cmd_description }}'
|
|
15
|
+
vi_VN: '{{ cmd_description }}'
|
|
16
|
+
es_ES: '{{ cmd_description }}'
|
|
11
17
|
spec:
|
|
12
18
|
execution:
|
|
13
19
|
python:
|
|
@@ -5,15 +5,24 @@ metadata:
|
|
|
5
5
|
label:
|
|
6
6
|
en_US: {{ knowledge_engine_label }}
|
|
7
7
|
zh_Hans: {{ knowledge_engine_label }}
|
|
8
|
+
th_TH: {{ knowledge_engine_label }}
|
|
9
|
+
vi_VN: {{ knowledge_engine_label }}
|
|
10
|
+
es_ES: {{ knowledge_engine_label }}
|
|
8
11
|
description:
|
|
9
12
|
en_US: '{{ knowledge_engine_description }}'
|
|
10
13
|
zh_Hans: '{{ knowledge_engine_description }}'
|
|
14
|
+
th_TH: '{{ knowledge_engine_description }}'
|
|
15
|
+
vi_VN: '{{ knowledge_engine_description }}'
|
|
16
|
+
es_ES: '{{ knowledge_engine_description }}'
|
|
11
17
|
spec:
|
|
12
18
|
creation_schema:
|
|
13
19
|
- name: chunk_size
|
|
14
20
|
label:
|
|
15
21
|
en_US: Chunk Size
|
|
16
22
|
zh_Hans: 分块大小
|
|
23
|
+
th_TH: ขนาดชิ้นส่วน
|
|
24
|
+
vi_VN: Kích thước khối
|
|
25
|
+
es_ES: Tamaño de fragmento
|
|
17
26
|
type: integer
|
|
18
27
|
required: false
|
|
19
28
|
default: 500
|
|
@@ -22,6 +31,9 @@ spec:
|
|
|
22
31
|
label:
|
|
23
32
|
en_US: Score Threshold
|
|
24
33
|
zh_Hans: 分数阈值
|
|
34
|
+
th_TH: เกณฑ์คะแนน
|
|
35
|
+
vi_VN: Ngưỡng điểm
|
|
36
|
+
es_ES: Umbral de puntuación
|
|
25
37
|
type: float
|
|
26
38
|
required: false
|
|
27
39
|
default: 0.5
|
|
@@ -5,9 +5,15 @@ metadata:
|
|
|
5
5
|
label:
|
|
6
6
|
en_US: {{ parser_label }}
|
|
7
7
|
zh_Hans: {{ parser_label }}
|
|
8
|
+
th_TH: {{ parser_label }}
|
|
9
|
+
vi_VN: {{ parser_label }}
|
|
10
|
+
es_ES: {{ parser_label }}
|
|
8
11
|
description:
|
|
9
12
|
en_US: '{{ parser_description }}'
|
|
10
13
|
zh_Hans: '{{ parser_description }}'
|
|
14
|
+
th_TH: '{{ parser_description }}'
|
|
15
|
+
vi_VN: '{{ parser_description }}'
|
|
16
|
+
es_ES: '{{ parser_description }}'
|
|
11
17
|
spec:
|
|
12
18
|
supported_mime_types:
|
|
13
19
|
- application/pdf
|
|
@@ -5,9 +5,15 @@ metadata:
|
|
|
5
5
|
label:
|
|
6
6
|
en_US: {{ tool_label }}
|
|
7
7
|
zh_Hans: {{ tool_label }}
|
|
8
|
+
th_TH: {{ tool_label }}
|
|
9
|
+
vi_VN: {{ tool_label }}
|
|
10
|
+
es_ES: {{ tool_label }}
|
|
8
11
|
description:
|
|
9
12
|
en_US: '{{ tool_description }}'
|
|
10
13
|
zh_Hans: '{{ tool_description }}'
|
|
14
|
+
th_TH: '{{ tool_description }}'
|
|
15
|
+
vi_VN: '{{ tool_description }}'
|
|
16
|
+
es_ES: '{{ tool_description }}'
|
|
11
17
|
spec:
|
|
12
18
|
parameters: {}
|
|
13
19
|
llm_prompt: '{{ tool_description }}'
|
|
@@ -8,9 +8,15 @@ metadata:
|
|
|
8
8
|
description:
|
|
9
9
|
en_US: '{{ plugin_description }}'
|
|
10
10
|
zh_Hans: '{{ plugin_description }}'
|
|
11
|
+
th_TH: '{{ plugin_description }}'
|
|
12
|
+
vi_VN: '{{ plugin_description }}'
|
|
13
|
+
es_ES: '{{ plugin_description }}'
|
|
11
14
|
label:
|
|
12
15
|
en_US: {{ plugin_label }}
|
|
13
16
|
zh_Hans: {{ plugin_label }}
|
|
17
|
+
th_TH: {{ plugin_label }}
|
|
18
|
+
vi_VN: {{ plugin_label }}
|
|
19
|
+
es_ES: {{ plugin_label }}
|
|
14
20
|
icon: assets/icon.svg # replace in assets/icon.svg
|
|
15
21
|
spec:
|
|
16
22
|
config: []
|
|
@@ -60,14 +60,22 @@ def main():
|
|
|
60
60
|
"-s", "--stdio", action="store_true", help="Use stdio for control connection"
|
|
61
61
|
)
|
|
62
62
|
run_parser.add_argument(
|
|
63
|
-
"--prod",
|
|
63
|
+
"--prod",
|
|
64
|
+
action="store_true",
|
|
65
|
+
help="Mark this process as production plugin process, only used on Windows",
|
|
64
66
|
)
|
|
65
67
|
run_parser.add_argument(
|
|
66
|
-
"--plugin-debug-key",
|
|
68
|
+
"--plugin-debug-key",
|
|
69
|
+
type=str,
|
|
70
|
+
help="Debug key for plugin authentication",
|
|
71
|
+
default="",
|
|
67
72
|
)
|
|
68
73
|
|
|
69
74
|
# login command
|
|
70
75
|
login_parser = subparsers.add_parser("login", help="Login to LangBot account")
|
|
76
|
+
login_parser.add_argument(
|
|
77
|
+
"--token", "-t", help="Login with a personal access token", default=None
|
|
78
|
+
)
|
|
71
79
|
|
|
72
80
|
# logout command
|
|
73
81
|
logout_parser = subparsers.add_parser("logout", help="Logout from LangBot account")
|
|
@@ -107,7 +115,9 @@ def main():
|
|
|
107
115
|
"--debug-only", action="store_true", help="Only run the debug server"
|
|
108
116
|
)
|
|
109
117
|
rt_parser.add_argument(
|
|
110
|
-
"--skip-deps-check",
|
|
118
|
+
"--skip-deps-check",
|
|
119
|
+
action="store_true",
|
|
120
|
+
help="Skip checking and installing dependencies for all installed plugins",
|
|
111
121
|
)
|
|
112
122
|
|
|
113
123
|
args = parser.parse_args()
|
|
@@ -122,7 +132,7 @@ def main():
|
|
|
122
132
|
case "ver":
|
|
123
133
|
cli_print("version_info", __version__)
|
|
124
134
|
case "login":
|
|
125
|
-
login_process()
|
|
135
|
+
login_process(token=args.token)
|
|
126
136
|
case "logout":
|
|
127
137
|
logout_process()
|
|
128
138
|
case "init":
|
|
@@ -71,6 +71,9 @@ form_fields = [
|
|
|
71
71
|
"label": {
|
|
72
72
|
"en_US": "Plugin author",
|
|
73
73
|
"zh_Hans": "插件作者",
|
|
74
|
+
"th_TH": "ผู้พัฒนาปลั๊กอิน",
|
|
75
|
+
"vi_VN": "Tác giả plugin",
|
|
76
|
+
"es_ES": "Autor del plugin",
|
|
74
77
|
},
|
|
75
78
|
"required": True,
|
|
76
79
|
"format": {
|
|
@@ -78,6 +81,9 @@ form_fields = [
|
|
|
78
81
|
"error": {
|
|
79
82
|
"en_US": "Invalid plugin author, please use a valid name, which only contains letters, numbers, underscores and hyphens.",
|
|
80
83
|
"zh_Hans": "无效的插件作者,请使用一个有效的名称,只能包含字母、数字、下划线和连字符。",
|
|
84
|
+
"th_TH": "ชื่อผู้พัฒนาปลั๊กอินไม่ถูกต้อง กรุณาใช้ชื่อที่ถูกต้อง ซึ่งประกอบด้วยตัวอักษร ตัวเลข ขีดล่าง และขีดกลางเท่านั้น",
|
|
85
|
+
"vi_VN": "Tên tác giả plugin không hợp lệ, vui lòng sử dụng tên hợp lệ, chỉ chứa chữ cái, số, dấu gạch dưới và dấu gạch ngang.",
|
|
86
|
+
"es_ES": "Autor del plugin no válido, por favor use un nombre válido que solo contenga letras, números, guiones bajos y guiones.",
|
|
81
87
|
},
|
|
82
88
|
},
|
|
83
89
|
},
|
|
@@ -86,6 +92,9 @@ form_fields = [
|
|
|
86
92
|
"label": {
|
|
87
93
|
"en_US": "Plugin description",
|
|
88
94
|
"zh_Hans": "插件描述",
|
|
95
|
+
"th_TH": "คำอธิบายปลั๊กอิน",
|
|
96
|
+
"vi_VN": "Mô tả plugin",
|
|
97
|
+
"es_ES": "Descripción del plugin",
|
|
89
98
|
},
|
|
90
99
|
"required": True,
|
|
91
100
|
},
|
|
@@ -13,7 +13,27 @@ from langbot_plugin.cli.i18n import cli_print, t
|
|
|
13
13
|
SERVER_URL = get_cloud_service_url()
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def login_process() -> None:
|
|
16
|
+
def login_process(token: str | None = None) -> None:
|
|
17
|
+
if token is not None:
|
|
18
|
+
if not token.startswith("lbpat_"):
|
|
19
|
+
cli_print("pat_invalid_format")
|
|
20
|
+
return
|
|
21
|
+
|
|
22
|
+
config = {
|
|
23
|
+
"access_token": token,
|
|
24
|
+
"token_type": "personal_access_token",
|
|
25
|
+
"login_time": int(time.time()),
|
|
26
|
+
"expires_in": 0,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
config_file = _save_config(config)
|
|
30
|
+
|
|
31
|
+
print("\n" + "=" * 50)
|
|
32
|
+
cli_print("pat_login_successful")
|
|
33
|
+
cli_print("pat_saved", config_file)
|
|
34
|
+
print("=" * 50)
|
|
35
|
+
return
|
|
36
|
+
|
|
17
37
|
"""
|
|
18
38
|
Implement LangBot CLI login process
|
|
19
39
|
|
|
@@ -200,6 +220,9 @@ def _is_token_valid(config: dict[str, Any]) -> bool:
|
|
|
200
220
|
if not config:
|
|
201
221
|
return False
|
|
202
222
|
|
|
223
|
+
if config.get("token_type") == "personal_access_token":
|
|
224
|
+
return True
|
|
225
|
+
|
|
203
226
|
login_time = config.get("login_time", 0)
|
|
204
227
|
expires_in = config.get("expires_in", 0)
|
|
205
228
|
|
|
@@ -247,6 +270,8 @@ def _refresh_token(config: dict[str, Any]) -> bool:
|
|
|
247
270
|
def check_login_status() -> bool:
|
|
248
271
|
"""Check login status"""
|
|
249
272
|
config = _load_config()
|
|
273
|
+
if config and config.get("token_type") == "personal_access_token":
|
|
274
|
+
return True
|
|
250
275
|
if not _is_token_valid(config):
|
|
251
276
|
# try refresh token
|
|
252
277
|
if not _refresh_token(config):
|
|
@@ -6,7 +6,7 @@ import httpx
|
|
|
6
6
|
from langbot_plugin.cli.commands.login import check_login_status, get_access_token
|
|
7
7
|
from langbot_plugin.cli.commands.buildplugin import build_plugin_process
|
|
8
8
|
from langbot_plugin.cli.utils.cloudsv import get_cloud_service_url
|
|
9
|
-
from langbot_plugin.cli.i18n import cli_print
|
|
9
|
+
from langbot_plugin.cli.i18n import cli_print
|
|
10
10
|
|
|
11
11
|
SERVER_URL = get_cloud_service_url()
|
|
12
12
|
|