blaxel 0.1.9rc36__py3-none-any.whl → 0.1.10__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 (83) hide show
  1. blaxel/agents/__init__.py +52 -15
  2. blaxel/authentication/__init__.py +11 -2
  3. blaxel/client/api/compute/create_sandbox_preview.py +179 -0
  4. blaxel/client/api/compute/create_sandbox_preview_token.py +192 -0
  5. blaxel/client/api/compute/delete_sandbox_preview.py +167 -0
  6. blaxel/client/api/compute/delete_sandbox_preview_token.py +180 -0
  7. blaxel/client/api/compute/get_sandbox_preview.py +167 -0
  8. blaxel/client/api/compute/list_sandbox_preview_tokens.py +172 -0
  9. blaxel/client/api/compute/list_sandbox_previews.py +159 -0
  10. blaxel/client/api/compute/update_sandbox_preview.py +192 -0
  11. blaxel/client/api/integrations/get_integration.py +64 -7
  12. blaxel/client/api/workspaces/check_workspace_availability.py +165 -0
  13. blaxel/client/models/__init__.py +32 -2
  14. blaxel/client/models/check_workspace_availability_body.py +60 -0
  15. blaxel/client/models/delete_sandbox_preview_token_response_200.py +60 -0
  16. blaxel/client/models/integration.py +197 -0
  17. blaxel/client/models/integration_additional_infos.py +45 -0
  18. blaxel/client/models/integration_endpoint.py +143 -0
  19. blaxel/client/models/integration_endpoint_token.py +79 -0
  20. blaxel/client/models/integration_endpoints.py +61 -0
  21. blaxel/client/models/integration_headers.py +45 -0
  22. blaxel/client/models/integration_organization.py +88 -0
  23. blaxel/client/models/integration_query_params.py +45 -0
  24. blaxel/client/models/metrics.py +9 -0
  25. blaxel/client/models/preview.py +96 -0
  26. blaxel/client/models/preview_metadata.py +133 -0
  27. blaxel/client/models/preview_spec.py +79 -0
  28. blaxel/client/models/preview_token.py +96 -0
  29. blaxel/client/models/preview_token_metadata.py +97 -0
  30. blaxel/client/models/preview_token_spec.py +88 -0
  31. blaxel/common/autoload.py +0 -2
  32. blaxel/common/internal.py +75 -0
  33. blaxel/common/settings.py +6 -1
  34. blaxel/mcp/server.py +2 -1
  35. blaxel/sandbox/base.py +68 -0
  36. blaxel/sandbox/client/__init__.py +8 -0
  37. blaxel/sandbox/client/api/__init__.py +1 -0
  38. blaxel/sandbox/client/api/filesystem/__init__.py +0 -0
  39. blaxel/sandbox/client/api/filesystem/delete_filesystem_path.py +184 -0
  40. blaxel/sandbox/client/api/filesystem/get_filesystem_path.py +184 -0
  41. blaxel/sandbox/client/api/filesystem/put_filesystem_path.py +189 -0
  42. blaxel/sandbox/client/api/network/__init__.py +0 -0
  43. blaxel/sandbox/client/api/network/delete_network_process_pid_monitor.py +169 -0
  44. blaxel/sandbox/client/api/network/get_network_process_pid_ports.py +169 -0
  45. blaxel/sandbox/client/api/network/post_network_process_pid_monitor.py +195 -0
  46. blaxel/sandbox/client/api/process/__init__.py +0 -0
  47. blaxel/sandbox/client/api/process/delete_process_identifier.py +163 -0
  48. blaxel/sandbox/client/api/process/delete_process_identifier_kill.py +189 -0
  49. blaxel/sandbox/client/api/process/get_process.py +135 -0
  50. blaxel/sandbox/client/api/process/get_process_identifier.py +159 -0
  51. blaxel/sandbox/client/api/process/get_process_identifier_logs.py +188 -0
  52. blaxel/sandbox/client/api/process/get_process_identifier_logs_stream.py +190 -0
  53. blaxel/sandbox/client/api/process/post_process.py +176 -0
  54. blaxel/sandbox/client/client.py +162 -0
  55. blaxel/sandbox/client/errors.py +16 -0
  56. blaxel/sandbox/client/models/__init__.py +41 -0
  57. blaxel/sandbox/client/models/delete_network_process_pid_monitor_response_200.py +45 -0
  58. blaxel/sandbox/client/models/directory.py +112 -0
  59. blaxel/sandbox/client/models/error_response.py +60 -0
  60. blaxel/sandbox/client/models/file.py +105 -0
  61. blaxel/sandbox/client/models/file_request.py +78 -0
  62. blaxel/sandbox/client/models/file_with_content.py +114 -0
  63. blaxel/sandbox/client/models/get_network_process_pid_ports_response_200.py +45 -0
  64. blaxel/sandbox/client/models/get_process_identifier_logs_response_200.py +45 -0
  65. blaxel/sandbox/client/models/get_process_identifier_logs_stream_response_200.py +45 -0
  66. blaxel/sandbox/client/models/port_monitor_request.py +60 -0
  67. blaxel/sandbox/client/models/post_network_process_pid_monitor_response_200.py +45 -0
  68. blaxel/sandbox/client/models/process_kill_request.py +60 -0
  69. blaxel/sandbox/client/models/process_request.py +118 -0
  70. blaxel/sandbox/client/models/process_response.py +123 -0
  71. blaxel/sandbox/client/models/subdirectory.py +60 -0
  72. blaxel/sandbox/client/models/success_response.py +69 -0
  73. blaxel/sandbox/client/py.typed +1 -0
  74. blaxel/sandbox/client/types.py +46 -0
  75. blaxel/sandbox/filesystem.py +104 -0
  76. blaxel/sandbox/process.py +57 -0
  77. blaxel/sandbox/sandbox.py +92 -0
  78. blaxel/tools/__init__.py +62 -21
  79. {blaxel-0.1.9rc36.dist-info → blaxel-0.1.10.dist-info}/METADATA +1 -1
  80. {blaxel-0.1.9rc36.dist-info → blaxel-0.1.10.dist-info}/RECORD +82 -14
  81. blaxel/client/models/sandboxes.py +0 -129
  82. {blaxel-0.1.9rc36.dist-info → blaxel-0.1.10.dist-info}/WHEEL +0 -0
  83. {blaxel-0.1.9rc36.dist-info → blaxel-0.1.10.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,189 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import Client
8
+ from ...models.error_response import ErrorResponse
9
+ from ...models.file_request import FileRequest
10
+ from ...models.success_response import SuccessResponse
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ path: str,
16
+ *,
17
+ body: FileRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "put",
23
+ "url": f"/filesystem/{path}",
24
+ }
25
+
26
+ if type(body) == dict:
27
+ _body = body
28
+ else:
29
+ _body = body.to_dict()
30
+
31
+ _kwargs["json"] = _body
32
+ headers["Content-Type"] = "application/json"
33
+
34
+ _kwargs["headers"] = headers
35
+ return _kwargs
36
+
37
+
38
+ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[ErrorResponse, SuccessResponse]]:
39
+ if response.status_code == 200:
40
+ response_200 = SuccessResponse.from_dict(response.json())
41
+
42
+ return response_200
43
+ if response.status_code == 400:
44
+ response_400 = ErrorResponse.from_dict(response.json())
45
+
46
+ return response_400
47
+ if response.status_code == 500:
48
+ response_500 = ErrorResponse.from_dict(response.json())
49
+
50
+ return response_500
51
+ if client.raise_on_unexpected_status:
52
+ raise errors.UnexpectedStatus(response.status_code, response.content)
53
+ else:
54
+ return None
55
+
56
+
57
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, SuccessResponse]]:
58
+ return Response(
59
+ status_code=HTTPStatus(response.status_code),
60
+ content=response.content,
61
+ headers=response.headers,
62
+ parsed=_parse_response(client=client, response=response),
63
+ )
64
+
65
+
66
+ def sync_detailed(
67
+ path: str,
68
+ *,
69
+ client: Union[Client],
70
+ body: FileRequest,
71
+ ) -> Response[Union[ErrorResponse, SuccessResponse]]:
72
+ """Create or update file or directory
73
+
74
+ Create or update a file or directory
75
+
76
+ Args:
77
+ path (str):
78
+ body (FileRequest):
79
+
80
+ Raises:
81
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
82
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
83
+
84
+ Returns:
85
+ Response[Union[ErrorResponse, SuccessResponse]]
86
+ """
87
+
88
+ kwargs = _get_kwargs(
89
+ path=path,
90
+ body=body,
91
+ )
92
+
93
+ response = client.get_httpx_client().request(
94
+ **kwargs,
95
+ )
96
+
97
+ return _build_response(client=client, response=response)
98
+
99
+
100
+ def sync(
101
+ path: str,
102
+ *,
103
+ client: Union[Client],
104
+ body: FileRequest,
105
+ ) -> Optional[Union[ErrorResponse, SuccessResponse]]:
106
+ """Create or update file or directory
107
+
108
+ Create or update a file or directory
109
+
110
+ Args:
111
+ path (str):
112
+ body (FileRequest):
113
+
114
+ Raises:
115
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
117
+
118
+ Returns:
119
+ Union[ErrorResponse, SuccessResponse]
120
+ """
121
+
122
+ return sync_detailed(
123
+ path=path,
124
+ client=client,
125
+ body=body,
126
+ ).parsed
127
+
128
+
129
+ async def asyncio_detailed(
130
+ path: str,
131
+ *,
132
+ client: Union[Client],
133
+ body: FileRequest,
134
+ ) -> Response[Union[ErrorResponse, SuccessResponse]]:
135
+ """Create or update file or directory
136
+
137
+ Create or update a file or directory
138
+
139
+ Args:
140
+ path (str):
141
+ body (FileRequest):
142
+
143
+ Raises:
144
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
145
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
146
+
147
+ Returns:
148
+ Response[Union[ErrorResponse, SuccessResponse]]
149
+ """
150
+
151
+ kwargs = _get_kwargs(
152
+ path=path,
153
+ body=body,
154
+ )
155
+
156
+ response = await client.get_async_httpx_client().request(**kwargs)
157
+
158
+ return _build_response(client=client, response=response)
159
+
160
+
161
+ async def asyncio(
162
+ path: str,
163
+ *,
164
+ client: Union[Client],
165
+ body: FileRequest,
166
+ ) -> Optional[Union[ErrorResponse, SuccessResponse]]:
167
+ """Create or update file or directory
168
+
169
+ Create or update a file or directory
170
+
171
+ Args:
172
+ path (str):
173
+ body (FileRequest):
174
+
175
+ Raises:
176
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
177
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
178
+
179
+ Returns:
180
+ Union[ErrorResponse, SuccessResponse]
181
+ """
182
+
183
+ return (
184
+ await asyncio_detailed(
185
+ path=path,
186
+ client=client,
187
+ body=body,
188
+ )
189
+ ).parsed
File without changes
@@ -0,0 +1,169 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import Client
8
+ from ...models.delete_network_process_pid_monitor_response_200 import (
9
+ DeleteNetworkProcessPidMonitorResponse200,
10
+ )
11
+ from ...models.error_response import ErrorResponse
12
+ from ...types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ pid: int,
17
+ ) -> dict[str, Any]:
18
+ _kwargs: dict[str, Any] = {
19
+ "method": "delete",
20
+ "url": f"/network/process/{pid}/monitor",
21
+ }
22
+
23
+ return _kwargs
24
+
25
+
26
+ def _parse_response(
27
+ *, client: Client, response: httpx.Response
28
+ ) -> Optional[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
29
+ if response.status_code == 200:
30
+ response_200 = DeleteNetworkProcessPidMonitorResponse200.from_dict(response.json())
31
+
32
+ return response_200
33
+ if response.status_code == 400:
34
+ response_400 = ErrorResponse.from_dict(response.json())
35
+
36
+ return response_400
37
+ if response.status_code == 500:
38
+ response_500 = ErrorResponse.from_dict(response.json())
39
+
40
+ return response_500
41
+ if client.raise_on_unexpected_status:
42
+ raise errors.UnexpectedStatus(response.status_code, response.content)
43
+ else:
44
+ return None
45
+
46
+
47
+ def _build_response(
48
+ *, client: Client, response: httpx.Response
49
+ ) -> Response[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
50
+ return Response(
51
+ status_code=HTTPStatus(response.status_code),
52
+ content=response.content,
53
+ headers=response.headers,
54
+ parsed=_parse_response(client=client, response=response),
55
+ )
56
+
57
+
58
+ def sync_detailed(
59
+ pid: int,
60
+ *,
61
+ client: Union[Client],
62
+ ) -> Response[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
63
+ """Stop monitoring ports for a process
64
+
65
+ Stop monitoring for new ports opened by a process
66
+
67
+ Args:
68
+ pid (int):
69
+
70
+ Raises:
71
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
72
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
73
+
74
+ Returns:
75
+ Response[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]
76
+ """
77
+
78
+ kwargs = _get_kwargs(
79
+ pid=pid,
80
+ )
81
+
82
+ response = client.get_httpx_client().request(
83
+ **kwargs,
84
+ )
85
+
86
+ return _build_response(client=client, response=response)
87
+
88
+
89
+ def sync(
90
+ pid: int,
91
+ *,
92
+ client: Union[Client],
93
+ ) -> Optional[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
94
+ """Stop monitoring ports for a process
95
+
96
+ Stop monitoring for new ports opened by a process
97
+
98
+ Args:
99
+ pid (int):
100
+
101
+ Raises:
102
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
103
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
104
+
105
+ Returns:
106
+ Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]
107
+ """
108
+
109
+ return sync_detailed(
110
+ pid=pid,
111
+ client=client,
112
+ ).parsed
113
+
114
+
115
+ async def asyncio_detailed(
116
+ pid: int,
117
+ *,
118
+ client: Union[Client],
119
+ ) -> Response[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
120
+ """Stop monitoring ports for a process
121
+
122
+ Stop monitoring for new ports opened by a process
123
+
124
+ Args:
125
+ pid (int):
126
+
127
+ Raises:
128
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
129
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
130
+
131
+ Returns:
132
+ Response[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]
133
+ """
134
+
135
+ kwargs = _get_kwargs(
136
+ pid=pid,
137
+ )
138
+
139
+ response = await client.get_async_httpx_client().request(**kwargs)
140
+
141
+ return _build_response(client=client, response=response)
142
+
143
+
144
+ async def asyncio(
145
+ pid: int,
146
+ *,
147
+ client: Union[Client],
148
+ ) -> Optional[Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]]:
149
+ """Stop monitoring ports for a process
150
+
151
+ Stop monitoring for new ports opened by a process
152
+
153
+ Args:
154
+ pid (int):
155
+
156
+ Raises:
157
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
158
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
159
+
160
+ Returns:
161
+ Union[DeleteNetworkProcessPidMonitorResponse200, ErrorResponse]
162
+ """
163
+
164
+ return (
165
+ await asyncio_detailed(
166
+ pid=pid,
167
+ client=client,
168
+ )
169
+ ).parsed
@@ -0,0 +1,169 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import Client
8
+ from ...models.error_response import ErrorResponse
9
+ from ...models.get_network_process_pid_ports_response_200 import (
10
+ GetNetworkProcessPidPortsResponse200,
11
+ )
12
+ from ...types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ pid: int,
17
+ ) -> dict[str, Any]:
18
+ _kwargs: dict[str, Any] = {
19
+ "method": "get",
20
+ "url": f"/network/process/{pid}/ports",
21
+ }
22
+
23
+ return _kwargs
24
+
25
+
26
+ def _parse_response(
27
+ *, client: Client, response: httpx.Response
28
+ ) -> Optional[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
29
+ if response.status_code == 200:
30
+ response_200 = GetNetworkProcessPidPortsResponse200.from_dict(response.json())
31
+
32
+ return response_200
33
+ if response.status_code == 400:
34
+ response_400 = ErrorResponse.from_dict(response.json())
35
+
36
+ return response_400
37
+ if response.status_code == 500:
38
+ response_500 = ErrorResponse.from_dict(response.json())
39
+
40
+ return response_500
41
+ if client.raise_on_unexpected_status:
42
+ raise errors.UnexpectedStatus(response.status_code, response.content)
43
+ else:
44
+ return None
45
+
46
+
47
+ def _build_response(
48
+ *, client: Client, response: httpx.Response
49
+ ) -> Response[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
50
+ return Response(
51
+ status_code=HTTPStatus(response.status_code),
52
+ content=response.content,
53
+ headers=response.headers,
54
+ parsed=_parse_response(client=client, response=response),
55
+ )
56
+
57
+
58
+ def sync_detailed(
59
+ pid: int,
60
+ *,
61
+ client: Union[Client],
62
+ ) -> Response[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
63
+ """Get open ports for a process
64
+
65
+ Get a list of all open ports for a process
66
+
67
+ Args:
68
+ pid (int):
69
+
70
+ Raises:
71
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
72
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
73
+
74
+ Returns:
75
+ Response[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]
76
+ """
77
+
78
+ kwargs = _get_kwargs(
79
+ pid=pid,
80
+ )
81
+
82
+ response = client.get_httpx_client().request(
83
+ **kwargs,
84
+ )
85
+
86
+ return _build_response(client=client, response=response)
87
+
88
+
89
+ def sync(
90
+ pid: int,
91
+ *,
92
+ client: Union[Client],
93
+ ) -> Optional[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
94
+ """Get open ports for a process
95
+
96
+ Get a list of all open ports for a process
97
+
98
+ Args:
99
+ pid (int):
100
+
101
+ Raises:
102
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
103
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
104
+
105
+ Returns:
106
+ Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]
107
+ """
108
+
109
+ return sync_detailed(
110
+ pid=pid,
111
+ client=client,
112
+ ).parsed
113
+
114
+
115
+ async def asyncio_detailed(
116
+ pid: int,
117
+ *,
118
+ client: Union[Client],
119
+ ) -> Response[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
120
+ """Get open ports for a process
121
+
122
+ Get a list of all open ports for a process
123
+
124
+ Args:
125
+ pid (int):
126
+
127
+ Raises:
128
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
129
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
130
+
131
+ Returns:
132
+ Response[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]
133
+ """
134
+
135
+ kwargs = _get_kwargs(
136
+ pid=pid,
137
+ )
138
+
139
+ response = await client.get_async_httpx_client().request(**kwargs)
140
+
141
+ return _build_response(client=client, response=response)
142
+
143
+
144
+ async def asyncio(
145
+ pid: int,
146
+ *,
147
+ client: Union[Client],
148
+ ) -> Optional[Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]]:
149
+ """Get open ports for a process
150
+
151
+ Get a list of all open ports for a process
152
+
153
+ Args:
154
+ pid (int):
155
+
156
+ Raises:
157
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
158
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
159
+
160
+ Returns:
161
+ Union[ErrorResponse, GetNetworkProcessPidPortsResponse200]
162
+ """
163
+
164
+ return (
165
+ await asyncio_detailed(
166
+ pid=pid,
167
+ client=client,
168
+ )
169
+ ).parsed