@vertesia/common 1.5.0-dev.20260910.052912Z → 1.6.0-dev.20260912.110338Z
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/lib/access-control-values.d.ts +1 -0
- package/lib/access-control-values.d.ts.map +1 -1
- package/lib/access-control-values.js +1 -0
- package/lib/access-control-values.js.map +1 -1
- package/lib/api-contract/components.generated.json +4188 -2267
- package/lib/api-schemas/adapter.d.ts.map +1 -1
- package/lib/api-schemas/adapter.js +8 -1
- package/lib/api-schemas/adapter.js.map +1 -1
- package/lib/api-schemas/agent-communication.d.ts +1 -0
- package/lib/api-schemas/agent-communication.d.ts.map +1 -1
- package/lib/api-schemas/agent-communication.js +6 -0
- package/lib/api-schemas/agent-communication.js.map +1 -1
- package/lib/api-schemas/agent-runs.d.ts +5271 -903
- package/lib/api-schemas/agent-runs.d.ts.map +1 -1
- package/lib/api-schemas/agent-runs.js +343 -1
- package/lib/api-schemas/agent-runs.js.map +1 -1
- package/lib/api-schemas/app-runtime.d.ts +1240 -22
- package/lib/api-schemas/app-runtime.d.ts.map +1 -1
- package/lib/api-schemas/content.d.ts +435 -0
- package/lib/api-schemas/content.d.ts.map +1 -1
- package/lib/api-schemas/data-store.d.ts +1 -0
- package/lib/api-schemas/data-store.d.ts.map +1 -1
- package/lib/api-schemas/data-store.js +7 -0
- package/lib/api-schemas/data-store.js.map +1 -1
- package/lib/api-schemas/delegation.d.ts +35 -0
- package/lib/api-schemas/delegation.d.ts.map +1 -0
- package/lib/api-schemas/delegation.js +21 -0
- package/lib/api-schemas/delegation.js.map +1 -0
- package/lib/api-schemas/document-processing.d.ts +261 -0
- package/lib/api-schemas/document-processing.d.ts.map +1 -1
- package/lib/api-schemas/emit-json-schema.d.ts +5 -0
- package/lib/api-schemas/emit-json-schema.d.ts.map +1 -0
- package/lib/api-schemas/emit-json-schema.js +37 -0
- package/lib/api-schemas/emit-json-schema.js.map +1 -0
- package/lib/api-schemas/environment.d.ts +18 -0
- package/lib/api-schemas/environment.d.ts.map +1 -1
- package/lib/api-schemas/events.d.ts +783 -0
- package/lib/api-schemas/events.d.ts.map +1 -1
- package/lib/api-schemas/index.d.ts +1 -0
- package/lib/api-schemas/index.d.ts.map +1 -1
- package/lib/api-schemas/index.js +1 -0
- package/lib/api-schemas/index.js.map +1 -1
- package/lib/api-schemas/interaction.d.ts +3939 -91
- package/lib/api-schemas/interaction.d.ts.map +1 -1
- package/lib/api-schemas/interaction.js +14 -3
- package/lib/api-schemas/interaction.js.map +1 -1
- package/lib/api-schemas/oauth-server.d.ts +1 -0
- package/lib/api-schemas/oauth-server.d.ts.map +1 -1
- package/lib/api-schemas/oauth-server.js +3 -0
- package/lib/api-schemas/oauth-server.js.map +1 -1
- package/lib/api-schemas/process-agent-policy.d.ts +69 -0
- package/lib/api-schemas/process-agent-policy.d.ts.map +1 -0
- package/lib/api-schemas/process-agent-policy.js +154 -0
- package/lib/api-schemas/process-agent-policy.js.map +1 -0
- package/lib/api-schemas/process.d.ts +1260 -0
- package/lib/api-schemas/process.d.ts.map +1 -1
- package/lib/api-schemas/process.js +29 -1
- package/lib/api-schemas/process.js.map +1 -1
- package/lib/api-schemas/project-configuration.d.ts +878 -8
- package/lib/api-schemas/project-configuration.d.ts.map +1 -1
- package/lib/api-schemas/project.d.ts +1327 -22
- package/lib/api-schemas/project.d.ts.map +1 -1
- package/lib/api-schemas/registry.d.ts +21836 -3256
- package/lib/api-schemas/registry.d.ts.map +1 -1
- package/lib/api-schemas/registry.js +40 -7
- package/lib/api-schemas/registry.js.map +1 -1
- package/lib/api-schemas/store.d.ts +4427 -77
- package/lib/api-schemas/store.d.ts.map +1 -1
- package/lib/api-schemas/sts.d.ts +6 -0
- package/lib/api-schemas/sts.d.ts.map +1 -1
- package/lib/api-schemas/sts.js +3 -0
- package/lib/api-schemas/sts.js.map +1 -1
- package/lib/api-schemas/workflow-runs.d.ts +189 -0
- package/lib/api-schemas/workflow-runs.d.ts.map +1 -1
- package/lib/api-schemas/workflow-runs.js +14 -0
- package/lib/api-schemas/workflow-runs.js.map +1 -1
- package/lib/apikey.d.ts +1 -0
- package/lib/apikey.d.ts.map +1 -1
- package/lib/apikey.js.map +1 -1
- package/lib/delegation.d.ts +13 -0
- package/lib/delegation.d.ts.map +1 -0
- package/lib/delegation.js +2 -0
- package/lib/delegation.js.map +1 -0
- package/lib/environment.d.ts +1 -0
- package/lib/environment.d.ts.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/oauth-scopes.d.ts.map +1 -1
- package/lib/oauth-scopes.js +1 -0
- package/lib/oauth-scopes.js.map +1 -1
- package/lib/store/agent-run-values.d.ts +25 -0
- package/lib/store/agent-run-values.d.ts.map +1 -0
- package/lib/store/agent-run-values.js +25 -0
- package/lib/store/agent-run-values.js.map +1 -0
- package/lib/store/agent-run.d.ts +22 -2
- package/lib/store/agent-run.d.ts.map +1 -1
- package/lib/store/agent-run.js +1 -1
- package/lib/store/agent-run.js.map +1 -1
- package/lib/store/conversation-state.d.ts +1 -1
- package/lib/store/conversation-state.d.ts.map +1 -1
- package/lib/store/intake-policy-schema.generated.d.ts.map +1 -1
- package/lib/store/intake-policy-schema.generated.js +124 -0
- package/lib/store/intake-policy-schema.generated.js.map +1 -1
- package/lib/store/process.d.ts +17 -0
- package/lib/store/process.d.ts.map +1 -1
- package/lib/store/process.js.map +1 -1
- package/lib/store/schedule.d.ts +62 -25
- package/lib/store/schedule.d.ts.map +1 -1
- package/lib/store/schedule.js +2 -2
- package/lib/store/schedule.js.map +1 -1
- package/lib/store/workflow.d.ts +2 -0
- package/lib/store/workflow.d.ts.map +1 -1
- package/lib/store/workflow.js.map +1 -1
- package/lib/vertesia-common.js +2 -2
- package/lib/vertesia-common.js.map +1 -1
- package/lib/workflow-analytics.d.ts +198 -2
- package/lib/workflow-analytics.d.ts.map +1 -1
- package/lib/workflow-analytics.js +6 -0
- package/lib/workflow-analytics.js.map +1 -1
- package/package.json +8 -8
- package/src/access-control-values.ts +1 -0
- package/src/api-contract/components.generated.json +4188 -2267
- package/src/api-schemas/adapter-edge-cases.test.ts +19 -0
- package/src/api-schemas/adapter.ts +8 -1
- package/src/api-schemas/agent-communication.ts +6 -0
- package/src/api-schemas/agent-history.contract.test.ts +42 -0
- package/src/api-schemas/agent-runs.contract.test.ts +203 -0
- package/src/api-schemas/agent-runs.ts +374 -0
- package/src/api-schemas/data-store.contract.test.ts +6 -0
- package/src/api-schemas/data-store.ts +8 -0
- package/src/api-schemas/delegation.ts +21 -0
- package/src/api-schemas/emit-json-schema.test.ts +36 -0
- package/src/api-schemas/emit-json-schema.ts +40 -0
- package/src/api-schemas/environment.contract.test.ts +3 -0
- package/src/api-schemas/index.ts +1 -0
- package/src/api-schemas/interaction.contract.test.ts +23 -0
- package/src/api-schemas/interaction.ts +15 -3
- package/src/api-schemas/llumiverse.contract.test.ts +3 -9
- package/src/api-schemas/oauth-server.ts +4 -0
- package/src/api-schemas/process-agent-policy.ts +167 -0
- package/src/api-schemas/process.contract.test.ts +115 -0
- package/src/api-schemas/process.ts +31 -1
- package/src/api-schemas/registry.ts +43 -10
- package/src/api-schemas/sts.ts +3 -0
- package/src/api-schemas/workflow-runs.ts +16 -0
- package/src/api-schemas/zeno-response-contracts.test.ts +36 -0
- package/src/apikey.ts +1 -0
- package/src/delegation.ts +18 -0
- package/src/index.ts +6 -0
- package/src/oauth-scopes.ts +1 -0
- package/src/store/agent-run-values.ts +27 -0
- package/src/store/agent-run.ts +36 -0
- package/src/store/conversation-state.ts +1 -1
- package/src/store/intake-policy-schema.generated.ts +125 -0
- package/src/store/process.ts +22 -0
- package/src/store/schedule.test.ts +59 -0
- package/src/store/schedule.ts +91 -27
- package/src/store/workflow.ts +2 -0
- package/src/workflow-analytics.ts +238 -1
|
@@ -2,6 +2,25 @@ import { describe, expect, it } from 'vitest';
|
|
|
2
2
|
import { type JsonObject, SchemaAdapterError, toOpenApiComponents } from './adapter.js';
|
|
3
3
|
|
|
4
4
|
describe('reference integrity', () => {
|
|
5
|
+
it('uses the definition when a named root references its own $defs entry', () => {
|
|
6
|
+
const definition = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: { child: { $ref: '#/$defs/Account' } },
|
|
9
|
+
};
|
|
10
|
+
expect(toOpenApiComponents({ Account: { $ref: '#/$defs/Account', $defs: { Account: definition } } })).toEqual({
|
|
11
|
+
Account: { type: 'object', properties: { child: { $ref: '#/components/schemas/Account' } } },
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('still rejects conflicting definitions behind a named root reference', () => {
|
|
16
|
+
expect(() =>
|
|
17
|
+
toOpenApiComponents({
|
|
18
|
+
Holder: { type: 'object', $defs: { Account: { type: 'string' } } },
|
|
19
|
+
Account: { $ref: '#/$defs/Account', $defs: { Account: { type: 'number' } } },
|
|
20
|
+
}),
|
|
21
|
+
).toThrow(SchemaAdapterError);
|
|
22
|
+
});
|
|
23
|
+
|
|
5
24
|
it('rejects a reference to a component that does not exist', () => {
|
|
6
25
|
// A dangling pointer produces a spec that validates structurally but breaks every
|
|
7
26
|
// generated client at deserialization time.
|
|
@@ -316,7 +316,14 @@ export function toOpenApiComponents(
|
|
|
316
316
|
throw new SchemaAdapterError(`Component '${name}' is not an object schema.`);
|
|
317
317
|
}
|
|
318
318
|
ctx.rootName = name;
|
|
319
|
-
|
|
319
|
+
const adapted = walk(structuredClone(schema), ctx, true) as JsonObject;
|
|
320
|
+
// Zod 4.5 emits named roots as a bare reference to their own $defs entry.
|
|
321
|
+
// walk already registered that definition; registering the wrapper would replace it
|
|
322
|
+
// with a self-reference and incorrectly report a conflicting component shape.
|
|
323
|
+
if (adapted[REF] === `${COMPONENT_PREFIX}${name}` && Object.keys(adapted).length === 1 && ctx.seen.has(name)) {
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
register(name, adapted, ctx);
|
|
320
327
|
}
|
|
321
328
|
|
|
322
329
|
const strict = options.strictComponents;
|
|
@@ -139,6 +139,12 @@ export const RegisterPendingAskRequestSchema = z
|
|
|
139
139
|
timeoutHours: z.number().optional(),
|
|
140
140
|
userChannels: z.array(UserChannelSchema),
|
|
141
141
|
taskFields: z.array(TaskFieldSchema).optional(),
|
|
142
|
+
/**
|
|
143
|
+
* Id of the REQUEST_INPUT message carrying this ask (the `ask_user` tool-use id), so a
|
|
144
|
+
* notified client can open the exact prompt. Optional: workers built before this field
|
|
145
|
+
* still validate against the component.
|
|
146
|
+
*/
|
|
147
|
+
requestId: z.string().optional(),
|
|
142
148
|
})
|
|
143
149
|
.meta({ id: 'RegisterPendingAskRequest' });
|
|
144
150
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { validateApiRequest, validateApiResponse } from './registry.js';
|
|
3
|
+
|
|
4
|
+
describe('agent history delta wire contract', () => {
|
|
5
|
+
it('accepts optional cursors and bounds their size', () => {
|
|
6
|
+
expect(validateApiRequest('AgentRunDetailsQuery', { include_history: true, from: 'opaque' }).valid).toBe(true);
|
|
7
|
+
expect(validateApiRequest('AgentRunDetailsQuery', { from: {} }).valid).toBe(false);
|
|
8
|
+
expect(validateApiRequest('AgentRunDetailsQuery', { from: 'x'.repeat(12001) }).valid).toBe(false);
|
|
9
|
+
});
|
|
10
|
+
it('validates legacy, snapshot, and delta responses through the registered contract', () => {
|
|
11
|
+
for (const mode of [undefined, 'snapshot', 'delta']) {
|
|
12
|
+
expect(
|
|
13
|
+
validateApiResponse('WorkflowRunWithDetails', {
|
|
14
|
+
started_at: null,
|
|
15
|
+
closed_at: null,
|
|
16
|
+
history: {
|
|
17
|
+
type: 'agent',
|
|
18
|
+
...(mode ? { mode, next_from: 'opaque' } : {}),
|
|
19
|
+
agentTasks: [
|
|
20
|
+
{
|
|
21
|
+
history_id: 'run:activity:7',
|
|
22
|
+
taskType: 'tool_call',
|
|
23
|
+
toolName: 'test',
|
|
24
|
+
status: 'running',
|
|
25
|
+
scheduled_at: null,
|
|
26
|
+
started_at: null,
|
|
27
|
+
completed_at: null,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
}).valid,
|
|
32
|
+
).toBe(true);
|
|
33
|
+
}
|
|
34
|
+
expect(
|
|
35
|
+
validateApiResponse('WorkflowRunWithDetails', {
|
|
36
|
+
started_at: null,
|
|
37
|
+
closed_at: null,
|
|
38
|
+
history: { type: 'agent', mode: 'append', agentTasks: [] },
|
|
39
|
+
}).valid,
|
|
40
|
+
).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { describe, expect, expectTypeOf, it } from 'vitest';
|
|
2
|
+
import type {
|
|
3
|
+
AgentRunEvaluation,
|
|
4
|
+
AgentRunEvaluationRollup,
|
|
5
|
+
AgentRunFeedbackEntry,
|
|
6
|
+
AgentRunFeedbackPayload,
|
|
7
|
+
AgentRunFeedbackResponse,
|
|
8
|
+
} from '../store/agent-run.js';
|
|
9
|
+
import { AgentEventType, type TurnEvaluationEvent } from '../workflow-analytics.js';
|
|
10
|
+
import type {
|
|
11
|
+
AgentRunEvaluationRollupSchema,
|
|
12
|
+
AgentRunEvaluationSchema,
|
|
13
|
+
AgentRunFeedbackEntrySchema,
|
|
14
|
+
AgentRunFeedbackPayloadSchema,
|
|
15
|
+
AgentRunFeedbackResponseSchema,
|
|
16
|
+
} from './agent-runs.js';
|
|
17
|
+
import { validateApiRequest, validateApiResponse } from './registry.js';
|
|
18
|
+
|
|
19
|
+
const turnEvaluation: TurnEvaluationEvent = {
|
|
20
|
+
eventType: AgentEventType.TurnEvaluation,
|
|
21
|
+
eventId: 'run-1:main:1:answer',
|
|
22
|
+
timestamp: '2026-09-11T10:00:00.000Z',
|
|
23
|
+
runId: 'wf-run-1',
|
|
24
|
+
agentRunId: 'run-1',
|
|
25
|
+
model: 'claude',
|
|
26
|
+
environmentId: 'env-1',
|
|
27
|
+
environmentType: 'vertexai',
|
|
28
|
+
interactionId: 'sys:StudioAssistant',
|
|
29
|
+
schemaVersion: 1,
|
|
30
|
+
detectorVersion: 1,
|
|
31
|
+
workstreamId: 'main',
|
|
32
|
+
turnSeq: 1,
|
|
33
|
+
terminalType: 'answer',
|
|
34
|
+
startedAt: '2026-09-11T09:59:00.000Z',
|
|
35
|
+
endedAt: '2026-09-11T10:00:00.000Z',
|
|
36
|
+
durationMs: 60_000,
|
|
37
|
+
activeMs: 50_000,
|
|
38
|
+
askUserWaitMs: 0,
|
|
39
|
+
approvalWaitMs: 10_000,
|
|
40
|
+
toolCalls: 3,
|
|
41
|
+
errorToolResults: 1,
|
|
42
|
+
maxFailStreak: 1,
|
|
43
|
+
identicalRetryCount: 0,
|
|
44
|
+
unrecoveredTools: [],
|
|
45
|
+
errorClasses: { schema: 1, platform: 0, config: 0, environment: 0, other: 0 },
|
|
46
|
+
gatherCalls: 2,
|
|
47
|
+
gatherRatio: 2 / 3,
|
|
48
|
+
mutationAttempted: true,
|
|
49
|
+
mutationSucceeded: true,
|
|
50
|
+
rereadCount: 0,
|
|
51
|
+
overheadCalls: 0,
|
|
52
|
+
skillsLoaded: 0,
|
|
53
|
+
interruptedToolCalls: 0,
|
|
54
|
+
llmCalls: 4,
|
|
55
|
+
promptTokens: 1000,
|
|
56
|
+
completionTokens: 200,
|
|
57
|
+
cachedTokens: 800,
|
|
58
|
+
retryCompletionTokens: 50,
|
|
59
|
+
approvalsRequested: 1,
|
|
60
|
+
approvalsDenied: 0,
|
|
61
|
+
stopRequests: 0,
|
|
62
|
+
followupAfterAnswer: false,
|
|
63
|
+
severity: 'none',
|
|
64
|
+
flags: [],
|
|
65
|
+
tools: [
|
|
66
|
+
{
|
|
67
|
+
seq: 1,
|
|
68
|
+
toolUseId: 'tu-1',
|
|
69
|
+
name: 'create_view',
|
|
70
|
+
approvalClass: 'side_effecting',
|
|
71
|
+
ok: false,
|
|
72
|
+
errorClass: 'schema',
|
|
73
|
+
sig: 'abcd1234',
|
|
74
|
+
durationMs: 20,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
toolsTruncated: 0,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
describe('agent run evaluation API contracts', () => {
|
|
81
|
+
it('derives the public types from the runtime schemas', () => {
|
|
82
|
+
expectTypeOf<AgentRunFeedbackPayload>().toEqualTypeOf<
|
|
83
|
+
import('zod').z.infer<typeof AgentRunFeedbackPayloadSchema>
|
|
84
|
+
>();
|
|
85
|
+
expectTypeOf<AgentRunFeedbackResponse>().toEqualTypeOf<
|
|
86
|
+
import('zod').z.infer<typeof AgentRunFeedbackResponseSchema>
|
|
87
|
+
>();
|
|
88
|
+
expectTypeOf<AgentRunFeedbackEntry>().toEqualTypeOf<
|
|
89
|
+
import('zod').z.infer<typeof AgentRunFeedbackEntrySchema>
|
|
90
|
+
>();
|
|
91
|
+
expectTypeOf<AgentRunEvaluationRollup>().toEqualTypeOf<
|
|
92
|
+
import('zod').z.infer<typeof AgentRunEvaluationRollupSchema>
|
|
93
|
+
>();
|
|
94
|
+
expectTypeOf<AgentRunEvaluation>().toEqualTypeOf<import('zod').z.infer<typeof AgentRunEvaluationSchema>>();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('accepts a turn_evaluation event through the ingest payload', () => {
|
|
98
|
+
expect(validateApiRequest('IngestAgentEventsPayload', { events: [turnEvaluation] }).valid).toBe(true);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('rejects a turn_evaluation event with an undeclared field', () => {
|
|
102
|
+
const events = [{ ...turnEvaluation, verdict: 'success' }];
|
|
103
|
+
expect(validateApiRequest('IngestAgentEventsPayload', { events }).valid).toBe(false);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('accepts a feedback event and a judgement event', () => {
|
|
107
|
+
const base = {
|
|
108
|
+
timestamp: turnEvaluation.timestamp,
|
|
109
|
+
runId: 'wf-run-1',
|
|
110
|
+
agentRunId: 'run-1',
|
|
111
|
+
model: '',
|
|
112
|
+
environmentId: '',
|
|
113
|
+
environmentType: '',
|
|
114
|
+
interactionId: 'sys:StudioAssistant',
|
|
115
|
+
deployment: { env: 'staging', group: 'staging', version: 'abc' },
|
|
116
|
+
};
|
|
117
|
+
const events = [
|
|
118
|
+
{
|
|
119
|
+
...base,
|
|
120
|
+
eventType: 'feedback',
|
|
121
|
+
feedbackId: 'f1',
|
|
122
|
+
rating: 'down',
|
|
123
|
+
hasComment: false,
|
|
124
|
+
messageScoped: false,
|
|
125
|
+
replaced: false,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
...base,
|
|
129
|
+
eventType: 'turn_judgement',
|
|
130
|
+
evaluationRev: 2,
|
|
131
|
+
workstreamId: 'main',
|
|
132
|
+
turnSeq: 1,
|
|
133
|
+
gate: 'signal',
|
|
134
|
+
sampleRate: 0,
|
|
135
|
+
selectedProbability: 1,
|
|
136
|
+
outcome: 'judged',
|
|
137
|
+
verdict: 'failure',
|
|
138
|
+
score: 0.2,
|
|
139
|
+
promptVersion: 'v1',
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
expect(validateApiRequest('IngestAgentEventsPayload', { events }).valid).toBe(true);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('requires feedback_id and rejects the retired episode_seq field', () => {
|
|
146
|
+
expect(validateApiRequest('AgentRunFeedbackPayload', { rating: 'up' }).valid).toBe(false);
|
|
147
|
+
expect(validateApiRequest('AgentRunFeedbackPayload', { feedback_id: 'f1', rating: 'up' }).valid).toBe(true);
|
|
148
|
+
expect(
|
|
149
|
+
validateApiRequest('AgentRunFeedbackPayload', { feedback_id: 'f1', rating: 'up', episode_seq: 1 }).valid,
|
|
150
|
+
).toBe(false);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('keeps the workflow rollup free of server-owned fields', () => {
|
|
154
|
+
const rollup: AgentRunEvaluationRollup = {
|
|
155
|
+
seq: 3,
|
|
156
|
+
detector_version: 1,
|
|
157
|
+
turns: 2,
|
|
158
|
+
severity: 'medium',
|
|
159
|
+
flags: ['unrecovered_tool'],
|
|
160
|
+
worst_turn_seq: 2,
|
|
161
|
+
last_terminal_type: 'answer',
|
|
162
|
+
totals: {
|
|
163
|
+
tool_calls: 5,
|
|
164
|
+
error_tool_results: 2,
|
|
165
|
+
unrecovered_tools: ['create_view'],
|
|
166
|
+
llm_calls: 6,
|
|
167
|
+
prompt_tokens: 100,
|
|
168
|
+
completion_tokens: 20,
|
|
169
|
+
cached_tokens: 0,
|
|
170
|
+
retry_completion_tokens: 5,
|
|
171
|
+
active_ms: 1000,
|
|
172
|
+
ask_user_wait_ms: 0,
|
|
173
|
+
approval_wait_ms: 0,
|
|
174
|
+
followups: 0,
|
|
175
|
+
approvals_requested: 0,
|
|
176
|
+
approvals_denied: 0,
|
|
177
|
+
stop_requests: 0,
|
|
178
|
+
},
|
|
179
|
+
updated_at: turnEvaluation.timestamp,
|
|
180
|
+
};
|
|
181
|
+
expect(validateApiRequest('UpdateAgentRunStatusPayload', { evaluation_rollup: rollup }).valid).toBe(true);
|
|
182
|
+
expect(
|
|
183
|
+
validateApiRequest('UpdateAgentRunStatusPayload', {
|
|
184
|
+
evaluation_rollup: { ...rollup, feedback_counts: { up: 1, down: 0 } },
|
|
185
|
+
}).valid,
|
|
186
|
+
).toBe(false);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('validates the published evaluation summary', () => {
|
|
190
|
+
const evaluation: AgentRunEvaluation = {
|
|
191
|
+
rev: 2,
|
|
192
|
+
feedback_counts: { up: 0, down: 1, last_rating: 'down', last_reason_code: 'wrong_result' },
|
|
193
|
+
severity: 'none',
|
|
194
|
+
flags: [],
|
|
195
|
+
contradicted: true,
|
|
196
|
+
contradiction_reasons: ['feedback_down_on_clean_run'],
|
|
197
|
+
deployment_env: 'staging',
|
|
198
|
+
updated_at: turnEvaluation.timestamp,
|
|
199
|
+
};
|
|
200
|
+
expect(validateApiResponse('AgentRunEvaluation', evaluation).valid).toBe(true);
|
|
201
|
+
expect(validateApiRequest('ListAgentRunsQuery', { evaluation_severity: ['unrated', 'high'] }).valid).toBe(true);
|
|
202
|
+
});
|
|
203
|
+
});
|