···11-/// Identifies the kind of script that blocks a worktree state transition
22-/// and runs in a dedicated terminal tab. Adding a new case requires handling
33-/// in `AppFeature`'s `.blockingScriptCompleted` event router.
44-enum BlockingScriptKind: Hashable, Sendable {
55- case archive
66-77- var tabTitle: String {
88- switch self {
99- case .archive: return "ARCHIVE SCRIPT"
1010- }
1111- }
1212-1313- var tabIcon: String {
1414- switch self {
1515- case .archive: return "archivebox.fill"
1616- }
1717- }
1818-}
···1616 var onMoveTab: ((ghostty_action_move_tab_s) -> Bool)?
1717 var onCommandPaletteToggle: (() -> Bool)?
1818 var onProgressReport: ((ghostty_action_progress_report_state_e) -> Void)?
1919- // Used by blocking script completion detection in WorktreeTerminalState.
2020- // Both callbacks are set on every surface but guarded by the
2121- // blockingScripts dict in the handlers.
2222- var onCommandFinished: ((Int?) -> Void)?
2323- var onChildExited: ((UInt32) -> Void)?
2419 var onDesktopNotification: ((String, String) -> Void)?
2520 private var progressResetTask: Task<Void, Never>?
2621···234229235230 case GHOSTTY_ACTION_COMMAND_FINISHED:
236231 let info = action.action.command_finished
237237- let exitCode = info.exit_code == -1 ? nil : Int(info.exit_code)
238238- state.commandExitCode = exitCode
232232+ state.commandExitCode = info.exit_code == -1 ? nil : Int(info.exit_code)
239233 state.commandDuration = info.duration
240240- onCommandFinished?(exitCode)
241234 return true
242235243236 case GHOSTTY_ACTION_SHOW_CHILD_EXITED:
244237 let info = action.action.child_exited
245238 state.childExitCode = info.exit_code
246239 state.childExitTimeMs = info.timetime_ms
247247- onChildExited?(info.exit_code)
248240 return true
249241250242 case GHOSTTY_ACTION_READONLY: