| 28 | * - 'dispose': Agent is being disposed |
| 29 | */ |
| 30 | export interface PanelAgentAdapter extends EventTarget { |
| 31 | /** Current agent status */ |
| 32 | readonly status: 'idle' | 'running' | 'completed' | 'error' | 'stopped' |
| 33 | |
| 34 | /** Result of the most recent run, or `null` before the first run completes */ |
| 35 | readonly lastResult: { success: boolean } | null |
| 36 | |
| 37 | /** History of agent events */ |
| 38 | readonly history: readonly { |
| 39 | type: 'step' | 'observation' | 'user_takeover' | 'retry' | 'error' |
| 40 | stepIndex?: number |
| 41 | /** For 'step' type */ |
| 42 | reflection?: { |
| 43 | evaluation_previous_goal?: string |
| 44 | memory?: string |
| 45 | next_goal?: string |
| 46 | } |
| 47 | /** For 'step' type */ |
| 48 | action?: { |
| 49 | name: string |
| 50 | input: unknown |
| 51 | output: string |
| 52 | } |
| 53 | /** For 'observation' type */ |
| 54 | content?: string |
| 55 | /** For 'retry' type */ |
| 56 | attempt?: number |
| 57 | maxAttempts?: number |
| 58 | /** For 'retry' and 'error' types */ |
| 59 | message?: string |
| 60 | }[] |
| 61 | |
| 62 | /** Current task being executed */ |
| 63 | readonly task: string |
| 64 | |
| 65 | /** |
| 66 | * Called when the agent needs to ask the user questions. |
| 67 | * If unset, the `ask_user` tool will be disabled. |
| 68 | * Panel will set this to handle user questions via its UI. |
| 69 | * The optional `signal` aborts when the task is stopped or disposed. |
| 70 | */ |
| 71 | onAskUser?: (question: string, options?: { signal: AbortSignal }) => Promise<string> |
| 72 | |
| 73 | /** Execute a task */ |
| 74 | execute(task: string): Promise<unknown> |
| 75 | |
| 76 | /** Stop the current task (agent remains reusable) */ |
| 77 | stop(): Promise<void> |
| 78 | |
| 79 | /** Dispose the agent (terminal, cannot be reused) */ |
| 80 | dispose(): void |
| 81 | } |
no outgoing calls
no test coverage detected