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