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