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
@@ -41,9 +41,9 @@ class ShellResource(SyncAPIResource):
41
41
  List currently running shell commands for a location. Exited commands are not included.
42
42
 
43
43
  Raises:
44
- InvalidRequestError
45
- UnauthorizedError
46
- LocationNotFoundError
44
+ InvalidRequestError: The server answered 400.
45
+ UnauthorizedError: The server answered 401.
46
+ LocationNotFoundError: The server answered 404.
47
47
 
48
48
  ``GET /api/shell``
49
49
  """
@@ -81,9 +81,9 @@ class ShellResource(SyncAPIResource):
81
81
  Spawn one non-interactive shell command for a location. Combined stdout/stderr is captured to a file pageable via output.
82
82
 
83
83
  Raises:
84
- InvalidRequestError
85
- UnauthorizedError
86
- LocationNotFoundError
84
+ InvalidRequestError: The server answered 400.
85
+ UnauthorizedError: The server answered 401.
86
+ LocationNotFoundError: The server answered 404.
87
87
 
88
88
  ``POST /api/shell``
89
89
  """
@@ -119,10 +119,10 @@ class ShellResource(SyncAPIResource):
119
119
  Get one shell command, including its status and exit code once exited.
120
120
 
121
121
  Raises:
122
- InvalidRequestError
123
- UnauthorizedError
124
- ShellNotFoundError
125
- LocationNotFoundError
122
+ InvalidRequestError: The server answered 400.
123
+ UnauthorizedError: The server answered 401.
124
+ ShellNotFoundError: The server answered 404.
125
+ LocationNotFoundError: The server answered 404.
126
126
 
127
127
  ``GET /api/shell/:id``
128
128
  """
@@ -159,10 +159,10 @@ class ShellResource(SyncAPIResource):
159
159
  Page through captured combined output by absolute byte cursor.
160
160
 
161
161
  Raises:
162
- InvalidRequestError
163
- UnauthorizedError
164
- ShellNotFoundError
165
- LocationNotFoundError
162
+ InvalidRequestError: The server answered 400.
163
+ UnauthorizedError: The server answered 401.
164
+ ShellNotFoundError: The server answered 404.
165
+ LocationNotFoundError: The server answered 404.
166
166
 
167
167
  ``GET /api/shell/:id/output``
168
168
  """
@@ -197,9 +197,9 @@ class ShellResource(SyncAPIResource):
197
197
  Terminate and remove one shell command and its retained output.
198
198
 
199
199
  Raises:
200
- InvalidRequestError
201
- UnauthorizedError
202
- LocationNotFoundError
200
+ InvalidRequestError: The server answered 400.
201
+ UnauthorizedError: The server answered 401.
202
+ LocationNotFoundError: The server answered 404.
203
203
 
204
204
  ``DELETE /api/shell/:id``
205
205
  """
@@ -234,9 +234,9 @@ class AsyncShellResource(AsyncAPIResource):
234
234
  List currently running shell commands for a location. Exited commands are not included.
235
235
 
236
236
  Raises:
237
- InvalidRequestError
238
- UnauthorizedError
239
- LocationNotFoundError
237
+ InvalidRequestError: The server answered 400.
238
+ UnauthorizedError: The server answered 401.
239
+ LocationNotFoundError: The server answered 404.
240
240
 
241
241
  ``GET /api/shell``
242
242
  """
@@ -274,9 +274,9 @@ class AsyncShellResource(AsyncAPIResource):
274
274
  Spawn one non-interactive shell command for a location. Combined stdout/stderr is captured to a file pageable via output.
275
275
 
276
276
  Raises:
277
- InvalidRequestError
278
- UnauthorizedError
279
- LocationNotFoundError
277
+ InvalidRequestError: The server answered 400.
278
+ UnauthorizedError: The server answered 401.
279
+ LocationNotFoundError: The server answered 404.
280
280
 
281
281
  ``POST /api/shell``
282
282
  """
@@ -312,10 +312,10 @@ class AsyncShellResource(AsyncAPIResource):
312
312
  Get one shell command, including its status and exit code once exited.
313
313
 
314
314
  Raises:
315
- InvalidRequestError
316
- UnauthorizedError
317
- ShellNotFoundError
318
- LocationNotFoundError
315
+ InvalidRequestError: The server answered 400.
316
+ UnauthorizedError: The server answered 401.
317
+ ShellNotFoundError: The server answered 404.
318
+ LocationNotFoundError: The server answered 404.
319
319
 
320
320
  ``GET /api/shell/:id``
321
321
  """
@@ -352,10 +352,10 @@ class AsyncShellResource(AsyncAPIResource):
352
352
  Page through captured combined output by absolute byte cursor.
353
353
 
354
354
  Raises:
355
- InvalidRequestError
356
- UnauthorizedError
357
- ShellNotFoundError
358
- LocationNotFoundError
355
+ InvalidRequestError: The server answered 400.
356
+ UnauthorizedError: The server answered 401.
357
+ ShellNotFoundError: The server answered 404.
358
+ LocationNotFoundError: The server answered 404.
359
359
 
360
360
  ``GET /api/shell/:id/output``
361
361
  """
@@ -390,9 +390,9 @@ class AsyncShellResource(AsyncAPIResource):
390
390
  Terminate and remove one shell command and its retained output.
391
391
 
392
392
  Raises:
393
- InvalidRequestError
394
- UnauthorizedError
395
- LocationNotFoundError
393
+ InvalidRequestError: The server answered 400.
394
+ UnauthorizedError: The server answered 401.
395
+ LocationNotFoundError: The server answered 404.
396
396
 
397
397
  ``DELETE /api/shell/:id``
398
398
  """
@@ -35,9 +35,9 @@ class SkillResource(SyncAPIResource):
35
35
  Retrieve currently registered skills.
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/skill``
43
43
  """
@@ -75,9 +75,9 @@ class AsyncSkillResource(AsyncAPIResource):
75
75
  Retrieve currently registered skills.
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/skill``
83
83
  """
opencode/resources/vcs.py CHANGED
@@ -43,9 +43,9 @@ class VcsBranchResource(SyncAPIResource):
43
43
  List local and remote branches available at the requested location.
44
44
 
45
45
  Raises:
46
- InvalidRequestError
47
- UnauthorizedError
48
- LocationNotFoundError
46
+ InvalidRequestError: The server answered 400.
47
+ UnauthorizedError: The server answered 401.
48
+ LocationNotFoundError: The server answered 404.
49
49
 
50
50
  ``GET /api/vcs/branch``
51
51
  """
@@ -71,6 +71,7 @@ class VcsResource(SyncAPIResource):
71
71
 
72
72
  @cached_property
73
73
  def branch(self) -> VcsBranchResource:
74
+ """Operations under ``client.vcs.branch``."""
74
75
  return VcsBranchResource(self._client)
75
76
 
76
77
  def init(
@@ -88,12 +89,12 @@ class VcsResource(SyncAPIResource):
88
89
  Initialize a repository using the selected VCS provider in a markerless project's directory and refresh its location services. Omitting provider defaults to git; built-in git and hg providers support initialization. An unknown provider returns 400; a registered provider without init returns 501.
89
90
 
90
91
  Raises:
91
- InvalidRequestError
92
- UnauthorizedError
93
- LocationNotFoundError
94
- ConflictError
95
- VcsInitNotSupportedError
96
- ServiceUnavailableError
92
+ InvalidRequestError: The server answered 400.
93
+ UnauthorizedError: The server answered 401.
94
+ LocationNotFoundError: The server answered 404.
95
+ ConflictError: The server answered 409.
96
+ VcsInitNotSupportedError: The server answered 501.
97
+ ServiceUnavailableError: The server answered 503.
97
98
 
98
99
  ``POST /api/vcs/init``
99
100
  """
@@ -124,9 +125,9 @@ class VcsResource(SyncAPIResource):
124
125
  Get current and default branch information for the requested location.
125
126
 
126
127
  Raises:
127
- InvalidRequestError
128
- UnauthorizedError
129
- LocationNotFoundError
128
+ InvalidRequestError: The server answered 400.
129
+ UnauthorizedError: The server answered 401.
130
+ LocationNotFoundError: The server answered 404.
130
131
 
131
132
  ``GET /api/vcs``
132
133
  """
@@ -160,10 +161,10 @@ class VcsResource(SyncAPIResource):
160
161
  Infer a local review base from named branch creation history, or the repository default only when currently on that branch. Returns null before the first commit or when the provider lacks base metadata; ambiguous Git history requires an explicit base on diff requests.
161
162
 
162
163
  Raises:
163
- InvalidRequestError
164
- UnauthorizedError
165
- LocationNotFoundError
166
- ServiceUnavailableError
164
+ InvalidRequestError: The server answered 400.
165
+ UnauthorizedError: The server answered 401.
166
+ LocationNotFoundError: The server answered 404.
167
+ ServiceUnavailableError: The server answered 503.
167
168
 
168
169
  ``GET /api/vcs/base``
169
170
  """
@@ -197,9 +198,9 @@ class VcsResource(SyncAPIResource):
197
198
  List uncommitted working-copy changes relative to the requested location.
198
199
 
199
200
  Raises:
200
- InvalidRequestError
201
- UnauthorizedError
202
- LocationNotFoundError
201
+ InvalidRequestError: The server answered 400.
202
+ UnauthorizedError: The server answered 401.
203
+ LocationNotFoundError: The server answered 404.
203
204
 
204
205
  ``GET /api/vcs/status``
205
206
  """
@@ -236,10 +237,10 @@ class VcsResource(SyncAPIResource):
236
237
  Diff HEAD to the working copy (working), the base merge-base to the working copy (branch), or the base merge-base to HEAD (committed). Omitting base preserves repository-default comparison; supplying it overrides the comparison without saving it.
237
238
 
238
239
  Raises:
239
- InvalidRequestError
240
- UnauthorizedError
241
- LocationNotFoundError
242
- ServiceUnavailableError
240
+ InvalidRequestError: The server answered 400.
241
+ UnauthorizedError: The server answered 401.
242
+ LocationNotFoundError: The server answered 404.
243
+ ServiceUnavailableError: The server answered 503.
243
244
 
244
245
  ``GET /api/vcs/diff``
245
246
  """
@@ -279,9 +280,9 @@ class AsyncVcsBranchResource(AsyncAPIResource):
279
280
  List local and remote branches available at the requested location.
280
281
 
281
282
  Raises:
282
- InvalidRequestError
283
- UnauthorizedError
284
- LocationNotFoundError
283
+ InvalidRequestError: The server answered 400.
284
+ UnauthorizedError: The server answered 401.
285
+ LocationNotFoundError: The server answered 404.
285
286
 
286
287
  ``GET /api/vcs/branch``
287
288
  """
@@ -307,6 +308,7 @@ class AsyncVcsResource(AsyncAPIResource):
307
308
 
308
309
  @cached_property
309
310
  def branch(self) -> AsyncVcsBranchResource:
311
+ """Operations under ``client.vcs.branch``."""
310
312
  return AsyncVcsBranchResource(self._client)
311
313
 
312
314
  async def init(
@@ -324,12 +326,12 @@ class AsyncVcsResource(AsyncAPIResource):
324
326
  Initialize a repository using the selected VCS provider in a markerless project's directory and refresh its location services. Omitting provider defaults to git; built-in git and hg providers support initialization. An unknown provider returns 400; a registered provider without init returns 501.
325
327
 
326
328
  Raises:
327
- InvalidRequestError
328
- UnauthorizedError
329
- LocationNotFoundError
330
- ConflictError
331
- VcsInitNotSupportedError
332
- ServiceUnavailableError
329
+ InvalidRequestError: The server answered 400.
330
+ UnauthorizedError: The server answered 401.
331
+ LocationNotFoundError: The server answered 404.
332
+ ConflictError: The server answered 409.
333
+ VcsInitNotSupportedError: The server answered 501.
334
+ ServiceUnavailableError: The server answered 503.
333
335
 
334
336
  ``POST /api/vcs/init``
335
337
  """
@@ -360,9 +362,9 @@ class AsyncVcsResource(AsyncAPIResource):
360
362
  Get current and default branch information for the requested location.
361
363
 
362
364
  Raises:
363
- InvalidRequestError
364
- UnauthorizedError
365
- LocationNotFoundError
365
+ InvalidRequestError: The server answered 400.
366
+ UnauthorizedError: The server answered 401.
367
+ LocationNotFoundError: The server answered 404.
366
368
 
367
369
  ``GET /api/vcs``
368
370
  """
@@ -396,10 +398,10 @@ class AsyncVcsResource(AsyncAPIResource):
396
398
  Infer a local review base from named branch creation history, or the repository default only when currently on that branch. Returns null before the first commit or when the provider lacks base metadata; ambiguous Git history requires an explicit base on diff requests.
397
399
 
398
400
  Raises:
399
- InvalidRequestError
400
- UnauthorizedError
401
- LocationNotFoundError
402
- ServiceUnavailableError
401
+ InvalidRequestError: The server answered 400.
402
+ UnauthorizedError: The server answered 401.
403
+ LocationNotFoundError: The server answered 404.
404
+ ServiceUnavailableError: The server answered 503.
403
405
 
404
406
  ``GET /api/vcs/base``
405
407
  """
@@ -433,9 +435,9 @@ class AsyncVcsResource(AsyncAPIResource):
433
435
  List uncommitted working-copy changes relative to the requested location.
434
436
 
435
437
  Raises:
436
- InvalidRequestError
437
- UnauthorizedError
438
- LocationNotFoundError
438
+ InvalidRequestError: The server answered 400.
439
+ UnauthorizedError: The server answered 401.
440
+ LocationNotFoundError: The server answered 404.
439
441
 
440
442
  ``GET /api/vcs/status``
441
443
  """
@@ -472,10 +474,10 @@ class AsyncVcsResource(AsyncAPIResource):
472
474
  Diff HEAD to the working copy (working), the base merge-base to the working copy (branch), or the base merge-base to HEAD (committed). Omitting base preserves repository-default comparison; supplying it overrides the comparison without saving it.
473
475
 
474
476
  Raises:
475
- InvalidRequestError
476
- UnauthorizedError
477
- LocationNotFoundError
478
- ServiceUnavailableError
477
+ InvalidRequestError: The server answered 400.
478
+ UnauthorizedError: The server answered 401.
479
+ LocationNotFoundError: The server answered 404.
480
+ ServiceUnavailableError: The server answered 503.
479
481
 
480
482
  ``GET /api/vcs/diff``
481
483
  """
@@ -40,10 +40,10 @@ class VoiceResource(SyncAPIResource):
40
40
  This endpoint is experimental in OpenCode and may change without notice.
41
41
 
42
42
  Raises:
43
- InvalidRequestError
44
- UnauthorizedError
45
- LocationNotFoundError
46
- ServiceUnavailableError
43
+ InvalidRequestError: The server answered 400.
44
+ UnauthorizedError: The server answered 401.
45
+ LocationNotFoundError: The server answered 404.
46
+ ServiceUnavailableError: The server answered 503.
47
47
 
48
48
  ``POST /api/experimental/voice/session``
49
49
  """
@@ -86,10 +86,10 @@ class AsyncVoiceResource(AsyncAPIResource):
86
86
  This endpoint is experimental in OpenCode and may change without notice.
87
87
 
88
88
  Raises:
89
- InvalidRequestError
90
- UnauthorizedError
91
- LocationNotFoundError
92
- ServiceUnavailableError
89
+ InvalidRequestError: The server answered 400.
90
+ UnauthorizedError: The server answered 401.
91
+ LocationNotFoundError: The server answered 404.
92
+ ServiceUnavailableError: The server answered 503.
93
93
 
94
94
  ``POST /api/experimental/voice/session``
95
95
  """
@@ -37,10 +37,10 @@ class WebsearchResource(SyncAPIResource):
37
37
  Return the registered web search providers.
38
38
 
39
39
  Raises:
40
- InvalidRequestError
41
- UnauthorizedError
42
- LocationNotFoundError
43
- ServiceUnavailableError
40
+ InvalidRequestError: The server answered 400.
41
+ UnauthorizedError: The server answered 401.
42
+ LocationNotFoundError: The server answered 404.
43
+ ServiceUnavailableError: The server answered 503.
44
44
 
45
45
  ``GET /api/websearch/provider``
46
46
  """
@@ -76,10 +76,10 @@ class WebsearchResource(SyncAPIResource):
76
76
  Run one web search through the selected provider. Specify a provider to override the configured default.
77
77
 
78
78
  Raises:
79
- InvalidRequestError
80
- UnauthorizedError
81
- LocationNotFoundError
82
- ServiceUnavailableError
79
+ InvalidRequestError: The server answered 400.
80
+ UnauthorizedError: The server answered 401.
81
+ LocationNotFoundError: The server answered 404.
82
+ ServiceUnavailableError: The server answered 503.
83
83
 
84
84
  ``POST /api/websearch``
85
85
  """
@@ -118,10 +118,10 @@ class AsyncWebsearchResource(AsyncAPIResource):
118
118
  Return the registered web search providers.
119
119
 
120
120
  Raises:
121
- InvalidRequestError
122
- UnauthorizedError
123
- LocationNotFoundError
124
- ServiceUnavailableError
121
+ InvalidRequestError: The server answered 400.
122
+ UnauthorizedError: The server answered 401.
123
+ LocationNotFoundError: The server answered 404.
124
+ ServiceUnavailableError: The server answered 503.
125
125
 
126
126
  ``GET /api/websearch/provider``
127
127
  """
@@ -157,10 +157,10 @@ class AsyncWebsearchResource(AsyncAPIResource):
157
157
  Run one web search through the selected provider. Specify a provider to override the configured default.
158
158
 
159
159
  Raises:
160
- InvalidRequestError
161
- UnauthorizedError
162
- LocationNotFoundError
163
- ServiceUnavailableError
160
+ InvalidRequestError: The server answered 400.
161
+ UnauthorizedError: The server answered 401.
162
+ LocationNotFoundError: The server answered 404.
163
+ ServiceUnavailableError: The server answered 503.
164
164
 
165
165
  ``POST /api/websearch``
166
166
  """
@@ -37,9 +37,9 @@ class WorktreeResource(SyncAPIResource):
37
37
  Return the project's saved worktree inventory without loading configuration or running discovery.
38
38
 
39
39
  Raises:
40
- InvalidRequestError
41
- UnauthorizedError
42
- ProjectNotFoundError
40
+ InvalidRequestError: The server answered 400.
41
+ UnauthorizedError: The server answered 401.
42
+ ProjectNotFoundError: The server answered 404.
43
43
 
44
44
  ``GET /api/worktree``
45
45
  """
@@ -77,10 +77,10 @@ class WorktreeResource(SyncAPIResource):
77
77
  Load the project's canonical configuration, create a local worktree using its selected strategy, then run the project's setup script.
78
78
 
79
79
  Raises:
80
- WorktreeError
81
- InvalidRequestError
82
- UnauthorizedError
83
- ProjectNotFoundError
80
+ WorktreeError: The server answered 400.
81
+ InvalidRequestError: The server answered 400.
82
+ UnauthorizedError: The server answered 401.
83
+ ProjectNotFoundError: The server answered 404.
84
84
 
85
85
  ``POST /api/worktree``
86
86
  """
@@ -122,10 +122,10 @@ class WorktreeResource(SyncAPIResource):
122
122
  Load the project's canonical configuration and remove a saved worktree using its recorded strategy.
123
123
 
124
124
  Raises:
125
- WorktreeError
126
- InvalidRequestError
127
- UnauthorizedError
128
- ProjectNotFoundError
125
+ WorktreeError: The server answered 400.
126
+ InvalidRequestError: The server answered 400.
127
+ UnauthorizedError: The server answered 401.
128
+ ProjectNotFoundError: The server answered 404.
129
129
 
130
130
  ``DELETE /api/worktree``
131
131
  """
@@ -156,10 +156,10 @@ class WorktreeResource(SyncAPIResource):
156
156
  Load the project's canonical configuration, discover worktrees across known checkout roots using all available strategies, and reconcile saved state.
157
157
 
158
158
  Raises:
159
- WorktreeError
160
- InvalidRequestError
161
- UnauthorizedError
162
- ProjectNotFoundError
159
+ WorktreeError: The server answered 400.
160
+ InvalidRequestError: The server answered 400.
161
+ UnauthorizedError: The server answered 401.
162
+ ProjectNotFoundError: The server answered 404.
163
163
 
164
164
  ``POST /api/worktree/refresh``
165
165
  """
@@ -194,9 +194,9 @@ class AsyncWorktreeResource(AsyncAPIResource):
194
194
  Return the project's saved worktree inventory without loading configuration or running discovery.
195
195
 
196
196
  Raises:
197
- InvalidRequestError
198
- UnauthorizedError
199
- ProjectNotFoundError
197
+ InvalidRequestError: The server answered 400.
198
+ UnauthorizedError: The server answered 401.
199
+ ProjectNotFoundError: The server answered 404.
200
200
 
201
201
  ``GET /api/worktree``
202
202
  """
@@ -234,10 +234,10 @@ class AsyncWorktreeResource(AsyncAPIResource):
234
234
  Load the project's canonical configuration, create a local worktree using its selected strategy, then run the project's setup script.
235
235
 
236
236
  Raises:
237
- WorktreeError
238
- InvalidRequestError
239
- UnauthorizedError
240
- ProjectNotFoundError
237
+ WorktreeError: The server answered 400.
238
+ InvalidRequestError: The server answered 400.
239
+ UnauthorizedError: The server answered 401.
240
+ ProjectNotFoundError: The server answered 404.
241
241
 
242
242
  ``POST /api/worktree``
243
243
  """
@@ -279,10 +279,10 @@ class AsyncWorktreeResource(AsyncAPIResource):
279
279
  Load the project's canonical configuration and remove a saved worktree using its recorded strategy.
280
280
 
281
281
  Raises:
282
- WorktreeError
283
- InvalidRequestError
284
- UnauthorizedError
285
- ProjectNotFoundError
282
+ WorktreeError: The server answered 400.
283
+ InvalidRequestError: The server answered 400.
284
+ UnauthorizedError: The server answered 401.
285
+ ProjectNotFoundError: The server answered 404.
286
286
 
287
287
  ``DELETE /api/worktree``
288
288
  """
@@ -313,10 +313,10 @@ class AsyncWorktreeResource(AsyncAPIResource):
313
313
  Load the project's canonical configuration, discover worktrees across known checkout roots using all available strategies, and reconcile saved state.
314
314
 
315
315
  Raises:
316
- WorktreeError
317
- InvalidRequestError
318
- UnauthorizedError
319
- ProjectNotFoundError
316
+ WorktreeError: The server answered 400.
317
+ InvalidRequestError: The server answered 400.
318
+ UnauthorizedError: The server answered 401.
319
+ ProjectNotFoundError: The server answered 404.
320
320
 
321
321
  ``POST /api/worktree/refresh``
322
322
  """
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: opencode-python-sdk
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: Typed Python client for the OpenCode 2.x server API
5
5
  Project-URL: Homepage, https://github.com/shrijayan/opencode-python-sdk
6
- Project-URL: Documentation, https://github.com/shrijayan/opencode-python-sdk#readme
6
+ Project-URL: Documentation, https://shrijayan.github.io/opencode-python-sdk/
7
7
  Project-URL: Repository, https://github.com/shrijayan/opencode-python-sdk
8
8
  Project-URL: Issues, https://github.com/shrijayan/opencode-python-sdk/issues
9
9
  Project-URL: Changelog, https://github.com/shrijayan/opencode-python-sdk/blob/main/CHANGELOG.md
@@ -31,16 +31,21 @@ Requires-Dist: anyio<5,>=4.4
31
31
  Requires-Dist: httpx<1,>=0.27
32
32
  Requires-Dist: pydantic<3,>=2.12
33
33
  Requires-Dist: typing-extensions>=4.12
34
+ Provides-Extra: pty
35
+ Requires-Dist: websockets<17,>=14; extra == 'pty'
34
36
  Description-Content-Type: text/markdown
35
37
 
36
38
  # opencode-python-sdk
37
39
 
38
40
  [![CI](https://github.com/shrijayan/opencode-python-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/shrijayan/opencode-python-sdk/actions/workflows/ci.yml)
39
41
  [![PyPI](https://img.shields.io/pypi/v/opencode-python-sdk.svg)](https://pypi.org/project/opencode-python-sdk/)
42
+ [![Docs](https://img.shields.io/badge/docs-shrijayan.github.io-d9730d)](https://shrijayan.github.io/opencode-python-sdk/)
40
43
  [![Python](https://img.shields.io/pypi/pyversions/opencode-python-sdk.svg)](https://pypi.org/project/opencode-python-sdk/)
41
44
 
42
45
  Typed Python client for the [OpenCode](https://github.com/anomalyco/opencode) 2.x server API.
43
46
 
47
+ **Documentation: <https://shrijayan.github.io/opencode-python-sdk/>**
48
+
44
49
  > **Unofficial, community-maintained.** This package is not affiliated with or endorsed by the OpenCode team.
45
50
  > If the OpenCode maintainers want to take it over, we are happy to transfer this repository and the `opencode-python-sdk`
46
51
  > name on PyPI. Open an issue and we will hand it over.
@@ -201,6 +206,27 @@ Events are typed (`SessionCreatedEvent`, `SessionTextDeltaEvent`, and so on). Ev
201
206
  not know arrive as `UnknownEvent` with all their fields kept. Streams apply only the connect timeout by default, since
202
207
  they stay open between events.
203
208
 
209
+ ## Terminals
210
+
211
+ `client.pty.attach()` opens an interactive connection to a PTY over a WebSocket. It needs the `pty` extra:
212
+ `pip install "opencode-python-sdk[pty]"`.
213
+
214
+ ```python
215
+ pty = client.pty.create(command="/bin/sh").data
216
+ with client.pty.attach(pty.id) as term:
217
+ term.resize(120, 40)
218
+ term.send("echo hi\n")
219
+ for chunk in term: # output bytes, until the shell exits
220
+ print(chunk.decode(errors="replace"), end="")
221
+ ```
222
+
223
+ `recv(timeout=...)` reads one chunk and returns `None` once the terminal has ended. `term.cursor` holds the output
224
+ position to pass as `cursor=` when reattaching; `cursor=-1` skips the replay of earlier output. Persistent terminals
225
+ work the same way through `client.experimental.persistent_pty.attach(pty_id, role=..., takeover=...)`. The async
226
+ client returns `AsyncPtyConnection` (asyncio only): `async with await client.pty.attach(...) as term`. A connection
227
+ the server refuses or closes abnormally raises `PtyConnectionError`. See
228
+ [`examples/terminal.py`](examples/terminal.py) for a full TTY bridge.
229
+
204
230
  ## Errors
205
231
 
206
232
  Every error derives from `opencode.OpencodeError`. Errors the server declares are raised as their own class, with a