From 5b5da7c19aa0916bfa29ccd1c7b325aa71237745 Mon Sep 17 00:00:00 2001 From: SentienceDEV Date: Mon, 19 Jan 2026 19:31:37 -0800 Subject: [PATCH 1/2] updated trace schema --- src/agent-runtime.ts | 9 +++-- tests/agent-runtime-assertions.test.ts | 46 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/src/agent-runtime.ts b/src/agent-runtime.ts index d74d363..e13a326 100644 --- a/src/agent-runtime.ts +++ b/src/agent-runtime.ts @@ -39,7 +39,6 @@ */ import { Page } from 'playwright'; -import { v4 as uuidv4 } from 'uuid'; import { Snapshot } from './types'; import { AssertContext, Predicate } from './verification'; import { Tracer } from './tracing/tracer'; @@ -741,15 +740,12 @@ export class AgentRuntime { * * @param goal - Description of what this step aims to achieve * @param stepIndex - Optional explicit step index (otherwise auto-increments) - * @returns Generated stepId + * @returns Generated stepId in format 'step-N' where N is the step index */ beginStep(goal: string, stepIndex?: number): string { // Clear previous step state this.assertionsThisStep = []; - // Generate new stepId - this.stepId = uuidv4(); - // Update step index if (stepIndex !== undefined) { this.stepIndex = stepIndex; @@ -757,6 +753,9 @@ export class AgentRuntime { this.stepIndex += 1; } + // Generate stepId in 'step-N' format for Studio compatibility + this.stepId = `step-${this.stepIndex}`; + return this.stepId; } diff --git a/tests/agent-runtime-assertions.test.ts b/tests/agent-runtime-assertions.test.ts index e1bfc08..0948d43 100644 --- a/tests/agent-runtime-assertions.test.ts +++ b/tests/agent-runtime-assertions.test.ts @@ -40,6 +40,52 @@ function makeElement( } as Element; } +describe('AgentRuntime.beginStep() stepId format', () => { + it('generates stepId in step-N format', () => { + const sink = new MockSink(); + const tracer = new Tracer('test-run', sink); + const page = new MockPage('https://example.com') as any; + const browserLike = { + snapshot: async () => ({ + status: 'success', + url: 'https://example.com', + elements: [], + timestamp: 't1', + }), + }; + + const runtime = new AgentRuntime(browserLike as any, page as any, tracer); + + const stepId1 = runtime.beginStep('Step 1'); + expect(stepId1).toBe('step-1'); + expect(runtime.stepIndex).toBe(1); + + const stepId2 = runtime.beginStep('Step 2'); + expect(stepId2).toBe('step-2'); + expect(runtime.stepIndex).toBe(2); + }); + + it('generates stepId matching explicit stepIndex', () => { + const sink = new MockSink(); + const tracer = new Tracer('test-run', sink); + const page = new MockPage('https://example.com') as any; + const browserLike = { + snapshot: async () => ({ + status: 'success', + url: 'https://example.com', + elements: [], + timestamp: 't1', + }), + }; + + const runtime = new AgentRuntime(browserLike as any, page as any, tracer); + + const stepId = runtime.beginStep('Custom step', 10); + expect(stepId).toBe('step-10'); + expect(runtime.stepIndex).toBe(10); + }); +}); + describe('AgentRuntime.assert() with state predicates', () => { it('uses snapshot context for enabled/disabled/value assertions', () => { const sink = new MockSink(); From e2a0242dce095cf147c191008b412ff490148fa9 Mon Sep 17 00:00:00 2001 From: SentienceDEV Date: Mon, 19 Jan 2026 19:49:54 -0800 Subject: [PATCH 2/2] fix tests --- tests/actions.test.ts | 2 +- tests/snapshot.test.ts | 2 +- tests/video-recording.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/actions.test.ts b/tests/actions.test.ts index 232e3e7..b91639a 100644 --- a/tests/actions.test.ts +++ b/tests/actions.test.ts @@ -174,7 +174,7 @@ describe('Actions', () => { } finally { await browser.close(); } - }, 60000); + }, 90000); // 90 seconds - Windows CI can be slow it('should take snapshot after scroll when requested', async () => { const browser = await createTestBrowser(); diff --git a/tests/snapshot.test.ts b/tests/snapshot.test.ts index 3db2fa3..c5bfe2e 100644 --- a/tests/snapshot.test.ts +++ b/tests/snapshot.test.ts @@ -23,7 +23,7 @@ describe('Snapshot', () => { } finally { await browser.close(); } - }, 60000); // 60 seconds - browser startup can be slow + }, 90000); // 90 seconds - Windows CI can be slow it('should have valid element structure', async () => { const browser = await createTestBrowser(); diff --git a/tests/video-recording.test.ts b/tests/video-recording.test.ts index c5e9b5e..f4366f2 100644 --- a/tests/video-recording.test.ts +++ b/tests/video-recording.test.ts @@ -301,5 +301,5 @@ describe('video recording', () => { throw error; } } - }); + }, 180000); // 180 seconds - tests 3 resolutions with browser start/stop each, Windows CI can be slow });