
Security News
Deno Goes the Way of the Dinosaur
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.
dsh-asciinema
Advanced tools
DSH plugin: record terminal/tool output as asciinema v2 (.cast), replay with an offline embedded player, and export HTML.
[!IMPORTANT] 依赖前置:相邻
dsh-src检出(link:依赖) 本项目在开发形态下使用link:依赖指向相邻的 DeepSeek Harness 源码检出(dsh-src), 与当前仓库保持同一父目录布局(<parent>/dsh-src)。克隆本仓库后:
- 先把官方
deepseek-ai/deepseek-harness检出到与本仓库同级的dsh-src/目录,并执行其pnpm install && pnpm run build;- 再按下方「安装」一节执行本仓库的
pnpm install --offline && pnpm build与测试。 发布到 npm 的版本会尽量把link:依赖替换为 registry 真实版本;无法替换的内部包保持link:,见各包 README 说明。
DSH 插件:把会话中的终端/工具输出录制为 asciinema v2(.cast) 文件,提供内嵌播放器
(自带离线渲染器,标签结构对齐 asciinema-player 数据模型)回放与 HTML 导出。
session/event 事件流中的 tool/result 输出(无需依赖 terminals 服务)。dsh-asciinema/
├── cordis.yml # bundle patch:插入一行插件(可配)
├── package.json # dsh.bundle 声明 + peerDependencies + engines.node
├── tsconfig.json # 静态检查(noEmit,路径映射指向同级 dsh-src)
├── tsconfig.build.json # 构建配置:src → lib/(ESM + .d.ts)
├── LICENSE # MIT
├── NOTICE # 第三方声明(MPL-2.0 player 资产/NOTICE)
├── src/
│ ├── index.ts # 装配:注册 3 工具 + 会话录制器 + 会话结束策略
│ ├── cast-core.ts # v2 格式核心:writer/reader/尺寸/时间轴/ANSI(零依赖)
│ ├── recorder.ts # 订阅 tool/result → 事件缓冲;SessionRecorder / RecorderRegistry
│ ├── cast-io.ts # 读写 .cast/.html、播放器模板加载
│ └── tools/
│ ├── rec.ts # term_rec:start/stop/mark/status(按会话隔离)
│ ├── play.ts # term_play:离线 HTML 回放或文本化
│ └── cat.ts # term_cat:cast → 纯文本
├── assets/
│ └── player.html # 自带离线渲染器模板(无 <asciinema-player> 标签,支持 ?url= 加载)
├── lib/ # pnpm build 产物(main/types 指向此,源码形态下不预置)
└── tests/
├── smoke.e2e.ts # 离线单元级冒烟(纯逻辑,未挂载 DSH 运行时;16 项)
└── node-ambient.d.ts
交付形态说明 — 当前为源码形态:
package.json的main/types指向lib/(编译产物), 但仓库不预置lib/。正式挂载前必须先pnpm build;开发期可用绝对路径直载源码 (见下文两种模式)。运行/加载.ts依赖 Node ≥23.6 内置 type 擦除;22.x 需--experimental-strip-types启动标志(engines.node已声明>=23.6.0)。
作为 bundle 安装(仓库根目录),按环境选一种挂载模式:
模式 A — dev:绝对路径行名直载源码(免构建,开发期):
dsh plugin --profile demo add /abs/path/to/dsh-asciinema/src/index.ts
dsh --patch /abs/path/to/dsh-asciinema/cordis.yml # 或本地叠加
模式 B — 生产:编译入口/裸包名(推荐正式环境):
cd dsh-asciinema && pnpm build # 生成 lib/(ESM + .d.ts)
dsh plugin --profile demo add ./dsh-asciinema # 解析 package.json main → lib/index.js
cordis.yml 的插入行:
- insert:
- id: asciinema
name: dsh-asciinema
config:
width: 100 # 录制几何宽
height: 40 # 录制几何高
maxEvents: 5000 # 事件条数上限(超过封存)
maxBytes: 1048576 # 数据字节上限(超过封存)
recordInput: false # 隐私默认:只录输出,不录输入
castsDir: '.casts' # 落盘目录(相对会话工作区)
playerUrl为预留字段,未实现:源码不消费该配置,配置了也不生效,故不在上述配置 清单中列出(历史版本曾出现,见「行为细节」)。
参数:action('start'|'stop'|'mark'|'status')、name?、scope('session'|'command')、
record_input?、marker?。
start:订阅当前会话的 tool/result 输出,缓冲为 [delay, 'o', data];delay 相对录制
开始、单调不减。stop:同名再调用即停止,写 <castsDir>/<name>.cast 到会话工作区(version=2、
width×height、timestamp、env{SHELL,TERM}、title),返回路径与事件数。mark:录制中插入 'm' 标记事件(可选命令,"标记此处")。status:列出活动录制。scope=command:当前 agent 步骤(step/end)结束自动封存,适合"这条命令的输出"。record_input=true 才以 'i' 记录。参数:path(必填)、mode('auto'|'html'|'text')。
.cast 同目录的 .html,返回可点击链接;presentationMeta 持久化回放卡片。mode=text:输出去除控制序列的纯文本(无浏览器环境兜底)。参数:path(必填)、raw?、include_input?。
'o' 事件,默认剥离 ANSI 控制序列;raw=true 保留 escape 序列原文
(终端协议保真,播放时由播放器解释)。maxEvents/maxBytes 时封存(seal),标记
truncated 并在停止结果里提示;封存后不再吸收新事件。assets/player.html 为自带离线渲染器(剥离 ANSI、行缓冲、播放/暂停、
速度、seek、marker 展示、idle 快进),数据模型对齐 asciinema-player(内嵌 v2 cast;
无 <asciinema-player> 标签、无官方 player 依赖),并可 ?url=xxx.cast 直接加载
外部文件。官方 asciinema-player(MPL-2.0)暂未随包;playerUrl 为预留字段,未实现,
当前不提供官方 player 标签注入。分发时携带 NOTICE。pnpm build # 编译 src → lib/(ESM + .d.ts);正式挂载前执行
pnpm test # 离线单元级冒烟:node --no-warnings tests/smoke.e2e.ts(16 项)
pnpm typecheck # 静态类型检查(tsc,noEmit)
tool/result→'o'、输入隐私、step/end 命令边界)、注册表
同会话冲突与跨会话隔离、播放器模板渲染(含 </script> 转义与内嵌 JS 语法校验)。
限制:以自写 parser 自证 round-trip,未与官方 asciinema play/player 做互操作验证;
播放器仅做模板/语法级校验,未在浏览器/DOM 中执行播放流程。import .ts,需 Node ≥23.6(内置 type 擦除;22.x 加
--experimental-strip-types,见 engines.node)。dsh-src 各包的已编译声明,前提:旁边有同级 dsh-src 检出
(tsconfig paths 用相对路径 ../../../dsh-src,换目录布局需同步调整;peerDependencies
由 DSH host 提供)。asciicast v2(https://docs.asciinema.org/manual/asciicast/v2/ ):
version=2;events 为 [delay, type, data] 三元组;'o'=输出、'i'=输入、
'm'=标记、'r'=尺寸调整("80x24");delay 为相对前一帧秒数,单调不减。
本项目的 cast-core 为独立实现,不依赖外部 CLI。
FAQs
DSH plugin: record terminal/tool output as asciinema v2 (.cast), replay with an offline embedded player, and export HTML.
We found that dsh-asciinema demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.

Security News
Anthropic’s free OSS Scanner uses Mythos and other Claude models to find open source vulnerabilities and send maintainers reports with proposed fixes.

Security News
On Front Lines’ Early Adopters: CISO podcast, Andrew Becherer shares lessons from Datadog, weighs the long-term costs of AI-built tools, and explains how founders can actually gain a CISO’s trust.