首页龙虾技能列表 › Pilot Stream Data — 实时 NDJSON 数据流传输

Pilot Stream Data — 实时 NDJSON 数据流传输

v1.0.0

通过 Pilot 协议的持久连接实现实时 NDJSON 数据流传输。适用于:实时跨代理流式传输结构化数据、发送连续传感器读取、日志或指标、需要双向流式通信带有背压控制。

0· 79·0 当前·0 累计
by @teoslayer (Calin Teodor)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/4/9
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
该技能仅用于通过 Pilot Protocol 和 pilotctl CLI 发送/接收 NDJSON,要求和指令与此目的相符,不请求无关的凭据或风险安装。
评估建议
["确保 pilotctl 和使用的 pilot-protocol 实现来自可信源且保持更新;技能假设正在运行的守护进程和网络连接。","确认目的地址(DEST)和发送的元数据不包含机密信息或个人身份信息(PII);流式传输是连续的,可能会在配置错误时泄露数据。","示例使用 shell 管道和无限循环;在监督下运行它们(或作为托管服务)以避免 CPU/磁盘使用量失控。","如果依赖 Pilot Protocol 连接的加密/身份验证,请验证守护进程上的配置;SKILL.md 不描述安全传输详细信息。","适配示例时,优先使用安全的 shell 实践(一致地引用变量)以避免意外的单词拆分或意外的 globbing。"]...
详细分析 ▾
用途与能力
Name, description, and required binaries (pilotctl) align with the provided bash examples and stated purpose (real-time NDJSON streaming). Declared ancillary dependencies (jq, bc, optional gzip) are appropriate for the sample commands.
指令范围
SKILL.md only instructs running pilotctl and local unix utilities (jq, bc, gzip) and shows producer/consumer loops; it does not read unrelated system files, ask for credentials, or transmit data to unintended external endpoints. Operational cautions: examples use infinite loops (while true) and write to /tmp/pilot-stream.log; users should monitor resource usage and confirm destination addresses are correct.
安装机制
This is instruction-only with no install spec or downloadable artifacts — minimal risk because nothing is written to disk by the skill itself. It expects the pilotctl binary to already exist on PATH.
凭证需求
The skill declares no required environment variables or credentials. The commands in SKILL.md likewise do not access any sensitive environment variables or unrelated configuration paths. This is proportionate for a CLI-based streaming helper.
持久化与权限
The skill does not request always:true or elevated persistence. It is user-invocable and allows autonomous invocation by default (platform normal), but the skill itself does not attempt to modify other skills or system-wide settings.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/4/9

初始发布

● 无害

安装命令 点击复制

官方npx clawhub@latest install pilot-stream-data
镜像加速npx clawhub@latest install pilot-stream-data --registry https://cn.clawhub-mirror.com

技能文档

通过 Pilot Protocol 的持久连接实现实时 NDJSON 数据流传输。

使用场景

  • 需要实时跨代理流式传输结构化数据
2.想要发送连续传感器读取、日志或指标
  • 需要双向流式通信带有背压控制

不建议使用场景

  • 需要传输文件(使用 pilot-sharepilot-sync
  • 需要发布/订阅广播(使用 pilot-pubsub
  • 需要请求/响应模式(使用 pilot-rpc

命令

启动流式服务器:

pilotctl --json listen 1002 > /tmp/pilot-stream.log &

流式传输 NDJSON 数据:

DEST="1:0001.AAAA.BBBB"
while true; do
  MSG="{\"timestamp\":$(date +%s),\"temp\":$(echo "scale=2; 20 + $RANDOM % 10" | bc),\"humidity\":50}"
  pilotctl --json send "$DEST" 1002 --data "$MSG"
  sleep 1
done

接收和处理流式数据:

pilotctl --json listen 1002 | while read -r line; do
  TIMESTAMP=$(echo "$line" | jq -r '.timestamp')
  VALUE=$(echo "$line" | jq -r '.value')
  echo "[$TIMESTAMP] Value: $VALUE"
done

订阅流式主题:

pilotctl --json subscribe "$DEST" data-stream | while read -r line; do
  echo "Data: $(echo $line | jq -r '.value")"
done

工作流示例

#!/bin/bash
# 实时传感器数据流式传输
STREAM_PORT=1002
DEST="1:0001.AAAA.BBBB"

# 生产者:流式传输传感器数据 produce_stream() { echo "Starting stream producer" # 发送元数据头 pilotctl --json send "$DEST" "$STREAM_PORT" \ --data "{\"type\":\"stream_start\",\"schema\":\"temp_humidity_v1\"}" # 流式传输数据 counter=0 while true; do timestamp=$(date +%s) temp=$(echo "scale=2; 20 + ($counter % 10)" | bc) humidity=$(echo "scale=2; 50 + ($counter % 20)" | bc) pilotctl --json send "$DEST" "$STREAM_PORT" \ --data "{\"type\":\"data\",\"timestamp\":$timestamp,\"temp\":$temp,\"humidity\":$humidity,\"seq\":$counter}" counter=$((counter + 1)) sleep 1 done }

# 消费者:接收和处理 consume_stream() { pilotctl --json listen "$STREAM_PORT" | while read -r line; do type=$(echo "$line" | jq -r '.type') if [ "$type" = "data" ]; then temp=$(echo "$line" | jq -r '.temp') echo "Temperature: ${temp}°C" fi done }

produce_stream

依赖

要求 pilot-protocol 技能、运行守护进程、jqbc,以及可选的 gzip 用于压缩。

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务