ChatLark
ChatArch 的 Feishu/Lark bot helper 包,承接从 ChatTool 拆出的轻量机器人、消息发送、事件服务和消息内容构造能力。更广泛的 Feishu/Lark OpenAPI 操作仍优先使用官方 lark-cli。
快速开始
pip install -e ".[dev]"
chatlark --help
chatlark --version
chatlark --tree
chatlark --tree-brief
chatlark send --help
chatlark serve --help
python -m pytest -q
python -m build
CLI
chatlark info
chatlark send USER_ID "Hello"
chatlark send "Hello" # 使用 FEISHU_DEFAULT_RECEIVER_ID
chatlark send -t chat_id "Hello team" # 使用 FEISHU_DEFAULT_CHAT_ID
chatlark serve echo
chatlark serve webhook
模型调用相关命令暂不放入 ChatLark 的默认命令面;需要模型 backend 的 bot 编排会在后续单独设计,避免重新引入 ChatTool 或其他 LLM runtime 硬依赖。
CLI 树
chatlark --tree 由 ChatStyle 从真实 Click registry 渲染,并保留参数签名:
chatlark
├── --help # Show this message and exit.
├── --version # Show the version and exit.
├── --tree # Print the registered CLI tree and exit.
├── --tree-brief # Print the registered CLI tree without parameter signatures and exit.
├── info [--env ENV-REF] # Read bot metadata and validate credentials without printing secrets.
├── send [RECEIVER] [TEXT] [--env ENV-REF] [--type ID-TYPE] # Send one remote text message and print its message ID, never credentials.
└── serve # Run long-lived Lark bot network services.
├── echo [--mode MODE] [--host HOST] [--port PORT] [--log-level LOG-LEVEL] # Run an echo bot that receives and replies to remote messages.
└── webhook [--host HOST] [--port PORT] [--path PATH] [--log-level LOG-LEVEL] [--encrypt-key ENCRYPT-KEY] [--verification-token VERIFICATION-TOKEN] # Run a webhook verifier without printing token values.
chatlark --tree-brief 保留同一组节点和说明,但省略参数签名。
| Leaf | 主要输入 | 输出 | 副作用与边界 |
|---|---|---|---|
chatlark info |
可选 Feishu profile 或 .env |
bot 名称、Open ID、状态 | 只读远程请求;不输出凭据 |
chatlark send |
receiver、text、ID type、可选配置 | message_id 或错误码 |
发送一条远程消息;不输出凭据 |
chatlark serve echo |
mode、host、port、log level | 长期运行日志 | 接收并回复消息;不输出凭据 |
chatlark serve webhook |
listener 与 webhook 参数 | 长期运行日志 | 启动监听服务;不输出 token 值 |
Python API
from chatlark import LarkBot, ChatSession
bot = LarkBot()
session = ChatSession(system="你是助手")
@bot.on_message
def chat(ctx):
ctx.reply(session.chat(ctx.sender_id, ctx.text))
bot.start()
配置
ChatLark 复用 ChatEnv 的 Feishu 配置字段:
FEISHU_APP_IDFEISHU_APP_SECRETFEISHU_API_BASEFEISHU_DEFAULT_RECEIVER_IDFEISHU_DEFAULT_CHAT_ID
默认从 ChatEnv active Feishu profile($CHATARCH_HOME/envs/Feishu/.env)读取,并回退到进程环境变量。info 和 send 也可通过 -e/--env 指定 ChatEnv Feishu profile 名称或显式 .env 文件;命名 profile 由 ChatEnv EnvStore 解析,且不会被全局激活。
边界
- ChatLark:bot helper、消息发送、事件服务、消息上下文、消息内容构造。
- lark-cli:广泛 Feishu/Lark OpenAPI 操作和用户授权流程。
- ChatTool:迁移完成后只应保留有意设计的兼容入口或依赖连接,不再重复持有 Lark business logic。
开发说明
扩展前先阅读 DEVELOP.md 和 AGENTS.md。发布走 PyPI Trusted Publisher/OIDC workflow,不使用本地 token 上传正式版本。
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chatlark-0.1.2.tar.gz.
File metadata
- Download URL: chatlark-0.1.2.tar.gz
- Upload date:
- Size: 25.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fa53688e64bdcb7d9042c0be45d52e3cdd5fb459b232be949d54920b78c593e
|
|
| MD5 |
281b7058c83dd23d528d105f0631a324
|
|
| BLAKE2b-256 |
2d129b83c5cc40ddea5faa67dfa1df2d5c083ab626a85f14a5fb642584da8b9c
|
Provenance
The following attestation bundles were made for chatlark-0.1.2.tar.gz:
Publisher:
publish.yml on ChatArch/ChatLark
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chatlark-0.1.2.tar.gz -
Subject digest:
9fa53688e64bdcb7d9042c0be45d52e3cdd5fb459b232be949d54920b78c593e - Sigstore transparency entry: 2550922087
- Sigstore integration time:
-
Permalink:
ChatArch/ChatLark@dabb0f14f8b9ebe61df202b87fd1b8ee04004825 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/ChatArch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dabb0f14f8b9ebe61df202b87fd1b8ee04004825 -
Trigger Event:
push
-
Statement type:
File details
Details for the file chatlark-0.1.2-py3-none-any.whl.
File metadata
- Download URL: chatlark-0.1.2-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc8c41075b2b38b1e31e6a200e3066ceaa81b2b622a4d7f42f41d06d85cb47f3
|
|
| MD5 |
ff99a2016474d1ae3a15eddfff2848da
|
|
| BLAKE2b-256 |
4e875657778df98db1f66c17395789ce0fa2dfd3dc9a3a9dff389fb7910130a3
|
Provenance
The following attestation bundles were made for chatlark-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on ChatArch/ChatLark
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chatlark-0.1.2-py3-none-any.whl -
Subject digest:
dc8c41075b2b38b1e31e6a200e3066ceaa81b2b622a4d7f42f41d06d85cb47f3 - Sigstore transparency entry: 2550922135
- Sigstore integration time:
-
Permalink:
ChatArch/ChatLark@dabb0f14f8b9ebe61df202b87fd1b8ee04004825 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/ChatArch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dabb0f14f8b9ebe61df202b87fd1b8ee04004825 -
Trigger Event:
push
-
Statement type: