@granular-software/sdk 0.4.41 → 0.4.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-evals.d.mts +137 -3
- package/dist/agent-evals.d.ts +137 -3
- package/dist/agent-evals.js +1197 -79
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +1197 -81
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/agent-harness.d.mts +60 -1
- package/dist/agent-harness.d.ts +60 -1
- package/dist/agent-harness.js +475 -0
- package/dist/agent-harness.js.map +1 -1
- package/dist/agent-harness.mjs +467 -1
- package/dist/agent-harness.mjs.map +1 -1
- package/dist/cli/index.js +282 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +597 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +589 -54
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/agent-evals.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as EnvironmentSession, G as Granular } from './client-CBQFvuKf.mjs';
|
|
2
|
-
import { G as GranularSpendContext, h as OpenAITokenSpend, P as Prompt,
|
|
3
|
-
import { GranularAgentToolInfo, GeneratedJobCodeIssue, HarnessControllerBudgets } from './agent-harness.mjs';
|
|
2
|
+
import { G as GranularSpendContext, h as OpenAITokenSpend, P as Prompt, ba as RecordObjectOptions, bM as ManifestContent, c as SessionHeapSnapshot, T as ToolWithHandler, C as ConnectOptions, a6 as CreateEnvironmentData, q as GranularOptions } from './spend-tAz2a16I.mjs';
|
|
3
|
+
import { GranularAgentToolInfo, GeneratedJobCodeIssue, BuildGranularAgentSystemPromptInput, HarnessRenderedPrompt, HarnessRenderedContinuation, HarnessControllerBudgets } from './agent-harness.mjs';
|
|
4
4
|
import '@automerge/automerge';
|
|
5
5
|
import '@automerge/automerge/slim';
|
|
6
6
|
import '@granular-software/policy-engine';
|
|
@@ -26,6 +26,8 @@ interface AgentEvalGenerationInput {
|
|
|
26
26
|
onTextDelta?: (delta: string) => void | Promise<void>;
|
|
27
27
|
usageContext?: GranularSpendContext;
|
|
28
28
|
}
|
|
29
|
+
type AgentEvalPromptRenderer = (input: BuildGranularAgentSystemPromptInput) => HarnessRenderedPrompt;
|
|
30
|
+
type AgentEvalContinuationRenderer = (resultPreview?: string) => HarnessRenderedContinuation;
|
|
29
31
|
interface AgentEvalGenerationOutput {
|
|
30
32
|
reply?: string;
|
|
31
33
|
code?: string;
|
|
@@ -82,6 +84,92 @@ interface AgentEvalExpectations {
|
|
|
82
84
|
actionExcludes?: EvalMatcher[];
|
|
83
85
|
codeIncludes?: EvalMatcher[];
|
|
84
86
|
codeExcludes?: EvalMatcher[];
|
|
87
|
+
behaviorBuckets?: string[];
|
|
88
|
+
actions?: {
|
|
89
|
+
required?: EvalMatcher[];
|
|
90
|
+
forbidden?: EvalMatcher[];
|
|
91
|
+
};
|
|
92
|
+
prompts?: {
|
|
93
|
+
requiredChoiceWhenAmbiguous?: boolean;
|
|
94
|
+
requiredConfirmationBefore?: EvalMatcher[];
|
|
95
|
+
forbiddenPromptTypes?: string[];
|
|
96
|
+
};
|
|
97
|
+
presentation?: {
|
|
98
|
+
mustMention?: EvalMatcher[];
|
|
99
|
+
mustNotMention?: EvalMatcher[];
|
|
100
|
+
mustDisplayOrSave?: EvalMatcher[];
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
interface AgentEvalScenarioFilePromptRule {
|
|
104
|
+
type?: Prompt["type"];
|
|
105
|
+
when?: string | string[];
|
|
106
|
+
answer: unknown;
|
|
107
|
+
}
|
|
108
|
+
interface AgentEvalScenarioFileStep {
|
|
109
|
+
id?: string;
|
|
110
|
+
request: string;
|
|
111
|
+
behaviorBuckets?: string[];
|
|
112
|
+
human?: AgentEvalScenarioFilePromptRule[];
|
|
113
|
+
inspect?: AgentEvalScenarioFileInspection | AgentEvalScenarioFileInspection[];
|
|
114
|
+
expect?: {
|
|
115
|
+
replyIncludes?: string[];
|
|
116
|
+
replyExcludes?: string[];
|
|
117
|
+
actionIncludes?: string[];
|
|
118
|
+
actionExcludes?: string[];
|
|
119
|
+
codeIncludes?: string[];
|
|
120
|
+
codeExcludes?: string[];
|
|
121
|
+
behaviorBuckets?: string[];
|
|
122
|
+
actions?: {
|
|
123
|
+
required?: string[];
|
|
124
|
+
forbidden?: string[];
|
|
125
|
+
};
|
|
126
|
+
prompts?: AgentEvalExpectations["prompts"];
|
|
127
|
+
presentation?: {
|
|
128
|
+
mustMention?: string[];
|
|
129
|
+
mustNotMention?: string[];
|
|
130
|
+
mustDisplayOrSave?: string[];
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
interface AgentEvalScenarioFileInspection {
|
|
135
|
+
code: string;
|
|
136
|
+
includes?: string[];
|
|
137
|
+
excludes?: string[];
|
|
138
|
+
}
|
|
139
|
+
interface AgentEvalScenarioFileScenario {
|
|
140
|
+
id: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
request?: string;
|
|
143
|
+
behaviorBuckets?: string[];
|
|
144
|
+
human?: AgentEvalScenarioFilePromptRule[];
|
|
145
|
+
steps?: AgentEvalScenarioFileStep[];
|
|
146
|
+
prepareRecords?: RecordObjectOptions[];
|
|
147
|
+
verify?: AgentEvalScenarioFileInspection;
|
|
148
|
+
inspect?: AgentEvalScenarioFileInspection | AgentEvalScenarioFileInspection[];
|
|
149
|
+
expect?: AgentEvalScenarioFileStep["expect"];
|
|
150
|
+
}
|
|
151
|
+
interface AgentEvalScenarioFileEnvironmentTarget {
|
|
152
|
+
mode: "environment";
|
|
153
|
+
}
|
|
154
|
+
interface AgentEvalScenarioFileSelfContainedTarget {
|
|
155
|
+
mode: "self-contained";
|
|
156
|
+
sandboxName?: string;
|
|
157
|
+
tag?: string;
|
|
158
|
+
userId?: string;
|
|
159
|
+
name?: string;
|
|
160
|
+
email?: string;
|
|
161
|
+
permissions?: string[];
|
|
162
|
+
effectPreset?: string;
|
|
163
|
+
extraRecords?: RecordObjectOptions[];
|
|
164
|
+
}
|
|
165
|
+
interface AgentEvalScenarioFile {
|
|
166
|
+
id: string;
|
|
167
|
+
title?: string;
|
|
168
|
+
description?: string;
|
|
169
|
+
domainDocumentation?: string;
|
|
170
|
+
manifest?: ManifestContent;
|
|
171
|
+
target?: AgentEvalScenarioFileSelfContainedTarget | AgentEvalScenarioFileEnvironmentTarget;
|
|
172
|
+
scenarios: AgentEvalScenarioFileScenario[];
|
|
85
173
|
}
|
|
86
174
|
interface AgentEvalCheckContext {
|
|
87
175
|
conversation: AgentEvalConversation;
|
|
@@ -127,6 +215,7 @@ interface AgentEvalStep {
|
|
|
127
215
|
id?: string;
|
|
128
216
|
title?: string;
|
|
129
217
|
request: string;
|
|
218
|
+
behaviorBuckets?: string[];
|
|
130
219
|
setup?: AgentEvalSetup;
|
|
131
220
|
human?: AgentEvalPromptResponder;
|
|
132
221
|
expect?: AgentEvalExpectations;
|
|
@@ -139,6 +228,7 @@ interface AgentEvalScenario {
|
|
|
139
228
|
id: string;
|
|
140
229
|
description?: string;
|
|
141
230
|
jobSource?: "llm" | "hardcoded" | "mixed";
|
|
231
|
+
behaviorBuckets?: string[];
|
|
142
232
|
request?: string;
|
|
143
233
|
steps?: AgentEvalStep[];
|
|
144
234
|
setup?: AgentEvalSetup;
|
|
@@ -161,8 +251,15 @@ interface AgentEvalStepResult {
|
|
|
161
251
|
actionSummary: string[];
|
|
162
252
|
promptInteractions: AgentEvalPromptInteraction[];
|
|
163
253
|
inspectionResults: unknown[];
|
|
254
|
+
assertions?: AgentEvalAssertion[];
|
|
164
255
|
turnDir: string;
|
|
165
256
|
}
|
|
257
|
+
interface AgentEvalAssertion {
|
|
258
|
+
id: string;
|
|
259
|
+
label: string;
|
|
260
|
+
status: "passed" | "failed";
|
|
261
|
+
message?: string;
|
|
262
|
+
}
|
|
166
263
|
interface AgentEvalResult {
|
|
167
264
|
scenario: AgentEvalScenario;
|
|
168
265
|
status: "passed" | "failed";
|
|
@@ -172,6 +269,7 @@ interface AgentEvalResult {
|
|
|
172
269
|
actionSummary: string[];
|
|
173
270
|
promptInteractions: AgentEvalPromptInteraction[];
|
|
174
271
|
verification: unknown | null;
|
|
272
|
+
assertions?: AgentEvalAssertion[];
|
|
175
273
|
tokenUsage?: AgentEvalTokenUsage;
|
|
176
274
|
steps?: AgentEvalStepResult[];
|
|
177
275
|
turnDir: string;
|
|
@@ -195,6 +293,26 @@ interface AgentEvalHarnessOptions {
|
|
|
195
293
|
chatTimeoutMs?: number;
|
|
196
294
|
jobTimeoutMs?: number;
|
|
197
295
|
pollIntervalMs?: number;
|
|
296
|
+
harnessTemplateId?: string;
|
|
297
|
+
promptRenderer?: AgentEvalPromptRenderer;
|
|
298
|
+
continuationRenderer?: AgentEvalContinuationRenderer;
|
|
299
|
+
onProgress?: (event: AgentEvalProgressEvent) => void | Promise<void>;
|
|
300
|
+
}
|
|
301
|
+
type AgentEvalProgressStatus = "info" | "running" | "passed" | "failed";
|
|
302
|
+
interface AgentEvalProgressEvent {
|
|
303
|
+
id: string;
|
|
304
|
+
timestamp: string;
|
|
305
|
+
phase: "scenario" | "setup" | "step" | "prompt" | "generation" | "job" | "interaction" | "continuation" | "assertion" | "inspection" | "check";
|
|
306
|
+
status: AgentEvalProgressStatus;
|
|
307
|
+
scenarioId?: string;
|
|
308
|
+
stepId?: string;
|
|
309
|
+
iteration?: number;
|
|
310
|
+
jobId?: string;
|
|
311
|
+
templateId?: string;
|
|
312
|
+
templateVersion?: string;
|
|
313
|
+
title: string;
|
|
314
|
+
message?: string;
|
|
315
|
+
data?: unknown;
|
|
198
316
|
}
|
|
199
317
|
interface AgentEvalConversation {
|
|
200
318
|
label: string;
|
|
@@ -209,6 +327,10 @@ interface AgentEvalSessionLogIteration {
|
|
|
209
327
|
iteration: number;
|
|
210
328
|
request: string;
|
|
211
329
|
systemPrompt: string;
|
|
330
|
+
templateId?: string;
|
|
331
|
+
templateVersion?: string;
|
|
332
|
+
templateHash?: string;
|
|
333
|
+
promptInstanceHash?: string;
|
|
212
334
|
generationReply?: string;
|
|
213
335
|
generatedCode?: string;
|
|
214
336
|
rawGeneration?: unknown;
|
|
@@ -278,6 +400,8 @@ interface PendingPromptEvent {
|
|
|
278
400
|
prompt: Prompt;
|
|
279
401
|
receivedAt: number;
|
|
280
402
|
}
|
|
403
|
+
declare function scenariosFromAgentEvalFile(file: AgentEvalScenarioFile): AgentEvalScenario[];
|
|
404
|
+
declare function loadAgentEvalScenarioFile(filePath: string): Promise<AgentEvalScenario[]>;
|
|
281
405
|
declare function createTimestampedArtifactDirectory(options?: {
|
|
282
406
|
baseDir?: string;
|
|
283
407
|
suiteName?: string;
|
|
@@ -300,6 +424,9 @@ declare function runAgentEvalSuite(options: {
|
|
|
300
424
|
declare function createAgentEvalHarness(options: AgentEvalHarnessOptions): {
|
|
301
425
|
artifactDir: string;
|
|
302
426
|
granular: Granular;
|
|
427
|
+
emitProgress: (event: Omit<AgentEvalProgressEvent, "id" | "timestamp"> & {
|
|
428
|
+
id?: string;
|
|
429
|
+
}) => Promise<void>;
|
|
303
430
|
openConversation: (label: string) => Promise<AgentEvalConversation>;
|
|
304
431
|
closeConversation: (conversation: AgentEvalConversation) => Promise<void>;
|
|
305
432
|
runTurn: (input: {
|
|
@@ -349,6 +476,10 @@ interface AgentTesterOptions {
|
|
|
349
476
|
chatTimeoutMs?: number;
|
|
350
477
|
jobTimeoutMs?: number;
|
|
351
478
|
pollIntervalMs?: number;
|
|
479
|
+
harnessTemplateId?: string;
|
|
480
|
+
promptRenderer?: AgentEvalPromptRenderer;
|
|
481
|
+
continuationRenderer?: AgentEvalContinuationRenderer;
|
|
482
|
+
onProgress?: (event: AgentEvalProgressEvent) => void | Promise<void>;
|
|
352
483
|
}
|
|
353
484
|
declare function createAgentTester(options: AgentTesterOptions): {
|
|
354
485
|
granular: Granular;
|
|
@@ -370,6 +501,9 @@ declare function createAgentTester(options: AgentTesterOptions): {
|
|
|
370
501
|
continueStep: (pending: AgentEvalPendingTurn, responder: AgentEvalPromptResponder) => Promise<AgentEvalCompletedTurn | AgentEvalPendingTurn>;
|
|
371
502
|
runSuite: (scenarios: AgentEvalScenario[]) => Promise<AgentEvalSuiteResult>;
|
|
372
503
|
artifactDir: string;
|
|
504
|
+
emitProgress: (event: Omit<AgentEvalProgressEvent, "id" | "timestamp"> & {
|
|
505
|
+
id?: string;
|
|
506
|
+
}) => Promise<void>;
|
|
373
507
|
openConversation: (label: string) => Promise<AgentEvalConversation>;
|
|
374
508
|
closeConversation: (conversation: AgentEvalConversation) => Promise<void>;
|
|
375
509
|
runTurn: (input: {
|
|
@@ -393,4 +527,4 @@ declare const createHumanResponder: typeof createScriptedPromptResponder;
|
|
|
393
527
|
declare const createOpenAIGenerator: typeof createOpenAIChatTurnGenerator;
|
|
394
528
|
declare const createTestArtifactsDirectory: typeof createTimestampedArtifactDirectory;
|
|
395
529
|
|
|
396
|
-
export { type AgentEvalCheck, type AgentEvalCheckContext, type AgentEvalCompletedTurn, type AgentEvalConversation, type AgentEvalExpectations, type AgentEvalGenerationAttempt, type AgentEvalGenerationInput, type AgentEvalGenerationOutput, type AgentEvalHarnessOptions, type AgentEvalInspection, type AgentEvalOpenAIUsageEvent, type AgentEvalPendingTurn, type AgentEvalPrepareContext, type AgentEvalPromptInteraction, type AgentEvalPromptResponder, type AgentEvalResult, type AgentEvalScenario, type AgentEvalSetup, type AgentEvalSetupContext, type AgentEvalStep, type AgentEvalStepResult, type AgentEvalSuiteResult, type AgentEvalTokenUsage, type AgentEvalTurnGenerator, type AgentTestTarget, type AgentTesterOptions, type EvalMatcher, type ScriptedPromptRule, createAgentEvalHarness, createAgentTester, createHumanResponder, createOpenAIChatTurnGenerator, createOpenAIGenerator, createScriptedPromptResponder, createTestArtifactsDirectory, createTimestampedArtifactDirectory, generateTurnWithRepair, runAgentEvalSuite, runAgentTests };
|
|
530
|
+
export { type AgentEvalAssertion, type AgentEvalCheck, type AgentEvalCheckContext, type AgentEvalCompletedTurn, type AgentEvalContinuationRenderer, type AgentEvalConversation, type AgentEvalExpectations, type AgentEvalGenerationAttempt, type AgentEvalGenerationInput, type AgentEvalGenerationOutput, type AgentEvalHarnessOptions, type AgentEvalInspection, type AgentEvalOpenAIUsageEvent, type AgentEvalPendingTurn, type AgentEvalPrepareContext, type AgentEvalProgressEvent, type AgentEvalProgressStatus, type AgentEvalPromptInteraction, type AgentEvalPromptRenderer, type AgentEvalPromptResponder, type AgentEvalResult, type AgentEvalScenario, type AgentEvalScenarioFile, type AgentEvalScenarioFileEnvironmentTarget, type AgentEvalScenarioFileInspection, type AgentEvalScenarioFilePromptRule, type AgentEvalScenarioFileScenario, type AgentEvalScenarioFileSelfContainedTarget, type AgentEvalScenarioFileStep, type AgentEvalSetup, type AgentEvalSetupContext, type AgentEvalStep, type AgentEvalStepResult, type AgentEvalSuiteResult, type AgentEvalTokenUsage, type AgentEvalTurnGenerator, type AgentTestTarget, type AgentTesterOptions, type EvalMatcher, type ScriptedPromptRule, createAgentEvalHarness, createAgentTester, createHumanResponder, createOpenAIChatTurnGenerator, createOpenAIGenerator, createScriptedPromptResponder, createTestArtifactsDirectory, createTimestampedArtifactDirectory, generateTurnWithRepair, loadAgentEvalScenarioFile, runAgentEvalSuite, runAgentTests, scenariosFromAgentEvalFile };
|
package/dist/agent-evals.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as EnvironmentSession, G as Granular } from './client-BZ8NuQ_e.js';
|
|
2
|
-
import { G as GranularSpendContext, h as OpenAITokenSpend, P as Prompt,
|
|
3
|
-
import { GranularAgentToolInfo, GeneratedJobCodeIssue, HarnessControllerBudgets } from './agent-harness.js';
|
|
2
|
+
import { G as GranularSpendContext, h as OpenAITokenSpend, P as Prompt, ba as RecordObjectOptions, bM as ManifestContent, c as SessionHeapSnapshot, T as ToolWithHandler, C as ConnectOptions, a6 as CreateEnvironmentData, q as GranularOptions } from './spend-tAz2a16I.js';
|
|
3
|
+
import { GranularAgentToolInfo, GeneratedJobCodeIssue, BuildGranularAgentSystemPromptInput, HarnessRenderedPrompt, HarnessRenderedContinuation, HarnessControllerBudgets } from './agent-harness.js';
|
|
4
4
|
import '@automerge/automerge';
|
|
5
5
|
import '@automerge/automerge/slim';
|
|
6
6
|
import '@granular-software/policy-engine';
|
|
@@ -26,6 +26,8 @@ interface AgentEvalGenerationInput {
|
|
|
26
26
|
onTextDelta?: (delta: string) => void | Promise<void>;
|
|
27
27
|
usageContext?: GranularSpendContext;
|
|
28
28
|
}
|
|
29
|
+
type AgentEvalPromptRenderer = (input: BuildGranularAgentSystemPromptInput) => HarnessRenderedPrompt;
|
|
30
|
+
type AgentEvalContinuationRenderer = (resultPreview?: string) => HarnessRenderedContinuation;
|
|
29
31
|
interface AgentEvalGenerationOutput {
|
|
30
32
|
reply?: string;
|
|
31
33
|
code?: string;
|
|
@@ -82,6 +84,92 @@ interface AgentEvalExpectations {
|
|
|
82
84
|
actionExcludes?: EvalMatcher[];
|
|
83
85
|
codeIncludes?: EvalMatcher[];
|
|
84
86
|
codeExcludes?: EvalMatcher[];
|
|
87
|
+
behaviorBuckets?: string[];
|
|
88
|
+
actions?: {
|
|
89
|
+
required?: EvalMatcher[];
|
|
90
|
+
forbidden?: EvalMatcher[];
|
|
91
|
+
};
|
|
92
|
+
prompts?: {
|
|
93
|
+
requiredChoiceWhenAmbiguous?: boolean;
|
|
94
|
+
requiredConfirmationBefore?: EvalMatcher[];
|
|
95
|
+
forbiddenPromptTypes?: string[];
|
|
96
|
+
};
|
|
97
|
+
presentation?: {
|
|
98
|
+
mustMention?: EvalMatcher[];
|
|
99
|
+
mustNotMention?: EvalMatcher[];
|
|
100
|
+
mustDisplayOrSave?: EvalMatcher[];
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
interface AgentEvalScenarioFilePromptRule {
|
|
104
|
+
type?: Prompt["type"];
|
|
105
|
+
when?: string | string[];
|
|
106
|
+
answer: unknown;
|
|
107
|
+
}
|
|
108
|
+
interface AgentEvalScenarioFileStep {
|
|
109
|
+
id?: string;
|
|
110
|
+
request: string;
|
|
111
|
+
behaviorBuckets?: string[];
|
|
112
|
+
human?: AgentEvalScenarioFilePromptRule[];
|
|
113
|
+
inspect?: AgentEvalScenarioFileInspection | AgentEvalScenarioFileInspection[];
|
|
114
|
+
expect?: {
|
|
115
|
+
replyIncludes?: string[];
|
|
116
|
+
replyExcludes?: string[];
|
|
117
|
+
actionIncludes?: string[];
|
|
118
|
+
actionExcludes?: string[];
|
|
119
|
+
codeIncludes?: string[];
|
|
120
|
+
codeExcludes?: string[];
|
|
121
|
+
behaviorBuckets?: string[];
|
|
122
|
+
actions?: {
|
|
123
|
+
required?: string[];
|
|
124
|
+
forbidden?: string[];
|
|
125
|
+
};
|
|
126
|
+
prompts?: AgentEvalExpectations["prompts"];
|
|
127
|
+
presentation?: {
|
|
128
|
+
mustMention?: string[];
|
|
129
|
+
mustNotMention?: string[];
|
|
130
|
+
mustDisplayOrSave?: string[];
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
interface AgentEvalScenarioFileInspection {
|
|
135
|
+
code: string;
|
|
136
|
+
includes?: string[];
|
|
137
|
+
excludes?: string[];
|
|
138
|
+
}
|
|
139
|
+
interface AgentEvalScenarioFileScenario {
|
|
140
|
+
id: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
request?: string;
|
|
143
|
+
behaviorBuckets?: string[];
|
|
144
|
+
human?: AgentEvalScenarioFilePromptRule[];
|
|
145
|
+
steps?: AgentEvalScenarioFileStep[];
|
|
146
|
+
prepareRecords?: RecordObjectOptions[];
|
|
147
|
+
verify?: AgentEvalScenarioFileInspection;
|
|
148
|
+
inspect?: AgentEvalScenarioFileInspection | AgentEvalScenarioFileInspection[];
|
|
149
|
+
expect?: AgentEvalScenarioFileStep["expect"];
|
|
150
|
+
}
|
|
151
|
+
interface AgentEvalScenarioFileEnvironmentTarget {
|
|
152
|
+
mode: "environment";
|
|
153
|
+
}
|
|
154
|
+
interface AgentEvalScenarioFileSelfContainedTarget {
|
|
155
|
+
mode: "self-contained";
|
|
156
|
+
sandboxName?: string;
|
|
157
|
+
tag?: string;
|
|
158
|
+
userId?: string;
|
|
159
|
+
name?: string;
|
|
160
|
+
email?: string;
|
|
161
|
+
permissions?: string[];
|
|
162
|
+
effectPreset?: string;
|
|
163
|
+
extraRecords?: RecordObjectOptions[];
|
|
164
|
+
}
|
|
165
|
+
interface AgentEvalScenarioFile {
|
|
166
|
+
id: string;
|
|
167
|
+
title?: string;
|
|
168
|
+
description?: string;
|
|
169
|
+
domainDocumentation?: string;
|
|
170
|
+
manifest?: ManifestContent;
|
|
171
|
+
target?: AgentEvalScenarioFileSelfContainedTarget | AgentEvalScenarioFileEnvironmentTarget;
|
|
172
|
+
scenarios: AgentEvalScenarioFileScenario[];
|
|
85
173
|
}
|
|
86
174
|
interface AgentEvalCheckContext {
|
|
87
175
|
conversation: AgentEvalConversation;
|
|
@@ -127,6 +215,7 @@ interface AgentEvalStep {
|
|
|
127
215
|
id?: string;
|
|
128
216
|
title?: string;
|
|
129
217
|
request: string;
|
|
218
|
+
behaviorBuckets?: string[];
|
|
130
219
|
setup?: AgentEvalSetup;
|
|
131
220
|
human?: AgentEvalPromptResponder;
|
|
132
221
|
expect?: AgentEvalExpectations;
|
|
@@ -139,6 +228,7 @@ interface AgentEvalScenario {
|
|
|
139
228
|
id: string;
|
|
140
229
|
description?: string;
|
|
141
230
|
jobSource?: "llm" | "hardcoded" | "mixed";
|
|
231
|
+
behaviorBuckets?: string[];
|
|
142
232
|
request?: string;
|
|
143
233
|
steps?: AgentEvalStep[];
|
|
144
234
|
setup?: AgentEvalSetup;
|
|
@@ -161,8 +251,15 @@ interface AgentEvalStepResult {
|
|
|
161
251
|
actionSummary: string[];
|
|
162
252
|
promptInteractions: AgentEvalPromptInteraction[];
|
|
163
253
|
inspectionResults: unknown[];
|
|
254
|
+
assertions?: AgentEvalAssertion[];
|
|
164
255
|
turnDir: string;
|
|
165
256
|
}
|
|
257
|
+
interface AgentEvalAssertion {
|
|
258
|
+
id: string;
|
|
259
|
+
label: string;
|
|
260
|
+
status: "passed" | "failed";
|
|
261
|
+
message?: string;
|
|
262
|
+
}
|
|
166
263
|
interface AgentEvalResult {
|
|
167
264
|
scenario: AgentEvalScenario;
|
|
168
265
|
status: "passed" | "failed";
|
|
@@ -172,6 +269,7 @@ interface AgentEvalResult {
|
|
|
172
269
|
actionSummary: string[];
|
|
173
270
|
promptInteractions: AgentEvalPromptInteraction[];
|
|
174
271
|
verification: unknown | null;
|
|
272
|
+
assertions?: AgentEvalAssertion[];
|
|
175
273
|
tokenUsage?: AgentEvalTokenUsage;
|
|
176
274
|
steps?: AgentEvalStepResult[];
|
|
177
275
|
turnDir: string;
|
|
@@ -195,6 +293,26 @@ interface AgentEvalHarnessOptions {
|
|
|
195
293
|
chatTimeoutMs?: number;
|
|
196
294
|
jobTimeoutMs?: number;
|
|
197
295
|
pollIntervalMs?: number;
|
|
296
|
+
harnessTemplateId?: string;
|
|
297
|
+
promptRenderer?: AgentEvalPromptRenderer;
|
|
298
|
+
continuationRenderer?: AgentEvalContinuationRenderer;
|
|
299
|
+
onProgress?: (event: AgentEvalProgressEvent) => void | Promise<void>;
|
|
300
|
+
}
|
|
301
|
+
type AgentEvalProgressStatus = "info" | "running" | "passed" | "failed";
|
|
302
|
+
interface AgentEvalProgressEvent {
|
|
303
|
+
id: string;
|
|
304
|
+
timestamp: string;
|
|
305
|
+
phase: "scenario" | "setup" | "step" | "prompt" | "generation" | "job" | "interaction" | "continuation" | "assertion" | "inspection" | "check";
|
|
306
|
+
status: AgentEvalProgressStatus;
|
|
307
|
+
scenarioId?: string;
|
|
308
|
+
stepId?: string;
|
|
309
|
+
iteration?: number;
|
|
310
|
+
jobId?: string;
|
|
311
|
+
templateId?: string;
|
|
312
|
+
templateVersion?: string;
|
|
313
|
+
title: string;
|
|
314
|
+
message?: string;
|
|
315
|
+
data?: unknown;
|
|
198
316
|
}
|
|
199
317
|
interface AgentEvalConversation {
|
|
200
318
|
label: string;
|
|
@@ -209,6 +327,10 @@ interface AgentEvalSessionLogIteration {
|
|
|
209
327
|
iteration: number;
|
|
210
328
|
request: string;
|
|
211
329
|
systemPrompt: string;
|
|
330
|
+
templateId?: string;
|
|
331
|
+
templateVersion?: string;
|
|
332
|
+
templateHash?: string;
|
|
333
|
+
promptInstanceHash?: string;
|
|
212
334
|
generationReply?: string;
|
|
213
335
|
generatedCode?: string;
|
|
214
336
|
rawGeneration?: unknown;
|
|
@@ -278,6 +400,8 @@ interface PendingPromptEvent {
|
|
|
278
400
|
prompt: Prompt;
|
|
279
401
|
receivedAt: number;
|
|
280
402
|
}
|
|
403
|
+
declare function scenariosFromAgentEvalFile(file: AgentEvalScenarioFile): AgentEvalScenario[];
|
|
404
|
+
declare function loadAgentEvalScenarioFile(filePath: string): Promise<AgentEvalScenario[]>;
|
|
281
405
|
declare function createTimestampedArtifactDirectory(options?: {
|
|
282
406
|
baseDir?: string;
|
|
283
407
|
suiteName?: string;
|
|
@@ -300,6 +424,9 @@ declare function runAgentEvalSuite(options: {
|
|
|
300
424
|
declare function createAgentEvalHarness(options: AgentEvalHarnessOptions): {
|
|
301
425
|
artifactDir: string;
|
|
302
426
|
granular: Granular;
|
|
427
|
+
emitProgress: (event: Omit<AgentEvalProgressEvent, "id" | "timestamp"> & {
|
|
428
|
+
id?: string;
|
|
429
|
+
}) => Promise<void>;
|
|
303
430
|
openConversation: (label: string) => Promise<AgentEvalConversation>;
|
|
304
431
|
closeConversation: (conversation: AgentEvalConversation) => Promise<void>;
|
|
305
432
|
runTurn: (input: {
|
|
@@ -349,6 +476,10 @@ interface AgentTesterOptions {
|
|
|
349
476
|
chatTimeoutMs?: number;
|
|
350
477
|
jobTimeoutMs?: number;
|
|
351
478
|
pollIntervalMs?: number;
|
|
479
|
+
harnessTemplateId?: string;
|
|
480
|
+
promptRenderer?: AgentEvalPromptRenderer;
|
|
481
|
+
continuationRenderer?: AgentEvalContinuationRenderer;
|
|
482
|
+
onProgress?: (event: AgentEvalProgressEvent) => void | Promise<void>;
|
|
352
483
|
}
|
|
353
484
|
declare function createAgentTester(options: AgentTesterOptions): {
|
|
354
485
|
granular: Granular;
|
|
@@ -370,6 +501,9 @@ declare function createAgentTester(options: AgentTesterOptions): {
|
|
|
370
501
|
continueStep: (pending: AgentEvalPendingTurn, responder: AgentEvalPromptResponder) => Promise<AgentEvalCompletedTurn | AgentEvalPendingTurn>;
|
|
371
502
|
runSuite: (scenarios: AgentEvalScenario[]) => Promise<AgentEvalSuiteResult>;
|
|
372
503
|
artifactDir: string;
|
|
504
|
+
emitProgress: (event: Omit<AgentEvalProgressEvent, "id" | "timestamp"> & {
|
|
505
|
+
id?: string;
|
|
506
|
+
}) => Promise<void>;
|
|
373
507
|
openConversation: (label: string) => Promise<AgentEvalConversation>;
|
|
374
508
|
closeConversation: (conversation: AgentEvalConversation) => Promise<void>;
|
|
375
509
|
runTurn: (input: {
|
|
@@ -393,4 +527,4 @@ declare const createHumanResponder: typeof createScriptedPromptResponder;
|
|
|
393
527
|
declare const createOpenAIGenerator: typeof createOpenAIChatTurnGenerator;
|
|
394
528
|
declare const createTestArtifactsDirectory: typeof createTimestampedArtifactDirectory;
|
|
395
529
|
|
|
396
|
-
export { type AgentEvalCheck, type AgentEvalCheckContext, type AgentEvalCompletedTurn, type AgentEvalConversation, type AgentEvalExpectations, type AgentEvalGenerationAttempt, type AgentEvalGenerationInput, type AgentEvalGenerationOutput, type AgentEvalHarnessOptions, type AgentEvalInspection, type AgentEvalOpenAIUsageEvent, type AgentEvalPendingTurn, type AgentEvalPrepareContext, type AgentEvalPromptInteraction, type AgentEvalPromptResponder, type AgentEvalResult, type AgentEvalScenario, type AgentEvalSetup, type AgentEvalSetupContext, type AgentEvalStep, type AgentEvalStepResult, type AgentEvalSuiteResult, type AgentEvalTokenUsage, type AgentEvalTurnGenerator, type AgentTestTarget, type AgentTesterOptions, type EvalMatcher, type ScriptedPromptRule, createAgentEvalHarness, createAgentTester, createHumanResponder, createOpenAIChatTurnGenerator, createOpenAIGenerator, createScriptedPromptResponder, createTestArtifactsDirectory, createTimestampedArtifactDirectory, generateTurnWithRepair, runAgentEvalSuite, runAgentTests };
|
|
530
|
+
export { type AgentEvalAssertion, type AgentEvalCheck, type AgentEvalCheckContext, type AgentEvalCompletedTurn, type AgentEvalContinuationRenderer, type AgentEvalConversation, type AgentEvalExpectations, type AgentEvalGenerationAttempt, type AgentEvalGenerationInput, type AgentEvalGenerationOutput, type AgentEvalHarnessOptions, type AgentEvalInspection, type AgentEvalOpenAIUsageEvent, type AgentEvalPendingTurn, type AgentEvalPrepareContext, type AgentEvalProgressEvent, type AgentEvalProgressStatus, type AgentEvalPromptInteraction, type AgentEvalPromptRenderer, type AgentEvalPromptResponder, type AgentEvalResult, type AgentEvalScenario, type AgentEvalScenarioFile, type AgentEvalScenarioFileEnvironmentTarget, type AgentEvalScenarioFileInspection, type AgentEvalScenarioFilePromptRule, type AgentEvalScenarioFileScenario, type AgentEvalScenarioFileSelfContainedTarget, type AgentEvalScenarioFileStep, type AgentEvalSetup, type AgentEvalSetupContext, type AgentEvalStep, type AgentEvalStepResult, type AgentEvalSuiteResult, type AgentEvalTokenUsage, type AgentEvalTurnGenerator, type AgentTestTarget, type AgentTesterOptions, type EvalMatcher, type ScriptedPromptRule, createAgentEvalHarness, createAgentTester, createHumanResponder, createOpenAIChatTurnGenerator, createOpenAIGenerator, createScriptedPromptResponder, createTestArtifactsDirectory, createTimestampedArtifactDirectory, generateTurnWithRepair, loadAgentEvalScenarioFile, runAgentEvalSuite, runAgentTests, scenariosFromAgentEvalFile };
|