restore: bring back all custom UI enhancements from checkpoint
Restored from commit 52be710 (checkpoint before qwen oauth + todo roller): Enhanced UI Features: - SMART FIX button with AI code analysis - APEX (Autonomous Programming EXecution) mode - SHIELD (Auto-approval) mode - MULTIX MODE multi-task pipeline interface - Live streaming token counter - Thinking indicator with bouncing dots animation Components restored: - packages/ui/src/components/chat/multi-task-chat.tsx - packages/ui/src/components/instance/instance-shell2.tsx - packages/ui/src/components/settings/OllamaCloudSettings.tsx - packages/ui/src/components/settings/QwenCodeSettings.tsx - packages/ui/src/stores/solo-store.ts - packages/ui/src/stores/task-actions.ts - packages/ui/src/stores/session-events.ts (autonomous mode) - packages/server/src/integrations/ollama-cloud.ts - packages/server/src/server/routes/ollama.ts - packages/server/src/server/routes/qwen.ts This ensures all custom features are preserved in source control.
This commit is contained in:
@@ -47,7 +47,7 @@ function getTauriBridge(): TauriBridge | null {
|
||||
if (typeof window === "undefined") {
|
||||
return null
|
||||
}
|
||||
const bridge = (window as { __TAURI__?: TauriBridge }).__TAURI__
|
||||
const bridge = (window as any).__TAURI__ as TauriBridge | undefined
|
||||
if (!bridge || !bridge.event || !bridge.invoke) {
|
||||
return null
|
||||
}
|
||||
@@ -62,6 +62,16 @@ function annotateDocument() {
|
||||
document.documentElement.dataset.runtimePlatform = runtimeEnv.platform
|
||||
}
|
||||
|
||||
interface electronAPI {
|
||||
onCliStatus: (callback: (data: CliStatus) => void) => () => void
|
||||
onCliError: (callback: (data: { message: string }) => void) => () => void
|
||||
getCliStatus: () => Promise<CliStatus>
|
||||
}
|
||||
|
||||
function getElectronAPI(): electronAPI | null {
|
||||
return (window as any).electronAPI || null
|
||||
}
|
||||
|
||||
function LoadingApp() {
|
||||
const [phrase, setPhrase] = createSignal(pickPhrase())
|
||||
const [error, setError] = createSignal<string | null>(null)
|
||||
@@ -70,10 +80,56 @@ function LoadingApp() {
|
||||
const changePhrase = () => setPhrase(pickPhrase(phrase()))
|
||||
|
||||
onMount(() => {
|
||||
console.info("[loading] mounted")
|
||||
annotateDocument()
|
||||
setPhrase(pickPhrase())
|
||||
const unsubscribers: Array<() => void> = []
|
||||
|
||||
async function bootstrapElectron(api: electronAPI) {
|
||||
console.info("[loading] bootstrapping electron")
|
||||
try {
|
||||
const statusUnsubscribe = api.onCliStatus((payload) => {
|
||||
console.info("[loading] received cli status:", payload)
|
||||
if (payload.state === "ready" && payload.url) {
|
||||
setError(null)
|
||||
setStatus(null)
|
||||
// Navigate to main app, not CLI API
|
||||
// In dev, main app is on localhost:3000, in production it's the same origin as loading screen
|
||||
const mainAppUrl = runtimeEnv.host === "electron" ? window.location.origin.replace(/:\d+/, ":3000") : payload.url
|
||||
navigateTo(mainAppUrl)
|
||||
} else if (payload.state === "error" && payload.error) {
|
||||
setError(payload.error)
|
||||
setStatus("Encountered an issue")
|
||||
}
|
||||
})
|
||||
|
||||
const errorUnsubscribe = api.onCliError((payload) => {
|
||||
console.info("[loading] received cli error:", payload)
|
||||
if (payload.message) {
|
||||
setError(payload.message)
|
||||
setStatus("Encountered an issue")
|
||||
}
|
||||
})
|
||||
|
||||
unsubscribers.push(statusUnsubscribe, errorUnsubscribe)
|
||||
|
||||
const initialStatus = await api.getCliStatus()
|
||||
console.info("[loading] initial status:", initialStatus)
|
||||
if (initialStatus?.state === "ready" && initialStatus.url) {
|
||||
// Navigate to main app, not CLI API
|
||||
const mainAppUrl = runtimeEnv.host === "electron" ? window.location.origin.replace(/:\d+/, ":3000") : initialStatus.url
|
||||
navigateTo(mainAppUrl)
|
||||
} else if (initialStatus?.state === "error" && initialStatus.error) {
|
||||
setError(initialStatus.error)
|
||||
setStatus("Encountered an issue")
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("[loading] bootstrap error:", err)
|
||||
setError(String(err))
|
||||
setStatus("Encountered an issue")
|
||||
}
|
||||
}
|
||||
|
||||
async function bootstrapTauri(tauriBridge: TauriBridge | null) {
|
||||
if (!tauriBridge || !tauriBridge.event || !tauriBridge.invoke) {
|
||||
return
|
||||
@@ -119,8 +175,15 @@ function LoadingApp() {
|
||||
}
|
||||
}
|
||||
|
||||
console.info("[loading] runtimeHost:", runtimeEnv.host)
|
||||
if (isTauriHost()) {
|
||||
void bootstrapTauri(getTauriBridge())
|
||||
} else if (runtimeEnv.host === "electron") {
|
||||
const api = getElectronAPI()
|
||||
console.info("[loading] electronAPI available:", !!api)
|
||||
if (api) {
|
||||
void bootstrapElectron(api)
|
||||
}
|
||||
}
|
||||
|
||||
onCleanup(() => {
|
||||
|
||||
Reference in New Issue
Block a user