| 1 | import { useController } from "../lib/useController"; |
| 2 | |
| 3 | /** |
| 4 | * Narrows the legacy controller into explicit App-facing runtime ports. |
| 5 | * It does not own state: Controller stores remain authoritative and every |
| 6 | * source-bound operation still executes through the existing controller. |
| 7 | */ |
| 8 | export function useAppRuntimeAdapter() { |
| 9 | const controller = useController(); |
| 10 | return { |
| 11 | snapshot: { |
| 12 | state: controller.state, |
| 13 | liveStore: controller.liveStore, |
| 14 | activeTabId: controller.activeTabId, |
| 15 | notice: controller.notice, |
| 16 | }, |
| 17 | composer: { |
| 18 | sendToTab: controller.sendToTab, |
| 19 | runShellForTab: controller.runShellForTab, |
| 20 | steerForTab: controller.steerForTab, |
| 21 | cancel: controller.cancel, |
| 22 | cancelForTab: controller.cancelForTab, |
| 23 | setControllerMode: controller.setControllerMode, |
| 24 | setControllerModeForTab: controller.setControllerModeForTab, |
| 25 | setCollaborationMode: controller.setCollaborationMode, |
| 26 | setCollaborationModeForTab: controller.setCollaborationModeForTab, |
| 27 | setToolApprovalMode: controller.setToolApprovalMode, |
| 28 | setToolApprovalModeForTab: controller.setToolApprovalModeForTab, |
| 29 | setComposerProfileForTab: controller.setComposerProfileForTab, |
| 30 | setGoalForTab: controller.setGoalForTab, |
| 31 | editGoalForTab: controller.editGoalForTab, |
| 32 | resumeGoalForTab: controller.resumeGoalForTab, |
| 33 | pauseGoalForTab: controller.pauseGoalForTab, |
| 34 | clearGoal: controller.clearGoal, |
| 35 | clearGoalForTab: controller.clearGoalForTab, |
| 36 | setModel: controller.setModel, |
| 37 | setModelForTab: controller.setModelForTab, |
| 38 | setEffort: controller.setEffort, |
| 39 | setEffortForTab: controller.setEffortForTab, |
| 40 | cancelJob: controller.cancelJob, |
| 41 | }, |
| 42 | sessionActions: { |
| 43 | isPromptCurrentForTab: controller.isPromptCurrentForTab, |
| 44 | recoverDeliveryToTab: controller.recoverDeliveryToTab, |
| 45 | approveForTab: controller.approveForTab, |
| 46 | resolvePlanDecisionForTab: controller.resolvePlanDecisionForTab, |
| 47 | resolveRecoveryForTab: controller.resolveRecoveryForTab, |
| 48 | answerQuestionForTab: controller.answerQuestionForTab, |
| 49 | answerMCPInteractionForTab: controller.answerMCPInteractionForTab, |
| 50 | dismissExtensionForm: controller.dismissExtensionForm, |
| 51 | drainExtensionNotifications: controller.drainExtensionNotifications, |
| 52 | clearSession: controller.clearSession, |
| 53 | newSession: controller.newSession, |
| 54 | listSessions: controller.listSessions, |
| 55 | listTrashedSessions: controller.listTrashedSessions, |
| 56 | resumeSession: controller.resumeSession, |
| 57 | openChannelSession: controller.openChannelSession, |
| 58 | previewSession: controller.previewSession, |
| 59 | deleteSession: controller.deleteSession, |
| 60 | restoreSession: controller.restoreSession, |
| 61 | purgeTrashedSession: controller.purgeTrashedSession, |
| 62 | renameSession: controller.renameSession, |
| 63 | loadOlderHistory: controller.loadOlderHistory, |
| 64 | loadNewerHistory: controller.loadNewerHistory, |
| 65 | retrySessionHistory: controller.retrySessionHistory, |
| 66 | rewindForTab: controller.rewindForTab, |
| 67 | rewindForTabDetailed: controller.rewindForTabDetailed, |
| 68 | undoRewindForTab: controller.undoRewindForTab, |
| 69 | forkTurnForTab: controller.forkTurnForTab, |
| 70 | }, |
| 71 | workspace: { |
| 72 | refreshMeta: controller.refreshMeta, |
| 73 | pickWorkspace: controller.pickWorkspace, |
| 74 | switchWorkspace: controller.switchWorkspace, |
| 75 | }, |
| 76 | navigation: { |
| 77 | switchTab: controller.switchTab, |
| 78 | switchRemoteTab: controller.switchRemoteTab, |
| 79 | createIsolatedWorktree: controller.createIsolatedWorktree, |
| 80 | closeTab: controller.closeTab, |
| 81 | reorderTabs: controller.reorderTabs, |
| 82 | activateTopic: controller.activateTopic, |
| 83 | openCanonicalSession: controller.openCanonicalSession, |
| 84 | noteNavigationIntent: controller.noteNavigationIntent, |
| 85 | currentNavigationIntent: controller.currentNavigationIntent, |
| 86 | registeredNavigationIntent: controller.registeredNavigationIntent, |
| 87 | isNavigationIntentCurrent: controller.isNavigationIntentCurrent, |
| 88 | reassertVisibleTabAfterStaleNavigation: controller.reassertVisibleTabAfterStaleNavigation, |
| 89 | syncActiveTab: controller.syncActiveTab, |
| 90 | ensureBlankSurface: controller.ensureBlankSurface, |
| 91 | commitSingleSurfaceNavigation: controller.commitSingleSurfaceNavigation, |
| 92 | }, |
| 93 | }; |
| 94 | } |
| 95 |