Skip to content

misc

Class info

Classes

Name Children Inherits
ExecPolicyAmendment
codexed.models.misc
Proposed execpolicy amendment (prefix rule).
    McpServerStatusEntry
    codexed.models.misc
    Status of a single MCP server.
      NetworkApprovalContext
      codexed.models.misc
      Network approval context for command approvals.
        NetworkPolicyAmendment
        codexed.models.misc
        Proposed network policy amendment.
          SkillRequestApprovalResponse
          codexed.models.misc
          Response for skill/requestApproval server request.
            Thread
            codexed.models.misc
              ToolRequestUserInputAnswer
              codexed.models.misc
              A user's answer to a request_user_input question.
                ToolRequestUserInputOption
                codexed.models.misc
                A selectable option for a user input question.
                  ToolRequestUserInputQuestion
                  codexed.models.misc
                  A question in a tool request for user input.
                    Turn
                    codexed.models.misc
                    Turn data structure.
                      TurnData
                      codexed.models.misc
                      Turn data in responses.
                        TurnsPage
                        codexed.models.misc
                        A page of turns.

                          🛈 DocStrings

                          Pydantic models for Codex JSON-RPC API requests and responses.

                          ExecPolicyAmendment

                          Bases: CodexBaseModel

                          Proposed execpolicy amendment (prefix rule).

                          Source code in src/codexed/models/misc.py
                          class ExecPolicyAmendment(CodexBaseModel):
                              """Proposed execpolicy amendment (prefix rule)."""
                          
                              command: list[str]
                          

                          McpServerStatusEntry

                          Bases: CodexBaseModel

                          Status of a single MCP server.

                          Source code in src/codexed/models/misc.py
                          class McpServerStatusEntry(CodexBaseModel):
                              """Status of a single MCP server."""
                          
                              name: str
                              tools: dict[str, Tool] = Field(default_factory=dict)
                              resources: list[Resource] = Field(default_factory=list)
                              resource_templates: list[ResourceTemplate] = Field(default_factory=list)
                              auth_status: McpAuthStatus = "unsupported"
                          

                          NetworkApprovalContext

                          Bases: CodexBaseModel

                          Network approval context for command approvals.

                          Source code in src/codexed/models/misc.py
                          class NetworkApprovalContext(CodexBaseModel):
                              """Network approval context for command approvals."""
                          
                              host: str
                              protocol: NetworkApprovalProtocol
                          

                          NetworkPolicyAmendment

                          Bases: CodexBaseModel

                          Proposed network policy amendment.

                          Source code in src/codexed/models/misc.py
                          class NetworkPolicyAmendment(CodexBaseModel):
                              """Proposed network policy amendment."""
                          
                              host: str
                              action: NetworkDomainPermission
                          

                          SkillRequestApprovalResponse

                          Bases: CodexBaseModel

                          Response for skill/requestApproval server request.

                          Source code in src/codexed/models/misc.py
                          class SkillRequestApprovalResponse(CodexBaseModel):
                              """Response for skill/requestApproval server request."""
                          
                              decision: SkillApprovalDecision
                          

                          Thread

                          Bases: CodexBaseModel

                          Source code in src/codexed/models/misc.py
                          class Thread(CodexBaseModel):
                              agent_nickname: str | None = None
                              """
                              Optional random unique nickname assigned to an AgentControl-spawned sub-agent.
                              """
                              agent_role: str | None = None
                              """
                              Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.
                              """
                              cli_version: str
                              """
                              Version of the CLI that created the thread.
                              """
                              created_at: int
                              """
                              Unix timestamp (in seconds) when the thread was created.
                              """
                              cwd: AbsolutePathBuf
                              """
                              Working directory captured for the thread.
                              """
                              ephemeral: bool
                              """
                              Whether the thread is ephemeral and should not be materialized on disk.
                              """
                              forked_from_id: str | None = None
                              """
                              Source thread id when this thread was created by forking another thread.
                              """
                              git_info: GitInfo | None = None
                              """
                              Optional Git metadata captured when the thread was created.
                              """
                              id: str
                              model_provider: str
                              """
                              Model provider used for this thread (for example, 'openai').
                              """
                              name: str | None = None
                              """
                              Optional user-facing thread title.
                              """
                              path: str | None = None
                              """
                              [UNSTABLE] Path to the thread on disk.
                              """
                              preview: str
                              """
                              Usually the first user message in the thread, if available.
                              """
                              source: SessionSource
                              """
                              Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).
                              """
                              status: ThreadStatus
                              """
                              Current runtime status for the thread.
                              """
                              turns: list[Turn]
                              """
                              Only populated on `thread/resume`, `thread/fork`, and `thread/read`
                              (when `includeTurns` is true) responses.
                              For all other responses and notifications returning a Thread,
                              the turns field will be an empty list.
                              """
                              updated_at: int
                              """
                              Unix timestamp (in seconds) when the thread was last updated.
                              """
                              attached_to_thread_id: str | None = None
                              can_accept_direct_input: bool | None = None
                              daybreak_enabled: bool | None = None
                              environments: list[ThreadEnvironment] | None = None
                              extra: ThreadExtra | None = None
                              history_mode: ThreadHistoryMode | None = None
                              model: str | None = None
                              originator: str | None = None
                              parent_thread_id: str | None = None
                              project_id: str | None = None
                              reasoning_effort: ReasoningEffort | None = None
                              recency_at: int | None = None
                              """Unix timestamp (in seconds) used to order threads by recency."""
                              section: ThreadSection | None = None
                              section_entered_at: int | None = None
                              session_id: str | None = None
                              thread_source: str | None = None
                          

                          agent_nickname class-attribute instance-attribute

                          agent_nickname: str | None = None
                          

                          Optional random unique nickname assigned to an AgentControl-spawned sub-agent.

                          agent_role class-attribute instance-attribute

                          agent_role: str | None = None
                          

                          Optional role (agent_role) assigned to an AgentControl-spawned sub-agent.

                          cli_version instance-attribute

                          cli_version: str
                          

                          Version of the CLI that created the thread.

                          created_at instance-attribute

                          created_at: int
                          

                          Unix timestamp (in seconds) when the thread was created.

                          cwd instance-attribute

                          Working directory captured for the thread.

                          ephemeral instance-attribute

                          ephemeral: bool
                          

                          Whether the thread is ephemeral and should not be materialized on disk.

                          forked_from_id class-attribute instance-attribute

                          forked_from_id: str | None = None
                          

                          Source thread id when this thread was created by forking another thread.

                          git_info class-attribute instance-attribute

                          git_info: GitInfo | None = None
                          

                          Optional Git metadata captured when the thread was created.

                          model_provider instance-attribute

                          model_provider: str
                          

                          Model provider used for this thread (for example, 'openai').

                          name class-attribute instance-attribute

                          name: str | None = None
                          

                          Optional user-facing thread title.

                          path class-attribute instance-attribute

                          path: str | None = None
                          

                          [UNSTABLE] Path to the thread on disk.

                          preview instance-attribute

                          preview: str
                          

                          Usually the first user message in the thread, if available.

                          recency_at class-attribute instance-attribute

                          recency_at: int | None = None
                          

                          Unix timestamp (in seconds) used to order threads by recency.

                          source instance-attribute

                          source: SessionSource
                          

                          Origin of the thread (CLI, VSCode, codex exec, codex app-server, etc.).

                          status instance-attribute

                          status: ThreadStatus
                          

                          Current runtime status for the thread.

                          turns instance-attribute

                          turns: list[Turn]
                          

                          Only populated on thread/resume, thread/fork, and thread/read (when includeTurns is true) responses. For all other responses and notifications returning a Thread, the turns field will be an empty list.

                          updated_at instance-attribute

                          updated_at: int
                          

                          Unix timestamp (in seconds) when the thread was last updated.

                          ToolRequestUserInputAnswer

                          Bases: CodexBaseModel

                          A user's answer to a request_user_input question.

                          Source code in src/codexed/models/misc.py
                          class ToolRequestUserInputAnswer(CodexBaseModel):
                              """A user's answer to a request_user_input question."""
                          
                              answers: list[str]
                          

                          ToolRequestUserInputOption

                          Bases: CodexBaseModel

                          A selectable option for a user input question.

                          Source code in src/codexed/models/misc.py
                          class ToolRequestUserInputOption(CodexBaseModel):
                              """A selectable option for a user input question."""
                          
                              label: str
                              description: str
                          

                          ToolRequestUserInputQuestion

                          Bases: CodexBaseModel

                          A question in a tool request for user input.

                          Source code in src/codexed/models/misc.py
                          class ToolRequestUserInputQuestion(CodexBaseModel):
                              """A question in a tool request for user input."""
                          
                              id: str
                              header: str
                              question: str
                              is_other: bool = False
                              is_secret: bool = False
                              options: list[ToolRequestUserInputOption] | None = None
                          
                              def to_schema_property(self) -> dict[str, Any]:
                                  """Convert a Codex user input question to a JSON Schema property.
                          
                                  Maps question options to enum values, and handles secret/free-text questions.
                          
                                  Args:
                                      question: Codex question with optional options list
                          
                                  Returns:
                                      JSON Schema property definition
                                  """
                                  prop: dict[str, Any] = {"title": self.header or self.id}
                                  if self.question:
                                      prop["description"] = self.question
                          
                                  if self.options and not self.is_other:
                                      # Question with fixed options -> enum
                                      prop["type"] = "string"
                                      prop["enum"] = [opt.label for opt in self.options]
                                  elif self.options and self.is_other:
                                      # Options with an "other" free-text fallback -> enum + freeform
                                      prop["type"] = "string"
                                      prop["enum"] = [opt.label for opt in self.options]
                                  else:
                                      # Free-text question
                                      prop["type"] = "string"
                          
                                  if self.is_secret:
                                      prop["writeOnly"] = True
                          
                                  return prop
                          

                          to_schema_property

                          to_schema_property() -> dict[str, Any]
                          

                          Convert a Codex user input question to a JSON Schema property.

                          Maps question options to enum values, and handles secret/free-text questions.

                          Parameters:

                          Name Type Description Default
                          question

                          Codex question with optional options list

                          required

                          Returns:

                          Type Description
                          dict[str, Any]

                          JSON Schema property definition

                          Source code in src/codexed/models/misc.py
                          def to_schema_property(self) -> dict[str, Any]:
                              """Convert a Codex user input question to a JSON Schema property.
                          
                              Maps question options to enum values, and handles secret/free-text questions.
                          
                              Args:
                                  question: Codex question with optional options list
                          
                              Returns:
                                  JSON Schema property definition
                              """
                              prop: dict[str, Any] = {"title": self.header or self.id}
                              if self.question:
                                  prop["description"] = self.question
                          
                              if self.options and not self.is_other:
                                  # Question with fixed options -> enum
                                  prop["type"] = "string"
                                  prop["enum"] = [opt.label for opt in self.options]
                              elif self.options and self.is_other:
                                  # Options with an "other" free-text fallback -> enum + freeform
                                  prop["type"] = "string"
                                  prop["enum"] = [opt.label for opt in self.options]
                              else:
                                  # Free-text question
                                  prop["type"] = "string"
                          
                              if self.is_secret:
                                  prop["writeOnly"] = True
                          
                              return prop
                          

                          Turn

                          Bases: CodexBaseModel

                          Turn data structure.

                          Source code in src/codexed/models/misc.py
                          class Turn(CodexBaseModel):
                              """Turn data structure."""
                          
                              id: str
                          
                              completed_at: int | None = None
                              """
                              Unix timestamp (in seconds) when the turn completed.
                              """
                              duration_ms: int | None = None
                              """
                              Duration between turn start and completion in milliseconds, if known.
                              """
                              error: TurnError | None = None
                              """
                              Only populated when the Turn's status is failed.
                              """
                              items: list[ThreadItem]
                              """
                              Only populated on a `thread/resume` or `thread/fork` response.
                          
                              For all other responses and notifications returning a Turn,
                              the items field will be an empty list.
                              """
                              started_at: int | None = None
                              """
                              Unix timestamp (in seconds) when the turn started.
                              """
                              status: TurnStatus
                          
                              @property
                              def final_response(self) -> str | None:
                                  """Extract the final assistant response text from this turn.
                          
                                  Looks for the last ``ThreadItemAgentMessage`` with ``phase="final_answer"``.
                                  Falls back to the last agent message with no phase (for models that don't
                                  emit phase metadata). Returns None if the turn has no agent messages.
                          
                                  For structured output turns, this returns the raw JSON string.
                                  """
                                  last_unphased: str | None = None
                                  for item in reversed(self.items):
                                      match item:
                                          case ThreadItemAgentMessage(phase="final_answer", text=text):
                                              return text
                                          case ThreadItemAgentMessage(phase=None, text=text) if last_unphased is None:
                                              last_unphased = text
                                  return last_unphased
                          
                              items_view: TurnItemsView | None = None
                              """How completely the turn's items are included in this payload."""
                              root_turn_id: str | None = None
                          

                          completed_at class-attribute instance-attribute

                          completed_at: int | None = None
                          

                          Unix timestamp (in seconds) when the turn completed.

                          duration_ms class-attribute instance-attribute

                          duration_ms: int | None = None
                          

                          Duration between turn start and completion in milliseconds, if known.

                          error class-attribute instance-attribute

                          error: TurnError | None = None
                          

                          Only populated when the Turn's status is failed.

                          final_response property

                          final_response: str | None
                          

                          Extract the final assistant response text from this turn.

                          Looks for the last ThreadItemAgentMessage with phase="final_answer". Falls back to the last agent message with no phase (for models that don't emit phase metadata). Returns None if the turn has no agent messages.

                          For structured output turns, this returns the raw JSON string.

                          items instance-attribute

                          items: list[ThreadItem]
                          

                          Only populated on a thread/resume or thread/fork response.

                          For all other responses and notifications returning a Turn, the items field will be an empty list.

                          items_view class-attribute instance-attribute

                          items_view: TurnItemsView | None = None
                          

                          How completely the turn's items are included in this payload.

                          started_at class-attribute instance-attribute

                          started_at: int | None = None
                          

                          Unix timestamp (in seconds) when the turn started.

                          TurnData

                          Bases: CodexBaseModel

                          Turn data in responses.

                          Source code in src/codexed/models/misc.py
                          class TurnData(CodexBaseModel):
                              """Turn data in responses."""
                          
                              id: str
                              status: TurnStatus  # always provided by the server
                              thread_id: str | None = None
                              items: list[ThreadItem] = Field(default_factory=list)
                              error: str | None = None
                              items_view: TurnItemsView | None = None
                              """How completely the turn's items are included in this payload."""
                              root_turn_id: str | None = None
                              started_at: int | None = None
                              completed_at: int | None = None
                              duration_ms: int | None = None
                          

                          items_view class-attribute instance-attribute

                          items_view: TurnItemsView | None = None
                          

                          How completely the turn's items are included in this payload.

                          TurnsPage

                          Bases: CodexBaseModel

                          A page of turns.

                          Source code in src/codexed/models/misc.py
                          class TurnsPage(CodexBaseModel):
                              """A page of turns."""
                          
                              backwards_cursor: str | None = None
                              data: list[Turn]
                              next_cursor: str | None = None