🎁 福利专区全网大模型免费应用 + 新用户福利 + 注册活动入口,低成本玩转 AI

Git AI 归属记录 NiuZhuang/dsh-git-ai

DeepSeek Harness
NiuZhuang70 天前有提交已提供中文文档扫描:未发现敏感能力

记录智能体改了哪些文件、用了哪个模型和会话

26/100
综合分
0
GitHub 星标
—
npm 周下载
—/5
用户评分

数据截至 2026/10/2 · 周下载取自 npm 全网(含 CI / 镜像),非本站安装数;综合分由星标、活跃度与兼容性检查合成。

安装命令 · 需先装 dsh CLI 引擎
dsh plugin --profile web add NiuZhuang/dsh-git-ai
该包不可直接 npm 安装,改从 GitHub 源安装(明细见下方安装检查)

状态速览

判定依据:实装验证 · 静态安装检查 · 自动扫描 · 仓库维护状态
信任档位:仅索引
是什么
dsh 原生插件 · dev
装得上吗
本站尚未做安装检查
L4 · 真实安装等级说明 →
安全吗
本站尚未对该插件做风险分级
暂未覆盖,不等同于无风险
还在维护吗
更新放缓:最近一次提交在 70 天前
档位由哪些信号合成

本站实装验证(真实安装 L4 覆盖全站;L5 为运行时冒烟或实机截图,覆盖范围小于 L4) · 验证所用 dsh 版本 · 静态安装检查 · 风险分级 · 仓库维护状态。 下方各区块是它的证据明细。

验证判据与等级说明 →
社区实装还没有人打卡 · 装过的第一个就是你
安全扫描自动 · 静态分析源码
v2.7.0
🟢 扫描:未发现敏感能力尚无人工评估
展开查看扫描说明与证据 ↓

静态扫描未发现敏感能力:最多只发网络请求、读取自身元数据或只读文件,未发现执行命令、文件写入或敏感信息读取。

扫描于 2026/10/31(1 天前) · 范围 全包扫描(包内未声明入口) · 来源 GitHub 仓库

静态扫描只反映源码中出现的调用,不构成安全背书;人工评估与自动扫描相互独立、互不覆盖。

依赖的 DSH / Cordis 模块
@deepseek-ai/schemastery@deepseek-ai/cordis@deepseek-ai/dsh-agent@deepseek-ai/dsh-agent-loop@deepseek-ai/dsh-agent-loop-testkit@deepseek-ai/dsh-bash-local@deepseek-ai/dsh-invariants@deepseek-ai/dsh-llm@deepseek-ai/dsh-session@deepseek-ai/dsh-shell@deepseek-ai/dsh-subprocess-local@deepseek-ai/dsh-tools
给这个插件打分还没有人投票↓
用户评分
还没有人投票,来当第一个

功能亮点

  • 记录智能体改动文件
  • 记录所用模型
  • 记录所属会话

把智能体改过哪些文件、用的哪个模型、在哪个会话里,都记进 git-ai 的 DeepSeek Harness 插件

README

由 DeepSeek 最新模型翻译生成
dsh-git-ai GitHub · npm · Issues 一个 DeepSeek Harness 插件,把 agent(智能体)编辑了哪些文件、用的是哪个模型、属于哪个会话,记录到 git-ai 中。它监听 harness 的 tools/pre-execute / tools/post-execute 拦截点,把每次相关工具调用翻译成 git-ai 的通用 agent-v1 checkpoint payload,并在 stdin 上传入该 JSON 后调用 git-ai checkpoint <preset> --hook-input stdin。git-ai 本身无需修改;agent 提交后,git-ai 会把归属写入 git notes,并按 tool-model 组合报告 ai_additions/ai_accepted。 效果预览 将鼠标悬停在 VS Code 的代码行上,即可看到这段代码是由谁、使用哪个模型、在哪个 DeepSeek Harness 会话中生成的: Git AI 代码归属 Popover 环境要求 - 通过 npm 安装 DeepSeek Harness(npx @deepseek-ai/dsh@latest)——插件以官方 @deepseek-ai/* 包为 peer 依赖。
展开完整文档(README 剩余 1 节)
dsh-git-ai

GitHub · npm · Issues

一个 DeepSeek Harness 插件,把 agent(智能体)编辑了哪些文件、用的是哪个模型、属于哪个会话,记录到 git-ai 中。它监听 harness 的 tools/pre-execute / tools/post-execute 拦截点,把每次相关工具调用翻译成 git-ai 的通用 agent-v1 checkpoint payload,并在 stdin 上传入该 JSON 后调用 git-ai checkpoint <preset> --hook-input stdin。git-ai 本身无需修改;agent 提交后,git-ai 会把归属写入 git notes,并按 tool-model 组合报告 ai_additions/ai_accepted。

效果预览

将鼠标悬停在 VS Code 的代码行上,即可看到这段代码是由谁、使用哪个模型、在哪个 DeepSeek Harness 会话中生成的:

Git AI 代码归属 Popover

环境要求

- 通过 npm 安装 DeepSeek Harness(npx @deepseek-ai/dsh@latest)——插件以官方 @deepseek-ai/* 包为 peer 依赖。
- 安装 git-ai 并加入 PATH(或通过 gitAiPath 指定)。

安装

本包以 profile bundle 形态发布:安装并激活只需要一条命令。

dsh plugin --profile web add dsh-git-ai

pnpm ≥ 10 提示: dsh plugin add 底层转发给 pnpm,而 pnpm 10+ 会拒绝在 workspace root 上直接添加依赖(ERR_PNPM_ADDING_TO_ROOT)。dsh 的 profile 按设计就是 pnpm workspace root,因此在 pnpm ≥ 10 的机器上请使用 -w(或一次性在 ~/.dsh/profiles/<profile>/pnpm-workspace.yaml 中加入 ignore-workspace-root-check: true):

dsh plugin --profile web add -w dsh-git-ai

dsh plugin 在 profile 目录内转发给 pnpm,并因为包声明了 dsh.bundle 而自动激活该 bundle。不使用 bundle 机制(或在自定义 profile 中加载)时,在 profile 的 cordis.patch.yml 中加入一行:

- dsh-git-ai:
gitAiPath: git-ai
agentName: deepseek-harness

配置

import type { Config } from 'dsh-git-ai'
const config: Config = {
gitAiPath: 'git-ai', // optional: git-ai executable (bare name resolves through PATH)
agentName: 'deepseek-harness', // optional: agent_name stamped on every checkpoint
model: '', // optional: explicit model; empty falls back to agent.options.model
checkpointPreset: 'agent-v1', // optional: the git-ai generic-integration preset
timeoutMs: 10_000, // optional: git-ai invocation timeout
trackBash: true, // optional: emit pre/post shell checkpoints for bash/pwsh
}

Checkpoint 映射

| Harness 点 | 工具 | git-ai payload |
| tools/post-execute(成功) | write、edit | ai_agent,edited_filepaths 取自 file_path |
| tools/post-execute(成功) | str_replace_editor(非 view) | ai_agent,edited_filepaths 取自 path |
| tools/pre-execute | bash、pwsh | pre_shell_command,含 command 与 tool_use_id |
| tools/post-execute | bash、pwsh | post_shell_command,含 command 与 tool_use_id |

Payload 身份字段:repo_working_dir 为会话 cwd(缺失时回退到进程 cwd),agent_name 为 config.agentName,model 为设置了 config.model 时取其值否则取 agent.options.model(再否则为 ''),conversation_id 为会话 id。相对 file_path/path 会基于会话 cwd 解析为绝对路径;绝对路径原样透传。str_replace_editor 的 view 命令是只读的,从不归因。

失败的编辑(result.isError === true)不发任何内容;失败的 bash 命令仍会发出 post_shell_command,从而闭合前后配对。bash 跟踪以工具 callId 为键,因此 pre 与 post checkpoint 共享 tool_use_id。

失败隔离

git-ai 是可选的(optional)外部依赖。二进制缺失、非零退出、超时或执行器拒绝都只会记录警告而不会向上传播:工具调用与 agent 轮次的运行方式与插件不存在时完全一致。

验证流程

1. 启动加载了本插件的 harness
dsh web
2. 让 agent 在 git 仓库里修改文件
3. 检查 git-ai 是否收到 checkpoint git-ai status --json
4. 提交
git add -A && git commit -m "test"
5. 查看归因统计 git-ai stats HEAD --json

开发

pnpm install
pnpm test # vitest,src/ 覆盖率 100%
pnpm typecheck
pnpm build # 生成 lib/ 供发布

发布

pnpm build
pnpm publish --access public

已知局限与后续工作

- 文件编辑工具只发编辑后的 ai_agent checkpoint。 git-ai 以 HEAD 或最后一次 checkpoint 的值为基准来归因文件的改动行,因此 agent 编辑前对同一文件已有的未提交改动(例如用户自己改的)也会被归因给 agent。在每次编辑工具之前补一个 human checkpoint 就能隔离这些改动;bash 的 pre/post 配对已为 shell 命令提供了这种隔离。
- 可能出现未配对的 pre_shell_command。 如果 bash 工具在 pre 与 post 之间被拒绝或取消,pre 快照会保持开放,之后对同一文件的新改动在下一次 checkpoint 之前会被 git-ai 视为 untracked。
- 同步调用延迟。 每个被跟踪的工具调用都会先等待其 git-ai checkpoint(上限为 timeoutMs)再让工具结果落定。
- bash 输出归因基于快照。 git-ai 从文件快照推断改动文件,因此修改仓库树外文件的命令不会被归因。

许可

MIT
预览分享卡片长什么样 ↓NiuZhuang/dsh-git-ai
分享 · DeepSeek Harness Hub
NiuZhuang/dsh-git-ai

记录智能体改了哪些文件、用了哪个模型和会话

回到顶部