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
|
@@ -1,414 +1,8 @@
|
|
|
1
|
-
import { CalleeBinding, ExtractedProps, PropDefinition as PropDefinition$1, PropType, PropValue as PropValue$1, SourceSpan, ValueCatalog, ValueCatalogGroup, ValueCatalogPreset, ValueFactory
|
|
1
|
+
import { CalleeBinding, ExtractedProps, PropDefinition as PropDefinition$1, PropType, PropValue as PropValue$1, SourceSpan, ValueCatalog, ValueCatalogGroup, ValueCatalogPreset, ValueFactory } from "ts-proppy";
|
|
2
|
+
import { Annotation as Annotation$1, AnnotationChanges as AnnotationChanges$1, AnnotationEvent as AnnotationEvent$1, AnnotationEventOp as AnnotationEventOp$1, AnnotationKind, AnnotationSource, EvalCounts, LLMSpanDetails, PromptID, PromptID as PromptID$1, Span as Span$1, SpanContentPart, SpanImagePart, SpanKind, SpanMessage, SpanMessageRole, SpanReasoningPart, SpanTextPart, SpanToolCallPart, SpanToolResultPart, ToolSpanDetails, Trace as Trace$1, TraceChangeEvent, TraceChangeEvent as TraceChangeEvent$1, TraceChangeType, TraceEvalRun, TraceEvalRun as TraceEvalRun$1, TraceLiveEvent, TraceProviderInfo, TraceStreamEvent as TraceStreamEvent$1, TraceSummary as TraceSummary$1, TraceWithSpans, TraceWithSpans as TraceWithSpans$1 } from "@evalution/sdk";
|
|
3
|
+
import { ChatPromptUpdates, FieldValues, InputLayout, NormalizedChatPrompt, NormalizedMessage, NormalizedParameter, NormalizedPrompt, NormalizedPrompt as NormalizedPrompt$1, NormalizedPromptBase, NormalizedPromptUpdates, NormalizedQuestionsPrompt, NormalizedToolCall, ParsedPrompt, PendingConflicts, PromptInputSources, PromptRef, PromptRef as PromptRef$1, PromptStyle, QuestionsPromptUpdates, ResourceInfo, ResourceScope, VariationConflict, VariationConflict as VariationConflict$1, VariationId, VariationId as VariationId$1, VariationInfo, VariationInfo as VariationInfo$1, VersionId, VersionId as VersionId$1, VersionInfo } from "@evalution/sdk/adapter";
|
|
2
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
5
|
|
|
4
|
-
//#region src/trace/trace-types.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* A reference to a prompt.
|
|
7
|
-
*
|
|
8
|
-
* `id` is interpreted as a globally-unique prompt ID unless `providerId` is
|
|
9
|
-
* present, in which case `id` is scoped to that specific prompt provider. This
|
|
10
|
-
* mirrors the OpenTelemetry attributes `evalution.prompt.id` (always present)
|
|
11
|
-
* and `evalution.prompt.provider.id` (optional, scoping).
|
|
12
|
-
*/
|
|
13
|
-
interface PromptID {
|
|
14
|
-
/** The prompt ID — global unless {@link providerId} scopes it. */
|
|
15
|
-
id: string;
|
|
16
|
-
/** When set, {@link id} is scoped to this prompt provider. */
|
|
17
|
-
providerId?: string;
|
|
18
|
-
/** Positional arguments the prompt function was called with. */
|
|
19
|
-
functionParameters?: unknown[];
|
|
20
|
-
/**
|
|
21
|
-
* The unresolved inputs the run was launched with — the recipe, not the
|
|
22
|
-
* resolution.
|
|
23
|
-
*
|
|
24
|
-
* Replaying them is only exactly faithful for the `value` kind. A `resource`
|
|
25
|
-
* re-runs its `create()`, producing an *equivalent* value rather than the
|
|
26
|
-
* same one — a fresh handle, a newly seeded row — so a UI must present it as
|
|
27
|
-
* something that will be re-created, never as a restored value.
|
|
28
|
-
*/
|
|
29
|
-
functionInputs?: unknown[];
|
|
30
|
-
/** The unresolved execute-parameter inputs, keyed by parameter name. */
|
|
31
|
-
executeInputs?: Record<string, unknown>;
|
|
32
|
-
/**
|
|
33
|
-
* The run's named resource instances, by name, with the receipt each
|
|
34
|
-
* `create()` produced. See `specs/resource-instances.md` §F.
|
|
35
|
-
*/
|
|
36
|
-
resources?: Record<string, unknown>;
|
|
37
|
-
/**
|
|
38
|
-
* The prompt's parameter definitions as they stood when the run was
|
|
39
|
-
* launched, so a replay can diff them against today's signature rather than
|
|
40
|
-
* guess whether the recorded inputs still fit.
|
|
41
|
-
*/
|
|
42
|
-
parameterDefinitions?: unknown[];
|
|
43
|
-
/**
|
|
44
|
-
* The prompt's execute-parameter definitions as they stood when the run was
|
|
45
|
-
* launched — the types of {@link executeInputs}, as
|
|
46
|
-
* {@link parameterDefinitions} is for {@link functionInputs}.
|
|
47
|
-
*/
|
|
48
|
-
executeParameterDefinitions?: unknown[];
|
|
49
|
-
/** The version the run executed against. */
|
|
50
|
-
version?: string;
|
|
51
|
-
/** The variation applied on top of {@link version}, if any. */
|
|
52
|
-
variation?: string;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Classification of a {@link Span}. See also:
|
|
56
|
-
* - `lmnr.span.type` from https://laminar.sh/docs/tracing/otel
|
|
57
|
-
* - `mlflow.spanType` from https://mlflow.org/docs/latest/genai/tracing/opentelemetry/attribute-mapping/#translated-span-attributes
|
|
58
|
-
*
|
|
59
|
-
* Mapped from `gen_ai.operation.name`. `CHECK` is evalution's own: an eval
|
|
60
|
-
* check that traced something while judging the run — see
|
|
61
|
-
* {@link CHECK_ATTRIBUTE}.
|
|
62
|
-
*/
|
|
63
|
-
type SpanKind = "LLM" | "TOOL" | "AGENT" | "EMBEDDING" | "CHECK" | "DEFAULT";
|
|
64
|
-
/**
|
|
65
|
-
* Span attribute naming the eval check (by its id within the eval) that
|
|
66
|
-
* recorded the span while judging the trace — set on the check's `CHECK` span
|
|
67
|
-
* and on everything under it. Those spans aren't part of the run being
|
|
68
|
-
* judged, so the trace's rollups and chat view leave them out.
|
|
69
|
-
*/
|
|
70
|
-
declare const CHECK_ATTRIBUTE = "evalution.check";
|
|
71
|
-
/** Whether `span` was recorded by a check judging its trace, not by the run. */
|
|
72
|
-
declare function isCheckSpan(span: Pick<Span, "attributes">): boolean;
|
|
73
|
-
/** A text segment within a multi-part {@link SpanMessage} content. */
|
|
74
|
-
interface SpanTextPart {
|
|
75
|
-
type: "text";
|
|
76
|
-
text: string;
|
|
77
|
-
}
|
|
78
|
-
/** An image segment within a multi-part {@link SpanMessage} content. */
|
|
79
|
-
interface SpanImagePart {
|
|
80
|
-
type: "image";
|
|
81
|
-
/** A URL, or base64/data-URI image data. */
|
|
82
|
-
image: string;
|
|
83
|
-
/** MIME type (e.g. `image/png`), when known. */
|
|
84
|
-
mediaType?: string;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* A tool call the assistant made, within a multi-part {@link SpanMessage}
|
|
88
|
-
* content. Matched to its {@link SpanToolResultPart} by `toolCallId`.
|
|
89
|
-
*/
|
|
90
|
-
interface SpanToolCallPart {
|
|
91
|
-
type: "tool-call";
|
|
92
|
-
toolCallId: string;
|
|
93
|
-
toolName: string;
|
|
94
|
-
/** The arguments the model passed, as JSON. */
|
|
95
|
-
input: unknown;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* A tool's result fed back to the model, within a multi-part
|
|
99
|
-
* {@link SpanMessage} content (usually a `tool` message).
|
|
100
|
-
*/
|
|
101
|
-
interface SpanToolResultPart {
|
|
102
|
-
type: "tool-result";
|
|
103
|
-
toolCallId: string;
|
|
104
|
-
toolName: string;
|
|
105
|
-
/** What the tool returned, unwrapped from the SDK's output envelope. */
|
|
106
|
-
output: unknown;
|
|
107
|
-
/** Whether the result reports a failure (an error, or a denied call). */
|
|
108
|
-
isError?: boolean;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* The reasoning (thinking) a model produced ahead of its answer, within a
|
|
112
|
-
* multi-part {@link SpanMessage} content — how a conversation's earlier
|
|
113
|
-
* assistant turns carry theirs. The turn a span records keeps its own in
|
|
114
|
-
* {@link LLMSpanDetails.reasoning}.
|
|
115
|
-
*/
|
|
116
|
-
interface SpanReasoningPart {
|
|
117
|
-
type: "reasoning";
|
|
118
|
-
text: string;
|
|
119
|
-
}
|
|
120
|
-
type SpanMessageRole = "user" | "assistant" | "system" | "tool" | (string & {});
|
|
121
|
-
/** One segment of a multi-part {@link SpanMessage} content. */
|
|
122
|
-
type SpanContentPart = SpanTextPart | SpanImagePart | SpanToolCallPart | SpanToolResultPart | SpanReasoningPart;
|
|
123
|
-
/**
|
|
124
|
-
* A single message within an LLM span's input/output.
|
|
125
|
-
*
|
|
126
|
-
* `content` is a plain string for the common text-only case. It is an array
|
|
127
|
-
* of {@link SpanContentPart} when the message carries non-text content (e.g.
|
|
128
|
-
* an image, or a tool call or result) — the `string` form stays in the union so existing consumers and
|
|
129
|
-
* already-stored rows keep working unchanged.
|
|
130
|
-
*/
|
|
131
|
-
interface SpanMessage {
|
|
132
|
-
role: SpanMessageRole;
|
|
133
|
-
content: string | SpanContentPart[];
|
|
134
|
-
}
|
|
135
|
-
/** LLM-specific attributes attached to `LLM` spans. */
|
|
136
|
-
interface LLMSpanDetails {
|
|
137
|
-
provider?: string;
|
|
138
|
-
model?: string;
|
|
139
|
-
/** Model parameters (temperature, max_tokens, …). */
|
|
140
|
-
modelParameters?: Record<string, unknown>;
|
|
141
|
-
/**
|
|
142
|
-
* Why the model stopped generating, as the provider or SDK reports it
|
|
143
|
-
* (`stop`, `length`, `tool-calls`, …). Not normalized across providers.
|
|
144
|
-
*/
|
|
145
|
-
finishReason?: string;
|
|
146
|
-
/**
|
|
147
|
-
* What the model was given: a message list for a chat model, or any JSON
|
|
148
|
-
* for a model that takes something else (a System One call records
|
|
149
|
-
* `{ state, questions }`). Array-ness is the discriminant — see
|
|
150
|
-
* {@link spanMessages}.
|
|
151
|
-
*/
|
|
152
|
-
input?: SpanMessage[] | {
|
|
153
|
-
[key: string]: unknown;
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* What it returned: text for a chat model, the assistant message of a turn
|
|
157
|
-
* that called tools (see `toolCallingOutput`), or JSON for structured
|
|
158
|
-
* output and for any model whose answer is data rather than prose.
|
|
159
|
-
*/
|
|
160
|
-
output?: unknown;
|
|
161
|
-
/**
|
|
162
|
-
* The reasoning the model produced on the way to {@link output}, kept apart
|
|
163
|
-
* from it so an output stays the answer that checks and agents read.
|
|
164
|
-
*/
|
|
165
|
-
reasoning?: string;
|
|
166
|
-
/** Input tokens, counting any read from or written to a prompt cache. */
|
|
167
|
-
promptTokens?: number;
|
|
168
|
-
completionTokens?: number;
|
|
169
|
-
totalTokens?: number;
|
|
170
|
-
/** How many of {@link promptTokens} were read from a prompt cache. */
|
|
171
|
-
cacheReadTokens?: number;
|
|
172
|
-
/** How many of {@link promptTokens} were written to a prompt cache. */
|
|
173
|
-
cacheWriteTokens?: number;
|
|
174
|
-
/**
|
|
175
|
-
* Dollar cost of the call, broken down by token type, if known. The total
|
|
176
|
-
* cost is `cost.prompt + cost.completion`; `cost.prompt` includes cache
|
|
177
|
-
* reads and writes, each at its own price.
|
|
178
|
-
*/
|
|
179
|
-
cost?: {
|
|
180
|
-
prompt: number;
|
|
181
|
-
completion: number; /** The part of `prompt` spent on {@link cacheReadTokens}. */
|
|
182
|
-
cacheRead?: number; /** The part of `prompt` spent on {@link cacheWriteTokens}. */
|
|
183
|
-
cacheWrite?: number;
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* The message list of a chat call, or `undefined` for any other input.
|
|
188
|
-
*
|
|
189
|
-
* A chat call's {@link LLMSpanDetails.input} is always a message list, and
|
|
190
|
-
* anything else is wrapped in an object, so being an array is what makes it
|
|
191
|
-
* one.
|
|
192
|
-
*/
|
|
193
|
-
declare function spanMessages(llm: LLMSpanDetails | undefined): SpanMessage[] | undefined;
|
|
194
|
-
interface ToolSpanDetails {
|
|
195
|
-
toolName: string;
|
|
196
|
-
/**
|
|
197
|
-
* The id the model gave this call, when the integration reports it — the
|
|
198
|
-
* same id as the {@link SpanToolCallPart} that requested it.
|
|
199
|
-
*/
|
|
200
|
-
toolCallId?: string;
|
|
201
|
-
input: unknown;
|
|
202
|
-
output?: unknown;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* A span in a {@link Trace}. Spans form a tree via {@link parentId}.
|
|
206
|
-
* Durations are derived from `startTime` and `endTime`; an in-progress span has
|
|
207
|
-
* no `endTime` yet.
|
|
208
|
-
*/
|
|
209
|
-
interface Span {
|
|
210
|
-
id: string;
|
|
211
|
-
traceId: string;
|
|
212
|
-
/** `undefined` for the root span of the trace. */
|
|
213
|
-
parentId?: string;
|
|
214
|
-
name: string;
|
|
215
|
-
kind: SpanKind;
|
|
216
|
-
/** Start timestamp in milliseconds since epoch. */
|
|
217
|
-
startTime: number;
|
|
218
|
-
/** End timestamp in milliseconds since epoch, or `undefined` while running. */
|
|
219
|
-
endTime?: number;
|
|
220
|
-
status?: "ok" | "error";
|
|
221
|
-
/** Error message if `status` is `'error'`. */
|
|
222
|
-
errorMessage?: string;
|
|
223
|
-
/** Free-form attributes to show in the span's details pane. */
|
|
224
|
-
attributes?: Record<string, unknown>;
|
|
225
|
-
/**
|
|
226
|
-
* The OpenTelemetry resource that produced the span: attributes describing
|
|
227
|
-
* the process or service it ran in rather than the span itself
|
|
228
|
-
* (`service.name`, `deployment.environment.name`, …).
|
|
229
|
-
*/
|
|
230
|
-
resource?: Record<string, unknown>;
|
|
231
|
-
/** LLM-specific details (present for `chat`/`completion`/`embedding` spans). */
|
|
232
|
-
llm?: LLMSpanDetails;
|
|
233
|
-
/**
|
|
234
|
-
* The prompt this span is attributed to, if any.
|
|
235
|
-
*
|
|
236
|
-
* Stored as emitted (`evalution.prompt.id` plus optional
|
|
237
|
-
* `evalution.prompt.provider.id`): a {@link PromptID} whose `id` is global
|
|
238
|
-
* unless `providerId` is set. The server resolves it against the prompt
|
|
239
|
-
* registry to a provider-scoped reference when a trace is served.
|
|
240
|
-
*/
|
|
241
|
-
prompt?: PromptID;
|
|
242
|
-
tool?: ToolSpanDetails;
|
|
243
|
-
}
|
|
244
|
-
interface TraceBase {
|
|
245
|
-
id: string;
|
|
246
|
-
providerId?: string;
|
|
247
|
-
name: string;
|
|
248
|
-
/** Start timestamp (ms). */
|
|
249
|
-
startTime: number;
|
|
250
|
-
/** End timestamp (ms), or `undefined` while the trace is still running. */
|
|
251
|
-
endTime?: number;
|
|
252
|
-
status: "running" | "ok" | "error";
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Top-level trace for a single invocation (e.g. one prompt execution).
|
|
256
|
-
*/
|
|
257
|
-
interface Trace extends TraceBase {
|
|
258
|
-
/** Free-form attributes (e.g. prompt ID, function params). */
|
|
259
|
-
attributes?: Record<string, unknown>;
|
|
260
|
-
}
|
|
261
|
-
/** Compact trace entry for listings (sidebar / `GET /api/traces`). */
|
|
262
|
-
interface TraceSummary extends TraceBase {
|
|
263
|
-
providerId: string;
|
|
264
|
-
/** Number of spans currently associated with the trace. */
|
|
265
|
-
spanCount: number;
|
|
266
|
-
/**
|
|
267
|
-
* Sum of every LLM span's token usage (`llm.totalTokens`, falling back to
|
|
268
|
-
* `promptTokens + completionTokens` per span the way `SpanDetails` does).
|
|
269
|
-
* `undefined` if no span in the trace reports any token usage.
|
|
270
|
-
*/
|
|
271
|
-
totalTokens?: number;
|
|
272
|
-
/** Sum of every LLM span's `llm.cost` (prompt + completion). `undefined` if no span reports a cost. */
|
|
273
|
-
cost?: number;
|
|
274
|
-
/** The model name, if every LLM span that reports one reports the same one. */
|
|
275
|
-
model?: string;
|
|
276
|
-
/** The prompt version the run executed against (`PromptID.version`). */
|
|
277
|
-
promptVersion?: string;
|
|
278
|
-
/** The prompt variation the run applied (`PromptID.variation`). */
|
|
279
|
-
promptVariation?: string;
|
|
280
|
-
/**
|
|
281
|
-
* The deployment environment the run happened in: its root span's
|
|
282
|
-
* resource's `deployment.environment.name` — `"playground"` for a run
|
|
283
|
-
* evalution itself made.
|
|
284
|
-
*/
|
|
285
|
-
environment?: string;
|
|
286
|
-
/** How many annotations of each kind are attached to the trace (trace-level or on any of its spans). */
|
|
287
|
-
annotationCounts: Record<AnnotationKind, number>;
|
|
288
|
-
/**
|
|
289
|
-
* The eval run that produced the trace, if any. Trace providers never set
|
|
290
|
-
* it — the server fills it in when listing, from the eval providers' results
|
|
291
|
-
* and the runs in flight.
|
|
292
|
-
*/
|
|
293
|
-
evalRun?: TraceEvalRun;
|
|
294
|
-
/**
|
|
295
|
-
* How the checks recorded against the trace break down, once it has any.
|
|
296
|
-
* Filled in by the server alongside {@link TraceSummary.evalRun}.
|
|
297
|
-
*/
|
|
298
|
-
checkCounts?: EvalCounts;
|
|
299
|
-
}
|
|
300
|
-
/** How a run's, or a trace's, check results break down. */
|
|
301
|
-
interface EvalCounts {
|
|
302
|
-
pass: number;
|
|
303
|
-
fail: number;
|
|
304
|
-
error: number;
|
|
305
|
-
skipped: number;
|
|
306
|
-
/** Scores reported without a threshold, so neither pass nor fail. */
|
|
307
|
-
scored: number;
|
|
308
|
-
}
|
|
309
|
-
/** The eval run a trace came from — what the trace list groups by. */
|
|
310
|
-
interface TraceEvalRun {
|
|
311
|
-
/** The eval provider the run is recorded on. */
|
|
312
|
-
providerId: string;
|
|
313
|
-
evalId: string;
|
|
314
|
-
/** The eval's name. */
|
|
315
|
-
evalName: string;
|
|
316
|
-
runId: string;
|
|
317
|
-
/** When the run started (ms). */
|
|
318
|
-
startedAt: number;
|
|
319
|
-
/** The arm of the run that produced the trace. */
|
|
320
|
-
armId: string;
|
|
321
|
-
/** That arm's label: the version it ran, as the run view names it. */
|
|
322
|
-
armLabel: string;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* The OpenTelemetry semantic-convention resource attribute naming the
|
|
326
|
-
* service that produced a span.
|
|
327
|
-
*/
|
|
328
|
-
declare const SERVICE_NAME_ATTRIBUTE = "service.name";
|
|
329
|
-
/**
|
|
330
|
-
* The OpenTelemetry semantic-convention resource attribute naming the
|
|
331
|
-
* deployment environment a span was produced in.
|
|
332
|
-
*/
|
|
333
|
-
declare const DEPLOYMENT_ENVIRONMENT_ATTRIBUTE = "deployment.environment.name";
|
|
334
|
-
/** {@link DEPLOYMENT_ENVIRONMENT_ATTRIBUTE}'s value on a run evalution itself made. */
|
|
335
|
-
declare const PLAYGROUND_ENVIRONMENT = "playground";
|
|
336
|
-
/** A trace together with all of its spans. */
|
|
337
|
-
interface TraceWithSpans {
|
|
338
|
-
trace: Trace;
|
|
339
|
-
spans: Span[];
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Where an {@link Annotation} came from: the user, a coding agent we know by
|
|
343
|
-
* name, or any other agent (an MCP client that isn't Claude Code or Codex).
|
|
344
|
-
*/
|
|
345
|
-
type AnnotationSource = "user" | "claude-code" | "codex" | "agent";
|
|
346
|
-
/** What kind of note an {@link Annotation} records. */
|
|
347
|
-
type AnnotationKind = "issue" | "good" | "note";
|
|
348
|
-
/**
|
|
349
|
-
* A note attached to a trace, or to one specific span within it — e.g. a
|
|
350
|
-
* reviewer flagging a bad tool call, or an agent leaving a note about a run
|
|
351
|
-
* it just replayed.
|
|
352
|
-
*/
|
|
353
|
-
interface Annotation {
|
|
354
|
-
id: string;
|
|
355
|
-
traceId: string;
|
|
356
|
-
/** The span this annotation is attached to, or `undefined` for a trace-level annotation. */
|
|
357
|
-
spanId?: string;
|
|
358
|
-
kind: AnnotationKind;
|
|
359
|
-
note: string;
|
|
360
|
-
source: AnnotationSource;
|
|
361
|
-
/** Creation timestamp (ms). */
|
|
362
|
-
createdAt: number;
|
|
363
|
-
}
|
|
364
|
-
/** The fields of an {@link Annotation} that can be changed after it's made. */
|
|
365
|
-
type AnnotationChanges = Partial<Pick<Annotation, "kind" | "note">>;
|
|
366
|
-
/** The kind of change that occurred to a trace. */
|
|
367
|
-
type TraceChangeType = "add" | "update" | "remove";
|
|
368
|
-
/** Describes a single change emitted by `TraceProvider.watch`. */
|
|
369
|
-
interface TraceChangeEvent {
|
|
370
|
-
type: TraceChangeType;
|
|
371
|
-
traceId: string;
|
|
372
|
-
}
|
|
373
|
-
/** Real-time event pushed over the per-trace SSE subscription. */
|
|
374
|
-
type TraceStreamEvent = {
|
|
375
|
-
type: "span-start";
|
|
376
|
-
span: Span;
|
|
377
|
-
} | {
|
|
378
|
-
type: "span-end";
|
|
379
|
-
span: Span;
|
|
380
|
-
} | {
|
|
381
|
-
type: "span-update";
|
|
382
|
-
span: Span;
|
|
383
|
-
} | {
|
|
384
|
-
type: "trace-update";
|
|
385
|
-
trace: Trace;
|
|
386
|
-
} | {
|
|
387
|
-
type: "trace-end";
|
|
388
|
-
trace: Trace;
|
|
389
|
-
};
|
|
390
|
-
/** The change an annotation event describes. */
|
|
391
|
-
type AnnotationEventOp = "insert" | "update" | "delete";
|
|
392
|
-
/** The event a per-trace annotation subscription delivers. */
|
|
393
|
-
interface AnnotationEvent {
|
|
394
|
-
type: "annotation";
|
|
395
|
-
op: AnnotationEventOp;
|
|
396
|
-
annotation: Annotation;
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* Real-time event pushed over the per-trace SSE subscription, broadened
|
|
400
|
-
* beyond span/trace lifecycle to also carry annotation changes — so a client
|
|
401
|
-
* holding one `EventSource` open on a trace sees both without a second
|
|
402
|
-
* connection. See `specs/trace-workshopping.md` §C.2.
|
|
403
|
-
*/
|
|
404
|
-
type TraceLiveEvent = TraceStreamEvent | AnnotationEvent;
|
|
405
|
-
/** Information about a registered trace provider, returned by `GET /api/trace-providers`. */
|
|
406
|
-
interface TraceProviderInfo {
|
|
407
|
-
id: string;
|
|
408
|
-
displayName?: string;
|
|
409
|
-
description?: string;
|
|
410
|
-
}
|
|
411
|
-
//#endregion
|
|
412
6
|
//#region src/eval/eval-types.d.ts
|
|
413
7
|
/** One check, as an eval uses it. See `specs/evals.md` §A. */
|
|
414
8
|
interface EvalCheck {
|
|
@@ -478,10 +72,10 @@ type EvalArmSpec = {
|
|
|
478
72
|
kind: "head";
|
|
479
73
|
} | {
|
|
480
74
|
kind: "wip";
|
|
481
|
-
variation: VariationId;
|
|
75
|
+
variation: VariationId$1;
|
|
482
76
|
} | {
|
|
483
77
|
kind: "variation";
|
|
484
|
-
variation: VariationId;
|
|
78
|
+
variation: VariationId$1;
|
|
485
79
|
label?: string;
|
|
486
80
|
};
|
|
487
81
|
/** One arm of a run, as it was set up when the run started. */
|
|
@@ -493,13 +87,13 @@ interface EvalArm {
|
|
|
493
87
|
/** What was asked for. */
|
|
494
88
|
spec: EvalArmSpec;
|
|
495
89
|
/** What every row of this arm runs. Absent when {@link error} is set. */
|
|
496
|
-
ref?: PromptRef;
|
|
90
|
+
ref?: PromptRef$1;
|
|
497
91
|
/** The frozen, rebased variation the arm's rows run, when it runs one. */
|
|
498
|
-
rebasedTo?: VariationId;
|
|
92
|
+
rebasedTo?: VariationId$1;
|
|
499
93
|
/** Why the arm didn't run — a rebase conflict, say. */
|
|
500
94
|
error?: string;
|
|
501
95
|
/** The conflicts, when {@link error} is a rebase conflict. */
|
|
502
|
-
conflicts?: VariationConflict[];
|
|
96
|
+
conflicts?: VariationConflict$1[];
|
|
503
97
|
}
|
|
504
98
|
/** A run's lifecycle. */
|
|
505
99
|
type EvalRunStatus = "running" | "done" | "cancelled" | "error";
|
|
@@ -509,7 +103,7 @@ interface NewEvalRun {
|
|
|
509
103
|
definition: EvalDefinition;
|
|
510
104
|
arms: EvalArm[];
|
|
511
105
|
/** The commit checked out at start, on a clean tree. */
|
|
512
|
-
startVersion?: VersionId;
|
|
106
|
+
startVersion?: VersionId$1;
|
|
513
107
|
/** Whether the working tree had uncommitted changes at start. */
|
|
514
108
|
dirty: boolean;
|
|
515
109
|
/** How many (arm, row) runs may be in flight at once. */
|
|
@@ -538,7 +132,7 @@ interface EvalRunSummary {
|
|
|
538
132
|
evalId: string;
|
|
539
133
|
status: EvalRunStatus;
|
|
540
134
|
arms: Pick<EvalArm, "id" | "label" | "error">[];
|
|
541
|
-
startVersion?: VersionId;
|
|
135
|
+
startVersion?: VersionId$1;
|
|
542
136
|
dirty: boolean;
|
|
543
137
|
drifted: boolean;
|
|
544
138
|
startedAt: number;
|
|
@@ -585,9 +179,9 @@ interface EvalRowResult {
|
|
|
585
179
|
traceProviderId?: string;
|
|
586
180
|
traceId?: string;
|
|
587
181
|
/** The version the row ran against, on a clean tree. */
|
|
588
|
-
version?: VersionId;
|
|
182
|
+
version?: VersionId$1;
|
|
589
183
|
/** The variation the row applied. */
|
|
590
|
-
variation?: VariationId;
|
|
184
|
+
variation?: VariationId$1;
|
|
591
185
|
status: EvalRowStatus;
|
|
592
186
|
/** Why the row errored or was skipped. */
|
|
593
187
|
error?: string;
|
|
@@ -660,273 +254,6 @@ interface EvalProviderInfo {
|
|
|
660
254
|
}
|
|
661
255
|
//#endregion
|
|
662
256
|
//#region src/shared/types.d.ts
|
|
663
|
-
/**
|
|
664
|
-
* Low-level prompt representation produced by a
|
|
665
|
-
* {@link PromptFileType}. It exposes the raw `extractedProps` from the parser
|
|
666
|
-
* and uses SDK-specific property names (e.g. `model`, `system`, `messages`).
|
|
667
|
-
*
|
|
668
|
-
* Not intended for public consumption — {@link PromptProvider} implementations
|
|
669
|
-
* convert this into a {@link NormalizedPrompt} via an {@link SDKAdapter} before
|
|
670
|
-
* returning it to callers.
|
|
671
|
-
*/
|
|
672
|
-
interface ParsedPrompt {
|
|
673
|
-
id: string;
|
|
674
|
-
providerId?: string;
|
|
675
|
-
/**
|
|
676
|
-
* Author-supplied stable alias for this prompt, globally unique across
|
|
677
|
-
* providers. Survives file moves/renames and is registered in the prompt
|
|
678
|
-
* registry so runtime traces can resolve back to this prompt.
|
|
679
|
-
*/
|
|
680
|
-
globalId?: string;
|
|
681
|
-
name: string;
|
|
682
|
-
functionParameters: PropDefinition$1[];
|
|
683
|
-
extractedProps: ExtractedProps;
|
|
684
|
-
metadata?: unknown;
|
|
685
|
-
treePath?: string[];
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* A single message in a conversation, in a form that is independent of any
|
|
689
|
-
* particular SDK's message shape.
|
|
690
|
-
*/
|
|
691
|
-
interface NormalizedMessage {
|
|
692
|
-
/** Role identifier (`'system'`, `'user'`, `'assistant'`, `'tool'`, …). */
|
|
693
|
-
role: string;
|
|
694
|
-
/** Message content. Typically a primitive or template string, but any
|
|
695
|
-
* {@link PropValue} is allowed so non-string content (e.g. structured
|
|
696
|
-
* content arrays) can round-trip through the editor. */
|
|
697
|
-
content: PropValue$1;
|
|
698
|
-
/** Optional tool calls attached to an assistant message. */
|
|
699
|
-
toolCalls?: NormalizedToolCall[];
|
|
700
|
-
}
|
|
701
|
-
/** A tool invocation emitted by an assistant message. */
|
|
702
|
-
interface NormalizedToolCall {
|
|
703
|
-
/** The name of the tool / function to invoke. */
|
|
704
|
-
toolName: string;
|
|
705
|
-
/** Arguments to the tool, as a JSON string. */
|
|
706
|
-
args: string;
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* A model parameter (`temperature`, `maxTokens`, …) attached to a prompt.
|
|
710
|
-
* Mirrors the `PropDefinition` + current value pair that the playground UI
|
|
711
|
-
* needs for rendering a parameter editor.
|
|
712
|
-
*/
|
|
713
|
-
interface NormalizedParameter {
|
|
714
|
-
/** Describes the parameter's name, type, and documentation. */
|
|
715
|
-
def: PropDefinition$1;
|
|
716
|
-
/** The parameter's current value, or `undefined` if not set on the prompt. */
|
|
717
|
-
value?: PropValue$1;
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* What every {@link NormalizedPrompt} has, whatever its {@link PromptStyle}.
|
|
721
|
-
*/
|
|
722
|
-
interface NormalizedPromptBase {
|
|
723
|
-
id: string;
|
|
724
|
-
providerId?: string;
|
|
725
|
-
/**
|
|
726
|
-
* Author-supplied stable alias for this prompt, globally unique across
|
|
727
|
-
* providers. Survives file moves/renames and is registered in the prompt
|
|
728
|
-
* registry so runtime traces can resolve back to this prompt.
|
|
729
|
-
*/
|
|
730
|
-
globalId?: string;
|
|
731
|
-
name: string;
|
|
732
|
-
functionParameters: PropDefinition$1[];
|
|
733
|
-
metadata?: unknown;
|
|
734
|
-
/**
|
|
735
|
-
* Controls where this prompt appears in the sidebar tree.
|
|
736
|
-
*
|
|
737
|
-
* Each element is a path segment. The last segment is treated as the leaf
|
|
738
|
-
* group label (analogous to a file name) and all preceding segments are
|
|
739
|
-
* rendered as collapsible directory nodes.
|
|
740
|
-
*
|
|
741
|
-
* Prompts that share the same `treePath` are grouped under the same leaf
|
|
742
|
-
* node. When omitted, the prompt is placed at the root level.
|
|
743
|
-
*
|
|
744
|
-
* @example ['src', 'prompts', 'greeting.prompt.ts']
|
|
745
|
-
*/
|
|
746
|
-
treePath?: string[];
|
|
747
|
-
/** The model reference (e.g. a provider call or gateway string). */
|
|
748
|
-
model?: PropValue$1;
|
|
749
|
-
/**
|
|
750
|
-
* Whether this SDK lets the model be chosen from the playground.
|
|
751
|
-
*
|
|
752
|
-
* A capability of the SDK, not a verdict on the current value: an editor
|
|
753
|
-
* also checks that the value itself has an editable shape (see
|
|
754
|
-
* `isEditable`), and renders read-only when either answer is no.
|
|
755
|
-
*/
|
|
756
|
-
modelEditable: boolean;
|
|
757
|
-
/**
|
|
758
|
-
* Model parameters currently set on the prompt (everything that isn't
|
|
759
|
-
* part of the style's own authored content).
|
|
760
|
-
*/
|
|
761
|
-
modelParameters: NormalizedParameter[];
|
|
762
|
-
/**
|
|
763
|
-
* False when the model parameters can't be changed here — a saved
|
|
764
|
-
* variation shown read-only, say. Absent means they can.
|
|
765
|
-
*/
|
|
766
|
-
modelParametersEditable?: boolean;
|
|
767
|
-
/**
|
|
768
|
-
* Named values the SDK needs to **execute** the config this prompt renders,
|
|
769
|
-
* supplied at run time rather than authored in the file.
|
|
770
|
-
*
|
|
771
|
-
* Distinct from {@link functionParameters}, which answers *what does this
|
|
772
|
-
* prompt take?* — this answers *what does running it require?*, which the
|
|
773
|
-
* function signature cannot express. The Vercel AI SDK's `toolsContext` is
|
|
774
|
-
* the motivating case: tools that declare a `contextSchema` need a context
|
|
775
|
-
* object the prompt function never sees.
|
|
776
|
-
*
|
|
777
|
-
* Absent when the prompt needs nothing beyond its arguments. Present with an
|
|
778
|
-
* unresolved type when the requirement is known but its shape is not — a
|
|
779
|
-
* usable state, and better than the silent failure at the first tool call
|
|
780
|
-
* that omitting it would produce.
|
|
781
|
-
*/
|
|
782
|
-
executeParameters?: PropDefinition$1[];
|
|
783
|
-
/**
|
|
784
|
-
* Non-authored sources that can fill this prompt's input slots — currently
|
|
785
|
-
* code-defined resources. Absent when the provider offers none.
|
|
786
|
-
*/
|
|
787
|
-
inputSources?: PromptInputSources;
|
|
788
|
-
/**
|
|
789
|
-
* Slot path → how to lay out a fan-out slot's fields in the execute panel.
|
|
790
|
-
* Any path not named here uses `"expanded"`.
|
|
791
|
-
*
|
|
792
|
-
* Set by an {@link SDKAdapter} whose own API shape is the reason a slot
|
|
793
|
-
* fans out — e.g. the Vercel AI SDK's `toolsContext`, which is keyed per
|
|
794
|
-
* tool because tools are resolved individually, not because prompt authors
|
|
795
|
-
* think in terms of separate contexts. Mirrors the `functionSlots` /
|
|
796
|
-
* `executeSlots` split on {@link PromptInputSources}, which exists for the
|
|
797
|
-
* same reason: a function parameter and an execute parameter may share a
|
|
798
|
-
* name.
|
|
799
|
-
*/
|
|
800
|
-
inputLayout?: {
|
|
801
|
-
functionSlots?: Record<string, InputLayout>;
|
|
802
|
-
executeSlots?: Record<string, InputLayout>;
|
|
803
|
-
};
|
|
804
|
-
/**
|
|
805
|
-
* Where this prompt was read from. Absent when the provider has no notion
|
|
806
|
-
* of versions, in which case the prompt is always head.
|
|
807
|
-
*/
|
|
808
|
-
ref?: PromptRef;
|
|
809
|
-
/** The base version, when {@link ref} is a version or a variation. */
|
|
810
|
-
version?: VersionInfo;
|
|
811
|
-
/** The variation, when {@link ref} names one. */
|
|
812
|
-
variation?: VariationInfo;
|
|
813
|
-
/**
|
|
814
|
-
* True when a WIP variation exists for this prompt at head — the dirty
|
|
815
|
-
* indicator. Reported on the head prompt, whatever ref is open.
|
|
816
|
-
*/
|
|
817
|
-
dirty?: boolean;
|
|
818
|
-
/** The id of the head WIP variation, when {@link dirty}. */
|
|
819
|
-
wipId?: VariationId;
|
|
820
|
-
/**
|
|
821
|
-
* True when this prompt's base is the working tree, so it can run. False
|
|
822
|
-
* for an old version, or a variation made against one.
|
|
823
|
-
*/
|
|
824
|
-
atHead?: boolean;
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* An opaque, immutable name for a state of the world — for a git project, a
|
|
828
|
-
* commit.
|
|
829
|
-
*/
|
|
830
|
-
type VersionId = string;
|
|
831
|
-
/** An opaque id for a {@link VariationInfo | variation}. */
|
|
832
|
-
type VariationId = string;
|
|
833
|
-
/**
|
|
834
|
-
* Which prompt, in which state.
|
|
835
|
-
*
|
|
836
|
-
* A variation already knows its base, so `{ variation }` is complete. There is
|
|
837
|
-
* deliberately no `{ version, variation }` pair: that is a rebase, which
|
|
838
|
-
* produces a new variation with its own id.
|
|
839
|
-
*/
|
|
840
|
-
type PromptRef = /** Head: the prompt as it is on disk now. */{
|
|
841
|
-
promptId: string;
|
|
842
|
-
version?: undefined;
|
|
843
|
-
variation?: undefined;
|
|
844
|
-
} /** The prompt as it was at a saved version. */ | {
|
|
845
|
-
promptId: string;
|
|
846
|
-
version: VersionId;
|
|
847
|
-
variation?: undefined;
|
|
848
|
-
} /** A variation, applied to its base commit (or the working tree, without one). */ | {
|
|
849
|
-
promptId: string;
|
|
850
|
-
variation: VariationId;
|
|
851
|
-
version?: undefined;
|
|
852
|
-
};
|
|
853
|
-
/** A saved state of the world: a commit. See {@link VersionId}. */
|
|
854
|
-
interface VersionInfo {
|
|
855
|
-
id: VersionId;
|
|
856
|
-
/** Commit subject. */
|
|
857
|
-
message?: string;
|
|
858
|
-
author?: string;
|
|
859
|
-
/** When the version was made (ms). */
|
|
860
|
-
time: number;
|
|
861
|
-
}
|
|
862
|
-
/**
|
|
863
|
-
* A prompt's field values, keyed like a variation's fields (`system`,
|
|
864
|
-
* `modelParameters.temperature`, …) — `null` for a field the prompt doesn't
|
|
865
|
-
* have.
|
|
866
|
-
*/
|
|
867
|
-
type FieldValues = Record<string, unknown>;
|
|
868
|
-
/**
|
|
869
|
-
* One field that could not be merged: both sides changed it, differently.
|
|
870
|
-
* `field` is `"system"`, `"modelParameters.temperature"`, or the pseudo-field
|
|
871
|
-
* `"prompt"` when the prompt itself no longer exists at the target.
|
|
872
|
-
*/
|
|
873
|
-
interface VariationConflict {
|
|
874
|
-
field: string;
|
|
875
|
-
/** The value both sides started from. */
|
|
876
|
-
base: unknown;
|
|
877
|
-
/** The value on the side being merged into (head, or the unsaved edits). */
|
|
878
|
-
target: unknown;
|
|
879
|
-
/** The value the variation wants. */
|
|
880
|
-
variation: unknown;
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* Conflicts a WIP variation is waiting on the user to resolve. While present,
|
|
884
|
-
* the WIP can neither run nor be saved.
|
|
885
|
-
*/
|
|
886
|
-
interface PendingConflicts {
|
|
887
|
-
/**
|
|
888
|
-
* The working tree's values for every field involved, as they were when
|
|
889
|
-
* the conflict arose: what the resolved WIP is based on.
|
|
890
|
-
*/
|
|
891
|
-
targetValues: FieldValues;
|
|
892
|
-
/** Every field that did merge, already applied. */
|
|
893
|
-
updates: NormalizedPromptUpdates;
|
|
894
|
-
conflicts: VariationConflict[];
|
|
895
|
-
/** How to label each side in the UI. */
|
|
896
|
-
labels: {
|
|
897
|
-
target: string;
|
|
898
|
-
variation: string;
|
|
899
|
-
};
|
|
900
|
-
}
|
|
901
|
-
/**
|
|
902
|
-
* An immutable set of {@link NormalizedPromptUpdates} for one prompt — or,
|
|
903
|
-
* when {@link wip}, the one mutable set of unsaved edits per (prompt, base).
|
|
904
|
-
* It applies to the working tree; its {@link base} commit, when it has one,
|
|
905
|
-
* is where it can also be shown (and one day run) as it was made.
|
|
906
|
-
*/
|
|
907
|
-
interface VariationInfo {
|
|
908
|
-
id: VariationId;
|
|
909
|
-
promptId: string;
|
|
910
|
-
/**
|
|
911
|
-
* The commit whose copy of the prompt's file the variation was made
|
|
912
|
-
* against. Absent when that file had uncommitted changes (or there's no
|
|
913
|
-
* git), and for a WIP of unsaved edits to the working tree.
|
|
914
|
-
*/
|
|
915
|
-
base?: VersionId;
|
|
916
|
-
updates: NormalizedPromptUpdates;
|
|
917
|
-
/** Whether this is a work-in-progress (unsaved, mutable) variation. */
|
|
918
|
-
wip: boolean;
|
|
919
|
-
/** For a WIP: whether it holds the unsaved edits to head. */
|
|
920
|
-
onHead?: boolean;
|
|
921
|
-
/** Names pointing at this variation. */
|
|
922
|
-
names: string[];
|
|
923
|
-
/** For a WIP opened from a named variation: that name. */
|
|
924
|
-
originName?: string;
|
|
925
|
-
/** For a WIP: conflicts awaiting resolution. */
|
|
926
|
-
pending?: PendingConflicts;
|
|
927
|
-
createdAt: number;
|
|
928
|
-
updatedAt: number;
|
|
929
|
-
}
|
|
930
257
|
/** What rebasing or merging a variation produced. */
|
|
931
258
|
type RebaseResult = {
|
|
932
259
|
ok: true;
|
|
@@ -944,163 +271,6 @@ type RebaseResult = {
|
|
|
944
271
|
* keep the target's value, or the variation's.
|
|
945
272
|
*/
|
|
946
273
|
type ConflictChoices = Record<string, "target" | "variation">;
|
|
947
|
-
/**
|
|
948
|
-
* Which kind of editor a prompt is authored in. Chosen by the
|
|
949
|
-
* {@link SDKAdapter}, since it is the SDK's request shape that decides it.
|
|
950
|
-
*
|
|
951
|
-
* A closed set: the client is a prebuilt bundle, so an adapter picks among
|
|
952
|
-
* the editors it has rather than shipping its own.
|
|
953
|
-
*/
|
|
954
|
-
type PromptStyle = NormalizedPrompt["style"];
|
|
955
|
-
/** A model driven by a system message and a conversation. */
|
|
956
|
-
interface NormalizedChatPrompt extends NormalizedPromptBase {
|
|
957
|
-
style: "chat";
|
|
958
|
-
/** Top-level system prompt, if the SDK supports one. */
|
|
959
|
-
system?: PropValue$1;
|
|
960
|
-
/** Whether this SDK supports an arbitrary system message. */
|
|
961
|
-
systemEditable: boolean;
|
|
962
|
-
/** Conversation messages. */
|
|
963
|
-
messages: NormalizedMessage[];
|
|
964
|
-
/** Whether this SDK supports an arbitrary message list. */
|
|
965
|
-
messagesEditable: boolean;
|
|
966
|
-
}
|
|
967
|
-
/** A model that answers a set of named questions about a state. */
|
|
968
|
-
interface NormalizedQuestionsPrompt extends NormalizedPromptBase {
|
|
969
|
-
style: "questions";
|
|
970
|
-
/** What the questions are asked about. `def` is the SDK's state type. */
|
|
971
|
-
state: NormalizedParameter;
|
|
972
|
-
/** Whether this SDK supports an arbitrary state. */
|
|
973
|
-
stateEditable: boolean;
|
|
974
|
-
/**
|
|
975
|
-
* The questions, as one value: an object whose property names are question
|
|
976
|
-
* ids. `def` is the SDK's type for the whole collection — a `record` whose
|
|
977
|
-
* value definition carries a catalog of question factories.
|
|
978
|
-
*/
|
|
979
|
-
questions: NormalizedParameter;
|
|
980
|
-
/** Whether this SDK supports adding, removing and editing questions. */
|
|
981
|
-
questionsEditable: boolean;
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Prompt representation used by {@link PromptProvider} public methods and by
|
|
985
|
-
* the playground UI. It hides SDK-specific property names behind a stable
|
|
986
|
-
* shape, discriminated by {@link PromptStyle}.
|
|
987
|
-
*
|
|
988
|
-
* {@link SDKAdapter.normalizePrompt} converts a {@link ParsedPrompt} produced
|
|
989
|
-
* by a {@link PromptFileType} into this form.
|
|
990
|
-
*/
|
|
991
|
-
type NormalizedPrompt = NormalizedChatPrompt | NormalizedQuestionsPrompt;
|
|
992
|
-
/** How a fan-out slot's fields are laid out in the execute panel. */
|
|
993
|
-
type InputLayout = "combined" | "expanded";
|
|
994
|
-
/** How long a resource's value lives, and how often `create()` runs. */
|
|
995
|
-
type ResourceScope = "run" | "server";
|
|
996
|
-
/**
|
|
997
|
-
* A code-defined resource offered as an input source, as the UI sees it.
|
|
998
|
-
*
|
|
999
|
-
* The resource's *value* never crosses the wire — the whole point is that only
|
|
1000
|
-
* running code can produce it — so this is just enough to render a chip and
|
|
1001
|
-
* send the choice back as an {@link ExecutionInput}.
|
|
1002
|
-
*/
|
|
1003
|
-
interface ResourceInfo {
|
|
1004
|
-
/**
|
|
1005
|
-
* Provider-interpreted reference to this resource, relative to the
|
|
1006
|
-
* provider's root so it stays valid on another machine (e.g.
|
|
1007
|
-
* `.evalution/playground/db.ts#db`).
|
|
1008
|
-
*/
|
|
1009
|
-
uri: string;
|
|
1010
|
-
/** Human-readable label shown on the chip. */
|
|
1011
|
-
label: string;
|
|
1012
|
-
/** How long the created value lives. See {@link ResourceScope}. */
|
|
1013
|
-
scope: ResourceScope;
|
|
1014
|
-
/**
|
|
1015
|
-
* Why this resource is unavailable, if it is — typically its module threw
|
|
1016
|
-
* at import time. Surfaced in the panel rather than hidden, so a broken
|
|
1017
|
-
* playground module is visible instead of silently absent.
|
|
1018
|
-
*/
|
|
1019
|
-
error?: string;
|
|
1020
|
-
/**
|
|
1021
|
-
* A snapshot of the resource's current value, so the panel can preview it
|
|
1022
|
-
* instead of just naming it. Present only when the server already has an
|
|
1023
|
-
* instance to peek at — a static `value` resource, or a `scope: 'server'`
|
|
1024
|
-
* one it has already created — and that instance's value is plain JSON
|
|
1025
|
-
* data. A run-scoped resource, or one whose value isn't plain data (a live
|
|
1026
|
-
* handle), has nothing here; the chip is all there is to show.
|
|
1027
|
-
*/
|
|
1028
|
-
value?: unknown;
|
|
1029
|
-
/**
|
|
1030
|
-
* Group path this source is displayed under, outermost first. Absent means
|
|
1031
|
-
* top level. Purely display metadata — never part of {@link uri} — so
|
|
1032
|
-
* renaming a group invalidates no saved selection. See
|
|
1033
|
-
* `specs/resource-hierarchy.md` §B.
|
|
1034
|
-
*/
|
|
1035
|
-
group?: string[];
|
|
1036
|
-
/**
|
|
1037
|
-
* For a value source (one read off another resource): the `uri` of the
|
|
1038
|
-
* resource it is read from. Absent for the resource itself.
|
|
1039
|
-
*/
|
|
1040
|
-
parent?: string;
|
|
1041
|
-
/**
|
|
1042
|
-
* For a value source: how many values that resource exposes in total,
|
|
1043
|
-
* before slot matching narrows them down for a particular slot. Only the
|
|
1044
|
-
* provider can supply this — after filtering, the panel cannot tell "this
|
|
1045
|
-
* resource exposes one value" from "it exposes five and four don't fit
|
|
1046
|
-
* here", and those read differently once a submenu collapses to its one
|
|
1047
|
-
* remaining entry.
|
|
1048
|
-
*/
|
|
1049
|
-
siblings?: number;
|
|
1050
|
-
/**
|
|
1051
|
-
* The resource's declared arguments, as slots for the panel to render —
|
|
1052
|
-
* one per schema-valued entry of its `inputs`, in declaration order.
|
|
1053
|
-
* Absent when the resource takes none. Present with an unresolved (generic
|
|
1054
|
-
* string) editor when the requirement is known but its shape is not —
|
|
1055
|
-
* the checker-less degradation, same idiom as
|
|
1056
|
-
* {@link NormalizedPrompt.executeParameters}.
|
|
1057
|
-
*
|
|
1058
|
-
* Only the resource itself carries this — a value source (`parent` set)
|
|
1059
|
-
* shares its root resource's arguments rather than repeating them. See
|
|
1060
|
-
* `specs/resource-arguments.md` §G.
|
|
1061
|
-
*/
|
|
1062
|
-
parameters?: PropDefinition$1[];
|
|
1063
|
-
/**
|
|
1064
|
-
* The resource's code-wired dependencies — its resource-valued `inputs`
|
|
1065
|
-
* entries — as input name → the dependency's {@link uri}. Only the
|
|
1066
|
-
* resource itself carries this, and only for dependencies discovery
|
|
1067
|
-
* registered. The panel lists them in its Resources section. See
|
|
1068
|
-
* `specs/resource-instances.md` §D.
|
|
1069
|
-
*/
|
|
1070
|
-
dependencies?: Record<string, string>;
|
|
1071
|
-
}
|
|
1072
|
-
/**
|
|
1073
|
-
* Which non-authored sources can fill which of a prompt's input slots.
|
|
1074
|
-
*
|
|
1075
|
-
* Matching runs provider-side, where the checker lives (see
|
|
1076
|
-
* `matchResourcesToSlots`), and ships as slot paths so the panel can offer a
|
|
1077
|
-
* source without re-deriving the rules.
|
|
1078
|
-
*/
|
|
1079
|
-
interface PromptInputSources {
|
|
1080
|
-
/** Every resource in scope for this prompt, identified by `uri`. */
|
|
1081
|
-
resources: ResourceInfo[];
|
|
1082
|
-
/**
|
|
1083
|
-
* Dotted slot path within {@link NormalizedPrompt.functionParameters}
|
|
1084
|
-
* (`taskId`, `ctx.db`) → URIs of the resources that can fill it.
|
|
1085
|
-
*/
|
|
1086
|
-
functionSlots: Record<string, string[]>;
|
|
1087
|
-
/**
|
|
1088
|
-
* Dotted slot path within {@link NormalizedPrompt.executeParameters}
|
|
1089
|
-
* (`toolsContext.list_tasks.db`) → URIs of the resources that can fill it.
|
|
1090
|
-
*/
|
|
1091
|
-
executeSlots: Record<string, string[]>;
|
|
1092
|
-
/**
|
|
1093
|
-
* Resource URI → (argument slot path → URIs of sources that can fill it).
|
|
1094
|
-
*
|
|
1095
|
-
* Separate from {@link functionSlots} / {@link executeSlots} and keyed by
|
|
1096
|
-
* URI rather than folded into the slot path, because an argument slot is a
|
|
1097
|
-
* property of the *resource*, not of the prompt: the same resource offers
|
|
1098
|
-
* the same arguments in every prompt that can see it. Absent when no
|
|
1099
|
-
* resource in scope declares arguments. See
|
|
1100
|
-
* `specs/resource-arguments.md` §G.
|
|
1101
|
-
*/
|
|
1102
|
-
resourceSlots?: Record<string, Record<string, string[]>>;
|
|
1103
|
-
}
|
|
1104
274
|
/**
|
|
1105
275
|
* One prompt input, *before* resolution — the recipe rather than the value.
|
|
1106
276
|
*
|
|
@@ -1205,31 +375,6 @@ interface CheckInfo {
|
|
|
1205
375
|
/** Set when the module failed to load or the definition is invalid. */
|
|
1206
376
|
error?: string;
|
|
1207
377
|
}
|
|
1208
|
-
/** Updates to a {@link NormalizedChatPrompt}. `null` removes a field. */
|
|
1209
|
-
interface ChatPromptUpdates {
|
|
1210
|
-
style: "chat";
|
|
1211
|
-
model?: PropValue$1 | null;
|
|
1212
|
-
system?: PropValue$1 | null;
|
|
1213
|
-
messages?: NormalizedMessage[] | null;
|
|
1214
|
-
/** Per-parameter updates, keyed by parameter name. `null` removes. */
|
|
1215
|
-
modelParameters?: Record<string, PropValue$1 | null>;
|
|
1216
|
-
}
|
|
1217
|
-
/** Updates to a {@link NormalizedQuestionsPrompt}. `null` removes a field. */
|
|
1218
|
-
interface QuestionsPromptUpdates {
|
|
1219
|
-
style: "questions";
|
|
1220
|
-
model?: PropValue$1 | null;
|
|
1221
|
-
state?: PropValue$1 | null;
|
|
1222
|
-
questions?: PropValue$1 | null;
|
|
1223
|
-
/** Per-parameter updates, keyed by parameter name. `null` removes. */
|
|
1224
|
-
modelParameters?: Record<string, PropValue$1 | null>;
|
|
1225
|
-
}
|
|
1226
|
-
/**
|
|
1227
|
-
* Updates that can be applied to a {@link NormalizedPrompt} via
|
|
1228
|
-
* {@link PromptProvider.updatePromptProperties}, in the vocabulary of the
|
|
1229
|
-
* prompt's {@link PromptStyle}. A value of `null` removes that field from the
|
|
1230
|
-
* underlying source.
|
|
1231
|
-
*/
|
|
1232
|
-
type NormalizedPromptUpdates = ChatPromptUpdates | QuestionsPromptUpdates;
|
|
1233
378
|
/** The kind of change that occurred to a prompt. */
|
|
1234
379
|
type ChangeEventType = "change" | "add" | "remove";
|
|
1235
380
|
/**
|
|
@@ -1950,4 +1095,4 @@ declare function check<const N extends ResourceInputs = Record<string, never>>(d
|
|
|
1950
1095
|
/** Whether `value` was produced by {@link check}. */
|
|
1951
1096
|
declare function isCheck(value: unknown): value is Check;
|
|
1952
1097
|
//#endregion
|
|
1953
|
-
export {
|
|
1098
|
+
export { FieldValues as $, VariationConflict$1 as $t, DatasetRowsOverview as A, SpanImagePart as At, AnnotationEvent$1 as B, TraceChangeEvent$1 as Bt, DatasetFieldShape as C, EvalSummary as Cn, ResourceInfo as Ct, DatasetRow as D, TraceCheckResult as Dn, SourceSpan as Dt, DatasetProviderInfo as E, NewEvalRun as En, RunResources as Et, KnownColumnSpec as F, SpanTextPart as Ft, ChangeEventType as G, TraceStreamEvent$1 as Gt, AnnotationKind as H, TraceEvalRun$1 as Ht, AddPromptContext as I, SpanToolCallPart as It, ConflictChoices as J, UpdatePromptResponse as Jt, ChatPromptUpdates as K, TraceSummary$1 as Kt, AddPromptField as L, SpanToolResultPart as Lt, ColumnPath as M, SpanMessage as Mt, DatasetColumnSpec as N, SpanMessageRole as Nt, DatasetRowSource as O, Span$1 as Ot, ForeignColumnSpec as P, SpanReasoningPart as Pt, ExtractedProps as Q, ValueFactory as Qt, Annotation$1 as R, ToolSpanDetails as Rt, DatasetField as S, EvalRunSummary as Sn, RebaseResult as St, DatasetPathChild as T, NewEvalDefinition as Tn, ResourceScope as Tt, AnnotationSource as U, TraceLiveEvent as Ut, AnnotationEventOp$1 as V, TraceChangeType as Vt, CalleeBinding as W, TraceProviderInfo as Wt, ExecuteResponse as X, ValueCatalogGroup as Xt, ExecuteRequest as Y, ValueCatalog as Yt, ExecutionInput as Z, ValueCatalogPreset as Zt, isStandardSchema as _, EvalRowResult as _n, PromptStyle as _t, check as a, EvalArmSpec as an, NormalizedPrompt$1 as at, DatasetChangeEvent as b, EvalRunProgress as bn, PropValue$1 as bt, ResolvedResourceInputs as c, EvalCheck as cn, NormalizedQuestionsPrompt as ct, ResourceInput as d, EvalCounts as dn, PendingConflicts as dt, VariationId$1 as en, InputLayout as et, ResourceInputs as f, EvalDefinition as fn, PromptChangeEvent as ft, isResource as g, EvalResults as gn, PromptRef$1 as gt, StaticResourceDefinition as h, EvalProviderInfo as hn, PromptProviderInfo as ht, CheckRun as i, EvalArm as in, NormalizedParameter as it, DatasetSummary as j, SpanKind as jt, DatasetRowUpdate as k, SpanContentPart as kt, Resource as l, EvalCheckOutcome as ln, NormalizedToolCall as lt, ResourceOutputDefinition as m, EvalInputs as mn, PromptInputSources as mt, CheckDefinition as n, VersionId$1 as nn, NormalizedChatPrompt as nt, isCheck as o, EvalChangeEvent as on, NormalizedPromptBase as ot, ResourceInstance as p, EvalDefinitionPatch as pn, PromptID$1 as pt, CheckInfo as q, TraceWithSpans$1 as qt, CheckOutcome as r, VersionInfo as rn, NormalizedMessage as rt, DynamicResourceDefinition as s, EvalChangeType as sn, NormalizedPromptUpdates as st, Check as t, VariationInfo$1 as tn, LLMSpanDetails as tt, ResourceDefinition as u, EvalCheckResult as un, ParsedPrompt as ut, resource as v, EvalRowStatus as vn, PropDefinition$1 as vt, DatasetInstanceShape as w, EvalTraceRun as wn, ResourceInstanceInput as wt, DatasetChangeType as x, EvalRunStatus as xn, QuestionsPromptUpdates as xt, Dataset as y, EvalRun as yn, PropType as yt, AnnotationChanges$1 as z, Trace$1 as zt };
|