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.
Files changed (40) hide show
  1. opencode/__init__.py +4 -0
  2. opencode/_exceptions.py +22 -0
  3. opencode/_pty.py +586 -0
  4. opencode/_server.py +8 -0
  5. opencode/resources/agent.py +14 -14
  6. opencode/resources/command.py +6 -6
  7. opencode/resources/config.py +18 -18
  8. opencode/resources/credential.py +22 -22
  9. opencode/resources/debug.py +10 -8
  10. opencode/resources/event.py +4 -4
  11. opencode/resources/experimental.py +77 -74
  12. opencode/resources/file.py +28 -28
  13. opencode/resources/form.py +6 -6
  14. opencode/resources/generate.py +8 -8
  15. opencode/resources/integration.py +102 -94
  16. opencode/resources/location.py +12 -12
  17. opencode/resources/mcp.py +44 -42
  18. opencode/resources/message.py +10 -10
  19. opencode/resources/migration.py +6 -4
  20. opencode/resources/model.py +16 -16
  21. opencode/resources/permission.py +68 -64
  22. opencode/resources/plugin.py +20 -20
  23. opencode/resources/project.py +14 -14
  24. opencode/resources/provider.py +18 -18
  25. opencode/resources/pty.py +51 -48
  26. opencode/resources/reference.py +6 -6
  27. opencode/resources/rpc.py +10 -10
  28. opencode/resources/server.py +12 -12
  29. opencode/resources/session.py +378 -366
  30. opencode/resources/shell.py +34 -34
  31. opencode/resources/skill.py +6 -6
  32. opencode/resources/vcs.py +48 -46
  33. opencode/resources/voice.py +8 -8
  34. opencode/resources/websearch.py +16 -16
  35. opencode/resources/worktree.py +30 -30
  36. {opencode_python_sdk-0.1.0.dist-info → opencode_python_sdk-0.1.2.dist-info}/METADATA +28 -2
  37. opencode_python_sdk-0.1.2.dist-info/RECORD +56 -0
  38. opencode_python_sdk-0.1.0.dist-info/RECORD +0 -55
  39. {opencode_python_sdk-0.1.0.dist-info → opencode_python_sdk-0.1.2.dist-info}/WHEEL +0 -0
  40. {opencode_python_sdk-0.1.0.dist-info → opencode_python_sdk-0.1.2.dist-info}/licenses/LICENSE +0 -0
@@ -11,6 +11,7 @@ from functools import cached_property
11
11
  from typing import cast
12
12
 
13
13
  from .._base_client import RequestOptions
14
+ from .._pty import AsyncPersistentPtyAttachMixin, PersistentPtyAttachMixin
14
15
  from .._qs import encode_path_segment
15
16
  from .._resource import AsyncAPIResource, SyncAPIResource
16
17
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
@@ -30,7 +31,7 @@ from ..types import (
30
31
  __all__ = ["ExperimentalResource", "AsyncExperimentalResource"]
31
32
 
32
33
 
33
- class ExperimentalPersistentPtyResource(SyncAPIResource):
34
+ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
34
35
  """Operations under ``client.experimental.persistent_pty`` (OpenCode ``experimental.persistentPty``)."""
35
36
 
36
37
  def read(
@@ -50,9 +51,9 @@ class ExperimentalPersistentPtyResource(SyncAPIResource):
50
51
  This endpoint is experimental in OpenCode and may change without notice.
51
52
 
52
53
  Raises:
53
- InvalidRequestError
54
- UnauthorizedError
55
- ServiceUnavailableError
54
+ InvalidRequestError: The server answered 400.
55
+ UnauthorizedError: The server answered 401.
56
+ ServiceUnavailableError: The server answered 503.
56
57
 
57
58
  ``GET /api/experimental/session/:sessionID/terminal/read``
58
59
  """
@@ -85,9 +86,9 @@ class ExperimentalPersistentPtyResource(SyncAPIResource):
85
86
  """This endpoint is experimental in OpenCode and may change without notice.
86
87
 
87
88
  Raises:
88
- InvalidRequestError
89
- UnauthorizedError
90
- ServiceUnavailableError
89
+ InvalidRequestError: The server answered 400.
90
+ UnauthorizedError: The server answered 401.
91
+ ServiceUnavailableError: The server answered 503.
91
92
 
92
93
  ``GET /api/experimental/session/:sessionID/terminal``
93
94
  """
@@ -125,9 +126,9 @@ class ExperimentalPersistentPtyResource(SyncAPIResource):
125
126
  """This endpoint is experimental in OpenCode and may change without notice.
126
127
 
127
128
  Raises:
128
- InvalidRequestError
129
- UnauthorizedError
130
- ServiceUnavailableError
129
+ InvalidRequestError: The server answered 400.
130
+ UnauthorizedError: The server answered 401.
131
+ ServiceUnavailableError: The server answered 503.
131
132
 
132
133
  ``POST /api/experimental/session/:sessionID/terminal``
133
134
  """
@@ -159,9 +160,9 @@ class ExperimentalPersistentPtyResource(SyncAPIResource):
159
160
  """This endpoint is experimental in OpenCode and may change without notice.
160
161
 
161
162
  Raises:
162
- InvalidRequestError
163
- UnauthorizedError
164
- ServiceUnavailableError
163
+ InvalidRequestError: The server answered 400.
164
+ UnauthorizedError: The server answered 401.
165
+ ServiceUnavailableError: The server answered 503.
165
166
 
166
167
  ``POST /api/experimental/persistent-pty/shutdown``
167
168
  """
@@ -188,9 +189,9 @@ class ExperimentalPersistentPtyResource(SyncAPIResource):
188
189
  """This endpoint is experimental in OpenCode and may change without notice.
189
190
 
190
191
  Raises:
191
- InvalidRequestError
192
- UnauthorizedError
193
- ServiceUnavailableError
192
+ InvalidRequestError: The server answered 400.
193
+ UnauthorizedError: The server answered 401.
194
+ ServiceUnavailableError: The server answered 503.
194
195
 
195
196
  ``POST /api/experimental/persistent-pty/handoff``
196
197
  """
@@ -221,10 +222,10 @@ class ExperimentalPersistentPtyResource(SyncAPIResource):
221
222
  """This endpoint is experimental in OpenCode and may change without notice.
222
223
 
223
224
  Raises:
224
- InvalidRequestError
225
- UnauthorizedError
226
- PtyNotFoundError
227
- ServiceUnavailableError
225
+ InvalidRequestError: The server answered 400.
226
+ UnauthorizedError: The server answered 401.
227
+ PtyNotFoundError: The server answered 404.
228
+ ServiceUnavailableError: The server answered 503.
228
229
 
229
230
  ``GET /api/experimental/persistent-pty/:ptyID``
230
231
  """
@@ -258,10 +259,10 @@ class ExperimentalPersistentPtyResource(SyncAPIResource):
258
259
  """This endpoint is experimental in OpenCode and may change without notice.
259
260
 
260
261
  Raises:
261
- InvalidRequestError
262
- UnauthorizedError
263
- PtyNotFoundError
264
- ServiceUnavailableError
262
+ InvalidRequestError: The server answered 400.
263
+ UnauthorizedError: The server answered 401.
264
+ PtyNotFoundError: The server answered 404.
265
+ ServiceUnavailableError: The server answered 503.
265
266
 
266
267
  ``PUT /api/experimental/persistent-pty/:ptyID``
267
268
  """
@@ -294,10 +295,10 @@ class ExperimentalPersistentPtyResource(SyncAPIResource):
294
295
  """This endpoint is experimental in OpenCode and may change without notice.
295
296
 
296
297
  Raises:
297
- InvalidRequestError
298
- UnauthorizedError
299
- PtyNotFoundError
300
- ServiceUnavailableError
298
+ InvalidRequestError: The server answered 400.
299
+ UnauthorizedError: The server answered 401.
300
+ PtyNotFoundError: The server answered 404.
301
+ ServiceUnavailableError: The server answered 503.
301
302
 
302
303
  ``GET /api/experimental/persistent-pty/:ptyID/snapshot``
303
304
  """
@@ -329,10 +330,10 @@ class ExperimentalPersistentPtyResource(SyncAPIResource):
329
330
  """This endpoint is experimental in OpenCode and may change without notice.
330
331
 
331
332
  Raises:
332
- InvalidRequestError
333
- UnauthorizedError
334
- PtyNotFoundError
335
- ServiceUnavailableError
333
+ InvalidRequestError: The server answered 400.
334
+ UnauthorizedError: The server answered 401.
335
+ PtyNotFoundError: The server answered 404.
336
+ ServiceUnavailableError: The server answered 503.
336
337
 
337
338
  ``DELETE /api/experimental/persistent-pty/:ptyID``
338
339
  """
@@ -361,11 +362,11 @@ class ExperimentalPersistentPtyResource(SyncAPIResource):
361
362
  """This endpoint is experimental in OpenCode and may change without notice.
362
363
 
363
364
  Raises:
364
- InvalidRequestError
365
- UnauthorizedError
366
- ForbiddenError
367
- PtyNotFoundError
368
- ServiceUnavailableError
365
+ InvalidRequestError: The server answered 400.
366
+ UnauthorizedError: The server answered 401.
367
+ ForbiddenError: The server answered 403.
368
+ PtyNotFoundError: The server answered 404.
369
+ ServiceUnavailableError: The server answered 503.
369
370
 
370
371
  ``POST /api/experimental/persistent-pty/:ptyID/connect-token``
371
372
  """
@@ -392,10 +393,11 @@ class ExperimentalResource(SyncAPIResource):
392
393
 
393
394
  @cached_property
394
395
  def persistent_pty(self) -> ExperimentalPersistentPtyResource:
396
+ """Operations under ``client.experimental.persistent_pty``."""
395
397
  return ExperimentalPersistentPtyResource(self._client)
396
398
 
397
399
 
398
- class AsyncExperimentalPersistentPtyResource(AsyncAPIResource):
400
+ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
399
401
  """Operations under ``client.experimental.persistent_pty`` (OpenCode ``experimental.persistentPty``)."""
400
402
 
401
403
  async def read(
@@ -415,9 +417,9 @@ class AsyncExperimentalPersistentPtyResource(AsyncAPIResource):
415
417
  This endpoint is experimental in OpenCode and may change without notice.
416
418
 
417
419
  Raises:
418
- InvalidRequestError
419
- UnauthorizedError
420
- ServiceUnavailableError
420
+ InvalidRequestError: The server answered 400.
421
+ UnauthorizedError: The server answered 401.
422
+ ServiceUnavailableError: The server answered 503.
421
423
 
422
424
  ``GET /api/experimental/session/:sessionID/terminal/read``
423
425
  """
@@ -450,9 +452,9 @@ class AsyncExperimentalPersistentPtyResource(AsyncAPIResource):
450
452
  """This endpoint is experimental in OpenCode and may change without notice.
451
453
 
452
454
  Raises:
453
- InvalidRequestError
454
- UnauthorizedError
455
- ServiceUnavailableError
455
+ InvalidRequestError: The server answered 400.
456
+ UnauthorizedError: The server answered 401.
457
+ ServiceUnavailableError: The server answered 503.
456
458
 
457
459
  ``GET /api/experimental/session/:sessionID/terminal``
458
460
  """
@@ -490,9 +492,9 @@ class AsyncExperimentalPersistentPtyResource(AsyncAPIResource):
490
492
  """This endpoint is experimental in OpenCode and may change without notice.
491
493
 
492
494
  Raises:
493
- InvalidRequestError
494
- UnauthorizedError
495
- ServiceUnavailableError
495
+ InvalidRequestError: The server answered 400.
496
+ UnauthorizedError: The server answered 401.
497
+ ServiceUnavailableError: The server answered 503.
496
498
 
497
499
  ``POST /api/experimental/session/:sessionID/terminal``
498
500
  """
@@ -524,9 +526,9 @@ class AsyncExperimentalPersistentPtyResource(AsyncAPIResource):
524
526
  """This endpoint is experimental in OpenCode and may change without notice.
525
527
 
526
528
  Raises:
527
- InvalidRequestError
528
- UnauthorizedError
529
- ServiceUnavailableError
529
+ InvalidRequestError: The server answered 400.
530
+ UnauthorizedError: The server answered 401.
531
+ ServiceUnavailableError: The server answered 503.
530
532
 
531
533
  ``POST /api/experimental/persistent-pty/shutdown``
532
534
  """
@@ -553,9 +555,9 @@ class AsyncExperimentalPersistentPtyResource(AsyncAPIResource):
553
555
  """This endpoint is experimental in OpenCode and may change without notice.
554
556
 
555
557
  Raises:
556
- InvalidRequestError
557
- UnauthorizedError
558
- ServiceUnavailableError
558
+ InvalidRequestError: The server answered 400.
559
+ UnauthorizedError: The server answered 401.
560
+ ServiceUnavailableError: The server answered 503.
559
561
 
560
562
  ``POST /api/experimental/persistent-pty/handoff``
561
563
  """
@@ -586,10 +588,10 @@ class AsyncExperimentalPersistentPtyResource(AsyncAPIResource):
586
588
  """This endpoint is experimental in OpenCode and may change without notice.
587
589
 
588
590
  Raises:
589
- InvalidRequestError
590
- UnauthorizedError
591
- PtyNotFoundError
592
- ServiceUnavailableError
591
+ InvalidRequestError: The server answered 400.
592
+ UnauthorizedError: The server answered 401.
593
+ PtyNotFoundError: The server answered 404.
594
+ ServiceUnavailableError: The server answered 503.
593
595
 
594
596
  ``GET /api/experimental/persistent-pty/:ptyID``
595
597
  """
@@ -623,10 +625,10 @@ class AsyncExperimentalPersistentPtyResource(AsyncAPIResource):
623
625
  """This endpoint is experimental in OpenCode and may change without notice.
624
626
 
625
627
  Raises:
626
- InvalidRequestError
627
- UnauthorizedError
628
- PtyNotFoundError
629
- ServiceUnavailableError
628
+ InvalidRequestError: The server answered 400.
629
+ UnauthorizedError: The server answered 401.
630
+ PtyNotFoundError: The server answered 404.
631
+ ServiceUnavailableError: The server answered 503.
630
632
 
631
633
  ``PUT /api/experimental/persistent-pty/:ptyID``
632
634
  """
@@ -659,10 +661,10 @@ class AsyncExperimentalPersistentPtyResource(AsyncAPIResource):
659
661
  """This endpoint is experimental in OpenCode and may change without notice.
660
662
 
661
663
  Raises:
662
- InvalidRequestError
663
- UnauthorizedError
664
- PtyNotFoundError
665
- ServiceUnavailableError
664
+ InvalidRequestError: The server answered 400.
665
+ UnauthorizedError: The server answered 401.
666
+ PtyNotFoundError: The server answered 404.
667
+ ServiceUnavailableError: The server answered 503.
666
668
 
667
669
  ``GET /api/experimental/persistent-pty/:ptyID/snapshot``
668
670
  """
@@ -694,10 +696,10 @@ class AsyncExperimentalPersistentPtyResource(AsyncAPIResource):
694
696
  """This endpoint is experimental in OpenCode and may change without notice.
695
697
 
696
698
  Raises:
697
- InvalidRequestError
698
- UnauthorizedError
699
- PtyNotFoundError
700
- ServiceUnavailableError
699
+ InvalidRequestError: The server answered 400.
700
+ UnauthorizedError: The server answered 401.
701
+ PtyNotFoundError: The server answered 404.
702
+ ServiceUnavailableError: The server answered 503.
701
703
 
702
704
  ``DELETE /api/experimental/persistent-pty/:ptyID``
703
705
  """
@@ -726,11 +728,11 @@ class AsyncExperimentalPersistentPtyResource(AsyncAPIResource):
726
728
  """This endpoint is experimental in OpenCode and may change without notice.
727
729
 
728
730
  Raises:
729
- InvalidRequestError
730
- UnauthorizedError
731
- ForbiddenError
732
- PtyNotFoundError
733
- ServiceUnavailableError
731
+ InvalidRequestError: The server answered 400.
732
+ UnauthorizedError: The server answered 401.
733
+ ForbiddenError: The server answered 403.
734
+ PtyNotFoundError: The server answered 404.
735
+ ServiceUnavailableError: The server answered 503.
734
736
 
735
737
  ``POST /api/experimental/persistent-pty/:ptyID/connect-token``
736
738
  """
@@ -757,4 +759,5 @@ class AsyncExperimentalResource(AsyncAPIResource):
757
759
 
758
760
  @cached_property
759
761
  def persistent_pty(self) -> AsyncExperimentalPersistentPtyResource:
762
+ """Operations under ``client.experimental.persistent_pty``."""
760
763
  return AsyncExperimentalPersistentPtyResource(self._client)
@@ -39,10 +39,10 @@ class FileResource(SyncAPIResource):
39
39
  Stream one file relative to the requested location with ETag, Last-Modified, and single-range HTTP Range support (206 Partial Content, 416 Range Not Satisfiable, and 304 Not Modified; multi-range and malformed Range headers fall back to 200).
40
40
 
41
41
  Raises:
42
- InvalidRequestError
43
- UnauthorizedError
44
- RemoteFileNotFoundError
45
- LocationNotFoundError
42
+ InvalidRequestError: The server answered 400.
43
+ UnauthorizedError: The server answered 401.
44
+ RemoteFileNotFoundError: The server answered 404.
45
+ LocationNotFoundError: The server answered 404.
46
46
 
47
47
  ``GET /api/fs/read/*``
48
48
  """
@@ -80,10 +80,10 @@ class FileResource(SyncAPIResource):
80
80
  path: An absolute path or a path relative to the requested location. Defaults to the location directory.
81
81
 
82
82
  Raises:
83
- InvalidRequestError
84
- UnauthorizedError
85
- RemoteFileNotFoundError
86
- LocationNotFoundError
83
+ InvalidRequestError: The server answered 400.
84
+ UnauthorizedError: The server answered 401.
85
+ RemoteFileNotFoundError: The server answered 404.
86
+ LocationNotFoundError: The server answered 404.
87
87
 
88
88
  ``GET /api/fs/list``
89
89
  """
@@ -120,9 +120,9 @@ class FileResource(SyncAPIResource):
120
120
  Find recursively ranked filesystem entries relative to the requested location.
121
121
 
122
122
  Raises:
123
- InvalidRequestError
124
- UnauthorizedError
125
- LocationNotFoundError
123
+ InvalidRequestError: The server answered 400.
124
+ UnauthorizedError: The server answered 401.
125
+ LocationNotFoundError: The server answered 404.
126
126
 
127
127
  ``GET /api/fs/find``
128
128
  """
@@ -163,9 +163,9 @@ class FileResource(SyncAPIResource):
163
163
  path: An absolute path or a path relative to the requested location. Missing parent directories are created.
164
164
 
165
165
  Raises:
166
- InvalidRequestError
167
- UnauthorizedError
168
- LocationNotFoundError
166
+ InvalidRequestError: The server answered 400.
167
+ UnauthorizedError: The server answered 401.
168
+ LocationNotFoundError: The server answered 404.
169
169
 
170
170
  ``POST /api/experimental/fs/write``
171
171
  """
@@ -205,10 +205,10 @@ class AsyncFileResource(AsyncAPIResource):
205
205
  Stream one file relative to the requested location with ETag, Last-Modified, and single-range HTTP Range support (206 Partial Content, 416 Range Not Satisfiable, and 304 Not Modified; multi-range and malformed Range headers fall back to 200).
206
206
 
207
207
  Raises:
208
- InvalidRequestError
209
- UnauthorizedError
210
- RemoteFileNotFoundError
211
- LocationNotFoundError
208
+ InvalidRequestError: The server answered 400.
209
+ UnauthorizedError: The server answered 401.
210
+ RemoteFileNotFoundError: The server answered 404.
211
+ LocationNotFoundError: The server answered 404.
212
212
 
213
213
  ``GET /api/fs/read/*``
214
214
  """
@@ -246,10 +246,10 @@ class AsyncFileResource(AsyncAPIResource):
246
246
  path: An absolute path or a path relative to the requested location. Defaults to the location directory.
247
247
 
248
248
  Raises:
249
- InvalidRequestError
250
- UnauthorizedError
251
- RemoteFileNotFoundError
252
- LocationNotFoundError
249
+ InvalidRequestError: The server answered 400.
250
+ UnauthorizedError: The server answered 401.
251
+ RemoteFileNotFoundError: The server answered 404.
252
+ LocationNotFoundError: The server answered 404.
253
253
 
254
254
  ``GET /api/fs/list``
255
255
  """
@@ -286,9 +286,9 @@ class AsyncFileResource(AsyncAPIResource):
286
286
  Find recursively ranked filesystem entries relative to the requested location.
287
287
 
288
288
  Raises:
289
- InvalidRequestError
290
- UnauthorizedError
291
- LocationNotFoundError
289
+ InvalidRequestError: The server answered 400.
290
+ UnauthorizedError: The server answered 401.
291
+ LocationNotFoundError: The server answered 404.
292
292
 
293
293
  ``GET /api/fs/find``
294
294
  """
@@ -329,9 +329,9 @@ class AsyncFileResource(AsyncAPIResource):
329
329
  path: An absolute path or a path relative to the requested location. Missing parent directories are created.
330
330
 
331
331
  Raises:
332
- InvalidRequestError
333
- UnauthorizedError
334
- LocationNotFoundError
332
+ InvalidRequestError: The server answered 400.
333
+ UnauthorizedError: The server answered 401.
334
+ LocationNotFoundError: The server answered 404.
335
335
 
336
336
  ``POST /api/experimental/fs/write``
337
337
  """
@@ -35,9 +35,9 @@ class FormResource(SyncAPIResource):
35
35
  Retrieve pending forms for a 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/form``
43
43
  """
@@ -75,9 +75,9 @@ class AsyncFormResource(AsyncAPIResource):
75
75
  Retrieve pending forms for a 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/form``
83
83
  """
@@ -38,10 +38,10 @@ class GenerateResource(SyncAPIResource):
38
38
  This endpoint is experimental in OpenCode and may change without notice.
39
39
 
40
40
  Raises:
41
- InvalidRequestError
42
- UnauthorizedError
43
- LocationNotFoundError
44
- ServiceUnavailableError
41
+ InvalidRequestError: The server answered 400.
42
+ UnauthorizedError: The server answered 401.
43
+ LocationNotFoundError: The server answered 404.
44
+ ServiceUnavailableError: The server answered 503.
45
45
 
46
46
  ``POST /api/experimental/generate``
47
47
  """
@@ -83,10 +83,10 @@ class AsyncGenerateResource(AsyncAPIResource):
83
83
  This endpoint is experimental in OpenCode and may change without notice.
84
84
 
85
85
  Raises:
86
- InvalidRequestError
87
- UnauthorizedError
88
- LocationNotFoundError
89
- ServiceUnavailableError
86
+ InvalidRequestError: The server answered 400.
87
+ UnauthorizedError: The server answered 401.
88
+ LocationNotFoundError: The server answered 404.
89
+ ServiceUnavailableError: The server answered 503.
90
90
 
91
91
  ``POST /api/experimental/generate``
92
92
  """