sinatra-dev 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sinatra_dev/__init__.py +71 -0
- sinatra_dev/_client.py +391 -0
- sinatra_dev/_errors.py +53 -0
- sinatra_dev/_generated/__init__.py +8 -0
- sinatra_dev/_generated/api/__init__.py +1 -0
- sinatra_dev/_generated/api/me/__init__.py +1 -0
- sinatra_dev/_generated/api/me/me_get.py +156 -0
- sinatra_dev/_generated/api/me/me_revoke_token.py +173 -0
- sinatra_dev/_generated/api/messages/__init__.py +1 -0
- sinatra_dev/_generated/api/messages/messages_create.py +323 -0
- sinatra_dev/_generated/api/messages/messages_list.py +332 -0
- sinatra_dev/_generated/api/tasks/__init__.py +1 -0
- sinatra_dev/_generated/api/tasks/tasks_create.py +337 -0
- sinatra_dev/_generated/api/tasks/tasks_get.py +202 -0
- sinatra_dev/_generated/api/tasks/tasks_list.py +252 -0
- sinatra_dev/_generated/api/tasks/tasks_stop.py +231 -0
- sinatra_dev/_generated/api/tickets/__init__.py +1 -0
- sinatra_dev/_generated/api/tickets/tickets_delegate.py +273 -0
- sinatra_dev/_generated/api/tickets/tickets_search.py +265 -0
- sinatra_dev/_generated/client.py +280 -0
- sinatra_dev/_generated/errors.py +16 -0
- sinatra_dev/_generated/models/__init__.py +47 -0
- sinatra_dev/_generated/models/create_message_request.py +62 -0
- sinatra_dev/_generated/models/create_message_response.py +62 -0
- sinatra_dev/_generated/models/create_task_request.py +106 -0
- sinatra_dev/_generated/models/create_task_response.py +76 -0
- sinatra_dev/_generated/models/delegate_github_ticket.py +86 -0
- sinatra_dev/_generated/models/delegate_linear_ticket.py +78 -0
- sinatra_dev/_generated/models/delegate_ticket_response.py +62 -0
- sinatra_dev/_generated/models/error.py +168 -0
- sinatra_dev/_generated/models/me.py +86 -0
- sinatra_dev/_generated/models/me_user.py +98 -0
- sinatra_dev/_generated/models/message.py +113 -0
- sinatra_dev/_generated/models/message_list.py +91 -0
- sinatra_dev/_generated/models/pull_request.py +70 -0
- sinatra_dev/_generated/models/stop_task_response.py +62 -0
- sinatra_dev/_generated/models/task.py +201 -0
- sinatra_dev/_generated/models/task_list.py +91 -0
- sinatra_dev/_generated/models/ticket.py +147 -0
- sinatra_dev/_generated/models/ticket_search_result.py +97 -0
- sinatra_dev/_generated/models/ticket_search_result_github.py +77 -0
- sinatra_dev/_generated/models/ticket_search_result_linear.py +79 -0
- sinatra_dev/_generated/models/workspace.py +78 -0
- sinatra_dev/_generated/types.py +54 -0
- sinatra_dev/_retry.py +72 -0
- sinatra_dev/py.typed +0 -0
- sinatra_dev-0.1.0.dist-info/METADATA +184 -0
- sinatra_dev-0.1.0.dist-info/RECORD +50 -0
- sinatra_dev-0.1.0.dist-info/WHEEL +4 -0
- sinatra_dev-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error import Error
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs() -> dict[str, Any]:
|
|
13
|
+
|
|
14
|
+
_kwargs: dict[str, Any] = {
|
|
15
|
+
"method": "delete",
|
|
16
|
+
"url": "/v1/me/token",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return _kwargs
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _parse_response(
|
|
23
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
24
|
+
) -> Any | Error | None:
|
|
25
|
+
if response.status_code == 204:
|
|
26
|
+
response_204 = cast(Any, None)
|
|
27
|
+
return response_204
|
|
28
|
+
|
|
29
|
+
if response.status_code == 400:
|
|
30
|
+
response_400 = Error.from_dict(response.json())
|
|
31
|
+
|
|
32
|
+
return response_400
|
|
33
|
+
|
|
34
|
+
if response.status_code == 401:
|
|
35
|
+
response_401 = Error.from_dict(response.json())
|
|
36
|
+
|
|
37
|
+
return response_401
|
|
38
|
+
|
|
39
|
+
if response.status_code == 413:
|
|
40
|
+
response_413 = Error.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_413
|
|
43
|
+
|
|
44
|
+
if response.status_code == 415:
|
|
45
|
+
response_415 = Error.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_415
|
|
48
|
+
|
|
49
|
+
if response.status_code == 429:
|
|
50
|
+
response_429 = Error.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_429
|
|
53
|
+
|
|
54
|
+
if response.status_code == 500:
|
|
55
|
+
response_500 = Error.from_dict(response.json())
|
|
56
|
+
|
|
57
|
+
return response_500
|
|
58
|
+
|
|
59
|
+
if client.raise_on_unexpected_status:
|
|
60
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
61
|
+
else:
|
|
62
|
+
return None
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _build_response(
|
|
66
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
67
|
+
) -> Response[Any | Error]:
|
|
68
|
+
return Response(
|
|
69
|
+
status_code=HTTPStatus(response.status_code),
|
|
70
|
+
content=response.content,
|
|
71
|
+
headers=response.headers,
|
|
72
|
+
parsed=_parse_response(client=client, response=response),
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def sync_detailed(
|
|
77
|
+
*,
|
|
78
|
+
client: AuthenticatedClient | Client,
|
|
79
|
+
) -> Response[Any | Error]:
|
|
80
|
+
"""Revoke the token
|
|
81
|
+
|
|
82
|
+
Revokes the token that sends the request, and answers `204` with no body. Requests with that token
|
|
83
|
+
get `401 invalid_token` afterwards. A token from a browser sign-in is revoked together with the rest
|
|
84
|
+
of that sign-in. `sinatra logout` calls this when you logged in with a token.
|
|
85
|
+
|
|
86
|
+
Raises:
|
|
87
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
88
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
Response[Any | Error]
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
kwargs = _get_kwargs()
|
|
95
|
+
|
|
96
|
+
response = client.get_httpx_client().request(
|
|
97
|
+
**kwargs,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
return _build_response(client=client, response=response)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def sync(
|
|
104
|
+
*,
|
|
105
|
+
client: AuthenticatedClient | Client,
|
|
106
|
+
) -> Any | Error | None:
|
|
107
|
+
"""Revoke the token
|
|
108
|
+
|
|
109
|
+
Revokes the token that sends the request, and answers `204` with no body. Requests with that token
|
|
110
|
+
get `401 invalid_token` afterwards. A token from a browser sign-in is revoked together with the rest
|
|
111
|
+
of that sign-in. `sinatra logout` calls this when you logged in with a token.
|
|
112
|
+
|
|
113
|
+
Raises:
|
|
114
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
115
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
Any | Error
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
return sync_detailed(
|
|
122
|
+
client=client,
|
|
123
|
+
).parsed
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
async def asyncio_detailed(
|
|
127
|
+
*,
|
|
128
|
+
client: AuthenticatedClient | Client,
|
|
129
|
+
) -> Response[Any | Error]:
|
|
130
|
+
"""Revoke the token
|
|
131
|
+
|
|
132
|
+
Revokes the token that sends the request, and answers `204` with no body. Requests with that token
|
|
133
|
+
get `401 invalid_token` afterwards. A token from a browser sign-in is revoked together with the rest
|
|
134
|
+
of that sign-in. `sinatra logout` calls this when you logged in with a token.
|
|
135
|
+
|
|
136
|
+
Raises:
|
|
137
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
138
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
Response[Any | Error]
|
|
142
|
+
"""
|
|
143
|
+
|
|
144
|
+
kwargs = _get_kwargs()
|
|
145
|
+
|
|
146
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
147
|
+
|
|
148
|
+
return _build_response(client=client, response=response)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
async def asyncio(
|
|
152
|
+
*,
|
|
153
|
+
client: AuthenticatedClient | Client,
|
|
154
|
+
) -> Any | Error | None:
|
|
155
|
+
"""Revoke the token
|
|
156
|
+
|
|
157
|
+
Revokes the token that sends the request, and answers `204` with no body. Requests with that token
|
|
158
|
+
get `401 invalid_token` afterwards. A token from a browser sign-in is revoked together with the rest
|
|
159
|
+
of that sign-in. `sinatra logout` calls this when you logged in with a token.
|
|
160
|
+
|
|
161
|
+
Raises:
|
|
162
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
163
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
Any | Error
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
await asyncio_detailed(
|
|
171
|
+
client=client,
|
|
172
|
+
)
|
|
173
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.create_message_request import CreateMessageRequest
|
|
10
|
+
from ...models.create_message_response import CreateMessageResponse
|
|
11
|
+
from ...models.error import Error
|
|
12
|
+
from ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
workspace_id: str,
|
|
17
|
+
task_id: str,
|
|
18
|
+
*,
|
|
19
|
+
body: CreateMessageRequest,
|
|
20
|
+
idempotency_key: str | Unset = UNSET,
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
if not isinstance(idempotency_key, Unset):
|
|
24
|
+
headers["Idempotency-Key"] = idempotency_key
|
|
25
|
+
|
|
26
|
+
_kwargs: dict[str, Any] = {
|
|
27
|
+
"method": "post",
|
|
28
|
+
"url": "/v1/workspaces/{workspace_id}/tasks/{task_id}/messages".format(
|
|
29
|
+
workspace_id=quote(str(workspace_id), safe=""),
|
|
30
|
+
task_id=quote(str(task_id), safe=""),
|
|
31
|
+
),
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_kwargs["json"] = body.to_dict()
|
|
35
|
+
|
|
36
|
+
headers["Content-Type"] = "application/json"
|
|
37
|
+
|
|
38
|
+
_kwargs["headers"] = headers
|
|
39
|
+
return _kwargs
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _parse_response(
|
|
43
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
44
|
+
) -> CreateMessageResponse | Error | None:
|
|
45
|
+
if response.status_code == 202:
|
|
46
|
+
response_202 = CreateMessageResponse.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_202
|
|
49
|
+
|
|
50
|
+
if response.status_code == 400:
|
|
51
|
+
response_400 = Error.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
return response_400
|
|
54
|
+
|
|
55
|
+
if response.status_code == 401:
|
|
56
|
+
response_401 = Error.from_dict(response.json())
|
|
57
|
+
|
|
58
|
+
return response_401
|
|
59
|
+
|
|
60
|
+
if response.status_code == 404:
|
|
61
|
+
response_404 = Error.from_dict(response.json())
|
|
62
|
+
|
|
63
|
+
return response_404
|
|
64
|
+
|
|
65
|
+
if response.status_code == 409:
|
|
66
|
+
response_409 = Error.from_dict(response.json())
|
|
67
|
+
|
|
68
|
+
return response_409
|
|
69
|
+
|
|
70
|
+
if response.status_code == 413:
|
|
71
|
+
response_413 = Error.from_dict(response.json())
|
|
72
|
+
|
|
73
|
+
return response_413
|
|
74
|
+
|
|
75
|
+
if response.status_code == 415:
|
|
76
|
+
response_415 = Error.from_dict(response.json())
|
|
77
|
+
|
|
78
|
+
return response_415
|
|
79
|
+
|
|
80
|
+
if response.status_code == 429:
|
|
81
|
+
response_429 = Error.from_dict(response.json())
|
|
82
|
+
|
|
83
|
+
return response_429
|
|
84
|
+
|
|
85
|
+
if response.status_code == 500:
|
|
86
|
+
response_500 = Error.from_dict(response.json())
|
|
87
|
+
|
|
88
|
+
return response_500
|
|
89
|
+
|
|
90
|
+
if response.status_code == 503:
|
|
91
|
+
response_503 = Error.from_dict(response.json())
|
|
92
|
+
|
|
93
|
+
return response_503
|
|
94
|
+
|
|
95
|
+
if client.raise_on_unexpected_status:
|
|
96
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
97
|
+
else:
|
|
98
|
+
return None
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _build_response(
|
|
102
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
103
|
+
) -> Response[CreateMessageResponse | Error]:
|
|
104
|
+
return Response(
|
|
105
|
+
status_code=HTTPStatus(response.status_code),
|
|
106
|
+
content=response.content,
|
|
107
|
+
headers=response.headers,
|
|
108
|
+
parsed=_parse_response(client=client, response=response),
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def sync_detailed(
|
|
113
|
+
workspace_id: str,
|
|
114
|
+
task_id: str,
|
|
115
|
+
*,
|
|
116
|
+
client: AuthenticatedClient | Client,
|
|
117
|
+
body: CreateMessageRequest,
|
|
118
|
+
idempotency_key: str | Unset = UNSET,
|
|
119
|
+
) -> Response[CreateMessageResponse | Error]:
|
|
120
|
+
"""Send a message
|
|
121
|
+
|
|
122
|
+
Sends a follow-up on a task and returns `202` with the message's id.
|
|
123
|
+
|
|
124
|
+
Any member of the workspace can follow up on a task started from the API, CLI, MCP or dashboard.
|
|
125
|
+
Follow up on other tasks, such as Linear or GitHub issues, where they started; here they return `409
|
|
126
|
+
not_an_api_task`. A task that has been idle for a while picks up again when you follow up.
|
|
127
|
+
|
|
128
|
+
A message sent while the agent is working doesn't change the current turn. It waits and runs as the
|
|
129
|
+
next turn. A message isn't refused when the workspace is running its limit of tasks: its turn takes
|
|
130
|
+
a place in the queue, and if the queue is full, the refusal appears in the task's conversation
|
|
131
|
+
instead.
|
|
132
|
+
|
|
133
|
+
Send an `Idempotency-Key` so a retry is safe: a message retried with the same key is sent once. Keys
|
|
134
|
+
belong to their sender, so two people using the same key send two messages. The key becomes the
|
|
135
|
+
message's `messageId`.
|
|
136
|
+
|
|
137
|
+
If Sinatra saves the message but can't hand it to the agent yet, it answers `503 unavailable` with
|
|
138
|
+
the `messageId`. Retry with that `messageId` as the `Idempotency-Key`, so the message is sent once.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
workspace_id (str):
|
|
142
|
+
task_id (str):
|
|
143
|
+
idempotency_key (str | Unset):
|
|
144
|
+
body (CreateMessageRequest): A message to send on a task.
|
|
145
|
+
|
|
146
|
+
Raises:
|
|
147
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
148
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
Response[CreateMessageResponse | Error]
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
kwargs = _get_kwargs(
|
|
155
|
+
workspace_id=workspace_id,
|
|
156
|
+
task_id=task_id,
|
|
157
|
+
body=body,
|
|
158
|
+
idempotency_key=idempotency_key,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
response = client.get_httpx_client().request(
|
|
162
|
+
**kwargs,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
return _build_response(client=client, response=response)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def sync(
|
|
169
|
+
workspace_id: str,
|
|
170
|
+
task_id: str,
|
|
171
|
+
*,
|
|
172
|
+
client: AuthenticatedClient | Client,
|
|
173
|
+
body: CreateMessageRequest,
|
|
174
|
+
idempotency_key: str | Unset = UNSET,
|
|
175
|
+
) -> CreateMessageResponse | Error | None:
|
|
176
|
+
"""Send a message
|
|
177
|
+
|
|
178
|
+
Sends a follow-up on a task and returns `202` with the message's id.
|
|
179
|
+
|
|
180
|
+
Any member of the workspace can follow up on a task started from the API, CLI, MCP or dashboard.
|
|
181
|
+
Follow up on other tasks, such as Linear or GitHub issues, where they started; here they return `409
|
|
182
|
+
not_an_api_task`. A task that has been idle for a while picks up again when you follow up.
|
|
183
|
+
|
|
184
|
+
A message sent while the agent is working doesn't change the current turn. It waits and runs as the
|
|
185
|
+
next turn. A message isn't refused when the workspace is running its limit of tasks: its turn takes
|
|
186
|
+
a place in the queue, and if the queue is full, the refusal appears in the task's conversation
|
|
187
|
+
instead.
|
|
188
|
+
|
|
189
|
+
Send an `Idempotency-Key` so a retry is safe: a message retried with the same key is sent once. Keys
|
|
190
|
+
belong to their sender, so two people using the same key send two messages. The key becomes the
|
|
191
|
+
message's `messageId`.
|
|
192
|
+
|
|
193
|
+
If Sinatra saves the message but can't hand it to the agent yet, it answers `503 unavailable` with
|
|
194
|
+
the `messageId`. Retry with that `messageId` as the `Idempotency-Key`, so the message is sent once.
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
workspace_id (str):
|
|
198
|
+
task_id (str):
|
|
199
|
+
idempotency_key (str | Unset):
|
|
200
|
+
body (CreateMessageRequest): A message to send on a task.
|
|
201
|
+
|
|
202
|
+
Raises:
|
|
203
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
204
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
205
|
+
|
|
206
|
+
Returns:
|
|
207
|
+
CreateMessageResponse | Error
|
|
208
|
+
"""
|
|
209
|
+
|
|
210
|
+
return sync_detailed(
|
|
211
|
+
workspace_id=workspace_id,
|
|
212
|
+
task_id=task_id,
|
|
213
|
+
client=client,
|
|
214
|
+
body=body,
|
|
215
|
+
idempotency_key=idempotency_key,
|
|
216
|
+
).parsed
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
async def asyncio_detailed(
|
|
220
|
+
workspace_id: str,
|
|
221
|
+
task_id: str,
|
|
222
|
+
*,
|
|
223
|
+
client: AuthenticatedClient | Client,
|
|
224
|
+
body: CreateMessageRequest,
|
|
225
|
+
idempotency_key: str | Unset = UNSET,
|
|
226
|
+
) -> Response[CreateMessageResponse | Error]:
|
|
227
|
+
"""Send a message
|
|
228
|
+
|
|
229
|
+
Sends a follow-up on a task and returns `202` with the message's id.
|
|
230
|
+
|
|
231
|
+
Any member of the workspace can follow up on a task started from the API, CLI, MCP or dashboard.
|
|
232
|
+
Follow up on other tasks, such as Linear or GitHub issues, where they started; here they return `409
|
|
233
|
+
not_an_api_task`. A task that has been idle for a while picks up again when you follow up.
|
|
234
|
+
|
|
235
|
+
A message sent while the agent is working doesn't change the current turn. It waits and runs as the
|
|
236
|
+
next turn. A message isn't refused when the workspace is running its limit of tasks: its turn takes
|
|
237
|
+
a place in the queue, and if the queue is full, the refusal appears in the task's conversation
|
|
238
|
+
instead.
|
|
239
|
+
|
|
240
|
+
Send an `Idempotency-Key` so a retry is safe: a message retried with the same key is sent once. Keys
|
|
241
|
+
belong to their sender, so two people using the same key send two messages. The key becomes the
|
|
242
|
+
message's `messageId`.
|
|
243
|
+
|
|
244
|
+
If Sinatra saves the message but can't hand it to the agent yet, it answers `503 unavailable` with
|
|
245
|
+
the `messageId`. Retry with that `messageId` as the `Idempotency-Key`, so the message is sent once.
|
|
246
|
+
|
|
247
|
+
Args:
|
|
248
|
+
workspace_id (str):
|
|
249
|
+
task_id (str):
|
|
250
|
+
idempotency_key (str | Unset):
|
|
251
|
+
body (CreateMessageRequest): A message to send on a task.
|
|
252
|
+
|
|
253
|
+
Raises:
|
|
254
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
255
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
256
|
+
|
|
257
|
+
Returns:
|
|
258
|
+
Response[CreateMessageResponse | Error]
|
|
259
|
+
"""
|
|
260
|
+
|
|
261
|
+
kwargs = _get_kwargs(
|
|
262
|
+
workspace_id=workspace_id,
|
|
263
|
+
task_id=task_id,
|
|
264
|
+
body=body,
|
|
265
|
+
idempotency_key=idempotency_key,
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
269
|
+
|
|
270
|
+
return _build_response(client=client, response=response)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
async def asyncio(
|
|
274
|
+
workspace_id: str,
|
|
275
|
+
task_id: str,
|
|
276
|
+
*,
|
|
277
|
+
client: AuthenticatedClient | Client,
|
|
278
|
+
body: CreateMessageRequest,
|
|
279
|
+
idempotency_key: str | Unset = UNSET,
|
|
280
|
+
) -> CreateMessageResponse | Error | None:
|
|
281
|
+
"""Send a message
|
|
282
|
+
|
|
283
|
+
Sends a follow-up on a task and returns `202` with the message's id.
|
|
284
|
+
|
|
285
|
+
Any member of the workspace can follow up on a task started from the API, CLI, MCP or dashboard.
|
|
286
|
+
Follow up on other tasks, such as Linear or GitHub issues, where they started; here they return `409
|
|
287
|
+
not_an_api_task`. A task that has been idle for a while picks up again when you follow up.
|
|
288
|
+
|
|
289
|
+
A message sent while the agent is working doesn't change the current turn. It waits and runs as the
|
|
290
|
+
next turn. A message isn't refused when the workspace is running its limit of tasks: its turn takes
|
|
291
|
+
a place in the queue, and if the queue is full, the refusal appears in the task's conversation
|
|
292
|
+
instead.
|
|
293
|
+
|
|
294
|
+
Send an `Idempotency-Key` so a retry is safe: a message retried with the same key is sent once. Keys
|
|
295
|
+
belong to their sender, so two people using the same key send two messages. The key becomes the
|
|
296
|
+
message's `messageId`.
|
|
297
|
+
|
|
298
|
+
If Sinatra saves the message but can't hand it to the agent yet, it answers `503 unavailable` with
|
|
299
|
+
the `messageId`. Retry with that `messageId` as the `Idempotency-Key`, so the message is sent once.
|
|
300
|
+
|
|
301
|
+
Args:
|
|
302
|
+
workspace_id (str):
|
|
303
|
+
task_id (str):
|
|
304
|
+
idempotency_key (str | Unset):
|
|
305
|
+
body (CreateMessageRequest): A message to send on a task.
|
|
306
|
+
|
|
307
|
+
Raises:
|
|
308
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
309
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
310
|
+
|
|
311
|
+
Returns:
|
|
312
|
+
CreateMessageResponse | Error
|
|
313
|
+
"""
|
|
314
|
+
|
|
315
|
+
return (
|
|
316
|
+
await asyncio_detailed(
|
|
317
|
+
workspace_id=workspace_id,
|
|
318
|
+
task_id=task_id,
|
|
319
|
+
client=client,
|
|
320
|
+
body=body,
|
|
321
|
+
idempotency_key=idempotency_key,
|
|
322
|
+
)
|
|
323
|
+
).parsed
|