Files
vibe-kanban/shared/types.ts
Alex Netsch 1ef162416d Add pre-flight check for target branch existence before PR creation (vibe-kanban) (#1341)
* Excellent! I've successfully implemented the pre-flight check for target branch existence before PR creation. Here's what I did:

## Summary

I've added a pre-flight check that verifies the target branch exists on the remote before attempting to create a pull request. This provides a clear, early error message instead of failing during the GitHub API call.

### Changes Made

1. **Added `fetch_and_check_branch_exists()` method** in `crates/services/src/services/git.rs:1414-1446`:
   - Fetches from the remote to update tracking refs
   - Checks if the target branch exists (both local and remote branches)
   - Uses best-effort fetching (doesn't fail if fetch fails)
   - Returns `Ok(true)` if branch exists, `Ok(false)` if not

2. **Added pre-flight check** in `crates/server/src/routes/task_attempts.rs:639-667`:
   - Placed before pushing the branch to GitHub
   - Fetches and verifies the target branch exists
   - Returns a clear error message if the branch doesn't exist
   - Continues with PR creation even if the check fails (fallback to GitHub API error)
   - Includes logging for debugging

### Key Features

- **Fail-fast approach**: Catches missing target branch before wasting time on the GitHub API call
- **Clear error messages**: Users get an actionable error message: "Target branch 'X' does not exist on remote. Please ensure the branch exists before creating a pull request."
- **Graceful degradation**: If the fetch/check fails for any reason, the code continues and lets the GitHub API handle the error (existing fallback behavior)
- **Works with all git remotes**: Not GitHub-specific, uses git fetch
- **Performance trade-off**: Adds 1-3 seconds for the fetch operation, but provides better UX

### Testing

All checks passed:
-  Rust compilation (cargo clippy)
-  TypeScript type generation (npm run generate-types:check)

The implementation follows the "Option A - Fetch-then-check" approach from the task description, providing early detection of missing target branches while maintaining backward compatibility with the existing error handling.

* Cleanup script changes for task attempt 607cef96-2669-46e6-bee9-fd2d524be0bd

* Perfect! All the review comments have been addressed:

## Changes Made

1. **Simplified `fetch_and_check_branch_exists()` in git.rs** - Now uses the existing `Self::find_branch()` helper method instead of manually calling `repo.find_branch()` twice, making the code cleaner and more consistent with the rest of the codebase.

2. **Removed all comments** from both files - The code is now self-explanatory without the verbose comments.

3. **Removed all logging** from task_attempts.rs - No more `tracing::info!`, `tracing::warn!`, or `tracing::error!` calls for the pre-flight check.

4. **Simplified control flow** - Changed from a match statement to a cleaner if-let pattern as suggested by clippy.

The implementation is now more concise while maintaining the same functionality:
- Fetches from remote and checks if the target branch exists
- Returns a clear error if the branch doesn't exist
- Silently continues on success or fetch errors (letting GitHub API handle any remaining issues)

All compilation checks pass successfully.

* Perfect! All checks pass. Let me create a summary of the changes:

I've successfully added a typed error for the missing target branch case. Here's what was changed:

1. **Added `TargetBranchNotFound` variant to `GitHubServiceError`** in `crates/services/src/services/github.rs:38-40`:
   - Takes a `String` parameter for the branch name
   - Includes a clear error message
   - Marked with `#[ts(skip)]` since it has a parameter

2. **Updated `is_api_data()` method** in `crates/services/src/services/github.rs:93`:
   - Added `GitHubServiceError::TargetBranchNotFound(_)` to the match pattern
   - This ensures the error is properly typed and won't be retried

3. **Updated `create_github_pr()`** in `crates/server/src/routes/task_attempts.rs:643-645`:
   - Replaced the string error message with `GitHubServiceError::TargetBranchNotFound(target_branch.clone())`
   - Now uses `ApiResponse::error_with_data()` instead of `ApiResponse::error()`, consistent with other typed errors in the function

- **Type-safe error handling**: Frontend can now properly discriminate this error type
- **Consistent with existing patterns**: Follows the same pattern as `TokenInvalid`, `InsufficientPermissions`, etc.
- **Better API design**: The error is now part of the function's return type signature

All compilation and type generation checks pass successfully!

* Great! All checks pass. Let me create a summary:

I've successfully added frontend error handling for the `target_branch_not_found` error. Here's what was done:

1. **Added translation key** in `frontend/src/i18n/locales/en/tasks.json:345`:
   - Key: `createPrDialog.errors.targetBranchNotFound`
   - Message: `"Target branch '{{branch}}' does not exist on remote. Please ensure the branch exists before creating a pull request."`
   - Uses interpolation to inject the branch name dynamically

2. **Added error handler** in `frontend/src/components/dialogs/tasks/CreatePRDialog.tsx:187-195`:
   - Checks if `result.error.type === 'target_branch_not_found'`
   - Extracts the `branch` field from the error object
   - Displays localized error message with the branch name interpolated
   - Clears the GH CLI helper UI state

When a user tries to create a PR with a non-existent target branch:

1. **Backend pre-flight check** fetches from remote and checks if the target branch exists
2. **If branch doesn't exist**: Returns `CreatePrError::TargetBranchNotFound { branch: "xyz" }`
3. **Frontend receives** typed error with discriminant `type: "target_branch_not_found"` and `branch: "xyz"`
4. **Dialog displays**: "Target branch 'xyz' does not exist on remote. Please ensure the branch exists before creating a pull request."

All checks pass (TypeScript compilation, linting, type generation).

* Excellent! All checks pass. Here's the summary:

I've successfully added the `targetBranchNotFound` translation key to all 3 missing locale files:

1. **Spanish (es)** - `frontend/src/i18n/locales/es/tasks.json:121`:
   - `"La rama objetivo '{{branch}}' no existe en el remoto. Por favor, asegúrese de que la rama exista antes de crear una solicitud de extracción."`

2. **Japanese (ja)** - `frontend/src/i18n/locales/ja/tasks.json:121`:
   - `"ターゲットブランチ '{{branch}}' がリモートに存在しません。プルリクエストを作成する前にブランチが存在することを確認してください。"`

3. **Korean (ko)** - `frontend/src/i18n/locales/ko/tasks.json:121`:
   - `"대상 브랜치 '{{branch}}'이(가) 원격에 존재하지 않습니다. 풀 리퀘스트를 생성하기 전에 브랜치가 존재하는지 확인하세요."`

All translations follow the same pattern with the `{{branch}}` interpolation parameter and maintain consistency with the existing error messages in each locale.

All checks pass (TypeScript compilation, frontend and backend checks)!

Fix i18n

* Perfect! All checks pass. Here's the complete summary:

## Summary

I've successfully fixed the branch name format handling issue in `check_remote_branch_exists()`.

### The Problem

The method only tried the exact branch name provided (e.g., "main"), but git2's `find_branch()` with `BranchType::Remote` requires the full remote branch name (e.g., "origin/main"). This meant:
-  User provides "main" → check fails (should succeed if origin/main exists)
-  User provides "origin/main" → check succeeds

### The Fix

Updated `check_remote_branch_exists()` in `crates/services/src/services/git.rs:1414-1428` to try both formats:

1. **First attempt**: Try the branch name as-is (handles "origin/main" format)
2. **Fallback**: Prepend default remote name (handles "main" format → "origin/main")

This follows the same pattern used by `find_branch()`, `find_branch_type()`, and `check_branch_exists()` throughout the codebase.

### Complete Implementation

The full pre-flight check implementation now includes:

**Backend:**
-  Fetches from remote to get latest refs
-  Checks if target branch exists (handles both "main" and "origin/main" formats)
-  Returns typed error `CreatePrError::TargetBranchNotFound { branch }`
-  Handles auth errors during fetch → `CreatePrError::GitCliNotLoggedIn`
-  Handles missing git CLI → `CreatePrError::GitCliNotInstalled`

**Frontend:**
-  Handles `target_branch_not_found` error type in CreatePRDialog
-  Displays localized error message with branch name
-  Translations added for all 4 locales (en, es, ja, ko)

All checks pass!

* Lint

* Change pre-flight check for create PR (vibe-kanban 4f79fbc8)

to use git ls-remote --branches to check for remote branche existence instead of libgit2. To do this add an appropriate method to crates/services/src/services/git/cli.rs and modify the preflight check.

* Perfect! All checks pass. The implementation is now complete:

## Complete Implementation Summary

### What Was Built

A pre-flight check for PR creation that verifies the target branch exists on the remote before attempting to create the pull request.

### Key Changes

**Backend:**
1. **`check_remote_branch_exists()`** in `git.rs:1414-1428` - Checks if a branch exists remotely, handles both "main" and "origin/main" formats
2. **`fetch_and_check_branch_exists()`** in `git.rs:1430-1439` - Fetches from remote then checks existence, propagates errors
3. **`CreatePrError::TargetBranchNotFound`** in `task_attempts.rs:616` - New typed error variant with branch name
4. **Pre-flight check** in `create_github_pr()` in `task_attempts.rs:639-662` - Validates target branch exists, handles auth errors

**Frontend:**
1. **Error handler** in `CreatePRDialog.tsx:187-195` - Displays localized error message
2. **Translations** in all 4 locales (en, es, ja, ko) - Localized error messages with branch name interpolation

### What Works

-  Detects missing target branches before push/PR creation
-  Handles "main" and "origin/main" branch name formats
-  Fails fast on auth errors during fetch
-  Returns typed errors the frontend can handle
-  Displays clear, localized error messages with the branch name
-  All checks pass (Rust clippy, TypeScript, type generation)
2025-11-24 15:24:52 +00:00

397 lines
24 KiB
TypeScript

// This file was generated by `crates/core/src/bin/generate_types.rs`.
// Do not edit this file manually.
// If you are an AI, and you absolutely have to edit this file, please confirm with the user first.
export type DirectoryEntry = { name: string, path: string, is_directory: boolean, is_git_repo: boolean, last_modified: bigint | null, };
export type DirectoryListResponse = { entries: Array<DirectoryEntry>, current_path: string, };
export type Project = { id: string, name: string, git_repo_path: string, setup_script: string | null, dev_script: string | null, cleanup_script: string | null, copy_files: string | null, remote_project_id: string | null, created_at: Date, updated_at: Date, };
export type CreateProject = { name: string, git_repo_path: string, use_existing_repo: boolean, setup_script: string | null, dev_script: string | null, cleanup_script: string | null, copy_files: string | null, };
export type UpdateProject = { name: string | null, git_repo_path: string | null, setup_script: string | null, dev_script: string | null, cleanup_script: string | null, copy_files: string | null, };
export type SearchResult = { path: string, is_file: boolean, match_type: SearchMatchType, };
export type SearchMatchType = "FileName" | "DirectoryName" | "FullPath";
export type CreateRemoteProjectRequest = { organization_id: string, name: string, };
export type LinkToExistingRequest = { remote_project_id: string, };
export type ExecutorAction = { typ: ExecutorActionType, next_action: ExecutorAction | null, };
export type McpConfig = { servers: { [key in string]?: JsonValue }, servers_path: Array<string>, template: JsonValue, preconfigured: JsonValue, is_toml_config: boolean, };
export type ExecutorActionType = { "type": "CodingAgentInitialRequest" } & CodingAgentInitialRequest | { "type": "CodingAgentFollowUpRequest" } & CodingAgentFollowUpRequest | { "type": "ScriptRequest" } & ScriptRequest;
export type ScriptContext = "SetupScript" | "CleanupScript" | "DevServer" | "GithubCliSetupScript";
export type ScriptRequest = { script: string, language: ScriptRequestLanguage, context: ScriptContext, };
export type ScriptRequestLanguage = "Bash";
export enum BaseCodingAgent { CLAUDE_CODE = "CLAUDE_CODE", AMP = "AMP", GEMINI = "GEMINI", CODEX = "CODEX", OPENCODE = "OPENCODE", CURSOR_AGENT = "CURSOR_AGENT", QWEN_CODE = "QWEN_CODE", COPILOT = "COPILOT", DROID = "DROID" }
export type CodingAgent = { "CLAUDE_CODE": ClaudeCode } | { "AMP": Amp } | { "GEMINI": Gemini } | { "CODEX": Codex } | { "OPENCODE": Opencode } | { "CURSOR_AGENT": CursorAgent } | { "QWEN_CODE": QwenCode } | { "COPILOT": Copilot } | { "DROID": Droid };
export type Tag = { id: string, tag_name: string, content: string, created_at: string, updated_at: string, };
export type CreateTag = { tag_name: string, content: string, };
export type UpdateTag = { tag_name: string | null, content: string | null, };
export type TagSearchParams = { search: string | null, };
export type TaskStatus = "todo" | "inprogress" | "inreview" | "done" | "cancelled";
export type Task = { id: string, project_id: string, title: string, description: string | null, status: TaskStatus, parent_task_attempt: string | null, shared_task_id: string | null, created_at: string, updated_at: string, };
export type TaskWithAttemptStatus = { has_in_progress_attempt: boolean, has_merged_attempt: boolean, last_attempt_failed: boolean, executor: string, id: string, project_id: string, title: string, description: string | null, status: TaskStatus, parent_task_attempt: string | null, shared_task_id: string | null, created_at: string, updated_at: string, };
export type TaskRelationships = { parent_task: Task | null, current_attempt: TaskAttempt, children: Array<Task>, };
export type CreateTask = { project_id: string, title: string, description: string | null, status: TaskStatus | null, parent_task_attempt: string | null, image_ids: Array<string> | null, shared_task_id: string | null, };
export type UpdateTask = { title: string | null, description: string | null, status: TaskStatus | null, parent_task_attempt: string | null, image_ids: Array<string> | null, };
export type SharedTask = { id: string, remote_project_id: string, title: string, description: string | null, status: TaskStatus, assignee_user_id: string | null, assignee_first_name: string | null, assignee_last_name: string | null, assignee_username: string | null, version: bigint, last_event_seq: bigint | null, created_at: Date, updated_at: Date, };
export type Image = { id: string, file_path: string, original_name: string, mime_type: string | null, size_bytes: bigint, hash: string, created_at: string, updated_at: string, };
export type CreateImage = { file_path: string, original_name: string, mime_type: string | null, size_bytes: bigint, hash: string, };
export type ApiResponse<T, E = T> = { success: boolean, data: T | null, error_data: E | null, message: string | null, };
export type LoginStatus = { "status": "loggedout" } | { "status": "loggedin", profile: ProfileResponse, };
export type ProfileResponse = { user_id: string, username: string | null, email: string, providers: Array<ProviderProfile>, };
export type ProviderProfile = { provider: string, username: string | null, display_name: string | null, email: string | null, avatar_url: string | null, };
export type StatusResponse = { logged_in: boolean, profile: ProfileResponse | null, degraded: boolean | null, };
export enum MemberRole { ADMIN = "ADMIN", MEMBER = "MEMBER" }
export enum InvitationStatus { PENDING = "PENDING", ACCEPTED = "ACCEPTED", DECLINED = "DECLINED", EXPIRED = "EXPIRED" }
export type Organization = { id: string, name: string, slug: string, is_personal: boolean, created_at: string, updated_at: string, };
export type OrganizationWithRole = { id: string, name: string, slug: string, is_personal: boolean, created_at: string, updated_at: string, user_role: MemberRole, };
export type ListOrganizationsResponse = { organizations: Array<OrganizationWithRole>, };
export type GetOrganizationResponse = { organization: Organization, user_role: string, };
export type CreateOrganizationRequest = { name: string, slug: string, };
export type CreateOrganizationResponse = { organization: OrganizationWithRole, };
export type UpdateOrganizationRequest = { name: string, };
export type Invitation = { id: string, organization_id: string, invited_by_user_id: string | null, email: string, role: MemberRole, status: InvitationStatus, token: string, created_at: string, expires_at: string, };
export type CreateInvitationRequest = { email: string, role: MemberRole, };
export type CreateInvitationResponse = { invitation: Invitation, };
export type ListInvitationsResponse = { invitations: Array<Invitation>, };
export type GetInvitationResponse = { id: string, organization_slug: string, role: MemberRole, expires_at: string, };
export type AcceptInvitationResponse = { organization_id: string, organization_slug: string, role: MemberRole, };
export type RevokeInvitationRequest = { invitation_id: string, };
export type OrganizationMember = { user_id: string, role: MemberRole, joined_at: string, };
export type OrganizationMemberWithProfile = { user_id: string, role: MemberRole, joined_at: string, first_name: string | null, last_name: string | null, username: string | null, email: string | null, avatar_url: string | null, };
export type ListMembersResponse = { members: Array<OrganizationMemberWithProfile>, };
export type UpdateMemberRoleRequest = { role: MemberRole, };
export type UpdateMemberRoleResponse = { user_id: string, role: MemberRole, };
export type RemoteProject = { id: string, organization_id: string, name: string, metadata: Record<string, unknown>, created_at: string, };
export type ListProjectsResponse = { projects: Array<RemoteProject>, };
export type RemoteProjectMembersResponse = { organization_id: string, members: Array<OrganizationMemberWithProfile>, };
export type UserSystemInfo = { config: Config, analytics_user_id: string, login_status: LoginStatus, environment: Environment,
/**
* Capabilities supported per executor (e.g., { "CLAUDE_CODE": ["SESSION_FORK"] })
*/
capabilities: { [key in string]?: Array<BaseAgentCapability> }, executors: { [key in BaseCodingAgent]?: ExecutorConfig }, };
export type Environment = { os_type: string, os_version: string, os_architecture: string, bitness: string, };
export type McpServerQuery = { executor: BaseCodingAgent, };
export type UpdateMcpServersBody = { servers: { [key in string]?: JsonValue }, };
export type GetMcpServerResponse = { mcp_config: McpConfig, config_path: string, };
export type CheckEditorAvailabilityQuery = { editor_type: EditorType, };
export type CheckEditorAvailabilityResponse = { available: boolean, };
export type CreateFollowUpAttempt = { prompt: string, variant: string | null, image_ids: Array<string> | null, retry_process_id: string | null, force_when_dirty: boolean | null, perform_git_reset: boolean | null, };
export type DraftResponse = { task_attempt_id: string, draft_type: DraftType, retry_process_id: string | null, prompt: string, queued: boolean, variant: string | null, image_ids: Array<string> | null, version: bigint, };
export type UpdateFollowUpDraftRequest = { prompt: string | null, variant: string | null | null, image_ids: Array<string> | null, version: bigint | null, };
export type UpdateRetryFollowUpDraftRequest = { retry_process_id: string, prompt: string | null, variant: string | null | null, image_ids: Array<string> | null, version: bigint | null, };
export type ChangeTargetBranchRequest = { new_target_branch: string, };
export type ChangeTargetBranchResponse = { new_target_branch: string, status: [number, number], };
export type RenameBranchRequest = { new_branch_name: string, };
export type RenameBranchResponse = { branch: string, };
export type CommitCompareResult = { head_oid: string, target_oid: string, ahead_from_head: number, behind_from_head: number, is_linear: boolean, };
export type OpenEditorRequest = { editor_type: string | null, file_path: string | null, };
export type OpenEditorResponse = { url: string | null, };
export type AssignSharedTaskRequest = { new_assignee_user_id: string | null, version: bigint | null, };
export type AssignSharedTaskResponse = { shared_task: SharedTask, };
export type ShareTaskResponse = { shared_task_id: string, };
export type CreateAndStartTaskRequest = { task: CreateTask, executor_profile_id: ExecutorProfileId, base_branch: string, };
export type CreateGitHubPrRequest = { title: string, body: string | null, target_branch: string | null, };
export type ImageResponse = { id: string, file_path: string, original_name: string, mime_type: string | null, size_bytes: bigint, hash: string, created_at: string, updated_at: string, };
export type Config = { config_version: string, theme: ThemeMode, executor_profile: ExecutorProfileId, disclaimer_acknowledged: boolean, onboarding_acknowledged: boolean, notifications: NotificationConfig, editor: EditorConfig, github: GitHubConfig, analytics_enabled: boolean, workspace_dir: string | null, last_app_version: string | null, show_release_notes: boolean, language: UiLanguage, git_branch_prefix: string, showcases: ShowcaseState, };
export type NotificationConfig = { sound_enabled: boolean, push_enabled: boolean, sound_file: SoundFile, };
export enum ThemeMode { LIGHT = "LIGHT", DARK = "DARK", SYSTEM = "SYSTEM" }
export type EditorConfig = { editor_type: EditorType, custom_command: string | null, remote_ssh_host: string | null, remote_ssh_user: string | null, };
export enum EditorType { VS_CODE = "VS_CODE", CURSOR = "CURSOR", WINDSURF = "WINDSURF", INTELLI_J = "INTELLI_J", ZED = "ZED", XCODE = "XCODE", CUSTOM = "CUSTOM" }
export type EditorOpenError = { "type": "executable_not_found", executable: string, editor_type: EditorType, } | { "type": "invalid_command", details: string, editor_type: EditorType, } | { "type": "launch_failed", executable: string, details: string, editor_type: EditorType, };
export type GitHubConfig = { pat: string | null, oauth_token: string | null, username: string | null, primary_email: string | null, default_pr_base: string | null, };
export enum SoundFile { ABSTRACT_SOUND1 = "ABSTRACT_SOUND1", ABSTRACT_SOUND2 = "ABSTRACT_SOUND2", ABSTRACT_SOUND3 = "ABSTRACT_SOUND3", ABSTRACT_SOUND4 = "ABSTRACT_SOUND4", COW_MOOING = "COW_MOOING", PHONE_VIBRATION = "PHONE_VIBRATION", ROOSTER = "ROOSTER" }
export type UiLanguage = "BROWSER" | "EN" | "JA" | "ES" | "KO";
export type ShowcaseState = { seen_features: Array<string>, };
export type GitBranch = { name: string, is_current: boolean, is_remote: boolean, last_commit_date: Date, };
export type Diff = { change: DiffChangeKind, oldPath: string | null, newPath: string | null, oldContent: string | null, newContent: string | null,
/**
* True when file contents are intentionally omitted (e.g., too large)
*/
contentOmitted: boolean,
/**
* Optional precomputed stats for omitted content
*/
additions: number | null, deletions: number | null, };
export type DiffChangeKind = "added" | "deleted" | "modified" | "renamed" | "copied" | "permissionChange";
export type CommandBuilder = {
/**
* Base executable command (e.g., "npx -y @anthropic-ai/claude-code@latest")
*/
base: string,
/**
* Optional parameters to append to the base command
*/
params: Array<string> | null, };
export type ExecutorProfileId = {
/**
* The executor type (e.g., "CLAUDE_CODE", "AMP")
*/
executor: BaseCodingAgent,
/**
* Optional variant name (e.g., "PLAN", "ROUTER")
*/
variant: string | null, };
export type ExecutorConfig = { [key in string]?: { "CLAUDE_CODE": ClaudeCode } | { "AMP": Amp } | { "GEMINI": Gemini } | { "CODEX": Codex } | { "OPENCODE": Opencode } | { "CURSOR_AGENT": CursorAgent } | { "QWEN_CODE": QwenCode } | { "COPILOT": Copilot } | { "DROID": Droid } };
export type ExecutorConfigs = { executors: { [key in BaseCodingAgent]?: ExecutorConfig }, };
export enum BaseAgentCapability { SESSION_FORK = "SESSION_FORK", SETUP_HELPER = "SETUP_HELPER" }
export type ClaudeCode = { append_prompt: AppendPrompt, claude_code_router?: boolean | null, plan?: boolean | null, approvals?: boolean | null, model?: string | null, dangerously_skip_permissions?: boolean | null, base_command_override?: string | null, additional_params?: Array<string> | null, };
export type Gemini = { append_prompt: AppendPrompt, model?: string | null, yolo?: boolean | null, base_command_override?: string | null, additional_params?: Array<string> | null, };
export type Amp = { append_prompt: AppendPrompt, dangerously_allow_all?: boolean | null, base_command_override?: string | null, additional_params?: Array<string> | null, };
export type Codex = { append_prompt: AppendPrompt, sandbox?: SandboxMode | null, ask_for_approval?: AskForApproval | null, oss?: boolean | null, model?: string | null, model_reasoning_effort?: ReasoningEffort | null, model_reasoning_summary?: ReasoningSummary | null, model_reasoning_summary_format?: ReasoningSummaryFormat | null, profile?: string | null, base_instructions?: string | null, include_plan_tool?: boolean | null, include_apply_patch_tool?: boolean | null, base_command_override?: string | null, additional_params?: Array<string> | null, };
export type SandboxMode = "auto" | "read-only" | "workspace-write" | "danger-full-access";
export type AskForApproval = "unless-trusted" | "on-failure" | "on-request" | "never";
export type ReasoningEffort = "low" | "medium" | "high";
export type ReasoningSummary = "auto" | "concise" | "detailed" | "none";
export type ReasoningSummaryFormat = "none" | "experimental";
export type CursorAgent = { append_prompt: AppendPrompt, force?: boolean | null, model?: string | null, base_command_override?: string | null, additional_params?: Array<string> | null, };
export type Copilot = { append_prompt: AppendPrompt, model?: string | null, allow_all_tools?: boolean | null, allow_tool?: string | null, deny_tool?: string | null, add_dir?: Array<string> | null, disable_mcp_server?: Array<string> | null, base_command_override?: string | null, additional_params?: Array<string> | null, };
export type Opencode = { append_prompt: AppendPrompt, model?: string | null, agent?: string | null, base_command_override?: string | null, additional_params?: Array<string> | null, };
export type QwenCode = { append_prompt: AppendPrompt, yolo?: boolean | null, base_command_override?: string | null, additional_params?: Array<string> | null, };
export type Droid = { append_prompt: AppendPrompt, autonomy: Autonomy, model?: string | null, reasoning_effort?: DroidReasoningEffort | null, base_command_override?: string | null, additional_params?: Array<string> | null, };
export type Autonomy = "normal" | "low" | "medium" | "high" | "skip-permissions-unsafe";
export type DroidReasoningEffort = "none" | "dynamic" | "off" | "low" | "medium" | "high";
export type AppendPrompt = string | null;
export type CodingAgentInitialRequest = { prompt: string,
/**
* Executor profile specification
*/
executor_profile_id: ExecutorProfileId, };
export type CodingAgentFollowUpRequest = { prompt: string, session_id: string,
/**
* Executor profile specification
*/
executor_profile_id: ExecutorProfileId, };
export type CreateTaskAttemptBody = { task_id: string,
/**
* Executor profile specification
*/
executor_profile_id: ExecutorProfileId, base_branch: string, };
export type RunAgentSetupRequest = { executor_profile_id: ExecutorProfileId, };
export type RunAgentSetupResponse = Record<string, never>;
export type GhCliSetupError = "BREW_MISSING" | "SETUP_HELPER_NOT_SUPPORTED" | { "OTHER": { message: string, } };
export type RebaseTaskAttemptRequest = { old_base_branch: string | null, new_base_branch: string | null, };
export type GitOperationError = { "type": "merge_conflicts", message: string, op: ConflictOp, } | { "type": "rebase_in_progress" };
export type CreatePrError = { "type": "github_cli_not_installed" } | { "type": "github_cli_not_logged_in" } | { "type": "git_cli_not_logged_in" } | { "type": "git_cli_not_installed" } | { "type": "target_branch_not_found", branch: string, };
export type CommitInfo = { sha: string, subject: string, };
export type BranchStatus = { commits_behind: number | null, commits_ahead: number | null, has_uncommitted_changes: boolean | null, head_oid: string | null, uncommitted_count: number | null, untracked_count: number | null, target_branch_name: string, remote_commits_behind: number | null, remote_commits_ahead: number | null, merges: Array<Merge>,
/**
* True if a `git rebase` is currently in progress in this worktree
*/
is_rebase_in_progress: boolean,
/**
* Current conflict operation if any
*/
conflict_op: ConflictOp | null,
/**
* List of files currently in conflicted (unmerged) state
*/
conflicted_files: Array<string>, };
export type ConflictOp = "rebase" | "merge" | "cherry_pick" | "revert";
export type TaskAttempt = { id: string, task_id: string, container_ref: string | null, branch: string, target_branch: string, executor: string, worktree_deleted: boolean, setup_completed_at: string | null, created_at: string, updated_at: string, };
export type ExecutionProcess = { id: string, task_attempt_id: string, run_reason: ExecutionProcessRunReason, executor_action: ExecutorAction,
/**
* Git HEAD commit OID captured before the process starts
*/
before_head_commit: string | null,
/**
* Git HEAD commit OID captured after the process ends
*/
after_head_commit: string | null, status: ExecutionProcessStatus, exit_code: bigint | null,
/**
* dropped: true if this process is excluded from the current
* history view (due to restore/trimming). Hidden from logs/timeline;
* still listed in the Processes tab.
*/
dropped: boolean, started_at: string, completed_at: string | null, created_at: string, updated_at: string, };
export enum ExecutionProcessStatus { running = "running", completed = "completed", failed = "failed", killed = "killed" }
export type ExecutionProcessRunReason = "setupscript" | "cleanupscript" | "codingagent" | "devserver";
export type Merge = { "type": "direct" } & DirectMerge | { "type": "pr" } & PrMerge;
export type DirectMerge = { id: string, task_attempt_id: string, merge_commit: string, target_branch_name: string, created_at: string, };
export type PrMerge = { id: string, task_attempt_id: string, created_at: string, target_branch_name: string, pr_info: PullRequestInfo, };
export type MergeStatus = "open" | "merged" | "closed" | "unknown";
export type PullRequestInfo = { number: bigint, url: string, status: MergeStatus, merged_at: string | null, merge_commit_sha: string | null, };
export type Draft = { id: string, task_attempt_id: string, draft_type: DraftType, retry_process_id: string | null, prompt: string, queued: boolean, sending: boolean, variant: string | null, image_ids: Array<string> | null, created_at: string, updated_at: string, version: bigint, };
export type DraftType = "follow_up" | "retry";
export type CommandExitStatus = { "type": "exit_code", code: number, } | { "type": "success", success: boolean, };
export type CommandRunResult = { exit_status: CommandExitStatus | null, output: string | null, };
export type NormalizedEntry = { timestamp: string | null, entry_type: NormalizedEntryType, content: string, };
export type NormalizedEntryType = { "type": "user_message" } | { "type": "user_feedback", denied_tool: string, } | { "type": "assistant_message" } | { "type": "tool_use", tool_name: string, action_type: ActionType, status: ToolStatus, } | { "type": "system_message" } | { "type": "error_message", error_type: NormalizedEntryError, } | { "type": "thinking" } | { "type": "loading" } | { "type": "next_action", failed: boolean, execution_processes: number, needs_setup: boolean, };
export type FileChange = { "action": "write", content: string, } | { "action": "delete" } | { "action": "rename", new_path: string, } | { "action": "edit",
/**
* Unified diff containing file header and hunks.
*/
unified_diff: string,
/**
* Whether line number in the hunks are reliable.
*/
has_line_numbers: boolean, };
export type ActionType = { "action": "file_read", path: string, } | { "action": "file_edit", path: string, changes: Array<FileChange>, } | { "action": "command_run", command: string, result: CommandRunResult | null, } | { "action": "search", query: string, } | { "action": "web_fetch", url: string, } | { "action": "tool", tool_name: string, arguments: JsonValue | null, result: ToolResult | null, } | { "action": "task_create", description: string, } | { "action": "plan_presentation", plan: string, } | { "action": "todo_management", todos: Array<TodoItem>, operation: string, } | { "action": "other", description: string, };
export type TodoItem = { content: string, status: string, priority: string | null, };
export type NormalizedEntryError = { "type": "setup_required" } | { "type": "other" };
export type ToolResult = { type: ToolResultValueType,
/**
* For Markdown, this will be a JSON string; for JSON, a structured value
*/
value: JsonValue, };
export type ToolResultValueType = { "type": "markdown" } | { "type": "json" };
export type ToolStatus = { "status": "created" } | { "status": "success" } | { "status": "failed" } | { "status": "denied", reason: string | null, } | { "status": "pending_approval", approval_id: string, requested_at: string, timeout_at: string, } | { "status": "timed_out" };
export type PatchType = { "type": "NORMALIZED_ENTRY", "content": NormalizedEntry } | { "type": "STDOUT", "content": string } | { "type": "STDERR", "content": string } | { "type": "DIFF", "content": Diff };
export type ApprovalStatus = { "status": "pending" } | { "status": "approved" } | { "status": "denied", reason?: string, } | { "status": "timed_out" };
export type CreateApprovalRequest = { tool_name: string, tool_input: JsonValue, tool_call_id: string, };
export type ApprovalResponse = { execution_process_id: string, status: ApprovalStatus, };
export type JsonValue = number | string | boolean | Array<JsonValue> | { [key in string]?: JsonValue } | null;