agentkit-sdk-python 0.7.12__py3-none-any.whl → 0.7.13__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.
@@ -23,9 +23,7 @@ import shlex
23
23
  import shutil
24
24
  import signal
25
25
  import sys
26
- import termios
27
26
  import threading
28
- import tty
29
27
  from contextlib import contextmanager
30
28
  from pathlib import Path
31
29
  from typing import Iterator, Optional
@@ -77,6 +75,7 @@ EXEC_MODE_TMUX = "tmux"
77
75
  CODEX_HOT_UPDATE_TIMEOUT_SECONDS = 300
78
76
  CODEX_HOT_UPDATE_REQUEST_TIMEOUT = 30
79
77
  CODEX_HOT_UPDATE_REQUEST_HARD_TIMEOUT = 90
78
+ IS_WINDOWS = os.name == "nt"
80
79
 
81
80
 
82
81
  def _terminal_size() -> dict[str, int]:
@@ -181,7 +180,14 @@ def _hot_update_codex_config(
181
180
 
182
181
  @contextmanager
183
182
  def _raw_terminal_mode() -> Iterator[None]:
184
- if not sys.stdin.isatty():
183
+ if IS_WINDOWS or not sys.stdin.isatty():
184
+ yield
185
+ return
186
+
187
+ try:
188
+ import termios
189
+ import tty
190
+ except ImportError: # pragma: no cover - POSIX-only modules are unavailable.
185
191
  yield
186
192
  return
187
193
 
@@ -202,7 +208,86 @@ def _send_resize(ws) -> None:
202
208
  _send_json(ws, {"type": "resize", "data": _terminal_size()})
203
209
 
204
210
 
211
+ def _process_stdin_data(
212
+ ws,
213
+ stop_event: threading.Event,
214
+ line_buffer: bytes,
215
+ data: bytes,
216
+ ) -> bytes:
217
+ if DETACH_SEQUENCE in data:
218
+ before_detach = data.split(DETACH_SEQUENCE, 1)[0]
219
+ if before_detach:
220
+ _send_json(
221
+ ws,
222
+ {
223
+ "type": "input",
224
+ "data": before_detach.decode("utf-8", errors="ignore"),
225
+ },
226
+ )
227
+ stop_event.set()
228
+ ws.close()
229
+ return b""
230
+
231
+ normalized_data = data.replace(b"\r", b"\n")
232
+ line_buffer += normalized_data
233
+ has_newline = b"\n" in normalized_data
234
+ line_parts = line_buffer.split(b"\n")
235
+ complete_lines = line_parts[:-1]
236
+ line_buffer = line_parts[-1]
237
+ if has_newline and any(_is_local_exit_line(line) for line in complete_lines):
238
+ stop_event.set()
239
+ ws.close()
240
+ return b""
241
+
242
+ _send_json(
243
+ ws,
244
+ {
245
+ "type": "input",
246
+ "data": data.decode("utf-8", errors="ignore"),
247
+ },
248
+ )
249
+ return line_buffer
250
+
251
+
252
+ def _stream_windows_stdin(ws, stop_event: threading.Event) -> None:
253
+ try:
254
+ import msvcrt
255
+ except ImportError:
256
+ error("Windows console input requires the msvcrt standard library module")
257
+
258
+ line_buffer = b""
259
+ while not stop_event.is_set():
260
+ if not msvcrt.kbhit():
261
+ stop_event.wait(0.1)
262
+ continue
263
+
264
+ char = msvcrt.getwch()
265
+ data = _windows_console_char_to_bytes(char, msvcrt)
266
+ if not data:
267
+ continue
268
+ line_buffer = _process_stdin_data(ws, stop_event, line_buffer, data)
269
+
270
+
271
+ def _windows_console_char_to_bytes(char: str, msvcrt) -> bytes:
272
+ if char in ("\x00", "\xe0"):
273
+ key = msvcrt.getwch()
274
+ return {
275
+ "H": b"\x1b[A", # Up
276
+ "P": b"\x1b[B", # Down
277
+ "K": b"\x1b[D", # Left
278
+ "M": b"\x1b[C", # Right
279
+ "G": b"\x1b[H", # Home
280
+ "O": b"\x1b[F", # End
281
+ "S": b"\x1b[3~", # Delete
282
+ }.get(key, b"")
283
+ return char.encode("utf-8", errors="ignore")
284
+
285
+
205
286
  def _stream_stdin(ws, stop_event: threading.Event) -> None:
287
+ if IS_WINDOWS:
288
+ _stream_windows_stdin(ws, stop_event)
289
+ return
290
+
206
291
  fd = sys.stdin.fileno()
207
292
  line_buffer = b""
208
293
  while not stop_event.is_set():
@@ -214,38 +299,7 @@ def _stream_stdin(ws, stop_event: threading.Event) -> None:
214
299
  if not data:
215
300
  break
216
301
 
217
- if DETACH_SEQUENCE in data:
218
- before_detach = data.split(DETACH_SEQUENCE, 1)[0]
219
- if before_detach:
220
- _send_json(
221
- ws,
222
- {
223
- "type": "input",
224
- "data": before_detach.decode("utf-8", errors="ignore"),
225
- },
226
- )
227
- stop_event.set()
228
- ws.close()
229
- break
230
-
231
- normalized_data = data.replace(b"\r", b"\n")
232
- line_buffer += normalized_data
233
- has_newline = b"\n" in normalized_data
234
- line_parts = line_buffer.split(b"\n")
235
- complete_lines = line_parts[:-1]
236
- line_buffer = line_parts[-1]
237
- if has_newline and any(_is_local_exit_line(line) for line in complete_lines):
238
- stop_event.set()
239
- ws.close()
240
- break
241
-
242
- _send_json(
243
- ws,
244
- {
245
- "type": "input",
246
- "data": data.decode("utf-8", errors="ignore"),
247
- },
248
- )
302
+ line_buffer = _process_stdin_data(ws, stop_event, line_buffer, data)
249
303
 
250
304
 
251
305
  def _is_local_exit_line(line: bytes) -> bool:
agentkit/version.py CHANGED
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- VERSION = "0.7.12"
15
+ VERSION = "0.7.13"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentkit-sdk-python
3
- Version: 0.7.12
3
+ Version: 0.7.13
4
4
  Summary: Python SDK for transforming any AI agent into a production-ready application. Framework-agnostic primitives for runtime, memory, authentication, and tools with volcengine-managed infrastructure.
5
5
  Author-email: Xiangrui Cheng <innsdcc@gmail.com>, Yumeng Bao <baoyumeng.123@gmail.com>, Yaozheng Fang <fangyozheng@gmail.com>, Guodong Li <cu.eric.lee@gmail.com>
6
6
  License: Apache License
@@ -229,6 +229,7 @@ Requires-Dist: requests>=2.32.5
229
229
  Requires-Dist: PyJWT>=2.10.1
230
230
  Requires-Dist: uvicorn>=0.37.0
231
231
  Requires-Dist: pyyaml
232
+ Requires-Dist: tomli>=2.0.1; python_version < "3.11"
232
233
  Requires-Dist: python-dotenv>=1.1.0
233
234
  Requires-Dist: prompt_toolkit
234
235
  Requires-Dist: typer
@@ -1,6 +1,6 @@
1
1
  agentkit/__init__.py,sha256=l27ZMDslc3VhmmnPZJyrqVvTDoZ0LqhCtM5hw0caHcU,1021
2
2
  agentkit/errors.py,sha256=UWlXv0ZsXd_oLTMlxuf4u9-XkTdRYeVZueE--Z3JsHU,1214
3
- agentkit/version.py,sha256=UZFajXkO3LMaoMxV_yKH2_pQpvhunh05rfkX_ftKnUQ,654
3
+ agentkit/version.py,sha256=8ePQzY83O8pNlD0-bVd6SGGfNjU42KnHWa2aWnxeSXY,654
4
4
  agentkit/apps/__init__.py,sha256=_Na1A4NSaMbVfPbsFKj2U-yI5mytD7W5skMaAOGbauY,2328
5
5
  agentkit/apps/base_app.py,sha256=3hZZExL1wyTGWveJEZZoqXN086MzmkVS_WU1vyulIWg,754
6
6
  agentkit/apps/utils.py,sha256=IzimIDmT6FS6PV9MLimPh46mq5zT-EjVmnYPxBdyEq0,1934
@@ -127,7 +127,7 @@ agentkit/toolkit/cli/sandbox/agentkit_client.py,sha256=6581_I9Mqa4pxqFD5wwG2AhUZ
127
127
  agentkit/toolkit/cli/sandbox/cli.py,sha256=abZ3F7dYltJCJiQJ-ZMgo8SPXGX48YB2n7Q-5UOsa-M,2619
128
128
  agentkit/toolkit/cli/sandbox/cli_build.py,sha256=43s9ohfj-bM48YNEJ4YKSZMofO63bCzb1hWCswxC2ck,2976
129
129
  agentkit/toolkit/cli/sandbox/cli_create.py,sha256=fHXtjOzXUmwFicHlGtv8V50o-rrZIsNGCUBctr9VzWA,26282
130
- agentkit/toolkit/cli/sandbox/cli_exec.py,sha256=bZ2cU56SJmyZIC_4vN5Y-likh7rqlK5FG6aoajyx-5E,23578
130
+ agentkit/toolkit/cli/sandbox/cli_exec.py,sha256=nfFiR45D8QAd32eGuQi1leYDptsbUEivG2ZCQ9uouaY,24984
131
131
  agentkit/toolkit/cli/sandbox/cli_file.py,sha256=T8OJ0_eVabn7c5AID8uSVNR2JXTc2X5UUMuMqckJS50,28940
132
132
  agentkit/toolkit/cli/sandbox/cli_get.py,sha256=3JuQrtDcn0onLuuiD4HEDL7X5WTa4Xnb-J5C4sC5UVM,3205
133
133
  agentkit/toolkit/cli/sandbox/cli_init_dockerfile.py,sha256=PV_PXPb1Y-lzxNh67653qgzWZvqu78BmxhIwr-whGx8,4125
@@ -253,9 +253,9 @@ agentkit/utils/redact.py,sha256=RAtiggxH74eb1Da6Gg0G5SLTVWRaIE5RqYnCozSZozQ,2167
253
253
  agentkit/utils/request.py,sha256=1IGxPS3BSCKk1K1_j862_v34xzLEx04CIvrLVb1MsGQ,1625
254
254
  agentkit/utils/template_utils.py,sha256=Qjg9V6dEpjAd_yYezIIPwuDsDeeMmp6XTMn5ZECifNc,6336
255
255
  agentkit/utils/ve_sign.py,sha256=IsRKRshTKpOMkNv4bDJoNWUcsBaMGeq-jHCniPMAyo8,13327
256
- agentkit_sdk_python-0.7.12.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
257
- agentkit_sdk_python-0.7.12.dist-info/METADATA,sha256=K90dgH6c8sePnET9IhGsL-u8BwcOcT0E58EdsKMXG4U,21409
258
- agentkit_sdk_python-0.7.12.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
259
- agentkit_sdk_python-0.7.12.dist-info/entry_points.txt,sha256=fhzZUsvsLXeB4mPaa0SBQiTBqFT404uDAKPaePAOUAE,58
260
- agentkit_sdk_python-0.7.12.dist-info/top_level.txt,sha256=ipy8JF-QQ-V0C1oRFLxsyaW8zwrasfJ-zjAh9vgOc7U,9
261
- agentkit_sdk_python-0.7.12.dist-info/RECORD,,
256
+ agentkit_sdk_python-0.7.13.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
257
+ agentkit_sdk_python-0.7.13.dist-info/METADATA,sha256=_zXgOumOvG-wnv9BQOegbLdgg325fBSaKJV2-SvWubU,21462
258
+ agentkit_sdk_python-0.7.13.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
259
+ agentkit_sdk_python-0.7.13.dist-info/entry_points.txt,sha256=fhzZUsvsLXeB4mPaa0SBQiTBqFT404uDAKPaePAOUAE,58
260
+ agentkit_sdk_python-0.7.13.dist-info/top_level.txt,sha256=ipy8JF-QQ-V0C1oRFLxsyaW8zwrasfJ-zjAh9vgOc7U,9
261
+ agentkit_sdk_python-0.7.13.dist-info/RECORD,,