Skip to main content

matrix-hub-client

小灵的应用中心端侧:读目录、把"要做什么"交给小灵、把本机做好的 node 发出去。

它是一份 pip 包,装进 lynn 的 .venv(不是自己的环境)—— 因为应用中心必须和 lynn 同版本。

hard rules(这几个决定了一切)

  1. hub 只存文档:NODE.md(运行契约)、INSTALL.md(怎么装)、README.md(给人看)。 代码永远不进 hub,它在自己的 git 仓里,地址写在 INSTALL.md 正文。
  2. 页面只发 signal:下载、绑定都不是页面执行的。页面拿不到进度,也不该编。
  3. 发布 = 三份原文,multipart 一次提交;title / description / platforms 由服务端从 NODE.md 派生,客户端不传。

装

uv pip install --python ~/lynn/.venv/bin/python -e ~/matrix-hub-client
python -m matrix_hub_client --selftest     # 离线自检:不联网、不需要 key

用

python -m matrix_hub_client serve --port 20890     # 起页面(node 里由宿主起)
python -m matrix_hub_client probe                  # /healthz + /api/v1/me
python -m matrix_hub_client list                   # 目录
python -m matrix_hub_client show weather           # 元数据 + 三份原文
python -m matrix_hub_client check nodes/meituan    # 发布前体检(不联网)
python -m matrix_hub_client publish nodes/meituan  # 提交(--dry-run 只体检)
python -m matrix_hub_client install weather        # 打印安装计划(--run 才执行)

环境变量:

变量 默认 说明
MATRIX_HUB_URL https://matrix-hub.rvsystems.cn 服务端端点
MATRIX_HUB_KEY ~/.lynn/credentials 的 lynn_key 覆盖 key
MATRIX_HUB_PORT 20890 页面端口
LYNN_ROOT ~/lynn 三格 node 目录的根

代码地图

src/matrix_hub_client/
  api.py       12 条路由,一条一个方法;失败一律 HubError
  errors.py    code 是分支依据,message 只给人看
  schema.py    pydantic 模型,服务端多给字段不算错
  local.py     读三份文档 / 判能不能发 / 看 git 现状
  publish.py   体检 + 提交(只发文档)
  install.py   找地址 → clone → moss nodes install(默认 dry-run)
  service.py   把 hub 和本机捏成一份状态;signal 投递箱
  server.py    starlette:页面 + 五个 JSON 接口
  node.py      MOSS 装配(页面 + channel),没有 MOSS 时裸起页面
  cli.py       子命令
  web/         页面(单文件,无框架无 CDN)

两条容易踩的

  • 「在仓里」≠「自己是仓」:git rev-parse --show-toplevel 会一路往上走。nodes/meituan 躺在 lynn 仓里,但它是"还没绑",不是"绑到了 lynn"。local.read_git_state 只认目录自己 就是仓根,否则记 parent_repo。
  • SSH 地址别人拉不到:发布要求 origin 是 https(匿名可 clone)。ssh://…:10022/… 和本机路径都会被自检拦下。

测试

PYTHONPATH=src pytest -q      # 36 个,不联网

还没对的

  • https://matrix-hub.rvsystems.cn 在开发机上解析不到(api.rvsystems.cn、 git.rvsystems.cn 能解析)。端点定了之后改 DEFAULT_BASE_URL 或设 MATRIX_HUB_URL。
  • 上传时 platforms 用逗号串(mac,win,linux)提交;服务端如果收的是重复字段或 JSON 数组, 改 api.publish_node 一处即可。

Metadata

Release files for matrix-hub-client 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for matrix-hub-client 0.1.0
File Size Uploaded Provenance Actions
matrix_hub_client-0.1.0.tar.gz 74.9 kB Without provenance Details for matrix_hub_client-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for matrix-hub-client 0.1.0
File Interpreter ABI Platform Actions
matrix_hub_client-0.1.0-py3-none-any.whl Python 3 none any Details for matrix_hub_client-0.1.0-py3-none-any.whl

Total release size: 133.3 kB

Release files / matrix_hub_client-0.1.0.tar.gz

Download URL matrix_hub_client-0.1.0.tar.gz
Size 74.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1634d32caef532cae6071fad394c28d631f264f2d604955c2bbd8913a33f6503
BLAKE2b-256 checksum
How to use checksums
187e9e25ca09efdf39a23a16f64ca719dd8ed41a5484aaad1d005a8bc24447e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.8

Release files / matrix_hub_client-0.1.0-py3-none-any.whl

Download URL matrix_hub_client-0.1.0-py3-none-any.whl
Size 58.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1c0bfb0c93236565134351462d22db954240344da82ddac0c2b653bc07407b6
BLAKE2b-256 checksum
How to use checksums
e49707afb59991ea8edc602ebf3ade8d6bc864c47f48860a323bffd1bfba8db7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.8

Security for matrix-hub-client 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page