kiro-tap
kiro-tap 是 Kiro CLI 和 Kiro IDE 的本地代理与请求追踪工具。通过它运行 Kiro,即可实时捕获所有 API 请求:系统提示词、对话历史、工具定义、工具调用、流式响应和 Token 用量。
支持 Kiro CLI(kiro-cli-chat)和 Kiro IDE。
为什么用它
- 👀 看清真实上下文:查看发往 Kiro API 的完整请求,包括系统提示、消息历史、工具定义、工具调用和响应内容
- 🔎 有据可查地调试:对比相邻请求,精确定位哪条消息、哪个工具或哪个参数发生了变化
- 📦 一个可分享的文件:每次运行生成本地 trace,可导出为自包含的 HTML 查看器,方便存档或分享
- 🔒 数据留在本机:无需任何云端 Dashboard,常见认证 Header 在记录前自动脱敏
- ⚡ AWS Event Stream 原生支持:正确解析 Kiro 使用的 AWS Event Stream 二进制帧协议,完整还原流式响应
安装
需要 Python 3.11+。
# 推荐
uv tool install kiro-tap
# 或使用 pipx
pipx install kiro-tap
# 或使用 pip
pip install kiro-tap
升级:kiro-tap update、uv tool upgrade kiro-tap、pipx upgrade kiro-tap 或 pip install --upgrade kiro-tap
快速开始
# Kiro CLI(默认,实时 Dashboard 默认开启)
kiro-tap
# Kiro IDE
kiro-tap --tap-client kiro-ide
# 关闭实时 Dashboard
kiro-tap --tap-no-live
# 不自动打开浏览器
kiro-tap --tap-no-open
# Kiro 需要走 VPN/代理才能访问时,通过 --proxy 指定上游代理(Clash/V2Ray 等)
kiro-tap --proxy 7890
kiro-tap --proxy http://127.0.0.1:7890
工作原理
kiro-tap 启动本地正向代理
↓
注入 HTTPS_PROXY + SSL_CERT_FILE 到子进程环境
↓
启动 kiro-cli-chat(或 kiro)
↓
所有 HTTPS 流量经过本地代理 → TLS 终止 → 转发到 q.us-east-1.amazonaws.com
↓
AWS Event Stream 二进制帧解析 → 重建完整响应
↓
写入本地 SQLite trace 数据库
↓
实时推送到浏览器 Dashboard(SSE)
kiro-tap 使用正向代理模式(CONNECT + TLS 终止),因为 Kiro CLI 没有暴露 base URL 环境变量。代理会自动生成本地 CA 证书并注入到子进程,无需 sudo。
CLI 选项
所有 --tap-* 之外的参数都会透传给 Kiro 客户端。
--tap-client CLIENT 要启动的客户端:kiro(默认)或 kiro-ide
--tap-target URL 上游 API URL(默认:https://q.us-east-1.amazonaws.com)
--tap-live 运行时开启实时 Dashboard(默认:开)
--tap-no-live 关闭实时 Dashboard
--tap-live-port PORT 实时 Dashboard 端口(默认:19528)
--tap-no-open 不自动在浏览器中打开 Dashboard 或生成的 HTML
--tap-output-dir DIR 旧版 trace 目录(默认:./.traces)
--tap-port PORT 代理端口(默认:自动)
--tap-host HOST 绑定地址(默认:127.0.0.1)
--tap-no-launch 只启动代理,不启动客户端
--tap-max-traces N 保留的最大 trace 会话数(默认:50,0 = 不限)
--tap-store-stream-events 持久化原始 AWS Event Stream 帧数组(默认:关)
--tap-no-update-check 禁用启动时的 PyPI 更新检查
--tap-no-auto-update 检查更新但不自动下载
--tap-trust-ca 在 macOS 用户登录钥匙串中信任本地 CA(无需 sudo)
--proxy URL 上游代理,用于出站请求(如 http://127.0.0.1:7890,Clash/VPN 场景;纯数字等价于 http://127.0.0.1:<port>)
上游代理(VPN/Clash)
如果 Kiro 必须走代理才能访问,用 --proxy 指定上游代理,流量链路为:
kiro-cli-chat → kiro-tap(本地 MitM)→ 上游代理(VPN/Clash)→ AWS API
# 简写:纯数字自动补全为 http://127.0.0.1:<port>
kiro-tap --proxy 7890
# 完整写法
kiro-tap --proxy http://127.0.0.1:7890
也可以不传 --proxy:kiro-tap 会自动继承启动环境中的 HTTPS_PROXY / ALL_PROXY 环境变量(启动时会打印 🌍 Upstream proxy: ... 提示检测到的上游代理)。
子命令
# 浏览历史 trace
kiro-tap dashboard
# 将 JSONL trace 导出为 HTML / Markdown / JSON
kiro-tap export .traces/session.jsonl -o trace.html
# 升级 kiro-tap
kiro-tap update
# 在 macOS 钥匙串中信任本地 CA(正向代理模式需要)
kiro-tap trust-ca
仅代理模式
# 只启动代理,在另一个终端手动启动 Kiro
kiro-tap --tap-no-launch --tap-port 8080
# 然后在另一个终端:
HTTPS_PROXY=http://127.0.0.1:8080 SSL_CERT_FILE=~/.kiro-tap/ca.pem kiro-cli-chat
Viewer 功能
生成的 HTML 查看器(零外部依赖)支持:
- 结构化 Diff:对比相邻请求,查看消息、系统提示、工具的变化
- 路径过滤:按 API 端点过滤(如只看
/generateAssistantResponse) - Token 用量:输入 / 输出 / 缓存读取 / 缓存写入
- 工具检查器:可展开的工具卡片,含名称、描述和参数 schema
- 全文搜索:跨消息、工具、提示词和响应搜索
- 深色模式:跟随系统偏好
- 键盘导航:
j/k或方向键 - 一键复制:复制请求 JSON 或 cURL 命令
- 多语言:English、简体中文、日本語、한국어、Français、العربية、Deutsch、Русский
AWS Event Stream 解析
Kiro API 使用 AWS Event Stream 二进制帧协议(非标准 SSE)。kiro-tap 实现了完整的帧解析器:
- CRC32 校验(ISO-HDLC,与 AWS SDK 一致)
- 所有 Header 值类型(bool、byte、short、int、long、bytes、string、timestamp、uuid)
- 事件类型:
assistantResponseEvent、toolUseEvent、meteringEvent、contextUsageEvent、codeReferenceEvent - 错误/异常消息类型
许可证
MIT
Metadata
Release files for kiro-tap 0.3.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kiro_tap-0.3.7.tar.gz | 215.5 kB | With provenance | Details for kiro_tap-0.3.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kiro_tap-0.3.7-py3-none-any.whl | Python 3 | none | any | Details for kiro_tap-0.3.7-py3-none-any.whl |
Total release size: 382.7 kB
Release files / kiro_tap-0.3.7.tar.gz
| Download URL | kiro_tap-0.3.7.tar.gz |
|---|---|
| Size | 215.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa909c64d931d8cd5efa154eef9c06cb10ae78bfcc490b1707a739ee6837c3b5
|
|
BLAKE2b-256 checksum How to use checksums |
04e8926631603663204e4ea5eb546bb6cc981f6cbb7c8bd154a677f02f9988c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / kiro_tap-0.3.7-py3-none-any.whl
| Download URL | kiro_tap-0.3.7-py3-none-any.whl |
|---|---|
| Size | 167.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efeb037e267c895929bb0562990f4eaf4b15114f4f1d13b5552c32fecfd20f1a
|
|
BLAKE2b-256 checksum How to use checksums |
e19024c8b629f04f93d2bd16e415f04975b01cdd9cc8cd75869b4ce9489a22df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logSecurity for kiro-tap 0.3.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for kiro_tap-0.3.7.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.