Disable Edit & Retry feature for agents that don't implement session forking (#750)
This commit is contained in:
@@ -31,7 +31,7 @@ pub mod qwen;
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, TS)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
pub enum BaseAgentCapability {
|
||||
RestoreCheckpoint,
|
||||
SessionFork,
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
@@ -122,9 +122,9 @@ impl CodingAgent {
|
||||
|
||||
pub fn capabilities(&self) -> Vec<BaseAgentCapability> {
|
||||
match self {
|
||||
Self::ClaudeCode(_) => vec![BaseAgentCapability::RestoreCheckpoint],
|
||||
Self::Amp(_) => vec![BaseAgentCapability::RestoreCheckpoint],
|
||||
Self::Codex(_) => vec![BaseAgentCapability::RestoreCheckpoint],
|
||||
Self::ClaudeCode(_) => vec![BaseAgentCapability::SessionFork],
|
||||
Self::Amp(_) => vec![BaseAgentCapability::SessionFork],
|
||||
Self::Codex(_) => vec![BaseAgentCapability::SessionFork],
|
||||
Self::Gemini(_) | Self::Opencode(_) | Self::Cursor(_) | Self::QwenCode(_) => vec![],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ pub struct UserSystemInfo {
|
||||
#[serde(flatten)]
|
||||
pub profiles: ExecutorConfigs,
|
||||
pub environment: Environment,
|
||||
/// Capabilities supported per executor (e.g., { "CLAUDE_CODE": ["RESTORE_CHECKPOINT"] })
|
||||
/// Capabilities supported per executor (e.g., { "CLAUDE_CODE": ["SESSION_FORK"] })
|
||||
pub capabilities: HashMap<String, Vec<BaseAgentCapability>>,
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ import { Pencil, Send, X } from 'lucide-react';
|
||||
import { useState } from 'react';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { useProcessRetry } from '@/hooks/useProcessRetry';
|
||||
import { TaskAttempt } from 'shared/types';
|
||||
import { TaskAttempt, type BaseAgentCapability } from 'shared/types';
|
||||
import { useUserSystem } from '@/components/config-provider';
|
||||
|
||||
const UserMessage = ({
|
||||
content,
|
||||
@@ -18,6 +19,14 @@ const UserMessage = ({
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const [editContent, setEditContent] = useState(content);
|
||||
const retryHook = useProcessRetry(taskAttempt);
|
||||
const { capabilities } = useUserSystem();
|
||||
|
||||
const canFork = !!(
|
||||
taskAttempt?.executor &&
|
||||
capabilities?.[taskAttempt.executor]?.includes(
|
||||
'SESSION_FORK' as BaseAgentCapability
|
||||
)
|
||||
);
|
||||
|
||||
const handleEdit = () => {
|
||||
if (!executionProcessId) return;
|
||||
@@ -42,7 +51,7 @@ const UserMessage = ({
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{executionProcessId && (
|
||||
{executionProcessId && canFork && (
|
||||
<div className="flex flex-col">
|
||||
<Button
|
||||
onClick={() => setIsEditing(!isEditing)}
|
||||
|
||||
@@ -60,7 +60,7 @@ export type ApiResponse<T, E = T> = { success: boolean, data: T | null, error_da
|
||||
|
||||
export type UserSystemInfo = { config: Config, environment: Environment,
|
||||
/**
|
||||
* Capabilities supported per executor (e.g., { "CLAUDE_CODE": ["RESTORE_CHECKPOINT"] })
|
||||
* Capabilities supported per executor (e.g., { "CLAUDE_CODE": ["SESSION_FORK"] })
|
||||
*/
|
||||
capabilities: { [key in string]?: Array<BaseAgentCapability> }, executors: { [key in BaseCodingAgent]?: ExecutorConfig }, };
|
||||
|
||||
@@ -136,7 +136,7 @@ variant: string | null, };
|
||||
|
||||
export type ExecutorConfig = { [key in string]?: { "CLAUDE_CODE": ClaudeCode } | { "AMP": Amp } | { "GEMINI": Gemini } | { "CODEX": Codex } | { "OPENCODE": Opencode } | { "CURSOR": Cursor } | { "QWEN_CODE": QwenCode } };
|
||||
|
||||
export type BaseAgentCapability = "RESTORE_CHECKPOINT";
|
||||
export type BaseAgentCapability = "SESSION_FORK";
|
||||
|
||||
export type ClaudeCode = { append_prompt: AppendPrompt, claude_code_router?: boolean | null, plan?: boolean | null, model?: string | null, dangerously_skip_permissions?: boolean | null, base_command_override?: string | null, additional_params?: Array<string> | null, };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user