-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathtypes.ts
More file actions
202 lines (182 loc) · 4.01 KB
/
Copy pathtypes.ts
File metadata and controls
202 lines (182 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/**
* AI Agent Eval Dataset Collection - Type Definitions
*
* Data models for collecting coding session metrics for eval datasets.
* Supports two privacy levels:
* - anonymous: Safe for external sharing (no content, just metrics)
* - full: Personal use only (includes prompts, responses, file paths)
*/
/**
* Summary of tool usage within a session
*/
export interface ToolCallSummary {
toolName: string;
callCount: number;
successCount: number;
failedCount: number;
avgDurationMs: number;
}
/**
* Base session record - always collected
*/
export interface Session {
sessionId: string; // UUID
timestamp: number; // Unix ms
engine: string; // claude, opencode, cursor, etc.
mode: string; // sequential, parallel, single
cliVersion: string;
platform: string; // darwin, linux, win32
// Aggregates
totalTokensIn: number;
totalTokensOut: number;
totalDurationMs: number;
taskCount: number;
successCount: number;
failedCount: number;
// Tool usage summary
toolCalls: ToolCallSummary[];
// Optional: user-provided tags for evals
tags?: string[];
}
/**
* Extended session record - full mode only
*/
export interface SessionFull extends Session {
prompt?: string; // User's task prompt
response?: string; // Final AI response
filePaths?: string[]; // Files touched
}
/**
* Individual tool call record
*/
export interface ToolCall {
sessionId: string;
callIndex: number; // Order in session
timestamp: number;
toolName: string; // Read, Edit, Bash, Grep, etc.
durationMs: number;
success: boolean;
errorType?: string; // timeout, permission, exit_code, etc.
// Anonymous mode: parameter keys only (no values)
parameterKeys?: string[]; // ["file_path", "command"]
// Full mode only
parameters?: Record<string, unknown>; // Actual tool parameters
result?: string; // Tool output
}
/**
* Privacy levels for telemetry
*/
export type TelemetryLevel = "anonymous" | "full";
/**
* Full session data for webhook
*/
interface WebhookSessionData {
sessionId: string;
engine: string;
mode: string;
cliVersion: string;
platform: string;
totalTokensIn: number;
totalTokensOut: number;
totalDurationMs: number;
taskCount: number;
successCount: number;
failedCount: number;
toolCalls: {
toolName: string;
callCount: number;
successCount: number;
failedCount: number;
avgDurationMs: number;
}[];
tags?: string[];
}
/**
* Full session details for webhook (full privacy mode)
*/
interface WebhookSessionDetails {
prompt?: string;
response?: string;
filePaths?: string[];
}
/**
* Telemetry webhook payload
*/
export interface TelemetryWebhookPayload {
event: string;
version: string;
timestamp: string;
session: WebhookSessionData;
details?: WebhookSessionDetails;
}
/**
* Telemetry configuration
*/
export interface TelemetryConfig {
enabled: boolean;
level: TelemetryLevel;
outputDir: string;
}
/**
* Runtime telemetry options (from CLI flags)
*/
export interface TelemetryOptions {
enabled?: boolean;
level?: TelemetryLevel;
outputDir?: string;
tags?: string[];
}
/**
* Export format types
*/
export type ExportFormat = "deepeval" | "openai" | "raw";
/**
* DeepEval test case format
*/
export interface DeepEvalTestCase {
input: string;
actual_output: string;
context: string[];
tools: string[];
metadata: {
session_id: string;
engine: string;
tokens_in: number;
tokens_out: number;
success: boolean;
duration_ms: number;
};
}
/**
* DeepEval export format
*/
export interface DeepEvalExport {
test_cases: DeepEvalTestCase[];
}
/**
* OpenAI Evals format (JSONL entries)
*/
export interface OpenAIEvalsEntry {
metadata: {
session_id: string;
engine: string;
mode: string;
tools_used: string[];
tokens_in: number;
tokens_out: number;
success: boolean;
duration_ms: number;
task_count: number;
platform: string;
};
// Full mode only
input?: Array<{ role: string; content: string }>;
ideal?: string;
}
/**
* Raw export entry (for custom processing)
*/
export interface RawExportEntry {
type: "session" | "tool_call";
data: Session | SessionFull | ToolCall;
}