@devflow-tools/telemetry 0.17.4 → 0.17.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +24 -43
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,62 +1,43 @@
1
1
  # @devflow-tools/telemetry
2
2
 
3
- DevFlow 遥测引擎 — 记录和分析 AI Agent 执行轨迹,提供 MCP 合规率统计、ROI 汇总和失败分类。
3
+ > 记录 Agent、tool、LLM 和语义控制事件,并生成健康度、失败分类和 ROI 汇总。(v0.17.6)
4
4
 
5
- ## Installation
5
+ [![npm version](https://img.shields.io/npm/v/%40devflow-tools%2Ftelemetry.svg)](https://www.npmjs.com/package/@devflow-tools/telemetry)
6
+
7
+ ## 安装
6
8
 
7
9
  ```bash
8
10
  npm install @devflow-tools/telemetry
9
11
  ```
10
12
 
11
- ## Usage
13
+ ## 快速开始
12
14
 
13
15
  ```typescript
14
16
  import { TelemetryEngine } from '@devflow-tools/telemetry';
15
17
 
16
- const engine = new TelemetryEngine({ projectRoot: '/path/to/project' });
18
+ const telemetry = new TelemetryEngine(process.cwd());
19
+ await telemetry.recordToolCall({ eventId: 'evt-1', executionId: 'run-1', timestamp: Date.now(), toolName: 'bash', toolType: 'shell', isMcpTool: false, mcpEnforced: false, mcpFallback: false, input: { command: 'npm test' }, tokensUsed: 0, duration: 1200, blocked: false });
20
+ ```
21
+
22
+ ## 公共 API / 命令
17
23
 
18
- // 记录 tool call 事件
19
- await engine.recordToolCall({
20
- eventId: 'evt:123',
21
- executionId: 'exec:456',
22
- toolName: 'bash',
23
- command: 'npm run build',
24
- isMcpTool: false,
25
- durationMs: 3200,
26
- });
24
+ `TelemetryEngine`、`LogWriter`、`getLogWriter`、`emitSemanticControlLog`、`aggregateHealthStatus` 和 `createHealthSnapshot`。
27
25
 
28
- // 获取执行历史
29
- const runs = await engine.listRuns({ limit: 10 });
30
26
 
31
- // 获取 MCP 合规率
32
- const compliance = await engine.getMCPCompliance();
33
- ```
27
+ ## 配置与运行时
28
+
29
+ 事件默认写入 DevFlow 本地数据库/日志目录;使用 `createLogger` 或 `LogWriter` 保持结构化字段,避免直接写 stdout。
30
+
31
+ ## 版本与兼容性
32
+
33
+ - 当前包版本:`0.17.6`
34
+ - Node.js:未在 package manifest 声明更高版本时,使用 Node.js 18+;原生 SQLite/Playwright 能力请按对应依赖安装
35
+ - workspace 内部包应使用同一 DevFlow minor/patch 版本,避免类型和数据库 schema 不一致
36
+
37
+ ## 相关链接
34
38
 
35
- ## Features
36
-
37
- - **Skill 执行追踪** — 完整生命周期记录(start → running → completed/failed)
38
- - **Tool Call 事件流** — 每次 tool 调用的详细记录(exitCode、stderr、output、durationMs)
39
- - **MCP 合规率** — 统计 MCP tool vs 直接 tool 调用比例
40
- - **失败分类** — 自动识别失败根因(上下文不足、知识缺失、工作流设计、工具错误等)
41
- - **ROI 汇总** — 效率指标、失败分布、工作流/插件健康度、每日趋势
42
- - **实验性 ROI** — baseline vs devflow 对比分析(时间节省率、Token 减少率)
43
-
44
- ## API
45
-
46
- - `new TelemetryEngine({ projectRoot })` — 构造函数
47
- - `.recordToolCall(event)` — 记录单次 tool 调用事件
48
- - `.getToolCallEvents(executionId)` — 获取某次执行的所有事件
49
- - `.updateToolCallOutput(eventId, output)` — 回填 tool 调用结果
50
- - `.recordExecutionStart/Complete(params)` — skill 执行生命周期管理
51
- - `.getExecutions(filter?)` — 查询 skill 执行历史
52
- - `.getExecutionEvents(executionId)` — 获取执行事件流
53
- - `.getMCPCompliance()` — MCP 合规率统计
54
- - `.getPluginEffectiveness(name)` — 插件有效性分析
55
- - `.getPluginUsageStats()` — 插件使用统计
56
- - `.getExperimentalRoiSummary()` — 实验性 ROI 汇总
57
- - `.classifyFailure(runId)` — 失败分类
58
- - `.getRunStats(runId)` — 运行统计
59
- - `.cleanup(maxAge)` — 清理过期数据
39
+ - [DevFlow 仓库](https://github.com/shilongfeicool/dev-flow)
40
+ - [问题反馈](https://github.com/shilongfeicool/dev-flow/issues)
60
41
 
61
42
  ## License
62
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devflow-tools/telemetry",
3
- "version": "0.17.4",
3
+ "version": "0.17.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -17,8 +17,8 @@
17
17
  "clean": "rm -rf dist"
18
18
  },
19
19
  "dependencies": {
20
- "@devflow-tools/database": "0.17.4",
21
- "@devflow-tools/sdk": "0.17.4"
20
+ "@devflow-tools/database": "0.17.6",
21
+ "@devflow-tools/sdk": "0.17.6"
22
22
  },
23
23
  "devDependencies": {
24
24
  "typescript": "^5.5.0",
@@ -27,5 +27,5 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "gitHead": "b880054f9cef4ed62b4d02544257c9f5cbd811bc"
30
+ "gitHead": "669fea3aa72aa3fde14ed50d24c1fec4dfac088f"
31
31
  }