mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
Update event schema types to use enum pattern (#7498)
Co-authored-by: Calvin Smith <calvin@all-hands.dev> Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
@@ -1,87 +1,83 @@
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
__all__ = ['ActionType']
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ActionTypeSchema(BaseModel):
|
||||
MESSAGE: str = Field(default='message')
|
||||
class ActionType(str, Enum):
|
||||
MESSAGE = 'message'
|
||||
"""Represents a message.
|
||||
"""
|
||||
|
||||
START: str = Field(default='start')
|
||||
START = 'start'
|
||||
"""Starts a new development task OR send chat from the user. Only sent by the client.
|
||||
"""
|
||||
|
||||
READ: str = Field(default='read')
|
||||
READ = 'read'
|
||||
"""Reads the content of a file.
|
||||
"""
|
||||
|
||||
WRITE: str = Field(default='write')
|
||||
WRITE = 'write'
|
||||
"""Writes the content to a file.
|
||||
"""
|
||||
|
||||
EDIT: str = Field(default='edit')
|
||||
EDIT = 'edit'
|
||||
"""Edits a file by providing a draft.
|
||||
"""
|
||||
|
||||
RUN: str = Field(default='run')
|
||||
RUN = 'run'
|
||||
"""Runs a command.
|
||||
"""
|
||||
|
||||
RUN_IPYTHON: str = Field(default='run_ipython')
|
||||
RUN_IPYTHON = 'run_ipython'
|
||||
"""Runs a IPython cell.
|
||||
"""
|
||||
|
||||
BROWSE: str = Field(default='browse')
|
||||
BROWSE = 'browse'
|
||||
"""Opens a web page.
|
||||
"""
|
||||
|
||||
BROWSE_INTERACTIVE: str = Field(default='browse_interactive')
|
||||
BROWSE_INTERACTIVE = 'browse_interactive'
|
||||
"""Interact with the browser instance.
|
||||
"""
|
||||
|
||||
DELEGATE: str = Field(default='delegate')
|
||||
DELEGATE = 'delegate'
|
||||
"""Delegates a task to another agent.
|
||||
"""
|
||||
|
||||
THINK: str = Field(default='think')
|
||||
|
||||
THINK = 'think'
|
||||
"""Logs a thought.
|
||||
"""
|
||||
|
||||
FINISH: str = Field(default='finish')
|
||||
FINISH = 'finish'
|
||||
"""If you're absolutely certain that you've completed your task and have tested your work,
|
||||
use the finish action to stop working.
|
||||
"""
|
||||
|
||||
REJECT: str = Field(default='reject')
|
||||
REJECT = 'reject'
|
||||
"""If you're absolutely certain that you cannot complete the task with given requirements,
|
||||
use the reject action to stop working.
|
||||
"""
|
||||
|
||||
NULL: str = Field(default='null')
|
||||
NULL = 'null'
|
||||
|
||||
PAUSE: str = Field(default='pause')
|
||||
PAUSE = 'pause'
|
||||
"""Pauses the task.
|
||||
"""
|
||||
|
||||
RESUME: str = Field(default='resume')
|
||||
RESUME = 'resume'
|
||||
"""Resumes the task.
|
||||
"""
|
||||
|
||||
STOP: str = Field(default='stop')
|
||||
STOP = 'stop'
|
||||
"""Stops the task. Must send a start action to restart a new task.
|
||||
"""
|
||||
|
||||
CHANGE_AGENT_STATE: str = Field(default='change_agent_state')
|
||||
CHANGE_AGENT_STATE = 'change_agent_state'
|
||||
|
||||
PUSH: str = Field(default='push')
|
||||
PUSH = 'push'
|
||||
"""Push a branch to github."""
|
||||
|
||||
SEND_PR: str = Field(default='send_pr')
|
||||
SEND_PR = 'send_pr'
|
||||
"""Send a PR to github."""
|
||||
|
||||
RECALL: str = Field(default='recall')
|
||||
RECALL = 'recall'
|
||||
"""Retrieves content from a user workspace, microagent, or other source."""
|
||||
|
||||
|
||||
ActionType = ActionTypeSchema()
|
||||
|
||||
Reference in New Issue
Block a user