refactor: unify interrupt handling in various tools

Refactored the context types for create, delete, and update functionalities across multiple tools including Confluence, Dropbox, Gmail, Google Calendar, Jira, Linear, Notion, and OneDrive to utilize a consistent type definition. This change enhances code clarity and maintains uniformity in handling user approvals by integrating the useHitlDecision hook for decision dispatching.
This commit is contained in:
Anish Sarkar 2026-04-13 20:25:49 +05:30
parent 041af34820
commit 71f4f77f26
25 changed files with 25 additions and 25 deletions

View file

@ -32,7 +32,7 @@ interface ConfluenceSpace {
name: string;
}
interface CreateConfluencePageInterruptContext {
type CreateConfluencePageInterruptContext = {
accounts?: ConfluenceAccount[];
spaces?: ConfluenceSpace[];
error?: string;

View file

@ -10,7 +10,7 @@ import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
import { useHitlPhase } from "@/hooks/use-hitl-phase";
interface DeleteConfluencePageInterruptContext {
type DeleteConfluencePageInterruptContext = {
account?: {
id: number;
name: string;

View file

@ -12,7 +12,7 @@ import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
import { useHitlPhase } from "@/hooks/use-hitl-phase";
interface UpdateConfluencePageInterruptContext {
type UpdateConfluencePageInterruptContext = {
account?: {
id: number;
name: string;

View file

@ -31,7 +31,7 @@ interface SupportedType {
label: string;
}
interface DropboxCreateFileContext {
type DropboxCreateFileContext = {
accounts?: DropboxAccount[];
parent_folders?: Record<number, Array<{ folder_path: string; name: string }>>;
supported_types?: SupportedType[];

View file

@ -24,7 +24,7 @@ interface DropboxFile {
document_id?: number;
}
interface DropboxTrashFileContext {
type DropboxTrashFileContext = {
account?: DropboxAccount;
file?: DropboxFile;
error?: string;

View file

@ -27,7 +27,7 @@ interface GmailAccount {
auth_expired?: boolean;
}
interface GmailCreateDraftContext {
type GmailCreateDraftContext = {
accounts?: GmailAccount[];
error?: string;
}

View file

@ -27,7 +27,7 @@ interface GmailAccount {
auth_expired?: boolean;
}
interface GmailSendEmailContext {
type GmailSendEmailContext = {
accounts?: GmailAccount[];
error?: string;
}

View file

@ -27,7 +27,7 @@ interface GmailMessage {
document_id: number;
}
interface GmailTrashEmailContext {
type GmailTrashEmailContext = {
account?: GmailAccount;
email?: GmailMessage;
error?: string;

View file

@ -30,7 +30,7 @@ interface GmailMessage {
document_id: number;
}
interface GmailUpdateDraftContext {
type GmailUpdateDraftContext = {
account?: GmailAccount;
email?: GmailMessage;
draft_id?: string;

View file

@ -32,7 +32,7 @@ interface CalendarEntry {
primary?: boolean;
}
interface CalendarCreateEventContext {
type CalendarCreateEventContext = {
accounts?: GoogleCalendarAccount[];
calendars?: CalendarEntry[];
timezone?: string;

View file

@ -29,7 +29,7 @@ interface CalendarEvent {
indexed_at?: string;
}
interface CalendarDeleteEventContext {
type CalendarDeleteEventContext = {
account?: GoogleCalendarAccount;
event?: CalendarEvent;
error?: string;

View file

@ -39,7 +39,7 @@ interface CalendarEvent {
indexed_at?: string;
}
interface CalendarUpdateEventContext {
type CalendarUpdateEventContext = {
account?: GoogleCalendarAccount;
event?: CalendarEvent;
error?: string;

View file

@ -25,7 +25,7 @@ interface GoogleDriveAccount {
auth_expired?: boolean;
}
interface DriveCreateFileContext {
type DriveCreateFileContext = {
accounts?: GoogleDriveAccount[];
supported_types?: string[];
parent_folders?: Record<number, Array<{ folder_id: string; name: string }>>;

View file

@ -23,7 +23,7 @@ interface GoogleDriveFile {
web_view_link: string;
}
interface DriveTrashFileContext {
type DriveTrashFileContext = {
account?: GoogleDriveAccount;
file?: GoogleDriveFile;
error?: string;

View file

@ -42,7 +42,7 @@ interface JiraPriority {
name: string;
}
interface CreateJiraIssueInterruptContext {
type CreateJiraIssueInterruptContext = {
accounts?: JiraAccount[];
projects?: JiraProject[];
issue_types?: JiraIssueType[];

View file

@ -25,7 +25,7 @@ interface JiraIssue {
document_id?: number;
}
interface DeleteJiraIssueInterruptContext {
type DeleteJiraIssueInterruptContext = {
account?: JiraAccount;
issue?: JiraIssue;
error?: string;

View file

@ -45,7 +45,7 @@ interface JiraPriority {
name: string;
}
interface UpdateJiraIssueInterruptContext {
type UpdateJiraIssueInterruptContext = {
account?: JiraAccount;
issue?: JiraIssue;
priorities?: JiraPriority[];

View file

@ -66,7 +66,7 @@ interface LinearWorkspace {
auth_expired?: boolean;
}
interface LinearCreateIssueContext {
type LinearCreateIssueContext = {
workspaces?: LinearWorkspace[];
error?: string;
}

View file

@ -10,7 +10,7 @@ import { useHitlPhase } from "@/hooks/use-hitl-phase";
import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
interface LinearDeleteIssueContext {
type LinearDeleteIssueContext = {
workspace?: { id: number; organization_name: string };
issue?: {
id: string;

View file

@ -47,7 +47,7 @@ interface LinearPriority {
label: string;
}
interface LinearUpdateIssueContext {
type LinearUpdateIssueContext = {
workspace?: { id: number; organization_name: string };
priorities?: LinearPriority[];
issue?: {

View file

@ -19,7 +19,7 @@ import { useHitlPhase } from "@/hooks/use-hitl-phase";
import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
interface NotionCreatePageContext {
type NotionCreatePageContext = {
accounts?: Array<{
id: number;
name: string;

View file

@ -10,7 +10,7 @@ import { useHitlPhase } from "@/hooks/use-hitl-phase";
import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
interface NotionDeletePageContext {
type NotionDeletePageContext = {
account?: {
id: number;
name: string;

View file

@ -12,7 +12,7 @@ import { useHitlPhase } from "@/hooks/use-hitl-phase";
import { isInterruptResult, useHitlDecision } from "@/lib/hitl";
import type { InterruptResult, HitlDecision } from "@/lib/hitl";
interface NotionUpdatePageContext {
type NotionUpdatePageContext = {
account?: {
id: number;
name: string;

View file

@ -26,7 +26,7 @@ interface OneDriveAccount {
auth_expired?: boolean;
}
interface OneDriveCreateFileContext {
type OneDriveCreateFileContext = {
accounts?: OneDriveAccount[];
parent_folders?: Record<number, Array<{ folder_id: string; name: string }>>;
error?: string;

View file

@ -24,7 +24,7 @@ interface OneDriveFile {
web_url?: string;
}
interface OneDriveTrashFileContext {
type OneDriveTrashFileContext = {
account?: OneDriveAccount;
file?: OneDriveFile;
error?: string;