
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="23514e15-9236-5b96-8f3e-02836b65c0b8")}catch(e){}}();
import { z } from "zod";
export const runtimeWorkspaceFileStatusSchema = z.enum([
    "modified",
    "added",
    "deleted",
    "renamed",
    "copied",
    "untracked",
    "unknown",
]);
export const runtimeWorkspaceFileChangeSchema = z.object({
    path: z.string(),
    previousPath: z.string().optional(),
    status: runtimeWorkspaceFileStatusSchema,
    additions: z.number(),
    deletions: z.number(),
    oldText: z.string().nullable(),
    newText: z.string().nullable(),
});
export const runtimeWorkspaceChangesRequestSchema = z.object({
    taskId: z.string(),
    baseRef: z.string(),
    mode: z.enum(["working_copy", "last_turn"]).optional(),
});
export const runtimeWorkspaceChangesModeSchema = z.enum(["working_copy", "last_turn"]);
export const runtimeWorkspaceChangesResponseSchema = z.object({
    repoRoot: z.string(),
    generatedAt: z.number(),
    files: z.array(runtimeWorkspaceFileChangeSchema),
});
export const runtimeWorkspaceFileSearchRequestSchema = z.object({
    query: z.string(),
    limit: z.number().int().positive().optional(),
});
export const runtimeWorkspaceFileSearchMatchSchema = z.object({
    path: z.string(),
    name: z.string(),
    changed: z.boolean(),
});
export const runtimeWorkspaceFileSearchResponseSchema = z.object({
    query: z.string(),
    files: z.array(runtimeWorkspaceFileSearchMatchSchema),
});
export const runtimeSlashCommandSchema = z.object({
    name: z.string(),
    instructions: z.string(),
    description: z.string().optional(),
});
export const runtimeSlashCommandsResponseSchema = z.object({
    commands: z.array(runtimeSlashCommandSchema),
});
export const runtimeAgentIdSchema = z.enum(["claude", "codex", "gemini", "opencode", "droid", "cline"]);
export const runtimeBoardColumnIdSchema = z.enum(["backlog", "in_progress", "review", "trash"]);
export const runtimeTaskAutoReviewModeSchema = z.enum(["commit", "pr", "move_to_trash"]);
export const runtimeTaskImageSchema = z.object({
    id: z.string(),
    data: z.string(),
    mimeType: z.string(),
    name: z.string().optional(),
});
export const runtimeBoardCardSchema = z.object({
    id: z.string(),
    prompt: z.string(),
    startInPlanMode: z.boolean(),
    autoReviewEnabled: z.boolean().optional(),
    autoReviewMode: runtimeTaskAutoReviewModeSchema.optional(),
    images: z.array(runtimeTaskImageSchema).optional(),
    baseRef: z.string(),
    createdAt: z.number(),
    updatedAt: z.number(),
});
export const runtimeBoardColumnSchema = z.object({
    id: runtimeBoardColumnIdSchema,
    title: z.string(),
    cards: z.array(runtimeBoardCardSchema),
});
export const runtimeBoardDependencySchema = z.object({
    id: z.string(),
    fromTaskId: z.string(),
    toTaskId: z.string(),
    createdAt: z.number(),
});
export const runtimeBoardDataSchema = z.object({
    columns: z.array(runtimeBoardColumnSchema),
    dependencies: z.array(runtimeBoardDependencySchema).default([]),
});
export const runtimeGitRepositoryInfoSchema = z.object({
    currentBranch: z.string().nullable(),
    defaultBranch: z.string().nullable(),
    branches: z.array(z.string()),
});
export const runtimeGitSyncActionSchema = z.enum(["fetch", "pull", "push"]);
export const runtimeGitSyncSummarySchema = z.object({
    currentBranch: z.string().nullable(),
    upstreamBranch: z.string().nullable(),
    changedFiles: z.number(),
    additions: z.number(),
    deletions: z.number(),
    aheadCount: z.number(),
    behindCount: z.number(),
});
export const runtimeGitSummaryResponseSchema = z.object({
    ok: z.boolean(),
    summary: runtimeGitSyncSummarySchema,
    error: z.string().optional(),
});
export const runtimeGitSyncResponseSchema = z.object({
    ok: z.boolean(),
    action: runtimeGitSyncActionSchema,
    summary: runtimeGitSyncSummarySchema,
    output: z.string(),
    error: z.string().optional(),
});
export const runtimeGitCheckoutRequestSchema = z.object({
    branch: z.string(),
});
export const runtimeGitCheckoutResponseSchema = z.object({
    ok: z.boolean(),
    branch: z.string(),
    summary: runtimeGitSyncSummarySchema,
    output: z.string(),
    error: z.string().optional(),
});
export const runtimeGitDiscardResponseSchema = z.object({
    ok: z.boolean(),
    summary: runtimeGitSyncSummarySchema,
    output: z.string(),
    error: z.string().optional(),
});
export const runtimeTaskSessionStateSchema = z.enum(["idle", "running", "awaiting_review", "failed", "interrupted"]);
export const runtimeTaskSessionModeSchema = z.enum(["act", "plan"]);
export const runtimeTaskSessionReviewReasonSchema = z
    .enum(["attention", "exit", "error", "interrupted", "hook"])
    .nullable();
export const runtimeTaskHookActivitySchema = z.object({
    activityText: z.string().nullable().default(null),
    toolName: z.string().nullable().default(null),
    toolInputSummary: z.string().nullable().default(null),
    finalMessage: z.string().nullable().default(null),
    hookEventName: z.string().nullable().default(null),
    notificationType: z.string().nullable().default(null),
    source: z.string().nullable().default(null),
});
export const runtimeTaskTurnCheckpointSchema = z.object({
    turn: z.number().int().positive(),
    ref: z.string(),
    commit: z.string(),
    createdAt: z.number(),
});
export const runtimeTaskSessionSummarySchema = z.object({
    taskId: z.string(),
    state: runtimeTaskSessionStateSchema,
    mode: runtimeTaskSessionModeSchema.nullable().optional(),
    agentId: runtimeAgentIdSchema.nullable(),
    workspacePath: z.string().nullable(),
    pid: z.number().nullable(),
    startedAt: z.number().nullable(),
    updatedAt: z.number(),
    lastOutputAt: z.number().nullable(),
    reviewReason: runtimeTaskSessionReviewReasonSchema,
    exitCode: z.number().nullable(),
    lastHookAt: z.number().nullable().default(null),
    latestHookActivity: runtimeTaskHookActivitySchema.nullable().default(null),
    warningMessage: z.string().nullable().optional(),
    latestTurnCheckpoint: runtimeTaskTurnCheckpointSchema.nullable().optional(),
    previousTurnCheckpoint: runtimeTaskTurnCheckpointSchema.nullable().optional(),
});
export const runtimeWorkspaceStateResponseSchema = z.object({
    repoPath: z.string(),
    statePath: z.string(),
    git: runtimeGitRepositoryInfoSchema,
    board: runtimeBoardDataSchema,
    sessions: z.record(z.string(), runtimeTaskSessionSummarySchema),
    revision: z.number(),
});
export const runtimeWorkspaceStateSaveRequestSchema = z.object({
    board: runtimeBoardDataSchema,
    sessions: z.record(z.string(), runtimeTaskSessionSummarySchema),
    expectedRevision: z.number().int().nonnegative().optional(),
});
export const runtimeWorkspaceStateConflictResponseSchema = z.object({
    error: z.string(),
    currentRevision: z.number(),
});
export const runtimeWorkspaceStateNotifyResponseSchema = z.object({
    ok: z.boolean(),
});
export const runtimeProjectTaskCountsSchema = z.object({
    backlog: z.number(),
    in_progress: z.number(),
    review: z.number(),
    trash: z.number(),
});
export const runtimeProjectSummarySchema = z.object({
    id: z.string(),
    path: z.string(),
    name: z.string(),
    taskCounts: runtimeProjectTaskCountsSchema,
});
export const runtimeTaskWorkspaceMetadataSchema = z.object({
    taskId: z.string(),
    path: z.string(),
    exists: z.boolean(),
    baseRef: z.string(),
    branch: z.string().nullable(),
    isDetached: z.boolean(),
    headCommit: z.string().nullable(),
    changedFiles: z.number().nullable(),
    additions: z.number().nullable(),
    deletions: z.number().nullable(),
    stateVersion: z.number().int().nonnegative(),
});
export const runtimeWorkspaceMetadataSchema = z.object({
    homeGitSummary: runtimeGitSyncSummarySchema.nullable(),
    homeGitStateVersion: z.number().int().nonnegative(),
    taskWorkspaces: z.array(runtimeTaskWorkspaceMetadataSchema),
});
export const runtimeClineMcpServerAuthStatusSchema = z.object({
    serverName: z.string(),
    oauthSupported: z.boolean(),
    oauthConfigured: z.boolean(),
    lastError: z.string().nullable(),
    lastAuthenticatedAt: z.number().nullable(),
});
export const runtimeStateStreamSnapshotMessageSchema = z.object({
    type: z.literal("snapshot"),
    currentProjectId: z.string().nullable(),
    projects: z.array(runtimeProjectSummarySchema),
    workspaceState: runtimeWorkspaceStateResponseSchema.nullable(),
    workspaceMetadata: runtimeWorkspaceMetadataSchema.nullable(),
    clineSessionContextVersion: z.number().int().nonnegative(),
});
export const runtimeStateStreamWorkspaceStateMessageSchema = z.object({
    type: z.literal("workspace_state_updated"),
    workspaceId: z.string(),
    workspaceState: runtimeWorkspaceStateResponseSchema,
});
export const runtimeStateStreamTaskSessionsMessageSchema = z.object({
    type: z.literal("task_sessions_updated"),
    workspaceId: z.string(),
    summaries: z.array(runtimeTaskSessionSummarySchema),
});
export const runtimeStateStreamProjectsMessageSchema = z.object({
    type: z.literal("projects_updated"),
    currentProjectId: z.string().nullable(),
    projects: z.array(runtimeProjectSummarySchema),
});
export const runtimeStateStreamWorkspaceMetadataMessageSchema = z.object({
    type: z.literal("workspace_metadata_updated"),
    workspaceId: z.string(),
    workspaceMetadata: runtimeWorkspaceMetadataSchema,
});
export const runtimeStateStreamTaskReadyForReviewMessageSchema = z.object({
    type: z.literal("task_ready_for_review"),
    workspaceId: z.string(),
    taskId: z.string(),
    triggeredAt: z.number(),
});
export const runtimeStateStreamTaskChatMessageSchema = z.object({
    type: z.literal("task_chat_message"),
    workspaceId: z.string(),
    taskId: z.string(),
    message: z.lazy(() => runtimeTaskChatMessageSchema),
});
export const runtimeStateStreamMcpAuthUpdatedMessageSchema = z.object({
    type: z.literal("mcp_auth_updated"),
    statuses: z.array(runtimeClineMcpServerAuthStatusSchema),
});
export const runtimeStateStreamClineSessionContextUpdatedMessageSchema = z.object({
    type: z.literal("cline_session_context_updated"),
    version: z.number().int().nonnegative(),
});
export const runtimeStateStreamErrorMessageSchema = z.object({
    type: z.literal("error"),
    message: z.string(),
});
export const runtimeStateStreamMessageSchema = z.discriminatedUnion("type", [
    runtimeStateStreamSnapshotMessageSchema,
    runtimeStateStreamWorkspaceStateMessageSchema,
    runtimeStateStreamTaskSessionsMessageSchema,
    runtimeStateStreamProjectsMessageSchema,
    runtimeStateStreamWorkspaceMetadataMessageSchema,
    runtimeStateStreamTaskReadyForReviewMessageSchema,
    runtimeStateStreamTaskChatMessageSchema,
    runtimeStateStreamMcpAuthUpdatedMessageSchema,
    runtimeStateStreamClineSessionContextUpdatedMessageSchema,
    runtimeStateStreamErrorMessageSchema,
]);
export const runtimeProjectsResponseSchema = z.object({
    currentProjectId: z.string().nullable(),
    projects: z.array(runtimeProjectSummarySchema),
});
export const runtimeProjectAddRequestSchema = z.object({
    path: z.string(),
    initializeGit: z.boolean().optional(),
});
export const runtimeProjectAddResponseSchema = z.object({
    ok: z.boolean(),
    project: runtimeProjectSummarySchema.nullable(),
    requiresGitInitialization: z.boolean().optional(),
    error: z.string().optional(),
});
export const runtimeProjectDirectoryPickerResponseSchema = z.object({
    ok: z.boolean(),
    path: z.string().nullable(),
    error: z.string().optional(),
});
export const runtimeProjectRemoveRequestSchema = z.object({
    projectId: z.string(),
});
export const runtimeProjectRemoveResponseSchema = z.object({
    ok: z.boolean(),
    error: z.string().optional(),
});
export const runtimeWorktreeEnsureRequestSchema = z.object({
    taskId: z.string(),
    baseRef: z.string(),
});
export const runtimeWorktreeEnsureResponseSchema = z.union([
    z.object({
        ok: z.literal(true),
        path: z.string(),
        baseRef: z.string(),
        baseCommit: z.string(),
        warning: z.string().optional(),
        error: z.string().optional(),
    }),
    z.object({
        ok: z.literal(false),
        path: z.null(),
        baseRef: z.string(),
        baseCommit: z.null(),
        error: z.string().optional(),
    }),
]);
export const runtimeWorktreeDeleteRequestSchema = z.object({
    taskId: z.string(),
});
export const runtimeWorktreeDeleteResponseSchema = z.object({
    ok: z.boolean(),
    removed: z.boolean(),
    error: z.string().optional(),
});
export const runtimeTaskWorkspaceInfoRequestSchema = z.object({
    taskId: z.string(),
    baseRef: z.string(),
});
export const runtimeTaskWorkspaceInfoResponseSchema = z.object({
    taskId: z.string(),
    path: z.string(),
    exists: z.boolean(),
    baseRef: z.string(),
    branch: z.string().nullable(),
    isDetached: z.boolean(),
    headCommit: z.string().nullable(),
});
export const runtimeProjectShortcutSchema = z.object({
    label: z.string(),
    command: z.string(),
    icon: z.string().optional(),
});
export const runtimeClineOauthProviderSchema = z.enum(["cline", "oca", "openai-codex"]);
export const runtimeClineProviderSettingsSchema = z.object({
    providerId: z.string().nullable(),
    modelId: z.string().nullable(),
    baseUrl: z.string().nullable(),
    apiKeyConfigured: z.boolean(),
    oauthProvider: runtimeClineOauthProviderSchema.nullable(),
    oauthAccessTokenConfigured: z.boolean(),
    oauthRefreshTokenConfigured: z.boolean(),
    oauthAccountId: z.string().nullable(),
    oauthExpiresAt: z.number().int().positive().nullable(),
});
export const runtimeClineAccountProfileSchema = z.object({
    accountId: z.string().nullable(),
    email: z.string().nullable(),
    displayName: z.string().nullable(),
});
export const runtimeClineAccountProfileResponseSchema = z.object({
    profile: runtimeClineAccountProfileSchema.nullable(),
    error: z.string().optional(),
});
export const runtimeClineKanbanAccessResponseSchema = z.object({
    enabled: z.boolean(),
    error: z.string().optional(),
});
export const runtimeClineProviderCatalogItemSchema = z.object({
    id: z.string(),
    name: z.string(),
    oauthSupported: z.boolean(),
    enabled: z.boolean(),
    defaultModelId: z.string().nullable(),
});
export const runtimeClineProviderCatalogResponseSchema = z.object({
    providers: z.array(runtimeClineProviderCatalogItemSchema),
});
export const runtimeClineProviderModelsRequestSchema = z.object({
    providerId: z.string(),
});
export const runtimeClineProviderModelSchema = z.object({
    id: z.string(),
    name: z.string(),
    supportsVision: z.boolean().optional(),
    supportsAttachments: z.boolean().optional(),
});
export const runtimeClineProviderModelsResponseSchema = z.object({
    providerId: z.string(),
    models: z.array(runtimeClineProviderModelSchema),
});
export const runtimeClineOauthLoginRequestSchema = z.object({
    provider: runtimeClineOauthProviderSchema,
    baseUrl: z.string().nullable().optional(),
});
export const runtimeClineOauthLoginResponseSchema = z.object({
    ok: z.boolean(),
    provider: runtimeClineOauthProviderSchema,
    settings: runtimeClineProviderSettingsSchema.optional(),
    error: z.string().optional(),
});
export const runtimeClineProviderSettingsSaveRequestSchema = z.object({
    providerId: z.string(),
    modelId: z.string().nullable().optional(),
    apiKey: z.string().nullable().optional(),
    baseUrl: z.string().nullable().optional(),
});
export const runtimeClineProviderSettingsSaveResponseSchema = runtimeClineProviderSettingsSchema;
const runtimeClineMcpServerBaseSchema = z.object({
    name: z.string(),
    disabled: z.boolean(),
});
export const runtimeClineMcpServerSchema = z.discriminatedUnion("type", [
    runtimeClineMcpServerBaseSchema.extend({
        type: z.literal("stdio"),
        command: z.string(),
        args: z.array(z.string()).optional(),
        cwd: z.string().optional(),
        env: z.record(z.string(), z.string()).optional(),
    }),
    runtimeClineMcpServerBaseSchema.extend({
        type: z.literal("sse"),
        url: z.string().url(),
        headers: z.record(z.string(), z.string()).optional(),
    }),
    runtimeClineMcpServerBaseSchema.extend({
        type: z.literal("streamableHttp"),
        url: z.string().url(),
        headers: z.record(z.string(), z.string()).optional(),
    }),
]);
export const runtimeClineMcpSettingsResponseSchema = z.object({
    path: z.string(),
    servers: z.array(runtimeClineMcpServerSchema),
});
export const runtimeClineMcpSettingsSaveRequestSchema = z.object({
    servers: z.array(runtimeClineMcpServerSchema),
});
export const runtimeClineMcpSettingsSaveResponseSchema = runtimeClineMcpSettingsResponseSchema;
export const runtimeClineMcpAuthStatusResponseSchema = z.object({
    statuses: z.array(runtimeClineMcpServerAuthStatusSchema),
});
export const runtimeClineMcpOAuthRequestSchema = z.object({
    serverName: z.string(),
});
export const runtimeClineMcpOAuthResponseSchema = z.object({
    serverName: z.string(),
    authorized: z.literal(true),
    message: z.string(),
});
export const runtimeCommandRunRequestSchema = z.object({
    command: z.string(),
});
export const runtimeCommandRunResponseSchema = z.object({
    exitCode: z.number(),
    stdout: z.string(),
    stderr: z.string(),
    combinedOutput: z.string(),
    durationMs: z.number(),
});
export const runtimeOpenFileRequestSchema = z.object({
    filePath: z.string(),
});
export const runtimeOpenFileResponseSchema = z.object({
    ok: z.boolean(),
});
export const runtimeDebugResetAllStateResponseSchema = z.object({
    ok: z.boolean(),
    clearedPaths: z.array(z.string()),
});
export const runtimeAgentDefinitionSchema = z.object({
    id: runtimeAgentIdSchema,
    label: z.string(),
    binary: z.string(),
    command: z.string(),
    defaultArgs: z.array(z.string()),
    installed: z.boolean(),
    configured: z.boolean(),
});
export const runtimeConfigResponseSchema = z.object({
    selectedAgentId: runtimeAgentIdSchema,
    selectedShortcutLabel: z.string().nullable(),
    agentAutonomousModeEnabled: z.boolean(),
    debugModeEnabled: z.boolean().optional(),
    effectiveCommand: z.string().nullable(),
    globalConfigPath: z.string(),
    projectConfigPath: z.string().nullable(),
    readyForReviewNotificationsEnabled: z.boolean(),
    detectedCommands: z.array(z.string()),
    agents: z.array(runtimeAgentDefinitionSchema),
    shortcuts: z.array(runtimeProjectShortcutSchema),
    clineProviderSettings: runtimeClineProviderSettingsSchema,
    commitPromptTemplate: z.string(),
    openPrPromptTemplate: z.string(),
    commitPromptTemplateDefault: z.string(),
    openPrPromptTemplateDefault: z.string(),
});
export const runtimeConfigSaveRequestSchema = z.object({
    selectedAgentId: runtimeAgentIdSchema.optional(),
    selectedShortcutLabel: z.string().nullable().optional(),
    agentAutonomousModeEnabled: z.boolean().optional(),
    shortcuts: z.array(runtimeProjectShortcutSchema).optional(),
    readyForReviewNotificationsEnabled: z.boolean().optional(),
    commitPromptTemplate: z.string().optional(),
    openPrPromptTemplate: z.string().optional(),
});
export const runtimeTaskSessionStartRequestSchema = z.object({
    taskId: z.string(),
    prompt: z.string(),
    images: z.array(runtimeTaskImageSchema).optional(),
    startInPlanMode: z.boolean().optional(),
    mode: runtimeTaskSessionModeSchema.optional(),
    resumeFromTrash: z.boolean().optional(),
    baseRef: z.string(),
    cols: z.number().int().positive().optional(),
    rows: z.number().int().positive().optional(),
});
export const runtimeTaskSessionStartResponseSchema = z.object({
    ok: z.boolean(),
    summary: runtimeTaskSessionSummarySchema.nullable(),
    error: z.string().optional(),
});
export const runtimeTaskSessionStopRequestSchema = z.object({
    taskId: z.string(),
});
export const runtimeTaskSessionStopResponseSchema = z.object({
    ok: z.boolean(),
    summary: runtimeTaskSessionSummarySchema.nullable(),
    error: z.string().optional(),
});
export const runtimeTaskSessionInputRequestSchema = z.object({
    taskId: z.string(),
    text: z.string(),
    appendNewline: z.boolean().optional(),
});
export const runtimeTaskSessionInputResponseSchema = z.object({
    ok: z.boolean(),
    summary: runtimeTaskSessionSummarySchema.nullable(),
    error: z.string().optional(),
});
export const runtimeTaskChatMessageSchema = z.object({
    id: z.string(),
    role: z.enum(["user", "assistant", "system", "tool", "reasoning", "status"]),
    content: z.string(),
    images: z.array(runtimeTaskImageSchema).optional(),
    createdAt: z.number(),
    meta: z
        .object({
        toolName: z.string().nullable().optional(),
        hookEventName: z.string().nullable().optional(),
        toolCallId: z.string().nullable().optional(),
        streamType: z.string().nullable().optional(),
        messageKind: z.string().nullable().optional(),
        displayRole: z.string().nullable().optional(),
        reason: z.string().nullable().optional(),
    })
        .nullable()
        .optional(),
});
export const runtimeTaskChatMessagesRequestSchema = z.object({
    taskId: z.string(),
});
export const runtimeTaskChatMessagesResponseSchema = z.object({
    ok: z.boolean(),
    messages: z.array(runtimeTaskChatMessageSchema),
    error: z.string().optional(),
});
export const runtimeTaskChatSendRequestSchema = z.object({
    taskId: z.string(),
    text: z.string(),
    images: z.array(runtimeTaskImageSchema).optional(),
    mode: runtimeTaskSessionModeSchema.optional(),
});
export const runtimeTaskChatSendResponseSchema = z.object({
    ok: z.boolean(),
    summary: runtimeTaskSessionSummarySchema.nullable(),
    message: runtimeTaskChatMessageSchema.nullable().optional(),
    error: z.string().optional(),
});
export const runtimeTaskChatAbortRequestSchema = z.object({
    taskId: z.string(),
});
export const runtimeTaskChatAbortResponseSchema = z.object({
    ok: z.boolean(),
    summary: runtimeTaskSessionSummarySchema.nullable(),
    error: z.string().optional(),
});
export const runtimeTaskChatCancelRequestSchema = z.object({
    taskId: z.string(),
});
export const runtimeTaskChatCancelResponseSchema = z.object({
    ok: z.boolean(),
    summary: runtimeTaskSessionSummarySchema.nullable(),
    error: z.string().optional(),
});
export const runtimeShellSessionStartRequestSchema = z.object({
    taskId: z.string(),
    cols: z.number().int().positive().optional(),
    rows: z.number().int().positive().optional(),
    workspaceTaskId: z.string().optional(),
    baseRef: z.string(),
});
export const runtimeShellSessionStartResponseSchema = z.object({
    ok: z.boolean(),
    summary: runtimeTaskSessionSummarySchema.nullable(),
    shellBinary: z.string().nullable().optional(),
    error: z.string().optional(),
});
export const runtimeTerminalWsResizeMessageSchema = z.object({
    type: z.literal("resize"),
    cols: z.number().int().positive(),
    rows: z.number().int().positive(),
    pixelWidth: z.number().int().positive().optional(),
    pixelHeight: z.number().int().positive().optional(),
});
export const runtimeTerminalWsStopMessageSchema = z.object({
    type: z.literal("stop"),
});
export const runtimeTerminalWsClientMessageSchema = z.discriminatedUnion("type", [
    runtimeTerminalWsResizeMessageSchema,
    runtimeTerminalWsStopMessageSchema,
]);
export const runtimeTerminalWsStateMessageSchema = z.object({
    type: z.literal("state"),
    summary: runtimeTaskSessionSummarySchema,
});
export const runtimeTerminalWsErrorMessageSchema = z.object({
    type: z.literal("error"),
    message: z.string(),
});
export const runtimeTerminalWsExitMessageSchema = z.object({
    type: z.literal("exit"),
    code: z.number().nullable(),
});
export const runtimeTerminalWsServerMessageSchema = z.discriminatedUnion("type", [
    runtimeTerminalWsStateMessageSchema,
    runtimeTerminalWsErrorMessageSchema,
    runtimeTerminalWsExitMessageSchema,
]);
export const runtimeGitCommitSchema = z.object({
    hash: z.string(),
    shortHash: z.string(),
    authorName: z.string(),
    authorEmail: z.string(),
    date: z.string(),
    message: z.string(),
    parentHashes: z.array(z.string()),
    relation: z.enum(["selected", "upstream", "shared"]).optional(),
});
export const runtimeGitRefSchema = z.object({
    name: z.string(),
    type: z.enum(["branch", "remote", "detached"]),
    hash: z.string(),
    isHead: z.boolean(),
    upstreamName: z.string().optional(),
    ahead: z.number().optional(),
    behind: z.number().optional(),
});
export const runtimeGitLogRequestSchema = z.object({
    ref: z.string().nullable().optional(),
    refs: z.array(z.string()).optional(),
    maxCount: z.number().int().positive().optional(),
    skip: z.number().int().nonnegative().optional(),
    taskScope: runtimeTaskWorkspaceInfoRequestSchema.nullable().optional(),
});
export const runtimeGitLogResponseSchema = z.object({
    ok: z.boolean(),
    commits: z.array(runtimeGitCommitSchema),
    totalCount: z.number(),
    error: z.string().optional(),
});
export const runtimeGitCommitDiffFileSchema = z.object({
    path: z.string(),
    previousPath: z.string().optional(),
    status: z.enum(["modified", "added", "deleted", "renamed"]),
    additions: z.number(),
    deletions: z.number(),
    patch: z.string(),
});
export const runtimeGitCommitDiffRequestSchema = z.object({
    commitHash: z.string(),
    taskScope: runtimeTaskWorkspaceInfoRequestSchema.nullable().optional(),
});
export const runtimeGitCommitDiffResponseSchema = z.object({
    ok: z.boolean(),
    commitHash: z.string(),
    files: z.array(runtimeGitCommitDiffFileSchema),
    error: z.string().optional(),
});
export const runtimeGitRefsResponseSchema = z.object({
    ok: z.boolean(),
    refs: z.array(runtimeGitRefSchema),
    error: z.string().optional(),
});
export const runtimeHookEventSchema = z.enum(["to_review", "to_in_progress", "activity"]);
export const runtimeHookIngestRequestSchema = z.object({
    taskId: z.string(),
    workspaceId: z.string(),
    event: runtimeHookEventSchema,
    metadata: runtimeTaskHookActivitySchema.partial().optional(),
});
export const runtimeHookIngestResponseSchema = z.object({
    ok: z.boolean(),
    error: z.string().optional(),
});
//# sourceMappingURL=api-contract.js.map
//# debugId=23514e15-9236-5b96-8f3e-02836b65c0b8
