BMCLI web
命令名、参数与机器可读字段保持英文,以便直接复制到终端或交给 AI 使用;当前安装版本的精确契约请以
bmcli help ... --format=json为准。
Host the packaged engineering console and BUSMUST Automation API v1 inside the
BMCLI daemon. The first release exposes typed channel snapshots, CAN/CAN FD/LIN
message send, cursor-based raw history, SSE, binary WebSocket frames, DBC signal
decode plans, and runtime command discovery. It does not execute arbitrary
command lines. /api/v1/operations reports every current CLI operation and
whether its typed HTTP handler has been migrated.
web start
Section titled “web start”# Default: loopback only, packaged console, no token requiredbmcli web start --listen=127.0.0.1:8080 --format=json
# Explicit project Web rootbmcli web start --listen=127.0.0.1:8080 --web-root=<directory> --format=json
# Non-loopback plain HTTP requires authentication and explicit risk acknowledgementbmcli web start --listen=0.0.0.0:8080 --token=<secret> --allow-insecure-http --format=jsonweb start starts the daemon when needed. Open hardware channels with daemon start --channel=... or channel open before using hardware endpoints. The
default history capacity is 8192 events and can be changed with
--history-capacity=<count>.
| Endpoint | Purpose |
|---|---|
GET /api/v1/info |
Product, build, API, and service identity |
GET /api/v1/health |
Daemon, Web, and channel-broker health |
GET /api/v1/capabilities |
Transports, resources, limits, and security defaults |
GET /api/v1/openapi.json |
Packaged and regression-gated OpenAPI 3.1 contract |
GET /api/v1/operations[/{operation_id}] |
Runtime CommandRegistry and HTTP migration policy |
GET/POST /api/v1/channels |
List or open daemon channels |
GET/PATCH/DELETE /api/v1/channels/{selector} |
Inspect, configure, or close a daemon channel |
GET/POST /api/v1/databases |
List or load typed database resources inside the project working root |
GET/DELETE /api/v1/databases/{name} |
Inspect or unload one database resource |
GET/POST /api/v1/tx-tasks |
List or add a channel TX task/LIN slave response |
DELETE /api/v1/tx-tasks/{task_id} |
Remove one channel TX task |
GET/POST /api/v1/routes |
List or add a hardware message route |
DELETE /api/v1/routes/{route_id} |
Remove one hardware message route |
POST /api/v1/messages |
Typed CAN/CAN FD/LIN send or LIN transaction |
GET /api/v1/messages/history |
Cursor-based raw history with explicit expiry |
GET /api/v1/messages/stream |
SSE raw-message stream with gap events |
GET /api/v1/messages/ws |
bmcli.frames.v1 BMF1 binary stream |
GET /api/v1/signals |
Active DBC decode plans |
POST /api/v1/signals/plans |
Create a bounded DBC signal plan |
DELETE /api/v1/signals/plans/{plan_id} |
Delete a signal plan |
GET /api/v1/signals/latest |
Latest decoded signal sample |
GET /api/v1/signals/history |
Cursor-based decoded signal history |
GET /api/v1/signals/stream |
SSE decoded-signal stream |
The exact request fields, units, limits, errors, query parameters, and WebSocket
layout are authoritative in /api/v1/openapi.json. Read it at runtime instead
of copying this table into an application. Percent-encode / when a stable
SN/port selector is placed in a path segment, for example 10356%2F0; query
parameters and JSON fields keep the ordinary 10356/0 form. POST /api/v1/execute is not a
shell: v1 accepts only the migrated one-token version operation. Use dedicated
resource endpoints for hardware work.
All ordinary daemon receive consumers share one RxBroker owner per channel.
message recv, software logging, gateway forwarding, Web history, SSE,
WebSocket, and DBC signal decoding therefore use independent cursors instead of
competing calls to BM_Read. History expiry returns 409 cursor_expired; SSE
and WebSocket streams emit an explicit gap event.
Security and limits
Section titled “Security and limits”- Default bind is
127.0.0.1; CORS is disabled. - Any non-loopback bind requires
--token; API callers useAuthorization: Bearer <token>. WebSocket clients may usebmcli.token.<token>as a second subprotocol. - Non-loopback bind also requires the presence-only
--allow-insecure-httpacknowledgement. This option does not weaken loopback defaults or add encryption; it prevents an accidental remote bind from looking secure merely because a token was supplied. - The current embedded server uses plain HTTP. A bearer token authenticates a caller but does not encrypt headers, payloads, bus traffic, or the token itself. Keep loopback as the normal deployment. Use a non-loopback listener only on a trusted isolated engineering network with host firewall rules, or place it behind an approved HTTPS reverse proxy; do not expose it directly to an untrusted LAN or the Internet.
- Static files are read-only and reject path traversal.
- Request body limit is 64 KiB; response limit is 2 MiB; simultaneous client,
SSE, and WebSocket limits are reported by
capabilities. - Treat Web message send and signal-plan creation as active bench operations. Apply the same authorization and cleanup rules as direct BMCLI commands.
web status / stop
Section titled “web status / stop”bmcli web status --format=jsonbmcli web stop --format=jsonweb stop releases the listener and stream clients but leaves a pre-existing
daemon and its open channels running.
权威来源: bmcli_reference.md in the BMCLI repository. Run bmcli help <category> <action> --format=json for the exact contract of the installed version.