feat(#1151): default bash_run wait_seconds to 3s
This commit is contained in:
parent
a789c096e7
commit
6be114eb05
1 changed files with 17 additions and 14 deletions
|
|
@ -503,18 +503,20 @@ pub struct BashRunArgs {
|
||||||
/// `timed_out` when the limit is exceeded.
|
/// `timed_out` when the limit is exceeded.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub timeout_secs: Option<u64>,
|
pub timeout_secs: Option<u64>,
|
||||||
/// Optional inline wait: if set, `bash_run` polls for up to
|
/// Optional inline wait: `bash_run` polls for up to `wait_seconds`
|
||||||
/// `wait_seconds` (capped at 30) before returning. When the task
|
/// (capped at 30) before returning. When the task finishes within the
|
||||||
/// finishes within the window the full status is returned immediately
|
/// window the full status is returned immediately and no wake is fired;
|
||||||
/// — no separate `bash_status` call needed. When the timeout expires
|
/// when the timeout expires the task keeps running and the normal
|
||||||
/// before the command finishes, the task keeps running in the
|
/// `task started: id=<id>` response is returned. Defaults to 3s. Pass
|
||||||
/// background and the usual `task started: id=<id>` response is
|
/// `0` to disable and always get the immediate response.
|
||||||
/// returned. Useful for fast commands (< 5 s) that would otherwise
|
#[serde(default = "default_bash_run_wait")]
|
||||||
/// force an unnecessary round-trip.
|
|
||||||
#[serde(default)]
|
|
||||||
pub wait_seconds: Option<u64>,
|
pub wait_seconds: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_bash_run_wait() -> Option<u64> {
|
||||||
|
Some(3)
|
||||||
|
}
|
||||||
|
|
||||||
/// MCP tool args for `bash_status`.
|
/// MCP tool args for `bash_status`.
|
||||||
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
|
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
|
||||||
pub struct BashStatusArgs {
|
pub struct BashStatusArgs {
|
||||||
|
|
@ -961,11 +963,12 @@ impl AgentServer {
|
||||||
do NOT wait inline. When the command finishes, the harness fires a wake with \
|
do NOT wait inline. When the command finishes, the harness fires a wake with \
|
||||||
`from: \"bash-task-<id>\"` and the exit code + last stdout lines in the body; \
|
`from: \"bash-task-<id>\"` and the exit code + last stdout lines in the body; \
|
||||||
handle it on a future turn. Use `bash_status` to poll the task status within \
|
handle it on a future turn. Use `bash_status` to poll the task status within \
|
||||||
the same turn if needed. `timeout_secs` defaults to 180. \
|
the same turn if needed. `timeout_secs` defaults to 180. Pass `wait_seconds` \
|
||||||
Pass `wait_seconds` (capped at 30) to wait inline for fast commands: when the \
|
(capped at 30) to wait inline for fast commands: when the task finishes within \
|
||||||
task finishes within the window the full status is returned immediately and no \
|
the window the full status is returned immediately and no wake is fired; when \
|
||||||
wake is fired; when the timeout expires the task keeps running and the normal \
|
the timeout expires the task keeps running and the normal `task started: id=<id>` \
|
||||||
`task started: id=<id>` response is returned."
|
response is returned. `wait_seconds` defaults to 3; pass `wait_seconds: 0` to \
|
||||||
|
disable inline waiting and always get the immediate response."
|
||||||
)]
|
)]
|
||||||
async fn bash_run(&self, Parameters(args): Parameters<BashRunArgs>) -> String {
|
async fn bash_run(&self, Parameters(args): Parameters<BashRunArgs>) -> String {
|
||||||
let log = format!("{args:?}");
|
let log = format!("{args:?}");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue