layout

package
v0.70.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package layout declares the tab, panel and split operations of a chat or Code session, served on the drive MCP server.

Index

Constants

View Source
const (
	PlacementBehind = "behind"
	PlacementBeside = "beside"
	PlacementBelow  = "below"
)
View Source
const (
	MinSplitShare = 0.2
	MaxSplitShare = 0.8
)

The UI clamps a split to the same range, so a share outside it is refused rather than silently changed.

Variables

View Source
var LayoutGet = ops.Spec[LayoutGetIn]{
	Name: "layout.get", Owner: ops.OwnerDesktop, Effect: ops.EffectRead, Toolset: Toolset, Caller: ops.CallerRuleSession,
	Summary: "Read the panel layout",
	Guidance: "Read the panel layout of this chat or Code session as the app last reported it: each panel with its " +
		"tabs, which tab is shown, which panel has focus, and the splits that join the panels. Each tab is spelled the " +
		"way the tab tools take it, so you can pass it back. A Code session's terminal tabs carry the tmux window name. " +
		"known is false when the app has not reported this layout yet, for instance just after it started or when the " +
		"session has never been open in Code; then act without it. onScreen says whether the user is looking at this " +
		"session now. Call it first when you are not sure what is open.",
}
View Source
var PanelClose = ops.Spec[TabIn]{
	Name: "panel.close", Owner: ops.OwnerDesktop, Effect: ops.EffectWrite, Toolset: Toolset, Caller: ops.CallerRuleSession,
	Summary: "Close a panel",
	Guidance: "Ask Hive to close the panel that holds a tab. Its tabs join the neighbouring panel and none of them " +
		"close. The last panel stays.",
	Args: []string{"tab"},
}
View Source
var SplitResize = ops.Spec[SplitResizeIn]{
	Name: "split.resize", Owner: ops.OwnerDesktop, Effect: ops.EffectWrite, Toolset: Toolset, Caller: ops.CallerRuleSession,
	Summary: "Resize a split",
	Guidance: "Ask Hive to resize the nearest split of the panel that holds a tab. share, from 0.2 to 0.8, is the " +
		"share of the split that the side holding the tab gets.",
	Args:   []string{"tab"},
	Fields: ops.Constraints{"share": ops.Range(MinSplitShare, MaxSplitShare)},
}
View Source
var SplitTurn = ops.Spec[TabIn]{
	Name: "split.turn", Owner: ops.OwnerDesktop, Effect: ops.EffectWrite, Toolset: Toolset, Caller: ops.CallerRuleSession,
	Summary:  "Turn a split",
	Guidance: "Ask Hive to turn the nearest split of the panel that holds a tab between side by side and stacked.",
	Args:     []string{"tab"},
}
View Source
var TabClose = ops.Spec[TabCloseIn]{
	Name: "tab.close", Owner: ops.OwnerDesktop, Effect: ops.EffectWrite, Toolset: Toolset, Caller: ops.CallerRuleSession,
	Summary: "Close a tab",
	Guidance: "Ask Hive to close this chat or Code session's tab for a view (drive, diff, tasks or applet:<id>), wherever it " +
		"sits. Closing an applet's tab ends its page. Like tab_open, the tab closes only while the user is viewing this chat or session. Documents and " +
		"canvases are untouched; this closes the tab, not the content. view terminal needs window (a tmux window of " +
		"the Code session, by id or exact name) and kills that window through tmux whether or not the session is on " +
		"screen: it ends what runs in it, and the tab goes with it. Only close a window you started. A chat's " +
		"terminal is the chat, so tab_close refuses it.",
	Args: []string{"view"},
}
View Source
var TabFocus = ops.Spec[TabIn]{
	Name: "tab.focus", Owner: ops.OwnerDesktop, Effect: ops.EffectWrite, Toolset: Toolset, Caller: ops.CallerRuleSession,
	Summary: "Bring a tab to the front",
	Guidance: "Ask Hive to bring a tab forward and focus its panel; a terminal window is also selected in tmux. " +
		"This one takes the screen: use it when the user asked to see something, not to show off a result. For a result " +
		"use tab_open, which leaves the focus where it is.",
	Args: []string{"tab"},
}
View Source
var TabMove = ops.Spec[TabMoveIn]{
	Name: "tab.move", Owner: ops.OwnerDesktop, Effect: ops.EffectWrite, Toolset: Toolset, Caller: ops.CallerRuleSession,
	Summary: "Move a tab",
	Guidance: "Ask Hive to move a tab within this chat or Code session's panels. tab is a tab reference. placement " +
		"behind (the default) puts it in the anchor's panel right after the anchor, or at the end of the focused panel " +
		"with no anchor. beside and below split the anchor's panel (or the focused one) and move the tab into the new " +
		"panel. It applies only while the user is viewing this chat or session, and takes neither the keyboard nor " +
		"the focus.",
	Args:   []string{"tab"},
	Fields: placement,
}
View Source
var TabOpen = ops.Spec[TabOpenIn]{
	Name: "tab.open", Owner: ops.OwnerDesktop, Effect: ops.EffectWrite, Toolset: Toolset, Caller: ops.CallerRuleSession,
	Summary: "Open a tab or terminal beside the session",
	Guidance: "Ask Hive to open a tab beside this chat or Code session. view is drive (the session's documents and " +
		"canvases), diff (the Code session's changes), tasks (its task board), terminal (a tmux window of the Code " +
		"session) or applet:<id> (an applet whose applet.yaml lists surfaces.tab; opening it runs its page). The tab applies only while the user is viewing this chat or session, and there is no " +
		"acknowledgment; a terminal's tmux window is started whether or not they are. A chat has drive and applets; diff, " +
		"tasks and terminal belong to a Code session. The shared space (global) sits beside no session, so it has no " +
		"tabs; the user reads it in the Drive page. path, for drive only, shows one document by its path in the space, " +
		"or a canvas by name or path (perf is canvases/perf.canvas.json); it must exist. Omit it to leave the tab on " +
		"its own pick. terminal starts a new window in the session's checkout, a shell with nothing running in it, or " +
		"places one that exists. It opens detached, so it never takes the keyboard or the screen. It takes no command: " +
		"run your own work yourself, and open a terminal for the user to type in. window, for terminal only, places " +
		"an existing window of the session by tmux id (@3) or exact name instead of starting one, and excludes name. " +
		"name, for terminal only, names the new window. The session must be running; start it in Code first. " +
		"placement behind (the default) adds the tab behind the tab " +
		"in front, with an unseen dot, and never takes the screen; beside splits the panel in front and opens the tab " +
		"next to it, and below splits it downward, so the user sees it at once. All leave the keyboard where it is, " +
		"and a tab that is already open stays where it is under any. anchor, a tab reference (drive, diff, tasks, " +
		"terminal, or a window by id or name), is the tab to place relative to instead of the tab in front of the " +
		"focused panel. Call it when you finish something worth looking at now, not on every write: " +
		"a write while a Drive tab is open behind another tab already lights a dot on it. Use beside or below only " +
		"for a result the user asked to see side by side with the terminal. If you are not sure what is open, call " +
		"layout_get first.",
	Args:   []string{"view"},
	Fields: placement,
}
View Source
var Toolset = ops.Toolset{Name: "layout", MCPPath: "/mcp/drive"}

Functions

func All

func All() []ops.Op

Types

type LayoutGetIn

type LayoutGetIn struct {
	Caller string `` /* 318-byte string literal not displayed */
}

type SplitResizeIn

type SplitResizeIn struct {
	Caller string  `` /* 318-byte string literal not displayed */
	Tab    string  `` /* 266-byte string literal not displayed */
	Share  float64 `json:"share"  jsonschema:"The share of the nearest split that the side holding the tab gets, from 0.2 to 0.8."`
}

type TabCloseIn

type TabCloseIn struct {
	Caller string `` /* 328-byte string literal not displayed */
	View   string `` /* 198-byte string literal not displayed */
	Window string `` /* 198-byte string literal not displayed */
}

type TabIn

type TabIn struct {
	Caller string `` /* 318-byte string literal not displayed */
	Tab    string `` /* 244-byte string literal not displayed */
}

TabIn names one tab. tab.focus, panel.close and split.turn take it.

type TabMoveIn

type TabMoveIn struct {
	Caller    string `` /* 331-byte string literal not displayed */
	Tab       string `` /* 244-byte string literal not displayed */
	Placement string `` /* 251-byte string literal not displayed */
	Anchor    string `` /* 135-byte string literal not displayed */
}

type TabOpenIn

type TabOpenIn struct {
	Caller    string `` /* 331-byte string literal not displayed */
	View      string `` /* 289-byte string literal not displayed */
	Path      string `` /* 218-byte string literal not displayed */
	Placement string `` /* 277-byte string literal not displayed */
	Anchor    string `` /* 242-byte string literal not displayed */
	Window    string `` /* 188-byte string literal not displayed */
	Name      string `` /* 158-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL