@inspectr/mcplab-core 1.17.0 → 1.18.1

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/dist/types.d.ts CHANGED
@@ -1,360 +1,364 @@
1
1
  export type TransportType = 'http';
2
2
  export interface ServerAuthBearer {
3
- type: 'bearer';
4
- env?: string;
5
- token?: string;
3
+ type: 'bearer';
4
+ env?: string;
5
+ token?: string;
6
6
  }
7
7
  export interface ServerAuthApiKey {
8
- type: 'api_key';
9
- header_name?: string;
10
- value: string;
8
+ type: 'api_key';
9
+ header_name?: string;
10
+ value: string;
11
11
  }
12
12
  export interface ServerAuthOauthClientCredentials {
13
- type: 'oauth_client_credentials';
14
- token_url: string;
15
- client_id_env: string;
16
- client_secret_env: string;
17
- scope?: string;
18
- audience?: string;
19
- token_params?: Record<string, string>;
13
+ type: 'oauth_client_credentials';
14
+ token_url: string;
15
+ client_id_env: string;
16
+ client_secret_env: string;
17
+ scope?: string;
18
+ audience?: string;
19
+ token_params?: Record<string, string>;
20
20
  }
21
21
  export interface ServerAuthOauthAuthorizationCode {
22
- type: 'oauth_authorization_code';
23
- mode?: 'pre_registered' | 'dcr';
24
- client_id?: string;
25
- client_secret?: string;
26
- redirect_url?: string;
27
- scope?: string;
28
- authorization_url?: string;
29
- token_url?: string;
30
- }
31
- export type ServerAuth =
32
- | ServerAuthBearer
33
- | ServerAuthApiKey
34
- | ServerAuthOauthClientCredentials
35
- | ServerAuthOauthAuthorizationCode;
22
+ type: 'oauth_authorization_code';
23
+ mode?: 'pre_registered' | 'dcr';
24
+ client_id?: string;
25
+ client_secret?: string;
26
+ redirect_url?: string;
27
+ scope?: string;
28
+ authorization_url?: string;
29
+ token_url?: string;
30
+ }
31
+ export type ServerAuth = ServerAuthBearer | ServerAuthApiKey | ServerAuthOauthClientCredentials | ServerAuthOauthAuthorizationCode;
36
32
  export interface ServerConfig {
37
- name?: string;
38
- transport: TransportType;
39
- url: string;
40
- headers?: Record<string, string>;
41
- auth?: ServerAuth;
33
+ name?: string;
34
+ transport: TransportType;
35
+ url: string;
36
+ headers?: Record<string, string>;
37
+ auth?: ServerAuth;
42
38
  }
43
39
  export interface ServerInlineEntry extends ServerConfig {
44
- id: string;
45
- name?: string;
40
+ id: string;
41
+ name?: string;
46
42
  }
47
43
  export interface ServerRefEntry {
48
- ref: string;
44
+ ref: string;
49
45
  }
50
46
  export type ServerListEntry = ServerInlineEntry | ServerRefEntry;
51
47
  export interface AgentConfig {
52
- name?: string;
53
- provider: 'openai' | 'anthropic' | 'azure_openai';
54
- model: string;
55
- temperature?: number;
56
- max_tokens?: number;
57
- max_turns?: number;
58
- system?: string;
48
+ name?: string;
49
+ provider: 'openai' | 'anthropic' | 'azure_openai';
50
+ model: string;
51
+ temperature?: number;
52
+ max_tokens?: number;
53
+ max_turns?: number;
54
+ system?: string;
59
55
  }
60
56
  export interface AgentInlineEntry extends AgentConfig {
61
- id: string;
62
- name?: string;
57
+ id: string;
58
+ name?: string;
63
59
  }
64
60
  export interface AgentRefEntry {
65
- ref: string;
61
+ ref: string;
66
62
  }
67
63
  export type AgentListEntry = AgentInlineEntry | AgentRefEntry;
68
64
  export interface ToolConstraints {
69
- required_tools?: string[];
70
- forbidden_tools?: string[];
65
+ required_tools?: string[];
66
+ forbidden_tools?: string[];
71
67
  }
72
68
  export interface ToolSequenceRules {
73
- allow?: string[][];
69
+ allow?: string[][];
74
70
  }
75
71
  export interface ResponseAssertionRegex {
76
- type: 'regex';
77
- pattern: string;
72
+ type: 'regex';
73
+ pattern: string;
78
74
  }
79
75
  export interface ResponseAssertionContains {
80
- type: 'contains';
81
- value: string;
76
+ type: 'contains';
77
+ value: string;
82
78
  }
83
79
  export interface ResponseAssertionNotContains {
84
- type: 'not_contains';
85
- value: string;
80
+ type: 'not_contains';
81
+ value: string;
86
82
  }
87
83
  export interface ResponseAssertionStartsWith {
88
- type: 'starts_with';
89
- value: string;
84
+ type: 'starts_with';
85
+ value: string;
90
86
  }
91
87
  export interface ResponseAssertionEndsWith {
92
- type: 'ends_with';
93
- value: string;
88
+ type: 'ends_with';
89
+ value: string;
94
90
  }
95
91
  export interface ResponseAssertionEquals {
96
- type: 'equals';
97
- value: string;
92
+ type: 'equals';
93
+ value: string;
98
94
  }
99
95
  export interface ResponseAssertionJsonPath {
100
- type: 'jsonpath';
101
- path: string;
102
- equals?: string | number | boolean;
96
+ type: 'jsonpath';
97
+ path: string;
98
+ equals?: string | number | boolean;
103
99
  }
104
100
  export interface ResponseAssertionJsonPathExists {
105
- type: 'jsonpath_exists';
106
- path: string;
101
+ type: 'jsonpath_exists';
102
+ path: string;
107
103
  }
108
104
  export interface ResponseAssertionJsonPathNotExists {
109
- type: 'jsonpath_not_exists';
110
- path: string;
111
- }
112
- export type ResponseAssertion =
113
- | ResponseAssertionRegex
114
- | ResponseAssertionContains
115
- | ResponseAssertionNotContains
116
- | ResponseAssertionStartsWith
117
- | ResponseAssertionEndsWith
118
- | ResponseAssertionEquals
119
- | ResponseAssertionJsonPath
120
- | ResponseAssertionJsonPathExists
121
- | ResponseAssertionJsonPathNotExists;
105
+ type: 'jsonpath_not_exists';
106
+ path: string;
107
+ }
108
+ export interface AgentAssertion {
109
+ label: string;
110
+ prompt: string;
111
+ }
112
+ export interface AgentContext {
113
+ include_prompt?: boolean;
114
+ include_tool_sequence?: boolean;
115
+ }
116
+ export interface AgentJudgeContext {
117
+ scenario_prompt?: string;
118
+ tool_sequence?: string[];
119
+ }
120
+ export type ResponseAssertion = ResponseAssertionRegex | ResponseAssertionContains | ResponseAssertionNotContains | ResponseAssertionStartsWith | ResponseAssertionEndsWith | ResponseAssertionEquals | ResponseAssertionJsonPath | ResponseAssertionJsonPathExists | ResponseAssertionJsonPathNotExists;
122
121
  export interface EvalRules {
123
- tool_constraints?: ToolConstraints;
124
- tool_sequence?: ToolSequenceRules;
125
- response_assertions?: ResponseAssertion[];
122
+ tool_constraints?: ToolConstraints;
123
+ tool_sequence?: ToolSequenceRules;
124
+ response_assertions?: ResponseAssertion[];
125
+ agent_assertions?: AgentAssertion[];
126
+ agent_context?: AgentContext;
127
+ }
128
+ export type CheckResultStatus = 'passed' | 'failed' | 'not_evaluated';
129
+ export interface CheckResult {
130
+ type: string;
131
+ label: string;
132
+ status: CheckResultStatus;
133
+ reason?: string;
134
+ metadata?: Record<string, unknown>;
126
135
  }
127
136
  export interface ExtractRule {
128
- name: string;
129
- from: 'final_text';
130
- regex: string;
137
+ name: string;
138
+ from: 'final_text';
139
+ regex: string;
131
140
  }
132
141
  export interface Scenario {
133
- id: string;
134
- name?: string;
135
- mcp_servers?: ServerListEntry[];
136
- servers: string[];
137
- prompt: string;
138
- eval?: EvalRules;
139
- extract?: ExtractRule[];
142
+ id: string;
143
+ name?: string;
144
+ mcp_servers?: ServerListEntry[];
145
+ servers: string[];
146
+ prompt: string;
147
+ eval?: EvalRules;
148
+ extract?: ExtractRule[];
140
149
  }
141
150
  export interface ScenarioRefEntry {
142
- ref: string;
143
- mcp_servers?: ServerListEntry[];
151
+ ref: string;
152
+ mcp_servers?: ServerListEntry[];
153
+ }
154
+ export interface SourceScenario extends Omit<Scenario, 'servers'> {
155
+ servers?: string[];
144
156
  }
145
- export type ScenarioInlineEntry = Scenario;
146
- export type ScenarioListEntry = ScenarioInlineEntry | ScenarioRefEntry;
157
+ export type ScenarioListEntry = SourceScenario | ScenarioRefEntry;
147
158
  export interface EvalConfig {
148
- name?: string;
149
- servers: Record<string, ServerConfig>;
150
- agents: Record<string, AgentConfig>;
151
- scenarios: Scenario[];
152
- run_defaults?: {
153
- selected_agents?: string[];
154
- };
159
+ name?: string;
160
+ servers: Record<string, ServerConfig>;
161
+ agents: Record<string, AgentConfig>;
162
+ scenarios: Scenario[];
163
+ run_defaults?: {
164
+ selected_agents?: string[];
165
+ };
155
166
  }
156
167
  export interface SourceEvalConfig extends Omit<EvalConfig, 'scenarios' | 'agents' | 'servers'> {
157
- servers?: ServerListEntry[];
158
- agents: AgentListEntry[];
159
- scenarios: ScenarioListEntry[];
168
+ servers?: ServerListEntry[];
169
+ agents: AgentListEntry[];
170
+ scenarios: ScenarioListEntry[];
160
171
  }
161
172
  export interface ExecutableScenario extends Scenario {
162
- agent: string;
163
- scenario_exec_id?: string;
173
+ agent: string;
174
+ scenario_exec_id?: string;
164
175
  }
165
176
  export interface ExecutableEvalConfig extends Omit<EvalConfig, 'scenarios'> {
166
- scenarios: ExecutableScenario[];
177
+ scenarios: ExecutableScenario[];
167
178
  }
168
179
  export interface ToolDef {
169
- name: string;
170
- title?: string;
171
- description?: string;
172
- inputSchema?: unknown;
173
- outputSchema?: unknown;
174
- annotations?: {
180
+ name: string;
175
181
  title?: string;
176
- readOnlyHint?: boolean;
177
- idempotentHint?: boolean;
178
- destructiveHint?: boolean;
179
- openWorldHint?: boolean;
180
- [key: string]: unknown;
181
- };
182
+ description?: string;
183
+ inputSchema?: unknown;
184
+ outputSchema?: unknown;
185
+ annotations?: {
186
+ title?: string;
187
+ readOnlyHint?: boolean;
188
+ idempotentHint?: boolean;
189
+ destructiveHint?: boolean;
190
+ openWorldHint?: boolean;
191
+ [key: string]: unknown;
192
+ };
182
193
  }
183
194
  export interface ToolCall {
184
- id?: string;
185
- name: string;
186
- arguments: Record<string, unknown> | unknown;
187
- server?: string;
195
+ id?: string;
196
+ name: string;
197
+ arguments: Record<string, unknown> | unknown;
198
+ server?: string;
188
199
  }
189
200
  export interface LlmMessage {
190
- role: 'system' | 'user' | 'assistant' | 'tool';
191
- content: string;
192
- tool_call_id?: string;
193
- name?: string;
194
- tool_calls?: ToolCall[];
201
+ role: 'system' | 'user' | 'assistant' | 'tool';
202
+ content: string;
203
+ tool_call_id?: string;
204
+ name?: string;
205
+ tool_calls?: ToolCall[];
195
206
  }
196
207
  export interface LlmResponse {
197
- content?: string;
198
- tool_calls?: ToolCall[];
199
- raw?: unknown;
200
- usage?: {
208
+ content?: string;
209
+ tool_calls?: ToolCall[];
210
+ raw?: unknown;
211
+ usage?: {
212
+ input_tokens?: number;
213
+ output_tokens?: number;
214
+ total_tokens?: number;
215
+ };
216
+ }
217
+ export interface TraceMessageUsage {
201
218
  input_tokens?: number;
202
219
  output_tokens?: number;
203
220
  total_tokens?: number;
204
- };
205
- }
206
- export interface TraceMessageUsage {
207
- input_tokens?: number;
208
- output_tokens?: number;
209
- total_tokens?: number;
210
221
  }
211
222
  export interface EstimatedTokens {
212
- input: number;
213
- output: number;
214
- total: number;
215
- method: 'js_tiktoken_estimate' | 'js_tiktoken_fallback';
216
- }
217
- export type TraceMessageContentBlock =
218
- | {
219
- type: 'text';
220
- text: string;
221
- }
222
- | {
223
- type: 'tool_use';
224
- id: string;
225
- name: string;
226
- input: unknown;
227
- server: string;
228
- estimated_tokens?: EstimatedTokens;
229
- }
230
- | {
231
- type: 'tool_result';
232
- tool_use_id: string;
233
- name: string;
234
- content: Array<{
223
+ input: number;
224
+ output: number;
225
+ total: number;
226
+ method: 'js_tiktoken_estimate' | 'js_tiktoken_fallback';
227
+ }
228
+ export type TraceMessageContentBlock = {
229
+ type: 'text';
230
+ text: string;
231
+ } | {
232
+ type: 'tool_use';
233
+ id: string;
234
+ name: string;
235
+ input: unknown;
236
+ server: string;
237
+ estimated_tokens?: EstimatedTokens;
238
+ } | {
239
+ type: 'tool_result';
240
+ tool_use_id: string;
241
+ name: string;
242
+ content: Array<{
235
243
  type: 'text';
236
244
  text: string;
237
- }>;
238
- is_error: boolean;
239
- duration_ms?: number;
240
- ts_start?: string;
241
- ts_end?: string;
242
- server?: string;
243
- estimated_tokens?: EstimatedTokens;
244
- };
245
+ }>;
246
+ is_error: boolean;
247
+ duration_ms?: number;
248
+ ts_start?: string;
249
+ ts_end?: string;
250
+ server?: string;
251
+ estimated_tokens?: EstimatedTokens;
252
+ };
245
253
  export interface TraceMessage {
246
- role: 'user' | 'assistant' | 'tool';
247
- ts?: string;
248
- usage?: TraceMessageUsage;
249
- content: TraceMessageContentBlock[];
254
+ role: 'user' | 'assistant' | 'tool';
255
+ ts?: string;
256
+ usage?: TraceMessageUsage;
257
+ content: TraceMessageContentBlock[];
250
258
  }
251
259
  export interface ScenarioRunTraceRecord {
252
- type: 'scenario_run';
253
- trace_version: 3;
254
- run_index: number;
255
- request_id?: string;
256
- scenario_id: string;
257
- agent: string;
258
- provider: string;
259
- model: string;
260
- ts_start: string;
261
- ts_end: string;
262
- pass: boolean;
263
- error?: string;
264
- messages: TraceMessage[];
265
- metrics?: {
266
- tool_call_count: number;
267
- total_tool_duration_ms: number;
268
- };
260
+ type: 'scenario_run';
261
+ trace_version: 3;
262
+ run_index: number;
263
+ request_id?: string;
264
+ scenario_id: string;
265
+ agent: string;
266
+ provider: string;
267
+ model: string;
268
+ ts_start: string;
269
+ ts_end: string;
270
+ pass: boolean;
271
+ error?: string;
272
+ messages: TraceMessage[];
273
+ metrics?: {
274
+ tool_call_count: number;
275
+ total_tool_duration_ms: number;
276
+ };
269
277
  }
270
278
  export interface TraceFileLegacyMeta {
271
- type: 'trace_meta';
272
- trace_version: number;
273
- run_id: string;
274
- ts: string;
275
- }
276
- export type PersistedTraceRecord =
277
- | ScenarioRunTraceRecord
278
- | TraceFileLegacyMeta
279
- | Record<string, unknown>;
279
+ type: 'trace_meta';
280
+ trace_version: number;
281
+ run_id: string;
282
+ ts: string;
283
+ }
284
+ export type PersistedTraceRecord = ScenarioRunTraceRecord | TraceFileLegacyMeta | Record<string, unknown>;
280
285
  export interface ScenarioRunResult {
281
- run_index: number;
282
- request_id?: string;
283
- pass: boolean;
284
- error?: string;
285
- failures: string[];
286
- tool_calls: string[];
287
- tool_call_count: number;
288
- tool_sequence: string[];
289
- tool_usage: Record<string, number>;
290
- tool_durations_ms: number[];
291
- run_duration_ms?: number;
292
- final_text: string;
293
- extracted: Record<string, string | number | boolean | null>;
286
+ run_index: number;
287
+ request_id?: string;
288
+ pass: boolean;
289
+ error?: string;
290
+ failures: string[];
291
+ check_results?: CheckResult[];
292
+ tool_calls: string[];
293
+ tool_call_count: number;
294
+ tool_sequence: string[];
295
+ tool_usage: Record<string, number>;
296
+ tool_durations_ms: number[];
297
+ run_duration_ms?: number;
298
+ final_text: string;
299
+ extracted: Record<string, string | number | boolean | null>;
294
300
  }
295
301
  export interface ScenarioAggregate {
296
- scenario_id: string;
297
- scenario_name?: string;
298
- agent: string;
299
- provider?: string;
300
- model?: string;
301
- eval?: EvalRules;
302
- tool_constraints_stats?: {
303
- required: Record<string, number>;
304
- forbidden: Record<string, number>;
305
- };
306
- runs: ScenarioRunResult[];
307
- pass_rate: number;
308
- distinct_sequences: Record<string, number>;
309
- tool_usage_frequency: Record<string, number>;
310
- extracted_values: Record<string, Record<string, number>>;
311
- last_final_answer: string;
312
- }
313
- export type HealthMcpConnectionInfo =
314
- | {
315
- enabled: false;
316
- }
317
- | {
318
- enabled: true;
319
- transport: 'streamable-http';
320
- host: string;
321
- port: number;
322
- path: string;
323
- proxyUrl: string;
324
- directUrl: string;
325
- serverPackageVersion: string;
326
- environment: {
302
+ scenario_id: string;
303
+ scenario_name?: string;
304
+ agent: string;
305
+ provider?: string;
306
+ model?: string;
307
+ eval?: EvalRules;
308
+ tool_constraints_stats?: {
309
+ required: Record<string, number>;
310
+ forbidden: Record<string, number>;
311
+ };
312
+ runs: ScenarioRunResult[];
313
+ pass_rate: number;
314
+ distinct_sequences: Record<string, number>;
315
+ tool_usage_frequency: Record<string, number>;
316
+ extracted_values: Record<string, Record<string, number>>;
317
+ last_final_answer: string;
318
+ }
319
+ export type HealthMcpConnectionInfo = {
320
+ enabled: false;
321
+ } | {
322
+ enabled: true;
323
+ transport: 'streamable-http';
324
+ host: string;
325
+ port: number;
326
+ path: string;
327
+ proxyUrl: string;
328
+ directUrl: string;
329
+ serverPackageVersion: string;
330
+ environment: {
327
331
  MCP_HOST: string;
328
332
  MCP_PORT: string;
329
333
  MCP_PATH: string;
330
- };
331
334
  };
335
+ };
332
336
  export interface ResultsJson {
333
- metadata: {
334
- run_id: string;
335
- timestamp: string;
336
- run_note?: string;
337
- git_commit?: string;
338
- config_hash: string;
339
- config_path?: string;
340
- config_name?: string;
341
- rerun_agents?: string[];
342
- rerun_scenario_ids?: string[];
343
- rerun_server_override_all?: string[];
344
- rerun_scenario_server_overrides?: Record<string, string[]>;
345
- tool_tokens_total?: number | null;
346
- total_duration_ms?: number;
347
- total_tool_duration_ms?: number;
348
- cli_version: string;
349
- mcp_server_versions: Record<string, string | null>;
350
- };
351
- summary: {
352
- total_scenarios: number;
353
- total_runs: number;
354
- pass_rate: number;
355
- avg_tool_calls_per_run: number;
356
- avg_tool_latency_ms: number | null;
357
- };
358
- scenarios: ScenarioAggregate[];
337
+ metadata: {
338
+ run_id: string;
339
+ timestamp: string;
340
+ run_note?: string;
341
+ git_commit?: string;
342
+ config_hash: string;
343
+ config_path?: string;
344
+ config_name?: string;
345
+ rerun_agents?: string[];
346
+ rerun_scenario_ids?: string[];
347
+ rerun_server_override_all?: string[];
348
+ rerun_scenario_server_overrides?: Record<string, string[]>;
349
+ tool_tokens_total?: number | null;
350
+ total_duration_ms?: number;
351
+ total_tool_duration_ms?: number;
352
+ cli_version: string;
353
+ mcp_server_versions: Record<string, string | null>;
354
+ };
355
+ summary: {
356
+ total_scenarios: number;
357
+ total_runs: number;
358
+ pass_rate: number;
359
+ avg_tool_calls_per_run: number;
360
+ avg_tool_latency_ms: number | null;
361
+ };
362
+ scenarios: ScenarioAggregate[];
359
363
  }
360
- //# sourceMappingURL=types.d.ts.map
364
+ //# sourceMappingURL=types.d.ts.map