archastro.platform.types.chat

  1# Copyright (c) 2026 ArchAstro Inc. Licensed under the MIT License.
  2# This file is auto-generated by @archastro/sdk-generator. Do not edit.
  3# Content hash: 25c7806cf204
  4
  5from typing import Annotated, Any, Literal
  6
  7from pydantic import BaseModel, Field
  8
  9from .common import Agent, Cancelled, Message, Ok
 10from .teams import Team
 11from .threads import Thread
 12from .users import User
 13
 14
 15class ChatMember(BaseModel):
 16    """
 17    A participant in a chat thread, which may be either a human user or an AI agent. Exactly one of `user` or `agent` is populated depending on `type`.
 18    """
 19
 20    agent: Agent | None = Field(
 21        default=None,
 22        description='Full agent object for this member. Populated when `type` is `"agent"`; `null` for user members.',
 23    )
 24    membership_type: str | None = Field(
 25        default=None,
 26        description='Role of this member within the thread. Common values are `"owner"` and `"member"`. `null` when the membership type is not applicable.',
 27    )
 28    type: str = Field(
 29        ...,
 30        description='Kind of participant. One of `"user"` (a human user) or `"agent"` (an AI agent).',
 31    )
 32    user: User | None = Field(
 33        default=None,
 34        description='Full user object for this member. Populated when `type` is `"user"`; `null` for agent members.',
 35    )
 36
 37
 38class ChatRoomModel(BaseModel):
 39    """
 40    A point-in-time snapshot of a chat room's state, including its loaded messages, member roster, and pagination cursors. Returned when loading or refreshing a thread's message list.
 41    """
 42
 43    after_cursor: str | None = Field(
 44        default=None,
 45        description="Opaque cursor to pass when fetching messages newer than those in this snapshot. `null` when this snapshot already reflects the latest messages.",
 46    )
 47    agent: Agent | None = Field(
 48        default=None,
 49        description="The agent associated with this chat room. `null` when no agent is attached.",
 50    )
 51    before_cursor: str | None = Field(
 52        default=None,
 53        description="Opaque cursor to pass when fetching messages older than those in this snapshot. `null` when the beginning of the thread history has been reached.",
 54    )
 55    is_transient: bool = Field(
 56        ...,
 57        description="Whether this thread is ephemeral. Transient threads are not retained in long-term storage and may be deleted when the session ends.",
 58    )
 59    members: list[ChatMember] = Field(
 60        ...,
 61        description="All active members of the chat room, including both human users and agents.",
 62    )
 63    messages: list[Message] = Field(
 64        ...,
 65        description="The page of messages currently loaded for the thread, ordered chronologically. Use `before_cursor` or `after_cursor` to page through additional history.",
 66    )
 67    messages_loaded_on_last_update: int | None = Field(
 68        default=None,
 69        description="Number of messages that were added to the snapshot in the most recent incremental update. `null` on the initial load.",
 70    )
 71    team: Team | None = Field(
 72        default=None,
 73        description="The team that owns this thread. `null` for threads scoped to an individual user rather than a team.",
 74    )
 75    thread: Thread = Field(
 76        ...,
 77        description="The parent thread whose message history and membership this snapshot represents.",
 78    )
 79
 80
 81class ChatForkThreadResponse(BaseModel):
 82    """
 83    Response returned after forking a chat thread. Contains the new thread, its initial chat-room snapshot, and the owning team when applicable.
 84    """
 85
 86    chat_model: ChatRoomModel | None = Field(
 87        default=None,
 88        description="Initial chat-room render snapshot for the forked thread, including members and loaded messages. `null` for transient threads whose room model is suppressed.",
 89    )
 90    team: Team | None = Field(
 91        default=None,
 92        description="Team that owns the forked thread. Present only when the original thread was team-scoped; `null` for personal threads.",
 93    )
 94    thread: Thread = Field(
 95        ..., description="The newly-created thread produced by the fork operation."
 96    )
 97
 98
 99class ChatLoadMoreMessagesResponse(BaseModel):
100    """
101    Response returned after loading an additional page of chat messages. Contains a refreshed chat-room snapshot with the newly-fetched messages merged in.
102    """
103
104    data: ChatRoomModel = Field(
105        ...,
106        description="Updated chat-room snapshot for the thread, incorporating the newly-loaded page of messages alongside any previously loaded messages.",
107    )
108
109
110class ChatLocalToolCall(BaseModel):
111    """
112    One local function invocation requested by the model.
113    """
114
115    arguments: dict[str, Any]
116    id: str
117    name: str
118
119
120class ChatLocalToolFunction(BaseModel):
121    """
122    A function implemented by the client connected to a personal thread.
123    """
124
125    description: str
126    name: str
127    parameters: dict[str, Any]
128
129
130class ChatLocalToolDefinition(BaseModel):
131    """
132    An OpenAI-compatible local function definition advertised by a personal-thread connection.
133    """
134
135    function: ChatLocalToolFunction
136    type: Literal["function"]
137
138
139class ChatLocalToolProvider(BaseModel):
140    """
141    Server-issued identity for the local-tool set currently advertised by this connection.
142    """
143
144    generation: int
145    provider_id: str
146
147
148class ChatLocalToolRequest(BaseModel):
149    """
150    A correlated batch of local function calls targeted to one connection.
151    """
152
153    calls: list[ChatLocalToolCall]
154    id: str
155
156
157class ChatLocalToolResultError(BaseModel):
158    """
159    A failed local-tool outcome.
160    """
161
162    call_id: str
163    code: str
164    message: str
165    status: Literal["error"] = "error"
166
167
168# One terminal local-tool outcome returned by the owning client connection.
169ChatLocalToolResult = Annotated[
170    Ok | ChatLocalToolResultError | Cancelled, Field(discriminator="status")
171]
172
173
174class ChatMarkThreadReadResponse(BaseModel):
175    """
176    Response returned after marking a chat thread as read. Confirms that the read marker was successfully recorded for the authenticated user.
177    """
178
179    success: bool = Field(
180        ...,
181        description="Indicates whether the read marker was successfully applied. Always `true` on success; errors are returned as channel error replies rather than a `false` value here.",
182    )
183
184
185class ChatMessageListResponse(BaseModel):
186    """
187    Response returned when listing the messages of a joined chat thread. Contains the set of messages currently loaded for the thread.
188    """
189
190    messages: list[Message] = Field(
191        ...,
192        description="Ordered array of message objects currently loaded for the thread, from oldest to newest. Use the `load_more_messages` channel message to fetch earlier pages.",
193    )
194
195
196class ChatPostMessageResponse(BaseModel):
197    """
198    Response returned after successfully posting a message to a chat thread. Contains the persisted message object echoed back to the sender.
199    """
200
201    message: Message = Field(
202        ...,
203        description="The message that was created and stored. Contains the full message object including its assigned ID, author, content, and timestamps.",
204    )
class ChatMember(pydantic.main.BaseModel):
16class ChatMember(BaseModel):
17    """
18    A participant in a chat thread, which may be either a human user or an AI agent. Exactly one of `user` or `agent` is populated depending on `type`.
19    """
20
21    agent: Agent | None = Field(
22        default=None,
23        description='Full agent object for this member. Populated when `type` is `"agent"`; `null` for user members.',
24    )
25    membership_type: str | None = Field(
26        default=None,
27        description='Role of this member within the thread. Common values are `"owner"` and `"member"`. `null` when the membership type is not applicable.',
28    )
29    type: str = Field(
30        ...,
31        description='Kind of participant. One of `"user"` (a human user) or `"agent"` (an AI agent).',
32    )
33    user: User | None = Field(
34        default=None,
35        description='Full user object for this member. Populated when `type` is `"user"`; `null` for agent members.',
36    )

A participant in a chat thread, which may be either a human user or an AI agent. Exactly one of user or agent is populated depending on type.

Full agent object for this member. Populated when type is "agent"; null for user members.

membership_type: str | None = None

Role of this member within the thread. Common values are "owner" and "member". null when the membership type is not applicable.

type: str = PydanticUndefined

Kind of participant. One of "user" (a human user) or "agent" (an AI agent).

Full user object for this member. Populated when type is "user"; null for agent members.

class ChatRoomModel(pydantic.main.BaseModel):
39class ChatRoomModel(BaseModel):
40    """
41    A point-in-time snapshot of a chat room's state, including its loaded messages, member roster, and pagination cursors. Returned when loading or refreshing a thread's message list.
42    """
43
44    after_cursor: str | None = Field(
45        default=None,
46        description="Opaque cursor to pass when fetching messages newer than those in this snapshot. `null` when this snapshot already reflects the latest messages.",
47    )
48    agent: Agent | None = Field(
49        default=None,
50        description="The agent associated with this chat room. `null` when no agent is attached.",
51    )
52    before_cursor: str | None = Field(
53        default=None,
54        description="Opaque cursor to pass when fetching messages older than those in this snapshot. `null` when the beginning of the thread history has been reached.",
55    )
56    is_transient: bool = Field(
57        ...,
58        description="Whether this thread is ephemeral. Transient threads are not retained in long-term storage and may be deleted when the session ends.",
59    )
60    members: list[ChatMember] = Field(
61        ...,
62        description="All active members of the chat room, including both human users and agents.",
63    )
64    messages: list[Message] = Field(
65        ...,
66        description="The page of messages currently loaded for the thread, ordered chronologically. Use `before_cursor` or `after_cursor` to page through additional history.",
67    )
68    messages_loaded_on_last_update: int | None = Field(
69        default=None,
70        description="Number of messages that were added to the snapshot in the most recent incremental update. `null` on the initial load.",
71    )
72    team: Team | None = Field(
73        default=None,
74        description="The team that owns this thread. `null` for threads scoped to an individual user rather than a team.",
75    )
76    thread: Thread = Field(
77        ...,
78        description="The parent thread whose message history and membership this snapshot represents.",
79    )

A point-in-time snapshot of a chat room's state, including its loaded messages, member roster, and pagination cursors. Returned when loading or refreshing a thread's message list.

after_cursor: str | None = None

Opaque cursor to pass when fetching messages newer than those in this snapshot. null when this snapshot already reflects the latest messages.

The agent associated with this chat room. null when no agent is attached.

before_cursor: str | None = None

Opaque cursor to pass when fetching messages older than those in this snapshot. null when the beginning of the thread history has been reached.

is_transient: bool = PydanticUndefined

Whether this thread is ephemeral. Transient threads are not retained in long-term storage and may be deleted when the session ends.

members: list[ChatMember] = PydanticUndefined

All active members of the chat room, including both human users and agents.

messages: list[archastro.platform.types.common.Message] = PydanticUndefined

The page of messages currently loaded for the thread, ordered chronologically. Use before_cursor or after_cursor to page through additional history.

messages_loaded_on_last_update: int | None = None

Number of messages that were added to the snapshot in the most recent incremental update. null on the initial load.

The team that owns this thread. null for threads scoped to an individual user rather than a team.

thread: archastro.platform.types.threads.Thread = PydanticUndefined

The parent thread whose message history and membership this snapshot represents.

class ChatForkThreadResponse(pydantic.main.BaseModel):
82class ChatForkThreadResponse(BaseModel):
83    """
84    Response returned after forking a chat thread. Contains the new thread, its initial chat-room snapshot, and the owning team when applicable.
85    """
86
87    chat_model: ChatRoomModel | None = Field(
88        default=None,
89        description="Initial chat-room render snapshot for the forked thread, including members and loaded messages. `null` for transient threads whose room model is suppressed.",
90    )
91    team: Team | None = Field(
92        default=None,
93        description="Team that owns the forked thread. Present only when the original thread was team-scoped; `null` for personal threads.",
94    )
95    thread: Thread = Field(
96        ..., description="The newly-created thread produced by the fork operation."
97    )

Response returned after forking a chat thread. Contains the new thread, its initial chat-room snapshot, and the owning team when applicable.

chat_model: ChatRoomModel | None = None

Initial chat-room render snapshot for the forked thread, including members and loaded messages. null for transient threads whose room model is suppressed.

Team that owns the forked thread. Present only when the original thread was team-scoped; null for personal threads.

thread: archastro.platform.types.threads.Thread = PydanticUndefined

The newly-created thread produced by the fork operation.

class ChatLoadMoreMessagesResponse(pydantic.main.BaseModel):
100class ChatLoadMoreMessagesResponse(BaseModel):
101    """
102    Response returned after loading an additional page of chat messages. Contains a refreshed chat-room snapshot with the newly-fetched messages merged in.
103    """
104
105    data: ChatRoomModel = Field(
106        ...,
107        description="Updated chat-room snapshot for the thread, incorporating the newly-loaded page of messages alongside any previously loaded messages.",
108    )

Response returned after loading an additional page of chat messages. Contains a refreshed chat-room snapshot with the newly-fetched messages merged in.

data: ChatRoomModel = PydanticUndefined

Updated chat-room snapshot for the thread, incorporating the newly-loaded page of messages alongside any previously loaded messages.

class ChatLocalToolCall(pydantic.main.BaseModel):
111class ChatLocalToolCall(BaseModel):
112    """
113    One local function invocation requested by the model.
114    """
115
116    arguments: dict[str, Any]
117    id: str
118    name: str

One local function invocation requested by the model.

arguments: dict[str, typing.Any] = PydanticUndefined
id: str = PydanticUndefined
name: str = PydanticUndefined
class ChatLocalToolFunction(pydantic.main.BaseModel):
121class ChatLocalToolFunction(BaseModel):
122    """
123    A function implemented by the client connected to a personal thread.
124    """
125
126    description: str
127    name: str
128    parameters: dict[str, Any]

A function implemented by the client connected to a personal thread.

description: str = PydanticUndefined
name: str = PydanticUndefined
parameters: dict[str, typing.Any] = PydanticUndefined
class ChatLocalToolDefinition(pydantic.main.BaseModel):
131class ChatLocalToolDefinition(BaseModel):
132    """
133    An OpenAI-compatible local function definition advertised by a personal-thread connection.
134    """
135
136    function: ChatLocalToolFunction
137    type: Literal["function"]

An OpenAI-compatible local function definition advertised by a personal-thread connection.

function: ChatLocalToolFunction = PydanticUndefined
type: Literal['function'] = PydanticUndefined
class ChatLocalToolProvider(pydantic.main.BaseModel):
140class ChatLocalToolProvider(BaseModel):
141    """
142    Server-issued identity for the local-tool set currently advertised by this connection.
143    """
144
145    generation: int
146    provider_id: str

Server-issued identity for the local-tool set currently advertised by this connection.

generation: int = PydanticUndefined
provider_id: str = PydanticUndefined
class ChatLocalToolRequest(pydantic.main.BaseModel):
149class ChatLocalToolRequest(BaseModel):
150    """
151    A correlated batch of local function calls targeted to one connection.
152    """
153
154    calls: list[ChatLocalToolCall]
155    id: str

A correlated batch of local function calls targeted to one connection.

calls: list[ChatLocalToolCall] = PydanticUndefined
id: str = PydanticUndefined
class ChatLocalToolResultError(pydantic.main.BaseModel):
158class ChatLocalToolResultError(BaseModel):
159    """
160    A failed local-tool outcome.
161    """
162
163    call_id: str
164    code: str
165    message: str
166    status: Literal["error"] = "error"

A failed local-tool outcome.

call_id: str = PydanticUndefined
code: str = PydanticUndefined
message: str = PydanticUndefined
status: Literal['error'] = 'error'
ChatLocalToolResult = typing.Annotated[archastro.platform.types.common.Ok | ChatLocalToolResultError | archastro.platform.types.common.Cancelled, FieldInfo(annotation=NoneType, required=True, discriminator='status')]
class ChatMarkThreadReadResponse(pydantic.main.BaseModel):
175class ChatMarkThreadReadResponse(BaseModel):
176    """
177    Response returned after marking a chat thread as read. Confirms that the read marker was successfully recorded for the authenticated user.
178    """
179
180    success: bool = Field(
181        ...,
182        description="Indicates whether the read marker was successfully applied. Always `true` on success; errors are returned as channel error replies rather than a `false` value here.",
183    )

Response returned after marking a chat thread as read. Confirms that the read marker was successfully recorded for the authenticated user.

success: bool = PydanticUndefined

Indicates whether the read marker was successfully applied. Always true on success; errors are returned as channel error replies rather than a false value here.

class ChatMessageListResponse(pydantic.main.BaseModel):
186class ChatMessageListResponse(BaseModel):
187    """
188    Response returned when listing the messages of a joined chat thread. Contains the set of messages currently loaded for the thread.
189    """
190
191    messages: list[Message] = Field(
192        ...,
193        description="Ordered array of message objects currently loaded for the thread, from oldest to newest. Use the `load_more_messages` channel message to fetch earlier pages.",
194    )

Response returned when listing the messages of a joined chat thread. Contains the set of messages currently loaded for the thread.

messages: list[archastro.platform.types.common.Message] = PydanticUndefined

Ordered array of message objects currently loaded for the thread, from oldest to newest. Use the load_more_messages channel message to fetch earlier pages.

class ChatPostMessageResponse(pydantic.main.BaseModel):
197class ChatPostMessageResponse(BaseModel):
198    """
199    Response returned after successfully posting a message to a chat thread. Contains the persisted message object echoed back to the sender.
200    """
201
202    message: Message = Field(
203        ...,
204        description="The message that was created and stored. Contains the full message object including its assigned ID, author, content, and timestamps.",
205    )

Response returned after successfully posting a message to a chat thread. Contains the persisted message object echoed back to the sender.

message: archastro.platform.types.common.Message = PydanticUndefined

The message that was created and stored. Contains the full message object including its assigned ID, author, content, and timestamps.