@@ -58,13 +58,18 @@ export type SettingsViewProps = {
5858 openworkServerCapabilities : OpenworkServerCapabilities | null ;
5959 openworkServerDiagnostics : OpenworkServerDiagnostics | null ;
6060 openworkServerWorkspaceId : string | null ;
61+ clientConnected : boolean ;
62+ canReloadWorkspace : boolean ;
6163 openworkAuditEntries : OpenworkAuditEntry [ ] ;
6264 openworkAuditStatus : "idle" | "loading" | "error" ;
6365 openworkAuditError : string | null ;
6466 opencodeConnectStatus : OpencodeConnectStatus | null ;
6567 engineInfo : EngineInfo | null ;
6668 openwrkStatus : OpenwrkStatus | null ;
6769 owpenbotInfo : OwpenbotInfo | null ;
70+ reloadWorkspaceEngine : ( ) => Promise < void > ;
71+ reloadBusy : boolean ;
72+ reloadError : string | null ;
6873 updateOpenworkServerSettings : ( next : OpenworkServerSettings ) => void ;
6974 resetOpenworkServerSettings : ( ) => void ;
7075 testOpenworkServerConnection : ( next : OpenworkServerSettings ) => Promise < boolean > ;
@@ -941,6 +946,18 @@ export default function SettingsView(props: SettingsViewProps) {
941946 }
942947 } ) ;
943948
949+ const reloadAvailabilityReason = createMemo ( ( ) => {
950+ if ( ! props . clientConnected ) return "Connect to this workspace to reload." ;
951+ if ( ! props . canReloadWorkspace ) {
952+ return "Reloading is only available for local workspaces or connected OpenWork servers." ;
953+ }
954+ return null ;
955+ } ) ;
956+
957+ const reloadButtonLabel = createMemo ( ( ) => ( props . reloadBusy ? "Reloading..." : "Reload engine" ) ) ;
958+ const reloadButtonTone = createMemo ( ( ) => ( props . anyActiveRuns ? "danger" : "secondary" ) ) ;
959+ const reloadButtonDisabled = createMemo ( ( ) => props . reloadBusy || Boolean ( reloadAvailabilityReason ( ) ) ) ;
960+
944961 const engineStatusLabel = createMemo ( ( ) => {
945962 if ( ! isTauriRuntime ( ) ) return "Unavailable" ;
946963 return props . engineInfo ?. running ? "Running" : "Offline" ;
@@ -1927,6 +1944,38 @@ export default function SettingsView(props: SettingsViewProps) {
19271944 </ div >
19281945 </ Show >
19291946 </ div >
1947+
1948+ < div class = "bg-gray-2/30 border border-gray-6/50 rounded-2xl p-5 space-y-4" >
1949+ < div >
1950+ < div class = "text-sm font-medium text-gray-12" > Engine reload</ div >
1951+ < div class = "text-xs text-gray-10" > Restart the OpenCode server for this workspace.</ div >
1952+ </ div >
1953+
1954+ < div class = "flex items-center justify-between bg-gray-1 p-3 rounded-xl border border-gray-6 gap-3" >
1955+ < div class = "min-w-0 space-y-1" >
1956+ < div class = "text-sm text-gray-12" > Reload now</ div >
1957+ < div class = "text-xs text-gray-7" > Applies config updates and reconnects your session.</ div >
1958+ < Show when = { props . anyActiveRuns } >
1959+ < div class = "text-[11px] text-amber-11" > Reloading will stop active tasks.</ div >
1960+ </ Show >
1961+ < Show when = { props . reloadError } >
1962+ < div class = "text-[11px] text-red-11" > { props . reloadError } </ div >
1963+ </ Show >
1964+ < Show when = { reloadAvailabilityReason ( ) } >
1965+ < div class = "text-[11px] text-gray-9" > { reloadAvailabilityReason ( ) } </ div >
1966+ </ Show >
1967+ </ div >
1968+ < Button
1969+ variant = { reloadButtonTone ( ) }
1970+ class = "text-xs h-8 py-0 px-3 shrink-0"
1971+ onClick = { props . reloadWorkspaceEngine }
1972+ disabled = { reloadButtonDisabled ( ) }
1973+ >
1974+ < RefreshCcw size = { 14 } class = { props . reloadBusy ? "animate-spin" : "" } />
1975+ { reloadButtonLabel ( ) }
1976+ </ Button >
1977+ </ div >
1978+ </ div >
19301979 </ div >
19311980 </ div >
19321981 </ Match >
0 commit comments