Import AITURK IDE 1.0.0-beta.1 from Hermes 63279301; preserve MIT license
This commit is contained in:
commit
03634b1ca3
11340 files changed
+3442369
No files matched your search
@@ -0,0 +1,56 @@
|
||||
import { setTerminalTakeover } from '@/app/right-sidebar/store'
|
||||
import { isLayoutNode, type LayoutNode } from '@/components/pane-shell/tree/model'
|
||||
import { applyLayoutPreset, LAYOUTS_AREA } from '@/components/pane-shell/tree/presets'
|
||||
import { revealTreePane } from '@/components/pane-shell/tree/store'
|
||||
import { registry } from '@/contrib/registry'
|
||||
|
||||
import { setFileBrowserOpen, setSidebarOpen } from './layout'
|
||||
import { openReview } from './review'
|
||||
|
||||
// Explicit-request pane reveals, keyed to the backend `focus_pane` tool. Each
|
||||
// entry drives the pane's own reveal path (some are toggle-bound) so a revealed
|
||||
// pane matches a user-driven open. files/review are workspace-gated — a no-op
|
||||
// without a project cwd, which is the honest behavior.
|
||||
const PANE_REVEALERS: Record<string, () => void> = {
|
||||
chat: () => revealTreePane('workspace'),
|
||||
files: () => setFileBrowserOpen(true),
|
||||
review: () => openReview(),
|
||||
sessions: () => setSidebarOpen(true),
|
||||
terminal: () => setTerminalTakeover(true)
|
||||
}
|
||||
|
||||
/** Reveal a desktop pane by name. Returns false for an unknown pane. */
|
||||
export function revealDesktopPane(pane: string): boolean {
|
||||
const reveal = PANE_REVEALERS[pane]
|
||||
|
||||
if (!reveal) {
|
||||
return false
|
||||
}
|
||||
|
||||
reveal()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/** Apply a layout preset by id, resolved against the layouts contribution
|
||||
* registry — the SAME list the layout picker renders, so core presets
|
||||
* (default/focus/terminal-deck/quad), plugin presets, and user-saved presets
|
||||
* are all addressable by the backend `apply_layout` tool. Returns false for
|
||||
* an unknown id. */
|
||||
export function applyDesktopLayoutPreset(preset: string): boolean {
|
||||
if (!preset) {
|
||||
return false
|
||||
}
|
||||
|
||||
const entry = registry
|
||||
.getArea(LAYOUTS_AREA)
|
||||
.find(candidate => candidate.id === preset && isLayoutNode(candidate.data))
|
||||
|
||||
if (!entry) {
|
||||
return false
|
||||
}
|
||||
|
||||
applyLayoutPreset(entry.id, entry.data as LayoutNode)
|
||||
|
||||
return true
|
||||
}
|
||||
Reference in new issue
Block a user