opencode-python-sdk 0.1.3__py3-none-any.whl → 0.2.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 (47) hide show
  1. opencode/__init__.py +19 -1
  2. opencode/_base_client.py +24 -3
  3. opencode/_client.py +173 -2
  4. opencode/_events.py +5 -2
  5. opencode/_rpc.py +9 -2
  6. opencode/_service.py +1018 -0
  7. opencode/lib/__init__.py +5 -0
  8. opencode/lib/_ready.py +91 -0
  9. opencode/lib/_session.py +231 -0
  10. opencode/resources/agent.py +13 -11
  11. opencode/resources/command.py +9 -7
  12. opencode/resources/config.py +12 -10
  13. opencode/resources/credential.py +13 -11
  14. opencode/resources/debug.py +9 -7
  15. opencode/resources/event.py +9 -5
  16. opencode/resources/experimental.py +31 -29
  17. opencode/resources/file.py +15 -13
  18. opencode/resources/form.py +9 -7
  19. opencode/resources/generate.py +9 -7
  20. opencode/resources/integration.py +28 -26
  21. opencode/resources/location.py +9 -7
  22. opencode/resources/mcp.py +13 -11
  23. opencode/resources/message.py +9 -8
  24. opencode/resources/migration.py +10 -12
  25. opencode/resources/model.py +12 -10
  26. opencode/resources/permission.py +29 -27
  27. opencode/resources/plugin.py +12 -10
  28. opencode/resources/project.py +14 -12
  29. opencode/resources/provider.py +13 -11
  30. opencode/resources/pty.py +23 -21
  31. opencode/resources/reference.py +9 -7
  32. opencode/resources/rpc.py +9 -7
  33. opencode/resources/server.py +14 -12
  34. opencode/resources/session.py +92 -90
  35. opencode/resources/shell.py +19 -17
  36. opencode/resources/skill.py +9 -7
  37. opencode/resources/vcs.py +22 -20
  38. opencode/resources/voice.py +9 -7
  39. opencode/resources/websearch.py +13 -11
  40. opencode/resources/worktree.py +13 -11
  41. opencode/service.py +50 -0
  42. opencode/testing.py +508 -0
  43. {opencode_python_sdk-0.1.3.dist-info → opencode_python_sdk-0.2.2.dist-info}/METADATA +71 -1
  44. opencode_python_sdk-0.2.2.dist-info/RECORD +64 -0
  45. opencode_python_sdk-0.1.3.dist-info/RECORD +0 -58
  46. {opencode_python_sdk-0.1.3.dist-info → opencode_python_sdk-0.2.2.dist-info}/WHEEL +0 -0
  47. {opencode_python_sdk-0.1.3.dist-info → opencode_python_sdk-0.2.2.dist-info}/licenses/LICENSE +0 -0
@@ -8,25 +8,27 @@ from __future__ import annotations
8
8
  import builtins
9
9
  from collections.abc import Mapping, Sequence
10
10
  from functools import cached_property
11
- from typing import cast
11
+ from typing import TYPE_CHECKING, cast
12
12
 
13
13
  from .._base_client import RequestOptions
14
14
  from .._pty import AsyncPersistentPtyAttachMixin, PersistentPtyAttachMixin
15
15
  from .._qs import encode_path_segment
16
16
  from .._resource import AsyncAPIResource, SyncAPIResource
17
17
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
18
- from ..types import (
19
- ExperimentalPersistentPtyCreateSize,
20
- ExperimentalPersistentPtyHandoffResponse,
21
- ExperimentalPersistentPtyUpdateSize,
22
- PersistentPtyInfo,
23
- PersistentPtyReadLines,
24
- PersistentPtyReadResult,
25
- PersistentPtySnapshot,
26
- PtyID,
27
- PtyTicketConnectToken,
28
- SessionID,
29
- )
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
+ )
30
32
 
31
33
  __all__ = ["ExperimentalResource", "AsyncExperimentalResource"]
32
34
 
@@ -69,7 +71,7 @@ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
69
71
  extra_body=extra_body,
70
72
  timeout=timeout,
71
73
  ),
72
- response_type=PersistentPtyReadResult | None,
74
+ response_type="PersistentPtyReadResult | None",
73
75
  unwrap=True,
74
76
  ),
75
77
  )
@@ -103,7 +105,7 @@ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
103
105
  extra_body=extra_body,
104
106
  timeout=timeout,
105
107
  ),
106
- response_type=builtins.list[PersistentPtyInfo],
108
+ response_type="builtins.list[PersistentPtyInfo]",
107
109
  unwrap=True,
108
110
  ),
109
111
  )
@@ -144,7 +146,7 @@ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
144
146
  extra_body=extra_body,
145
147
  timeout=timeout,
146
148
  ),
147
- response_type=PersistentPtyInfo,
149
+ response_type="PersistentPtyInfo",
148
150
  unwrap=True,
149
151
  ),
150
152
  )
@@ -206,7 +208,7 @@ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
206
208
  extra_body=extra_body,
207
209
  timeout=timeout,
208
210
  ),
209
- response_type=ExperimentalPersistentPtyHandoffResponse,
211
+ response_type="ExperimentalPersistentPtyHandoffResponse",
210
212
  ),
211
213
  )
212
214
 
@@ -240,7 +242,7 @@ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
240
242
  extra_body=extra_body,
241
243
  timeout=timeout,
242
244
  ),
243
- response_type=PersistentPtyInfo,
245
+ response_type="PersistentPtyInfo",
244
246
  unwrap=True,
245
247
  ),
246
248
  )
@@ -278,7 +280,7 @@ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
278
280
  extra_body=extra_body,
279
281
  timeout=timeout,
280
282
  ),
281
- response_type=PersistentPtyInfo,
283
+ response_type="PersistentPtyInfo",
282
284
  unwrap=True,
283
285
  ),
284
286
  )
@@ -313,7 +315,7 @@ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
313
315
  extra_body=extra_body,
314
316
  timeout=timeout,
315
317
  ),
316
- response_type=PersistentPtySnapshot,
318
+ response_type="PersistentPtySnapshot",
317
319
  unwrap=True,
318
320
  ),
319
321
  )
@@ -382,7 +384,7 @@ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
382
384
  extra_body=extra_body,
383
385
  timeout=timeout,
384
386
  ),
385
- response_type=PtyTicketConnectToken,
387
+ response_type="PtyTicketConnectToken",
386
388
  unwrap=True,
387
389
  ),
388
390
  )
@@ -435,7 +437,7 @@ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
435
437
  extra_body=extra_body,
436
438
  timeout=timeout,
437
439
  ),
438
- response_type=PersistentPtyReadResult | None,
440
+ response_type="PersistentPtyReadResult | None",
439
441
  unwrap=True,
440
442
  ),
441
443
  )
@@ -469,7 +471,7 @@ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
469
471
  extra_body=extra_body,
470
472
  timeout=timeout,
471
473
  ),
472
- response_type=builtins.list[PersistentPtyInfo],
474
+ response_type="builtins.list[PersistentPtyInfo]",
473
475
  unwrap=True,
474
476
  ),
475
477
  )
@@ -510,7 +512,7 @@ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
510
512
  extra_body=extra_body,
511
513
  timeout=timeout,
512
514
  ),
513
- response_type=PersistentPtyInfo,
515
+ response_type="PersistentPtyInfo",
514
516
  unwrap=True,
515
517
  ),
516
518
  )
@@ -572,7 +574,7 @@ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
572
574
  extra_body=extra_body,
573
575
  timeout=timeout,
574
576
  ),
575
- response_type=ExperimentalPersistentPtyHandoffResponse,
577
+ response_type="ExperimentalPersistentPtyHandoffResponse",
576
578
  ),
577
579
  )
578
580
 
@@ -606,7 +608,7 @@ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
606
608
  extra_body=extra_body,
607
609
  timeout=timeout,
608
610
  ),
609
- response_type=PersistentPtyInfo,
611
+ response_type="PersistentPtyInfo",
610
612
  unwrap=True,
611
613
  ),
612
614
  )
@@ -644,7 +646,7 @@ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
644
646
  extra_body=extra_body,
645
647
  timeout=timeout,
646
648
  ),
647
- response_type=PersistentPtyInfo,
649
+ response_type="PersistentPtyInfo",
648
650
  unwrap=True,
649
651
  ),
650
652
  )
@@ -679,7 +681,7 @@ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
679
681
  extra_body=extra_body,
680
682
  timeout=timeout,
681
683
  ),
682
- response_type=PersistentPtySnapshot,
684
+ response_type="PersistentPtySnapshot",
683
685
  unwrap=True,
684
686
  ),
685
687
  )
@@ -748,7 +750,7 @@ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
748
750
  extra_body=extra_body,
749
751
  timeout=timeout,
750
752
  ),
751
- response_type=PtyTicketConnectToken,
753
+ response_type="PtyTicketConnectToken",
752
754
  unwrap=True,
753
755
  ),
754
756
  )
@@ -5,18 +5,20 @@
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- from typing import Literal, cast
8
+ from typing import TYPE_CHECKING, Literal, cast
9
9
 
10
10
  from .._base_client import RequestOptions
11
11
  from .._qs import encode_path
12
12
  from .._resource import AsyncAPIResource, SyncAPIResource
13
13
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, OpenEnum, Query, Timeout
14
- from ..types import (
15
- FileFindResponse,
16
- FileListResponse,
17
- FileWriteResponse,
18
- Location,
19
- )
14
+
15
+ if TYPE_CHECKING:
16
+ from ..types import (
17
+ FileFindResponse,
18
+ FileListResponse,
19
+ FileWriteResponse,
20
+ Location,
21
+ )
20
22
 
21
23
  __all__ = ["FileResource", "AsyncFileResource"]
22
24
 
@@ -99,7 +101,7 @@ class FileResource(SyncAPIResource):
99
101
  extra_body=extra_body,
100
102
  timeout=timeout,
101
103
  ),
102
- response_type=FileListResponse,
104
+ response_type="FileListResponse",
103
105
  ),
104
106
  )
105
107
 
@@ -138,7 +140,7 @@ class FileResource(SyncAPIResource):
138
140
  extra_body=extra_body,
139
141
  timeout=timeout,
140
142
  ),
141
- response_type=FileFindResponse,
143
+ response_type="FileFindResponse",
142
144
  ),
143
145
  )
144
146
 
@@ -182,7 +184,7 @@ class FileResource(SyncAPIResource):
182
184
  extra_body=extra_body,
183
185
  timeout=timeout,
184
186
  ),
185
- response_type=FileWriteResponse,
187
+ response_type="FileWriteResponse",
186
188
  ),
187
189
  )
188
190
 
@@ -265,7 +267,7 @@ class AsyncFileResource(AsyncAPIResource):
265
267
  extra_body=extra_body,
266
268
  timeout=timeout,
267
269
  ),
268
- response_type=FileListResponse,
270
+ response_type="FileListResponse",
269
271
  ),
270
272
  )
271
273
 
@@ -304,7 +306,7 @@ class AsyncFileResource(AsyncAPIResource):
304
306
  extra_body=extra_body,
305
307
  timeout=timeout,
306
308
  ),
307
- response_type=FileFindResponse,
309
+ response_type="FileFindResponse",
308
310
  ),
309
311
  )
310
312
 
@@ -348,6 +350,6 @@ class AsyncFileResource(AsyncAPIResource):
348
350
  extra_body=extra_body,
349
351
  timeout=timeout,
350
352
  ),
351
- response_type=FileWriteResponse,
353
+ response_type="FileWriteResponse",
352
354
  ),
353
355
  )
@@ -5,15 +5,17 @@
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- from typing import cast
8
+ from typing import TYPE_CHECKING, cast
9
9
 
10
10
  from .._base_client import RequestOptions
11
11
  from .._resource import AsyncAPIResource, SyncAPIResource
12
12
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
13
- from ..types import (
14
- FormListResponse,
15
- Location,
16
- )
13
+
14
+ if TYPE_CHECKING:
15
+ from ..types import (
16
+ FormListResponse,
17
+ Location,
18
+ )
17
19
 
18
20
  __all__ = ["FormResource", "AsyncFormResource"]
19
21
 
@@ -53,7 +55,7 @@ class FormResource(SyncAPIResource):
53
55
  extra_body=extra_body,
54
56
  timeout=timeout,
55
57
  ),
56
- response_type=FormListResponse,
58
+ response_type="FormListResponse",
57
59
  ),
58
60
  )
59
61
 
@@ -93,6 +95,6 @@ class AsyncFormResource(AsyncAPIResource):
93
95
  extra_body=extra_body,
94
96
  timeout=timeout,
95
97
  ),
96
- response_type=FormListResponse,
98
+ response_type="FormListResponse",
97
99
  ),
98
100
  )
@@ -5,15 +5,17 @@
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- from typing import cast
8
+ from typing import TYPE_CHECKING, cast
9
9
 
10
10
  from .._base_client import RequestOptions
11
11
  from .._resource import AsyncAPIResource, SyncAPIResource
12
12
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
13
- from ..types import (
14
- GenerateTextResponseData,
15
- ModelRef,
16
- )
13
+
14
+ if TYPE_CHECKING:
15
+ from ..types import (
16
+ GenerateTextResponseData,
17
+ ModelRef,
18
+ )
17
19
 
18
20
  __all__ = ["GenerateResource", "AsyncGenerateResource"]
19
21
 
@@ -57,7 +59,7 @@ class GenerateResource(SyncAPIResource):
57
59
  extra_body=extra_body,
58
60
  timeout=timeout,
59
61
  ),
60
- response_type=GenerateTextResponseData,
62
+ response_type="GenerateTextResponseData",
61
63
  unwrap=True,
62
64
  ),
63
65
  )
@@ -102,7 +104,7 @@ class AsyncGenerateResource(AsyncAPIResource):
102
104
  extra_body=extra_body,
103
105
  timeout=timeout,
104
106
  ),
105
- response_type=GenerateTextResponseData,
107
+ response_type="GenerateTextResponseData",
106
108
  unwrap=True,
107
109
  ),
108
110
  )
@@ -6,25 +6,27 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  from functools import cached_property
9
- from typing import cast
9
+ from typing import TYPE_CHECKING, cast
10
10
 
11
11
  from .._base_client import RequestOptions
12
12
  from .._qs import encode_path_segment
13
13
  from .._resource import AsyncAPIResource, SyncAPIResource
14
14
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
15
- from ..types import (
16
- FormAnswer,
17
- IntegrationAttemptID,
18
- IntegrationCommandConnectResponse,
19
- IntegrationCommandStatusResponse,
20
- IntegrationGetResponse,
21
- IntegrationID,
22
- IntegrationListResponse,
23
- IntegrationMethodID,
24
- IntegrationOauthConnectResponse,
25
- IntegrationOauthStatusResponse,
26
- Location,
27
- )
15
+
16
+ if TYPE_CHECKING:
17
+ from ..types import (
18
+ FormAnswer,
19
+ IntegrationAttemptID,
20
+ IntegrationCommandConnectResponse,
21
+ IntegrationCommandStatusResponse,
22
+ IntegrationGetResponse,
23
+ IntegrationID,
24
+ IntegrationListResponse,
25
+ IntegrationMethodID,
26
+ IntegrationOauthConnectResponse,
27
+ IntegrationOauthStatusResponse,
28
+ Location,
29
+ )
28
30
 
29
31
  __all__ = ["IntegrationResource", "AsyncIntegrationResource"]
30
32
 
@@ -192,7 +194,7 @@ class IntegrationOauthResource(SyncAPIResource):
192
194
  extra_body=extra_body,
193
195
  timeout=timeout,
194
196
  ),
195
- response_type=IntegrationOauthConnectResponse,
197
+ response_type="IntegrationOauthConnectResponse",
196
198
  ),
197
199
  )
198
200
 
@@ -232,7 +234,7 @@ class IntegrationOauthResource(SyncAPIResource):
232
234
  extra_body=extra_body,
233
235
  timeout=timeout,
234
236
  ),
235
- response_type=IntegrationOauthStatusResponse,
237
+ response_type="IntegrationOauthStatusResponse",
236
238
  ),
237
239
  )
238
240
 
@@ -352,7 +354,7 @@ class IntegrationCommandResource(SyncAPIResource):
352
354
  extra_body=extra_body,
353
355
  timeout=timeout,
354
356
  ),
355
- response_type=IntegrationCommandConnectResponse,
357
+ response_type="IntegrationCommandConnectResponse",
356
358
  ),
357
359
  )
358
360
 
@@ -392,7 +394,7 @@ class IntegrationCommandResource(SyncAPIResource):
392
394
  extra_body=extra_body,
393
395
  timeout=timeout,
394
396
  ),
395
- response_type=IntegrationCommandStatusResponse,
397
+ response_type="IntegrationCommandStatusResponse",
396
398
  ),
397
399
  )
398
400
 
@@ -487,7 +489,7 @@ class IntegrationResource(SyncAPIResource):
487
489
  extra_body=extra_body,
488
490
  timeout=timeout,
489
491
  ),
490
- response_type=IntegrationListResponse,
492
+ response_type="IntegrationListResponse",
491
493
  ),
492
494
  )
493
495
 
@@ -525,7 +527,7 @@ class IntegrationResource(SyncAPIResource):
525
527
  extra_body=extra_body,
526
528
  timeout=timeout,
527
529
  ),
528
- response_type=IntegrationGetResponse,
530
+ response_type="IntegrationGetResponse",
529
531
  ),
530
532
  )
531
533
 
@@ -693,7 +695,7 @@ class AsyncIntegrationOauthResource(AsyncAPIResource):
693
695
  extra_body=extra_body,
694
696
  timeout=timeout,
695
697
  ),
696
- response_type=IntegrationOauthConnectResponse,
698
+ response_type="IntegrationOauthConnectResponse",
697
699
  ),
698
700
  )
699
701
 
@@ -733,7 +735,7 @@ class AsyncIntegrationOauthResource(AsyncAPIResource):
733
735
  extra_body=extra_body,
734
736
  timeout=timeout,
735
737
  ),
736
- response_type=IntegrationOauthStatusResponse,
738
+ response_type="IntegrationOauthStatusResponse",
737
739
  ),
738
740
  )
739
741
 
@@ -853,7 +855,7 @@ class AsyncIntegrationCommandResource(AsyncAPIResource):
853
855
  extra_body=extra_body,
854
856
  timeout=timeout,
855
857
  ),
856
- response_type=IntegrationCommandConnectResponse,
858
+ response_type="IntegrationCommandConnectResponse",
857
859
  ),
858
860
  )
859
861
 
@@ -893,7 +895,7 @@ class AsyncIntegrationCommandResource(AsyncAPIResource):
893
895
  extra_body=extra_body,
894
896
  timeout=timeout,
895
897
  ),
896
- response_type=IntegrationCommandStatusResponse,
898
+ response_type="IntegrationCommandStatusResponse",
897
899
  ),
898
900
  )
899
901
 
@@ -988,7 +990,7 @@ class AsyncIntegrationResource(AsyncAPIResource):
988
990
  extra_body=extra_body,
989
991
  timeout=timeout,
990
992
  ),
991
- response_type=IntegrationListResponse,
993
+ response_type="IntegrationListResponse",
992
994
  ),
993
995
  )
994
996
 
@@ -1026,6 +1028,6 @@ class AsyncIntegrationResource(AsyncAPIResource):
1026
1028
  extra_body=extra_body,
1027
1029
  timeout=timeout,
1028
1030
  ),
1029
- response_type=IntegrationGetResponse,
1031
+ response_type="IntegrationGetResponse",
1030
1032
  ),
1031
1033
  )
@@ -5,15 +5,17 @@
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- from typing import cast
8
+ from typing import TYPE_CHECKING, cast
9
9
 
10
10
  from .._base_client import RequestOptions
11
11
  from .._resource import AsyncAPIResource, SyncAPIResource
12
12
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
13
- from ..types import (
14
- Location,
15
- LocationPublicInfo,
16
- )
13
+
14
+ if TYPE_CHECKING:
15
+ from ..types import (
16
+ Location,
17
+ LocationPublicInfo,
18
+ )
17
19
 
18
20
  __all__ = ["LocationResource", "AsyncLocationResource"]
19
21
 
@@ -53,7 +55,7 @@ class LocationResource(SyncAPIResource):
53
55
  extra_body=extra_body,
54
56
  timeout=timeout,
55
57
  ),
56
- response_type=LocationPublicInfo,
58
+ response_type="LocationPublicInfo",
57
59
  ),
58
60
  )
59
61
 
@@ -124,7 +126,7 @@ class AsyncLocationResource(AsyncAPIResource):
124
126
  extra_body=extra_body,
125
127
  timeout=timeout,
126
128
  ),
127
- response_type=LocationPublicInfo,
129
+ response_type="LocationPublicInfo",
128
130
  ),
129
131
  )
130
132
 
opencode/resources/mcp.py CHANGED
@@ -6,18 +6,20 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  from functools import cached_property
9
- from typing import cast
9
+ from typing import TYPE_CHECKING, cast
10
10
 
11
11
  from .._base_client import RequestOptions
12
12
  from .._qs import encode_path_segment
13
13
  from .._resource import AsyncAPIResource, SyncAPIResource
14
14
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
15
- from ..types import (
16
- Location,
17
- McpAddConfig,
18
- McpListResponse,
19
- McpResourceCatalogResponse,
20
- )
15
+
16
+ if TYPE_CHECKING:
17
+ from ..types import (
18
+ Location,
19
+ McpAddConfig,
20
+ McpListResponse,
21
+ McpResourceCatalogResponse,
22
+ )
21
23
 
22
24
  __all__ = ["McpResource", "AsyncMcpResource"]
23
25
 
@@ -57,7 +59,7 @@ class McpResourceResource(SyncAPIResource):
57
59
  extra_body=extra_body,
58
60
  timeout=timeout,
59
61
  ),
60
- response_type=McpResourceCatalogResponse,
62
+ response_type="McpResourceCatalogResponse",
61
63
  ),
62
64
  )
63
65
 
@@ -102,7 +104,7 @@ class McpResource(SyncAPIResource):
102
104
  extra_body=extra_body,
103
105
  timeout=timeout,
104
106
  ),
105
- response_type=McpListResponse,
107
+ response_type="McpListResponse",
106
108
  ),
107
109
  )
108
110
 
@@ -291,7 +293,7 @@ class AsyncMcpResourceResource(AsyncAPIResource):
291
293
  extra_body=extra_body,
292
294
  timeout=timeout,
293
295
  ),
294
- response_type=McpResourceCatalogResponse,
296
+ response_type="McpResourceCatalogResponse",
295
297
  ),
296
298
  )
297
299
 
@@ -336,7 +338,7 @@ class AsyncMcpResource(AsyncAPIResource):
336
338
  extra_body=extra_body,
337
339
  timeout=timeout,
338
340
  ),
339
- response_type=McpListResponse,
341
+ response_type="McpListResponse",
340
342
  ),
341
343
  )
342
344
 
@@ -5,18 +5,19 @@
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- from typing import Literal
8
+ from typing import TYPE_CHECKING, Literal
9
9
 
10
10
  from .._base_client import RequestOptions
11
11
  from .._pagination import AsyncPaginator, SyncCursorPage
12
12
  from .._qs import encode_path_segment
13
13
  from .._resource import AsyncAPIResource, SyncAPIResource
14
14
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, OpenEnum, Query, Timeout
15
- from ..types import (
16
- SessionID,
17
- SessionMessageInfo,
18
- SessionMessagesResponse,
19
- )
15
+
16
+ if TYPE_CHECKING:
17
+ from ..types import (
18
+ SessionID,
19
+ SessionMessageInfo,
20
+ )
20
21
 
21
22
  __all__ = ["MessageResource", "AsyncMessageResource"]
22
23
 
@@ -82,7 +83,7 @@ class MessageResource(SyncAPIResource):
82
83
  extra_body=extra_body,
83
84
  timeout=timeout,
84
85
  ),
85
- response_type=SessionMessagesResponse,
86
+ response_type="SessionMessagesResponse",
86
87
  )
87
88
 
88
89
 
@@ -147,5 +148,5 @@ class AsyncMessageResource(AsyncAPIResource):
147
148
  extra_body=extra_body,
148
149
  timeout=timeout,
149
150
  ),
150
- response_type=SessionMessagesResponse,
151
+ response_type="SessionMessagesResponse",
151
152
  )
@@ -6,16 +6,18 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  from functools import cached_property
9
- from typing import cast
9
+ from typing import TYPE_CHECKING, cast
10
10
 
11
11
  from .._base_client import RequestOptions
12
12
  from .._resource import AsyncAPIResource, SyncAPIResource
13
13
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
14
- from ..types import (
15
- MigrationV1StatusResponseOption1,
16
- MigrationV1StatusResponseOption2,
17
- MigrationV1StatusResponseOption3,
18
- )
14
+
15
+ if TYPE_CHECKING:
16
+ from ..types import (
17
+ MigrationV1StatusResponseOption1,
18
+ MigrationV1StatusResponseOption2,
19
+ MigrationV1StatusResponseOption3,
20
+ )
19
21
 
20
22
  __all__ = ["MigrationResource", "AsyncMigrationResource"]
21
23
 
@@ -54,9 +56,7 @@ class MigrationV1Resource(SyncAPIResource):
54
56
  extra_body=extra_body,
55
57
  timeout=timeout,
56
58
  ),
57
- response_type=MigrationV1StatusResponseOption1
58
- | MigrationV1StatusResponseOption2
59
- | MigrationV1StatusResponseOption3,
59
+ response_type="MigrationV1StatusResponseOption1 | MigrationV1StatusResponseOption2 | MigrationV1StatusResponseOption3",
60
60
  ),
61
61
  )
62
62
 
@@ -104,9 +104,7 @@ class AsyncMigrationV1Resource(AsyncAPIResource):
104
104
  extra_body=extra_body,
105
105
  timeout=timeout,
106
106
  ),
107
- response_type=MigrationV1StatusResponseOption1
108
- | MigrationV1StatusResponseOption2
109
- | MigrationV1StatusResponseOption3,
107
+ response_type="MigrationV1StatusResponseOption1 | MigrationV1StatusResponseOption2 | MigrationV1StatusResponseOption3",
110
108
  ),
111
109
  )
112
110