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:
77
packages/ui/src/stores/solo-store.ts
Normal file
77
packages/ui/src/stores/solo-store.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import { createSignal } from "solid-js"
|
||||
import { getLogger } from "../lib/logger"
|
||||
|
||||
const log = getLogger("solo")
|
||||
|
||||
export interface SoloState {
|
||||
isAutonomous: boolean
|
||||
autoApproval: boolean
|
||||
maxSteps: number
|
||||
currentStep: number
|
||||
activeTaskId: string | null
|
||||
taskQueue: string[]
|
||||
}
|
||||
|
||||
const [soloStates, setSoloStates] = createSignal<Map<string, SoloState>>(new Map())
|
||||
|
||||
export function getSoloState(instanceId: string): SoloState {
|
||||
const state = soloStates().get(instanceId)
|
||||
if (!state) {
|
||||
return {
|
||||
isAutonomous: false,
|
||||
autoApproval: false,
|
||||
maxSteps: 50,
|
||||
currentStep: 0,
|
||||
activeTaskId: null,
|
||||
taskQueue: [],
|
||||
}
|
||||
}
|
||||
return state
|
||||
}
|
||||
|
||||
export function setSoloState(instanceId: string, partial: Partial<SoloState>) {
|
||||
setSoloStates((prev) => {
|
||||
const next = new Map(prev)
|
||||
const current = getSoloState(instanceId)
|
||||
next.set(instanceId, { ...current, ...partial })
|
||||
return next
|
||||
})
|
||||
}
|
||||
|
||||
export function toggleAutonomous(instanceId: string) {
|
||||
const current = getSoloState(instanceId)
|
||||
setSoloState(instanceId, { isAutonomous: !current.isAutonomous })
|
||||
log.info(`Autonomous mode ${!current.isAutonomous ? "enabled" : "disabled"} for ${instanceId}`)
|
||||
}
|
||||
|
||||
export function toggleAutoApproval(instanceId: string) {
|
||||
const current = getSoloState(instanceId)
|
||||
setSoloState(instanceId, { autoApproval: !current.autoApproval })
|
||||
log.info(`Auto-approval ${!current.autoApproval ? "enabled" : "disabled"} for ${instanceId}`)
|
||||
}
|
||||
|
||||
export function incrementStep(instanceId: string) {
|
||||
const state = getSoloState(instanceId)
|
||||
setSoloState(instanceId, { currentStep: state.currentStep + 1 })
|
||||
}
|
||||
|
||||
export function resetSteps(instanceId: string) {
|
||||
setSoloState(instanceId, { currentStep: 0 })
|
||||
}
|
||||
|
||||
export function setActiveTaskId(instanceId: string, taskId: string | null) {
|
||||
setSoloState(instanceId, { activeTaskId: taskId })
|
||||
}
|
||||
|
||||
export function addToTaskQueue(instanceId: string, taskId: string) {
|
||||
const current = getSoloState(instanceId)
|
||||
setSoloState(instanceId, { taskQueue: [...current.taskQueue, taskId] })
|
||||
}
|
||||
|
||||
export function popFromTaskQueue(instanceId: string): string | null {
|
||||
const current = getSoloState(instanceId)
|
||||
if (current.taskQueue.length === 0) return null
|
||||
const [next, ...rest] = current.taskQueue
|
||||
setSoloState(instanceId, { taskQueue: rest })
|
||||
return next
|
||||
}
|
||||
Reference in New Issue
Block a user