evalution 1.0.8 → 2.0.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/LICENSING.md +26 -44
- package/dist/{check-CR4fU1S5.d.ts → check-ci7RhMcB.d.ts} +13 -868
- package/dist/checks/index.d.ts +2 -1
- package/dist/cli/index.js +209 -58
- package/dist/{dataset-types-Dqi5vVg-.d.ts → dataset-types-8cDpOFYi.d.ts} +2 -247
- package/dist/index.d.ts +325 -1303
- package/dist/index.js +127 -475
- package/dist/{trace-DGj5oW7z.d.ts → trace-BlnjMp7o.d.ts} +2 -1
- package/dist/{trace-event-ingestor-BghQcCHe.js → trace-event-ingestor-DwI1hxGX.js} +2143 -8238
- package/dist/views/datasets/index.d.ts +1 -1
- package/dist/views/index.d.ts +3 -2
- package/dist/views/index.js +0 -4
- package/dist/views/react/index.d.ts +1 -1
- package/package.json +18 -15
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import {
|
|
3
|
-
import { PropDefinition as PropDefinition$1, PropValue as PropValue$1
|
|
1
|
+
import { $ as FieldValues, $t as VariationConflict, A as DatasetRowsOverview, At as SpanImagePart, B as AnnotationEvent, Bt as TraceChangeEvent, C as DatasetFieldShape, Cn as EvalSummary, Ct as ResourceInfo, D as DatasetRow, Dn as TraceCheckResult, Dt as SourceSpan, E as DatasetProviderInfo, En as NewEvalRun, Et as RunResources, F as KnownColumnSpec, Ft as SpanTextPart, G as ChangeEventType, Gt as TraceStreamEvent, H as AnnotationKind, Ht as TraceEvalRun, I as AddPromptContext, It as SpanToolCallPart, J as ConflictChoices, Jt as UpdatePromptResponse, K as ChatPromptUpdates, Kt as TraceSummary, L as AddPromptField, Lt as SpanToolResultPart, M as ColumnPath, Mt as SpanMessage, N as DatasetColumnSpec, Nt as SpanMessageRole, O as DatasetRowSource, Ot as Span, P as ForeignColumnSpec, Pt as SpanReasoningPart, Q as ExtractedProps, Qt as ValueFactory, R as Annotation, Rt as ToolSpanDetails, S as DatasetField, Sn as EvalRunSummary, St as RebaseResult, T as DatasetPathChild, Tn as NewEvalDefinition, Tt as ResourceScope, U as AnnotationSource, Ut as TraceLiveEvent, V as AnnotationEventOp, Vt as TraceChangeType, W as CalleeBinding, Wt as TraceProviderInfo, X as ExecuteResponse, Xt as ValueCatalogGroup, Y as ExecuteRequest, Yt as ValueCatalog, Z as ExecutionInput, Zt as ValueCatalogPreset, _ as isStandardSchema, _n as EvalRowResult, _t as PromptStyle, a as check, an as EvalArmSpec, at as NormalizedPrompt, b as DatasetChangeEvent, bn as EvalRunProgress, bt as PropValue, c as ResolvedResourceInputs, cn as EvalCheck, ct as NormalizedQuestionsPrompt, d as ResourceInput, dn as EvalCounts, dt as PendingConflicts, en as VariationId, et as InputLayout, f as ResourceInputs, fn as EvalDefinition, ft as PromptChangeEvent, g as isResource, gn as EvalResults, gt as PromptRef, h as StaticResourceDefinition, hn as EvalProviderInfo, ht as PromptProviderInfo, i as CheckRun, in as EvalArm, it as NormalizedParameter, j as DatasetSummary, jt as SpanKind, k as DatasetRowUpdate, kt as SpanContentPart, l as Resource, ln as EvalCheckOutcome, lt as NormalizedToolCall, m as ResourceOutputDefinition, mn as EvalInputs, mt as PromptInputSources, n as CheckDefinition, nn as VersionId, nt as NormalizedChatPrompt, o as isCheck, on as EvalChangeEvent, ot as NormalizedPromptBase, p as ResourceInstance, pn as EvalDefinitionPatch, pt as PromptID, q as CheckInfo, qt as TraceWithSpans, r as CheckOutcome, rn as VersionInfo, rt as NormalizedMessage, s as DynamicResourceDefinition, sn as EvalChangeType, st as NormalizedPromptUpdates, t as Check, tn as VariationInfo, tt as LLMSpanDetails, u as ResourceDefinition, un as EvalCheckResult, ut as ParsedPrompt, v as resource, vn as EvalRowStatus, vt as PropDefinition, w as DatasetInstanceShape, wn as EvalTraceRun, wt as ResourceInstanceInput, x as DatasetChangeType, xn as EvalRunStatus, xt as QuestionsPromptUpdates, y as Dataset, yn as EvalRun, yt as PropType, z as AnnotationChanges, zt as Trace } from "./check-ci7RhMcB.js";
|
|
2
|
+
import { Tracer } from "@opentelemetry/api";
|
|
3
|
+
import { PropDefinition as PropDefinition$1, PropValue as PropValue$1 } from "ts-proppy";
|
|
4
|
+
import { Annotation as Annotation$1, AnnotationChanges as AnnotationChanges$1, AnnotationEvent as AnnotationEvent$1, AnnotationEventOp as AnnotationEventOp$1, BaseTraceIngestor, BaseTraceIngestor as BaseTraceIngestor$1, CHECK_ATTRIBUTE, DEPLOYMENT_ENVIRONMENT_ATTRIBUTE, Evalution, EvalutionOptions, HttpTraceSink, HttpTraceSinkOptions, HttpTraceTarget, PLAYGROUND_ENVIRONMENT, PLAYGROUND_RESOURCE, PROMPT_ID_ATTRIBUTE, PROMPT_INPUTS_ATTRIBUTE, PROMPT_NAME_ATTRIBUTE, PROMPT_PROVIDER_ID_ATTRIBUTE, PROMPT_VARIATION_ATTRIBUTE, PROMPT_VERSION_ATTRIBUTE, PromptID as PromptID$1, PromptSpanInfo, PromptsFactory, PromptsHelper, PromptsHelperOptions, SERVICE_NAME_ATTRIBUTE, SPAN_KIND_ATTRIBUTE, Span as Span$1, TRACE_EVENTS_PATH, Trace as Trace$1, TraceChangeEvent as TraceChangeEvent$1, TraceEventsRequest, TraceIngestor, TraceIngestor as TraceIngestor$1, TraceSink, TraceSink as TraceSink$1, TraceSinkEvent, TraceSinkEvent as TraceSinkEvent$1, TraceStreamEvent as TraceStreamEvent$1, TraceSummary as TraceSummary$1, TraceWithSpans as TraceWithSpans$1, createTracerForPrompt, getPromptSpanAttributes, isCheckSpan, mergePromptIdentity, spanMessages } from "@evalution/sdk";
|
|
4
5
|
import { Database } from "@tursodatabase/sync";
|
|
5
6
|
import { migrateAsync } from "drizzle-orm/sqlite-core/async/session";
|
|
7
|
+
import { ExecuteConfigOptions, ExecutionHandle, FactoriesProbe, ProbeResult, ProbeResult as ProbeResult$1, ProbeResults, ProbeResults as ProbeResults$1, SDKAdapter, SDKAdapter as SDKAdapter$1, TypeExpressionProbe, TypeProbe, TypeProbe as TypeProbe$1, assertUpdateStyle } from "@evalution/sdk/adapter";
|
|
6
8
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
7
9
|
import { MigrationMeta } from "drizzle-orm/migrator";
|
|
8
|
-
import { Questions, SystemOneRequest, SystemOneResult } from "@typesafe-ai/sdk";
|
|
9
|
-
import { Telemetry } from "ai";
|
|
10
10
|
import { SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
11
11
|
|
|
12
12
|
//#region src/cli/fresh-import-hook.d.ts
|
|
@@ -96,7 +96,7 @@ interface CreateDatasetInput {
|
|
|
96
96
|
/** The schema. Ids are minted by the provider. */
|
|
97
97
|
fields: Omit<DatasetField, "id">[];
|
|
98
98
|
/** The prompt this dataset is created from, if any. */
|
|
99
|
-
prompt?: PromptID;
|
|
99
|
+
prompt?: PromptID$1;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Which rows {@link DatasetProvider.listRows} returns: a window onto the
|
|
@@ -312,417 +312,6 @@ interface EvalProvider {
|
|
|
312
312
|
watch?(callback: (event: EvalChangeEvent) => void): () => void;
|
|
313
313
|
}
|
|
314
314
|
//#endregion
|
|
315
|
-
//#region src/trace/prompt-tracer.d.ts
|
|
316
|
-
interface PromptsHelperOptions {
|
|
317
|
-
/**
|
|
318
|
-
* Globally-unique stable identifier for this group of prompts.
|
|
319
|
-
*/
|
|
320
|
-
readonly id: string;
|
|
321
|
-
}
|
|
322
|
-
type PromptsFactory<Args extends any[] = never[], Prompt = unknown> = (...args: Args) => Record<string, (...args: any[]) => Prompt>;
|
|
323
|
-
/**
|
|
324
|
-
* Intended to be used in the `satisfies` clause of a `prompts` export from an
|
|
325
|
-
* SDK adapter package.
|
|
326
|
-
*/
|
|
327
|
-
type PromptsHelper = (opts: PromptsHelperOptions, factory: PromptsFactory<any[], any>) => PromptsFactory<any[], any>;
|
|
328
|
-
/**
|
|
329
|
-
* Attribute name a span can set to pick one of evalution's span-kind values
|
|
330
|
-
* (`'LLM'`, `'TOOL'`, `'AGENT'`, `'EMBEDDING'`, `'DEFAULT'`). Falls back to
|
|
331
|
-
* `'DEFAULT'` when absent or unrecognised.
|
|
332
|
-
*/
|
|
333
|
-
declare const SPAN_KIND_ATTRIBUTE = "evalution.span.type";
|
|
334
|
-
/**
|
|
335
|
-
* Attribute name a span can set to give a human-readable name to the prompt.
|
|
336
|
-
*/
|
|
337
|
-
declare const PROMPT_NAME_ATTRIBUTE = "gen_ai.prompt.name";
|
|
338
|
-
/**
|
|
339
|
-
* Attribute name a span can set to link itself to a specific prompt. The value
|
|
340
|
-
* is a globally-unique prompt ID unless {@link PROMPT_PROVIDER_ID_ATTRIBUTE} is
|
|
341
|
-
* also set, in which case it is scoped to that provider.
|
|
342
|
-
*/
|
|
343
|
-
declare const PROMPT_ID_ATTRIBUTE = "evalution.prompt.id";
|
|
344
|
-
/**
|
|
345
|
-
* Attribute name a span can set to scope its {@link PROMPT_ID_ATTRIBUTE} to a
|
|
346
|
-
* specific prompt provider. When absent, the prompt ID is treated as global.
|
|
347
|
-
*/
|
|
348
|
-
declare const PROMPT_PROVIDER_ID_ATTRIBUTE = "evalution.prompt.provider.id";
|
|
349
|
-
/**
|
|
350
|
-
* Attribute name a span can set to include an array of input parameters used
|
|
351
|
-
* to construct the final prompt.
|
|
352
|
-
*/
|
|
353
|
-
declare const PROMPT_INPUTS_ATTRIBUTE = "evalution.prompt.inputs";
|
|
354
|
-
/**
|
|
355
|
-
* Attribute name a span can set to record which version of its prompt ran —
|
|
356
|
-
* for a file-based prompt, the commit checked out, when nothing was
|
|
357
|
-
* uncommitted.
|
|
358
|
-
*/
|
|
359
|
-
declare const PROMPT_VERSION_ATTRIBUTE = "evalution.prompt.version";
|
|
360
|
-
/**
|
|
361
|
-
* Attribute name a span can set to record which variation of its prompt ran,
|
|
362
|
-
* on top of its {@link PROMPT_VERSION_ATTRIBUTE}.
|
|
363
|
-
*/
|
|
364
|
-
declare const PROMPT_VARIATION_ATTRIBUTE = "evalution.prompt.variation";
|
|
365
|
-
interface PromptSpanInfo {
|
|
366
|
-
/** Globally-unique prompt id (e.g. `${groupId}#${name}`). */
|
|
367
|
-
id?: string;
|
|
368
|
-
/** Human-readable prompt name. */
|
|
369
|
-
name: string;
|
|
370
|
-
/**
|
|
371
|
-
* Positional arguments the prompt function was called with.
|
|
372
|
-
*
|
|
373
|
-
* Only the `prompts()` helper records these, because it is the only caller
|
|
374
|
-
* that sees the arguments and nothing else. A playground run records
|
|
375
|
-
* {@link functionInputs} instead: its arguments may include a live database
|
|
376
|
-
* handle, which is neither serializable nor the thing a replay needs.
|
|
377
|
-
*/
|
|
378
|
-
functionParameters?: unknown[];
|
|
379
|
-
/**
|
|
380
|
-
* The unresolved inputs this run was launched with — the *recipe* rather
|
|
381
|
-
* than the resolution.
|
|
382
|
-
*
|
|
383
|
-
* This is what makes a past run replayable. A resolved value cannot be
|
|
384
|
-
* recorded faithfully (a live handle does not serialize) and would not be
|
|
385
|
-
* the right thing to record anyway: replaying a resource means running its
|
|
386
|
-
* `create()` again, which is the recipe, not the value it produced last
|
|
387
|
-
* time. Each entry is JSON-safe by construction.
|
|
388
|
-
*/
|
|
389
|
-
functionInputs?: unknown[];
|
|
390
|
-
/** The unresolved execute-parameter inputs, keyed by parameter name. */
|
|
391
|
-
executeInputs?: Record<string, unknown>;
|
|
392
|
-
/**
|
|
393
|
-
* The run's named resource instances, by name, each with the receipt its
|
|
394
|
-
* `create()` produced. See `specs/resource-instances.md` §F.
|
|
395
|
-
*/
|
|
396
|
-
resources?: Record<string, unknown>;
|
|
397
|
-
/**
|
|
398
|
-
* The prompt's parameter definitions as they stood when the run was
|
|
399
|
-
* launched, recorded beside the inputs.
|
|
400
|
-
*
|
|
401
|
-
* For a file-based prompt git is the version, and the playground has no
|
|
402
|
-
* business checking out old commits to replay one — so writing the shape
|
|
403
|
-
* down at run time is the cheap equivalent. A later replay diffs two known
|
|
404
|
-
* signatures instead of guessing whether the recorded inputs still fit.
|
|
405
|
-
*/
|
|
406
|
-
parameterDefinitions?: unknown[];
|
|
407
|
-
/**
|
|
408
|
-
* The prompt's execute-parameter definitions, recorded for the same reason
|
|
409
|
-
* as {@link parameterDefinitions}: without them an entry of
|
|
410
|
-
* {@link executeInputs} has a name but no type.
|
|
411
|
-
*/
|
|
412
|
-
executeParameterDefinitions?: unknown[];
|
|
413
|
-
/** The version the run executed against. See {@link PROMPT_VERSION_ATTRIBUTE}. */
|
|
414
|
-
version?: string;
|
|
415
|
-
/** The variation the run applied. See {@link PROMPT_VARIATION_ATTRIBUTE}. */
|
|
416
|
-
variation?: string;
|
|
417
|
-
}
|
|
418
|
-
/**
|
|
419
|
-
* `identity` with any field it leaves unset filled from `fallback`.
|
|
420
|
-
*
|
|
421
|
-
* A config built by the `prompts()` helper carries an identity of its own —
|
|
422
|
-
* the one to keep, since its id is the global one — but only the playground
|
|
423
|
-
* knows what the run was launched with and against which version.
|
|
424
|
-
*/
|
|
425
|
-
declare function mergePromptIdentity(identity: PromptSpanInfo | undefined, fallback: PromptSpanInfo | undefined): PromptSpanInfo | undefined;
|
|
426
|
-
/**
|
|
427
|
-
* Build the attributes that associate a span with a prompt.
|
|
428
|
-
*
|
|
429
|
-
* @param prompt - The prompt to attribute the span to.
|
|
430
|
-
* @param attributes - Attributes to merge in; these take precedence.
|
|
431
|
-
* @param includeInputs - Whether to stamp the run's inputs. Inputs belong on
|
|
432
|
-
* the **root span only**: they are identical on every span of a trace, so
|
|
433
|
-
* repeating them is invisible when the input is `["Ada"]` and wasteful when
|
|
434
|
-
* it is a fifty-message thread — multiplied by span count, then persisted.
|
|
435
|
-
*/
|
|
436
|
-
declare function getPromptSpanAttributes(prompt: PromptSpanInfo, attributes?: Attributes, includeInputs?: boolean): Record<string, AttributeValue>;
|
|
437
|
-
/**
|
|
438
|
-
* Wraps a {@link Tracer} so that every span it produces is tagged with the
|
|
439
|
-
* attributes that associate it with a prompt — the prompt's name
|
|
440
|
-
* ({@link PROMPT_NAME_ATTRIBUTE}), an optional global prompt ID
|
|
441
|
-
* ({@link PROMPT_ID_ATTRIBUTE}), and an `'LLM'` span kind
|
|
442
|
-
* ({@link SPAN_KIND_ATTRIBUTE}). Attributes set explicitly on an individual
|
|
443
|
-
* span take precedence over these defaults.
|
|
444
|
-
*
|
|
445
|
-
* This depends only on `@opentelemetry/api`, so it can be re-used by SDK
|
|
446
|
-
* adapter packages (e.g. `@evalution/vercel-ai-sdk`) without pulling in the
|
|
447
|
-
* rest of evalution.
|
|
448
|
-
*
|
|
449
|
-
* @param prompt - The prompt to attribute spans to. `name` is a human-readable
|
|
450
|
-
* name; the optional `id` is a globally-unique prompt ID used to resolve
|
|
451
|
-
* runtime traces back to the prompt.
|
|
452
|
-
* @param tracer - Tracer to wrap. Defaults to a tracer from the globally
|
|
453
|
-
* registered tracer provider.
|
|
454
|
-
* @returns A tracer that forwards to `tracer` while attaching the prompt
|
|
455
|
-
* attributes to each span it creates.
|
|
456
|
-
*/
|
|
457
|
-
declare function createTracerForPrompt(prompt: PromptSpanInfo, tracer?: Tracer): Tracer;
|
|
458
|
-
//#endregion
|
|
459
|
-
//#region src/trace/trace-provider.d.ts
|
|
460
|
-
/**
|
|
461
|
-
* A read-only store of execution traces that the playground can display and
|
|
462
|
-
* subscribe to in real time. Implement this interface to integrate a tracing
|
|
463
|
-
* backend.
|
|
464
|
-
*
|
|
465
|
-
* `TraceProvider` is a pure read interface — populating the store is the job
|
|
466
|
-
* of a `TraceIngestor`, which feeds normalized spans into the provider's
|
|
467
|
-
* write side (`TraceSink`, implemented by `BaseTraceProvider`).
|
|
468
|
-
*/
|
|
469
|
-
interface TraceProvider {
|
|
470
|
-
/**
|
|
471
|
-
* Uniquely identifies this instance, even when multiple providers of the
|
|
472
|
-
* same type are used.
|
|
473
|
-
*/
|
|
474
|
-
readonly id: string;
|
|
475
|
-
/** Human-readable name shown when choosing between providers. */
|
|
476
|
-
readonly displayName?: string;
|
|
477
|
-
/** Short description of what this provider offers. */
|
|
478
|
-
readonly description?: string;
|
|
479
|
-
/**
|
|
480
|
-
* Returns compact summaries for every trace known to this provider, newest
|
|
481
|
-
* first. Used to populate the Traces sidebar.
|
|
482
|
-
*/
|
|
483
|
-
getAllTraces(): Promise<TraceSummary[]>;
|
|
484
|
-
/**
|
|
485
|
-
* Returns the trace with the given ID together with all of its spans, or
|
|
486
|
-
* `undefined` when the trace is unknown.
|
|
487
|
-
*/
|
|
488
|
-
getTrace(traceId: string): Promise<TraceWithSpans | undefined>;
|
|
489
|
-
/**
|
|
490
|
-
* Subscribes to real-time updates for a specific trace. The callback is
|
|
491
|
-
* invoked for every {@link Span} change on this trace, for as long as the
|
|
492
|
-
* returned cleanup function has not been called.
|
|
493
|
-
*
|
|
494
|
-
* Optional — providers that cannot track live changes may omit it.
|
|
495
|
-
*
|
|
496
|
-
* @returns A no-argument function that cancels the subscription.
|
|
497
|
-
*/
|
|
498
|
-
subscribeTrace?(traceId: string, callback: (event: TraceStreamEvent) => void): () => void;
|
|
499
|
-
/**
|
|
500
|
-
* Registers a callback invoked whenever a trace is added, updated, or
|
|
501
|
-
* removed. Used by the sidebar to stay in sync without polling.
|
|
502
|
-
*
|
|
503
|
-
* Optional — providers that cannot detect live changes may omit it.
|
|
504
|
-
*
|
|
505
|
-
* @returns A no-argument function that unregisters the watcher.
|
|
506
|
-
*/
|
|
507
|
-
watch?(callback: (event: TraceChangeEvent) => void): () => void;
|
|
508
|
-
/**
|
|
509
|
-
* Permanently deletes a trace along with its spans and annotations, and
|
|
510
|
-
* notifies {@link watch}ers with a `remove` event. Returns `false` if the trace
|
|
511
|
-
* doesn't exist.
|
|
512
|
-
*
|
|
513
|
-
* Optional — a provider backed by a read-only source omits it, and the REST
|
|
514
|
-
* route in `src/server/api-routes.ts` treats its absence as "not
|
|
515
|
-
* supported" (405).
|
|
516
|
-
*/
|
|
517
|
-
deleteTrace?(traceId: string): Promise<boolean>;
|
|
518
|
-
/**
|
|
519
|
-
* Runs one read-only SQL query (a `SELECT`) against this provider's
|
|
520
|
-
* store and returns the rows — the ad-hoc counterpart to
|
|
521
|
-
* {@link getAllTraces}, for questions a summary can't answer. The schema the
|
|
522
|
-
* query is written against is {@link getQuerySchema}'s. Writes are refused.
|
|
523
|
-
*
|
|
524
|
-
* Optional — a provider not backed by SQL omits it, and the REST and MCP
|
|
525
|
-
* handlers report "not supported".
|
|
526
|
-
*/
|
|
527
|
-
query?(sql: string, options?: SqlQueryOptions): Promise<SqlQueryResult>;
|
|
528
|
-
/**
|
|
529
|
-
* Describes the tables {@link query} runs against, as annotated SQL DDL.
|
|
530
|
-
* Present exactly when {@link query} is.
|
|
531
|
-
*/
|
|
532
|
-
getQuerySchema?(): string;
|
|
533
|
-
/** Lists every annotation on a trace, oldest first. */
|
|
534
|
-
listAnnotations?(traceId: string): Promise<Annotation[]>;
|
|
535
|
-
/** Creates a new annotation, minting its `id`/`createdAt`. */
|
|
536
|
-
createAnnotation?(input: Omit<Annotation, "id" | "createdAt">): Promise<Annotation>;
|
|
537
|
-
/**
|
|
538
|
-
* Changes an annotation's `kind` and/or `note`, returning it as updated, or
|
|
539
|
-
* `undefined` if it doesn't exist.
|
|
540
|
-
*/
|
|
541
|
-
updateAnnotation?(id: string, changes: AnnotationChanges): Promise<Annotation | undefined>;
|
|
542
|
-
/** Deletes an annotation by id. A no-op if it doesn't exist. */
|
|
543
|
-
deleteAnnotation?(id: string): Promise<void>;
|
|
544
|
-
/**
|
|
545
|
-
* Subscribes to annotation changes on a specific trace — the counterpart
|
|
546
|
-
* to {@link subscribeTrace} that a client's per-trace SSE connection also
|
|
547
|
-
* opens, so both ride the same stream. Callers (the annotation REST
|
|
548
|
-
* handlers) invoke {@link emitAnnotation} after a successful
|
|
549
|
-
* create/update/delete; this only delivers what's explicitly emitted.
|
|
550
|
-
*
|
|
551
|
-
* @returns A no-argument function that cancels the subscription.
|
|
552
|
-
*/
|
|
553
|
-
subscribeAnnotations?(traceId: string, callback: (event: AnnotationEvent) => void): () => void;
|
|
554
|
-
/**
|
|
555
|
-
* Notifies this trace's {@link subscribeAnnotations} subscribers of an
|
|
556
|
-
* annotation change, and {@link watch}ers with an `update` event, since a
|
|
557
|
-
* trace's summary carries its annotation counts. Called by the annotation
|
|
558
|
-
* REST handlers immediately after
|
|
559
|
-
* {@link createAnnotation}/{@link updateAnnotation}/{@link deleteAnnotation}
|
|
560
|
-
* succeeds — the provider itself never calls this on its own.
|
|
561
|
-
*/
|
|
562
|
-
emitAnnotation?(traceId: string, op: AnnotationEventOp, annotation: Annotation): void;
|
|
563
|
-
}
|
|
564
|
-
//#endregion
|
|
565
|
-
//#region src/trace/trace-sink.d.ts
|
|
566
|
-
/**
|
|
567
|
-
* The write side of a {@link TraceProvider}. A {@link TraceIngestor} feeds
|
|
568
|
-
* normalized spans in; the sink owns root detection, trace creation, and
|
|
569
|
-
* event emission.
|
|
570
|
-
*/
|
|
571
|
-
interface TraceSink {
|
|
572
|
-
/**
|
|
573
|
-
* Records a span start. Creates a `running` trace for a new root. Returns
|
|
574
|
-
* the stored (merged) span. Emits `span-start` (+ watch `add` for a new
|
|
575
|
-
* trace).
|
|
576
|
-
*/
|
|
577
|
-
recordSpanStart(span: Span): Promise<Span>;
|
|
578
|
-
/**
|
|
579
|
-
* Records a span end. For a root span, finalizes the trace and emits
|
|
580
|
-
* `trace-end` (+ watch `update`). Returns the stored (merged) span.
|
|
581
|
-
*/
|
|
582
|
-
recordSpanEnd(span: Span): Promise<Span>;
|
|
583
|
-
/**
|
|
584
|
-
* Finalizes a trace as `error` when execution fails before any span is
|
|
585
|
-
* produced (e.g. a bad model id throws before `onStart`).
|
|
586
|
-
*/
|
|
587
|
-
failTrace(traceId: string, errorMessage: string): Promise<void>;
|
|
588
|
-
/**
|
|
589
|
-
* Optional: resolves once everything recorded so far has been delivered,
|
|
590
|
-
* for a sink that records in the background (e.g. `HttpTraceSink`).
|
|
591
|
-
*/
|
|
592
|
-
flush?(): Promise<void>;
|
|
593
|
-
}
|
|
594
|
-
/**
|
|
595
|
-
* Source-agnostic base class for a {@link TraceProvider}. Owns storage
|
|
596
|
-
* delegation, subscriptions, watchers, and the generic trace lifecycle that
|
|
597
|
-
* every concrete provider shares, regardless of how spans are produced.
|
|
598
|
-
*
|
|
599
|
-
* Subclasses implement the abstract storage hooks; ingestion is handled by
|
|
600
|
-
* one or more {@link TraceIngestor}s that call {@link recordSpanStart} /
|
|
601
|
-
* {@link recordSpanEnd} / {@link failTrace} on this instance (via
|
|
602
|
-
* {@link TraceSink}).
|
|
603
|
-
*/
|
|
604
|
-
declare abstract class BaseTraceProvider implements TraceProvider, TraceSink {
|
|
605
|
-
readonly id: string;
|
|
606
|
-
readonly displayName?: string;
|
|
607
|
-
readonly description?: string;
|
|
608
|
-
protected subscribers: Map<string, Set<(event: TraceStreamEvent) => void>>;
|
|
609
|
-
private watchers;
|
|
610
|
-
private annotationSubscribers;
|
|
611
|
-
constructor(options: {
|
|
612
|
-
id: string;
|
|
613
|
-
displayName: string;
|
|
614
|
-
description: string;
|
|
615
|
-
});
|
|
616
|
-
abstract getAllTraces(): Promise<TraceSummary[]>;
|
|
617
|
-
abstract hasTrace(traceId: string): Promise<boolean>;
|
|
618
|
-
protected abstract getTraceWithoutSpans(traceId: string): Promise<Trace | undefined>;
|
|
619
|
-
protected abstract getTraceSpans(traceId: string): Promise<Span[]>;
|
|
620
|
-
protected abstract addOrUpdateTrace(trace: Trace): Promise<void>;
|
|
621
|
-
/**
|
|
622
|
-
* Removes a trace together with its spans and annotations. Only called for
|
|
623
|
-
* a trace that {@link hasTrace} confirmed exists.
|
|
624
|
-
*/
|
|
625
|
-
protected abstract removeTrace(traceId: string): Promise<void>;
|
|
626
|
-
/**
|
|
627
|
-
* Stores a span, merging it into any existing span with the same ID (via
|
|
628
|
-
* the `mergeSpans` helper). Returns the resulting stored span so callers
|
|
629
|
-
* can stream the merged view rather than the partial snapshot they passed
|
|
630
|
-
* in.
|
|
631
|
-
*/
|
|
632
|
-
protected abstract addOrUpdateSpan(span: Span): Promise<Span>;
|
|
633
|
-
getTrace(traceId: string): Promise<TraceWithSpans | undefined>;
|
|
634
|
-
deleteTrace(traceId: string): Promise<boolean>;
|
|
635
|
-
subscribeTrace(traceId: string, callback: (event: TraceStreamEvent) => void): () => void;
|
|
636
|
-
watch(callback: (event: TraceChangeEvent) => void): () => void;
|
|
637
|
-
/**
|
|
638
|
-
* Generic pub-sub for annotation changes — every subclass gets a working
|
|
639
|
-
* implementation "for free", even one with no annotation store of its own
|
|
640
|
-
* (e.g. `MemoryTraceProvider`): nothing is ever delivered unless a caller
|
|
641
|
-
* (the annotation REST handlers) explicitly calls {@link emitAnnotation}.
|
|
642
|
-
*/
|
|
643
|
-
subscribeAnnotations(traceId: string, callback: (event: AnnotationEvent) => void): () => void;
|
|
644
|
-
emitAnnotation(traceId: string, op: AnnotationEventOp, annotation: Annotation): void;
|
|
645
|
-
recordSpanStart(span: Span): Promise<Span>;
|
|
646
|
-
recordSpanEnd(span: Span): Promise<Span>;
|
|
647
|
-
/**
|
|
648
|
-
* Marks a trace that already ended as running again: its root span has just
|
|
649
|
-
* been started anew (a failed run being retried), so the failure it recorded
|
|
650
|
-
* is no longer its state.
|
|
651
|
-
*/
|
|
652
|
-
private reopenTrace;
|
|
653
|
-
failTrace(traceId: string, errorMessage: string): Promise<void>;
|
|
654
|
-
protected emitStream(traceId: string, event: TraceStreamEvent): void;
|
|
655
|
-
protected emitChange(event: TraceChangeEvent): void;
|
|
656
|
-
}
|
|
657
|
-
//#endregion
|
|
658
|
-
//#region src/trace/trace-ingestor.d.ts
|
|
659
|
-
/**
|
|
660
|
-
* A source of trace data. Translates some upstream signal (OTel spans, native
|
|
661
|
-
* AI SDK telemetry, an external collector) into normalized {@link Span}s and
|
|
662
|
-
* feeds the {@link TraceSink}(s) it is connected to.
|
|
663
|
-
*/
|
|
664
|
-
interface TraceIngestor {
|
|
665
|
-
/**
|
|
666
|
-
* Add a sink. May be called multiple times; the ingestor writes to every
|
|
667
|
-
* added sink.
|
|
668
|
-
*/
|
|
669
|
-
addSink(sink: TraceSink): void;
|
|
670
|
-
/**
|
|
671
|
-
* Remove a previously-added sink. Returns `true` if the given sink was found
|
|
672
|
-
* and removed, otherwise `false`.
|
|
673
|
-
*/
|
|
674
|
-
removeSink(sink: TraceSink): boolean;
|
|
675
|
-
/**
|
|
676
|
-
* Optional: returns true if `other` is made redundant by this ingestor and
|
|
677
|
-
* should be excluded from the collected set. The decision may depend on
|
|
678
|
-
* this ingestor's own configuration. Used by the server to consolidate
|
|
679
|
-
* overlapping ingestors — e.g. `OTelTraceIngestor` reports any other
|
|
680
|
-
* `OTelTraceIngestor` redundant because OTel is a single process-global
|
|
681
|
-
* pipeline.
|
|
682
|
-
*/
|
|
683
|
-
isRedundant?(other: TraceIngestor): boolean;
|
|
684
|
-
/**
|
|
685
|
-
* Optional: sets the resource attributes merged into every span this
|
|
686
|
-
* ingestor records from now on, over whatever resource the source itself
|
|
687
|
-
* reported. The server stamps {@link PLAYGROUND_RESOURCE} on the ingestors
|
|
688
|
-
* that record its own runs.
|
|
689
|
-
*/
|
|
690
|
-
setResource?(resource: Record<string, unknown>): void;
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* The resource of every run evalution itself makes — from the playground, an
|
|
694
|
-
* eval, or an MCP client — as opposed to one an app exported to it.
|
|
695
|
-
*/
|
|
696
|
-
declare const PLAYGROUND_RESOURCE: Readonly<Record<string, string>>;
|
|
697
|
-
/**
|
|
698
|
-
* Base class that holds the added sinks and fans each normalized record out
|
|
699
|
-
* to all of them. Concrete ingestors translate their source into
|
|
700
|
-
* {@link Span}/{@link Trace} records and call these protected helpers.
|
|
701
|
-
*/
|
|
702
|
-
declare abstract class BaseTraceIngestor implements TraceIngestor {
|
|
703
|
-
protected sinks: TraceSink[];
|
|
704
|
-
private resource?;
|
|
705
|
-
/** Recordings still under way, which {@link flush} waits out. */
|
|
706
|
-
private pending;
|
|
707
|
-
setResource(resource: Record<string, unknown>): void;
|
|
708
|
-
/** `span` with this ingestor's resource, if it has one, merged into its own. */
|
|
709
|
-
private withResource;
|
|
710
|
-
addSink(sink: TraceSink): void;
|
|
711
|
-
removeSink(sink: TraceSink): boolean;
|
|
712
|
-
/**
|
|
713
|
-
* Resolves once everything recorded so far has reached every sink and been
|
|
714
|
-
* delivered by those that deliver in the background. Await it before a
|
|
715
|
-
* short-lived process (a script, a serverless function) exits, so no trace
|
|
716
|
-
* data is lost.
|
|
717
|
-
*/
|
|
718
|
-
flush(): Promise<void>;
|
|
719
|
-
/** Registers `recording` for {@link flush} to wait out, and returns it. */
|
|
720
|
-
private track;
|
|
721
|
-
protected recordSpanStart(span: Span): Promise<void>;
|
|
722
|
-
protected recordSpanEnd(span: Span): Promise<void>;
|
|
723
|
-
protected failTrace(traceId: string, msg: string): Promise<void>;
|
|
724
|
-
}
|
|
725
|
-
//#endregion
|
|
726
315
|
//#region src/shared/input-references.d.ts
|
|
727
316
|
/**
|
|
728
317
|
* One place an input can be plugged in: a prompt's parameter, or any slot
|
|
@@ -1677,7 +1266,7 @@ interface PromptProvider<TPrompt extends NormalizedPrompt = NormalizedPrompt> {
|
|
|
1677
1266
|
*
|
|
1678
1267
|
* Optional — providers with no tracing support may omit it.
|
|
1679
1268
|
*/
|
|
1680
|
-
setupTraceIngestion?(): Promise<TraceIngestor | undefined>;
|
|
1269
|
+
setupTraceIngestion?(): Promise<TraceIngestor$1 | undefined>;
|
|
1681
1270
|
/**
|
|
1682
1271
|
* Returns the definition of the model slot for this provider's underlying
|
|
1683
1272
|
* SDK, catalogs included, for prompts of the given style. See
|
|
@@ -1732,33 +1321,140 @@ interface PromptProvider<TPrompt extends NormalizedPrompt = NormalizedPrompt> {
|
|
|
1732
1321
|
readonly variations?: PromptVariations;
|
|
1733
1322
|
}
|
|
1734
1323
|
//#endregion
|
|
1735
|
-
//#region src/
|
|
1324
|
+
//#region src/trace/trace-provider.d.ts
|
|
1736
1325
|
/**
|
|
1737
|
-
*
|
|
1738
|
-
*
|
|
1739
|
-
*
|
|
1740
|
-
* of your project to customise how Evalution discovers and serves prompts
|
|
1741
|
-
* and traces.
|
|
1742
|
-
*
|
|
1743
|
-
* If no config file is found, Evalution will show an onboarding wizard
|
|
1744
|
-
* to help you create one.
|
|
1745
|
-
*
|
|
1746
|
-
* @example
|
|
1747
|
-
* ```ts
|
|
1748
|
-
* // .evalution/config.ts
|
|
1749
|
-
* import type { EvalutionConfig } from 'evalution';
|
|
1750
|
-
* import { FilePromptProvider, VercelAISDK } from 'evalution';
|
|
1326
|
+
* A read-only store of execution traces that the playground can display and
|
|
1327
|
+
* subscribe to in real time. Implement this interface to integrate a tracing
|
|
1328
|
+
* backend.
|
|
1751
1329
|
*
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1754
|
-
*
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1330
|
+
* `TraceProvider` is a pure read interface — populating the store is the job
|
|
1331
|
+
* of a `TraceIngestor`, which feeds normalized spans into the provider's
|
|
1332
|
+
* write side (`TraceSink`, implemented by `BaseTraceProvider`).
|
|
1333
|
+
*/
|
|
1334
|
+
interface TraceProvider {
|
|
1335
|
+
/**
|
|
1336
|
+
* Uniquely identifies this instance, even when multiple providers of the
|
|
1337
|
+
* same type are used.
|
|
1338
|
+
*/
|
|
1339
|
+
readonly id: string;
|
|
1340
|
+
/** Human-readable name shown when choosing between providers. */
|
|
1341
|
+
readonly displayName?: string;
|
|
1342
|
+
/** Short description of what this provider offers. */
|
|
1343
|
+
readonly description?: string;
|
|
1344
|
+
/**
|
|
1345
|
+
* Returns compact summaries for every trace known to this provider, newest
|
|
1346
|
+
* first. Used to populate the Traces sidebar.
|
|
1347
|
+
*/
|
|
1348
|
+
getAllTraces(): Promise<TraceSummary[]>;
|
|
1349
|
+
/**
|
|
1350
|
+
* Returns the trace with the given ID together with all of its spans, or
|
|
1351
|
+
* `undefined` when the trace is unknown.
|
|
1352
|
+
*/
|
|
1353
|
+
getTrace(traceId: string): Promise<TraceWithSpans | undefined>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Subscribes to real-time updates for a specific trace. The callback is
|
|
1356
|
+
* invoked for every {@link Span} change on this trace, for as long as the
|
|
1357
|
+
* returned cleanup function has not been called.
|
|
1358
|
+
*
|
|
1359
|
+
* Optional — providers that cannot track live changes may omit it.
|
|
1360
|
+
*
|
|
1361
|
+
* @returns A no-argument function that cancels the subscription.
|
|
1362
|
+
*/
|
|
1363
|
+
subscribeTrace?(traceId: string, callback: (event: TraceStreamEvent) => void): () => void;
|
|
1364
|
+
/**
|
|
1365
|
+
* Registers a callback invoked whenever a trace is added, updated, or
|
|
1366
|
+
* removed. Used by the sidebar to stay in sync without polling.
|
|
1367
|
+
*
|
|
1368
|
+
* Optional — providers that cannot detect live changes may omit it.
|
|
1369
|
+
*
|
|
1370
|
+
* @returns A no-argument function that unregisters the watcher.
|
|
1371
|
+
*/
|
|
1372
|
+
watch?(callback: (event: TraceChangeEvent) => void): () => void;
|
|
1373
|
+
/**
|
|
1374
|
+
* Permanently deletes a trace along with its spans and annotations, and
|
|
1375
|
+
* notifies {@link watch}ers with a `remove` event. Returns `false` if the trace
|
|
1376
|
+
* doesn't exist.
|
|
1377
|
+
*
|
|
1378
|
+
* Optional — a provider backed by a read-only source omits it, and the REST
|
|
1379
|
+
* route in `src/server/api-routes.ts` treats its absence as "not
|
|
1380
|
+
* supported" (405).
|
|
1381
|
+
*/
|
|
1382
|
+
deleteTrace?(traceId: string): Promise<boolean>;
|
|
1383
|
+
/**
|
|
1384
|
+
* Runs one read-only SQL query (a `SELECT`) against this provider's
|
|
1385
|
+
* store and returns the rows — the ad-hoc counterpart to
|
|
1386
|
+
* {@link getAllTraces}, for questions a summary can't answer. The schema the
|
|
1387
|
+
* query is written against is {@link getQuerySchema}'s. Writes are refused.
|
|
1388
|
+
*
|
|
1389
|
+
* Optional — a provider not backed by SQL omits it, and the REST and MCP
|
|
1390
|
+
* handlers report "not supported".
|
|
1391
|
+
*/
|
|
1392
|
+
query?(sql: string, options?: SqlQueryOptions): Promise<SqlQueryResult>;
|
|
1393
|
+
/**
|
|
1394
|
+
* Describes the tables {@link query} runs against, as annotated SQL DDL.
|
|
1395
|
+
* Present exactly when {@link query} is.
|
|
1396
|
+
*/
|
|
1397
|
+
getQuerySchema?(): string;
|
|
1398
|
+
/** Lists every annotation on a trace, oldest first. */
|
|
1399
|
+
listAnnotations?(traceId: string): Promise<Annotation[]>;
|
|
1400
|
+
/** Creates a new annotation, minting its `id`/`createdAt`. */
|
|
1401
|
+
createAnnotation?(input: Omit<Annotation, "id" | "createdAt">): Promise<Annotation>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Changes an annotation's `kind` and/or `note`, returning it as updated, or
|
|
1404
|
+
* `undefined` if it doesn't exist.
|
|
1405
|
+
*/
|
|
1406
|
+
updateAnnotation?(id: string, changes: AnnotationChanges): Promise<Annotation | undefined>;
|
|
1407
|
+
/** Deletes an annotation by id. A no-op if it doesn't exist. */
|
|
1408
|
+
deleteAnnotation?(id: string): Promise<void>;
|
|
1409
|
+
/**
|
|
1410
|
+
* Subscribes to annotation changes on a specific trace — the counterpart
|
|
1411
|
+
* to {@link subscribeTrace} that a client's per-trace SSE connection also
|
|
1412
|
+
* opens, so both ride the same stream. Callers (the annotation REST
|
|
1413
|
+
* handlers) invoke {@link emitAnnotation} after a successful
|
|
1414
|
+
* create/update/delete; this only delivers what's explicitly emitted.
|
|
1415
|
+
*
|
|
1416
|
+
* @returns A no-argument function that cancels the subscription.
|
|
1417
|
+
*/
|
|
1418
|
+
subscribeAnnotations?(traceId: string, callback: (event: AnnotationEvent) => void): () => void;
|
|
1419
|
+
/**
|
|
1420
|
+
* Notifies this trace's {@link subscribeAnnotations} subscribers of an
|
|
1421
|
+
* annotation change, and {@link watch}ers with an `update` event, since a
|
|
1422
|
+
* trace's summary carries its annotation counts. Called by the annotation
|
|
1423
|
+
* REST handlers immediately after
|
|
1424
|
+
* {@link createAnnotation}/{@link updateAnnotation}/{@link deleteAnnotation}
|
|
1425
|
+
* succeeds — the provider itself never calls this on its own.
|
|
1426
|
+
*/
|
|
1427
|
+
emitAnnotation?(traceId: string, op: AnnotationEventOp, annotation: Annotation): void;
|
|
1428
|
+
}
|
|
1429
|
+
//#endregion
|
|
1430
|
+
//#region src/config.d.ts
|
|
1431
|
+
/**
|
|
1432
|
+
* Top-level configuration for an Evalution instance.
|
|
1433
|
+
*
|
|
1434
|
+
* Place a default export of this type in `.evalution/config.ts` at the root
|
|
1435
|
+
* of your project to customise how Evalution discovers and serves prompts
|
|
1436
|
+
* and traces.
|
|
1437
|
+
*
|
|
1438
|
+
* If no config file is found, Evalution will show an onboarding wizard
|
|
1439
|
+
* to help you create one.
|
|
1440
|
+
*
|
|
1441
|
+
* @example
|
|
1442
|
+
* ```ts
|
|
1443
|
+
* // .evalution/config.ts
|
|
1444
|
+
* import type { EvalutionConfig } from 'evalution';
|
|
1445
|
+
* import { FilePromptProvider } from 'evalution';
|
|
1446
|
+
* import { VercelAISDK } from '@evalution/vercel-ai-sdk/config';
|
|
1447
|
+
*
|
|
1448
|
+
* export default {
|
|
1449
|
+
* promptProviders: [
|
|
1450
|
+
* new FilePromptProvider({
|
|
1451
|
+
* sdk: new VercelAISDK(),
|
|
1452
|
+
* }),
|
|
1453
|
+
* ],
|
|
1454
|
+
* } satisfies EvalutionConfig;
|
|
1455
|
+
* ```
|
|
1456
|
+
*/
|
|
1457
|
+
interface EvalutionConfig {
|
|
1762
1458
|
/**
|
|
1763
1459
|
* Whether to load a `.env` file from the directory Evalution is launched
|
|
1764
1460
|
* from before starting the server.
|
|
@@ -2044,7 +1740,7 @@ interface EvalRunnerOptions {
|
|
|
2044
1740
|
traceProviderId: string;
|
|
2045
1741
|
tracer: Tracer;
|
|
2046
1742
|
/** Resolves an eval's (possibly global) prompt id to a provider and prompt. */
|
|
2047
|
-
resolvePrompt(prompt: PromptID): {
|
|
1743
|
+
resolvePrompt(prompt: PromptID$1): {
|
|
2048
1744
|
providerId: string;
|
|
2049
1745
|
promptId: string;
|
|
2050
1746
|
} | undefined;
|
|
@@ -2359,6 +2055,87 @@ declare class OverlayFileProvider implements FileProvider {
|
|
|
2359
2055
|
watch(patterns: readonly string[], options: FileWatchOptions, callback: FileWatchCallback): () => void;
|
|
2360
2056
|
}
|
|
2361
2057
|
//#endregion
|
|
2058
|
+
//#region src/prompt/variations/variation-store.d.ts
|
|
2059
|
+
/** A variation as stored: {@link VariationInfo} plus what only the store needs. */
|
|
2060
|
+
interface StoredVariation extends VariationInfo {
|
|
2061
|
+
/**
|
|
2062
|
+
* The prompt's `prompts()` id when it has one, so a rebase can find the
|
|
2063
|
+
* prompt at head after a file move or an export rename.
|
|
2064
|
+
*/
|
|
2065
|
+
globalId?: string;
|
|
2066
|
+
/**
|
|
2067
|
+
* The prompt's values for the fields {@link updates} sets, as they were
|
|
2068
|
+
* when it was made — the base of the three-way merge that carries it onto
|
|
2069
|
+
* a changed working tree. See `fieldValuesOf`.
|
|
2070
|
+
*/
|
|
2071
|
+
baseValues: FieldValues;
|
|
2072
|
+
}
|
|
2073
|
+
/** What identifies a variation's content. */
|
|
2074
|
+
interface VariationContent {
|
|
2075
|
+
promptId: string;
|
|
2076
|
+
globalId?: string;
|
|
2077
|
+
base?: VersionId;
|
|
2078
|
+
/** Canonical updates — see `canonicalizeUpdates`. */
|
|
2079
|
+
updates: NormalizedPromptUpdates;
|
|
2080
|
+
baseValues: FieldValues;
|
|
2081
|
+
}
|
|
2082
|
+
/** A new WIP variation. */
|
|
2083
|
+
interface NewWip extends VariationContent {
|
|
2084
|
+
/** Whether this WIP holds the unsaved edits to head. At most one per prompt. */
|
|
2085
|
+
onHead: boolean;
|
|
2086
|
+
/** The name of the variation it was opened from, if any. */
|
|
2087
|
+
originName?: string;
|
|
2088
|
+
}
|
|
2089
|
+
/** Changes to a WIP. Omitted fields are left alone; `null` clears. */
|
|
2090
|
+
interface WipChanges {
|
|
2091
|
+
updates?: NormalizedPromptUpdates;
|
|
2092
|
+
baseValues?: FieldValues;
|
|
2093
|
+
pending?: PendingConflicts | null;
|
|
2094
|
+
originName?: string | null;
|
|
2095
|
+
}
|
|
2096
|
+
/**
|
|
2097
|
+
* Where a {@link FilePromptProvider} keeps variations: immutable ("frozen")
|
|
2098
|
+
* ones, deduplicated by content, the one mutable WIP of unsaved edits to
|
|
2099
|
+
* head per prompt, and one per (prompt, old version).
|
|
2100
|
+
*
|
|
2101
|
+
* Nothing is garbage-collected: frozen rows are minted only when something
|
|
2102
|
+
* runs or gets a name, and they dedupe. See
|
|
2103
|
+
* `specs/prompt-versions-and-variations.md` §E.
|
|
2104
|
+
*/
|
|
2105
|
+
interface VariationStore {
|
|
2106
|
+
/** The variation with this id, frozen or WIP. */
|
|
2107
|
+
get(id: VariationId): Promise<StoredVariation | undefined>;
|
|
2108
|
+
/**
|
|
2109
|
+
* Inserts a frozen variation, or returns the existing one with the same
|
|
2110
|
+
* content.
|
|
2111
|
+
*/
|
|
2112
|
+
intern(v: VariationContent): Promise<StoredVariation>;
|
|
2113
|
+
/** The WIP of unsaved edits to an old version of a prompt, if any. */
|
|
2114
|
+
getWip(promptId: string, base: VersionId): Promise<StoredVariation | undefined>;
|
|
2115
|
+
/** The WIP holding a prompt's unsaved edits to head, if any. */
|
|
2116
|
+
getHeadWip(promptId: string): Promise<StoredVariation | undefined>;
|
|
2117
|
+
/** Every head WIP, of every prompt — what the dirty indicators come from. */
|
|
2118
|
+
listHeadWips(): Promise<StoredVariation[]>;
|
|
2119
|
+
/** Creates a WIP, replacing any that holds the same slot. */
|
|
2120
|
+
putWip(v: NewWip): Promise<StoredVariation>;
|
|
2121
|
+
/** Changes a WIP in place — to edit it, rebase it, or record conflicts. */
|
|
2122
|
+
updateWip(id: VariationId, changes: WipChanges): Promise<StoredVariation>;
|
|
2123
|
+
/** Deletes a WIP. A frozen variation is never deleted. */
|
|
2124
|
+
deleteWip(id: VariationId): Promise<void>;
|
|
2125
|
+
/** A prompt's named variations and its WIPs. */
|
|
2126
|
+
list(promptId: string): Promise<StoredVariation[]>;
|
|
2127
|
+
/** Names a frozen variation. A name is unique per prompt; naming again moves it. */
|
|
2128
|
+
name(id: VariationId, promptId: string, name: string): Promise<void>;
|
|
2129
|
+
/** Removes a name. */
|
|
2130
|
+
unname(promptId: string, name: string): Promise<void>;
|
|
2131
|
+
/**
|
|
2132
|
+
* Renames `from` to `to`, keeping the variation it points at, and returns
|
|
2133
|
+
* that variation's id. Throws if `from` doesn't exist, or `to` is already
|
|
2134
|
+
* taken.
|
|
2135
|
+
*/
|
|
2136
|
+
rename(promptId: string, from: string, to: string): Promise<VariationId>;
|
|
2137
|
+
}
|
|
2138
|
+
//#endregion
|
|
2362
2139
|
//#region src/prompt/file/prompt-file-type.d.ts
|
|
2363
2140
|
/** Metadata attached to prompts that originate from a file on disk. */
|
|
2364
2141
|
interface FilePromptMetadata {
|
|
@@ -2397,96 +2174,6 @@ interface ParsePromptsOptions {
|
|
|
2397
2174
|
*/
|
|
2398
2175
|
companionFiles?: readonly string[];
|
|
2399
2176
|
}
|
|
2400
|
-
/**
|
|
2401
|
-
* A type question for a {@link PromptFileType} to answer on an
|
|
2402
|
-
* {@link SDKAdapter}'s behalf.
|
|
2403
|
-
*
|
|
2404
|
-
* Neither side can answer alone. Knowing that a Vercel AI SDK config's tools
|
|
2405
|
-
* imply a `toolsContext` is SDK semantics; *evaluating* that mapping is a
|
|
2406
|
-
* TypeScript capability. So the adapter says what to look for and the file
|
|
2407
|
-
* type contributes the checker.
|
|
2408
|
-
*/
|
|
2409
|
-
type TypeProbe = TypeExpressionProbe | FactoriesProbe;
|
|
2410
|
-
/** A probe that resolves a type expression to a {@link PropDefinition}. */
|
|
2411
|
-
interface TypeExpressionProbe {
|
|
2412
|
-
kind: "type";
|
|
2413
|
-
/**
|
|
2414
|
-
* The name the result is reported under — for an execute parameter, its
|
|
2415
|
-
* name, and the name of the resolved {@link PropDefinition}.
|
|
2416
|
-
*/
|
|
2417
|
-
name: string;
|
|
2418
|
-
/**
|
|
2419
|
-
* Source text of a type expression, in the file type's
|
|
2420
|
-
* {@link PromptFileType.language}, that resolves to the type.
|
|
2421
|
-
*
|
|
2422
|
-
* In a prompt probe, the token `$config` stands for the type of whatever the
|
|
2423
|
-
* prompt returns, and the file type substitutes a way to name it — which
|
|
2424
|
-
* shape a prompt file uses is the file type's knowledge, not the adapter's.
|
|
2425
|
-
* A project probe has no prompt, so `$config` resolves to `never` there.
|
|
2426
|
-
*
|
|
2427
|
-
* Write it defensively: a probe that cannot find what it is looking for
|
|
2428
|
-
* should resolve to `never` (which means "there is no such thing"), never
|
|
2429
|
-
* fail to compile. That is what lets an adapter emit a probe without first
|
|
2430
|
-
* inspecting the parse result.
|
|
2431
|
-
*
|
|
2432
|
-
* For instance, the Vercel AI SDK derives its `toolsContext` from whichever
|
|
2433
|
-
* of a config's tools declare a `contextSchema`, with the `never` branch
|
|
2434
|
-
* covering a config that has no tools at all:
|
|
2435
|
-
*
|
|
2436
|
-
* ```ts
|
|
2437
|
-
* "$config extends { tools: infer T extends ToolSet } ? InferToolSetContext<T> : never"
|
|
2438
|
-
* ```
|
|
2439
|
-
*/
|
|
2440
|
-
expression: string;
|
|
2441
|
-
/**
|
|
2442
|
-
* How to label the resolved type in the UI, when the checker's own spelling
|
|
2443
|
-
* would be unreadable — a deeply-instantiated mapped type is accurate and
|
|
2444
|
-
* useless as a label. The resolved *shape* is unaffected.
|
|
2445
|
-
*/
|
|
2446
|
-
syntax?: string;
|
|
2447
|
-
/** Documentation shown beside the resolved definition in the UI. */
|
|
2448
|
-
description?: string;
|
|
2449
|
-
}
|
|
2450
|
-
/**
|
|
2451
|
-
* A probe that resolves to the {@link ValueFactory}s among some modules'
|
|
2452
|
-
* exports: every export that can be called to produce a value assignable to
|
|
2453
|
-
* {@link produces}.
|
|
2454
|
-
*
|
|
2455
|
-
* The adapter says *what* to look for; the file type knows *how* to ask in its
|
|
2456
|
-
* language. A module that isn't installed contributes nothing rather than
|
|
2457
|
-
* failing the probe.
|
|
2458
|
-
*/
|
|
2459
|
-
interface FactoriesProbe {
|
|
2460
|
-
kind: "factories";
|
|
2461
|
-
/** The name the result is reported under. */
|
|
2462
|
-
name: string;
|
|
2463
|
-
/** Module specifiers whose exports to consider, e.g. `"@ai-sdk/openai"`. */
|
|
2464
|
-
modules: string[];
|
|
2465
|
-
/**
|
|
2466
|
-
* A type expression, in the file type's language, naming what a factory's
|
|
2467
|
-
* call must produce, e.g. `import("ai").LanguageModel`.
|
|
2468
|
-
*/
|
|
2469
|
-
produces: string;
|
|
2470
|
-
/**
|
|
2471
|
-
* Consider a method of each export rather than the export itself: with
|
|
2472
|
-
* `"evaluationModel"`, an exported provider object `typeSafeAi` whose
|
|
2473
|
-
* `evaluationModel(…)` produces the type is found as the factory
|
|
2474
|
-
* `typeSafeAi.evaluationModel`, still bound to the import of `typeSafeAi`.
|
|
2475
|
-
*/
|
|
2476
|
-
member?: string;
|
|
2477
|
-
}
|
|
2478
|
-
/**
|
|
2479
|
-
* What one probe resolved to: a {@link PropDefinition} for a `type` probe or
|
|
2480
|
-
* the {@link ValueFactory}s found by a `factories` probe; `null` for a definite
|
|
2481
|
-
* "no such thing" (the expression evaluated to `never`); or `undefined` for
|
|
2482
|
-
* "could not be evaluated".
|
|
2483
|
-
*/
|
|
2484
|
-
type ProbeResult = PropDefinition$1 | ValueFactory$1[] | null | undefined;
|
|
2485
|
-
/**
|
|
2486
|
-
* Project probe results, keyed by probe name. See
|
|
2487
|
-
* {@link SDKAdapter.getProjectProbes}.
|
|
2488
|
-
*/
|
|
2489
|
-
type ProbeResults = Record<string, ProbeResult>;
|
|
2490
2177
|
/** The project-scoped half of a {@link TypeResolutionRequest}. */
|
|
2491
2178
|
interface ProjectProbeRequest {
|
|
2492
2179
|
/**
|
|
@@ -2495,12 +2182,12 @@ interface ProjectProbeRequest {
|
|
|
2495
2182
|
*/
|
|
2496
2183
|
rootDir: string;
|
|
2497
2184
|
/** The probes to evaluate. */
|
|
2498
|
-
probes: readonly TypeProbe[];
|
|
2185
|
+
probes: readonly TypeProbe$1[];
|
|
2499
2186
|
}
|
|
2500
2187
|
/** A {@link TypeProbe} together with the prompt it is being asked about. */
|
|
2501
2188
|
interface TypeProbeRequest {
|
|
2502
2189
|
/** The probe to evaluate. */
|
|
2503
|
-
probe: TypeProbe;
|
|
2190
|
+
probe: TypeProbe$1;
|
|
2504
2191
|
/** Absolute path of the prompt's source file. */
|
|
2505
2192
|
filePath: string;
|
|
2506
2193
|
/** Name of the prompt within that file. */
|
|
@@ -2554,12 +2241,12 @@ interface TypeResolutionRequest {
|
|
|
2554
2241
|
/** Answers to a {@link TypeResolutionRequest}, positional within each list. */
|
|
2555
2242
|
interface TypeResolutionResult {
|
|
2556
2243
|
/** One per probe request, with the same meaning as {@link PromptFileType.resolveTypeProbes}. */
|
|
2557
|
-
probes: ProbeResult[];
|
|
2244
|
+
probes: ProbeResult$1[];
|
|
2558
2245
|
/**
|
|
2559
2246
|
* The project probes' results, by probe name. Every requested probe has an
|
|
2560
2247
|
* entry, `undefined` when it could not be evaluated.
|
|
2561
2248
|
*/
|
|
2562
|
-
project?: ProbeResults;
|
|
2249
|
+
project?: ProbeResults$1;
|
|
2563
2250
|
/** One per slot match request, with the same meaning as {@link PromptFileType.resolveSlotMatches}. */
|
|
2564
2251
|
slotMatches: Record<string, string[]>[];
|
|
2565
2252
|
}
|
|
@@ -2670,7 +2357,7 @@ interface PromptFileType {
|
|
|
2670
2357
|
* @param requests - The expressions to evaluate, each paired with the
|
|
2671
2358
|
* prompt it concerns. See {@link TypeProbeRequest}.
|
|
2672
2359
|
*/
|
|
2673
|
-
resolveTypeProbes?(requests: readonly TypeProbeRequest[]): Promise<ProbeResult[]>;
|
|
2360
|
+
resolveTypeProbes?(requests: readonly TypeProbeRequest[]): Promise<ProbeResult$1[]>;
|
|
2674
2361
|
/**
|
|
2675
2362
|
* Decides, for each request, which of its sources can supply which of the
|
|
2676
2363
|
* prompt's input slots — the type-based half of source matching.
|
|
@@ -2696,299 +2383,26 @@ interface PromptFileType {
|
|
|
2696
2383
|
/**
|
|
2697
2384
|
* Answers probes and slot matches together: the same questions, with the
|
|
2698
2385
|
* same answers, as {@link resolveTypeProbes} and {@link resolveSlotMatches},
|
|
2699
|
-
* but sharing whatever it costs to answer them. For a checker-backed file
|
|
2700
|
-
* type that is a whole program build, so a caller with both kinds of
|
|
2701
|
-
* question should prefer this.
|
|
2702
|
-
*
|
|
2703
|
-
* Optional. When omitted, callers ask the two separately.
|
|
2704
|
-
*
|
|
2705
|
-
* @param requests - See {@link TypeResolutionRequest}.
|
|
2706
|
-
*/
|
|
2707
|
-
resolveTypes?(requests: TypeResolutionRequest): Promise<TypeResolutionResult>;
|
|
2708
|
-
/**
|
|
2709
|
-
* A file type like this one that does all its file I/O — reading, writing
|
|
2710
|
-
* and importing prompt files — through `fileProvider` instead.
|
|
2711
|
-
*
|
|
2712
|
-
* How a prompt variation is materialized: the provider hands the copy an
|
|
2713
|
-
* {@link OverlayFileProvider} holding the variation's source at the
|
|
2714
|
-
* prompt's real path, and parses, edits and runs it through that.
|
|
2715
|
-
*
|
|
2716
|
-
* Optional. A file type without it can't show or run variations.
|
|
2717
|
-
*/
|
|
2718
|
-
withFileProvider?(fileProvider: FileProvider): PromptFileType;
|
|
2719
|
-
}
|
|
2720
|
-
//#endregion
|
|
2721
|
-
//#region src/sdk/sdk-adapter.d.ts
|
|
2722
|
-
/** Options for {@link SDKAdapter.executeConfig}. */
|
|
2723
|
-
interface ExecuteConfigOptions {
|
|
2724
|
-
/** The ID to use for the trace created by this execution, if any. */
|
|
2725
|
-
traceId?: string;
|
|
2726
|
-
/**
|
|
2727
|
-
* The ID the route gave this execution's root span, if any. An adapter that
|
|
2728
|
-
* records its own spans names the root span with this, so the span the
|
|
2729
|
-
* client selects when a run starts is the one that actually arrives.
|
|
2730
|
-
*/
|
|
2731
|
-
rootSpanId?: string;
|
|
2732
|
-
/**
|
|
2733
|
-
* The prompt's identity (id, name, inputs). Used to name and link the
|
|
2734
|
-
* trace when the config wasn't built by the `prompts()` helper (which would
|
|
2735
|
-
* otherwise carry that identity itself).
|
|
2736
|
-
*/
|
|
2737
|
-
identity?: PromptSpanInfo;
|
|
2738
|
-
/**
|
|
2739
|
-
* Named values the SDK needs to execute this config, resolved from the
|
|
2740
|
-
* prompt's `executeParameters` — the Vercel AI SDK's `toolsContext`, say.
|
|
2741
|
-
*
|
|
2742
|
-
* How they reach the underlying call is the adapter's business: merging
|
|
2743
|
-
* them generically would assume an execute parameter's name is always a
|
|
2744
|
-
* config key, which is true for `toolsContext` but is the adapter's fact to
|
|
2745
|
-
* know rather than the caller's.
|
|
2746
|
-
*/
|
|
2747
|
-
executeValues?: Record<string, any>;
|
|
2748
|
-
}
|
|
2749
|
-
/**
|
|
2750
|
-
* Handle on an execution that has been dispatched.
|
|
2751
|
-
*
|
|
2752
|
-
* `executeConfig` deliberately resolves as soon as the call is in flight — the
|
|
2753
|
-
* route answers with a trace id and the generation continues in the background
|
|
2754
|
-
* — so this is how a caller learns when the run is actually over, which is
|
|
2755
|
-
* what run-scoped resource teardown hangs off.
|
|
2756
|
-
*/
|
|
2757
|
-
interface ExecutionHandle {
|
|
2758
|
-
/**
|
|
2759
|
-
* Settles when the run is over, successfully or not. Never rejects: a
|
|
2760
|
-
* failure is already reported through the trace, and a caller awaiting this
|
|
2761
|
-
* only wants to know that it is safe to tear down.
|
|
2762
|
-
*/
|
|
2763
|
-
done: Promise<void>;
|
|
2764
|
-
}
|
|
2765
|
-
/**
|
|
2766
|
-
* Adapter that provides values and execution for a particular AI SDK.
|
|
2767
|
-
*
|
|
2768
|
-
* Pass an instance of this to {@link FilePromptProvider} via the
|
|
2769
|
-
* `sdk` option.
|
|
2770
|
-
*
|
|
2771
|
-
* Each `SDKAdapter` implementation should be paired with a companion package
|
|
2772
|
-
* (named by {@link SDKAdapter.promptsHelperImport}) that exports a `prompts`
|
|
2773
|
-
* function satisfying the {@link PromptsHelper} type. That function is the user-facing entry
|
|
2774
|
-
* point for defining prompts that work with Evalution. It accepts a {@link PromptsHelperOptions}
|
|
2775
|
-
* and a factory that can optionally receive SDK-specific parameters. The factory should return a
|
|
2776
|
-
* record of prompt functions. Prompt functions should return a configuration that enables OpenTelemetry
|
|
2777
|
-
* reporting, if possible, with the attributes returned by {@link getPromptSpanAttributes}.
|
|
2778
|
-
*/
|
|
2779
|
-
interface SDKAdapter {
|
|
2780
|
-
/**
|
|
2781
|
-
* The package that exports the `prompts()` helper used in new prompt files
|
|
2782
|
-
* (e.g. `'@evalution/vercel-ai-sdk'`). Used by {@link PromptFileType.newPromptSkeleton}.
|
|
2783
|
-
*/
|
|
2784
|
-
promptsHelperImport: string;
|
|
2785
|
-
/**
|
|
2786
|
-
* Returns the definition of this SDK's model slot: its type, and the
|
|
2787
|
-
* catalogs (providers, presets, free-form entries) the playground's model
|
|
2788
|
-
* picker offers.
|
|
2789
|
-
*
|
|
2790
|
-
* A per-SDK call rather than something copied onto every prompt, since the
|
|
2791
|
-
* suggestions a checker derives can run to hundreds of model IDs. It is
|
|
2792
|
-
* asked per {@link PromptStyle}, since one SDK may drive different kinds of
|
|
2793
|
-
* model — the Vercel AI SDK's chat prompts take a language model, and its
|
|
2794
|
-
* evaluation prompts an evaluation model. An adapter that only produces one
|
|
2795
|
-
* style may ignore it.
|
|
2796
|
-
*
|
|
2797
|
-
* @param project - What {@link getProjectProbes} resolved to, by probe name.
|
|
2798
|
-
* Substitute a fallback for any `undefined` result.
|
|
2799
|
-
* @param style - The style of the prompts the slot belongs to.
|
|
2800
|
-
*/
|
|
2801
|
-
getModelDefinition(project: ProbeResults, style: PromptStyle): Promise<PropDefinition$1>;
|
|
2802
|
-
/**
|
|
2803
|
-
* Returns the list of model parameters that can be edited in the playground
|
|
2804
|
-
* UI for projects rooted at `rootDir`. Typically extracted from the SDK's
|
|
2805
|
-
* published TypeScript type definitions.
|
|
2806
|
-
*
|
|
2807
|
-
* @param rootDir - Absolute path to the project root.
|
|
2808
|
-
*/
|
|
2809
|
-
getModelParameters(rootDir: string): PropDefinition$1[];
|
|
2810
|
-
/**
|
|
2811
|
-
* Executes a prompt config object.
|
|
2812
|
-
*
|
|
2813
|
-
* Resolves once the call has been dispatched, not once it has finished. Use
|
|
2814
|
-
* the returned {@link ExecutionHandle} to await completion.
|
|
2815
|
-
*
|
|
2816
|
-
* @param config - The config object returned by the prompt function.
|
|
2817
|
-
* @param options - Optional execution options (trace id, prompt identity,
|
|
2818
|
-
* resolved execute values).
|
|
2819
|
-
*/
|
|
2820
|
-
executeConfig(config: any, options?: ExecuteConfigOptions): Promise<ExecutionHandle | undefined>;
|
|
2821
|
-
/**
|
|
2822
|
-
* Called once, during server startup, before any prompt config is built,
|
|
2823
|
-
* to perform whatever setup this SDK's tracing mechanism needs
|
|
2824
|
-
* (e.g. registering a native telemetry integration, or standing up an
|
|
2825
|
-
* OpenTelemetry pipeline).
|
|
2826
|
-
*
|
|
2827
|
-
* If this SDK's tracing is built on OpenTelemetry, its implementation of
|
|
2828
|
-
* this method should call {@link setupGlobalOTelPipeline}, which
|
|
2829
|
-
* ensures the global pipeline is only set up once, even if other SDK adapters
|
|
2830
|
-
* also call it.
|
|
2831
|
-
*
|
|
2832
|
-
* Optional — adapters with no tracing support may omit it.
|
|
2833
|
-
*
|
|
2834
|
-
* @returns An ingestor to which {@link TraceSink}s should be added, or
|
|
2835
|
-
* `undefined` if tracing cannot be set up.
|
|
2836
|
-
*/
|
|
2837
|
-
setupTraceIngestion?(): Promise<TraceIngestor | undefined>;
|
|
2838
|
-
/**
|
|
2839
|
-
* Convert a low-level {@link ParsedPrompt} produced by a
|
|
2840
|
-
* {@link PromptFileType} into a {@link NormalizedPrompt} that the UI can
|
|
2841
|
-
* consume without knowing the SDK's specific property names or message shape.
|
|
2842
|
-
*
|
|
2843
|
-
* Stays synchronous: the expensive, asynchronous work of resolving probes
|
|
2844
|
-
* happens in the provider, which passes the results back in.
|
|
2845
|
-
*
|
|
2846
|
-
* The adapter also chooses the prompt's {@link PromptStyle},
|
|
2847
|
-
* which decides the editor the playground renders it in.
|
|
2848
|
-
*
|
|
2849
|
-
* @param prompt - The raw parsed prompt.
|
|
2850
|
-
* @param promptProbes - What this prompt's {@link getPromptProbes} resolved
|
|
2851
|
-
* to, in the order the probes were returned — see {@link ProbeResult}.
|
|
2852
|
-
* Absent when the file type cannot evaluate probes at all, which an
|
|
2853
|
-
* adapter should treat the same as `undefined`: declaring a parameter with
|
|
2854
|
-
* an unresolved type rather than omitting it.
|
|
2855
|
-
* @param project - What {@link getProjectProbes} resolved to, by probe name.
|
|
2856
|
-
* An adapter substitutes its own fallback for any `undefined` result.
|
|
2857
|
-
*/
|
|
2858
|
-
normalizePrompt(prompt: ParsedPrompt, promptProbes?: readonly ProbeResult[], project?: ProbeResults): NormalizedPrompt;
|
|
2859
|
-
/**
|
|
2860
|
-
* Returns the type expressions to evaluate for one prompt — chiefly to
|
|
2861
|
-
* discover its **execute parameters**, the named values this SDK needs at
|
|
2862
|
-
* run time that the prompt function's signature cannot express. Resolved
|
|
2863
|
-
* per prompt, so an expression may reference `$config`.
|
|
2864
|
-
*
|
|
2865
|
-
* The file type declares the language and this method is asked *in* it, so
|
|
2866
|
-
* the decision of whether the expression can be written at all belongs here,
|
|
2867
|
-
* where the SDK knowledge is. Return `[]` for a language this adapter does
|
|
2868
|
-
* not speak, rather than emitting every variant and hoping.
|
|
2869
|
-
*
|
|
2870
|
-
* Optional — an SDK whose configs are self-contained omits it.
|
|
2871
|
-
*
|
|
2872
|
-
* @param prompt - The parsed prompt to probe.
|
|
2873
|
-
* @param language - The file type's {@link PromptFileType.language}.
|
|
2874
|
-
*/
|
|
2875
|
-
getPromptProbes?(prompt: ParsedPrompt, language: string): TypeProbe[];
|
|
2876
|
-
/**
|
|
2877
|
-
* Returns the probes to evaluate about the project as a whole — the SDK's
|
|
2878
|
-
* own types, as installed — rather than about any one prompt. They are
|
|
2879
|
-
* resolved once per program build, in a virtual module at the project root
|
|
2880
|
-
* (so they see the project's module resolution), and cached; `$config` has
|
|
2881
|
-
* no meaning here.
|
|
2386
|
+
* but sharing whatever it costs to answer them. For a checker-backed file
|
|
2387
|
+
* type that is a whole program build, so a caller with both kinds of
|
|
2388
|
+
* question should prefer this.
|
|
2882
2389
|
*
|
|
2883
|
-
* Optional
|
|
2884
|
-
* this adapter does not speak.
|
|
2390
|
+
* Optional. When omitted, callers ask the two separately.
|
|
2885
2391
|
*
|
|
2886
|
-
* @param
|
|
2392
|
+
* @param requests - See {@link TypeResolutionRequest}.
|
|
2887
2393
|
*/
|
|
2888
|
-
|
|
2394
|
+
resolveTypes?(requests: TypeResolutionRequest): Promise<TypeResolutionResult>;
|
|
2889
2395
|
/**
|
|
2890
|
-
*
|
|
2891
|
-
*
|
|
2892
|
-
* and friends operate on.
|
|
2396
|
+
* A file type like this one that does all its file I/O — reading, writing
|
|
2397
|
+
* and importing prompt files — through `fileProvider` instead.
|
|
2893
2398
|
*
|
|
2894
|
-
*
|
|
2895
|
-
*
|
|
2896
|
-
*
|
|
2399
|
+
* How a prompt variation is materialized: the provider hands the copy an
|
|
2400
|
+
* {@link OverlayFileProvider} holding the variation's source at the
|
|
2401
|
+
* prompt's real path, and parses, edits and runs it through that.
|
|
2897
2402
|
*
|
|
2898
|
-
*
|
|
2899
|
-
* @returns A `Record` keyed by the SDK's actual property names. Values may
|
|
2900
|
-
* be `null` (to remove) or a `PropValue`.
|
|
2901
|
-
*/
|
|
2902
|
-
denormalizeUpdates(updates: NormalizedPromptUpdates, currentValues?: Record<string, PropValue$1>): Record<string, PropValue$1 | null>;
|
|
2903
|
-
}
|
|
2904
|
-
/**
|
|
2905
|
-
* Throws unless `updates` are in the style the adapter produces. For use at
|
|
2906
|
-
* the top of {@link SDKAdapter.denormalizeUpdates}; narrows `updates` to that
|
|
2907
|
-
* style's update type.
|
|
2908
|
-
*/
|
|
2909
|
-
declare function assertUpdateStyle<S extends NormalizedPromptUpdates["style"]>(updates: NormalizedPromptUpdates, style: S): asserts updates is Extract<NormalizedPromptUpdates, {
|
|
2910
|
-
style: S;
|
|
2911
|
-
}>;
|
|
2912
|
-
//#endregion
|
|
2913
|
-
//#region src/prompt/variations/variation-store.d.ts
|
|
2914
|
-
/** A variation as stored: {@link VariationInfo} plus what only the store needs. */
|
|
2915
|
-
interface StoredVariation extends VariationInfo {
|
|
2916
|
-
/**
|
|
2917
|
-
* The prompt's `prompts()` id when it has one, so a rebase can find the
|
|
2918
|
-
* prompt at head after a file move or an export rename.
|
|
2919
|
-
*/
|
|
2920
|
-
globalId?: string;
|
|
2921
|
-
/**
|
|
2922
|
-
* The prompt's values for the fields {@link updates} sets, as they were
|
|
2923
|
-
* when it was made — the base of the three-way merge that carries it onto
|
|
2924
|
-
* a changed working tree. See `fieldValuesOf`.
|
|
2925
|
-
*/
|
|
2926
|
-
baseValues: FieldValues;
|
|
2927
|
-
}
|
|
2928
|
-
/** What identifies a variation's content. */
|
|
2929
|
-
interface VariationContent {
|
|
2930
|
-
promptId: string;
|
|
2931
|
-
globalId?: string;
|
|
2932
|
-
base?: VersionId;
|
|
2933
|
-
/** Canonical updates — see `canonicalizeUpdates`. */
|
|
2934
|
-
updates: NormalizedPromptUpdates;
|
|
2935
|
-
baseValues: FieldValues;
|
|
2936
|
-
}
|
|
2937
|
-
/** A new WIP variation. */
|
|
2938
|
-
interface NewWip extends VariationContent {
|
|
2939
|
-
/** Whether this WIP holds the unsaved edits to head. At most one per prompt. */
|
|
2940
|
-
onHead: boolean;
|
|
2941
|
-
/** The name of the variation it was opened from, if any. */
|
|
2942
|
-
originName?: string;
|
|
2943
|
-
}
|
|
2944
|
-
/** Changes to a WIP. Omitted fields are left alone; `null` clears. */
|
|
2945
|
-
interface WipChanges {
|
|
2946
|
-
updates?: NormalizedPromptUpdates;
|
|
2947
|
-
baseValues?: FieldValues;
|
|
2948
|
-
pending?: PendingConflicts | null;
|
|
2949
|
-
originName?: string | null;
|
|
2950
|
-
}
|
|
2951
|
-
/**
|
|
2952
|
-
* Where a {@link FilePromptProvider} keeps variations: immutable ("frozen")
|
|
2953
|
-
* ones, deduplicated by content, the one mutable WIP of unsaved edits to
|
|
2954
|
-
* head per prompt, and one per (prompt, old version).
|
|
2955
|
-
*
|
|
2956
|
-
* Nothing is garbage-collected: frozen rows are minted only when something
|
|
2957
|
-
* runs or gets a name, and they dedupe. See
|
|
2958
|
-
* `specs/prompt-versions-and-variations.md` §E.
|
|
2959
|
-
*/
|
|
2960
|
-
interface VariationStore {
|
|
2961
|
-
/** The variation with this id, frozen or WIP. */
|
|
2962
|
-
get(id: VariationId): Promise<StoredVariation | undefined>;
|
|
2963
|
-
/**
|
|
2964
|
-
* Inserts a frozen variation, or returns the existing one with the same
|
|
2965
|
-
* content.
|
|
2966
|
-
*/
|
|
2967
|
-
intern(v: VariationContent): Promise<StoredVariation>;
|
|
2968
|
-
/** The WIP of unsaved edits to an old version of a prompt, if any. */
|
|
2969
|
-
getWip(promptId: string, base: VersionId): Promise<StoredVariation | undefined>;
|
|
2970
|
-
/** The WIP holding a prompt's unsaved edits to head, if any. */
|
|
2971
|
-
getHeadWip(promptId: string): Promise<StoredVariation | undefined>;
|
|
2972
|
-
/** Every head WIP, of every prompt — what the dirty indicators come from. */
|
|
2973
|
-
listHeadWips(): Promise<StoredVariation[]>;
|
|
2974
|
-
/** Creates a WIP, replacing any that holds the same slot. */
|
|
2975
|
-
putWip(v: NewWip): Promise<StoredVariation>;
|
|
2976
|
-
/** Changes a WIP in place — to edit it, rebase it, or record conflicts. */
|
|
2977
|
-
updateWip(id: VariationId, changes: WipChanges): Promise<StoredVariation>;
|
|
2978
|
-
/** Deletes a WIP. A frozen variation is never deleted. */
|
|
2979
|
-
deleteWip(id: VariationId): Promise<void>;
|
|
2980
|
-
/** A prompt's named variations and its WIPs. */
|
|
2981
|
-
list(promptId: string): Promise<StoredVariation[]>;
|
|
2982
|
-
/** Names a frozen variation. A name is unique per prompt; naming again moves it. */
|
|
2983
|
-
name(id: VariationId, promptId: string, name: string): Promise<void>;
|
|
2984
|
-
/** Removes a name. */
|
|
2985
|
-
unname(promptId: string, name: string): Promise<void>;
|
|
2986
|
-
/**
|
|
2987
|
-
* Renames `from` to `to`, keeping the variation it points at, and returns
|
|
2988
|
-
* that variation's id. Throws if `from` doesn't exist, or `to` is already
|
|
2989
|
-
* taken.
|
|
2403
|
+
* Optional. A file type without it can't show or run variations.
|
|
2990
2404
|
*/
|
|
2991
|
-
|
|
2405
|
+
withFileProvider?(fileProvider: FileProvider): PromptFileType;
|
|
2992
2406
|
}
|
|
2993
2407
|
//#endregion
|
|
2994
2408
|
//#region src/prompt/file/file-prompt-provider.d.ts
|
|
@@ -3038,7 +2452,7 @@ interface FilePromptProviderOptions {
|
|
|
3038
2452
|
/**
|
|
3039
2453
|
* SDK adapter that governs prompt structure and execution.
|
|
3040
2454
|
*/
|
|
3041
|
-
sdk: SDKAdapter;
|
|
2455
|
+
sdk: SDKAdapter$1;
|
|
3042
2456
|
/**
|
|
3043
2457
|
* How states of the world are named, so a trace records which content of a
|
|
3044
2458
|
* prompt it ran and an old one can be reopened. See
|
|
@@ -3349,7 +2763,7 @@ declare class FilePromptProvider implements PromptProvider<NormalizedFilePrompt>
|
|
|
3349
2763
|
* trace's `executeInputs` would have names but no types.
|
|
3350
2764
|
*/
|
|
3351
2765
|
private parameterSnapshot;
|
|
3352
|
-
setupTraceIngestion(): Promise<TraceIngestor | undefined>;
|
|
2766
|
+
setupTraceIngestion(): Promise<import("@evalution/sdk").TraceIngestor | undefined>;
|
|
3353
2767
|
renamePrompt(promptId: string, newName: string): Promise<NormalizedFilePrompt>;
|
|
3354
2768
|
addPrompt(partial: Partial<NormalizedFilePrompt>): Promise<NormalizedFilePrompt | AddPromptContext>;
|
|
3355
2769
|
watch(callback: (event: PromptChangeEvent) => void): () => void;
|
|
@@ -3667,409 +3081,80 @@ declare class GitVersioning implements VersioningAdapter {
|
|
|
3667
3081
|
private git;
|
|
3668
3082
|
}
|
|
3669
3083
|
//#endregion
|
|
3670
|
-
//#region src/
|
|
3671
|
-
type BaseCreateInteractionParams = Parameters<typeof import("@google/genai").GoogleGenAI.prototype.interactions.create>[0];
|
|
3672
|
-
/**
|
|
3673
|
-
* {@link SDKAdapter} implementation for the Google GenAI
|
|
3674
|
-
* [Interactions API](https://ai.google.dev/gemini-api/docs/interactions)
|
|
3675
|
-
* (`@google/genai` package). Currently experimental and untested.
|
|
3676
|
-
*/
|
|
3677
|
-
declare class GeminiInteractionsSDK implements SDKAdapter {
|
|
3678
|
-
readonly promptsHelperImport = "FIXME";
|
|
3679
|
-
getProjectProbes(language: string): TypeProbe[];
|
|
3680
|
-
/**
|
|
3681
|
-
* One model row whose value is an honest config fragment —
|
|
3682
|
-
* `{ model: "gemini-3.5-flash" }` or `{ agent: "deep-research-…" }` —
|
|
3683
|
-
* because `interactions.create` takes one or the other, never both. The
|
|
3684
|
-
* **Models** and **Agents** catalogs each narrow their free-form entry to
|
|
3685
|
-
* their own variant.
|
|
3686
|
-
*/
|
|
3687
|
-
getModelDefinition(project: ProbeResults): Promise<PropDefinition$1>;
|
|
3688
|
-
getModelParameters(rootDir: string): PropDefinition$1[];
|
|
3689
|
-
executeConfig(config: BaseCreateInteractionParams): Promise<undefined>;
|
|
3690
|
-
normalizePrompt(prompt: ParsedPrompt): NormalizedChatPrompt;
|
|
3691
|
-
denormalizeUpdates(updates: NormalizedPromptUpdates, currentValues?: Record<string, PropValue$1>): Record<string, PropValue$1 | null>;
|
|
3692
|
-
}
|
|
3693
|
-
//#endregion
|
|
3694
|
-
//#region src/shared/setup-task.d.ts
|
|
3695
|
-
/** Fields shared by every {@link SetupStep} kind. */
|
|
3696
|
-
interface SetupStepBase {
|
|
3697
|
-
/** Stable identifier, unique within the owning {@link SetupTask}. */
|
|
3698
|
-
id: string;
|
|
3699
|
-
/**
|
|
3700
|
-
* Runtime completion status, populated by the server when listing tasks
|
|
3701
|
-
* (e.g. the config file already exists, or the package is installed). Absent
|
|
3702
|
-
* in the static step definitions held by the registry.
|
|
3703
|
-
*/
|
|
3704
|
-
completed?: boolean;
|
|
3705
|
-
}
|
|
3706
|
-
/** Writes evalution's starter config file. */
|
|
3707
|
-
interface SetupCreateConfigStep extends SetupStepBase {
|
|
3708
|
-
/** Discriminant: this step creates the project config file. */
|
|
3709
|
-
kind: "create_config";
|
|
3710
|
-
/** Project-relative path the file will be written to. */
|
|
3711
|
-
path: string;
|
|
3712
|
-
/**
|
|
3713
|
-
* Full contents of the file. Shown to the user as a copyable snippet and
|
|
3714
|
-
* written verbatim by the server. This is display data: the server reads it
|
|
3715
|
-
* from its own registry, never from a client request.
|
|
3716
|
-
*/
|
|
3717
|
-
contents: string;
|
|
3718
|
-
}
|
|
3719
|
-
/**
|
|
3720
|
-
* Runs a shell command in the project root, streamed to an interactive
|
|
3721
|
-
* terminal so the user can watch it and respond to prompts.
|
|
3722
|
-
*/
|
|
3723
|
-
interface SetupRunCommandStep extends SetupStepBase {
|
|
3724
|
-
/** Discriminant: this step runs a shell command. */
|
|
3725
|
-
kind: "run_command";
|
|
3726
|
-
/** The command line to run, e.g. `npm run build`. */
|
|
3727
|
-
command: string;
|
|
3728
|
-
/** Optional human-friendly label shown alongside the command. */
|
|
3729
|
-
label?: string;
|
|
3730
|
-
}
|
|
3731
|
-
/**
|
|
3732
|
-
* Installs an npm package — a specialization of {@link SetupRunCommandStep}
|
|
3733
|
-
* that runs `npm i <package>`. The server reports it as already
|
|
3734
|
-
* {@link SetupStepBase.completed | completed} when the package is present in
|
|
3735
|
-
* the project, so the user can skip it.
|
|
3736
|
-
*/
|
|
3737
|
-
interface SetupInstallPackageStep extends SetupStepBase {
|
|
3738
|
-
/** Discriminant: this step installs an npm package. */
|
|
3739
|
-
kind: "install_package";
|
|
3740
|
-
/** The npm package to install, e.g. `@evalution/vercel-ai-sdk`. */
|
|
3741
|
-
package: string;
|
|
3742
|
-
}
|
|
3743
|
-
/**
|
|
3744
|
-
* A single executable step within a {@link SetupTask}.
|
|
3745
|
-
*
|
|
3746
|
-
* Steps are defined server-side and addressed by {@link SetupTask.id} plus the
|
|
3747
|
-
* step's `id`; the client references a step only by those ids when asking the
|
|
3748
|
-
* server to run it.
|
|
3749
|
-
*/
|
|
3750
|
-
type SetupStep = {
|
|
3751
|
-
disabledReason?: string;
|
|
3752
|
-
} & (SetupCreateConfigStep | SetupRunCommandStep | SetupInstallPackageStep);
|
|
3753
|
-
/**
|
|
3754
|
-
* A named onboarding task for a single AI SDK: what to show in the manual-setup
|
|
3755
|
-
* picker, plus the ordered steps that wire the SDK up.
|
|
3756
|
-
*/
|
|
3757
|
-
interface SetupTask {
|
|
3758
|
-
/** Stable identifier, also used as the wire id for this SDK choice. */
|
|
3759
|
-
id: string;
|
|
3760
|
-
/** Display label for the picker (typically the SDK's product name). */
|
|
3761
|
-
label: string;
|
|
3762
|
-
/** Icon identifier, mapped to a bundled asset on the client. */
|
|
3763
|
-
icon: string;
|
|
3764
|
-
/** Ordered steps to run, in display order. */
|
|
3765
|
-
steps: SetupStep[];
|
|
3766
|
-
}
|
|
3767
|
-
//#endregion
|
|
3768
|
-
//#region src/sdk/typesafe-sdk/telemetry.d.ts
|
|
3769
|
-
/**
|
|
3770
|
-
* The key under which the `prompts()` helper attaches a config's prompt
|
|
3771
|
-
* identity. A symbol, because a System One request object is sent to the API
|
|
3772
|
-
* as-is: a string key would be sent along and fail validation, while a symbol
|
|
3773
|
-
* survives a spread and is dropped by `JSON.stringify`.
|
|
3774
|
-
*/
|
|
3775
|
-
declare const PROMPT_IDENTITY: unique symbol;
|
|
3776
|
-
/** One System One call being recorded. See {@link TypeSafeTelemetry.startCall}. */
|
|
3777
|
-
interface SystemOneCallRecord {
|
|
3778
|
-
/** Records the call's result and ends its span. */
|
|
3779
|
-
end(result: SystemOneResult<Questions>): Promise<void>;
|
|
3780
|
-
/** Records the call's failure and ends its span as an error. */
|
|
3781
|
-
fail(err: unknown): Promise<void>;
|
|
3782
|
-
}
|
|
3783
|
-
/** Options for {@link TypeSafeTelemetry.startCall}. */
|
|
3784
|
-
interface SystemOneCallOptions {
|
|
3785
|
-
/** The trace to record into. */
|
|
3786
|
-
traceId: string;
|
|
3787
|
-
/** The span's ID; defaults to the trace's conventional root span ID. */
|
|
3788
|
-
spanId?: string;
|
|
3789
|
-
/** The prompt the call was made for, if known. */
|
|
3790
|
-
identity?: PromptSpanInfo;
|
|
3791
|
-
/** The request, recorded as the span's input. */
|
|
3792
|
-
request: SystemOneRequest<Questions>;
|
|
3793
|
-
/** The model the request will be answered by, if the request doesn't say. */
|
|
3794
|
-
defaultModel?: string;
|
|
3795
|
-
}
|
|
3796
|
-
/**
|
|
3797
|
-
* Records System One calls as `LLM` spans. The SDK has no telemetry hook, so
|
|
3798
|
-
* the adapter (in the playground) and `instrument()` (at run time) call it
|
|
3799
|
-
* around each `systemOne` call.
|
|
3800
|
-
*/
|
|
3801
|
-
declare class TypeSafeTelemetry extends BaseTraceIngestor {
|
|
3802
|
-
/** Starts a span for a call; the returned record ends it. */
|
|
3803
|
-
startCall({
|
|
3804
|
-
traceId,
|
|
3805
|
-
spanId,
|
|
3806
|
-
identity,
|
|
3807
|
-
request,
|
|
3808
|
-
defaultModel
|
|
3809
|
-
}: SystemOneCallOptions): Promise<SystemOneCallRecord>;
|
|
3810
|
-
}
|
|
3811
|
-
//#endregion
|
|
3812
|
-
//#region src/sdk/typesafe-sdk/index.d.ts
|
|
3813
|
-
type TypeSafeClientConfig = import("@typesafe-ai/sdk").TypeSafeClientConfig;
|
|
3814
|
-
type SystemOneRequest$1 = import("@typesafe-ai/sdk").SystemOneRequest;
|
|
3815
|
-
/** Options for {@link TypeSafeSDK}. */
|
|
3816
|
-
interface TypeSafeSDKOptions {
|
|
3817
|
-
/**
|
|
3818
|
-
* Configuration for the `TypeSafeClient` this adapter builds to list models
|
|
3819
|
-
* and execute prompts. Defaults to the SDK's own (API key and base URL from
|
|
3820
|
-
* the environment).
|
|
3821
|
-
*/
|
|
3822
|
-
client?: TypeSafeClientConfig;
|
|
3823
|
-
}
|
|
3084
|
+
//#region src/shared/instance-names.d.ts
|
|
3824
3085
|
/**
|
|
3825
|
-
*
|
|
3826
|
-
*
|
|
3827
|
-
*
|
|
3828
|
-
* A System One request isn't a chat: it asks a set of named, typed questions
|
|
3829
|
-
* about a `state`. So its prompts are normalized to the `questions` style,
|
|
3830
|
-
* whose editor is built around the questions rather than a message list.
|
|
3831
|
-
*
|
|
3832
|
-
* Every type the editor needs — the state, the questions, and the factories
|
|
3833
|
-
* that build them — is read from the installed SDK through project probes, so
|
|
3834
|
-
* a question type added by a later SDK version is editable without an
|
|
3835
|
-
* Evalution release.
|
|
3086
|
+
* What a run's resource instance may be named — shared by the server, which
|
|
3087
|
+
* refuses anything else, and the client, which says so before sending. See
|
|
3088
|
+
* `specs/resource-instances.md` §A.2.
|
|
3836
3089
|
*/
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
/**
|
|
3840
|
-
* Onboarding task: install the SDK and the prompts helper, then drop a
|
|
3841
|
-
* starter config.
|
|
3842
|
-
* @internal
|
|
3843
|
-
*/
|
|
3844
|
-
static readonly setupTask: SetupTask;
|
|
3845
|
-
private readonly clientConfig;
|
|
3846
|
-
private modelIds;
|
|
3847
|
-
private clientPromise;
|
|
3848
|
-
constructor({
|
|
3849
|
-
client
|
|
3850
|
-
}?: TypeSafeSDKOptions);
|
|
3851
|
-
/** The model a request without one is answered by. */
|
|
3852
|
-
private get defaultModel();
|
|
3853
|
-
getProjectProbes(language: string): TypeProbe[];
|
|
3854
|
-
/**
|
|
3855
|
-
* A model name, with the account's models from `client.models.list()` as
|
|
3856
|
-
* presets. Listing needs an API key and the network, so it falls back to the
|
|
3857
|
-
* default model alone.
|
|
3858
|
-
*/
|
|
3859
|
-
getModelDefinition(project: ProbeResults): Promise<PropDefinition$1>;
|
|
3860
|
-
/** Model names from the API, listed once per adapter. */
|
|
3861
|
-
private listModels;
|
|
3862
|
-
/** Per-call options are transport settings, not prompt content. */
|
|
3863
|
-
getModelParameters(): PropDefinition$1[];
|
|
3864
|
-
normalizePrompt(prompt: ParsedPrompt, _promptProbes?: readonly ProbeResult[], project?: ProbeResults): NormalizedQuestionsPrompt;
|
|
3865
|
-
/**
|
|
3866
|
-
* Nearly the identity: a System One config's `model`, `state` and
|
|
3867
|
-
* `questions` are the normalized fields, already in source shape.
|
|
3868
|
-
*/
|
|
3869
|
-
denormalizeUpdates(updates: NormalizedPromptUpdates): Record<string, PropValue$1 | null>;
|
|
3870
|
-
/**
|
|
3871
|
-
* Calls `systemOne` with the config, recording it as the run's root span.
|
|
3872
|
-
*
|
|
3873
|
-
* Resolves as soon as the call is dispatched; the returned handle's `done`
|
|
3874
|
-
* settles when it finishes, successfully or not.
|
|
3875
|
-
*/
|
|
3876
|
-
executeConfig(config: SystemOneRequest$1, {
|
|
3877
|
-
traceId,
|
|
3878
|
-
rootSpanId,
|
|
3879
|
-
identity
|
|
3880
|
-
}?: ExecuteConfigOptions): Promise<ExecutionHandle>;
|
|
3881
|
-
/** The client executions use, built once. */
|
|
3882
|
-
private client;
|
|
3883
|
-
setupTraceIngestion(): Promise<TypeSafeTelemetry>;
|
|
3884
|
-
}
|
|
3090
|
+
/** Whether `name` is a valid instance name: `[A-Za-z_][A-Za-z0-9_-]*`. */
|
|
3091
|
+
declare function isValidInstanceName(name: string): boolean;
|
|
3885
3092
|
//#endregion
|
|
3886
|
-
//#region src/
|
|
3093
|
+
//#region src/trace/base-trace-provider.d.ts
|
|
3887
3094
|
/**
|
|
3888
|
-
* {@link
|
|
3889
|
-
*
|
|
3890
|
-
*
|
|
3891
|
-
* - `getModelParameters` reads `CallSettings` from the SDK's `.d.ts` bundle
|
|
3892
|
-
* and surfaces parameters with simple types that can be edited in the UI.
|
|
3893
|
-
* - `executeConfig` delegates to `generateText`.
|
|
3095
|
+
* Source-agnostic base class for a {@link TraceProvider}. Owns storage
|
|
3096
|
+
* delegation, subscriptions, watchers, and the generic trace lifecycle that
|
|
3097
|
+
* every concrete provider shares, regardless of how spans are produced.
|
|
3894
3098
|
*
|
|
3895
|
-
*
|
|
3896
|
-
*
|
|
3897
|
-
*
|
|
3099
|
+
* Subclasses implement the abstract storage hooks; ingestion is handled by
|
|
3100
|
+
* one or more {@link TraceIngestor}s that call {@link recordSpanStart} /
|
|
3101
|
+
* {@link recordSpanEnd} / {@link failTrace} on this instance (via
|
|
3102
|
+
* {@link TraceSink}).
|
|
3898
3103
|
*/
|
|
3899
|
-
declare class
|
|
3900
|
-
readonly
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
executeConfig(config: any, {
|
|
3917
|
-
traceId,
|
|
3918
|
-
identity,
|
|
3919
|
-
executeValues
|
|
3920
|
-
}?: ExecuteConfigOptions): Promise<ExecutionHandle>;
|
|
3921
|
-
setupTraceIngestion(): Promise<TraceIngestor | undefined>;
|
|
3922
|
-
private doSetupTraceIngestion;
|
|
3923
|
-
normalizePrompt(prompt: ParsedPrompt, resolvedProbes?: readonly ProbeResult[], project?: ProbeResults): NormalizedPrompt;
|
|
3924
|
-
private normalizeChatPrompt;
|
|
3925
|
-
/**
|
|
3926
|
-
* Assemble the prompt's execute parameters from what the probes resolved to.
|
|
3927
|
-
*
|
|
3928
|
-
* The interesting case is the third one. When no probe could run — a file
|
|
3929
|
-
* type with no checker, an in-memory provider, a resolution failure — the
|
|
3930
|
-
* parameter is still declared, with an unresolved type. "This prompt needs
|
|
3931
|
-
* `toolsContext` and I cannot tell you its shape" is a usable state; staying
|
|
3932
|
-
* silent reproduces exactly the failure this machinery exists to prevent,
|
|
3933
|
-
* where the first tool call dies at run time with nothing having warned you.
|
|
3934
|
-
*
|
|
3935
|
-
* That degradation is scoped by a cheap syntactic check — does the config
|
|
3936
|
-
* even have a `tools` property? — so a prompt that plainly has no tools does
|
|
3937
|
-
* not sprout a mystery parameter.
|
|
3938
|
-
*/
|
|
3939
|
-
private executeParametersFor;
|
|
3940
|
-
denormalizeUpdates(updates: NormalizedPromptUpdates, currentValues?: Record<string, PropValue$1>): Record<string, PropValue$1 | null>;
|
|
3941
|
-
}
|
|
3942
|
-
//#endregion
|
|
3943
|
-
//#region src/sdk/vercel-ai-sdk/telemetry.d.ts
|
|
3944
|
-
interface PerPromptTelemetry extends Telemetry {
|
|
3945
|
-
/**
|
|
3946
|
-
* Returns a new instance that will use the given trace ID.
|
|
3947
|
-
*
|
|
3948
|
-
* @param runIdentity - What the caller knows about this run that the
|
|
3949
|
-
* integration's own identity doesn't — the playground's inputs and the
|
|
3950
|
-
* version it ran — filled in wherever the integration's identity is unset.
|
|
3951
|
-
*/
|
|
3952
|
-
withTraceId(traceId: string, runIdentity?: PromptSpanInfo): PerTraceTelemetry;
|
|
3953
|
-
}
|
|
3954
|
-
interface PerTraceTelemetry extends PerPromptTelemetry {
|
|
3955
|
-
/**
|
|
3956
|
-
* Marks this run's trace as failed. Used by `executeConfig` to surface a
|
|
3957
|
-
* `generateText` rejection that happens before `onStart` fires (e.g. a
|
|
3958
|
-
* bad model id) — without this, the trace pre-created for the route's
|
|
3959
|
-
* synchronous response would otherwise hang in `running` forever. If spans
|
|
3960
|
-
* were already opened before the rejection, they are closed as `error` too.
|
|
3961
|
-
* Does nothing if `onError` already closed the run.
|
|
3962
|
-
*/
|
|
3963
|
-
fail(message: string): Promise<void>;
|
|
3964
|
-
/**
|
|
3965
|
-
* Whether the SDK has reported this run's start. An `ai` release too old to
|
|
3966
|
-
* send an operation's events never will, which `executeConfig` checks so
|
|
3967
|
-
* the trace doesn't hang in `running`.
|
|
3968
|
-
*/
|
|
3969
|
-
wasStarted(): boolean;
|
|
3970
|
-
}
|
|
3971
|
-
interface VercelAISDKTelemetryOptions {
|
|
3972
|
-
/**
|
|
3973
|
-
* Native telemetry collection: `"auto"` (default) collects natively unless
|
|
3974
|
-
* an OpenTelemetry integration is also active for the call, in which case
|
|
3975
|
-
* it defers to OTel; `"always"` forces native telemetry collection, even
|
|
3976
|
-
* alongside OTel; `"never"` always defers.
|
|
3977
|
-
*/
|
|
3978
|
-
nativeTelemetry?: "auto" | "always" | "never";
|
|
3104
|
+
declare abstract class BaseTraceProvider implements TraceProvider, TraceSink$1 {
|
|
3105
|
+
readonly id: string;
|
|
3106
|
+
readonly displayName?: string;
|
|
3107
|
+
readonly description?: string;
|
|
3108
|
+
protected subscribers: Map<string, Set<(event: TraceStreamEvent$1) => void>>;
|
|
3109
|
+
private watchers;
|
|
3110
|
+
private annotationSubscribers;
|
|
3111
|
+
constructor(options: {
|
|
3112
|
+
id: string;
|
|
3113
|
+
displayName: string;
|
|
3114
|
+
description: string;
|
|
3115
|
+
});
|
|
3116
|
+
abstract getAllTraces(): Promise<TraceSummary$1[]>;
|
|
3117
|
+
abstract hasTrace(traceId: string): Promise<boolean>;
|
|
3118
|
+
protected abstract getTraceWithoutSpans(traceId: string): Promise<Trace$1 | undefined>;
|
|
3119
|
+
protected abstract getTraceSpans(traceId: string): Promise<Span$1[]>;
|
|
3120
|
+
protected abstract addOrUpdateTrace(trace: Trace$1): Promise<void>;
|
|
3979
3121
|
/**
|
|
3980
|
-
*
|
|
3981
|
-
* {@link
|
|
3982
|
-
* variable, if set; `false` sends nowhere, whatever the environment says.
|
|
3122
|
+
* Removes a trace together with its spans and annotations. Only called for
|
|
3123
|
+
* a trace that {@link hasTrace} confirmed exists.
|
|
3983
3124
|
*/
|
|
3984
|
-
|
|
3985
|
-
}
|
|
3986
|
-
type Callbacks = Required<Telemetry>;
|
|
3987
|
-
/**
|
|
3988
|
-
* Native v7 AI SDK `Telemetry` integration that records evalution traces
|
|
3989
|
-
* without going through OpenTelemetry.
|
|
3990
|
-
*
|
|
3991
|
-
* When your app starts, register this globally via `registerTelemetry(new Evalution())` to capture
|
|
3992
|
-
* every `generateText`/`streamText` call as a fallback (events are keyed by
|
|
3993
|
-
* `callId`, so concurrent calls stay correctly separated, though the fallback
|
|
3994
|
-
* lacks prompt identity). The `prompts()` helper additionally swaps in a
|
|
3995
|
-
* per-call integration from {@link createTelemetryForPrompt} so
|
|
3996
|
-
* helper-defined prompts are recorded with full identity.
|
|
3997
|
-
*
|
|
3998
|
-
* When it sends traces to an evalution server (see
|
|
3999
|
-
* {@link VercelAISDKTelemetryOptions.endpoint}), they go in the background:
|
|
4000
|
-
* `await` {@link flush} before a short-lived process — a script, a
|
|
4001
|
-
* serverless function — exits, so none are lost.
|
|
4002
|
-
*
|
|
4003
|
-
* When an OpenTelemetry integration is also active, this class
|
|
4004
|
-
* defers to it by default (see {@link VercelAISDKTelemetryOptions.nativeTelemetry}) rather
|
|
4005
|
-
* than emitting a duplicate, parallel trace.
|
|
4006
|
-
*/
|
|
4007
|
-
declare class VercelAISDKTelemetry extends BaseTraceIngestor implements Telemetry {
|
|
4008
|
-
/**
|
|
4009
|
-
* This instance's configured {@link VercelAISDKTelemetryOptions.nativeTelemetry}.
|
|
4010
|
-
* Read by the `prompts()` helper to decide whether to defer to a sibling
|
|
4011
|
-
* OpenTelemetry integration for a given call.
|
|
4012
|
-
*/
|
|
4013
|
-
readonly nativeTelemetry: "auto" | "always" | "never";
|
|
4014
|
-
private readonly runs;
|
|
4015
|
-
constructor(options?: VercelAISDKTelemetryOptions);
|
|
4016
|
-
private shouldDeferGlobally;
|
|
4017
|
-
onStart: Callbacks["onStart"];
|
|
4018
|
-
onStepStart: Callbacks["onStepStart"];
|
|
4019
|
-
onToolExecutionStart: Callbacks["onToolExecutionStart"];
|
|
4020
|
-
onToolExecutionEnd: Callbacks["onToolExecutionEnd"];
|
|
4021
|
-
onStepEnd: Callbacks["onStepEnd"];
|
|
4022
|
-
onEnd: Callbacks["onEnd"];
|
|
4023
|
-
onAbort: Callbacks["onAbort"];
|
|
4024
|
-
onError: Callbacks["onError"];
|
|
4025
|
-
experimental_onEvaluateStart: Callbacks["experimental_onEvaluateStart"];
|
|
4026
|
-
experimental_onEvaluateEnd: Callbacks["experimental_onEvaluateEnd"];
|
|
4027
|
-
/**
|
|
4028
|
-
* Mints a `PerPromptTelemetry` integration bound to the given prompt identity.
|
|
4029
|
-
* Used by the `prompts()` helper so a helper-defined prompt is recorded with
|
|
4030
|
-
* full identity. Called with no `identity` (e.g. by the playground for a raw,
|
|
4031
|
-
* non-helper config) it still binds a trace id but records without prompt
|
|
4032
|
-
* identity — the same data the global fallback would, just under a known id.
|
|
4033
|
-
*/
|
|
4034
|
-
createTelemetryForPrompt(identity?: PromptSpanInfo): PerPromptTelemetry;
|
|
4035
|
-
private handleStart;
|
|
3125
|
+
protected abstract removeTrace(traceId: string): Promise<void>;
|
|
4036
3126
|
/**
|
|
4037
|
-
*
|
|
4038
|
-
*
|
|
4039
|
-
*
|
|
3127
|
+
* Stores a span, merging it into any existing span with the same ID (via
|
|
3128
|
+
* the `mergeSpans` helper). Returns the resulting stored span so callers
|
|
3129
|
+
* can stream the merged view rather than the partial snapshot they passed
|
|
3130
|
+
* in.
|
|
4040
3131
|
*/
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
private handleStepEnd;
|
|
4047
|
-
private handleEnd;
|
|
4048
|
-
private handleAbort;
|
|
3132
|
+
protected abstract addOrUpdateSpan(span: Span$1): Promise<Span$1>;
|
|
3133
|
+
getTrace(traceId: string): Promise<TraceWithSpans$1 | undefined>;
|
|
3134
|
+
deleteTrace(traceId: string): Promise<boolean>;
|
|
3135
|
+
subscribeTrace(traceId: string, callback: (event: TraceStreamEvent$1) => void): () => void;
|
|
3136
|
+
watch(callback: (event: TraceChangeEvent$1) => void): () => void;
|
|
4049
3137
|
/**
|
|
4050
|
-
*
|
|
4051
|
-
*
|
|
4052
|
-
*
|
|
4053
|
-
*
|
|
3138
|
+
* Generic pub-sub for annotation changes — every subclass gets a working
|
|
3139
|
+
* implementation "for free", even one with no annotation store of its own
|
|
3140
|
+
* (e.g. `MemoryTraceProvider`): nothing is ever delivered unless a caller
|
|
3141
|
+
* (the annotation REST handlers) explicitly calls {@link emitAnnotation}.
|
|
4054
3142
|
*/
|
|
4055
|
-
|
|
3143
|
+
subscribeAnnotations(traceId: string, callback: (event: AnnotationEvent$1) => void): () => void;
|
|
3144
|
+
emitAnnotation(traceId: string, op: AnnotationEventOp$1, annotation: Annotation$1): void;
|
|
3145
|
+
recordSpanStart(span: Span$1): Promise<Span$1>;
|
|
3146
|
+
recordSpanEnd(span: Span$1): Promise<Span$1>;
|
|
4056
3147
|
/**
|
|
4057
|
-
*
|
|
4058
|
-
* failed
|
|
3148
|
+
* Marks a trace that already ended as running again: its root span has just
|
|
3149
|
+
* been started anew (a failed run being retried), so the failure it recorded
|
|
3150
|
+
* is no longer its state.
|
|
4059
3151
|
*/
|
|
4060
|
-
private
|
|
4061
|
-
|
|
3152
|
+
private reopenTrace;
|
|
3153
|
+
failTrace(traceId: string, errorMessage: string): Promise<void>;
|
|
3154
|
+
protected emitStream(traceId: string, event: TraceStreamEvent$1): void;
|
|
3155
|
+
protected emitChange(event: TraceChangeEvent$1): void;
|
|
4062
3156
|
}
|
|
4063
3157
|
//#endregion
|
|
4064
|
-
//#region src/shared/instance-names.d.ts
|
|
4065
|
-
/**
|
|
4066
|
-
* What a run's resource instance may be named — shared by the server, which
|
|
4067
|
-
* refuses anything else, and the client, which says so before sending. See
|
|
4068
|
-
* `specs/resource-instances.md` §A.2.
|
|
4069
|
-
*/
|
|
4070
|
-
/** Whether `name` is a valid instance name: `[A-Za-z_][A-Za-z0-9_-]*`. */
|
|
4071
|
-
declare function isValidInstanceName(name: string): boolean;
|
|
4072
|
-
//#endregion
|
|
4073
3158
|
//#region src/trace/db/local-turso-client.d.ts
|
|
4074
3159
|
interface LocalTursoClientOptions {
|
|
4075
3160
|
/** Path to the local SQLite file (e.g. `<rootDir>/.evalution/trace.db`). */
|
|
@@ -4125,69 +3210,6 @@ declare function createLocalTursoClient({
|
|
|
4125
3210
|
/** The trace database's tables, described for someone writing SQL against them. */
|
|
4126
3211
|
declare const TRACE_QUERY_SCHEMA = "-- Trace database (SQLite). Timestamps are milliseconds since the Unix epoch.\n-- Columns marked JSON hold JSON text; read into them with json_extract(),\n-- e.g. json_extract(llm_parameters, '$.temperature').\n\n-- One row per trace: a single run, e.g. one prompt execution.\nCREATE TABLE traces (\n id TEXT PRIMARY KEY,\n provider_id TEXT, -- the trace provider that recorded it\n name TEXT NOT NULL, -- usually the prompt's name\n start_time REAL NOT NULL, -- ms since epoch\n end_time REAL, -- ms since epoch; NULL while running\n status TEXT NOT NULL, -- 'running' | 'ok' | 'error'\n attributes TEXT -- JSON object of free-form attributes\n);\n\n-- One row per span. Spans form a tree per trace via parent_id.\nCREATE TABLE spans (\n id TEXT PRIMARY KEY,\n trace_id TEXT NOT NULL, -- traces.id\n parent_id TEXT, -- spans.id; NULL for the root span\n name TEXT NOT NULL,\n kind TEXT NOT NULL, -- 'LLM' | 'TOOL' | 'AGENT' | 'EMBEDDING' | 'CHECK' | 'DEFAULT'\n start_time REAL NOT NULL, -- ms since epoch\n end_time REAL, -- ms since epoch; NULL while running\n status TEXT, -- 'ok' | 'error'; NULL while running\n error_message TEXT,\n llm_provider TEXT, -- e.g. 'openai', 'anthropic'\n llm_model TEXT, -- e.g. 'gpt-4o'\n llm_finish_reason TEXT, -- e.g. 'stop', 'length', 'tool-calls'\n llm_prompt_tokens INTEGER, -- includes cache reads and writes\n llm_completion_tokens INTEGER,\n llm_total_tokens INTEGER,\n llm_cache_read_tokens INTEGER, -- of llm_prompt_tokens, read from a prompt cache\n llm_cache_write_tokens INTEGER, -- of llm_prompt_tokens, written to a prompt cache\n llm_cost_prompt REAL, -- USD, cache reads and writes included\n llm_cost_completion REAL, -- USD\n llm_cost_cache_read REAL, -- USD, the part of llm_cost_prompt spent on cache reads\n llm_cost_cache_write REAL, -- USD, the part of llm_cost_prompt spent on cache writes\n llm_input TEXT, -- JSON: an array of messages {role, content}, or any JSON object\n llm_output TEXT, -- JSON: always encoded, so a text output is a JSON string\n llm_reasoning TEXT, -- the model's reasoning for this turn, as plain text\n llm_parameters TEXT, -- JSON object of model parameters (temperature, ...)\n attributes TEXT, -- JSON object of free-form attributes; \"evalution.check\" is set on spans an eval check recorded while judging the trace (its CHECK span and everything under it), which aren't part of the run\n resource TEXT, -- JSON object: the OTel resource that produced the span (\"service.name\", \"deployment.environment.name\" = 'playground' for runs evalution made, ...)\n prompt TEXT, -- JSON {id, providerId?, version?, variation?, functionInputs?, executeInputs?, ...}: the prompt this span ran\n tool TEXT -- JSON {toolName, input, output?} for TOOL spans\n);\n\n-- Notes left on a trace, or on one span of it.\nCREATE TABLE annotations (\n id TEXT PRIMARY KEY,\n trace_id TEXT NOT NULL, -- traces.id\n span_id TEXT, -- spans.id; NULL for a note on the whole trace\n kind TEXT NOT NULL, -- 'issue' | 'good' | 'note'\n note TEXT NOT NULL,\n source TEXT NOT NULL, -- 'user' | 'claude-code' | 'codex' | 'agent'\n created_at REAL NOT NULL -- ms since epoch\n);\n";
|
|
4127
3212
|
//#endregion
|
|
4128
|
-
//#region src/trace/http-trace-sink.d.ts
|
|
4129
|
-
/**
|
|
4130
|
-
* Where an evalution server accepts {@link TraceSinkEvent}s, relative to its
|
|
4131
|
-
* base URL.
|
|
4132
|
-
*/
|
|
4133
|
-
declare const TRACE_EVENTS_PATH = "/api/traces";
|
|
4134
|
-
/** One {@link TraceSink} call, as {@link HttpTraceSink} sends it. */
|
|
4135
|
-
type TraceSinkEvent = {
|
|
4136
|
-
type: "span-start";
|
|
4137
|
-
span: Span;
|
|
4138
|
-
} | {
|
|
4139
|
-
type: "span-end";
|
|
4140
|
-
span: Span;
|
|
4141
|
-
} | {
|
|
4142
|
-
type: "trace-fail";
|
|
4143
|
-
traceId: string;
|
|
4144
|
-
errorMessage: string;
|
|
4145
|
-
};
|
|
4146
|
-
/** The body of a `POST` to {@link TRACE_EVENTS_PATH}. */
|
|
4147
|
-
interface TraceEventsRequest {
|
|
4148
|
-
/** The events to record, in the order they happened. */
|
|
4149
|
-
events: TraceSinkEvent[];
|
|
4150
|
-
}
|
|
4151
|
-
/** Options for {@link HttpTraceSink}. */
|
|
4152
|
-
interface HttpTraceSinkOptions {
|
|
4153
|
-
/**
|
|
4154
|
-
* The evalution server's base URL, e.g. `http://localhost:3000`. Events are
|
|
4155
|
-
* posted to {@link TRACE_EVENTS_PATH} under it.
|
|
4156
|
-
*/
|
|
4157
|
-
endpoint: string;
|
|
4158
|
-
/** The `fetch` to send with. Defaults to the global one. */
|
|
4159
|
-
fetch?: typeof fetch;
|
|
4160
|
-
}
|
|
4161
|
-
/**
|
|
4162
|
-
* A {@link TraceSink} that sends what it's given to an evalution server,
|
|
4163
|
-
* which records it through its own trace providers — so an app's traces show
|
|
4164
|
-
* up in the playground without the app writing to a trace store itself.
|
|
4165
|
-
*
|
|
4166
|
-
* Calls return as soon as the event is queued, never waiting on the network,
|
|
4167
|
-
* so tracing doesn't slow the app down. Queued events go out in order, batched
|
|
4168
|
-
* into one request at a time, so a span's end never overtakes its start. A
|
|
4169
|
-
* request that fails is logged and its events dropped: tracing never breaks
|
|
4170
|
-
* the app. Await {@link flush} before a short-lived process exits to be sure
|
|
4171
|
-
* everything was sent.
|
|
4172
|
-
*/
|
|
4173
|
-
declare class HttpTraceSink implements TraceSink {
|
|
4174
|
-
private readonly url;
|
|
4175
|
-
private readonly fetch;
|
|
4176
|
-
private queue;
|
|
4177
|
-
private sending?;
|
|
4178
|
-
/** Whether the last request failed, so a down server is reported once. */
|
|
4179
|
-
private failing;
|
|
4180
|
-
constructor(options: HttpTraceSinkOptions);
|
|
4181
|
-
recordSpanStart(span: Span): Promise<Span>;
|
|
4182
|
-
recordSpanEnd(span: Span): Promise<Span>;
|
|
4183
|
-
failTrace(traceId: string, errorMessage: string): Promise<void>;
|
|
4184
|
-
/** Resolves once every event recorded so far has been sent (or dropped). */
|
|
4185
|
-
flush(): Promise<void>;
|
|
4186
|
-
private enqueue;
|
|
4187
|
-
private drain;
|
|
4188
|
-
private send;
|
|
4189
|
-
}
|
|
4190
|
-
//#endregion
|
|
4191
3213
|
//#region src/trace/local-database-trace-provider.d.ts
|
|
4192
3214
|
interface LocalDatabaseTraceProviderOptions {
|
|
4193
3215
|
/**
|
|
@@ -4238,12 +3260,12 @@ declare class LocalDatabaseTraceProvider extends BaseTraceProvider {
|
|
|
4238
3260
|
private ensureReal;
|
|
4239
3261
|
private open;
|
|
4240
3262
|
private bridgeTrace;
|
|
4241
|
-
getAllTraces(): Promise<TraceSummary[]>;
|
|
3263
|
+
getAllTraces(): Promise<TraceSummary$1[]>;
|
|
4242
3264
|
hasTrace(traceId: string): Promise<boolean>;
|
|
4243
|
-
protected getTraceWithoutSpans(): Promise<Trace | undefined>;
|
|
4244
|
-
protected getTraceSpans(): Promise<Span[]>;
|
|
3265
|
+
protected getTraceWithoutSpans(): Promise<Trace$1 | undefined>;
|
|
3266
|
+
protected getTraceSpans(): Promise<Span$1[]>;
|
|
4245
3267
|
protected addOrUpdateTrace(): Promise<void>;
|
|
4246
|
-
protected addOrUpdateSpan(): Promise<Span>;
|
|
3268
|
+
protected addOrUpdateSpan(): Promise<Span$1>;
|
|
4247
3269
|
protected removeTrace(): Promise<void>;
|
|
4248
3270
|
/**
|
|
4249
3271
|
* Deletes a trace, its spans and its annotations. Returns `false` if the database
|
|
@@ -4259,25 +3281,25 @@ declare class LocalDatabaseTraceProvider extends BaseTraceProvider {
|
|
|
4259
3281
|
query(sql: string, options?: SqlQueryOptions): Promise<SqlQueryResult>;
|
|
4260
3282
|
/** The tables {@link query} runs against. */
|
|
4261
3283
|
getQuerySchema(): string;
|
|
4262
|
-
getTrace(traceId: string): Promise<TraceWithSpans | undefined>;
|
|
4263
|
-
subscribeTrace(traceId: string, callback: (event: TraceStreamEvent) => void): () => void;
|
|
4264
|
-
recordSpanStart(span: Span): Promise<Span>;
|
|
4265
|
-
recordSpanEnd(span: Span): Promise<Span>;
|
|
3284
|
+
getTrace(traceId: string): Promise<TraceWithSpans$1 | undefined>;
|
|
3285
|
+
subscribeTrace(traceId: string, callback: (event: TraceStreamEvent$1) => void): () => void;
|
|
3286
|
+
recordSpanStart(span: Span$1): Promise<Span$1>;
|
|
3287
|
+
recordSpanEnd(span: Span$1): Promise<Span$1>;
|
|
4266
3288
|
failTrace(traceId: string, errorMessage: string): Promise<void>;
|
|
4267
3289
|
/** Lists every annotation on a trace, oldest first. Empty if nothing has been saved yet. */
|
|
4268
|
-
listAnnotations(traceId: string): Promise<Annotation[]>;
|
|
3290
|
+
listAnnotations(traceId: string): Promise<Annotation$1[]>;
|
|
4269
3291
|
/**
|
|
4270
3292
|
* Creates a new annotation, minting its `id`/`createdAt`. Unlike span
|
|
4271
3293
|
* recording, this throws when the database can't be opened — someone asked
|
|
4272
3294
|
* for this note to be saved, so dropping it silently would be worse than
|
|
4273
3295
|
* the error.
|
|
4274
3296
|
*/
|
|
4275
|
-
createAnnotation(input: Omit<Annotation, "id" | "createdAt">): Promise<Annotation>;
|
|
3297
|
+
createAnnotation(input: Omit<Annotation$1, "id" | "createdAt">): Promise<Annotation$1>;
|
|
4276
3298
|
/**
|
|
4277
3299
|
* Changes an annotation's `kind` and/or `note`. `undefined` if it doesn't
|
|
4278
3300
|
* exist — including when the database was never created.
|
|
4279
3301
|
*/
|
|
4280
|
-
updateAnnotation(id: string, changes: AnnotationChanges): Promise<Annotation | undefined>;
|
|
3302
|
+
updateAnnotation(id: string, changes: AnnotationChanges$1): Promise<Annotation$1 | undefined>;
|
|
4281
3303
|
/** Deletes an annotation by id. A no-op if the database was never created. */
|
|
4282
3304
|
deleteAnnotation(id: string): Promise<void>;
|
|
4283
3305
|
}
|
|
@@ -4318,9 +3340,9 @@ declare class MemoryTraceProvider extends BaseTraceProvider {
|
|
|
4318
3340
|
* `OTelTraceIngestor` should be active per server — {@link isRedundant}
|
|
4319
3341
|
* reports any other instance redundant so server wiring can consolidate.
|
|
4320
3342
|
*/
|
|
4321
|
-
declare class OTelTraceIngestor extends BaseTraceIngestor {
|
|
3343
|
+
declare class OTelTraceIngestor extends BaseTraceIngestor$1 {
|
|
4322
3344
|
private spanPromises;
|
|
4323
|
-
isRedundant(other: TraceIngestor): boolean;
|
|
3345
|
+
isRedundant(other: TraceIngestor$1): boolean;
|
|
4324
3346
|
/**
|
|
4325
3347
|
* Returns a `SpanProcessor` that funnels every OpenTelemetry span the
|
|
4326
3348
|
* caller's tracer produces into this ingestor's sinks.
|
|
@@ -4414,7 +3436,7 @@ declare function decodeOtlpProtobuf(buf: Uint8Array): {
|
|
|
4414
3436
|
* Storage-agnostic like every ingestor: works against `MemoryTraceProvider`
|
|
4415
3437
|
* in tests and any other `TraceSink` in production with no code change.
|
|
4416
3438
|
*/
|
|
4417
|
-
declare class OtlpTraceIngestor extends BaseTraceIngestor {
|
|
3439
|
+
declare class OtlpTraceIngestor extends BaseTraceIngestor$1 {
|
|
4418
3440
|
/** Ingests one OTLP export batch, already normalized by `./otlp/normalize.ts`. */
|
|
4419
3441
|
ingest(spans: NormalizedOtlpSpan[]): Promise<void>;
|
|
4420
3442
|
}
|
|
@@ -4439,7 +3461,7 @@ declare class OtlpTraceIngestor extends BaseTraceIngestor {
|
|
|
4439
3461
|
* over the old `errorMessage`, status or attributes would describe a failure
|
|
4440
3462
|
* the retry may not have had.
|
|
4441
3463
|
*/
|
|
4442
|
-
declare function mergeSpans(existing: Span, incoming: Span): Span;
|
|
3464
|
+
declare function mergeSpans(existing: Span$1, incoming: Span$1): Span$1;
|
|
4443
3465
|
//#endregion
|
|
4444
3466
|
//#region src/trace/trace-event-ingestor.d.ts
|
|
4445
3467
|
/**
|
|
@@ -4448,9 +3470,9 @@ declare function mergeSpans(existing: Span, incoming: Span): Span;
|
|
|
4448
3470
|
* {@link TraceSink} calls, so this just replays them, in order, on its own
|
|
4449
3471
|
* sinks.
|
|
4450
3472
|
*/
|
|
4451
|
-
declare class TraceEventIngestor extends BaseTraceIngestor {
|
|
3473
|
+
declare class TraceEventIngestor extends BaseTraceIngestor$1 {
|
|
4452
3474
|
/** Records one batch of events, in order. */
|
|
4453
|
-
ingest(events: TraceSinkEvent[]): Promise<void>;
|
|
3475
|
+
ingest(events: TraceSinkEvent$1[]): Promise<void>;
|
|
4454
3476
|
}
|
|
4455
3477
|
//#endregion
|
|
4456
3478
|
//#region src/trace/turso-trace-provider.d.ts
|
|
@@ -4499,7 +3521,7 @@ declare class TursoTraceProvider extends BaseTraceProvider {
|
|
|
4499
3521
|
* start or end in the same tick land here concurrently.
|
|
4500
3522
|
*/
|
|
4501
3523
|
private serializeWrite;
|
|
4502
|
-
getAllTraces(): Promise<TraceSummary[]>;
|
|
3524
|
+
getAllTraces(): Promise<TraceSummary$1[]>;
|
|
4503
3525
|
/**
|
|
4504
3526
|
* Runs one read-only query against the `traces`, `spans`, and
|
|
4505
3527
|
* `annotations` tables.
|
|
@@ -4508,9 +3530,9 @@ declare class TursoTraceProvider extends BaseTraceProvider {
|
|
|
4508
3530
|
/** The tables {@link query} runs against — see `./db/query-schema.ts`. */
|
|
4509
3531
|
getQuerySchema(): string;
|
|
4510
3532
|
hasTrace(traceId: string): Promise<boolean>;
|
|
4511
|
-
protected getTraceWithoutSpans(traceId: string): Promise<Trace | undefined>;
|
|
4512
|
-
protected getTraceSpans(traceId: string): Promise<Span[]>;
|
|
4513
|
-
protected addOrUpdateTrace(trace: Trace): Promise<void>;
|
|
3533
|
+
protected getTraceWithoutSpans(traceId: string): Promise<Trace$1 | undefined>;
|
|
3534
|
+
protected getTraceSpans(traceId: string): Promise<Span$1[]>;
|
|
3535
|
+
protected addOrUpdateTrace(trace: Trace$1): Promise<void>;
|
|
4514
3536
|
/**
|
|
4515
3537
|
* Deletes just the `traces` row — its spans go via the
|
|
4516
3538
|
* `trg_spans_cascade_delete_trace` trigger, and its annotations via their
|
|
@@ -4525,18 +3547,18 @@ declare class TursoTraceProvider extends BaseTraceProvider {
|
|
|
4525
3547
|
* `serializeWrite` slot), so a concurrent write can't interleave
|
|
4526
3548
|
* between the read and the write.
|
|
4527
3549
|
*/
|
|
4528
|
-
protected addOrUpdateSpan(span: Span): Promise<Span>;
|
|
3550
|
+
protected addOrUpdateSpan(span: Span$1): Promise<Span$1>;
|
|
4529
3551
|
/** Lists every annotation on a trace, oldest first. */
|
|
4530
|
-
listAnnotations(traceId: string): Promise<Annotation[]>;
|
|
3552
|
+
listAnnotations(traceId: string): Promise<Annotation$1[]>;
|
|
4531
3553
|
/** Creates a new annotation, minting its `id`/`createdAt`. */
|
|
4532
|
-
createAnnotation(input: Omit<Annotation, "id" | "createdAt">): Promise<Annotation>;
|
|
3554
|
+
createAnnotation(input: Omit<Annotation$1, "id" | "createdAt">): Promise<Annotation$1>;
|
|
4533
3555
|
/**
|
|
4534
3556
|
* Changes an annotation's `kind` and/or `note`. Returns it as updated, or
|
|
4535
3557
|
* `undefined` if it doesn't exist.
|
|
4536
3558
|
*/
|
|
4537
|
-
updateAnnotation(id: string, changes: AnnotationChanges): Promise<Annotation | undefined>;
|
|
3559
|
+
updateAnnotation(id: string, changes: AnnotationChanges$1): Promise<Annotation$1 | undefined>;
|
|
4538
3560
|
/** Deletes an annotation by id. A no-op if it doesn't exist. */
|
|
4539
3561
|
deleteAnnotation(id: string): Promise<void>;
|
|
4540
3562
|
}
|
|
4541
3563
|
//#endregion
|
|
4542
|
-
export { type AddPromptContext, type AddPromptField, type Annotation, type AnnotationChanges, type AnnotationEvent, type AnnotationEventOp, type AnnotationKind, type AnnotationSource, BaseTraceIngestor, BaseTraceProvider, CHECK_ATTRIBUTE, type CalleeBinding, type ChangeEventType, type ChatPromptUpdates, type Check, type CheckDefinition, type CheckInfo, type CheckOutcome, type CheckRun, type ColumnPath, type ConflictChoices, type CreateDatasetInput, DEFAULT_EVAL_CONCURRENCY, DEFAULT_MAX_QUERY_ROWS, DEFAULT_PLAYGROUND_IGNORE_PATTERNS, DEFAULT_PLAYGROUND_INCLUDE_PATTERNS, DEFAULT_QUERY_TIMEOUT_MS, DEPLOYMENT_ENVIRONMENT_ATTRIBUTE, type Dataset, type DatasetChangeEvent, type DatasetChangeType, type DatasetColumnSpec, type DatasetField, type DatasetFieldShape, type DatasetInstanceShape, DatasetNotFoundError, type DatasetPathChild, type DatasetProvider, type DatasetProviderInfo, type DatasetRow, type DatasetRowSource, type DatasetRowUpdate, type DatasetRowsOverview, type DatasetSummary, DatasetValidationError, type DeclaredInstance, type DynamicResourceDefinition, type EvalArm, type EvalArmSpec, type EvalChangeEvent, type EvalChangeType, type EvalCheck, type EvalCheckOutcome, type EvalCheckResult, type EvalCounts, type EvalDefinition, type EvalDefinitionPatch, type EvalInputs, EvalNotFoundError, type EvalProvider, type EvalProviderInfo, type EvalResults, type EvalRowResult, type EvalRowStatus, type EvalRun, type EvalRunProgress, EvalRunRefusedError, type EvalRunStatus, type EvalRunSummary, EvalRunner, type EvalRunnerOptions, type EvalSummary, type EvalTraceRun, type EvalutionConfig, type ExecuteConfigOptions, type ExecuteOptions, type ExecuteRequest, type ExecuteResponse, type ExecuteResult, type ExecutionHandle, type ExecutionInput, type ExtractedProps, type FactoriesProbe, type FieldValues, type FilePromptMetadata, FilePromptProvider, type FilePromptProviderOptions, type FileProvider, type FileWatchCallback, type FileWatchOptions, type ForeignColumnSpec,
|
|
3564
|
+
export { type AddPromptContext, type AddPromptField, type Annotation, type AnnotationChanges, type AnnotationEvent, type AnnotationEventOp, type AnnotationKind, type AnnotationSource, BaseTraceIngestor, BaseTraceProvider, CHECK_ATTRIBUTE, type CalleeBinding, type ChangeEventType, type ChatPromptUpdates, type Check, type CheckDefinition, type CheckInfo, type CheckOutcome, type CheckRun, type ColumnPath, type ConflictChoices, type CreateDatasetInput, DEFAULT_EVAL_CONCURRENCY, DEFAULT_MAX_QUERY_ROWS, DEFAULT_PLAYGROUND_IGNORE_PATTERNS, DEFAULT_PLAYGROUND_INCLUDE_PATTERNS, DEFAULT_QUERY_TIMEOUT_MS, DEPLOYMENT_ENVIRONMENT_ATTRIBUTE, type Dataset, type DatasetChangeEvent, type DatasetChangeType, type DatasetColumnSpec, type DatasetField, type DatasetFieldShape, type DatasetInstanceShape, DatasetNotFoundError, type DatasetPathChild, type DatasetProvider, type DatasetProviderInfo, type DatasetRow, type DatasetRowSource, type DatasetRowUpdate, type DatasetRowsOverview, type DatasetSummary, DatasetValidationError, type DeclaredInstance, type DynamicResourceDefinition, type EvalArm, type EvalArmSpec, type EvalChangeEvent, type EvalChangeType, type EvalCheck, type EvalCheckOutcome, type EvalCheckResult, type EvalCounts, type EvalDefinition, type EvalDefinitionPatch, type EvalInputs, EvalNotFoundError, type EvalProvider, type EvalProviderInfo, type EvalResults, type EvalRowResult, type EvalRowStatus, type EvalRun, type EvalRunProgress, EvalRunRefusedError, type EvalRunStatus, type EvalRunSummary, EvalRunner, type EvalRunnerOptions, type EvalSummary, type EvalTraceRun, Evalution, type EvalutionConfig, type EvalutionOptions, type ExecuteConfigOptions, type ExecuteOptions, type ExecuteRequest, type ExecuteResponse, type ExecuteResult, type ExecutionHandle, type ExecutionInput, type ExtractedProps, type FactoriesProbe, type FieldValues, type FilePromptMetadata, FilePromptProvider, type FilePromptProviderOptions, type FileProvider, type FileWatchCallback, type FileWatchOptions, type ForeignColumnSpec, GitVersioning, type GitVersioningOptions, type GlobOptions, type HeadState, HttpTraceSink, type HttpTraceSinkOptions, type HttpTraceTarget, type ImportOptions, type InputBindings, type InputLayout, type InputSignature, type InputSlot, type InputSource, type InstanceResolver, type KnownColumnSpec, type LLMSpanDetails, type ListRowsOptions, LocalDatabaseTraceProvider, type LocalDatabaseTraceProviderOptions, LocalDirectoryDatasetProvider, type LocalDirectoryDatasetProviderOptions, LocalEvalProvider, type LocalEvalProviderOptions, LocalFileProvider, type LocalTursoClientOptions, LocalVariationStore, MIGRATIONS_TABLE, MemoryFileProvider, MemoryTraceProvider, type MergeOutcome, type NewDatasetRow, type NewEvalDefinition, type NewEvalRun, type NewWip, type NormalizedChatPrompt, type NormalizedFilePrompt, type NormalizedMessage, type NormalizedOtlpEvent, type NormalizedOtlpSpan, type NormalizedParameter, type NormalizedPrompt, type NormalizedPromptBase, type NormalizedPromptUpdates, type NormalizedQuestionsPrompt, type NormalizedToolCall, OTelTraceIngestor, type OpenOnHeadOptions, OtlpTraceIngestor, OverlayFileProvider, PLAYGROUND_ENVIRONMENT, PLAYGROUND_RESOURCE, PROMPT_FIELD, PROMPT_ID_ATTRIBUTE, PROMPT_INPUTS_ATTRIBUTE, PROMPT_NAME_ATTRIBUTE, PROMPT_PROVIDER_ID_ATTRIBUTE, PROMPT_VARIATION_ATTRIBUTE, PROMPT_VERSION_ATTRIBUTE, type ParsePromptsOptions, type ParsedFilePrompt, type ParsedPrompt, type PendingConflicts, type PlaygroundModuleError, type PreparedCheck, type ProbeResult, type ProbeResults, type ProjectProbeRequest, type PromptChangeEvent, type PromptFileType, type PromptID, type PromptInputSources, type PromptProvider, type PromptProviderInfo, type PromptRef, type PromptRefLike, type PromptSpanInfo, type PromptStyle, type PromptVariations, type PromptVersions, type PromptsFactory, type PromptsHelper, type PromptsHelperOptions, type PropDefinition, type PropType, type PropValue, type QuestionsPromptUpdates, type ReadOnlyQueryRunner, type RebaseResult, type RegisteredCheck, type RegisteredResource, type RegisteredSource, type ResolutionContext, type ResolvedPromptInputs, type ResolvedResourceInputs, type Resource, type ResourceBinding, type ResourceDefinition, type ResourceInfo, type ResourceInput, type ResourceInputs, type ResourceInstance, type ResourceInstanceInput, type ResourceLease, type ResourceOutputDefinition, ResourceRegistry, type ResourceScope, type RunResources, type SDKAdapter, SERVICE_NAME_ATTRIBUTE, SPAN_KIND_ATTRIBUTE, type SlotMatchRequest, type SlotMatchSource, type SourceSpan, type Span, type SpanContentPart, type SpanImagePart, type SpanKind, type SpanMessage, type SpanMessageRole, type SpanReasoningPart, type SpanTextPart, type SpanToolCallPart, type SpanToolResultPart, SqlQueryError, type SqlQueryOptions, type SqlQueryResult, type StartEvalRunOptions, type StaticResourceDefinition, type StoredVariation, TRACE_EVENTS_PATH, TRACE_QUERY_SCHEMA, TSPromptFileType, type ToolSpanDetails, type Trace, type TraceChangeEvent, type TraceChangeType, type TraceCheckResult, type TraceEvalRun, TraceEventIngestor, type TraceEventsRequest, type TraceIngestor, type TraceLiveEvent, type TraceProvider, type TraceProviderInfo, type TraceSink, type TraceSinkEvent, type TraceStreamEvent, type TraceSummary, type TraceWithSpans, type TursoCreateDatasetOptions, TursoDatasetProvider, TursoEvalProvider, TursoTraceProvider, TursoVariationStore, type TypeExpressionProbe, type TypeProbe, type TypeProbeRequest, type TypeResolutionRequest, type TypeResolutionResult, type UpdatePromptResponse, type UpdatePromptResult, type ValueCatalog, type ValueCatalogGroup, type ValueCatalogPreset, type ValueFactory, type VariationConflict, VariationConflictError, type VariationContent, type VariationId, type VariationInfo, type VariationStore, type VersionHistoryOptions, type VersionId, type VersionInfo, type VersioningAdapter, type WipChanges, assertUpdateStyle, canonicalizeUpdates, check, collectInputSlots, createLocalTursoClient, createTracerForPrompt, decodeOtlpProtobuf, fieldValuesOf, findInputCycle, getPromptSpanAttributes, inputReferenceProblems, isCheck, isCheckSpan, isFreshImportHookRegistered, isResource, isStandardSchema, isValidInstanceName, isVariationLoaderHookRegistered, matchSourcesToSlots, mergeIntoWip, mergePromptIdentity, mergeSpans, mergeUpdates, namedBindings, normalizeOtlpRequest, openLocalEvalProvider, openLocalVariationStore, promptIdOf, rebaseUpdates, registerFreshImportHook, registerVariationLoaderHook, resolveConflicts, resolveExecutionInput, resolveExecutionInputs, resource, resourceParameterNames, runDatasetMigrations, runEvalMigrations, runMigrations, runVariationMigrations, serializeUpdates, setupGlobalOTelPipeline, spanMessages, stampReceipts, toPromptRef };
|