{"_id":"@eco-dsh/eco-audit-chain","_rev":"3-256ab204fcaaf25e6efcf7d5c284fc24","name":"@eco-dsh/eco-audit-chain","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@eco-dsh/eco-audit-chain","version":"0.1.0","keywords":["dsh","dsh-plugin","cordis","audit","sm3","hash-chain","tamper-evident","eco-agent"],"license":"MIT","_id":"@eco-dsh/eco-audit-chain@0.1.0","maintainers":[{"name":"13907387110ms","email":"awep000@qq.com"}],"dist":{"shasum":"ea17860bf444bcd92592285de75af2f1b33d574b","tarball":"https://registry.npmjs.org/@eco-dsh/eco-audit-chain/-/eco-audit-chain-0.1.0.tgz","fileCount":6,"integrity":"sha512-GnMTMZ3eArcELkNAsPFi9pUn7zYHrQcF/mRJlM57Qgw5m5xLOsQvI+XpfleLamBDDn5xA+iTST9VFmj5LjUK3w==","signatures":[{"sig":"MEQCIFrO0bVNARaj1K91C5lKtUcsW3uWj2w5SLz1XhUU6RnqAiAeXJD5ZTbROajSJ9mJP4t6leQsgc0ZhpEpkVXDG3pq8Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19444},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","exports":{".":{"types":"./lib/index.d.ts","import":"./lib/index.js"}},"gitHead":"4ce16543838f1abefd0c4fb203c61a84dc1736fa","scripts":{"build":"tsc -p tsconfig.json","prepublishOnly":"npm run build"},"_npmUser":{"name":"13907387110ms","email":"awep000@qq.com"},"_npmVersion":"10.9.0","description":"dsh plugin: SM3 tamper-evident execution audit chain (port of eco-agent trace_audit.py)","directories":{},"_nodeVersion":"22.12.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.0"},"peerDependencies":{"@deepseek-ai/cordis":"^4.0.0","@deepseek-ai/dsh-tools":"^0.0.1-rc.1","@deepseek-ai/schemastery":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/eco-audit-chain_0.1.0_1787056843568_0.8644834013422027","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@eco-dsh/eco-audit-chain","version":"0.2.0","keywords":["dsh","dsh-plugin","cordis","audit","sm3","hash-chain","tamper-evident","eco-agent"],"license":"MIT","_id":"@eco-dsh/eco-audit-chain@0.2.0","maintainers":[{"name":"13907387110ms","email":"awep000@qq.com"}],"dist":{"shasum":"68b8b5483bc93a9fbf1a54f0c0034f9e7e3a1342","tarball":"https://registry.npmjs.org/@eco-dsh/eco-audit-chain/-/eco-audit-chain-0.2.0.tgz","fileCount":6,"integrity":"sha512-/4WwyaZ0WyoUiFohfksXbd33+27D6PegauTxtRYypoRpkiDlCrIyC/XubLfNMdMVIboQxB6BGr/yoTHASm4+WQ==","signatures":[{"sig":"MEQCIGt5KYwhfgXx4L23T0eEx9OZpR/3S5Uw/3y22wxXNacvAiByYxuG3FdsgfAv/8lIHTvtVi2zXEnMbpHw/qWCqTsybg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24056},"main":"lib/index.js","type":"module","types":"lib/index.d.ts","exports":{".":{"types":"./lib/index.d.ts","import":"./lib/index.js"}},"gitHead":"4ce16543838f1abefd0c4fb203c61a84dc1736fa","scripts":{"build":"tsc -p tsconfig.json","prepublishOnly":"npm run build"},"_npmUser":{"name":"13907387110ms","email":"awep000@qq.com"},"_npmVersion":"10.9.0","description":"dsh plugin: SM3 tamper-evident execution audit chain (port of eco-agent trace_audit.py)","directories":{},"_nodeVersion":"22.12.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.0"},"peerDependencies":{"@deepseek-ai/cordis":"^4.0.0","@deepseek-ai/dsh-tools":"^0.0.1-rc.1","@deepseek-ai/schemastery":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/eco-audit-chain_0.2.0_1787058289429_0.5933293464667462","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@eco-dsh/eco-audit-chain","version":"0.3.0","description":"dsh plugin: SM3 tamper-evident execution audit chain (port of eco-agent trace_audit.py)","type":"module","main":"lib/index.js","types":"lib/index.d.ts","exports":{".":{"types":"./lib/index.d.ts","import":"./lib/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","prepublishOnly":"npm run build"},"keywords":["dsh","dsh-plugin","cordis","audit","sm3","hash-chain","tamper-evident","eco-agent"],"license":"MIT","peerDependencies":{"@deepseek-ai/cordis":"^4.0.0","@deepseek-ai/dsh-tools":"^0.0.1-rc.1","@deepseek-ai/schemastery":"^3.0.0"},"devDependencies":{"typescript":"^5.5.0"},"_id":"@eco-dsh/eco-audit-chain@0.3.0","gitHead":"4ce16543838f1abefd0c4fb203c61a84dc1736fa","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-lOFks2UWLZ1ixvGx7bfrgj9+ZWyFdPYvL0xA8KBMPQJZmFcQwpxg2rF1Uol9zVht4n+iYHFkByC1ZlQU+p5V7Q==","shasum":"7678eed2b6fd9e8ff9e28bc5209f85f221752e59","tarball":"https://registry.npmjs.org/@eco-dsh/eco-audit-chain/-/eco-audit-chain-0.3.0.tgz","fileCount":6,"unpackedSize":30136,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAUEu0Ejoa13io+i4qjWY7IRzOCfWBgQPrgPpadkSFNYAiBwtmWcIP5r+sWE+fnHWMHkLWIMw7y/M1OjGLSn0whBYg=="}]},"_npmUser":{"name":"13907387110ms","email":"awep000@qq.com"},"directories":{},"maintainers":[{"name":"13907387110ms","email":"awep000@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/eco-audit-chain_0.3.0_1787062333757_0.9213999814847738"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-18T12:40:43.369Z","modified":"2026-08-18T14:12:14.127Z","0.1.0":"2026-08-18T12:40:43.708Z","0.2.0":"2026-08-18T13:04:49.553Z","0.3.0":"2026-08-18T14:12:13.895Z"},"license":"MIT","keywords":["dsh","dsh-plugin","cordis","audit","sm3","hash-chain","tamper-evident","eco-agent"],"description":"dsh plugin: SM3 tamper-evident execution audit chain (port of eco-agent trace_audit.py)","maintainers":[{"name":"13907387110ms","email":"awep000@qq.com"}],"readme":"# eco-audit-chain\n\ndsh plugin — SM3 防篡改执行审计链。\n\n> 移植自 [xiejianjun000/eco-agent](https://github.com/xiejianjun000/eco-agent) 的 `agent_core/trace_audit.py`（MIT License），保留五要素账本 + SM3 哈希链设计。\n\n## 作用\n\n每次工具调用记录五要素（when / who / what / result / cost）并锁进 SM3 哈希链：\n\n```\ncurrent_hash = SM3(prev_hash + timestamp + operation + input_hash + output_hash)\n```\n\n任何对历史记录的篡改都会导致链断裂，`verify()` 重算每一行并报告首个不匹配位置。内置纯 TS 零依赖 SM3 实现（`sm3.ts`），无需原生模块。\n\n## v0.2.0 — 查询增强\n\n- `eco_audit_query` 支持多维过滤：`decision`(allow/deny/ask)、`level`(L1-L4)、`operation`、`who`、`keyword`(正文子串)、`from/to`(时间范围)、`offset` 分页。\n- 新增 `eco_audit_summary`：按决策 / 风险级别 / 操作类型 / 小时维度聚合统计，返回 `denied_total` 等安全态势指标。\n\n## v0.3.0 — 归档轮转与导出\n\n- 新增 `maxEntries` 配置：live 链超过条数后自动归档为 `trace_audit_<ts>.jsonl` 并从 genesis 开启新链——不截断、不断链，历史归档仍可完整 `verify()`。\n- 新增 `eco_audit_export` 工具：跨 live 链与全部归档导出记录，支持与 `eco_audit_query` 相同的多维过滤，适合合规留存与安全取证。\n\n## 安装\n\n```bash\nnpm install @eco-dsh/eco-audit-chain\n```\n\n```ts\nimport * as ecoAuditChain from '@eco-dsh/eco-audit-chain'\n\napp.plugin(ecoAuditChain, {\n  auditDir: '~/.eco/dsh/audit', // 账本 trace_audit.jsonl 目录\n  autoRecord: true,             // 自动通过 tools/result 记录\n})\n```\n\n## 注册工具\n\n| 工具 | 说明 |\n|------|------|\n| `eco_audit_verify` | 重算整条链，检测篡改/断链 |\n| `eco_audit_stats` | 链统计：条目数、完整性、操作分布 |\n| `eco_audit_query` | 查询最近记录（可过滤 operation） |\n\n## 编程接口\n\n`ctx.ecoAudit`（`EcoAuditService`）暴露 `append` / `recordToolCall` / `recordDenied` / `verify` / `stats` / `query`，供其他插件（如 eco-permission-gate）写入拒绝事件。\n\n## 配置项\n\n| 字段 | 默认 | 说明 |\n|------|------|------|\n| `auditDir` | `~/.eco/dsh/audit` | 账本目录 |\n| `autoRecord` | `true` | 自动记录工具调用 |\n\n## 许可\n\nMIT。原始实现版权归 [xiejianjun000/eco-agent](https://github.com/xiejianjun000/eco-agent) 所有，本包为 dsh 生态移植版。\n","readmeFilename":"README.md"}