Skip to content

Commit 0b8d020

Browse files
committed
fix(app-server): clarify command stdin write API
1 parent d198f66 commit 0b8d020

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

codex/app_server/_async_services.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,19 @@ async def execute(
357357

358358
exec = execute
359359

360-
async def write(
360+
async def write_stdin(
361361
self,
362362
*,
363363
process_id: str,
364364
close_stdin: bool | None = None,
365365
delta_base64: str | None = None,
366366
) -> EmptyResult:
367+
"""Write stdin bytes to a running `command/exec` process or close stdin.
368+
369+
This wraps the app-server `command/exec/write` request. `delta_base64`
370+
is optional base64-encoded stdin data; `close_stdin` closes the
371+
process stdin after the optional write.
372+
"""
367373
params = protocol.CommandExecWriteParams(
368374
closeStdin=close_stdin,
369375
deltaBase64=delta_base64,

codex/app_server/_sync_services.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ async def execute(
198198
tty: bool | None = None,
199199
) -> CommandExecResult: ...
200200

201-
async def write(
201+
async def write_stdin(
202202
self,
203203
*,
204204
process_id: str,
@@ -588,15 +588,21 @@ def execute(
588588

589589
exec = execute
590590

591-
def write(
591+
def write_stdin(
592592
self,
593593
*,
594594
process_id: str,
595595
close_stdin: bool | None = None,
596596
delta_base64: str | None = None,
597597
) -> EmptyResult:
598+
"""Write stdin bytes to a running `command/exec` process or close stdin.
599+
600+
This wraps the app-server `command/exec/write` request. `delta_base64`
601+
is optional base64-encoded stdin data; `close_stdin` closes the
602+
process stdin after the optional write.
603+
"""
598604
return self._run(
599-
self._async_client.write(
605+
self._async_client.write_stdin(
600606
process_id=process_id,
601607
close_stdin=close_stdin,
602608
delta_base64=delta_base64,

tests/test_app_server_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,7 +1938,7 @@ def command_terminate(message: JsonObject) -> JsonObject:
19381938
stream_stdout_stderr=True,
19391939
tty=True,
19401940
)
1941-
wrote = await client.command.write(
1941+
wrote = await client.command.write_stdin(
19421942
process_id="proc-1",
19431943
delta_base64="aGVsbG8K",
19441944
close_stdin=True,
@@ -2587,11 +2587,14 @@ def login_account(message: JsonObject) -> JsonObject:
25872587
"timeout_ms",
25882588
"tty",
25892589
)
2590-
assert tuple(inspect.signature(client.command.write).parameters) == (
2590+
assert tuple(inspect.signature(client.command.write_stdin).parameters) == (
25912591
"process_id",
25922592
"close_stdin",
25932593
"delta_base64",
25942594
)
2595+
assert client.command.write_stdin.__doc__ is not None
2596+
assert "command/exec/write" in client.command.write_stdin.__doc__
2597+
assert "stdin" in client.command.write_stdin.__doc__
25952598
assert tuple(inspect.signature(client.command.resize).parameters) == (
25962599
"process_id",
25972600
"size",

0 commit comments

Comments
 (0)