← Catalog

@piex-dev/dap

DAP (Debug Adapter Protocol) extension for pi — debug programs directly from your coding agent

Extension

Install

Install with PiG

pig install npm:@piex-dev/dap

Install with Pi

pi install npm:@piex-dev/dap
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./extensions/dap.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.1 (README.md). PiG does not review it.

dap

DAP(Debug Adapter Protocol)调试扩展,注册 debug 工具。

功能

  • debug 工具: 完整的 DAP 协议客户端
  • 14 个 debug adapter: gdb, lldb-dap, codelldb, debugpy (Python), dlv (Go), js-debug-adapter (JS/TS), netcoredbg (C#), kotlin-debug-adapter, rdbg (Ruby), php-debug-adapter, bash-debug-adapter, dart-debug-adapter, flutter-debug-adapter, elixir-ls-debugger
  • 会话管理: launch/attach/terminate
  • 断点: 文件断点、函数断点、指令断点、数据断点
  • 执行控制: continue/step_over/step_in/step_out/pause
  • 状态检查: stack_trace/threads/scopes/variables/evaluate
  • 内存操作: read_memory/write_memory/disassemble
  • 自动适配器选择: 根据文件扩展名 + 项目标记自动选择

架构

dap.ts                         # pi 扩展入口
├── client.ts                  # DapClient — JSON-RPC over DAP
├── session.ts                 # DapSessionManager — 会话管理
├── config.ts                  # 适配器配置 + 发现
├── types.ts                   # 完整 DAP 类型 (~370 行)
├── defaults.json              # 14 个适配器默认配置
├── non-interactive-env.ts     # 非交互环境变量
└── utils.ts                   # 工具函数

支持的 action

launch, attach, terminate, sessions, output
set_breakpoint, remove_breakpoint
continue, step_over, step_in, step_out, pause
- `Node.js 移植仅支持 stdio transport,不支持 TCP/WebSocket 远程调试`
evaluate, stack_trace, threads, scopes, variables
disassemble, read_memory, write_memory
modules, loaded_sources, custom_request

Node.js 移植说明

从 omp(Bun)移植到 Node.js 的主要变更:

Bun APINode.js 替代
Bun.spawn()child_process.spawn()
Bun.sleep(ms)new Promise(r => setTimeout(r, ms))
Bun.envprocess.env

安装

pi install npm:@piex-dev/dap

前提条件

需要安装对应的 debug adapter:

pip install debugpy        # Python
brew install llvm           # lldb-dap
go install github.com/go-delve/delve/cmd/dlv@latest  # Go

来源

与 omp 实现差异

ompdap
双传输层(stdio + TCP)仅 stdio(不支持 TCP/WebSocket 远程调试)
数据断点、指令断点、异常断点未实现(需手动补全)
completions、exceptionInfo未实现(session 层已支持,工具未暴露)
TUI inline rendering纯文本输出

功能特性来自 oh-my-pi 的 packages/coding-agent/src/dap。