evalution 1.0.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.
@@ -0,0 +1,1440 @@
1
+ import { Tracer } from "@opentelemetry/api";
2
+ import { SpanProcessor } from "@opentelemetry/sdk-trace-base";
3
+ import { CalleeBinding, ExtractedProps, PropDefinition, PropDefinition as PropDefinition$1, PropValue, PropValue as PropValue$1, SourceSpan } from "ts-proppy";
4
+ import { GoogleGenAI } from "@google/genai";
5
+
6
+ //#region src/shared/types.d.ts
7
+ /**
8
+ * A reference to a prompt.
9
+ *
10
+ * `id` is interpreted as a globally-unique prompt ID unless `providerId` is
11
+ * present, in which case `id` is scoped to that specific prompt provider. This
12
+ * mirrors the OpenTelemetry attributes `evalution.prompt.id` (always present)
13
+ * and `evalution.prompt.provider.id` (optional, scoping).
14
+ */
15
+ interface PromptID {
16
+ /** The prompt ID — global unless {@link providerId} scopes it. */
17
+ id: string;
18
+ /** When set, {@link id} is scoped to this prompt provider. */
19
+ providerId?: string;
20
+ }
21
+ /**
22
+ * Low-level prompt representation produced by a
23
+ * {@link PromptFileType}. It exposes the raw `extractedProps` from the parser
24
+ * and uses SDK-specific property names (e.g. `model`, `system`, `messages`).
25
+ *
26
+ * Not intended for public consumption — {@link PromptProvider} implementations
27
+ * convert this into a {@link NormalizedPrompt} via an {@link SDKAdapter} before
28
+ * returning it to callers.
29
+ */
30
+ interface ParsedPrompt {
31
+ id: string;
32
+ providerId?: string;
33
+ /**
34
+ * Author-supplied stable alias for this prompt, globally unique across
35
+ * providers. Survives file moves/renames and is registered in the prompt
36
+ * registry so runtime traces can resolve back to this prompt.
37
+ */
38
+ globalId?: string;
39
+ name: string;
40
+ functionParameters: PropDefinition[];
41
+ extractedProps: ExtractedProps;
42
+ metadata?: unknown;
43
+ treePath?: string[];
44
+ }
45
+ /**
46
+ * A single message in a conversation, in a form that is independent of any
47
+ * particular SDK's message shape.
48
+ */
49
+ interface NormalizedMessage {
50
+ /** Role identifier (`'system'`, `'user'`, `'assistant'`, `'tool'`, …). */
51
+ role: string;
52
+ /** Message content. Typically a primitive or template string, but any
53
+ * {@link PropValue} is allowed so non-string content (e.g. structured
54
+ * content arrays) can round-trip through the editor. */
55
+ content: PropValue;
56
+ /** Optional tool calls attached to an assistant message. */
57
+ toolCalls?: NormalizedToolCall[];
58
+ }
59
+ /** A tool invocation emitted by an assistant message. */
60
+ interface NormalizedToolCall {
61
+ /** The name of the tool / function to invoke. */
62
+ toolName: string;
63
+ /** Arguments to the tool, as a JSON string. */
64
+ args: string;
65
+ }
66
+ /**
67
+ * A model parameter (`temperature`, `maxTokens`, …) attached to a prompt.
68
+ * Mirrors the `PropDefinition` + current value pair that the playground UI
69
+ * needs for rendering a parameter editor.
70
+ */
71
+ interface NormalizedParameter {
72
+ /** Describes the parameter's name, type, and documentation. */
73
+ def: PropDefinition;
74
+ /** The parameter's current value, or `undefined` if not set on the prompt. */
75
+ value?: PropValue;
76
+ /** Whether the current value can be edited from the UI. */
77
+ editable: boolean;
78
+ }
79
+ /**
80
+ * Prompt representation used by {@link PromptProvider} public methods and by
81
+ * the playground UI. It hides SDK-specific property names behind a stable
82
+ * shape — `model`, `system`, `messages`, and the rest as `parameters`.
83
+ *
84
+ * {@link SDKAdapter.normalizePrompt} converts a {@link ParsedPrompt} produced
85
+ * by a {@link PromptFileType} into this form.
86
+ */
87
+ interface NormalizedPrompt {
88
+ id: string;
89
+ providerId?: string;
90
+ /**
91
+ * Author-supplied stable alias for this prompt, globally unique across
92
+ * providers. Survives file moves/renames and is registered in the prompt
93
+ * registry so runtime traces can resolve back to this prompt.
94
+ */
95
+ globalId?: string;
96
+ name: string;
97
+ functionParameters: PropDefinition[];
98
+ metadata?: unknown;
99
+ /**
100
+ * Controls where this prompt appears in the sidebar tree.
101
+ *
102
+ * Each element is a path segment. The last segment is treated as the leaf
103
+ * group label (analogous to a file name) and all preceding segments are
104
+ * rendered as collapsible directory nodes.
105
+ *
106
+ * Prompts that share the same `treePath` are grouped under the same leaf
107
+ * node. When omitted, the prompt is placed at the root level.
108
+ *
109
+ * @example ['src', 'prompts', 'greeting.prompt.ts']
110
+ */
111
+ treePath?: string[];
112
+ /** The model reference (e.g. a provider call or gateway string). */
113
+ model?: PropValue;
114
+ /** Whether {@link model} can be edited in the UI. */
115
+ modelEditable: boolean;
116
+ /** Top-level system prompt, if the SDK supports one. */
117
+ system?: PropValue;
118
+ /** Whether {@link system} can be edited in the UI. */
119
+ systemEditable: boolean;
120
+ /** Conversation messages. */
121
+ messages: NormalizedMessage[];
122
+ /** Whether {@link messages} can be edited in the UI. */
123
+ messagesEditable: boolean;
124
+ /**
125
+ * Model parameters currently set on the prompt (everything other than
126
+ * `model`, `system`, and `messages`).
127
+ */
128
+ modelParameters: NormalizedParameter[];
129
+ }
130
+ /**
131
+ * Updates that can be applied to a {@link NormalizedPrompt} via
132
+ * {@link PromptProvider.updatePromptProperties}. A value of `null` removes
133
+ * that field from the underlying source.
134
+ */
135
+ interface NormalizedPromptUpdates {
136
+ model?: ModelPropValue | null;
137
+ system?: PropValue | null;
138
+ messages?: NormalizedMessage[] | null;
139
+ /** Per-parameter updates, keyed by parameter name. `null` removes. */
140
+ modelParameters?: Record<string, PropValue | null>;
141
+ }
142
+ /** The kind of change that occurred to a prompt. */
143
+ type ChangeEventType = "change" | "add" | "remove";
144
+ /**
145
+ * Describes a single change emitted by {@link PromptProvider.watch}.
146
+ */
147
+ interface PromptChangeEvent {
148
+ /** Whether the prompt was added, modified, or removed. */
149
+ type: ChangeEventType;
150
+ /** The ID of the affected prompt ({@link ParsedPrompt.id}) */
151
+ promptId: string;
152
+ }
153
+ /** Describes a single form field rendered by the Add Prompt dialog. */
154
+ interface AddPromptField {
155
+ /** Key used to identify this field's value (e.g. `'name'`). */
156
+ name: string;
157
+ /** Human-readable label shown next to the input. */
158
+ label: string;
159
+ /** The kind of input control to render. */
160
+ type: "text" | "select";
161
+ /** Whether the field must be filled before submission. */
162
+ required?: boolean;
163
+ /** Pre-filled value. */
164
+ defaultValue?: string;
165
+ /** Placeholder text shown when the field is empty. */
166
+ placeholder?: string;
167
+ /** Available choices when `type` is `'select'`. */
168
+ options?: {
169
+ label: string;
170
+ value: string;
171
+ }[];
172
+ }
173
+ /**
174
+ * Returned by {@link PromptProvider.addPrompt} when additional user input is
175
+ * needed before the prompt can be created.
176
+ */
177
+ interface AddPromptContext {
178
+ /** The form fields the provider needs the user to fill in. */
179
+ fields: AddPromptField[];
180
+ }
181
+ /** Information about a registered provider, returned by `GET /api/providers`. */
182
+ interface PromptProviderInfo {
183
+ id: string;
184
+ displayName?: string;
185
+ description?: string;
186
+ icon?: string;
187
+ hasAddPrompt: boolean;
188
+ }
189
+ interface ExecuteRequest {
190
+ stream?: boolean;
191
+ functionParams?: any[];
192
+ }
193
+ /**
194
+ * Response body of `POST /api/prompts/:providerId/:id/execute`.
195
+ *
196
+ * The endpoint returns immediately after the trace has been registered; the
197
+ * real output is streamed as span events via
198
+ * `GET /api/traces/:tracerProviderId/:traceId/events`.
199
+ */
200
+ interface ExecuteResponse {
201
+ /** ID of the trace that tracks this execution. */
202
+ traceId: string;
203
+ /** ID of the trace provider that owns the trace. */
204
+ tracerProviderId: string;
205
+ /** Span ID of the root span for this execution. */
206
+ rootSpanId: string;
207
+ }
208
+ /**
209
+ * Classification of a {@link Span}. See also:
210
+ * - `lmnr.span.type` from https://laminar.sh/docs/tracing/otel
211
+ * - `mlflow.spanType` from https://mlflow.org/docs/latest/genai/tracing/opentelemetry/attribute-mapping/#translated-span-attributes
212
+ *
213
+ * Mapped from `gen_ai.operation.name`.
214
+ */
215
+ type SpanKind = "LLM" | "TOOL" | "AGENT" | "EMBEDDING" | "DEFAULT";
216
+ /** A single message within an LLM span's input/output. */
217
+ interface SpanMessage {
218
+ role: string;
219
+ content: string;
220
+ }
221
+ /** LLM-specific attributes attached to `LLM` spans. */
222
+ interface LLMSpanDetails {
223
+ provider?: string;
224
+ model?: string;
225
+ messages?: SpanMessage[];
226
+ output?: string;
227
+ promptTokens?: number;
228
+ completionTokens?: number;
229
+ totalTokens?: number;
230
+ /** Dollar cost of the call, if known. */
231
+ cost?: number;
232
+ /** Model parameters (temperature, max_tokens, …). */
233
+ parameters?: Record<string, unknown>;
234
+ }
235
+ /**
236
+ * A span in a {@link Trace}. Spans form a tree via {@link parentId}.
237
+ * Durations are derived from `startTime` and `endTime`; an in-progress span has
238
+ * no `endTime` yet.
239
+ */
240
+ interface Span {
241
+ id: string;
242
+ traceId: string;
243
+ /** `undefined` for the root span of the trace. */
244
+ parentId?: string;
245
+ name: string;
246
+ kind: SpanKind;
247
+ /** Start timestamp in milliseconds since epoch. */
248
+ startTime: number;
249
+ /** End timestamp in milliseconds since epoch, or `undefined` while running. */
250
+ endTime?: number;
251
+ status?: "ok" | "error";
252
+ /** Error message if `status` is `'error'`. */
253
+ errorMessage?: string;
254
+ /** Free-form attributes to show in the span's details pane. */
255
+ attributes?: Record<string, unknown>;
256
+ /** LLM-specific details (present for `chat`/`completion`/`embedding` spans). */
257
+ llm?: LLMSpanDetails;
258
+ /**
259
+ * The prompt this span is attributed to, if any.
260
+ *
261
+ * Stored as emitted (`evalution.prompt.id` plus optional
262
+ * `evalution.prompt.provider.id`): a {@link PromptID} whose `id` is global
263
+ * unless `providerId` is set. The server resolves it against the prompt
264
+ * registry to a provider-scoped reference when a trace is served.
265
+ */
266
+ prompt?: PromptID;
267
+ }
268
+ /**
269
+ * Top-level trace for a single invocation (e.g. one prompt execution).
270
+ */
271
+ interface Trace {
272
+ id: string;
273
+ providerId?: string;
274
+ name: string;
275
+ /** Start timestamp (ms). */
276
+ startTime: number;
277
+ /** End timestamp (ms), or `undefined` while the trace is still running. */
278
+ endTime?: number;
279
+ status: "running" | "ok" | "error";
280
+ /** Free-form attributes (e.g. prompt ID, function params). */
281
+ attributes?: Record<string, unknown>;
282
+ }
283
+ /** Compact trace entry for listings (sidebar / `GET /api/traces`). */
284
+ interface TraceSummary {
285
+ id: string;
286
+ providerId: string;
287
+ name: string;
288
+ startTime: number;
289
+ endTime?: number;
290
+ status: "running" | "ok" | "error";
291
+ /** Number of spans currently associated with the trace. */
292
+ spanCount: number;
293
+ }
294
+ /** A trace together with all of its spans. */
295
+ interface TraceWithSpans {
296
+ trace: Trace;
297
+ spans: Span[];
298
+ }
299
+ /** The kind of change that occurred to a trace. */
300
+ type TraceChangeType = "add" | "update" | "remove";
301
+ /** Describes a single change emitted by `TraceProvider.watch`. */
302
+ interface TraceChangeEvent {
303
+ type: TraceChangeType;
304
+ traceId: string;
305
+ }
306
+ /** Real-time event pushed over the per-trace SSE subscription. */
307
+ type TraceStreamEvent = {
308
+ type: "span-start";
309
+ span: Span;
310
+ } | {
311
+ type: "span-end";
312
+ span: Span;
313
+ } | {
314
+ type: "span-update";
315
+ span: Span;
316
+ } | {
317
+ type: "trace-update";
318
+ trace: Trace;
319
+ } | {
320
+ type: "trace-end";
321
+ trace: Trace;
322
+ };
323
+ /** Information about a registered trace provider, returned by `GET /api/trace-providers`. */
324
+ interface TraceProviderInfo {
325
+ id: string;
326
+ displayName?: string;
327
+ description?: string;
328
+ }
329
+ /**
330
+ * Catalog-only variant of {@link PropValue} where `functionCall.binding` may
331
+ * carry multiple candidate bindings (e.g. a parameter-destructure form *and* a
332
+ * top-level-import form). The {@link PromptFileType} resolves these candidates
333
+ * against the target file's structure at edit time.
334
+ *
335
+ * Plain {@link PropValue} is assignable to `ModelPropValue` (single binding ⊆ array).
336
+ */
337
+ type ModelPropValue = Exclude<PropValue, {
338
+ kind: "functionCall" | "object" | "array" | "tuple";
339
+ }> | (Omit<Extract<PropValue, {
340
+ kind: "functionCall";
341
+ }>, "binding" | "args"> & {
342
+ binding?: CalleeBinding | CalleeBinding[];
343
+ args: ModelPropValue[];
344
+ }) | (Omit<Extract<PropValue, {
345
+ kind: "object";
346
+ }>, "properties"> & {
347
+ properties: Record<string, ModelPropValue>;
348
+ }) | (Omit<Extract<PropValue, {
349
+ kind: "array" | "tuple";
350
+ }>, "elements"> & {
351
+ elements: ModelPropValue[];
352
+ });
353
+ /** A pre-defined model option shown in quick-select UIs. */
354
+ interface ModelInfo {
355
+ /** Model ID (e.g. `'gpt-4o'`). */
356
+ id: string;
357
+ /** Human-readable label shown in the UI (e.g. `'GPT-4o (OpenAI)'`). */
358
+ label: string;
359
+ /** Optional category for grouping related models together in the UI (usually provider name). */
360
+ group?: string;
361
+ /**
362
+ * Values to use when selecting this model in different modes (as defined by {@link ModelCatalog.modelValueTypes}).
363
+ * If a value is undefined for a particular mode, this model is not offered as a quick-select option in that mode.
364
+ */
365
+ values: Record<string, ModelPropValue | undefined>;
366
+ }
367
+ /** Describes a model selection mode exposed by the SDK adapter (e.g. "Provider" or "Gateway"). */
368
+ interface ModelValueType {
369
+ /** Label shown in the UI toggle (e.g. "Provider", "Gateway"). */
370
+ readonly label: string;
371
+ /** Optional tooltip / helper text. */
372
+ readonly description?: string;
373
+ }
374
+ /**
375
+ * Per-group metadata for constructing custom model values in the UI.
376
+ *
377
+ * `customValueTemplates` is a `PropValue` template per mode. Any primitive
378
+ * string value containing `$input` is replaced with the user's custom model
379
+ * ID at runtime.
380
+ */
381
+ interface ModelGroupInfo {
382
+ customValueTemplates?: Record<string, ModelPropValue>;
383
+ }
384
+ /**
385
+ * Model catalog returned by {@link SDKAdapter.getModelCatalog}.
386
+ * Contains the set of known providers and a curated list of models.
387
+ */
388
+ interface ModelCatalog {
389
+ /** List of known models. */
390
+ models: readonly ModelInfo[];
391
+ /**
392
+ * Available model selection modes.
393
+ *
394
+ * When this is an object, the UI renders a toggle so the user can switch between them.
395
+ * The keys of this object are used in {@link ModelInfo.values}, and the values provide
396
+ * metadata for how to render each mode in the UI.
397
+ */
398
+ modelValueTypes?: Record<string, ModelValueType>;
399
+ /** Per-group metadata for constructing custom model PropValues. Keyed by group name. */
400
+ groups?: Record<string, ModelGroupInfo>;
401
+ }
402
+ //#endregion
403
+ //#region src/prompt/prompt-provider.d.ts
404
+ /**
405
+ * A source of prompts that the playground can display and execute.
406
+ *
407
+ * Implement this interface to add a custom prompt source — for example,
408
+ * prompts stored in a database or fetched from a remote API. If you simply
409
+ * need to support a file format other than TypeScript, use {@link FilePromptProvider}
410
+ * with a custom {@link PromptFileType}.
411
+ */
412
+ interface PromptProvider<TPrompt extends NormalizedPrompt = NormalizedPrompt> {
413
+ /** Uniquely identifies this provider when multiple providers are used. */
414
+ readonly id: string;
415
+ /** Human-readable name shown when choosing between providers. */
416
+ readonly displayName?: string;
417
+ /** Short description of what this provider offers. */
418
+ readonly description?: string;
419
+ /** SVG icon markup for this provider. */
420
+ readonly icon?: string;
421
+ /** Returns all prompts currently available from this provider. */
422
+ getAllPrompts(): Promise<TPrompt[]>;
423
+ /**
424
+ * Returns the prompt with the given ID, or `null` if not found.
425
+ * @param id - The prompt's unique identifier.
426
+ */
427
+ getPrompt(id: string): Promise<TPrompt | null>;
428
+ /**
429
+ * Applies normalized updates to a prompt's source and returns the fresh
430
+ * prompt. Setting any field of `updates` to `null` removes the corresponding
431
+ * property from the underlying source.
432
+ *
433
+ * This method is optional; providers that do not support in-place editing
434
+ * may omit it.
435
+ *
436
+ * @param promptId - ID of the prompt to update.
437
+ * @param updates - Updates expressed in the normalized vocabulary.
438
+ */
439
+ updatePromptProperties?(promptId: string, updates: NormalizedPromptUpdates): Promise<TPrompt>;
440
+ /**
441
+ * Executes a prompt and returns either a result object (when `stream` is
442
+ * `false`) or an async text iterable (when `stream` is `true`).
443
+ *
444
+ * @param promptId - ID of the prompt to run.
445
+ * @param params - Positional arguments forwarded to the prompt function.
446
+ * @param stream - When `true`, the return value is an async text iterator.
447
+ */
448
+ execute(promptId: string, params: any[], stream: boolean): Promise<any>;
449
+ /**
450
+ * Returns the model catalog (known providers and popular models) for this
451
+ * provider's underlying SDK.
452
+ *
453
+ * Optional — providers that do not expose model info may omit it.
454
+ */
455
+ getModelCatalog?(): Promise<ModelCatalog>;
456
+ /**
457
+ * Returns the list of editable model parameters exposed by this provider's
458
+ * underlying SDK (e.g. `temperature`, `maxTokens`).
459
+ *
460
+ * Optional — providers that do not expose model parameters may omit it.
461
+ */
462
+ getModelParameters?(): PropDefinition[];
463
+ /**
464
+ * Registers a callback that is invoked whenever a prompt changes.
465
+ * Returns a cleanup function that stops the watcher when called.
466
+ *
467
+ * Optional — providers that cannot detect live changes may omit it.
468
+ *
469
+ * @param callback - Invoked with a {@link PromptChangeEvent} for each change.
470
+ * @returns A no-argument function that unregisters the watcher.
471
+ */
472
+ watch?(callback: (event: PromptChangeEvent) => void): () => void;
473
+ /**
474
+ * Creates a new prompt from the given partial, or returns an
475
+ * {@link AddPromptContext} describing what additional inputs are needed.
476
+ *
477
+ * When `partial` contains enough information the provider creates the
478
+ * prompt and returns the full {@link NormalizedPrompt}. Otherwise it returns
479
+ * an {@link AddPromptContext} whose `fields` describe the form the UI
480
+ * should present to the user.
481
+ *
482
+ * Optional — providers that do not support creating prompts may omit it.
483
+ *
484
+ * @param partial - Partially filled prompt data.
485
+ */
486
+ addPrompt?(partial: Partial<TPrompt>): Promise<TPrompt | AddPromptContext>;
487
+ /**
488
+ * Renames a prompt and returns the updated prompt with its new ID.
489
+ *
490
+ * Optional — providers that do not support renaming may omit it.
491
+ *
492
+ * @param promptId - ID of the prompt to rename.
493
+ * @param newName - The new name for the prompt.
494
+ */
495
+ renamePrompt?(promptId: string, newName: string): Promise<TPrompt>;
496
+ }
497
+ //#endregion
498
+ //#region src/trace/prompt-tracer.d.ts
499
+ /**
500
+ * Attribute name a span can set to pick one of evalution's span-kind values
501
+ * (`'LLM'`, `'TOOL'`, `'AGENT'`, `'EMBEDDING'`, `'DEFAULT'`). Falls back to
502
+ * `'DEFAULT'` when absent or unrecognised.
503
+ */
504
+ declare const SPAN_KIND_ATTRIBUTE = "evalution.span.type";
505
+ /**
506
+ * Attribute name a span can set to scope its {@link PROMPT_ID_ATTRIBUTE} to a
507
+ * specific prompt provider. When absent, the prompt ID is treated as global.
508
+ */
509
+ declare const PROMPT_PROVIDER_ID_ATTRIBUTE = "evalution.prompt.provider.id";
510
+ /**
511
+ * Attribute name a span can set to link itself to a specific prompt. The value
512
+ * is a globally-unique prompt ID unless {@link PROMPT_PROVIDER_ID_ATTRIBUTE} is
513
+ * also set, in which case it is scoped to that provider.
514
+ */
515
+ declare const PROMPT_ID_ATTRIBUTE = "evalution.prompt.id";
516
+ /**
517
+ * Attribute name a span can set to give a human-readable name to the prompt.
518
+ */
519
+ declare const PROMPT_NAME_ATTRIBUTE = "gen_ai.prompt.name";
520
+ /**
521
+ * Wraps a {@link Tracer} so that every span it produces is tagged with the
522
+ * attributes that associate it with a prompt — the prompt's name
523
+ * ({@link PROMPT_NAME_ATTRIBUTE}), an optional global prompt ID
524
+ * ({@link PROMPT_ID_ATTRIBUTE}), and an `'LLM'` span kind
525
+ * ({@link SPAN_KIND_ATTRIBUTE}). Attributes set explicitly on an individual
526
+ * span take precedence over these defaults.
527
+ *
528
+ * This depends only on `@opentelemetry/api`, so it can be re-used by SDK
529
+ * adapter packages (e.g. `@evalution/vercel-ai-sdk`) without pulling in the
530
+ * rest of evalution.
531
+ *
532
+ * @param prompt - The prompt to attribute spans to. `name` is a human-readable
533
+ * name; the optional `id` is a globally-unique prompt ID used to resolve
534
+ * runtime traces back to the prompt.
535
+ * @param tracer - Tracer to wrap. Defaults to a tracer from the globally
536
+ * registered tracer provider.
537
+ * @returns A tracer that forwards to `tracer` while attaching the prompt
538
+ * attributes to each span it creates.
539
+ */
540
+ declare function createTracerForPrompt(prompt: {
541
+ name: string;
542
+ id?: string;
543
+ }, tracer?: Tracer): Tracer;
544
+ //#endregion
545
+ //#region src/trace/trace-provider.d.ts
546
+ /**
547
+ * A read-only store of execution traces that the playground can display and
548
+ * subscribe to in real time. Implement this interface to integrate a tracing
549
+ * backend.
550
+ *
551
+ * Traces and spans are created via the OpenTelemetry API
552
+ * (`@opentelemetry/api`). A `TraceProvider` implementation's job is to expose
553
+ * the traces a backend knows about; populating the store from OTel spans is
554
+ * an implementation detail (e.g. by registering a
555
+ * `@opentelemetry/sdk-trace-base` `SpanProcessor`).
556
+ */
557
+ interface TraceProvider {
558
+ /** Uniquely identifies this provider when multiple providers are used. */
559
+ readonly id: string;
560
+ /** Human-readable name shown when choosing between providers. */
561
+ readonly displayName?: string;
562
+ /** Short description of what this provider offers. */
563
+ readonly description?: string;
564
+ /**
565
+ * Returns compact summaries for every trace known to this provider, newest
566
+ * first. Used to populate the Traces sidebar.
567
+ */
568
+ getAllTraces(): Promise<TraceSummary[]>;
569
+ /**
570
+ * Returns the trace with the given ID together with all of its spans, or
571
+ * `undefined` when the trace is unknown.
572
+ */
573
+ getTrace(traceId: string): Promise<TraceWithSpans | undefined>;
574
+ /**
575
+ * Subscribes to real-time updates for a specific trace. The callback is
576
+ * invoked for every {@link Span} change on this trace, for as long as the
577
+ * returned cleanup function has not been called.
578
+ *
579
+ * @returns A no-argument function that cancels the subscription.
580
+ */
581
+ subscribeTrace(traceId: string, callback: (event: TraceStreamEvent) => void): () => void;
582
+ /**
583
+ * Registers a callback invoked whenever a trace is added, updated, or
584
+ * removed. Used by the sidebar to stay in sync without polling.
585
+ *
586
+ * Optional — providers that cannot detect live changes may omit it.
587
+ *
588
+ * @returns A no-argument function that unregisters the watcher.
589
+ */
590
+ watch?(callback: (event: TraceChangeEvent) => void): () => void;
591
+ /**
592
+ * Returns a `SpanProcessor` (from `@opentelemetry/sdk-trace-base`) that
593
+ * feeds OpenTelemetry spans into this provider's store. The playground
594
+ * registers it on a shared `BasicTracerProvider` so spans produced by the
595
+ * server's tracer land here.
596
+ *
597
+ * Optional — providers backed by an external backend (LangSmith, a
598
+ * collector, …) typically receive spans out-of-band and can omit this.
599
+ */
600
+ getSpanProcessor?(): SpanProcessor;
601
+ }
602
+ //#endregion
603
+ //#region src/config.d.ts
604
+ /**
605
+ * Top-level configuration for an Evalution instance.
606
+ *
607
+ * Place a default export of this type in `.evalution/config.ts` at the root
608
+ * of your project to customise how Evalution discovers and serves prompts
609
+ * and traces.
610
+ *
611
+ * If no config file is found, Evalution will show an onboarding wizard
612
+ * to help you create one.
613
+ *
614
+ * @example
615
+ * ```ts
616
+ * // .evalution/config.ts
617
+ * import type { EvalutionConfig } from 'evalution';
618
+ * import { FilePromptProvider, VercelAISDK } from 'evalution';
619
+ *
620
+ * export default {
621
+ * promptProviders: [
622
+ * new FilePromptProvider({
623
+ * sdk: new VercelAISDK(),
624
+ * }),
625
+ * ],
626
+ * } satisfies EvalutionConfig;
627
+ * ```
628
+ */
629
+ interface EvalutionConfig {
630
+ /**
631
+ * Whether to load a `.env` file from the directory Evalution is launched
632
+ * from before starting the server.
633
+ *
634
+ * @default true
635
+ */
636
+ useDotenv?: boolean;
637
+ /**
638
+ * One or more providers that supply prompts to the playground.
639
+ *
640
+ * If omitted, a {@link FilePromptProvider} rooted at the current working
641
+ * directory is used automatically.
642
+ */
643
+ promptProviders?: PromptProvider[];
644
+ /**
645
+ * One or more providers that supply execution traces to the playground.
646
+ *
647
+ * If omitted, a {@link MemoryTraceProvider} is used automatically so the
648
+ * Traces tab can still be exercised without wiring a real tracing backend.
649
+ */
650
+ traceProviders?: TraceProvider[];
651
+ }
652
+ //#endregion
653
+ //#region src/file-provider.d.ts
654
+ /** Options accepted by {@link FileProvider.glob}. */
655
+ interface GlobOptions {
656
+ /** The directory to search from. Defaults to `process.cwd()`. */
657
+ cwd?: string;
658
+ /** Glob patterns whose matches are excluded from results. */
659
+ ignore?: readonly string[];
660
+ /** When `true`, yielded paths are absolute; otherwise they are relative to `cwd`. */
661
+ absolute?: boolean;
662
+ }
663
+ /** Options accepted by {@link FileProvider.watch}. */
664
+ interface FileWatchOptions {
665
+ /** The directory from which relative file paths are resolved. Defaults to `process.cwd()`. */
666
+ cwd?: string;
667
+ /** Glob patterns whose matches are excluded from the watcher. */
668
+ ignored?: readonly string[];
669
+ /**
670
+ * When `true`, the watcher does not emit events for files that already exist
671
+ * at startup. Defaults to `true`.
672
+ */
673
+ ignoreInitial?: boolean;
674
+ }
675
+ /**
676
+ * Callback invoked by {@link FileProvider.watch} when a watched file changes.
677
+ * @param eventType - The kind of change: `'add'`, `'change'`, or `'remove'`.
678
+ * @param filePath - The affected file path, relative to the watcher's `cwd`.
679
+ */
680
+ type FileWatchCallback = (eventType: ChangeEventType, filePath: string) => void;
681
+ /**
682
+ * Abstraction over file system I/O used throughout Evalution.
683
+ *
684
+ * Swap in a different implementation to adapt Evalution to non-local
685
+ * environments or to make tests fully in-memory (see {@link MemoryFileProvider}).
686
+ * {@link LocalFileProvider} is the default implementation for production use.
687
+ */
688
+ interface FileProvider {
689
+ /**
690
+ * Reads the file at `filePath` and returns its content as a UTF-8 string.
691
+ * Rejects if the file does not exist.
692
+ */
693
+ readFile(filePath: string): Promise<string>;
694
+ /**
695
+ * Writes `content` to `filePath`, creating or overwriting the file.
696
+ * When the path falls inside an active {@link watch} scope, the watcher
697
+ * callback is invoked automatically.
698
+ */
699
+ writeFile(filePath: string, content: string): Promise<void>;
700
+ /**
701
+ * Deletes the file at `filePath`.
702
+ * When the path falls inside an active {@link watch} scope, the watcher
703
+ * callback is invoked automatically with `'remove'`.
704
+ */
705
+ deleteFile(filePath: string): Promise<void>;
706
+ /**
707
+ * Dynamically imports the module at `filePath` and returns its namespace
708
+ * object. Rejects if the file does not exist.
709
+ */
710
+ import(filePath: string): Promise<any>;
711
+ /**
712
+ * Returns an async iterator that yields paths matching `pattern`.
713
+ * @param pattern - A glob pattern (e.g. `'**\/*.prompt.ts'`).
714
+ * @param options - See {@link GlobOptions}.
715
+ */
716
+ glob(pattern: string, options?: GlobOptions): AsyncIterableIterator<string>;
717
+ /**
718
+ * Starts watching for changes to files that match `patterns` and calls
719
+ * `callback` on each relevant event.
720
+ *
721
+ * @param patterns - Glob patterns that select which files to watch.
722
+ * @param options - See {@link FileWatchOptions}.
723
+ * @param callback - Called for each matching file event.
724
+ * @returns A cleanup function; call it to stop watching.
725
+ */
726
+ watch(patterns: readonly string[], options: FileWatchOptions, callback: FileWatchCallback): () => void;
727
+ }
728
+ /**
729
+ * An in-memory {@link FileProvider} backed by a `Map<string, string>`.
730
+ *
731
+ * Intended for unit tests — all file I/O stays in-process with no disk access.
732
+ * Calling {@link writeFile} triggers any active {@link watch} callbacks
733
+ * synchronously, making it easy to test reactive code paths.
734
+ *
735
+ * @example
736
+ * ```ts
737
+ * const provider = new MemoryFileProvider({
738
+ * '/virtual/prompt.ts': 'export function myPrompt() { ... }',
739
+ * });
740
+ * const content = await provider.readFile('/virtual/prompt.ts');
741
+ * ```
742
+ */
743
+ declare class MemoryFileProvider implements FileProvider {
744
+ private files;
745
+ private watchers;
746
+ /**
747
+ * @param files - Initial file contents keyed by absolute path.
748
+ */
749
+ constructor(files?: Record<string, string>);
750
+ readFile(filePath: string): Promise<string>;
751
+ writeFile(filePath: string, content: string): Promise<void>;
752
+ deleteFile(filePath: string): Promise<void>;
753
+ import(filePath: string): Promise<any>;
754
+ glob(pattern: string, options?: GlobOptions): AsyncIterableIterator<string>;
755
+ watch(patterns: readonly string[], options: FileWatchOptions, callback: FileWatchCallback): () => void;
756
+ private notifyWatchers;
757
+ }
758
+ /**
759
+ * A {@link FileProvider} backed by the local file system.
760
+ *
761
+ * Uses `fs/promises` for I/O, `fs/promises.glob` (Node.js ≥ 22) for pattern
762
+ * matching, and [chokidar](https://github.com/paulmillr/chokidar) for file
763
+ * watching.
764
+ *
765
+ * This is the default implementation used by {@link FilePromptProvider} and
766
+ * {@link TSPromptFileType} when no custom provider is supplied.
767
+ */
768
+ declare class LocalFileProvider implements FileProvider {
769
+ readFile(filePath: string): Promise<string>;
770
+ writeFile(filePath: string, content: string): Promise<void>;
771
+ deleteFile(filePath: string): Promise<void>;
772
+ import(filePath: string): Promise<any>;
773
+ glob(pattern: string, options?: GlobOptions): AsyncIterableIterator<string>;
774
+ watch(patterns: readonly string[], options: FileWatchOptions, callback: FileWatchCallback): () => void;
775
+ }
776
+ //#endregion
777
+ //#region src/sdk/sdk-adapter.d.ts
778
+ /**
779
+ * Adapter that provides values and execution for a particular AI SDK.
780
+ *
781
+ * Pass an instance of this to {@link FilePromptProvider} via the
782
+ * `sdk` option.
783
+ */
784
+ interface SDKAdapter {
785
+ /**
786
+ * The package that exports the `prompts()` helper used in new prompt files
787
+ * (e.g. `'@evalution/vercel-ai-sdk'`). Used by {@link PromptFileType.newPromptSkeleton}.
788
+ */
789
+ promptsHelperImport: string;
790
+ /**
791
+ * Returns model catalog information: the set of known providers and a
792
+ * curated list of popular models for this SDK.
793
+ */
794
+ getModelCatalog(): Promise<ModelCatalog>;
795
+ /**
796
+ * Returns the list of model parameters that can be edited in the playground
797
+ * UI for projects rooted at `rootDir`. Typically extracted from the SDK's
798
+ * published TypeScript type definitions.
799
+ *
800
+ * @param rootDir - Absolute path to the project root.
801
+ */
802
+ getModelParameters(rootDir: string): PropDefinition$1[];
803
+ /**
804
+ * Executes a prompt config object and returns either a result object (when
805
+ * `stream` is `false`) or an async text iterable (when `stream` is `true`).
806
+ *
807
+ * @param config - The config object returned by the prompt function.
808
+ * @param stream - When `true`, returns a streaming text iterator.
809
+ */
810
+ executeConfig(config: any, stream: boolean): Promise<any>;
811
+ /**
812
+ * Convert a low-level {@link ParsedPrompt} produced by a
813
+ * {@link PromptFileType} into a {@link NormalizedPrompt} that the UI can
814
+ * consume without knowing the SDK's specific property names or message shape.
815
+ *
816
+ * @param prompt - The raw parsed prompt.
817
+ */
818
+ normalizePrompt(prompt: ParsedPrompt): NormalizedPrompt;
819
+ /**
820
+ * Convert {@link NormalizedPromptUpdates} (what the UI sends back) into the
821
+ * raw property-name-keyed updates that {@link PromptFileType.updateProperty}
822
+ * and friends operate on.
823
+ *
824
+ * @param updates - Updates expressed in the normalized vocabulary.
825
+ * @returns A `Record` keyed by the SDK's actual property names. Values may
826
+ * be `null` (to remove) or a `PropValue`.
827
+ */
828
+ denormalizeUpdates(updates: NormalizedPromptUpdates, currentValues?: Record<string, PropValue$1>): Record<string, ModelPropValue | null>;
829
+ }
830
+ //#endregion
831
+ //#region src/prompt/file/prompt-file-type.d.ts
832
+ /** Metadata attached to prompts that originate from a file on disk. */
833
+ interface FilePromptMetadata {
834
+ /** Path to the source file relative to the {@link FilePromptProviderOptions.rootDir}. */
835
+ relativeFilePath: string;
836
+ }
837
+ /**
838
+ * A {@link ParsedPrompt} produced by the file-based parser, with
839
+ * {@link FilePromptMetadata} guaranteed to be present on `metadata`.
840
+ *
841
+ * This is the low-level form emitted by {@link PromptFileType.parsePrompts};
842
+ * {@link FilePromptProvider} converts it to a {@link NormalizedFilePrompt}
843
+ * before exposing it publicly.
844
+ */
845
+ interface ParsedFilePrompt extends ParsedPrompt {
846
+ metadata: FilePromptMetadata;
847
+ }
848
+ /**
849
+ * A {@link NormalizedPrompt} whose `metadata` field is guaranteed to carry
850
+ * {@link FilePromptMetadata}. This is the public-facing prompt type returned
851
+ * by {@link FilePromptProvider}.
852
+ */
853
+ interface NormalizedFilePrompt extends NormalizedPrompt {
854
+ metadata: FilePromptMetadata;
855
+ }
856
+ /**
857
+ * Strategy object that knows how to parse, edit, and execute a specific
858
+ * prompt file format.
859
+ *
860
+ * The default implementation is {@link TSPromptFileType}, which handles
861
+ * TypeScript `.prompt.ts` files. Provide a custom implementation to support
862
+ * other file formats, then pass it to {@link FilePromptProvider} via its
863
+ * `fileType` option.
864
+ */
865
+ interface PromptFileType {
866
+ /**
867
+ * Glob patterns used by {@link FilePromptProvider} when no explicit
868
+ * `includePatterns` option is provided.
869
+ */
870
+ defaultIncludePatterns: readonly string[];
871
+ /**
872
+ * File extension appended to a new prompt's filename when the user does not
873
+ * supply one (e.g. `'.prompt.ts'`). Includes the leading dot.
874
+ */
875
+ defaultFileExtension: string;
876
+ /**
877
+ * Generates the starter source code for a new prompt file.
878
+ * @param promptsId - The module ID passed to the `prompts()` helper (typically derived from the file name).
879
+ * @param name - The initial prompt function name.
880
+ * @param importPath - The package path to import the `prompts()` helper from.
881
+ */
882
+ newPromptSkeleton(promptsId: string, name: string, importPath: string): string;
883
+ /**
884
+ * Parses the given files and returns all discovered prompts.
885
+ * Reads fresh file content at the time of the call.
886
+ * @param files - Absolute paths of the files to parse.
887
+ * @param rootDir - The project root; used to compute relative prompt IDs.
888
+ */
889
+ parsePrompts(files: string[], rootDir: string): Promise<ParsedFilePrompt[]>;
890
+ /**
891
+ * Updates the value of an existing property in a prompt source file.
892
+ * @param filePath - Absolute path to the file to edit.
893
+ * @param propDef - The property definition to update (must carry source-position metadata).
894
+ * @param value - The new value to write.
895
+ * @param promptId - The prompt ID, used to re-parse for fresh spans.
896
+ */
897
+ updateProperty(filePath: string, propDef: PropDefinition$1, value: ModelPropValue, promptId?: string): Promise<void>;
898
+ /**
899
+ * Removes a property from a prompt source file entirely.
900
+ * @param filePath - Absolute path to the file to edit.
901
+ * @param propDef - The property definition to remove.
902
+ */
903
+ removeProperty(filePath: string, propDef: PropDefinition$1): Promise<void>;
904
+ /**
905
+ * Adds a new property to a prompt in a source file.
906
+ * @param filePath - Absolute path to the file to edit.
907
+ * @param promptName - Name of the exported function to add the property to.
908
+ * @param propertyName - The key to add.
909
+ * @param value - The value to assign.
910
+ */
911
+ addProperty(filePath: string, promptName: string, propertyName: string, value: ModelPropValue): Promise<void>;
912
+ /**
913
+ * Renames an exported prompt in a source file.
914
+ * @param filePath - Absolute path to the file to edit.
915
+ * @param oldName - Current prompt name.
916
+ * @param newName - New prompt name.
917
+ */
918
+ renamePrompt(filePath: string, oldName: string, newName: string): Promise<void>;
919
+ /**
920
+ * Dynamically imports `filePath`, calls the exported function named
921
+ * `promptName` with `params`, and returns the resulting config object.
922
+ *
923
+ * @param filePath - Absolute path to the prompt file.
924
+ * @param promptName - Name of the exported function to invoke.
925
+ * @param params - Positional arguments forwarded to the function.
926
+ */
927
+ loadConfig(filePath: string, promptName: string, params: any[]): Promise<any>;
928
+ }
929
+ //#endregion
930
+ //#region src/prompt/file/file-prompt-provider.d.ts
931
+ /**
932
+ * Configuration options for the {@link FilePromptProvider}.
933
+ */
934
+ interface FilePromptProviderOptions {
935
+ /**
936
+ * Uniquely identifies this provider instance when multiple providers are used together. Defaults to 'fs' + an incrementing number.
937
+ */
938
+ id?: string;
939
+ /**
940
+ * The root directory to scan recursively for prompt files. Defaults to the current working directory.
941
+ */
942
+ rootDir?: string;
943
+ /**
944
+ * Glob patterns to include when scanning for prompt files. Defaults to {@link PromptFileType.defaultIncludePatterns}.
945
+ */
946
+ includePatterns?: readonly string[];
947
+ /**
948
+ * Glob patterns to exclude when scanning for prompt files. Defaults to ['\*\*\/node_modules/\*\*', '\*\*\/dist/\*\*', '\*\*\/.git/**'].
949
+ */
950
+ ignorePatterns?: readonly string[];
951
+ /**
952
+ * Optional custom file provider that abstracts file system access, useful for testing or non-local environments. Defaults to an instance of {@link LocalFileProvider}.
953
+ */
954
+ fileProvider?: FileProvider;
955
+ /**
956
+ * Optional custom file type handler that defines how to parse prompt files and manipulate properties. Defaults to an instance of {@link TSPromptFileType}.
957
+ */
958
+ fileType?: PromptFileType;
959
+ /**
960
+ * SDK adapter that governs prompt structure and execution.
961
+ */
962
+ sdk: SDKAdapter;
963
+ }
964
+ /**
965
+ * A {@link PromptProvider} that discovers and serves prompts from
966
+ * files on the local file system (or any {@link FileProvider}).
967
+ *
968
+ * Out of the box it scans for `**\/*.prompt.ts` files and parses them with
969
+ * {@link TSPromptFileType}. Pass a {@link FilePromptProviderOptions} to the
970
+ * constructor to customize this behavior. You must specify at least
971
+ * {@link FilePromptProviderOptions.sdk}.
972
+ *
973
+ * @example
974
+ * ```ts
975
+ * const provider = new FilePromptProvider({ rootDir: '/my/project', sdk: new VercelAISDK() });
976
+ * const prompts = await provider.getAllPrompts();
977
+ * ```
978
+ */
979
+ declare class FilePromptProvider implements PromptProvider<NormalizedFilePrompt> {
980
+ readonly id: string;
981
+ readonly displayName = "File System";
982
+ readonly description = "Create a .prompt.ts file";
983
+ readonly icon = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\"><path d=\"M1.5 3A1.5 1.5 0 000 4.5v8A1.5 1.5 0 001.5 14h13a1.5 1.5 0 001.5-1.5v-7A1.5 1.5 0 0014.5 4H8L6.5 2.5h-5z\"/></svg>";
984
+ private files;
985
+ private rootDir;
986
+ private fileType;
987
+ private fileProvider;
988
+ private includePatterns;
989
+ private ignorePatterns;
990
+ private sdkAdapter;
991
+ private suppressedWatchEvents;
992
+ constructor({
993
+ id,
994
+ rootDir,
995
+ fileProvider,
996
+ fileType,
997
+ includePatterns,
998
+ ignorePatterns,
999
+ sdk
1000
+ }: FilePromptProviderOptions);
1001
+ getAllPrompts(): Promise<NormalizedFilePrompt[]>;
1002
+ getPrompt(id: string): Promise<NormalizedFilePrompt | null>;
1003
+ updatePromptProperties(promptId: string, updates: NormalizedPromptUpdates): Promise<NormalizedFilePrompt>;
1004
+ private getParsedPrompt;
1005
+ private normalizeFilePrompt;
1006
+ getModelCatalog(): Promise<ModelCatalog>;
1007
+ getModelParameters(): PropDefinition[];
1008
+ execute(promptId: string, params: any[], stream: boolean): Promise<any>;
1009
+ renamePrompt(promptId: string, newName: string): Promise<NormalizedFilePrompt>;
1010
+ addPrompt(partial: Partial<NormalizedFilePrompt>): Promise<NormalizedFilePrompt | AddPromptContext>;
1011
+ watch(callback: (event: PromptChangeEvent) => void): () => void;
1012
+ private ensureFiles;
1013
+ private suppressNextWatchEvent;
1014
+ private consumeSuppressedWatchEvent;
1015
+ private findPromptFiles;
1016
+ private parsePromptId;
1017
+ private listDirectories;
1018
+ private resolveFilePath;
1019
+ }
1020
+ //#endregion
1021
+ //#region src/prompt/file/ts/ts-prompt-file-type.d.ts
1022
+ declare class TSPromptFileType implements PromptFileType {
1023
+ defaultIncludePatterns: string[];
1024
+ defaultFileExtension: string;
1025
+ newPromptSkeleton(promptsId: string, name: string, importPath: string): string;
1026
+ private fileProvider;
1027
+ constructor(fileProvider?: FileProvider);
1028
+ parsePrompts(files: string[], rootDir?: string): Promise<ParsedFilePrompt[]>;
1029
+ updateProperty(filePath: string, propDef: PropDefinition$1, value: ModelPropValue, promptId?: string): Promise<void>;
1030
+ removeProperty(filePath: string, propDef: PropDefinition$1): Promise<void>;
1031
+ addProperty(filePath: string, promptName: string, propertyName: string, value: ModelPropValue): Promise<void>;
1032
+ renamePrompt(filePath: string, oldName: string, newName: string): Promise<void>;
1033
+ loadConfig(filePath: string, promptName: string, params: any[]): Promise<any>;
1034
+ private parseFileContent;
1035
+ private parseHelperProperty;
1036
+ private parseFunctionDeclaration;
1037
+ private findFreshDefinition;
1038
+ private findReturnObjectInFunction;
1039
+ private findReturnObjectInSource;
1040
+ }
1041
+ //#endregion
1042
+ //#region src/sdk/gemini-interactions-sdk.d.ts
1043
+ type BaseCreateInteractionParams = Parameters<typeof GoogleGenAI.prototype.interactions.create>[0];
1044
+ /**
1045
+ * {@link SDKAdapter} implementation for the Google GenAI
1046
+ * [Interactions API](https://ai.google.dev/gemini-api/docs/interactions)
1047
+ * (`@google/genai` package). Currently experimental and untested.
1048
+ */
1049
+ declare class GeminiInteractionsSDK implements SDKAdapter {
1050
+ readonly promptsHelperImport = "FIXME";
1051
+ getModelCatalog(): Promise<{
1052
+ readonly modelValueTypes: {
1053
+ readonly model: {
1054
+ readonly label: "Models";
1055
+ readonly description: "Models";
1056
+ };
1057
+ readonly agent: {
1058
+ readonly label: "Agents";
1059
+ readonly description: "Agents";
1060
+ };
1061
+ };
1062
+ readonly groups: {
1063
+ readonly Google: {
1064
+ readonly customValueTemplates: {
1065
+ readonly model: {
1066
+ readonly kind: "object";
1067
+ readonly properties: {
1068
+ readonly key: {
1069
+ readonly kind: "primitive";
1070
+ readonly value: "model";
1071
+ };
1072
+ readonly value: {
1073
+ readonly kind: "primitive";
1074
+ readonly value: "$input";
1075
+ };
1076
+ };
1077
+ };
1078
+ readonly agent: {
1079
+ readonly kind: "object";
1080
+ readonly properties: {
1081
+ readonly key: {
1082
+ readonly kind: "primitive";
1083
+ readonly value: "agent";
1084
+ };
1085
+ readonly value: {
1086
+ readonly kind: "primitive";
1087
+ readonly value: "$input";
1088
+ };
1089
+ };
1090
+ };
1091
+ };
1092
+ };
1093
+ };
1094
+ readonly models: readonly [{
1095
+ readonly id: "gemini-3.1-pro-preview";
1096
+ readonly label: "Gemini 3.1 Pro Preview";
1097
+ readonly values: {
1098
+ readonly model: {
1099
+ readonly kind: "object";
1100
+ readonly properties: {
1101
+ readonly key: {
1102
+ readonly kind: "primitive";
1103
+ readonly value: "model";
1104
+ };
1105
+ readonly value: {
1106
+ readonly kind: "primitive";
1107
+ readonly value: "gemini-3.1-pro-preview";
1108
+ };
1109
+ };
1110
+ readonly displayValue: "gemini-3.1-pro-preview";
1111
+ };
1112
+ };
1113
+ readonly group: "Google";
1114
+ }, {
1115
+ readonly id: "gemini-3-flash-preview";
1116
+ readonly label: "Gemini 3 Flash Preview";
1117
+ readonly values: {
1118
+ readonly model: {
1119
+ readonly kind: "object";
1120
+ readonly properties: {
1121
+ readonly key: {
1122
+ readonly kind: "primitive";
1123
+ readonly value: "model";
1124
+ };
1125
+ readonly value: {
1126
+ readonly kind: "primitive";
1127
+ readonly value: "gemini-3-flash-preview";
1128
+ };
1129
+ };
1130
+ readonly displayValue: "gemini-3-flash-preview";
1131
+ };
1132
+ };
1133
+ readonly group: "Google";
1134
+ }, {
1135
+ readonly id: "gemini-3.1-flash-lite-preview";
1136
+ readonly label: "Gemini 3.1 Flash-Lite Preview";
1137
+ readonly values: {
1138
+ readonly model: {
1139
+ readonly kind: "object";
1140
+ readonly properties: {
1141
+ readonly key: {
1142
+ readonly kind: "primitive";
1143
+ readonly value: "model";
1144
+ };
1145
+ readonly value: {
1146
+ readonly kind: "primitive";
1147
+ readonly value: "gemini-3.1-flash-lite-preview";
1148
+ };
1149
+ };
1150
+ readonly displayValue: "gemini-3.1-flash-lite-preview";
1151
+ };
1152
+ };
1153
+ readonly group: "Google";
1154
+ }, {
1155
+ readonly id: "gemini-2.5-pro";
1156
+ readonly label: "Gemini 2.5 Pro";
1157
+ readonly values: {
1158
+ readonly model: {
1159
+ readonly kind: "object";
1160
+ readonly properties: {
1161
+ readonly key: {
1162
+ readonly kind: "primitive";
1163
+ readonly value: "model";
1164
+ };
1165
+ readonly value: {
1166
+ readonly kind: "primitive";
1167
+ readonly value: "gemini-2.5-pro";
1168
+ };
1169
+ };
1170
+ readonly displayValue: "gemini-2.5-pro";
1171
+ };
1172
+ };
1173
+ readonly group: "Google";
1174
+ }, {
1175
+ readonly id: "gemini-2.5-flash";
1176
+ readonly label: "Gemini 2.5 Flash";
1177
+ readonly values: {
1178
+ readonly model: {
1179
+ readonly kind: "object";
1180
+ readonly properties: {
1181
+ readonly key: {
1182
+ readonly kind: "primitive";
1183
+ readonly value: "model";
1184
+ };
1185
+ readonly value: {
1186
+ readonly kind: "primitive";
1187
+ readonly value: "gemini-2.5-flash";
1188
+ };
1189
+ };
1190
+ readonly displayValue: "gemini-2.5-flash";
1191
+ };
1192
+ };
1193
+ readonly group: "Google";
1194
+ }, {
1195
+ readonly id: "gemini-2.5-flash-lite";
1196
+ readonly label: "Gemini 2.5 Flash-lite";
1197
+ readonly values: {
1198
+ readonly model: {
1199
+ readonly kind: "object";
1200
+ readonly properties: {
1201
+ readonly key: {
1202
+ readonly kind: "primitive";
1203
+ readonly value: "model";
1204
+ };
1205
+ readonly value: {
1206
+ readonly kind: "primitive";
1207
+ readonly value: "gemini-2.5-flash-lite";
1208
+ };
1209
+ };
1210
+ readonly displayValue: "gemini-2.5-flash-lite";
1211
+ };
1212
+ };
1213
+ readonly group: "Google";
1214
+ }, {
1215
+ readonly id: "deep-research-pro-preview-12-2025";
1216
+ readonly label: "Deep Research Preview";
1217
+ readonly values: {
1218
+ readonly agent: {
1219
+ readonly kind: "object";
1220
+ readonly properties: {
1221
+ readonly key: {
1222
+ readonly kind: "primitive";
1223
+ readonly value: "agent";
1224
+ };
1225
+ readonly value: {
1226
+ readonly kind: "primitive";
1227
+ readonly value: "deep-research-pro-preview-12-2025";
1228
+ };
1229
+ };
1230
+ readonly displayValue: "deep-research-pro-preview-12-2025";
1231
+ };
1232
+ };
1233
+ readonly group: "Google";
1234
+ }];
1235
+ }>;
1236
+ getModelParameters(rootDir: string): PropDefinition$1[];
1237
+ executeConfig(config: BaseCreateInteractionParams, stream: boolean): Promise<any>;
1238
+ normalizePrompt(prompt: ParsedPrompt): NormalizedPrompt;
1239
+ denormalizeUpdates(updates: NormalizedPromptUpdates, currentValues?: Record<string, PropValue$1>): Record<string, ModelPropValue | null>;
1240
+ }
1241
+ //#endregion
1242
+ //#region src/shared/setup-task.d.ts
1243
+ /** Fields shared by every {@link SetupStep} kind. */
1244
+ interface SetupStepBase {
1245
+ /** Stable identifier, unique within the owning {@link SetupTask}. */
1246
+ id: string;
1247
+ /**
1248
+ * Runtime completion status, populated by the server when listing tasks
1249
+ * (e.g. the config file already exists, or the package is installed). Absent
1250
+ * in the static step definitions held by the registry.
1251
+ */
1252
+ completed?: boolean;
1253
+ }
1254
+ /** Writes evalution's starter config file. */
1255
+ interface SetupCreateConfigStep extends SetupStepBase {
1256
+ /** Discriminant: this step creates the project config file. */
1257
+ kind: "create_config";
1258
+ /** Project-relative path the file will be written to. */
1259
+ path: string;
1260
+ /**
1261
+ * Full contents of the file. Shown to the user as a copyable snippet and
1262
+ * written verbatim by the server. This is display data: the server reads it
1263
+ * from its own registry, never from a client request.
1264
+ */
1265
+ contents: string;
1266
+ }
1267
+ /**
1268
+ * Runs a shell command in the project root, streamed to an interactive
1269
+ * terminal so the user can watch it and respond to prompts.
1270
+ */
1271
+ interface SetupRunCommandStep extends SetupStepBase {
1272
+ /** Discriminant: this step runs a shell command. */
1273
+ kind: "run_command";
1274
+ /** The command line to run, e.g. `npm run build`. */
1275
+ command: string;
1276
+ /** Optional human-friendly label shown alongside the command. */
1277
+ label?: string;
1278
+ }
1279
+ /**
1280
+ * Installs an npm package — a specialization of {@link SetupRunCommandStep}
1281
+ * that runs `npm i <package>`. The server reports it as already
1282
+ * {@link SetupStepBase.completed | completed} when the package is present in
1283
+ * the project, so the user can skip it.
1284
+ */
1285
+ interface SetupInstallPackageStep extends SetupStepBase {
1286
+ /** Discriminant: this step installs an npm package. */
1287
+ kind: "install_package";
1288
+ /** The npm package to install, e.g. `@evalution/vercel-ai-sdk`. */
1289
+ package: string;
1290
+ }
1291
+ /**
1292
+ * A single executable step within a {@link SetupTask}.
1293
+ *
1294
+ * Steps are defined server-side and addressed by {@link SetupTask.id} plus the
1295
+ * step's `id`; the client references a step only by those ids when asking the
1296
+ * server to run it.
1297
+ */
1298
+ type SetupStep = SetupCreateConfigStep | SetupRunCommandStep | SetupInstallPackageStep;
1299
+ /**
1300
+ * The shell command a run-style step executes. `install_package` steps map to
1301
+ * `npm i <package>`; `run_command` steps carry their command verbatim.
1302
+ */
1303
+ declare function setupStepCommand(step: SetupRunCommandStep | SetupInstallPackageStep): string;
1304
+ /**
1305
+ * A named onboarding task for a single AI SDK: what to show in the manual-setup
1306
+ * picker, plus the ordered steps that wire the SDK up.
1307
+ */
1308
+ interface SetupTask {
1309
+ /** Stable identifier, also used as the wire id for this SDK choice. */
1310
+ id: string;
1311
+ /** Display label for the picker (typically the SDK's product name). */
1312
+ label: string;
1313
+ /** Icon identifier, mapped to a bundled asset on the client. */
1314
+ icon: string;
1315
+ /** Ordered steps to run, in display order. */
1316
+ steps: SetupStep[];
1317
+ }
1318
+ //#endregion
1319
+ //#region src/sdk/vercel-ai-sdk.d.ts
1320
+ /**
1321
+ * {@link SDKAdapter} implementation for the
1322
+ * [Vercel AI SDK](https://sdk.vercel.ai/).
1323
+ *
1324
+ * - `getModelParameters` reads `CallSettings` from the SDK's `.d.ts` bundle
1325
+ * and surfaces parameters with simple types that can be edited in the UI.
1326
+ * - `executeConfig` delegates to `generateText`.
1327
+ */
1328
+ declare class VercelAISDK implements SDKAdapter {
1329
+ readonly promptsHelperImport: "@evalution/vercel-ai-sdk";
1330
+ /** Onboarding task: install the SDK package, then drop a starter config. */
1331
+ static readonly setupTask: SetupTask;
1332
+ getModelCatalog(): Promise<{
1333
+ modelValueTypes: {
1334
+ function: {
1335
+ label: string;
1336
+ description: string;
1337
+ };
1338
+ string: {
1339
+ label: string;
1340
+ description: string;
1341
+ };
1342
+ };
1343
+ groups: {
1344
+ OpenAI: {
1345
+ customValueTemplates: {
1346
+ function: ModelPropValue;
1347
+ };
1348
+ };
1349
+ Anthropic: {
1350
+ customValueTemplates: {
1351
+ function: ModelPropValue;
1352
+ };
1353
+ };
1354
+ Google: {
1355
+ customValueTemplates: {
1356
+ function: ModelPropValue;
1357
+ };
1358
+ };
1359
+ };
1360
+ models: ModelInfo[];
1361
+ }>;
1362
+ getModelParameters(rootDir: string): PropDefinition$1[];
1363
+ executeConfig(config: any, stream: boolean): Promise<any>;
1364
+ normalizePrompt(prompt: ParsedPrompt): NormalizedPrompt;
1365
+ denormalizeUpdates(updates: NormalizedPromptUpdates, _currentValues?: Record<string, PropValue$1>): Record<string, ModelPropValue | null>;
1366
+ }
1367
+ //#endregion
1368
+ //#region src/trace/base-otel-trace-provider.d.ts
1369
+ /**
1370
+ * Base class for a {@link TraceProvider} populated by OpenTelemetry spans.
1371
+ *
1372
+ * Register the processor returned by {@link getSpanProcessor} on a
1373
+ * `BasicTracerProvider` (from `@opentelemetry/sdk-trace-base`).
1374
+ */
1375
+ declare abstract class BaseOTelTraceProvider implements TraceProvider {
1376
+ readonly id: string;
1377
+ readonly displayName?: string;
1378
+ readonly description?: string;
1379
+ private subscribers;
1380
+ private watchers;
1381
+ private spanPromises;
1382
+ constructor(options: {
1383
+ id: string;
1384
+ displayName: string;
1385
+ description: string;
1386
+ });
1387
+ abstract getAllTraces(): Promise<TraceSummary[]>;
1388
+ abstract hasTrace(traceId: string): Promise<boolean>;
1389
+ protected abstract getTraceWithoutSpans(traceId: string): Promise<Trace | undefined>;
1390
+ protected abstract getTraceSpans(traceId: string): Promise<Span[]>;
1391
+ protected abstract addOrUpdateTrace(trace: Trace): Promise<void>;
1392
+ /**
1393
+ * Stores a span, merging it into any existing span with the same ID (via the
1394
+ * internal `mergeSpans` helper). Returns the resulting stored span so callers can
1395
+ * stream the merged view rather than the partial snapshot they passed in.
1396
+ */
1397
+ protected abstract addOrUpdateSpan(span: Span): Promise<Span>;
1398
+ getTrace(traceId: string): Promise<TraceWithSpans | undefined>;
1399
+ subscribeTrace(traceId: string, callback: (event: TraceStreamEvent) => void): () => void;
1400
+ watch(callback: (event: TraceChangeEvent) => void): () => void;
1401
+ /**
1402
+ * Returns a `SpanProcessor` that funnels every OpenTelemetry span the
1403
+ * caller's tracer produces into this provider's in-memory store.
1404
+ */
1405
+ getSpanProcessor(): SpanProcessor;
1406
+ private handleStart;
1407
+ private handleEnd;
1408
+ private emitStream;
1409
+ private emitChange;
1410
+ drainPendingHandlers(): Promise<void>;
1411
+ }
1412
+ //#endregion
1413
+ //#region src/trace/memory-trace-provider.d.ts
1414
+ /**
1415
+ * In-memory {@link TraceProvider} populated by OpenTelemetry spans.
1416
+ *
1417
+ * Register the processor returned by {@link getSpanProcessor} on a
1418
+ * `BasicTracerProvider` (from `@opentelemetry/sdk-trace-base`).
1419
+ */
1420
+ declare class MemoryTraceProvider extends BaseOTelTraceProvider {
1421
+ private traces;
1422
+ private spansByTrace;
1423
+ constructor({
1424
+ id,
1425
+ displayName,
1426
+ description
1427
+ }?: {
1428
+ id?: string;
1429
+ displayName?: string;
1430
+ description?: string;
1431
+ });
1432
+ getAllTraces(): Promise<TraceSummary[]>;
1433
+ hasTrace(traceId: string): Promise<boolean>;
1434
+ protected getTraceWithoutSpans(traceId: string): Promise<Trace | undefined>;
1435
+ protected getTraceSpans(traceId: string): Promise<Span[]>;
1436
+ protected addOrUpdateTrace(trace: Trace): Promise<void>;
1437
+ protected addOrUpdateSpan(span: Span): Promise<Span>;
1438
+ }
1439
+ //#endregion
1440
+ export { type AddPromptContext, type AddPromptField, type CalleeBinding, type ChangeEventType, type EvalutionConfig, type ExecuteRequest, type ExecuteResponse, type ExtractedProps, type FilePromptMetadata, FilePromptProvider, type FilePromptProviderOptions, type FileProvider, type FileWatchCallback, type FileWatchOptions, GeminiInteractionsSDK, type GlobOptions, type LLMSpanDetails, LocalFileProvider, MemoryFileProvider, MemoryTraceProvider, type ModelCatalog, type ModelGroupInfo, type ModelInfo, type ModelPropValue, type ModelValueType, type NormalizedFilePrompt, type NormalizedMessage, type NormalizedParameter, type NormalizedPrompt, type NormalizedPromptUpdates, type NormalizedToolCall, PROMPT_ID_ATTRIBUTE, PROMPT_NAME_ATTRIBUTE, PROMPT_PROVIDER_ID_ATTRIBUTE, type ParsedFilePrompt, type ParsedPrompt, type PromptChangeEvent, type PromptFileType, type PromptID, type PromptProvider, type PromptProviderInfo, type PropDefinition, type PropValue, type SDKAdapter, SPAN_KIND_ATTRIBUTE, type SetupCreateConfigStep, type SetupInstallPackageStep, type SetupRunCommandStep, type SetupStep, type SetupStepBase, type SetupTask, type SourceSpan, type Span, type SpanKind, type SpanMessage, TSPromptFileType, type Trace, type TraceChangeEvent, type TraceChangeType, type TraceProvider, type TraceProviderInfo, type TraceStreamEvent, type TraceSummary, type TraceWithSpans, VercelAISDK, createTracerForPrompt, setupStepCommand };