@reskill/agent-aware-server 0.2.0 → 0.3.0
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.
- package/README.md +202 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +40 -8
- package/dist/cli.js.map +1 -1
- package/dist/detector/alertDetector.d.ts +31 -0
- package/dist/detector/alertDetector.d.ts.map +1 -0
- package/dist/detector/alertDetector.js +82 -0
- package/dist/detector/alertDetector.js.map +1 -0
- package/dist/detector/behaviorDetector.d.ts +31 -0
- package/dist/detector/behaviorDetector.d.ts.map +1 -0
- package/dist/detector/behaviorDetector.js +89 -0
- package/dist/detector/behaviorDetector.js.map +1 -0
- package/dist/httpApi.d.ts +4 -2
- package/dist/httpApi.d.ts.map +1 -1
- package/dist/httpApi.js +16 -2
- package/dist/httpApi.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# @reskill/agent-aware-server
|
|
2
|
+
|
|
3
|
+
Agent-aware Server 提供 HTTP API 来收集用户交互行为和页面报错信息,并通过智能检测器主动发现问题。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
### 1. 数据收集
|
|
8
|
+
|
|
9
|
+
- **行为数据收集**:从 `http://localhost:4100` 接收 SDK 上报的用户交互数据
|
|
10
|
+
- **错误数据收集**:收集运行时错误、Promise 异常和 Console 错误
|
|
11
|
+
|
|
12
|
+
### 2. 智能检测器
|
|
13
|
+
|
|
14
|
+
重构后的架构包含两个独立的检测器:
|
|
15
|
+
|
|
16
|
+
#### BehaviorDetector(行为检测器)
|
|
17
|
+
- 检测消极的用户交互行为
|
|
18
|
+
- 触发条件:
|
|
19
|
+
- 挫折指数 >= 70(Critical)
|
|
20
|
+
- 挫折指数 50-70(Warning)
|
|
21
|
+
- 愤怒点击 >= 3 次(Warning)
|
|
22
|
+
- 死点击 >= 2 次(Warning)
|
|
23
|
+
- 输出文件:`.agent-aware/behavior.json`
|
|
24
|
+
|
|
25
|
+
#### AlertDetector(错误检测器)
|
|
26
|
+
- 检测高危的运行时错误
|
|
27
|
+
- 触发条件:
|
|
28
|
+
- 错误数 >= 1(Critical)
|
|
29
|
+
- 输出文件:`.agent-aware/error.json`
|
|
30
|
+
|
|
31
|
+
### 3. 数据存储
|
|
32
|
+
|
|
33
|
+
**详细数据存储在包根目录的 `data/` 目录**:
|
|
34
|
+
- `data/behaviors.json`:所有行为详细数据(最多 1000 条)
|
|
35
|
+
- `data/errors.json`:所有错误详细数据(最多 1000 条)
|
|
36
|
+
|
|
37
|
+
**检测文件输出到用户项目根目录的 `.agent-aware/` 目录**:
|
|
38
|
+
- `.agent-aware/behavior.json`:行为检测结果
|
|
39
|
+
- `.agent-aware/error.json`:错误检测结果
|
|
40
|
+
|
|
41
|
+
## 使用方式
|
|
42
|
+
|
|
43
|
+
### 安装
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install @reskill/agent-aware-server
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 启动服务
|
|
50
|
+
|
|
51
|
+
#### 方式 1:使用 CLI(推荐)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# 默认启动(输出到当前目录)
|
|
55
|
+
npx agent-aware-server start
|
|
56
|
+
|
|
57
|
+
# 指定项目根目录
|
|
58
|
+
npx agent-aware-server start --project-root /path/to/project
|
|
59
|
+
|
|
60
|
+
# 使用环境变量(优先级最高)
|
|
61
|
+
USER_PROJECT_ROOT=/path/to/project npx agent-aware-server start
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### 方式 2:编程方式
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { serve } from '@hono/node-server'
|
|
68
|
+
import { createHttpApi } from '@reskill/agent-aware-server/httpApi'
|
|
69
|
+
import { BehaviorStore } from '@reskill/agent-aware-server/store/behaviorStore'
|
|
70
|
+
import { ErrorStore } from '@reskill/agent-aware-server/store/errorStore'
|
|
71
|
+
import { BehaviorDetector } from '@reskill/agent-aware-server/detector/behaviorDetector'
|
|
72
|
+
import { AlertDetector } from '@reskill/agent-aware-server/detector/alertDetector'
|
|
73
|
+
|
|
74
|
+
const PORT = 4100
|
|
75
|
+
const DATA_DIR = './data'
|
|
76
|
+
const PROJECT_ROOT = process.env.USER_PROJECT_ROOT || process.cwd()
|
|
77
|
+
|
|
78
|
+
const store = new BehaviorStore(DATA_DIR)
|
|
79
|
+
const errorStore = new ErrorStore(DATA_DIR)
|
|
80
|
+
const behaviorDetector = new BehaviorDetector(PROJECT_ROOT)
|
|
81
|
+
const alertDetector = new AlertDetector(PROJECT_ROOT)
|
|
82
|
+
|
|
83
|
+
const app = createHttpApi(store, errorStore, behaviorDetector, alertDetector)
|
|
84
|
+
|
|
85
|
+
serve({
|
|
86
|
+
fetch: app.fetch,
|
|
87
|
+
port: PORT,
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
console.log(`Server running on http://localhost:${PORT}`)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## HTTP API
|
|
94
|
+
|
|
95
|
+
### 行为相关
|
|
96
|
+
|
|
97
|
+
- **POST /behaviors** - 接收行为数据(SDK 上报)
|
|
98
|
+
- **GET /behaviors** - 查询行为数据
|
|
99
|
+
- 参数:`types`(可选)、`limit`(可选)
|
|
100
|
+
- **GET /summary** - 获取行为摘要
|
|
101
|
+
- **GET /hotspots** - 获取交互热点
|
|
102
|
+
- 参数:`limit`(可选)
|
|
103
|
+
- **DELETE /behaviors** - 清空行为数据
|
|
104
|
+
|
|
105
|
+
### 错误相关
|
|
106
|
+
|
|
107
|
+
- **POST /errors** - 接收错误数据(SDK 上报)
|
|
108
|
+
- **GET /errors** - 查询错误数据
|
|
109
|
+
- 参数:`errorTypes`(可选)、`limit`(可选)
|
|
110
|
+
- **GET /errors/summary** - 获取错误摘要
|
|
111
|
+
- **DELETE /errors** - 清空错误数据
|
|
112
|
+
|
|
113
|
+
### 健康检查
|
|
114
|
+
|
|
115
|
+
- **GET /health** - 健康检查
|
|
116
|
+
|
|
117
|
+
## 项目根目录配置
|
|
118
|
+
|
|
119
|
+
检测器输出文件的位置由以下优先级决定:
|
|
120
|
+
|
|
121
|
+
1. **环境变量** `USER_PROJECT_ROOT`(优先级最高)
|
|
122
|
+
2. **启动参数** `--project-root`
|
|
123
|
+
3. **默认值** `process.cwd()`(当前工作目录)
|
|
124
|
+
|
|
125
|
+
## 输出文件示例
|
|
126
|
+
|
|
127
|
+
### behavior.json
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"timestamp": "2026-01-30T10:30:00.000Z",
|
|
132
|
+
"severity": "critical",
|
|
133
|
+
"type": "frustration",
|
|
134
|
+
"summary": "检测到用户挫折行为",
|
|
135
|
+
"details": {
|
|
136
|
+
"frustrationScore": 75,
|
|
137
|
+
"rageClickCount": 5,
|
|
138
|
+
"deadClickCount": 3,
|
|
139
|
+
"totalInteractions": 50
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### error.json
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"timestamp": "2026-01-30T10:30:00.000Z",
|
|
149
|
+
"severity": "critical",
|
|
150
|
+
"type": "error",
|
|
151
|
+
"summary": "检测到 3 个运行时错误",
|
|
152
|
+
"details": {
|
|
153
|
+
"totalErrors": 3,
|
|
154
|
+
"runtimeErrorCount": 2,
|
|
155
|
+
"unhandledRejectionCount": 1,
|
|
156
|
+
"consoleErrorCount": 0,
|
|
157
|
+
"recentErrors": [
|
|
158
|
+
{
|
|
159
|
+
"id": "uuid-1",
|
|
160
|
+
"timestamp": 1738233000000,
|
|
161
|
+
"errorType": "runtime",
|
|
162
|
+
"message": "Cannot read property 'foo' of undefined"
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 冷却期机制
|
|
170
|
+
|
|
171
|
+
为避免告警风暴,每个检测器都有 10 秒的冷却期:
|
|
172
|
+
- 同一检测器的文件写入间隔至少 10 秒
|
|
173
|
+
- 冷却期内的新问题会累积到下次写入
|
|
174
|
+
|
|
175
|
+
## 架构说明
|
|
176
|
+
|
|
177
|
+
基于 [SPEC-SRV-005: Detector 架构重构](../../specs/server/005-detector-refactor.md)
|
|
178
|
+
|
|
179
|
+
### 设计原则
|
|
180
|
+
|
|
181
|
+
1. **职责分离**:BehaviorDetector 和 AlertDetector 各司其职
|
|
182
|
+
2. **异步检测**:检测逻辑不阻塞 API 响应
|
|
183
|
+
3. **容错设计**:文件写入失败不影响数据接收
|
|
184
|
+
4. **独立工作**:每个检测器独立工作,互不干扰
|
|
185
|
+
|
|
186
|
+
## 开发
|
|
187
|
+
|
|
188
|
+
### 运行测试
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
npm test
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 构建
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
npm run build
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
MIT
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG"}
|
package/dist/cli.js
CHANGED
|
@@ -2,31 +2,55 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Agent-aware CLI
|
|
4
4
|
* 启动 HTTP Server
|
|
5
|
+
* 基于 SPEC-SRV-005: Detector 架构重构
|
|
5
6
|
*
|
|
6
7
|
* 使用方式:
|
|
7
|
-
* npx agent-aware-server start
|
|
8
|
+
* npx agent-aware-server start [--project-root <path>]
|
|
8
9
|
*/
|
|
9
10
|
import { serve } from '@hono/node-server';
|
|
10
11
|
import { createHttpApi } from './httpApi.js';
|
|
11
12
|
import { BehaviorStore } from './store/behaviorStore.js';
|
|
13
|
+
import { ErrorStore } from './store/errorStore.js';
|
|
14
|
+
import { BehaviorDetector } from './detector/behaviorDetector.js';
|
|
15
|
+
import { AlertDetector } from './detector/alertDetector.js';
|
|
12
16
|
const HTTP_PORT = 4100;
|
|
13
17
|
const DATA_DIR = './data';
|
|
18
|
+
function parseArgs() {
|
|
19
|
+
const args = process.argv.slice(2);
|
|
20
|
+
let projectRoot = process.env.USER_PROJECT_ROOT || process.cwd();
|
|
21
|
+
// 解析 --project-root 参数
|
|
22
|
+
const projectRootIndex = args.indexOf('--project-root');
|
|
23
|
+
if (projectRootIndex !== -1 && args[projectRootIndex + 1]) {
|
|
24
|
+
projectRoot = args[projectRootIndex + 1];
|
|
25
|
+
}
|
|
26
|
+
return { projectRoot };
|
|
27
|
+
}
|
|
14
28
|
function start() {
|
|
29
|
+
const { projectRoot } = parseArgs();
|
|
15
30
|
const store = new BehaviorStore(DATA_DIR);
|
|
16
|
-
const
|
|
31
|
+
const errorStore = new ErrorStore(DATA_DIR);
|
|
32
|
+
const behaviorDetector = new BehaviorDetector(projectRoot);
|
|
33
|
+
const alertDetector = new AlertDetector(projectRoot);
|
|
34
|
+
const app = createHttpApi(store, errorStore, behaviorDetector, alertDetector);
|
|
17
35
|
console.log(`
|
|
18
36
|
╔═══════════════════════════════════════════════════════════╗
|
|
19
37
|
║ ║
|
|
20
38
|
║ Agent-aware Server ║
|
|
21
39
|
║ ║
|
|
22
40
|
║ HTTP API: http://localhost:${HTTP_PORT} ║
|
|
41
|
+
║ Project Root: ${projectRoot.slice(0, 38).padEnd(38)}║
|
|
42
|
+
║ Output: ${(projectRoot + '/.agent-aware/').slice(0, 47).padEnd(47)}║
|
|
23
43
|
║ ║
|
|
24
44
|
║ Endpoints: ║
|
|
25
|
-
║ POST /behaviors
|
|
26
|
-
║ GET /behaviors
|
|
27
|
-
║ GET /summary
|
|
28
|
-
║ GET /hotspots
|
|
29
|
-
║ DELETE /behaviors
|
|
45
|
+
║ POST /behaviors - SDK 上报行为数据 ║
|
|
46
|
+
║ GET /behaviors - 查询行为列表 ║
|
|
47
|
+
║ GET /summary - 获取行为摘要 ║
|
|
48
|
+
║ GET /hotspots - 获取交互热点 ║
|
|
49
|
+
║ DELETE /behaviors - 清空行为数据 ║
|
|
50
|
+
║ POST /errors - SDK 上报错误数据 ║
|
|
51
|
+
║ GET /errors - 查询错误列表 ║
|
|
52
|
+
║ GET /errors/summary - 获取错误摘要 ║
|
|
53
|
+
║ DELETE /errors - 清空错误数据 ║
|
|
30
54
|
║ ║
|
|
31
55
|
╚═══════════════════════════════════════════════════════════╝
|
|
32
56
|
`);
|
|
@@ -41,13 +65,21 @@ function showHelp() {
|
|
|
41
65
|
Agent-aware CLI
|
|
42
66
|
|
|
43
67
|
用法:
|
|
44
|
-
npx agent-aware-server <command>
|
|
68
|
+
npx agent-aware-server <command> [options]
|
|
45
69
|
|
|
46
70
|
命令:
|
|
47
71
|
start 启动 HTTP Server(默认端口 4100)
|
|
48
72
|
|
|
73
|
+
选项:
|
|
74
|
+
--project-root <path> 指定用户项目根目录(输出 .agent-aware/ 目录)
|
|
75
|
+
|
|
76
|
+
环境变量:
|
|
77
|
+
USER_PROJECT_ROOT 用户项目根目录(优先级高于 --project-root)
|
|
78
|
+
|
|
49
79
|
示例:
|
|
50
80
|
npx agent-aware-server start
|
|
81
|
+
npx agent-aware-server start --project-root /path/to/project
|
|
82
|
+
USER_PROJECT_ROOT=/path/to/project npx agent-aware-server start
|
|
51
83
|
`);
|
|
52
84
|
}
|
|
53
85
|
// 主入口
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAE3D,MAAM,SAAS,GAAG,IAAI,CAAA;AACtB,MAAM,QAAQ,GAAG,QAAQ,CAAA;AAEzB,SAAS,SAAS;IAChB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAClC,IAAI,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;IAEhE,uBAAuB;IACvB,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACvD,IAAI,gBAAgB,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,EAAE,CAAC;QAC1D,WAAW,GAAG,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,CAAA;AACxB,CAAC;AAED,SAAS,KAAK;IACZ,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,EAAE,CAAA;IAEnC,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAA;IACzC,M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 -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AlertDetector - 错误检测器
|
|
3
|
+
* 基于 SPEC-SRV-005: Detector 架构重构
|
|
4
|
+
*
|
|
5
|
+
* 职责:检测高危的运行时错误
|
|
6
|
+
*/
|
|
7
|
+
import type { ErrorSummary } from '../types';
|
|
8
|
+
export type IssueSeverity = 'critical' | 'warning' | 'info';
|
|
9
|
+
export declare class AlertDetector {
|
|
10
|
+
private agentAwareDir;
|
|
11
|
+
private errorPath;
|
|
12
|
+
private lastAlertTime;
|
|
13
|
+
constructor(outputDir?: string);
|
|
14
|
+
/**
|
|
15
|
+
* 计算严重级别
|
|
16
|
+
*/
|
|
17
|
+
calculateSeverity(errorSummary: ErrorSummary): IssueSeverity;
|
|
18
|
+
/**
|
|
19
|
+
* 检测并写入问题
|
|
20
|
+
*/
|
|
21
|
+
checkAndAlert(errorSummary: ErrorSummary): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* 写入 error.json
|
|
24
|
+
*/
|
|
25
|
+
private writeAlert;
|
|
26
|
+
/**
|
|
27
|
+
* 生成问题描述
|
|
28
|
+
*/
|
|
29
|
+
private generateDescription;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=alertDetector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alertDetector.d.ts","sourceRoot":"","sources":["../../src/detector/alertDetector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAM5C,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAA;AAqB3D,qBAAa,aAAa;IACxB,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,aAAa,CAAY;gBAErB,SAAS,GAAE,MAAsB;IAK7C;;OAEG;IACH,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,aAAa;IAS5D;;OAEG;IACG,aAAa,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAqC9D;;OAEG;YACW,UAAU;IASxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAG5B"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AlertDetector - 错误检测器
|
|
3
|
+
* 基于 SPEC-SRV-005: Detector 架构重构
|
|
4
|
+
*
|
|
5
|
+
* 职责:检测高危的运行时错误
|
|
6
|
+
*/
|
|
7
|
+
import { writeFile, mkdir } from 'node:fs/promises';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
const AGENT_AWARE_DIR = '.agent-aware';
|
|
10
|
+
const ERROR_FILE = 'error.json';
|
|
11
|
+
const ALERT_COOLDOWN_MS = 10000; // 10 秒冷却期
|
|
12
|
+
export class AlertDetector {
|
|
13
|
+
constructor(outputDir = process.cwd()) {
|
|
14
|
+
this.lastAlertTime = 0;
|
|
15
|
+
this.agentAwareDir = join(outputDir, AGENT_AWARE_DIR);
|
|
16
|
+
this.errorPath = join(this.agentAwareDir, ERROR_FILE);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 计算严重级别
|
|
20
|
+
*/
|
|
21
|
+
calculateSeverity(errorSummary) {
|
|
22
|
+
// Critical: 有错误
|
|
23
|
+
if (errorSummary.totalErrors >= 1) {
|
|
24
|
+
return 'critical';
|
|
25
|
+
}
|
|
26
|
+
return 'info';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 检测并写入问题
|
|
30
|
+
*/
|
|
31
|
+
async checkAndAlert(errorSummary) {
|
|
32
|
+
const severity = this.calculateSeverity(errorSummary);
|
|
33
|
+
// Info 级别不记录
|
|
34
|
+
if (severity === 'info') {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// 检查冷却期
|
|
38
|
+
const now = Date.now();
|
|
39
|
+
if (now - this.lastAlertTime < ALERT_COOLDOWN_MS) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// 写入 error.json
|
|
43
|
+
await this.writeAlert({
|
|
44
|
+
timestamp: new Date().toISOString(),
|
|
45
|
+
severity,
|
|
46
|
+
type: 'error',
|
|
47
|
+
summary: this.generateDescription(errorSummary),
|
|
48
|
+
details: {
|
|
49
|
+
totalErrors: errorSummary.totalErrors,
|
|
50
|
+
runtimeErrorCount: errorSummary.runtimeErrorCount,
|
|
51
|
+
unhandledRejectionCount: errorSummary.unhandledRejectionCount,
|
|
52
|
+
consoleErrorCount: errorSummary.consoleErrorCount,
|
|
53
|
+
recentErrors: errorSummary.recentErrors.map((error) => ({
|
|
54
|
+
id: error.id,
|
|
55
|
+
timestamp: error.timestamp,
|
|
56
|
+
errorType: error.errorType,
|
|
57
|
+
message: error.error.message,
|
|
58
|
+
})),
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
this.lastAlertTime = now;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 写入 error.json
|
|
65
|
+
*/
|
|
66
|
+
async writeAlert(alert) {
|
|
67
|
+
try {
|
|
68
|
+
await mkdir(this.agentAwareDir, { recursive: true });
|
|
69
|
+
await writeFile(this.errorPath, JSON.stringify(alert, null, 2), 'utf-8');
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
console.error('Failed to write error alert:', error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 生成问题描述
|
|
77
|
+
*/
|
|
78
|
+
generateDescription(errorSummary) {
|
|
79
|
+
return `检测到 ${errorSummary.totalErrors} 个运行时错误`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=alertDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alertDetector.js","sourceRoot":"","sources":["../../src/detector/alertDetector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS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Summary } from '../types';
|
|
8
|
+
export type IssueSeverity = 'critical' | 'warning' | 'info';
|
|
9
|
+
export declare class BehaviorDetector {
|
|
10
|
+
private agentAwareDir;
|
|
11
|
+
private behaviorPath;
|
|
12
|
+
private lastAlertTime;
|
|
13
|
+
constructor(outputDir?: string);
|
|
14
|
+
/**
|
|
15
|
+
* 计算严重级别
|
|
16
|
+
*/
|
|
17
|
+
calculateSeverity(summary: Summary): IssueSeverity;
|
|
18
|
+
/**
|
|
19
|
+
* 检测并写入问题
|
|
20
|
+
*/
|
|
21
|
+
checkAndAlert(summary: Summary): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* 写入 behavior.json
|
|
24
|
+
*/
|
|
25
|
+
private writeAlert;
|
|
26
|
+
/**
|
|
27
|
+
* 生成问题描述
|
|
28
|
+
*/
|
|
29
|
+
private generateDescription;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=behaviorDetector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"behaviorDetector.d.ts","sourceRoot":"","sources":["../../src/detector/behaviorDetector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAMvC,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAA;AAe3D,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,aAAa,CAAY;gBAErB,SAAS,GAAE,MAAsB;IAK7C;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa;IAoBlD;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BpD;;OAEG;YACW,UAAU;IASxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAM5B"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BehaviorDetector - 行为检测器
|
|
3
|
+
* 基于 SPEC-SRV-005: Detector 架构重构
|
|
4
|
+
*
|
|
5
|
+
* 职责:检测消极的用户交互行为
|
|
6
|
+
*/
|
|
7
|
+
import { writeFile, mkdir } from 'node:fs/promises';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
const AGENT_AWARE_DIR = '.agent-aware';
|
|
10
|
+
const BEHAVIOR_FILE = 'behavior.json';
|
|
11
|
+
const ALERT_COOLDOWN_MS = 10000; // 10 秒冷却期
|
|
12
|
+
export class BehaviorDetector {
|
|
13
|
+
constructor(outputDir = process.cwd()) {
|
|
14
|
+
this.lastAlertTime = 0;
|
|
15
|
+
this.agentAwareDir = join(outputDir, AGENT_AWARE_DIR);
|
|
16
|
+
this.behaviorPath = join(this.agentAwareDir, BEHAVIOR_FILE);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 计算严重级别
|
|
20
|
+
*/
|
|
21
|
+
calculateSeverity(summary) {
|
|
22
|
+
// Critical: 挫折指数很高
|
|
23
|
+
if (summary.frustrationScore >= 70) {
|
|
24
|
+
return 'critical';
|
|
25
|
+
}
|
|
26
|
+
// Warning: 中等挫折或有问题行为
|
|
27
|
+
if (summary.frustrationScore >= 50) {
|
|
28
|
+
return 'warning';
|
|
29
|
+
}
|
|
30
|
+
if (summary.rageClickCount >= 3) {
|
|
31
|
+
return 'warning';
|
|
32
|
+
}
|
|
33
|
+
if (summary.deadClickCount >= 2) {
|
|
34
|
+
return 'warning';
|
|
35
|
+
}
|
|
36
|
+
return 'info';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 检测并写入问题
|
|
40
|
+
*/
|
|
41
|
+
async checkAndAlert(summary) {
|
|
42
|
+
const severity = this.calculateSeverity(summary);
|
|
43
|
+
// Info 级别不记录
|
|
44
|
+
if (severity === 'info') {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// 检查冷却期
|
|
48
|
+
const now = Date.now();
|
|
49
|
+
if (now - this.lastAlertTime < ALERT_COOLDOWN_MS) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// 写入 behavior.json
|
|
53
|
+
await this.writeAlert({
|
|
54
|
+
timestamp: new Date().toISOString(),
|
|
55
|
+
severity,
|
|
56
|
+
type: 'frustration',
|
|
57
|
+
summary: this.generateDescription(summary),
|
|
58
|
+
details: {
|
|
59
|
+
frustrationScore: summary.frustrationScore,
|
|
60
|
+
rageClickCount: summary.rageClickCount,
|
|
61
|
+
deadClickCount: summary.deadClickCount,
|
|
62
|
+
totalInteractions: summary.totalInteractions,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
this.lastAlertTime = now;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 写入 behavior.json
|
|
69
|
+
*/
|
|
70
|
+
async writeAlert(alert) {
|
|
71
|
+
try {
|
|
72
|
+
await mkdir(this.agentAwareDir, { recursive: true });
|
|
73
|
+
await writeFile(this.behaviorPath, JSON.stringify(alert, null, 2), 'utf-8');
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error('Failed to write behavior alert:', error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 生成问题描述
|
|
81
|
+
*/
|
|
82
|
+
generateDescription(summary) {
|
|
83
|
+
if (summary.frustrationScore >= 70) {
|
|
84
|
+
return `检测到用户挫折行为(挫折指数: ${summary.frustrationScore})`;
|
|
85
|
+
}
|
|
86
|
+
return `检测到用户挫折行为`;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=behaviorDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"behaviorDetector.js","sourceRoot":"","sources":["../../src/detector/behaviorDetector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBA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-001
|
|
3
|
+
* 基于 SPEC-SRV-001 和 SPEC-SRV-005
|
|
4
4
|
*
|
|
5
5
|
* 支持 SDK 上报和 AI 查询
|
|
6
6
|
*/
|
|
7
7
|
import { Hono } from 'hono';
|
|
8
8
|
import type { BehaviorStore } from './store/behaviorStore';
|
|
9
9
|
import type { ErrorStore } from './store/errorStore';
|
|
10
|
-
|
|
10
|
+
import type { BehaviorDetector } from './detector/behaviorDetector';
|
|
11
|
+
import type { AlertDetector } from './detector/alertDetector';
|
|
12
|
+
export declare function createHttpApi(store: BehaviorStore, errorStore?: ErrorStore, behaviorDetector?: BehaviorDetector, alertDetector?: AlertDetector): Hono;
|
|
11
13
|
//# sourceMappingURL=httpApi.d.ts.map
|
package/dist/httpApi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpApi.d.ts","sourceRoot":"","sources":["../src/httpApi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"httpApi.d.ts","sourceRoot":"","sources":["../src/httpApi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAW7D,wBAAgB,aAAa,CAC3B,KAAK,EAAE,aAAa,EACpB,UAAU,CAAC,EAAE,UAAU,EACvB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,aAAa,CAAC,EAAE,aAAa,GAC5B,IAAI,CAoJN"}
|
package/dist/httpApi.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP API
|
|
3
|
-
* 基于 SPEC-SRV-001
|
|
3
|
+
* 基于 SPEC-SRV-001 和 SPEC-SRV-005
|
|
4
4
|
*
|
|
5
5
|
* 支持 SDK 上报和 AI 查询
|
|
6
6
|
*/
|
|
7
7
|
import { Hono } from 'hono';
|
|
8
8
|
import { cors } from 'hono/cors';
|
|
9
|
-
export function createHttpApi(store, errorStore) {
|
|
9
|
+
export function createHttpApi(store, errorStore, behaviorDetector, alertDetector) {
|
|
10
10
|
const app = new Hono();
|
|
11
11
|
// 启用 CORS - 允许所有来源(开发环境)
|
|
12
12
|
// 使用动态 origin 回显请求的 Origin,以支持 credentials 模式
|
|
@@ -25,6 +25,13 @@ export function createHttpApi(store, errorStore) {
|
|
|
25
25
|
const body = await c.req.json();
|
|
26
26
|
const behaviors = body.behaviors || [];
|
|
27
27
|
await store.addBatch(behaviors);
|
|
28
|
+
// 触发行为检测(不阻塞响应)
|
|
29
|
+
if (behaviorDetector) {
|
|
30
|
+
const summary = await store.getSummary();
|
|
31
|
+
behaviorDetector.checkAndAlert(summary).catch((err) => {
|
|
32
|
+
console.error('Behavior detection failed:', err);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
28
35
|
const response = {
|
|
29
36
|
ok: true,
|
|
30
37
|
count: behaviors.length,
|
|
@@ -79,6 +86,13 @@ export function createHttpApi(store, errorStore) {
|
|
|
79
86
|
const body = await c.req.json();
|
|
80
87
|
const errors = body.errors || [];
|
|
81
88
|
await errorStore.addBatch(errors);
|
|
89
|
+
// 触发错误检测(不阻塞响应)
|
|
90
|
+
if (alertDetector) {
|
|
91
|
+
const errorSummary = await errorStore.getSummary();
|
|
92
|
+
alertDetector.checkAndAlert(errorSummary).catch((err) => {
|
|
93
|
+
console.error('Error detection failed:', err);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
82
96
|
const response = {
|
|
83
97
|
ok: true,
|
|
84
98
|
count: errors.length,
|
package/dist/httpApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpApi.js","sourceRoot":"","sources":["../src/httpApi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"httpApi.js","sourceRoot":"","sources":["../src/httpApi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAehC,MAAM,UAAU,aAAa,CAC3B,KAAoB,EACpB,UAAuB,EACvB,gBAAmC,EACnC,aAA6B;IAE7B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAA;IAEtB,yBAAyB;IACzB,8CAA8C;IAC9C,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;QACjB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,GAAG,EAAE,wBAAwB;QAC3D,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC;QAClD,YAAY,EAAE,CAAC,cAAc,CAAC;QAC9B,aAAa,EAAE,CAAC,gBAAgB,CAAC;QACjC,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,IAAI,EAAE,cAAc;KAClC,CAAC,CAAC,CAAA;IAEH,mCAAmC;IAEnC,2BAA2B;IAC3B,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACjC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,EAA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ourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent-aware Server 入口
|
|
3
3
|
* HTTP Server (Hono)
|
|
4
|
+
* 基于 SPEC-SRV-005: Detector 架构重构
|
|
4
5
|
*/
|
|
5
6
|
import { serve } from '@hono/node-server';
|
|
6
7
|
import { createHttpApi } from './httpApi';
|
|
7
8
|
import { BehaviorStore } from './store/behaviorStore';
|
|
8
9
|
import { ErrorStore } from './store/errorStore';
|
|
10
|
+
import { BehaviorDetector } from './detector/behaviorDetector';
|
|
11
|
+
import { AlertDetector } from './detector/alertDetector';
|
|
9
12
|
const PORT = 4100;
|
|
10
13
|
const DATA_DIR = './data';
|
|
14
|
+
// 检测器输出到用户项目根目录
|
|
15
|
+
// 优先级:环境变量 > process.cwd()
|
|
16
|
+
const PROJECT_ROOT = process.env.USER_PROJECT_ROOT || process.cwd();
|
|
11
17
|
const store = new BehaviorStore(DATA_DIR);
|
|
12
18
|
const errorStore = new ErrorStore(DATA_DIR);
|
|
13
|
-
const
|
|
19
|
+
const behaviorDetector = new BehaviorDetector(PROJECT_ROOT);
|
|
20
|
+
const alertDetector = new AlertDetector(PROJECT_ROOT);
|
|
21
|
+
const app = createHttpApi(store, errorStore, behaviorDetector, alertDetector);
|
|
14
22
|
console.log(`[AgentAware Server] Starting on port ${PORT}...`);
|
|
23
|
+
console.log(`[AgentAware Server] Project root: ${PROJECT_ROOT}`);
|
|
24
|
+
console.log(`[AgentAware Server] Output directory: ${PROJECT_ROOT}/.agent-aware/`);
|
|
15
25
|
serve({
|
|
16
26
|
fetch: app.fetch,
|
|
17
27
|
port: PORT,
|
|
@@ -19,6 +29,9 @@ serve({
|
|
|
19
29
|
console.log(`[AgentAware Server] HTTP API listening on http://localhost:${PORT}`);
|
|
20
30
|
console.log(`[AgentAware Server] Endpoints:`);
|
|
21
31
|
console.log(` POST /behaviors - 接收行为数据`);
|
|
32
|
+
console.log(` GET /behaviors - 查询行为数据`);
|
|
33
|
+
console.log(` GET /summary - 获取行为摘要`);
|
|
34
|
+
console.log(` GET /hotspots - 获取交互热点`);
|
|
22
35
|
console.log(` GET /health - 健康检查`);
|
|
23
36
|
console.log(` DELETE /behaviors - 清空行为数据`);
|
|
24
37
|
console.log(` POST /errors - 接收错误数据`);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD,MAAM,IAAI,GAAG,IAAI,CAAA;AACjB,MAAM,QAAQ,GAAG,QAAQ,CAAA;AACzB,gBAAgB;AAChB,2BAA2B;AAC3B,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;AAEnE,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAA;AACzC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAA;AAC3C,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,YAAY,CAAC,CAAA;AAC3D,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,YAAY,CAAC,CAAA;AACrD,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAA;AAE7E,OAAO,CAAC,GAAG,CAAC,wCAAwC,IAAI,KAAK,CAAC,CAAA;AAC9D,OAAO,CAAC,GAAG,CAAC,qCAAqC,YAAY,EAAE,CAAC,CAAA;AAChE,OAAO,CAAC,GAAG,CAAC,yCAAyC,YAAY,gBAAgB,CAAC,CAAA;AAElF,KAAK,CAAC;IACJ,KAAK,EAAE,GAAG,CAAC,KAAK;IAChB,IAAI,EAAE,IAAI;CACX,CAAC,CAAA;AAEF,OAAO,CAAC,GAAG,CAAC,8DAA8D,IAAI,EAAE,CAAC,CAAA;AACjF,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;AAC7C,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;AACjD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;AACjD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;AACjD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;AACjD,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAA;AAC/C,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;AACjD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;AACjD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;AACjD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;AACjD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -92,4 +92,38 @@ export interface ErrorsResponse {
|
|
|
92
92
|
ok: boolean;
|
|
93
93
|
count: number;
|
|
94
94
|
}
|
|
95
|
+
export type IssueSeverity = 'critical' | 'warning' | 'info';
|
|
96
|
+
export type IssueType = 'error' | 'frustration' | 'performance';
|
|
97
|
+
export interface Issue {
|
|
98
|
+
id: string;
|
|
99
|
+
timestamp: string;
|
|
100
|
+
severity: IssueSeverity;
|
|
101
|
+
type: IssueType;
|
|
102
|
+
description: string;
|
|
103
|
+
details: {
|
|
104
|
+
summary?: Summary;
|
|
105
|
+
errorSummary?: ErrorSummary;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export interface IssuesData {
|
|
109
|
+
issues: Issue[];
|
|
110
|
+
summary: {
|
|
111
|
+
total: number;
|
|
112
|
+
critical: number;
|
|
113
|
+
warning: number;
|
|
114
|
+
info: number;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export interface Alert {
|
|
118
|
+
timestamp: string;
|
|
119
|
+
severity: IssueSeverity;
|
|
120
|
+
type: IssueType;
|
|
121
|
+
summary: string;
|
|
122
|
+
details: {
|
|
123
|
+
frustrationScore?: number;
|
|
124
|
+
rageClickCount?: number;
|
|
125
|
+
deadClickCount?: number;
|
|
126
|
+
errorCount?: number;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
95
129
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAE9F,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,YAAY,GAAG,aAAa,CAAA;AAEzE,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,qBAAqB,GAAG,SAAS,CAAA;AAIrE,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,YAAY,CAAA;IA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