Synced from monorepo
Synced from monorepo Changes: - Shell: accept target response id on rewind execute - Shell: stamp response id on chat user message chunks - Worktree: optional rebuild and stale git registration cleanup in auto-GC - Worktree: kind-aware auto-GC TTLs and config knobs - Worktree: macOS process CWD scan and Unix PID liveness for GC guards - Worktree: automatic throttled GC on startup (Linux age-based; non-Linux dead-only) - Pager: add `[ui].combine_queued_prompts` to batch queued follow-ups - Shell: stop overwriting user skills - Tools: read markdown in `skills/` directories untruncated - `/usage` shows per-session token and dollar usage in the TUI - Security: prompt on environment-dumping `ps` variants - Security: always-safe `kubectl` no longer runs arbitrary kubeconfig credential plugins without permission - Tools: make scheduler deletion durable - Shell: add relocation storage primitives - Shell: give side model calls their own conversation ids - Fix five workflow-runtime bugs (budget, pause, cancel, reconnect) - Security: peel `env -S` / `--split-string` operands in the Bash permission gate (managed deny/ask) - Pager: expose doctor in the TUI - Security: block unauthorized RCE via abused safe commands - Pager idle watcher cue: "1 subagent still running" instead of "watching · 1 subagent" - Security: block `rg --pre` arbitrary code execution in auto-mode - Voice: diagnose silent-mic failures (macOS permission) and add doctor/terminal-setup Voice section - App builder deployer: `allow_forking` and `show_built_with_grok` - Pager: stop stacking duplicate "Worked for" markers on parked turns - Shell: support `max` as a distinct reasoning effort tier - Tools: serialize background `/loop` fires on the whole work unit - Shell: add working-directory relocation state primitives - Proto: `ClientToolResult` and `ChatConfig` client-side tools - Shell: model providers - Chat: select App Builder product on the Build path - Shell: attach author identity to feedback when the deployment opts in - Doctor: fix for SSH wrap setup - Workflow authoring skills: create-workflow and import-claude-workflow docs - Add read-only grok doctor - Sandbox: apply Landlock without a controlling TTY - Pager: recover image paste over grok wrap on headless remotes - Pager: make actions screen-mode aware - Shell: resume sessions when the working directory moves - Pager: centralize terminal diagnostics - Workspace: gate inline shell file access - Pager: centralize terminal probes - Pager: edit minimal prompts in an external editor - Pager: standardize backgrounding on Ctrl+B - Shell: recap rides the parent turn's prompt cache - Tools: add scheduler lifecycle version clock Source-Revision: 0f4d7c91b8b2b408333f6de1e8a76cb8eaa71899
This commit is contained in:
parent
a881e6703f
commit
3af4d5d398
556 changed files with 56609 additions and 21892 deletions
|
|
@ -702,6 +702,8 @@ pub(crate) fn execute(
|
|||
);
|
||||
if let Some(q) = &query {
|
||||
params["query"] = serde_json::Value::String(q.clone());
|
||||
} else {
|
||||
params["allowRelax"] = serde_json::Value::Bool(true);
|
||||
}
|
||||
let request = acp::ExtRequest::new(
|
||||
"x.ai/session/list",
|
||||
|
|
@ -726,9 +728,11 @@ pub(crate) fn execute(
|
|||
let payload = wrapper.get("result").unwrap_or(&wrapper);
|
||||
let sessions = parse_session_picker_entries(payload);
|
||||
let partial = parse_session_list_partial(payload);
|
||||
let scope = parse_session_list_scope(payload);
|
||||
TaskResult::SessionListLoaded {
|
||||
sessions,
|
||||
partial,
|
||||
scope,
|
||||
seq,
|
||||
query,
|
||||
}
|
||||
|
|
@ -1349,6 +1353,48 @@ pub(crate) fn execute(
|
|||
TaskResult::CancelComplete
|
||||
});
|
||||
}
|
||||
Effect::QueueHoldEdit { session_id, id } => {
|
||||
let tx = acp_tx.clone();
|
||||
tasks
|
||||
.spawn(async move {
|
||||
let params = serde_json::json!(
|
||||
{ "sessionId" : session_id.0.to_string(), "id" : id, }
|
||||
);
|
||||
let notification = acp::ExtNotification::new(
|
||||
"x.ai/queue/hold_edit",
|
||||
serde_json::value::to_raw_value(¶ms)
|
||||
.expect("serialize queue/hold_edit params")
|
||||
.into(),
|
||||
);
|
||||
if let Err(e) = acp_send(notification, &tx).await {
|
||||
tracing::warn!(
|
||||
"Failed to send queue/hold_edit notification: {e}"
|
||||
);
|
||||
}
|
||||
TaskResult::CancelComplete
|
||||
});
|
||||
}
|
||||
Effect::QueueReleaseEdit { session_id, id } => {
|
||||
let tx = acp_tx.clone();
|
||||
tasks
|
||||
.spawn(async move {
|
||||
let params = serde_json::json!(
|
||||
{ "sessionId" : session_id.0.to_string(), "id" : id, }
|
||||
);
|
||||
let notification = acp::ExtNotification::new(
|
||||
"x.ai/queue/release_edit",
|
||||
serde_json::value::to_raw_value(¶ms)
|
||||
.expect("serialize queue/release_edit params")
|
||||
.into(),
|
||||
);
|
||||
if let Err(e) = acp_send(notification, &tx).await {
|
||||
tracing::warn!(
|
||||
"Failed to send queue/release_edit notification: {e}"
|
||||
);
|
||||
}
|
||||
TaskResult::CancelComplete
|
||||
});
|
||||
}
|
||||
Effect::QueueInterject { session_id, id, expected_version, new_text } => {
|
||||
let tx = acp_tx.clone();
|
||||
tasks
|
||||
|
|
@ -2404,6 +2450,44 @@ pub(crate) fn execute(
|
|||
}
|
||||
});
|
||||
}
|
||||
Effect::FetchWorkflowsList { agent_id, session_id } => {
|
||||
let tx = acp_tx.clone();
|
||||
tasks
|
||||
.spawn(async move {
|
||||
let params = serde_json::json!({ "sessionId" : session_id });
|
||||
let req = acp::ExtRequest::new(
|
||||
"x.ai/workflows/list",
|
||||
serde_json::value::to_raw_value(¶ms)
|
||||
.expect("serialize workflows/list params")
|
||||
.into(),
|
||||
);
|
||||
let result = match acp_send(req, &tx).await {
|
||||
Ok(resp) => {
|
||||
let wrapper: serde_json::Value = serde_json::from_str(
|
||||
resp.0.get(),
|
||||
)
|
||||
.unwrap_or_default();
|
||||
let inner = wrapper.get("result").unwrap_or(&wrapper);
|
||||
serde_json::from_value::<
|
||||
Vec<crate::views::extensions_modal::WorkflowInfo>,
|
||||
>(inner.get("workflows").cloned().unwrap_or_default())
|
||||
.map_err(|_| "couldn't load workflows".to_string())
|
||||
}
|
||||
Err(e) => {
|
||||
Err(
|
||||
sanitize_user_error(
|
||||
&format!("couldn't load workflows: {e}"),
|
||||
),
|
||||
)
|
||||
}
|
||||
};
|
||||
TaskResult::WorkflowsListLoaded {
|
||||
agent_id,
|
||||
session_id,
|
||||
result,
|
||||
}
|
||||
});
|
||||
}
|
||||
Effect::ToggleSkill { agent_id, session_id: _, skill_name, enabled } => {
|
||||
let tx = acp_tx.clone();
|
||||
tasks
|
||||
|
|
@ -3176,6 +3260,28 @@ pub(crate) fn execute(
|
|||
}
|
||||
});
|
||||
}
|
||||
Effect::FetchSessionUsage { agent_id, session_id } => {
|
||||
let tx = acp_tx.clone();
|
||||
tasks
|
||||
.spawn(async move {
|
||||
match fetch_session_usage(&session_id, &tx).await {
|
||||
Ok(usage) => {
|
||||
TaskResult::SessionUsageComplete {
|
||||
agent_id,
|
||||
session_id,
|
||||
usage: Box::new(usage),
|
||||
}
|
||||
}
|
||||
Err(error) => {
|
||||
TaskResult::SessionUsageFailed {
|
||||
agent_id,
|
||||
session_id,
|
||||
error,
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Effect::SendFeedback { agent_id, session_id, feedback_text } => {
|
||||
use xai_grok_shell::session::ClientType;
|
||||
use xai_grok_shell::session::acp_types::ClientFeedbackInput;
|
||||
|
|
@ -3537,11 +3643,11 @@ pub(crate) fn execute(
|
|||
}
|
||||
});
|
||||
}
|
||||
Effect::RefreshAvailableCommands { agent_id, cwd } => {
|
||||
Effect::RefreshAvailableCommands { agent_id, session_id } => {
|
||||
let tx = acp_tx.clone();
|
||||
tasks
|
||||
.spawn(async move {
|
||||
let params = serde_json::json!({ "cwd" : cwd });
|
||||
let params = serde_json::json!({ "sessionId" : session_id });
|
||||
let req = acp::ExtRequest::new(
|
||||
"x.ai/commands/list",
|
||||
serde_json::value::to_raw_value(¶ms)
|
||||
|
|
@ -4198,6 +4304,37 @@ async fn fetch_session_info(
|
|||
}
|
||||
envelope.result.ok_or_else(|| "session info response missing result".to_string())
|
||||
}
|
||||
/// `x.ai/session/usage` → [`PromptUsage`] (bare response, no envelope).
|
||||
async fn fetch_session_usage(
|
||||
session_id: &acp::SessionId,
|
||||
tx: &AcpAgentTx,
|
||||
) -> Result<xai_grok_shell::extensions::notification::PromptUsage, String> {
|
||||
let request = acp::ExtRequest::new(
|
||||
"x.ai/session/usage",
|
||||
serde_json::value::to_raw_value(
|
||||
&serde_json::json!({ "sessionId" : session_id.0.to_string() }),
|
||||
)
|
||||
.expect("serialize session/usage params")
|
||||
.into(),
|
||||
);
|
||||
let resp = acp_send(request, tx)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
if i32::from(e.code) == i32::from(acp::Error::method_not_found().code) {
|
||||
"not supported by this agent version".to_string()
|
||||
} else {
|
||||
sanitize_user_error(&e.to_string())
|
||||
}
|
||||
})?;
|
||||
let parsed: xai_grok_shell::extensions::usage::SessionUsageResponse = serde_json::from_str(
|
||||
resp.0.get(),
|
||||
)
|
||||
.map_err(|e| {
|
||||
tracing::debug!("session usage deser failed: {e}");
|
||||
"invalid session usage response".to_string()
|
||||
})?;
|
||||
Ok(parsed.usage)
|
||||
}
|
||||
/// Look up the session title/summary from local persistence.
|
||||
async fn lookup_session_title(session_id: &acp::SessionId) -> Option<String> {
|
||||
let summaries = xai_grok_shell::session::persistence::list_summaries(None)
|
||||
|
|
|
|||
Loading…
Reference in a new issue