mirror of
https://github.com/GuDaStudio/codexmcp.git
synced 2026-02-11 02:43:48 +08:00
v0.6:支持更多参数
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from ast import List
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
@@ -148,11 +149,38 @@ async def codex(
|
|||||||
bool,
|
bool,
|
||||||
"Return all messages (e.g. reasoning, tool calls, etc.) from the codex session. Set to `False` by default, only the agent's final reply message is returned.",
|
"Return all messages (e.g. reasoning, tool calls, etc.) from the codex session. Set to `False` by default, only the agent's final reply message is returned.",
|
||||||
] = False,
|
] = False,
|
||||||
|
image: Annotated[
|
||||||
|
Optional[List[Path]],
|
||||||
|
Field(
|
||||||
|
description="Attach one or more image files to the initial prompt. Separate multiple paths with commas or repeat the flag.",
|
||||||
|
),
|
||||||
|
] = None,
|
||||||
|
model: Annotated[
|
||||||
|
Optional[str],
|
||||||
|
Field(
|
||||||
|
description="The model to use for the codex session. Default user configuration is applied; this parameter remains inactive unless explicitly specified by the user.",
|
||||||
|
),
|
||||||
|
] = None,
|
||||||
|
yolo: Annotated[
|
||||||
|
Optional[bool],
|
||||||
|
Field(
|
||||||
|
description="Run every command without approvals or sandboxing. Only use when `sandbox` couldn't be applied.",
|
||||||
|
),
|
||||||
|
] = False,
|
||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
"""Execute a Codex CLI session and return the results."""
|
"""Execute a Codex CLI session and return the results."""
|
||||||
# Build command as list to avoid injection
|
# Build command as list to avoid injection
|
||||||
cmd = ["codex", "exec", "--sandbox", sandbox, "--cd", str(cd), "--json"]
|
cmd = ["codex", "exec", "--sandbox", sandbox, "--cd", str(cd), "--json"]
|
||||||
|
|
||||||
|
if image is not None:
|
||||||
|
cmd.extend(["--image", ",".join(image)])
|
||||||
|
|
||||||
|
if model is not None:
|
||||||
|
cmd.extend(["--model", model])
|
||||||
|
|
||||||
|
if yolo:
|
||||||
|
cmd.append("--yolo")
|
||||||
|
|
||||||
if skip_git_repo_check:
|
if skip_git_repo_check:
|
||||||
cmd.append("--skip-git-repo-check")
|
cmd.append("--skip-git-repo-check")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user