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.
Files changed (62) hide show
  1. opencode/.generated.json +39 -0
  2. opencode/__init__.py +221 -0
  3. opencode/_base_client.py +539 -0
  4. opencode/_client.py +255 -0
  5. opencode/_constants.py +27 -0
  6. opencode/_errors.py +547 -0
  7. opencode/_events.py +732 -0
  8. opencode/_exceptions.py +271 -0
  9. opencode/_models.py +54 -0
  10. opencode/_pagination.py +192 -0
  11. opencode/_pty.py +586 -0
  12. opencode/_qs.py +95 -0
  13. opencode/_resource.py +42 -0
  14. opencode/_rpc.py +489 -0
  15. opencode/_server.py +335 -0
  16. opencode/_streaming.py +248 -0
  17. opencode/_types.py +77 -0
  18. opencode/_unions.py +46 -0
  19. opencode/_version.py +8 -0
  20. opencode/lib/__init__.py +5 -0
  21. opencode/lib/_ready.py +91 -0
  22. opencode/lib/_session.py +231 -0
  23. opencode/py.typed +0 -0
  24. opencode/resources/__init__.py +364 -0
  25. opencode/resources/agent.py +179 -0
  26. opencode/resources/command.py +100 -0
  27. opencode/resources/config.py +240 -0
  28. opencode/resources/credential.py +384 -0
  29. opencode/resources/debug.py +178 -0
  30. opencode/resources/event.py +88 -0
  31. opencode/resources/experimental.py +765 -0
  32. opencode/resources/file.py +355 -0
  33. opencode/resources/form.py +100 -0
  34. opencode/resources/generate.py +110 -0
  35. opencode/resources/integration.py +1033 -0
  36. opencode/resources/location.py +162 -0
  37. opencode/resources/mcp.py +492 -0
  38. opencode/resources/message.py +152 -0
  39. opencode/resources/migration.py +118 -0
  40. opencode/resources/model.py +177 -0
  41. opencode/resources/permission.py +704 -0
  42. opencode/resources/plugin.py +250 -0
  43. opencode/resources/project.py +187 -0
  44. opencode/resources/provider.py +183 -0
  45. opencode/resources/pty.py +522 -0
  46. opencode/resources/reference.py +100 -0
  47. opencode/resources/rpc.py +113 -0
  48. opencode/resources/server.py +230 -0
  49. opencode/resources/session.py +3567 -0
  50. opencode/resources/shell.py +412 -0
  51. opencode/resources/skill.py +100 -0
  52. opencode/resources/vcs.py +500 -0
  53. opencode/resources/voice.py +113 -0
  54. opencode/resources/websearch.py +184 -0
  55. opencode/resources/worktree.py +336 -0
  56. opencode/testing.py +508 -0
  57. opencode/types/__init__.py +1462 -0
  58. opencode/types/_generated.py +8540 -0
  59. opencode_python_sdk-0.0.1.dev1.dist-info/METADATA +468 -0
  60. opencode_python_sdk-0.0.1.dev1.dist-info/RECORD +62 -0
  61. opencode_python_sdk-0.0.1.dev1.dist-info/WHEEL +4 -0
  62. opencode_python_sdk-0.0.1.dev1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,178 @@
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 ``debug`` resource."""
5
+
6
+ from __future__ import annotations
7
+
8
+ import builtins
9
+ from functools import cached_property
10
+ from typing import TYPE_CHECKING, cast
11
+
12
+ from .._base_client import RequestOptions
13
+ from .._resource import AsyncAPIResource, SyncAPIResource
14
+ from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
15
+
16
+ if TYPE_CHECKING:
17
+ from ..types import (
18
+ Location,
19
+ LocationPublicRef,
20
+ )
21
+
22
+ __all__ = ["DebugResource", "AsyncDebugResource"]
23
+
24
+
25
+ class DebugLocationResource(SyncAPIResource):
26
+ """Operations under ``client.debug.location`` (OpenCode ``debug.location``)."""
27
+
28
+ def list(
29
+ self,
30
+ *,
31
+ extra_headers: Headers | None = None,
32
+ extra_query: Query | None = None,
33
+ extra_body: Body | None = None,
34
+ timeout: Timeout | NotGiven = NOT_GIVEN,
35
+ ) -> builtins.list[LocationPublicRef]:
36
+ """List loaded locations.
37
+
38
+ List locations currently loaded by the server.
39
+
40
+ Raises:
41
+ InvalidRequestError: The server answered 400.
42
+ UnauthorizedError: The server answered 401.
43
+
44
+ ``GET /api/debug/location``
45
+ """
46
+ return cast(
47
+ "builtins.list[LocationPublicRef]",
48
+ self._client.request(
49
+ RequestOptions(
50
+ method="GET",
51
+ path="/api/debug/location",
52
+ extra_headers=extra_headers,
53
+ extra_query=extra_query,
54
+ extra_body=extra_body,
55
+ timeout=timeout,
56
+ ),
57
+ response_type="builtins.list[LocationPublicRef]",
58
+ ),
59
+ )
60
+
61
+ def evict(
62
+ self,
63
+ *,
64
+ location: Location | NotGiven | None = NOT_GIVEN,
65
+ extra_headers: Headers | None = None,
66
+ extra_query: Query | None = None,
67
+ extra_body: Body | None = None,
68
+ timeout: Timeout | NotGiven = NOT_GIVEN,
69
+ ) -> None:
70
+ """Evict a loaded location.
71
+
72
+ Dispose the requested location's cached services so its next use boots them fresh.
73
+
74
+ Raises:
75
+ InvalidRequestError: The server answered 400.
76
+ UnauthorizedError: The server answered 401.
77
+
78
+ ``DELETE /api/debug/location``
79
+ """
80
+ self._client.request(
81
+ RequestOptions(
82
+ method="DELETE",
83
+ path="/api/debug/location",
84
+ query={"location": self._location(location)},
85
+ extra_headers=extra_headers,
86
+ extra_query=extra_query,
87
+ extra_body=extra_body,
88
+ timeout=timeout,
89
+ ),
90
+ kind="void",
91
+ )
92
+
93
+
94
+ class DebugResource(SyncAPIResource):
95
+ """Operations under ``client.debug`` (OpenCode ``debug``)."""
96
+
97
+ @cached_property
98
+ def location(self) -> DebugLocationResource:
99
+ """Operations under ``client.debug.location``."""
100
+ return DebugLocationResource(self._client)
101
+
102
+
103
+ class AsyncDebugLocationResource(AsyncAPIResource):
104
+ """Operations under ``client.debug.location`` (OpenCode ``debug.location``)."""
105
+
106
+ async def list(
107
+ self,
108
+ *,
109
+ extra_headers: Headers | None = None,
110
+ extra_query: Query | None = None,
111
+ extra_body: Body | None = None,
112
+ timeout: Timeout | NotGiven = NOT_GIVEN,
113
+ ) -> builtins.list[LocationPublicRef]:
114
+ """List loaded locations.
115
+
116
+ List locations currently loaded by the server.
117
+
118
+ Raises:
119
+ InvalidRequestError: The server answered 400.
120
+ UnauthorizedError: The server answered 401.
121
+
122
+ ``GET /api/debug/location``
123
+ """
124
+ return cast(
125
+ "builtins.list[LocationPublicRef]",
126
+ await self._client.request(
127
+ RequestOptions(
128
+ method="GET",
129
+ path="/api/debug/location",
130
+ extra_headers=extra_headers,
131
+ extra_query=extra_query,
132
+ extra_body=extra_body,
133
+ timeout=timeout,
134
+ ),
135
+ response_type="builtins.list[LocationPublicRef]",
136
+ ),
137
+ )
138
+
139
+ async def evict(
140
+ self,
141
+ *,
142
+ location: Location | NotGiven | None = NOT_GIVEN,
143
+ extra_headers: Headers | None = None,
144
+ extra_query: Query | None = None,
145
+ extra_body: Body | None = None,
146
+ timeout: Timeout | NotGiven = NOT_GIVEN,
147
+ ) -> None:
148
+ """Evict a loaded location.
149
+
150
+ Dispose the requested location's cached services so its next use boots them fresh.
151
+
152
+ Raises:
153
+ InvalidRequestError: The server answered 400.
154
+ UnauthorizedError: The server answered 401.
155
+
156
+ ``DELETE /api/debug/location``
157
+ """
158
+ await self._client.request(
159
+ RequestOptions(
160
+ method="DELETE",
161
+ path="/api/debug/location",
162
+ query={"location": self._location(location)},
163
+ extra_headers=extra_headers,
164
+ extra_query=extra_query,
165
+ extra_body=extra_body,
166
+ timeout=timeout,
167
+ ),
168
+ kind="void",
169
+ )
170
+
171
+
172
+ class AsyncDebugResource(AsyncAPIResource):
173
+ """Operations under ``client.debug`` (OpenCode ``debug``)."""
174
+
175
+ @cached_property
176
+ def location(self) -> AsyncDebugLocationResource:
177
+ """Operations under ``client.debug.location``."""
178
+ return AsyncDebugLocationResource(self._client)
@@ -0,0 +1,88 @@
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 ``event`` resource."""
5
+
6
+ from __future__ import annotations
7
+
8
+ from typing import TYPE_CHECKING
9
+
10
+ from .._base_client import RequestOptions
11
+ from .._resource import AsyncAPIResource, SyncAPIResource
12
+ from .._streaming import AsyncStream, Stream
13
+ from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
14
+
15
+ if TYPE_CHECKING:
16
+ from ..types import (
17
+ Event,
18
+ )
19
+
20
+ __all__ = ["EventResource", "AsyncEventResource"]
21
+
22
+
23
+ class EventResource(SyncAPIResource):
24
+ """Operations under ``client.event`` (OpenCode ``event``)."""
25
+
26
+ def subscribe(
27
+ self,
28
+ *,
29
+ extra_headers: Headers | None = None,
30
+ extra_query: Query | None = None,
31
+ extra_body: Body | None = None,
32
+ timeout: Timeout | NotGiven = NOT_GIVEN,
33
+ ) -> Stream[Event]:
34
+ """Subscribe to events.
35
+
36
+ Subscribe to native events and plugin RPC events across all server locations. Volatile by contract: a slow consumer overflows and fails the stream, and events during disconnection are missed.
37
+
38
+ Raises:
39
+ InvalidRequestError: The server answered 400.
40
+ UnauthorizedError: The server answered 401.
41
+
42
+ ``GET /api/event``
43
+ """
44
+ return self._client.stream(
45
+ RequestOptions(
46
+ method="GET",
47
+ path="/api/event",
48
+ extra_headers=extra_headers,
49
+ extra_query=extra_query,
50
+ extra_body=extra_body,
51
+ timeout=timeout,
52
+ ),
53
+ item_type="Event",
54
+ )
55
+
56
+
57
+ class AsyncEventResource(AsyncAPIResource):
58
+ """Operations under ``client.event`` (OpenCode ``event``)."""
59
+
60
+ async def subscribe(
61
+ self,
62
+ *,
63
+ extra_headers: Headers | None = None,
64
+ extra_query: Query | None = None,
65
+ extra_body: Body | None = None,
66
+ timeout: Timeout | NotGiven = NOT_GIVEN,
67
+ ) -> AsyncStream[Event]:
68
+ """Subscribe to events.
69
+
70
+ Subscribe to native events and plugin RPC events across all server locations. Volatile by contract: a slow consumer overflows and fails the stream, and events during disconnection are missed.
71
+
72
+ Raises:
73
+ InvalidRequestError: The server answered 400.
74
+ UnauthorizedError: The server answered 401.
75
+
76
+ ``GET /api/event``
77
+ """
78
+ return await self._client.stream(
79
+ RequestOptions(
80
+ method="GET",
81
+ path="/api/event",
82
+ extra_headers=extra_headers,
83
+ extra_query=extra_query,
84
+ extra_body=extra_body,
85
+ timeout=timeout,
86
+ ),
87
+ item_type="Event",
88
+ )