|
| 1 | +import { BaseModel } from "./common"; |
| 2 | + |
| 3 | +/** |
| 4 | + * Agent run status enum |
| 5 | + */ |
| 6 | +export type AgentRunStatus = |
| 7 | + | "created" |
| 8 | + | "in_progress" |
| 9 | + | "awaiting" |
| 10 | + | "completed" |
| 11 | + | "stopping" |
| 12 | + | "stopped" |
| 13 | + | "failed" |
| 14 | + | "stale"; |
| 15 | + |
| 16 | +/** |
| 17 | + * Agent run type enum |
| 18 | + */ |
| 19 | +export type AgentRunType = "comment_thread"; |
| 20 | + |
| 21 | +/** |
| 22 | + * Agent run activity signal enum |
| 23 | + */ |
| 24 | +export type AgentRunActivitySignal = "auth_request" | "continue" | "select" | "stop"; |
| 25 | + |
| 26 | +/** |
| 27 | + * Agent run activity type enum |
| 28 | + */ |
| 29 | +export type AgentRunActivityType = "action" | "elicitation" | "error" | "prompt" | "response" | "thought"; |
| 30 | + |
| 31 | +/** |
| 32 | + * Agent Run interface |
| 33 | + */ |
| 34 | +export interface AgentRun extends BaseModel { |
| 35 | + agent_user: string; |
| 36 | + comment?: string; |
| 37 | + source_comment?: string; |
| 38 | + creator: string; |
| 39 | + stopped_at?: string; |
| 40 | + stopped_by?: string; |
| 41 | + started_at: string; |
| 42 | + ended_at?: string; |
| 43 | + external_link?: string; |
| 44 | + issue?: string; |
| 45 | + workspace: string; |
| 46 | + project?: string; |
| 47 | + status: AgentRunStatus; |
| 48 | + error_metadata?: Record<string, any>; |
| 49 | + type: AgentRunType; |
| 50 | +} |
| 51 | + |
| 52 | +/** |
| 53 | + * Create agent run request interface |
| 54 | + */ |
| 55 | +export interface CreateAgentRunRequest { |
| 56 | + agent_slug: string; |
| 57 | + issue?: string; |
| 58 | + project?: string; |
| 59 | + comment?: string; |
| 60 | + source_comment?: string; |
| 61 | + external_link?: string; |
| 62 | + type?: AgentRunType; |
| 63 | +} |
| 64 | + |
| 65 | +/** |
| 66 | + * Agent run activity content for action type |
| 67 | + */ |
| 68 | +export interface AgentRunActivityActionContent { |
| 69 | + type: "action"; |
| 70 | + action: string; |
| 71 | + parameters: Record<string, string>; |
| 72 | +} |
| 73 | + |
| 74 | +/** |
| 75 | + * Agent run activity content for other types |
| 76 | + */ |
| 77 | +export interface AgentRunActivityTextContent { |
| 78 | + type: Exclude<AgentRunActivityType, "action">; |
| 79 | + body: string; |
| 80 | +} |
| 81 | + |
| 82 | +/** |
| 83 | + * Agent run activity content |
| 84 | + */ |
| 85 | +export type AgentRunActivityContent = AgentRunActivityActionContent | AgentRunActivityTextContent; |
| 86 | + |
| 87 | +/** |
| 88 | + * Agent Run Activity interface |
| 89 | + */ |
| 90 | +export interface AgentRunActivity extends BaseModel { |
| 91 | + agent_run: string; |
| 92 | + content: AgentRunActivityContent; |
| 93 | + content_metadata?: Record<string, any>; |
| 94 | + ephemeral: boolean; |
| 95 | + signal: AgentRunActivitySignal; |
| 96 | + signal_metadata?: Record<string, any>; |
| 97 | + comment?: string; |
| 98 | + actor?: string; |
| 99 | + type: AgentRunActivityType; |
| 100 | + project?: string; |
| 101 | + workspace: string; |
| 102 | +} |
| 103 | + |
| 104 | +/** |
| 105 | + * Create agent run activity request interface |
| 106 | + */ |
| 107 | +export interface CreateAgentRunActivityRequest { |
| 108 | + content: AgentRunActivityContent; |
| 109 | + content_metadata?: Record<string, any>; |
| 110 | + signal?: AgentRunActivitySignal; |
| 111 | + signal_metadata?: Record<string, any>; |
| 112 | + type: Exclude<AgentRunActivityType, "prompt">; |
| 113 | + project?: string; |
| 114 | +} |
0 commit comments