Back to home@horizon105457

tsstream

🌊 Agent-native time-series streaming for DeepSeek Harness (DSH plugin) — terminal/serial byte streams → indexed, queryable, event-driven timeline. 16 tools · 9 operators · 🧪 experimental

Stars
0
Language
TypeScript
Created
Aug 26, 2026
Updated
Aug 26, 2026

Introduction

🌊 tsstream

Agent 原生时序流式分析 —— DeepSeek Harness(DSH)插件
把终端 / 串口字节流,变成可索引、可回查、事件驱动的时序数据流

license status node

⚠️ 实验性项目:当前处于早期开发阶段,尚不稳定,接口与行为可能随版本变动;建议仅用于学习、研究与实验环境。本项目会持续维护与更新,欢迎反馈与贡献。

这是什么

tsstream 是一个可安装的 DSH 插件(TypeScript 包 @tsstream/core),让 DeepSeek Harness 的 Agent 能以时序的方式处理持续输出的字节流——终端日志、串口数据等。

Agent 处理长日志的传统做法是「整段灌进上下文再 grep」,又贵又慢。tsstream 改为 事件钩子唤醒 + 有界窗口回查 + 降采样,让 Agent 只读它真正需要的那几行。

✨ 特性

  • 🕒 持续采集 + 时间轴:捕获终端 / 串口输出(stdout + stderr 合并),每个数据包带微秒级时间戳(PTS)。
  • 🔔 事件钩子:自动标记 error / warning / idle 等事件;无事件时 Agent 不必被唤醒。
  • 🔁 收发完整记录:发送的输入也记入同一条时间线,可确认发送成功、回溯完整交互。
  • 🧩 Agent 可自我配置:以结构化配置下发声明式算子,Agent 在线搭建「行分割 → 解析 → 索引」处理链。
  • 🎯 随机访问 + 降采样:按时间窗口回查、长窗口均匀抽样,大幅削减注入上下文的体积。

🚀 安装

dsh plugin --profile <name> add file:./packages/core   # 安装为依赖
# 在 profile 的 cordis.patch.yml 追加:
#   - insert:
#       - id: tsstream
#         name: '@tsstream/core'
#         config: { dataRoot: '~/.tsstream' }
dsh --profile <name> --dump-config                      # 验证 compose

环境要求:Node.js ≥ 22。唯一运行时依赖为 zodserialport / node-pty 为可选原生依赖,未安装不影响终端与模拟场景。

⚡ 快速体验(无需硬件)

# 端到端 Demo:采集 → 行分割 → CSV 解析 → 字段提取 → 阈值索引
node examples/demo.ts

# 终端场景 Demo:长构建日志中定位报错 + 读上下文(对比上下文注入体积)
node examples/demo-terminal.ts

# 运行测试
node --test packages/core/test/*.test.ts

🧰 Agent 工具(16 个)

  • 查询:stream_list / stream_info / stream_read / stream_recent / stream_events / stream_context
  • 交互:stream_write(发送输入,TX 记入时间线)
  • 监听:stream_watch(静默时植入 idle 事件)
  • 算子:plugin_deploy / plugin_list / plugin_status / plugin_remove
  • 批处理:batch_submit / batch_status
  • 缓存:cache_protect / cache_list_protected

🧩 内置算子(9 个)

line-split · csv-parse · field-extract · fixed-split · unit-convert · regex-index · threshold-index · keyword-index · idle-index

📄 License

MIT