opencode-python-sdk 0.1.0__py3-none-any.whl → 0.1.2__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/__init__.py +4 -0
- opencode/_exceptions.py +22 -0
- opencode/_pty.py +586 -0
- opencode/_server.py +8 -0
- opencode/resources/agent.py +14 -14
- opencode/resources/command.py +6 -6
- opencode/resources/config.py +18 -18
- opencode/resources/credential.py +22 -22
- opencode/resources/debug.py +10 -8
- opencode/resources/event.py +4 -4
- opencode/resources/experimental.py +77 -74
- opencode/resources/file.py +28 -28
- opencode/resources/form.py +6 -6
- opencode/resources/generate.py +8 -8
- opencode/resources/integration.py +102 -94
- opencode/resources/location.py +12 -12
- opencode/resources/mcp.py +44 -42
- opencode/resources/message.py +10 -10
- opencode/resources/migration.py +6 -4
- opencode/resources/model.py +16 -16
- opencode/resources/permission.py +68 -64
- opencode/resources/plugin.py +20 -20
- opencode/resources/project.py +14 -14
- opencode/resources/provider.py +18 -18
- opencode/resources/pty.py +51 -48
- opencode/resources/reference.py +6 -6
- opencode/resources/rpc.py +10 -10
- opencode/resources/server.py +12 -12
- opencode/resources/session.py +378 -366
- opencode/resources/shell.py +34 -34
- opencode/resources/skill.py +6 -6
- opencode/resources/vcs.py +48 -46
- opencode/resources/voice.py +8 -8
- opencode/resources/websearch.py +16 -16
- opencode/resources/worktree.py +30 -30
- {opencode_python_sdk-0.1.0.dist-info → opencode_python_sdk-0.1.2.dist-info}/METADATA +28 -2
- opencode_python_sdk-0.1.2.dist-info/RECORD +56 -0
- opencode_python_sdk-0.1.0.dist-info/RECORD +0 -55
- {opencode_python_sdk-0.1.0.dist-info → opencode_python_sdk-0.1.2.dist-info}/WHEEL +0 -0
- {opencode_python_sdk-0.1.0.dist-info → opencode_python_sdk-0.1.2.dist-info}/licenses/LICENSE +0 -0
opencode/resources/pty.py
CHANGED
|
@@ -10,6 +10,7 @@ from functools import cached_property
|
|
|
10
10
|
from typing import cast
|
|
11
11
|
|
|
12
12
|
from .._base_client import RequestOptions
|
|
13
|
+
from .._pty import AsyncPtyAttachMixin, PtyAttachMixin
|
|
13
14
|
from .._qs import encode_path_segment
|
|
14
15
|
from .._resource import AsyncAPIResource, SyncAPIResource
|
|
15
16
|
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
@@ -46,11 +47,11 @@ class PtyConnectResource(SyncAPIResource):
|
|
|
46
47
|
Create a short-lived single-use ticket for opening a PTY WebSocket connection.
|
|
47
48
|
|
|
48
49
|
Raises:
|
|
49
|
-
InvalidRequestError
|
|
50
|
-
UnauthorizedError
|
|
51
|
-
ForbiddenError
|
|
52
|
-
PtyNotFoundError
|
|
53
|
-
LocationNotFoundError
|
|
50
|
+
InvalidRequestError: The server answered 400.
|
|
51
|
+
UnauthorizedError: The server answered 401.
|
|
52
|
+
ForbiddenError: The server answered 403.
|
|
53
|
+
PtyNotFoundError: The server answered 404.
|
|
54
|
+
LocationNotFoundError: The server answered 404.
|
|
54
55
|
|
|
55
56
|
``POST /api/pty/:ptyID/connect-token``
|
|
56
57
|
"""
|
|
@@ -72,11 +73,12 @@ class PtyConnectResource(SyncAPIResource):
|
|
|
72
73
|
)
|
|
73
74
|
|
|
74
75
|
|
|
75
|
-
class PtyResource(
|
|
76
|
+
class PtyResource(PtyAttachMixin):
|
|
76
77
|
"""Operations under ``client.pty`` (OpenCode ``pty``)."""
|
|
77
78
|
|
|
78
79
|
@cached_property
|
|
79
80
|
def connect(self) -> PtyConnectResource:
|
|
81
|
+
"""Operations under ``client.pty.connect``."""
|
|
80
82
|
return PtyConnectResource(self._client)
|
|
81
83
|
|
|
82
84
|
def list(
|
|
@@ -93,9 +95,9 @@ class PtyResource(SyncAPIResource):
|
|
|
93
95
|
List PTY sessions for a location, including exited sessions retained until removal.
|
|
94
96
|
|
|
95
97
|
Raises:
|
|
96
|
-
InvalidRequestError
|
|
97
|
-
UnauthorizedError
|
|
98
|
-
LocationNotFoundError
|
|
98
|
+
InvalidRequestError: The server answered 400.
|
|
99
|
+
UnauthorizedError: The server answered 401.
|
|
100
|
+
LocationNotFoundError: The server answered 404.
|
|
99
101
|
|
|
100
102
|
``GET /api/pty``
|
|
101
103
|
"""
|
|
@@ -134,9 +136,9 @@ class PtyResource(SyncAPIResource):
|
|
|
134
136
|
Create a pseudo-terminal session for a location.
|
|
135
137
|
|
|
136
138
|
Raises:
|
|
137
|
-
InvalidRequestError
|
|
138
|
-
UnauthorizedError
|
|
139
|
-
LocationNotFoundError
|
|
139
|
+
InvalidRequestError: The server answered 400.
|
|
140
|
+
UnauthorizedError: The server answered 401.
|
|
141
|
+
LocationNotFoundError: The server answered 404.
|
|
140
142
|
|
|
141
143
|
``POST /api/pty``
|
|
142
144
|
"""
|
|
@@ -172,10 +174,10 @@ class PtyResource(SyncAPIResource):
|
|
|
172
174
|
Get one PTY session, including its exit code once exited.
|
|
173
175
|
|
|
174
176
|
Raises:
|
|
175
|
-
InvalidRequestError
|
|
176
|
-
UnauthorizedError
|
|
177
|
-
PtyNotFoundError
|
|
178
|
-
LocationNotFoundError
|
|
177
|
+
InvalidRequestError: The server answered 400.
|
|
178
|
+
UnauthorizedError: The server answered 401.
|
|
179
|
+
PtyNotFoundError: The server answered 404.
|
|
180
|
+
LocationNotFoundError: The server answered 404.
|
|
179
181
|
|
|
180
182
|
``GET /api/pty/:ptyID``
|
|
181
183
|
"""
|
|
@@ -212,10 +214,10 @@ class PtyResource(SyncAPIResource):
|
|
|
212
214
|
Update the title or viewport size of one PTY session.
|
|
213
215
|
|
|
214
216
|
Raises:
|
|
215
|
-
InvalidRequestError
|
|
216
|
-
UnauthorizedError
|
|
217
|
-
PtyNotFoundError
|
|
218
|
-
LocationNotFoundError
|
|
217
|
+
InvalidRequestError: The server answered 400.
|
|
218
|
+
UnauthorizedError: The server answered 401.
|
|
219
|
+
PtyNotFoundError: The server answered 404.
|
|
220
|
+
LocationNotFoundError: The server answered 404.
|
|
219
221
|
|
|
220
222
|
``PUT /api/pty/:ptyID``
|
|
221
223
|
"""
|
|
@@ -251,10 +253,10 @@ class PtyResource(SyncAPIResource):
|
|
|
251
253
|
Terminate and remove one PTY session.
|
|
252
254
|
|
|
253
255
|
Raises:
|
|
254
|
-
InvalidRequestError
|
|
255
|
-
UnauthorizedError
|
|
256
|
-
PtyNotFoundError
|
|
257
|
-
LocationNotFoundError
|
|
256
|
+
InvalidRequestError: The server answered 400.
|
|
257
|
+
UnauthorizedError: The server answered 401.
|
|
258
|
+
PtyNotFoundError: The server answered 404.
|
|
259
|
+
LocationNotFoundError: The server answered 404.
|
|
258
260
|
|
|
259
261
|
``DELETE /api/pty/:ptyID``
|
|
260
262
|
"""
|
|
@@ -291,11 +293,11 @@ class AsyncPtyConnectResource(AsyncAPIResource):
|
|
|
291
293
|
Create a short-lived single-use ticket for opening a PTY WebSocket connection.
|
|
292
294
|
|
|
293
295
|
Raises:
|
|
294
|
-
InvalidRequestError
|
|
295
|
-
UnauthorizedError
|
|
296
|
-
ForbiddenError
|
|
297
|
-
PtyNotFoundError
|
|
298
|
-
LocationNotFoundError
|
|
296
|
+
InvalidRequestError: The server answered 400.
|
|
297
|
+
UnauthorizedError: The server answered 401.
|
|
298
|
+
ForbiddenError: The server answered 403.
|
|
299
|
+
PtyNotFoundError: The server answered 404.
|
|
300
|
+
LocationNotFoundError: The server answered 404.
|
|
299
301
|
|
|
300
302
|
``POST /api/pty/:ptyID/connect-token``
|
|
301
303
|
"""
|
|
@@ -317,11 +319,12 @@ class AsyncPtyConnectResource(AsyncAPIResource):
|
|
|
317
319
|
)
|
|
318
320
|
|
|
319
321
|
|
|
320
|
-
class AsyncPtyResource(
|
|
322
|
+
class AsyncPtyResource(AsyncPtyAttachMixin):
|
|
321
323
|
"""Operations under ``client.pty`` (OpenCode ``pty``)."""
|
|
322
324
|
|
|
323
325
|
@cached_property
|
|
324
326
|
def connect(self) -> AsyncPtyConnectResource:
|
|
327
|
+
"""Operations under ``client.pty.connect``."""
|
|
325
328
|
return AsyncPtyConnectResource(self._client)
|
|
326
329
|
|
|
327
330
|
async def list(
|
|
@@ -338,9 +341,9 @@ class AsyncPtyResource(AsyncAPIResource):
|
|
|
338
341
|
List PTY sessions for a location, including exited sessions retained until removal.
|
|
339
342
|
|
|
340
343
|
Raises:
|
|
341
|
-
InvalidRequestError
|
|
342
|
-
UnauthorizedError
|
|
343
|
-
LocationNotFoundError
|
|
344
|
+
InvalidRequestError: The server answered 400.
|
|
345
|
+
UnauthorizedError: The server answered 401.
|
|
346
|
+
LocationNotFoundError: The server answered 404.
|
|
344
347
|
|
|
345
348
|
``GET /api/pty``
|
|
346
349
|
"""
|
|
@@ -379,9 +382,9 @@ class AsyncPtyResource(AsyncAPIResource):
|
|
|
379
382
|
Create a pseudo-terminal session for a location.
|
|
380
383
|
|
|
381
384
|
Raises:
|
|
382
|
-
InvalidRequestError
|
|
383
|
-
UnauthorizedError
|
|
384
|
-
LocationNotFoundError
|
|
385
|
+
InvalidRequestError: The server answered 400.
|
|
386
|
+
UnauthorizedError: The server answered 401.
|
|
387
|
+
LocationNotFoundError: The server answered 404.
|
|
385
388
|
|
|
386
389
|
``POST /api/pty``
|
|
387
390
|
"""
|
|
@@ -417,10 +420,10 @@ class AsyncPtyResource(AsyncAPIResource):
|
|
|
417
420
|
Get one PTY session, including its exit code once exited.
|
|
418
421
|
|
|
419
422
|
Raises:
|
|
420
|
-
InvalidRequestError
|
|
421
|
-
UnauthorizedError
|
|
422
|
-
PtyNotFoundError
|
|
423
|
-
LocationNotFoundError
|
|
423
|
+
InvalidRequestError: The server answered 400.
|
|
424
|
+
UnauthorizedError: The server answered 401.
|
|
425
|
+
PtyNotFoundError: The server answered 404.
|
|
426
|
+
LocationNotFoundError: The server answered 404.
|
|
424
427
|
|
|
425
428
|
``GET /api/pty/:ptyID``
|
|
426
429
|
"""
|
|
@@ -457,10 +460,10 @@ class AsyncPtyResource(AsyncAPIResource):
|
|
|
457
460
|
Update the title or viewport size of one PTY session.
|
|
458
461
|
|
|
459
462
|
Raises:
|
|
460
|
-
InvalidRequestError
|
|
461
|
-
UnauthorizedError
|
|
462
|
-
PtyNotFoundError
|
|
463
|
-
LocationNotFoundError
|
|
463
|
+
InvalidRequestError: The server answered 400.
|
|
464
|
+
UnauthorizedError: The server answered 401.
|
|
465
|
+
PtyNotFoundError: The server answered 404.
|
|
466
|
+
LocationNotFoundError: The server answered 404.
|
|
464
467
|
|
|
465
468
|
``PUT /api/pty/:ptyID``
|
|
466
469
|
"""
|
|
@@ -496,10 +499,10 @@ class AsyncPtyResource(AsyncAPIResource):
|
|
|
496
499
|
Terminate and remove one PTY session.
|
|
497
500
|
|
|
498
501
|
Raises:
|
|
499
|
-
InvalidRequestError
|
|
500
|
-
UnauthorizedError
|
|
501
|
-
PtyNotFoundError
|
|
502
|
-
LocationNotFoundError
|
|
502
|
+
InvalidRequestError: The server answered 400.
|
|
503
|
+
UnauthorizedError: The server answered 401.
|
|
504
|
+
PtyNotFoundError: The server answered 404.
|
|
505
|
+
LocationNotFoundError: The server answered 404.
|
|
503
506
|
|
|
504
507
|
``DELETE /api/pty/:ptyID``
|
|
505
508
|
"""
|
opencode/resources/reference.py
CHANGED
|
@@ -35,9 +35,9 @@ class ReferenceResource(SyncAPIResource):
|
|
|
35
35
|
List references available in the requested location.
|
|
36
36
|
|
|
37
37
|
Raises:
|
|
38
|
-
InvalidRequestError
|
|
39
|
-
UnauthorizedError
|
|
40
|
-
LocationNotFoundError
|
|
38
|
+
InvalidRequestError: The server answered 400.
|
|
39
|
+
UnauthorizedError: The server answered 401.
|
|
40
|
+
LocationNotFoundError: The server answered 404.
|
|
41
41
|
|
|
42
42
|
``GET /api/reference``
|
|
43
43
|
"""
|
|
@@ -75,9 +75,9 @@ class AsyncReferenceResource(AsyncAPIResource):
|
|
|
75
75
|
List references available in the requested location.
|
|
76
76
|
|
|
77
77
|
Raises:
|
|
78
|
-
InvalidRequestError
|
|
79
|
-
UnauthorizedError
|
|
80
|
-
LocationNotFoundError
|
|
78
|
+
InvalidRequestError: The server answered 400.
|
|
79
|
+
UnauthorizedError: The server answered 401.
|
|
80
|
+
LocationNotFoundError: The server answered 404.
|
|
81
81
|
|
|
82
82
|
``GET /api/reference``
|
|
83
83
|
"""
|
opencode/resources/rpc.py
CHANGED
|
@@ -39,11 +39,11 @@ class RpcResource(SyncAPIResource):
|
|
|
39
39
|
Dispatch a method to the currently registered RPC at the requested location.
|
|
40
40
|
|
|
41
41
|
Raises:
|
|
42
|
-
RpcError
|
|
43
|
-
InvalidRequestError
|
|
44
|
-
UnauthorizedError
|
|
45
|
-
LocationNotFoundError
|
|
46
|
-
RpcInternalError
|
|
42
|
+
RpcError: The server answered 400.
|
|
43
|
+
InvalidRequestError: The server answered 400.
|
|
44
|
+
UnauthorizedError: The server answered 401.
|
|
45
|
+
LocationNotFoundError: The server answered 404.
|
|
46
|
+
RpcInternalError: The server answered 500.
|
|
47
47
|
|
|
48
48
|
``POST /api/rpc/:rpcID/:method``
|
|
49
49
|
"""
|
|
@@ -85,11 +85,11 @@ class AsyncRpcResource(AsyncAPIResource):
|
|
|
85
85
|
Dispatch a method to the currently registered RPC at the requested location.
|
|
86
86
|
|
|
87
87
|
Raises:
|
|
88
|
-
RpcError
|
|
89
|
-
InvalidRequestError
|
|
90
|
-
UnauthorizedError
|
|
91
|
-
LocationNotFoundError
|
|
92
|
-
RpcInternalError
|
|
88
|
+
RpcError: The server answered 400.
|
|
89
|
+
InvalidRequestError: The server answered 400.
|
|
90
|
+
UnauthorizedError: The server answered 401.
|
|
91
|
+
LocationNotFoundError: The server answered 404.
|
|
92
|
+
RpcInternalError: The server answered 500.
|
|
93
93
|
|
|
94
94
|
``POST /api/rpc/:rpcID/:method``
|
|
95
95
|
"""
|
opencode/resources/server.py
CHANGED
|
@@ -36,8 +36,8 @@ class ServerResource(SyncAPIResource):
|
|
|
36
36
|
Return the server identity, connection URLs, paths, and readiness status.
|
|
37
37
|
|
|
38
38
|
Raises:
|
|
39
|
-
InvalidRequestError
|
|
40
|
-
UnauthorizedError
|
|
39
|
+
InvalidRequestError: The server answered 400.
|
|
40
|
+
UnauthorizedError: The server answered 401.
|
|
41
41
|
|
|
42
42
|
``GET /api/info``
|
|
43
43
|
"""
|
|
@@ -69,8 +69,8 @@ class ServerResource(SyncAPIResource):
|
|
|
69
69
|
Create a short-lived, single-use code for a /auth/connect/:code pairing link.
|
|
70
70
|
|
|
71
71
|
Raises:
|
|
72
|
-
InvalidRequestError
|
|
73
|
-
UnauthorizedError
|
|
72
|
+
InvalidRequestError: The server answered 400.
|
|
73
|
+
UnauthorizedError: The server answered 401.
|
|
74
74
|
|
|
75
75
|
``POST /api/pair``
|
|
76
76
|
"""
|
|
@@ -103,8 +103,8 @@ class ServerResource(SyncAPIResource):
|
|
|
103
103
|
Redeem a pairing code. Browsers receive a session cookie and a redirect to the web app; requests that accept JSON receive a session token to use as the password.
|
|
104
104
|
|
|
105
105
|
Raises:
|
|
106
|
-
InvalidRequestError
|
|
107
|
-
UnauthorizedError
|
|
106
|
+
InvalidRequestError: The server answered 400.
|
|
107
|
+
UnauthorizedError: The server answered 401.
|
|
108
108
|
|
|
109
109
|
``GET /auth/connect/:code``
|
|
110
110
|
"""
|
|
@@ -140,8 +140,8 @@ class AsyncServerResource(AsyncAPIResource):
|
|
|
140
140
|
Return the server identity, connection URLs, paths, and readiness status.
|
|
141
141
|
|
|
142
142
|
Raises:
|
|
143
|
-
InvalidRequestError
|
|
144
|
-
UnauthorizedError
|
|
143
|
+
InvalidRequestError: The server answered 400.
|
|
144
|
+
UnauthorizedError: The server answered 401.
|
|
145
145
|
|
|
146
146
|
``GET /api/info``
|
|
147
147
|
"""
|
|
@@ -173,8 +173,8 @@ class AsyncServerResource(AsyncAPIResource):
|
|
|
173
173
|
Create a short-lived, single-use code for a /auth/connect/:code pairing link.
|
|
174
174
|
|
|
175
175
|
Raises:
|
|
176
|
-
InvalidRequestError
|
|
177
|
-
UnauthorizedError
|
|
176
|
+
InvalidRequestError: The server answered 400.
|
|
177
|
+
UnauthorizedError: The server answered 401.
|
|
178
178
|
|
|
179
179
|
``POST /api/pair``
|
|
180
180
|
"""
|
|
@@ -207,8 +207,8 @@ class AsyncServerResource(AsyncAPIResource):
|
|
|
207
207
|
Redeem a pairing code. Browsers receive a session cookie and a redirect to the web app; requests that accept JSON receive a session token to use as the password.
|
|
208
208
|
|
|
209
209
|
Raises:
|
|
210
|
-
InvalidRequestError
|
|
211
|
-
UnauthorizedError
|
|
210
|
+
InvalidRequestError: The server answered 400.
|
|
211
|
+
UnauthorizedError: The server answered 401.
|
|
212
212
|
|
|
213
213
|
``GET /auth/connect/:code``
|
|
214
214
|
"""
|