diff --git a/packages/core/src/PageAgentCore.ts b/packages/core/src/PageAgentCore.ts index 5e7bc83..3f78f19 100644 --- a/packages/core/src/PageAgentCore.ts +++ b/packages/core/src/PageAgentCore.ts @@ -15,7 +15,7 @@ import { AgentActivity, AgentReflection, AgentStatus, - AgentStep, + AgentStepEvent, ExecutionResult, HistoricalEvent, MacroToolInput, @@ -256,7 +256,7 @@ export class PageAgentCore extends EventTarget { next_goal: input.next_goal, } const actionName = Object.keys(input.action)[0] - const action: AgentStep['action'] = { + const action: AgentStepEvent['action'] = { name: actionName, input: input.action[actionName], output: output, @@ -269,7 +269,7 @@ export class PageAgentCore extends EventTarget { action, usage: result.usage, rawResponse: result.rawResponse, - } as AgentStep) + } as AgentStepEvent) this.#emitHistoryChange() console.log(chalk.green('Step finished:'), actionName) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 57c8f9f..b44fb43 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -33,7 +33,7 @@ export interface MacroToolResult { /** * A single agent step with reflection and action */ -export interface AgentStep { +export interface AgentStepEvent { type: 'step' stepIndex: number reflection: Partial @@ -71,7 +71,7 @@ export interface UserTakeoverEvent { /** * Error event (retry or error from LLM) */ -export interface ErrorEvent { +export interface AgentErrorEvent { type: 'error' errorType: 'retry' | 'error' message: string @@ -83,7 +83,11 @@ export interface ErrorEvent { /** * Union type for all history events */ -export type HistoricalEvent = AgentStep | ObservationEvent | UserTakeoverEvent | ErrorEvent +export type HistoricalEvent = + | AgentStepEvent + | ObservationEvent + | UserTakeoverEvent + | AgentErrorEvent /** * Agent execution status