@@ -15,7 +15,7 @@ import { TaterSpriteRunning } from '@plannotator/ui/components/TaterSpriteRunnin
1515import { TaterSpritePullup } from '@plannotator/ui/components/TaterSpritePullup' ;
1616import { Settings } from '@plannotator/ui/components/Settings' ;
1717import { FeedbackButton , ApproveButton , ExitButton } from '@plannotator/ui/components/ToolbarButtons' ;
18- import { ApproveDropdown , type ApproveExtraEntry } from '@plannotator/ui/components/ApproveDropdown' ;
18+ import { ApproveDropdown } from '@plannotator/ui/components/ApproveDropdown' ;
1919import { useSharing } from '@plannotator/ui/hooks/useSharing' ;
2020import { getCallbackConfig , CallbackAction , executeCallback , type ToastPayload } from '@plannotator/ui/utils/callback' ;
2121import { useAgents } from '@plannotator/ui/hooks/useAgents' ;
@@ -77,7 +77,6 @@ import type { PlanDiffMode } from '@plannotator/ui/components/plan-diff/PlanDiff
7777import { DEMO_PLAN_CONTENT as DEFAULT_DEMO_PLAN_CONTENT } from './demoPlan' ;
7878import { DIFF_DEMO_PLAN_CONTENT } from './demoPlanDiffDemo' ;
7979import { canUseAnnotateWideMode , resolveWideModeExitLayout , type WideModeLayoutSnapshot , type WideModeType } from './wideMode' ;
80- import { buildApprovalRequestBody , type ApprovalOverride } from './approvalBody' ;
8180const USE_DIFF_DEMO =
8281 import . meta. env . VITE_DIFF_DEMO === '1' ||
8382 import . meta. env . VITE_DIFF_DEMO === 'true' ;
@@ -104,7 +103,6 @@ const App: React.FC = () => {
104103 const [ showImport , setShowImport ] = useState ( false ) ;
105104 const [ showFeedbackPrompt , setShowFeedbackPrompt ] = useState ( false ) ;
106105 const [ showClaudeCodeWarning , setShowClaudeCodeWarning ] = useState ( false ) ;
107- const [ pendingApprovalOverride , setPendingApprovalOverride ] = useState < ApprovalOverride | null > ( null ) ;
108106 const [ showExitWarning , setShowExitWarning ] = useState ( false ) ;
109107 // When the warning dialog confirms, route to the handler matching the button that opened it.
110108 const [ exitWarningAction , setExitWarningAction ] = useState < 'close' | 'approve' > ( 'close' ) ;
@@ -943,8 +941,7 @@ const App: React.FC = () => {
943941 } ;
944942
945943 // API mode handlers
946- const handleApprove = async ( override : ApprovalOverride = { } ) => {
947- setPendingApprovalOverride ( null ) ;
944+ const handleApprove = async ( ) => {
948945 setIsSubmitting ( true ) ;
949946 try {
950947 const obsidianSettings = getObsidianSettings ( ) ;
@@ -955,14 +952,24 @@ const App: React.FC = () => {
955952 ? await autoSavePromiseRef . current
956953 : autoSaveResultsRef . current ;
957954
955+ // Build request body - include integrations if enabled
956+ const body : { obsidian ?: object ; bear ?: object ; octarine ?: object ; feedback ?: string ; agentSwitch ?: string ; planSave ?: { enabled : boolean ; customPath ?: string } ; permissionMode ?: string } = { } ;
957+
958+ // Include permission mode for Claude Code
959+ if ( origin === 'claude-code' ) {
960+ body . permissionMode = permissionMode ;
961+ }
962+
958963 const effectiveAgent = getEffectiveAgentName ( getAgentSwitchSettings ( ) ) ;
959- const body = buildApprovalRequestBody ( {
960- origin,
961- permissionMode,
962- override,
963- effectiveAgent,
964- planSaveSettings,
965- } ) ;
964+ if ( effectiveAgent ) {
965+ body . agentSwitch = effectiveAgent ;
966+ }
967+
968+ // Include plan save settings
969+ body . planSave = {
970+ enabled : planSaveSettings . enabled ,
971+ ...( planSaveSettings . customPath && { customPath : planSaveSettings . customPath } ) ,
972+ } ;
966973
967974 const effectiveVaultPath = getEffectiveVaultPath ( obsidianSettings ) ;
968975 if ( obsidianSettings . enabled && effectiveVaultPath ) {
@@ -1033,25 +1040,6 @@ const App: React.FC = () => {
10331040 }
10341041 } ;
10351042
1036- const approveWithClaudeCodeWarning = useCallback ( ( override : ApprovalOverride = { } ) => {
1037- setPendingApprovalOverride ( override ) ;
1038- if ( origin === 'claude-code' && ( allAnnotations . length > 0 || codeAnnotations . length > 0 ) ) {
1039- setShowClaudeCodeWarning ( true ) ;
1040- return ;
1041- }
1042- handleApprove ( override ) ;
1043- } , [ allAnnotations . length , codeAnnotations . length , origin , handleApprove ] ) ;
1044-
1045- const claudeCodeExtraEntries = useMemo < ApproveExtraEntry [ ] > ( ( ) => ( origin === 'claude-code' ? [ {
1046- id : 'approve-bypass-clear-reminder' ,
1047- label : 'Approve + Bypass + /clear Reminder' ,
1048- description : 'Requests bypass mode and reminds you to run /clear. Hooks cannot clear context directly.' ,
1049- onSelect : ( ) => approveWithClaudeCodeWarning ( {
1050- permissionMode : 'bypassPermissions' ,
1051- clearContextNudge : true ,
1052- } ) ,
1053- } ] : [ ] ) , [ approveWithClaudeCodeWarning , origin ] ) ;
1054-
10551043 // Annotate mode handler — sends feedback via /api/feedback
10561044 const handleAnnotateFeedback = async ( ) => {
10571045 setIsSubmitting ( true ) ;
@@ -1646,24 +1634,18 @@ const App: React.FC = () => {
16461634 ) }
16471635
16481636 { ( ! annotateMode || gate ) && (
1649- ! annotateMode && (
1650- ( origin === 'opencode' && availableAgents . length > 0 ) ||
1651- ( origin === 'claude-code' && claudeCodeExtraEntries . length > 0 )
1652- ) ? (
1637+ origin === 'opencode' && ! annotateMode && availableAgents . length > 0 ? (
16531638 < ApproveDropdown
16541639 onApprove = { ( ) => {
1655- if ( origin === 'opencode' ) {
1656- const warning = getAgentWarning ( ) ;
1657- if ( warning ) {
1658- setAgentWarningMessage ( warning ) ;
1659- setShowAgentWarning ( true ) ;
1660- return ;
1661- }
1640+ const warning = getAgentWarning ( ) ;
1641+ if ( warning ) {
1642+ setAgentWarningMessage ( warning ) ;
1643+ setShowAgentWarning ( true ) ;
1644+ return ;
16621645 }
1663- approveWithClaudeCodeWarning ( ) ;
1646+ handleApprove ( ) ;
16641647 } }
1665- agents = { origin === 'opencode' ? availableAgents : [ ] }
1666- extraEntries = { claudeCodeExtraEntries }
1648+ agents = { availableAgents }
16671649 disabled = { isSubmitting }
16681650 isLoading = { isSubmitting }
16691651 />
@@ -1681,7 +1663,6 @@ const App: React.FC = () => {
16811663 return ;
16821664 }
16831665 if ( origin === 'claude-code' && ( allAnnotations . length > 0 || codeAnnotations . length > 0 ) ) {
1684- setPendingApprovalOverride ( { } ) ;
16851666 setShowClaudeCodeWarning ( true ) ;
16861667 return ;
16871668 }
@@ -1738,7 +1719,6 @@ const App: React.FC = () => {
17381719 onIdentityChange = { handleIdentityChange }
17391720 origin = { origin }
17401721 onUIPreferencesChange = { setUiPrefs }
1741- onPermissionModeChange = { setPermissionMode }
17421722 externalOpen = { mobileSettingsOpen }
17431723 onExternalClose = { ( ) => setMobileSettingsOpen ( false ) }
17441724 gitUser = { gitUser }
@@ -2094,15 +2074,10 @@ const App: React.FC = () => {
20942074 { /* Claude Code annotation warning dialog */ }
20952075 < ConfirmDialog
20962076 isOpen = { showClaudeCodeWarning }
2097- onClose = { ( ) => {
2098- setShowClaudeCodeWarning ( false ) ;
2099- setPendingApprovalOverride ( null ) ;
2100- } }
2077+ onClose = { ( ) => setShowClaudeCodeWarning ( false ) }
21012078 onConfirm = { ( ) => {
2102- const override = pendingApprovalOverride ?? { } ;
21032079 setShowClaudeCodeWarning ( false ) ;
2104- setPendingApprovalOverride ( null ) ;
2105- handleApprove ( override ) ;
2080+ handleApprove ( ) ;
21062081 } }
21072082 title = "Annotations Won't Be Sent"
21082083 message = { < > { agentName } doesn't yet support feedback on approval. Your { allAnnotations . length + codeAnnotations . length } annotation{ ( allAnnotations . length + codeAnnotations . length ) !== 1 ? 's' : '' } will be lost.</ > }
0 commit comments