opencode-python-sdk 0.0.1.dev1__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.
- opencode/.generated.json +39 -0
- opencode/__init__.py +221 -0
- opencode/_base_client.py +539 -0
- opencode/_client.py +255 -0
- opencode/_constants.py +27 -0
- opencode/_errors.py +547 -0
- opencode/_events.py +732 -0
- opencode/_exceptions.py +271 -0
- opencode/_models.py +54 -0
- opencode/_pagination.py +192 -0
- opencode/_pty.py +586 -0
- opencode/_qs.py +95 -0
- opencode/_resource.py +42 -0
- opencode/_rpc.py +489 -0
- opencode/_server.py +335 -0
- opencode/_streaming.py +248 -0
- opencode/_types.py +77 -0
- opencode/_unions.py +46 -0
- opencode/_version.py +8 -0
- opencode/lib/__init__.py +5 -0
- opencode/lib/_ready.py +91 -0
- opencode/lib/_session.py +231 -0
- opencode/py.typed +0 -0
- opencode/resources/__init__.py +364 -0
- opencode/resources/agent.py +179 -0
- opencode/resources/command.py +100 -0
- opencode/resources/config.py +240 -0
- opencode/resources/credential.py +384 -0
- opencode/resources/debug.py +178 -0
- opencode/resources/event.py +88 -0
- opencode/resources/experimental.py +765 -0
- opencode/resources/file.py +355 -0
- opencode/resources/form.py +100 -0
- opencode/resources/generate.py +110 -0
- opencode/resources/integration.py +1033 -0
- opencode/resources/location.py +162 -0
- opencode/resources/mcp.py +492 -0
- opencode/resources/message.py +152 -0
- opencode/resources/migration.py +118 -0
- opencode/resources/model.py +177 -0
- opencode/resources/permission.py +704 -0
- opencode/resources/plugin.py +250 -0
- opencode/resources/project.py +187 -0
- opencode/resources/provider.py +183 -0
- opencode/resources/pty.py +522 -0
- opencode/resources/reference.py +100 -0
- opencode/resources/rpc.py +113 -0
- opencode/resources/server.py +230 -0
- opencode/resources/session.py +3567 -0
- opencode/resources/shell.py +412 -0
- opencode/resources/skill.py +100 -0
- opencode/resources/vcs.py +500 -0
- opencode/resources/voice.py +113 -0
- opencode/resources/websearch.py +184 -0
- opencode/resources/worktree.py +336 -0
- opencode/testing.py +508 -0
- opencode/types/__init__.py +1462 -0
- opencode/types/_generated.py +8540 -0
- opencode_python_sdk-0.0.1.dev1.dist-info/METADATA +468 -0
- opencode_python_sdk-0.0.1.dev1.dist-info/RECORD +62 -0
- opencode_python_sdk-0.0.1.dev1.dist-info/WHEEL +4 -0
- opencode_python_sdk-0.0.1.dev1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,765 @@
|
|
|
1
|
+
# This file is generated by `python -m codegen` from spec/contract.json. Do not edit it by hand.
|
|
2
|
+
# OpenCode 2.1.2
|
|
3
|
+
|
|
4
|
+
"""The ``experimental`` resource."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import builtins
|
|
9
|
+
from collections.abc import Mapping, Sequence
|
|
10
|
+
from functools import cached_property
|
|
11
|
+
from typing import TYPE_CHECKING, cast
|
|
12
|
+
|
|
13
|
+
from .._base_client import RequestOptions
|
|
14
|
+
from .._pty import AsyncPersistentPtyAttachMixin, PersistentPtyAttachMixin
|
|
15
|
+
from .._qs import encode_path_segment
|
|
16
|
+
from .._resource import AsyncAPIResource, SyncAPIResource
|
|
17
|
+
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
18
|
+
|
|
19
|
+
if TYPE_CHECKING:
|
|
20
|
+
from ..types import (
|
|
21
|
+
ExperimentalPersistentPtyCreateSize,
|
|
22
|
+
ExperimentalPersistentPtyHandoffResponse,
|
|
23
|
+
ExperimentalPersistentPtyUpdateSize,
|
|
24
|
+
PersistentPtyInfo,
|
|
25
|
+
PersistentPtyReadLines,
|
|
26
|
+
PersistentPtyReadResult,
|
|
27
|
+
PersistentPtySnapshot,
|
|
28
|
+
PtyID,
|
|
29
|
+
PtyTicketConnectToken,
|
|
30
|
+
SessionID,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
__all__ = ["ExperimentalResource", "AsyncExperimentalResource"]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
|
|
37
|
+
"""Operations under ``client.experimental.persistent_pty`` (OpenCode ``experimental.persistentPty``)."""
|
|
38
|
+
|
|
39
|
+
def read(
|
|
40
|
+
self,
|
|
41
|
+
session_id: SessionID,
|
|
42
|
+
*,
|
|
43
|
+
lines: PersistentPtyReadLines | NotGiven | None = NOT_GIVEN,
|
|
44
|
+
extra_headers: Headers | None = None,
|
|
45
|
+
extra_query: Query | None = None,
|
|
46
|
+
extra_body: Body | None = None,
|
|
47
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
48
|
+
) -> PersistentPtyReadResult | None:
|
|
49
|
+
"""Read the session's most recently controlled terminal.
|
|
50
|
+
|
|
51
|
+
Read the last physical rows without changing selection or taking control. Omitted lines uses the live terminal height; larger counts include retained history. Blank rows are preserved. Screen dimensions and cursor remain relative to the live screen. Returns null when no current terminal exists. Selection is server-local and resets on restart. Experimental: may change without compatibility guarantees.
|
|
52
|
+
|
|
53
|
+
This endpoint is experimental in OpenCode and may change without notice.
|
|
54
|
+
|
|
55
|
+
Raises:
|
|
56
|
+
InvalidRequestError: The server answered 400.
|
|
57
|
+
UnauthorizedError: The server answered 401.
|
|
58
|
+
ServiceUnavailableError: The server answered 503.
|
|
59
|
+
|
|
60
|
+
``GET /api/experimental/session/:sessionID/terminal/read``
|
|
61
|
+
"""
|
|
62
|
+
return cast(
|
|
63
|
+
"PersistentPtyReadResult | None",
|
|
64
|
+
self._client.request(
|
|
65
|
+
RequestOptions(
|
|
66
|
+
method="GET",
|
|
67
|
+
path=f"/api/experimental/session/{encode_path_segment(session_id)}/terminal/read",
|
|
68
|
+
query={"lines": lines},
|
|
69
|
+
extra_headers=extra_headers,
|
|
70
|
+
extra_query=extra_query,
|
|
71
|
+
extra_body=extra_body,
|
|
72
|
+
timeout=timeout,
|
|
73
|
+
),
|
|
74
|
+
response_type="PersistentPtyReadResult | None",
|
|
75
|
+
unwrap=True,
|
|
76
|
+
),
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
def list(
|
|
80
|
+
self,
|
|
81
|
+
session_id: SessionID,
|
|
82
|
+
*,
|
|
83
|
+
extra_headers: Headers | None = None,
|
|
84
|
+
extra_query: Query | None = None,
|
|
85
|
+
extra_body: Body | None = None,
|
|
86
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
87
|
+
) -> builtins.list[PersistentPtyInfo]:
|
|
88
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
InvalidRequestError: The server answered 400.
|
|
92
|
+
UnauthorizedError: The server answered 401.
|
|
93
|
+
ServiceUnavailableError: The server answered 503.
|
|
94
|
+
|
|
95
|
+
``GET /api/experimental/session/:sessionID/terminal``
|
|
96
|
+
"""
|
|
97
|
+
return cast(
|
|
98
|
+
"builtins.list[PersistentPtyInfo]",
|
|
99
|
+
self._client.request(
|
|
100
|
+
RequestOptions(
|
|
101
|
+
method="GET",
|
|
102
|
+
path=f"/api/experimental/session/{encode_path_segment(session_id)}/terminal",
|
|
103
|
+
extra_headers=extra_headers,
|
|
104
|
+
extra_query=extra_query,
|
|
105
|
+
extra_body=extra_body,
|
|
106
|
+
timeout=timeout,
|
|
107
|
+
),
|
|
108
|
+
response_type="builtins.list[PersistentPtyInfo]",
|
|
109
|
+
unwrap=True,
|
|
110
|
+
),
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
def create(
|
|
114
|
+
self,
|
|
115
|
+
session_id: SessionID,
|
|
116
|
+
*,
|
|
117
|
+
args: Sequence[str],
|
|
118
|
+
title: str,
|
|
119
|
+
env: Mapping[str, str],
|
|
120
|
+
command: str | NotGiven = NOT_GIVEN,
|
|
121
|
+
cwd: str | NotGiven = NOT_GIVEN,
|
|
122
|
+
size: ExperimentalPersistentPtyCreateSize | NotGiven = NOT_GIVEN,
|
|
123
|
+
extra_headers: Headers | None = None,
|
|
124
|
+
extra_query: Query | None = None,
|
|
125
|
+
extra_body: Body | None = None,
|
|
126
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
127
|
+
) -> PersistentPtyInfo:
|
|
128
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
129
|
+
|
|
130
|
+
Raises:
|
|
131
|
+
InvalidRequestError: The server answered 400.
|
|
132
|
+
UnauthorizedError: The server answered 401.
|
|
133
|
+
ServiceUnavailableError: The server answered 503.
|
|
134
|
+
|
|
135
|
+
``POST /api/experimental/session/:sessionID/terminal``
|
|
136
|
+
"""
|
|
137
|
+
return cast(
|
|
138
|
+
"PersistentPtyInfo",
|
|
139
|
+
self._client.request(
|
|
140
|
+
RequestOptions(
|
|
141
|
+
method="POST",
|
|
142
|
+
path=f"/api/experimental/session/{encode_path_segment(session_id)}/terminal",
|
|
143
|
+
body={"command": command, "args": args, "cwd": cwd, "title": title, "env": env, "size": size},
|
|
144
|
+
extra_headers=extra_headers,
|
|
145
|
+
extra_query=extra_query,
|
|
146
|
+
extra_body=extra_body,
|
|
147
|
+
timeout=timeout,
|
|
148
|
+
),
|
|
149
|
+
response_type="PersistentPtyInfo",
|
|
150
|
+
unwrap=True,
|
|
151
|
+
),
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
def shutdown(
|
|
155
|
+
self,
|
|
156
|
+
*,
|
|
157
|
+
extra_headers: Headers | None = None,
|
|
158
|
+
extra_query: Query | None = None,
|
|
159
|
+
extra_body: Body | None = None,
|
|
160
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
161
|
+
) -> None:
|
|
162
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
163
|
+
|
|
164
|
+
Raises:
|
|
165
|
+
InvalidRequestError: The server answered 400.
|
|
166
|
+
UnauthorizedError: The server answered 401.
|
|
167
|
+
ServiceUnavailableError: The server answered 503.
|
|
168
|
+
|
|
169
|
+
``POST /api/experimental/persistent-pty/shutdown``
|
|
170
|
+
"""
|
|
171
|
+
self._client.request(
|
|
172
|
+
RequestOptions(
|
|
173
|
+
method="POST",
|
|
174
|
+
path="/api/experimental/persistent-pty/shutdown",
|
|
175
|
+
extra_headers=extra_headers,
|
|
176
|
+
extra_query=extra_query,
|
|
177
|
+
extra_body=extra_body,
|
|
178
|
+
timeout=timeout,
|
|
179
|
+
),
|
|
180
|
+
kind="void",
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
def handoff(
|
|
184
|
+
self,
|
|
185
|
+
*,
|
|
186
|
+
extra_headers: Headers | None = None,
|
|
187
|
+
extra_query: Query | None = None,
|
|
188
|
+
extra_body: Body | None = None,
|
|
189
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
190
|
+
) -> ExperimentalPersistentPtyHandoffResponse:
|
|
191
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
192
|
+
|
|
193
|
+
Raises:
|
|
194
|
+
InvalidRequestError: The server answered 400.
|
|
195
|
+
UnauthorizedError: The server answered 401.
|
|
196
|
+
ServiceUnavailableError: The server answered 503.
|
|
197
|
+
|
|
198
|
+
``POST /api/experimental/persistent-pty/handoff``
|
|
199
|
+
"""
|
|
200
|
+
return cast(
|
|
201
|
+
"ExperimentalPersistentPtyHandoffResponse",
|
|
202
|
+
self._client.request(
|
|
203
|
+
RequestOptions(
|
|
204
|
+
method="POST",
|
|
205
|
+
path="/api/experimental/persistent-pty/handoff",
|
|
206
|
+
extra_headers=extra_headers,
|
|
207
|
+
extra_query=extra_query,
|
|
208
|
+
extra_body=extra_body,
|
|
209
|
+
timeout=timeout,
|
|
210
|
+
),
|
|
211
|
+
response_type="ExperimentalPersistentPtyHandoffResponse",
|
|
212
|
+
),
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
def get(
|
|
216
|
+
self,
|
|
217
|
+
pty_id: PtyID,
|
|
218
|
+
*,
|
|
219
|
+
extra_headers: Headers | None = None,
|
|
220
|
+
extra_query: Query | None = None,
|
|
221
|
+
extra_body: Body | None = None,
|
|
222
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
223
|
+
) -> PersistentPtyInfo:
|
|
224
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
225
|
+
|
|
226
|
+
Raises:
|
|
227
|
+
InvalidRequestError: The server answered 400.
|
|
228
|
+
UnauthorizedError: The server answered 401.
|
|
229
|
+
PtyNotFoundError: The server answered 404.
|
|
230
|
+
ServiceUnavailableError: The server answered 503.
|
|
231
|
+
|
|
232
|
+
``GET /api/experimental/persistent-pty/:ptyID``
|
|
233
|
+
"""
|
|
234
|
+
return cast(
|
|
235
|
+
"PersistentPtyInfo",
|
|
236
|
+
self._client.request(
|
|
237
|
+
RequestOptions(
|
|
238
|
+
method="GET",
|
|
239
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}",
|
|
240
|
+
extra_headers=extra_headers,
|
|
241
|
+
extra_query=extra_query,
|
|
242
|
+
extra_body=extra_body,
|
|
243
|
+
timeout=timeout,
|
|
244
|
+
),
|
|
245
|
+
response_type="PersistentPtyInfo",
|
|
246
|
+
unwrap=True,
|
|
247
|
+
),
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
def update(
|
|
251
|
+
self,
|
|
252
|
+
pty_id: PtyID,
|
|
253
|
+
*,
|
|
254
|
+
size: ExperimentalPersistentPtyUpdateSize,
|
|
255
|
+
attachment_id: str | NotGiven = NOT_GIVEN,
|
|
256
|
+
extra_headers: Headers | None = None,
|
|
257
|
+
extra_query: Query | None = None,
|
|
258
|
+
extra_body: Body | None = None,
|
|
259
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
260
|
+
) -> PersistentPtyInfo:
|
|
261
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
262
|
+
|
|
263
|
+
Raises:
|
|
264
|
+
InvalidRequestError: The server answered 400.
|
|
265
|
+
UnauthorizedError: The server answered 401.
|
|
266
|
+
PtyNotFoundError: The server answered 404.
|
|
267
|
+
ServiceUnavailableError: The server answered 503.
|
|
268
|
+
|
|
269
|
+
``PUT /api/experimental/persistent-pty/:ptyID``
|
|
270
|
+
"""
|
|
271
|
+
return cast(
|
|
272
|
+
"PersistentPtyInfo",
|
|
273
|
+
self._client.request(
|
|
274
|
+
RequestOptions(
|
|
275
|
+
method="PUT",
|
|
276
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}",
|
|
277
|
+
body={"attachmentID": attachment_id, "size": size},
|
|
278
|
+
extra_headers=extra_headers,
|
|
279
|
+
extra_query=extra_query,
|
|
280
|
+
extra_body=extra_body,
|
|
281
|
+
timeout=timeout,
|
|
282
|
+
),
|
|
283
|
+
response_type="PersistentPtyInfo",
|
|
284
|
+
unwrap=True,
|
|
285
|
+
),
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
def snapshot(
|
|
289
|
+
self,
|
|
290
|
+
pty_id: PtyID,
|
|
291
|
+
*,
|
|
292
|
+
extra_headers: Headers | None = None,
|
|
293
|
+
extra_query: Query | None = None,
|
|
294
|
+
extra_body: Body | None = None,
|
|
295
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
296
|
+
) -> PersistentPtySnapshot:
|
|
297
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
298
|
+
|
|
299
|
+
Raises:
|
|
300
|
+
InvalidRequestError: The server answered 400.
|
|
301
|
+
UnauthorizedError: The server answered 401.
|
|
302
|
+
PtyNotFoundError: The server answered 404.
|
|
303
|
+
ServiceUnavailableError: The server answered 503.
|
|
304
|
+
|
|
305
|
+
``GET /api/experimental/persistent-pty/:ptyID/snapshot``
|
|
306
|
+
"""
|
|
307
|
+
return cast(
|
|
308
|
+
"PersistentPtySnapshot",
|
|
309
|
+
self._client.request(
|
|
310
|
+
RequestOptions(
|
|
311
|
+
method="GET",
|
|
312
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}/snapshot",
|
|
313
|
+
extra_headers=extra_headers,
|
|
314
|
+
extra_query=extra_query,
|
|
315
|
+
extra_body=extra_body,
|
|
316
|
+
timeout=timeout,
|
|
317
|
+
),
|
|
318
|
+
response_type="PersistentPtySnapshot",
|
|
319
|
+
unwrap=True,
|
|
320
|
+
),
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
def remove(
|
|
324
|
+
self,
|
|
325
|
+
pty_id: PtyID,
|
|
326
|
+
*,
|
|
327
|
+
extra_headers: Headers | None = None,
|
|
328
|
+
extra_query: Query | None = None,
|
|
329
|
+
extra_body: Body | None = None,
|
|
330
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
331
|
+
) -> None:
|
|
332
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
333
|
+
|
|
334
|
+
Raises:
|
|
335
|
+
InvalidRequestError: The server answered 400.
|
|
336
|
+
UnauthorizedError: The server answered 401.
|
|
337
|
+
PtyNotFoundError: The server answered 404.
|
|
338
|
+
ServiceUnavailableError: The server answered 503.
|
|
339
|
+
|
|
340
|
+
``DELETE /api/experimental/persistent-pty/:ptyID``
|
|
341
|
+
"""
|
|
342
|
+
self._client.request(
|
|
343
|
+
RequestOptions(
|
|
344
|
+
method="DELETE",
|
|
345
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}",
|
|
346
|
+
extra_headers=extra_headers,
|
|
347
|
+
extra_query=extra_query,
|
|
348
|
+
extra_body=extra_body,
|
|
349
|
+
timeout=timeout,
|
|
350
|
+
),
|
|
351
|
+
kind="void",
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
def connect_token(
|
|
355
|
+
self,
|
|
356
|
+
pty_id: PtyID,
|
|
357
|
+
*,
|
|
358
|
+
x_opencode_ticket: str | NotGiven | None = NOT_GIVEN,
|
|
359
|
+
extra_headers: Headers | None = None,
|
|
360
|
+
extra_query: Query | None = None,
|
|
361
|
+
extra_body: Body | None = None,
|
|
362
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
363
|
+
) -> PtyTicketConnectToken:
|
|
364
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
365
|
+
|
|
366
|
+
Raises:
|
|
367
|
+
InvalidRequestError: The server answered 400.
|
|
368
|
+
UnauthorizedError: The server answered 401.
|
|
369
|
+
ForbiddenError: The server answered 403.
|
|
370
|
+
PtyNotFoundError: The server answered 404.
|
|
371
|
+
ServiceUnavailableError: The server answered 503.
|
|
372
|
+
|
|
373
|
+
``POST /api/experimental/persistent-pty/:ptyID/connect-token``
|
|
374
|
+
"""
|
|
375
|
+
return cast(
|
|
376
|
+
"PtyTicketConnectToken",
|
|
377
|
+
self._client.request(
|
|
378
|
+
RequestOptions(
|
|
379
|
+
method="POST",
|
|
380
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}/connect-token",
|
|
381
|
+
headers={"x-opencode-ticket": x_opencode_ticket},
|
|
382
|
+
extra_headers=extra_headers,
|
|
383
|
+
extra_query=extra_query,
|
|
384
|
+
extra_body=extra_body,
|
|
385
|
+
timeout=timeout,
|
|
386
|
+
),
|
|
387
|
+
response_type="PtyTicketConnectToken",
|
|
388
|
+
unwrap=True,
|
|
389
|
+
),
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
class ExperimentalResource(SyncAPIResource):
|
|
394
|
+
"""Operations under ``client.experimental`` (OpenCode ``experimental``)."""
|
|
395
|
+
|
|
396
|
+
@cached_property
|
|
397
|
+
def persistent_pty(self) -> ExperimentalPersistentPtyResource:
|
|
398
|
+
"""Operations under ``client.experimental.persistent_pty``."""
|
|
399
|
+
return ExperimentalPersistentPtyResource(self._client)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
|
|
403
|
+
"""Operations under ``client.experimental.persistent_pty`` (OpenCode ``experimental.persistentPty``)."""
|
|
404
|
+
|
|
405
|
+
async def read(
|
|
406
|
+
self,
|
|
407
|
+
session_id: SessionID,
|
|
408
|
+
*,
|
|
409
|
+
lines: PersistentPtyReadLines | NotGiven | None = NOT_GIVEN,
|
|
410
|
+
extra_headers: Headers | None = None,
|
|
411
|
+
extra_query: Query | None = None,
|
|
412
|
+
extra_body: Body | None = None,
|
|
413
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
414
|
+
) -> PersistentPtyReadResult | None:
|
|
415
|
+
"""Read the session's most recently controlled terminal.
|
|
416
|
+
|
|
417
|
+
Read the last physical rows without changing selection or taking control. Omitted lines uses the live terminal height; larger counts include retained history. Blank rows are preserved. Screen dimensions and cursor remain relative to the live screen. Returns null when no current terminal exists. Selection is server-local and resets on restart. Experimental: may change without compatibility guarantees.
|
|
418
|
+
|
|
419
|
+
This endpoint is experimental in OpenCode and may change without notice.
|
|
420
|
+
|
|
421
|
+
Raises:
|
|
422
|
+
InvalidRequestError: The server answered 400.
|
|
423
|
+
UnauthorizedError: The server answered 401.
|
|
424
|
+
ServiceUnavailableError: The server answered 503.
|
|
425
|
+
|
|
426
|
+
``GET /api/experimental/session/:sessionID/terminal/read``
|
|
427
|
+
"""
|
|
428
|
+
return cast(
|
|
429
|
+
"PersistentPtyReadResult | None",
|
|
430
|
+
await self._client.request(
|
|
431
|
+
RequestOptions(
|
|
432
|
+
method="GET",
|
|
433
|
+
path=f"/api/experimental/session/{encode_path_segment(session_id)}/terminal/read",
|
|
434
|
+
query={"lines": lines},
|
|
435
|
+
extra_headers=extra_headers,
|
|
436
|
+
extra_query=extra_query,
|
|
437
|
+
extra_body=extra_body,
|
|
438
|
+
timeout=timeout,
|
|
439
|
+
),
|
|
440
|
+
response_type="PersistentPtyReadResult | None",
|
|
441
|
+
unwrap=True,
|
|
442
|
+
),
|
|
443
|
+
)
|
|
444
|
+
|
|
445
|
+
async def list(
|
|
446
|
+
self,
|
|
447
|
+
session_id: SessionID,
|
|
448
|
+
*,
|
|
449
|
+
extra_headers: Headers | None = None,
|
|
450
|
+
extra_query: Query | None = None,
|
|
451
|
+
extra_body: Body | None = None,
|
|
452
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
453
|
+
) -> builtins.list[PersistentPtyInfo]:
|
|
454
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
455
|
+
|
|
456
|
+
Raises:
|
|
457
|
+
InvalidRequestError: The server answered 400.
|
|
458
|
+
UnauthorizedError: The server answered 401.
|
|
459
|
+
ServiceUnavailableError: The server answered 503.
|
|
460
|
+
|
|
461
|
+
``GET /api/experimental/session/:sessionID/terminal``
|
|
462
|
+
"""
|
|
463
|
+
return cast(
|
|
464
|
+
"builtins.list[PersistentPtyInfo]",
|
|
465
|
+
await self._client.request(
|
|
466
|
+
RequestOptions(
|
|
467
|
+
method="GET",
|
|
468
|
+
path=f"/api/experimental/session/{encode_path_segment(session_id)}/terminal",
|
|
469
|
+
extra_headers=extra_headers,
|
|
470
|
+
extra_query=extra_query,
|
|
471
|
+
extra_body=extra_body,
|
|
472
|
+
timeout=timeout,
|
|
473
|
+
),
|
|
474
|
+
response_type="builtins.list[PersistentPtyInfo]",
|
|
475
|
+
unwrap=True,
|
|
476
|
+
),
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
async def create(
|
|
480
|
+
self,
|
|
481
|
+
session_id: SessionID,
|
|
482
|
+
*,
|
|
483
|
+
args: Sequence[str],
|
|
484
|
+
title: str,
|
|
485
|
+
env: Mapping[str, str],
|
|
486
|
+
command: str | NotGiven = NOT_GIVEN,
|
|
487
|
+
cwd: str | NotGiven = NOT_GIVEN,
|
|
488
|
+
size: ExperimentalPersistentPtyCreateSize | NotGiven = NOT_GIVEN,
|
|
489
|
+
extra_headers: Headers | None = None,
|
|
490
|
+
extra_query: Query | None = None,
|
|
491
|
+
extra_body: Body | None = None,
|
|
492
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
493
|
+
) -> PersistentPtyInfo:
|
|
494
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
495
|
+
|
|
496
|
+
Raises:
|
|
497
|
+
InvalidRequestError: The server answered 400.
|
|
498
|
+
UnauthorizedError: The server answered 401.
|
|
499
|
+
ServiceUnavailableError: The server answered 503.
|
|
500
|
+
|
|
501
|
+
``POST /api/experimental/session/:sessionID/terminal``
|
|
502
|
+
"""
|
|
503
|
+
return cast(
|
|
504
|
+
"PersistentPtyInfo",
|
|
505
|
+
await self._client.request(
|
|
506
|
+
RequestOptions(
|
|
507
|
+
method="POST",
|
|
508
|
+
path=f"/api/experimental/session/{encode_path_segment(session_id)}/terminal",
|
|
509
|
+
body={"command": command, "args": args, "cwd": cwd, "title": title, "env": env, "size": size},
|
|
510
|
+
extra_headers=extra_headers,
|
|
511
|
+
extra_query=extra_query,
|
|
512
|
+
extra_body=extra_body,
|
|
513
|
+
timeout=timeout,
|
|
514
|
+
),
|
|
515
|
+
response_type="PersistentPtyInfo",
|
|
516
|
+
unwrap=True,
|
|
517
|
+
),
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
async def shutdown(
|
|
521
|
+
self,
|
|
522
|
+
*,
|
|
523
|
+
extra_headers: Headers | None = None,
|
|
524
|
+
extra_query: Query | None = None,
|
|
525
|
+
extra_body: Body | None = None,
|
|
526
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
527
|
+
) -> None:
|
|
528
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
529
|
+
|
|
530
|
+
Raises:
|
|
531
|
+
InvalidRequestError: The server answered 400.
|
|
532
|
+
UnauthorizedError: The server answered 401.
|
|
533
|
+
ServiceUnavailableError: The server answered 503.
|
|
534
|
+
|
|
535
|
+
``POST /api/experimental/persistent-pty/shutdown``
|
|
536
|
+
"""
|
|
537
|
+
await self._client.request(
|
|
538
|
+
RequestOptions(
|
|
539
|
+
method="POST",
|
|
540
|
+
path="/api/experimental/persistent-pty/shutdown",
|
|
541
|
+
extra_headers=extra_headers,
|
|
542
|
+
extra_query=extra_query,
|
|
543
|
+
extra_body=extra_body,
|
|
544
|
+
timeout=timeout,
|
|
545
|
+
),
|
|
546
|
+
kind="void",
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
async def handoff(
|
|
550
|
+
self,
|
|
551
|
+
*,
|
|
552
|
+
extra_headers: Headers | None = None,
|
|
553
|
+
extra_query: Query | None = None,
|
|
554
|
+
extra_body: Body | None = None,
|
|
555
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
556
|
+
) -> ExperimentalPersistentPtyHandoffResponse:
|
|
557
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
558
|
+
|
|
559
|
+
Raises:
|
|
560
|
+
InvalidRequestError: The server answered 400.
|
|
561
|
+
UnauthorizedError: The server answered 401.
|
|
562
|
+
ServiceUnavailableError: The server answered 503.
|
|
563
|
+
|
|
564
|
+
``POST /api/experimental/persistent-pty/handoff``
|
|
565
|
+
"""
|
|
566
|
+
return cast(
|
|
567
|
+
"ExperimentalPersistentPtyHandoffResponse",
|
|
568
|
+
await self._client.request(
|
|
569
|
+
RequestOptions(
|
|
570
|
+
method="POST",
|
|
571
|
+
path="/api/experimental/persistent-pty/handoff",
|
|
572
|
+
extra_headers=extra_headers,
|
|
573
|
+
extra_query=extra_query,
|
|
574
|
+
extra_body=extra_body,
|
|
575
|
+
timeout=timeout,
|
|
576
|
+
),
|
|
577
|
+
response_type="ExperimentalPersistentPtyHandoffResponse",
|
|
578
|
+
),
|
|
579
|
+
)
|
|
580
|
+
|
|
581
|
+
async def get(
|
|
582
|
+
self,
|
|
583
|
+
pty_id: PtyID,
|
|
584
|
+
*,
|
|
585
|
+
extra_headers: Headers | None = None,
|
|
586
|
+
extra_query: Query | None = None,
|
|
587
|
+
extra_body: Body | None = None,
|
|
588
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
589
|
+
) -> PersistentPtyInfo:
|
|
590
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
591
|
+
|
|
592
|
+
Raises:
|
|
593
|
+
InvalidRequestError: The server answered 400.
|
|
594
|
+
UnauthorizedError: The server answered 401.
|
|
595
|
+
PtyNotFoundError: The server answered 404.
|
|
596
|
+
ServiceUnavailableError: The server answered 503.
|
|
597
|
+
|
|
598
|
+
``GET /api/experimental/persistent-pty/:ptyID``
|
|
599
|
+
"""
|
|
600
|
+
return cast(
|
|
601
|
+
"PersistentPtyInfo",
|
|
602
|
+
await self._client.request(
|
|
603
|
+
RequestOptions(
|
|
604
|
+
method="GET",
|
|
605
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}",
|
|
606
|
+
extra_headers=extra_headers,
|
|
607
|
+
extra_query=extra_query,
|
|
608
|
+
extra_body=extra_body,
|
|
609
|
+
timeout=timeout,
|
|
610
|
+
),
|
|
611
|
+
response_type="PersistentPtyInfo",
|
|
612
|
+
unwrap=True,
|
|
613
|
+
),
|
|
614
|
+
)
|
|
615
|
+
|
|
616
|
+
async def update(
|
|
617
|
+
self,
|
|
618
|
+
pty_id: PtyID,
|
|
619
|
+
*,
|
|
620
|
+
size: ExperimentalPersistentPtyUpdateSize,
|
|
621
|
+
attachment_id: str | NotGiven = NOT_GIVEN,
|
|
622
|
+
extra_headers: Headers | None = None,
|
|
623
|
+
extra_query: Query | None = None,
|
|
624
|
+
extra_body: Body | None = None,
|
|
625
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
626
|
+
) -> PersistentPtyInfo:
|
|
627
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
628
|
+
|
|
629
|
+
Raises:
|
|
630
|
+
InvalidRequestError: The server answered 400.
|
|
631
|
+
UnauthorizedError: The server answered 401.
|
|
632
|
+
PtyNotFoundError: The server answered 404.
|
|
633
|
+
ServiceUnavailableError: The server answered 503.
|
|
634
|
+
|
|
635
|
+
``PUT /api/experimental/persistent-pty/:ptyID``
|
|
636
|
+
"""
|
|
637
|
+
return cast(
|
|
638
|
+
"PersistentPtyInfo",
|
|
639
|
+
await self._client.request(
|
|
640
|
+
RequestOptions(
|
|
641
|
+
method="PUT",
|
|
642
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}",
|
|
643
|
+
body={"attachmentID": attachment_id, "size": size},
|
|
644
|
+
extra_headers=extra_headers,
|
|
645
|
+
extra_query=extra_query,
|
|
646
|
+
extra_body=extra_body,
|
|
647
|
+
timeout=timeout,
|
|
648
|
+
),
|
|
649
|
+
response_type="PersistentPtyInfo",
|
|
650
|
+
unwrap=True,
|
|
651
|
+
),
|
|
652
|
+
)
|
|
653
|
+
|
|
654
|
+
async def snapshot(
|
|
655
|
+
self,
|
|
656
|
+
pty_id: PtyID,
|
|
657
|
+
*,
|
|
658
|
+
extra_headers: Headers | None = None,
|
|
659
|
+
extra_query: Query | None = None,
|
|
660
|
+
extra_body: Body | None = None,
|
|
661
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
662
|
+
) -> PersistentPtySnapshot:
|
|
663
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
664
|
+
|
|
665
|
+
Raises:
|
|
666
|
+
InvalidRequestError: The server answered 400.
|
|
667
|
+
UnauthorizedError: The server answered 401.
|
|
668
|
+
PtyNotFoundError: The server answered 404.
|
|
669
|
+
ServiceUnavailableError: The server answered 503.
|
|
670
|
+
|
|
671
|
+
``GET /api/experimental/persistent-pty/:ptyID/snapshot``
|
|
672
|
+
"""
|
|
673
|
+
return cast(
|
|
674
|
+
"PersistentPtySnapshot",
|
|
675
|
+
await self._client.request(
|
|
676
|
+
RequestOptions(
|
|
677
|
+
method="GET",
|
|
678
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}/snapshot",
|
|
679
|
+
extra_headers=extra_headers,
|
|
680
|
+
extra_query=extra_query,
|
|
681
|
+
extra_body=extra_body,
|
|
682
|
+
timeout=timeout,
|
|
683
|
+
),
|
|
684
|
+
response_type="PersistentPtySnapshot",
|
|
685
|
+
unwrap=True,
|
|
686
|
+
),
|
|
687
|
+
)
|
|
688
|
+
|
|
689
|
+
async def remove(
|
|
690
|
+
self,
|
|
691
|
+
pty_id: PtyID,
|
|
692
|
+
*,
|
|
693
|
+
extra_headers: Headers | None = None,
|
|
694
|
+
extra_query: Query | None = None,
|
|
695
|
+
extra_body: Body | None = None,
|
|
696
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
697
|
+
) -> None:
|
|
698
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
699
|
+
|
|
700
|
+
Raises:
|
|
701
|
+
InvalidRequestError: The server answered 400.
|
|
702
|
+
UnauthorizedError: The server answered 401.
|
|
703
|
+
PtyNotFoundError: The server answered 404.
|
|
704
|
+
ServiceUnavailableError: The server answered 503.
|
|
705
|
+
|
|
706
|
+
``DELETE /api/experimental/persistent-pty/:ptyID``
|
|
707
|
+
"""
|
|
708
|
+
await self._client.request(
|
|
709
|
+
RequestOptions(
|
|
710
|
+
method="DELETE",
|
|
711
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}",
|
|
712
|
+
extra_headers=extra_headers,
|
|
713
|
+
extra_query=extra_query,
|
|
714
|
+
extra_body=extra_body,
|
|
715
|
+
timeout=timeout,
|
|
716
|
+
),
|
|
717
|
+
kind="void",
|
|
718
|
+
)
|
|
719
|
+
|
|
720
|
+
async def connect_token(
|
|
721
|
+
self,
|
|
722
|
+
pty_id: PtyID,
|
|
723
|
+
*,
|
|
724
|
+
x_opencode_ticket: str | NotGiven | None = NOT_GIVEN,
|
|
725
|
+
extra_headers: Headers | None = None,
|
|
726
|
+
extra_query: Query | None = None,
|
|
727
|
+
extra_body: Body | None = None,
|
|
728
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
729
|
+
) -> PtyTicketConnectToken:
|
|
730
|
+
"""This endpoint is experimental in OpenCode and may change without notice.
|
|
731
|
+
|
|
732
|
+
Raises:
|
|
733
|
+
InvalidRequestError: The server answered 400.
|
|
734
|
+
UnauthorizedError: The server answered 401.
|
|
735
|
+
ForbiddenError: The server answered 403.
|
|
736
|
+
PtyNotFoundError: The server answered 404.
|
|
737
|
+
ServiceUnavailableError: The server answered 503.
|
|
738
|
+
|
|
739
|
+
``POST /api/experimental/persistent-pty/:ptyID/connect-token``
|
|
740
|
+
"""
|
|
741
|
+
return cast(
|
|
742
|
+
"PtyTicketConnectToken",
|
|
743
|
+
await self._client.request(
|
|
744
|
+
RequestOptions(
|
|
745
|
+
method="POST",
|
|
746
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}/connect-token",
|
|
747
|
+
headers={"x-opencode-ticket": x_opencode_ticket},
|
|
748
|
+
extra_headers=extra_headers,
|
|
749
|
+
extra_query=extra_query,
|
|
750
|
+
extra_body=extra_body,
|
|
751
|
+
timeout=timeout,
|
|
752
|
+
),
|
|
753
|
+
response_type="PtyTicketConnectToken",
|
|
754
|
+
unwrap=True,
|
|
755
|
+
),
|
|
756
|
+
)
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
class AsyncExperimentalResource(AsyncAPIResource):
|
|
760
|
+
"""Operations under ``client.experimental`` (OpenCode ``experimental``)."""
|
|
761
|
+
|
|
762
|
+
@cached_property
|
|
763
|
+
def persistent_pty(self) -> AsyncExperimentalPersistentPtyResource:
|
|
764
|
+
"""Operations under ``client.experimental.persistent_pty``."""
|
|
765
|
+
return AsyncExperimentalPersistentPtyResource(self._client)
|