Documentation
¶
Overview ¶
Package viewapi defines the window-scoped service contracts shared between live Desktop windows and compiled view modules.
Index ¶
- func IsLegacyPackage(name, digest string) bool
- func WithServices(ctx context.Context, services Services) context.Context
- type ActionCard
- type AttachmentPickMode
- type AttachmentSelection
- type CardAction
- type CardButton
- type CardRow
- type CardTone
- type Change
- type ChipStrip
- type ComposerAttachment
- type ComposerModel
- type ComposerNotice
- type ComposerProfile
- type Conversation
- type ConversationAssociation
- type ConversationDraft
- type ConversationIdentity
- type ConversationOverview
- type ConversationPrompt
- type ConversationSpec
- type ConversationToolCall
- type ConversationToolHistory
- type ConversationToolObserver
- type Destination
- type DirectoryOptions
- type FileTypes
- type MediaGrid
- type MediaTile
- type MemoryFilter
- type MemorySummary
- type MessageReference
- type NodeAvailability
- type NodeInfo
- type PanelTabSpec
- type ProductAttachment
- type ProjectActions
- type ProviderAccount
- type Receipt
- type SendMessageRequest
- type Services
- type Session
- type SessionConfig
- type SourceFile
- type Terminal
- type TerminalInfo
- type UsageInventory
- type UsageNodeSource
- type UsageNodeView
- type UsageOverview
- type UsageSample
- type UsageScopedGroup
- type UsageScopedPage
- type UsageScopedRequest
- type UsageServices
- type UsageSource
- type UsageSummary
- type UsageWatch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLegacyPackage ¶
IsLegacyPackage recognizes a captured official package by its immutable content.
Types ¶
type ActionCard ¶
type ActionCard struct {
// Body optionally renders the owning module's current projection in place
// of the static fields. It runs on the UI thread only while the turn is drawn.
Body func(*ui.Context)
Code string
Badge string
Status string
StatusTone CardTone
Title, Detail string
Meta []string
Image ui.ImageSource
ImageAlt string
ImageOpen func()
Open func()
Rows []CardRow
Buttons []CardButton
Chips ChipStrip
Media MediaGrid
// Icon, when set, leads the card in a tile tinted by the title: what
// kind of product it is, as a document, a table or a web page.
Icon *ui.SVG
// ID names the card among the window's, for its menu; it is needed
// only with Actions.
ID string
// Actions, when given, fill a "more" menu at the card's end, in order:
// what the product's module offers on it, such as export or showing it
// in the asset library.
Actions []CardAction
}
ActionCard projects a tool's structured result or a custom data card. Products resolve and authorize any preview and Open actions; the renderer never reads a path.
func (ActionCard) Render ¶
func (card ActionCard) Render(c *ui.Context)
type AttachmentPickMode ¶
type AttachmentPickMode uint8
const ( PickSingleFile AttachmentPickMode = iota PickMultipleFiles PickDirectory )
type AttachmentSelection ¶
AttachmentSelection describes one admitted selection. Directories includes the chosen root. Cancellation yields a zero selection and no cards.
type CardAction ¶
CardAction is an item of an ActionCard's menu.
type CardButton ¶
CardButton is an inline action button rendered in an ActionCard's footer.
type CardRow ¶
type CardRow struct {
ID string
Code string
Title string
Badge string
Status string
StatusTone CardTone
Avatar func(*ui.Context, float32)
Open func()
}
CardRow is one compact horizontal item inside an ActionCard's Rows list.
type CardTone ¶
type CardTone string
CardTone colors status dots and labels on structured data cards and rows.
type ComposerAttachment ¶
type ComposerAttachment struct {
Node protocol.NodeID
Worktree protocol.WorktreeID
ID protocol.AttachmentID
Name, RelativeName, Revision string
Size uint64
}
ComposerAttachment names a published Node attachment. A zero Worktree identifies a private draft belonging to the authenticated controller.
type ComposerModel ¶
type ComposerModel struct {
Provider string // provider ID
Model protocol.ConversationModel
}
type ComposerNotice ¶
ComposerNotice describes a status strip stacked directly onto the top edge of the composer surface, using the queue tray's tucked layout.
type ComposerProfile ¶
type ComposerProfile struct {
RequireTools, HideDevelopment bool
MatchModel func(ComposerModel) bool
}
ComposerProfile limits the mount to single-model execution. MatchModel refines the authenticated Node catalog, including when RequireTools is set.
type Conversation ¶
type Conversation struct {
Render func(*ui.Context)
Header func(*ui.Context, string)
// SelectedSession reports the current history selection, or zero for a
// draft or an as-yet unselected mount. Call on the UI thread.
SelectedSession func() protocol.SessionID
// FocusSession explicitly selects an existing session admitted by Match or
// ReadOnlyHistory. When the connected Node cannot open that session, the
// mount shows its draft and returns false. Only unpinned mounts can focus.
// Call on the UI thread.
FocusSession func(protocol.SessionID) bool
// ResumeConversation leaves read-only history for the continuous mount's
// current conversation or retained draft. Call on the UI thread.
ResumeConversation func()
// HasDraft reports whether the mount has unsent input or a submission
// that is still in flight or unconfirmed. Call on the UI thread.
HasDraft func() bool
// PickAttachments opens an OS picker. Call on the UI thread. If accepted,
// done runs on the UI thread after selection, while this target is current.
PickAttachments func(AttachmentPickMode, func(AttachmentSelection, error)) bool
// ReplaceProductAttachments, when available, stages files in this mount's
// unsent draft without changing attachments added through the composer.
// Call on the UI thread, including before the first render if the mount
// resolves to a draft. An empty batch clears only the product files.
// An admission error keeps existing cards; uploads report on their cards.
ReplaceProductAttachments func([]ProductAttachment) error
// ReadyAttachments is an ordered, all-or-nothing snapshot for submission.
ReadyAttachments func() ([]ComposerAttachment, bool)
// FillPrompt replaces the current editor text and requests focus. UI thread
// only. False means the mounted target cannot currently accept this edit.
FillPrompt func(string) bool
// AppendPrompt stages more text without submitting or replacing unsent input.
AppendPrompt func(string) bool
// InsertMention inserts or replaces a structured @mention chip (kind is
// "team" or "role", id is the bare team/role ID) in the current editor and
// focuses it. Kind "entity" with id "<type>:<id>" instead adds the chip of
// an entity reference the conversation offers, after the draft. UI thread
// only.
InsertMention func(kind, id string) bool
// SendMessage submits a message into this mount's active session without
// overwriting the user's composer draft. UI thread only.
SendMessage func(SendMessageRequest) bool
// RenderComposer lays out only the native editor at its intrinsic height.
// Render either RenderComposer or Render once per mount per frame.
RenderComposer func(*ui.Context)
Close func()
}
type ConversationAssociation ¶
type ConversationAssociation = protocol.ConversationAssociation
type ConversationDraft ¶
type ConversationDraft struct {
Project protocol.ProjectID
Association *protocol.ConversationAssociation
Team protocol.TeamID
Role protocol.RoleID
}
ConversationDraft supplies the project, association and execution scope for a new conversation. A zero Project means no project. Team and Role are mutually exclusive; leaving both zero keeps the default scope.
type ConversationIdentity ¶
type ConversationIdentity struct {
Name string
Description string
Avatar func(*ui.Context, float32)
}
ConversationIdentity gives the welcome surface a name, optional description and optional avatar.
type ConversationOverview ¶
type ConversationOverview struct {
Title string
Icon *ui.SVG
Active bool
Badge int
Attention bool
Render func(c *ui.Context, close func())
OnOpen func(open bool)
}
ConversationOverview supplies custom content for a mounted conversation's overview card (docked beside wide transcripts, or a header popover in narrow panes).
type ConversationPrompt ¶
ConversationPrompt is a starter a mount offers over its empty conversation: Label on the capsule, Text put in the editor (Label when empty). Pinned keeps it among the starters when the mount offers more than three; all pinned prompts show even beyond three.
type ConversationSpec ¶
type ConversationSpec struct {
// ResourcePanelScope opts this transcript into its module page's shared
// right panel. It returns the expected WorkspaceSlots.PanelScope on the
// UI thread. An empty or mismatched scope does not admit scoped resources.
// Nil keeps the ordinary conversation open behavior.
ResourcePanelScope func() string
// Node selects the execution Node whose sessions the mount opens and
// drives: its history and Match, draft and first send, sends, Header,
// FocusSession, SelectedSession and Identity's sessions. Zero keeps the
// window's target Node (Services.Node). A peer must be connected when
// the mount is made, or MountConversation returns the zero Conversation;
// while it is away afterwards the mount is unavailable (it draws nothing
// and refuses edits) and resumes on the same Node when the peer returns.
// It never falls back to another Node.
Node protocol.NodeID
// Session pins the mount to one existing session on this Node, including a
// listed delegated session. Once a writable, unfiltered target disappears
// from the live inventory its mount offers an unsent draft in that location.
// ReadOnly and Match retain their explicit admission boundary.
Session protocol.SessionID
Match func(Session) bool
// ReadOnly renders a pinned session as a transcript, without composer or
// execution controls. It does not admit sessions outside Match.
ReadOnly bool
// ReadOnlyHistory admits additional sessions to an unpinned mount's
// history picker and FocusSession. It does not select sessions automatically,
// adopt drafts, or grant write access. Match takes precedence.
ReadOnlyHistory func(Session) bool
// Project is the selected project ID on this mount's execution Node. A
// nonempty ID scopes history and the first turn to that project's worktree.
Project string
Profile *ComposerProfile
// Association scopes the history and is captured on the first submitted
// turn. When supplied, Match and Config are optional refinements.
Association *ConversationAssociation
// AssociationAtSend optionally supplies the association ID (empty keeps
// Association.ID) at a draft's first send, on the UI thread. Namespace and
// Kind stay fixed; retries of an unresolved request use the captured ID.
// Set both Association and Match: Match then selects IDs within that
// Namespace and Kind, including any ID the callback can supply.
AssociationAtSend func() string
// Config supplies a draft configuration. Its resource, if any, is
// captured at mount time by calling Config with a default configuration.
Config func(SessionConfig) SessionConfig
// Draft opts into the native welcome composer and sets its draft scope.
Draft *ConversationDraft
// SelectWorkspaceProject offers project navigation under the composer of a
// team or role mount. The zero ID selects No project. The callback runs on
// the UI thread and changes the caller's workspace, not the mounted draft
// or session's project.
SelectWorkspaceProject func(protocol.ProjectID)
// ProjectMentions offers projects visible on the current Node as message
// references. Choosing one does not change the session or its worktree.
ProjectMentions bool
// Identity, if given, is read on the UI thread when drawing the welcome surface.
Identity func() ConversationIdentity
// DefaultSpeaker, if given, supplies the default assistant name and avatar
// for replies in this mount that have no explicit addressed speaker.
DefaultSpeaker func() ConversationIdentity
// HideWelcomeShortcuts omits development prompt cards from this mount's
// empty conversation without replacing its identity or native composer.
HideWelcomeShortcuts bool
// Prompts, if given, are shown as capsules above the composer while the
// mounted conversation has no turns. Choosing one replaces the editor's
// text with its Text and focuses the editor; it never sends. Read on the
// UI thread while drawing. Up to three show as given. From a longer list
// every Pinned prompt shows first, in order, and a random choice of the
// others fills up to three; the choice stays while that empty
// conversation or draft shows. After a reply the capsules show the
// Node's follow-up suggestions instead, as in every live conversation.
Prompts func() []ConversationPrompt
// HideNewSession makes an unpinned mount one continuous conversation, as
// a Bot's or a lead's chat: Header shows only the history control, with
// no new-conversation button, and nothing in the mount starts a second
// session while one is selected. The first session still starts from
// the draft. History can be opened by ID and ResumeConversation returns
// to the current writable selection.
HideNewSession bool
// HideHistory omits the header history picker button for single-stream
// continuous chats such as Bot DMs and Group chats.
HideHistory bool
// HideModeControls removes the composer's mode and permission entries,
// including Shift+Tab and / mode commands; sends use the standard mode and
// ask first (or Permission when provided). Models, teams, attachments and
// references are unaffected.
HideModeControls bool
// HideModelControls removes the composer's model/role selector chip for
// surfaces whose model or roster is already owned by the active Bot or Group.
HideModelControls bool
// Permission, when non-nil, supplies the live permission level for this
// mounted conversation (e.g. synced from a Bot or Group contact permission
// picker) instead of clamping discussion turns to AskFirst.
Permission func() protocol.Permission
// HideTurnMenus removes per-turn Fork/Rewind and More/Export menus from
// reply footers (e.g. in Bot and Group desk chats) while keeping Copy,
// Read aloud, Retry, and timestamps.
HideTurnMenus bool
// HideTurnChanges hides the per-turn edited-files review card (used for
// Bot/Group desk chats that have no git repository).
HideTurnChanges bool
// ExecutorMentions makes team and role @mentions name executors for the
// conversation's own assistant to assign: they stay in the message text
// but are never sent as recipients, so the default speaker always
// replies, and a message may name several of them.
ExecutorMentions bool
// CanSend optionally gates composer submissions without hiding the editor.
// It is checked on the UI thread during rendering and again at submission.
CanSend func() bool
// Tools is optional. Its callback runs on the UI thread while mounted.
Tools *ConversationToolObserver
// FirstMessageContext supplies optional text appended to a new session's
// first message. It runs on the UI thread at send time. The editor and
// its recoverable draft are not changed, and retries of an unresolved
// request use the originally captured text.
FirstMessageContext func() string
// SendBlocked temporarily holds submission while the module prepares draft
// inputs. It does not override the Shell's existing model or upload checks.
SendBlocked func() bool
// ComposerTop renders above the editor. ComposerToolbar renders inline
// beside Attach; it should use controls with intrinsic widths. If set,
// ComposerToolbarCompact replaces it when the editor gets narrow.
ComposerTop, ComposerToolbar func(*ui.Context)
ComposerToolbarCompact func(*ui.Context)
// ComposerNotice, when non-nil and returning a non-empty notice, renders a
// status tray stacked onto the top edge of the composer surface (sharing the
// queue tray's tucked layout).
ComposerNotice func(*ui.Context) *ComposerNotice
// ComposerPlaceholder, when non-nil and returning a non-empty string,
// overrides the composer input placeholder for this mounted conversation.
ComposerPlaceholder func(*ui.Context) string
// ComposerMaxWidth, if positive, lets RenderComposer's input surface span
// up to this width with no side gutter of its own, so a page that already
// pads its content can align the surface with its other content. Zero
// keeps the transcript composer's width and gutter. Render ignores it.
ComposerMaxWidth float32
// ComposerEditorMinHeight, if positive, raises RenderComposer's editor
// minimum height (two lines, 42) for a start page; the editor still grows
// to its usual maximum. Fonts and toolbar sizes are unchanged. Render
// ignores it.
ComposerEditorMinHeight float32
// ComposerAbove, if set, renders a row outside the input surface, 8 above
// it: under the activity strip and over the queue tray, which stays
// tucked onto the surface. It takes no room of the activity strip or the
// queue, and leaves the surface's own content as it is. Render ignores it.
ComposerAbove func(*ui.Context)
// Overview, if set, supplies a custom floating/popover overview card for
// this mounted conversation, reusing the shell's three-tier width layout.
Overview func(*ui.Context) *ConversationOverview
}
type ConversationToolCall ¶
type ConversationToolCall struct {
Approval string `json:"-"` // the pending one-time decision on this exact call, if any
Turn string `json:"turn,omitempty"`
Key string `json:"key"`
Name string `json:"name"`
Arguments json.RawMessage `json:"arguments"`
State string `json:"state"`
TimestampMs int64 `json:"timestamp_ms"`
Result json.RawMessage `json:"result"`
Sequence *string `json:"sequence"`
}
type ConversationToolHistory ¶
type ConversationToolObserver ¶
type ConversationToolObserver struct {
Names []string
LegacyPackage string
Publish func(ConversationToolHistory)
// Present maps a retained, completed tool call into native result blocks
// below its own turn in the mounted transcript. Nil omits the card.
Present func(ConversationToolCall) *ActionCard
// PresentApproval may replace a pending tool result with actions for its
// original one-time approval. A decision never applies to another session.
PresentApproval func(call ConversationToolCall, confirm, cancel func()) *ActionCard
// PresentReadOnly opts into completed result cards in authorized history.
// Supply navigation-only actions for these historical cards.
PresentReadOnly func(ConversationToolCall) *ActionCard
}
ConversationToolObserver projects only the named calls of the mounted conversation, never calls from another session. Names also apply to the aliases of LegacyPackage when a saved conversation predates the module.
type Destination ¶
type Destination struct {
Writer io.WriteCloser
Publish func(context.Context) error
Close func()
}
type DirectoryOptions ¶
type DirectoryOptions struct {
Title string
// Actions draws the header's actions, in color: the page's sort menu,
// add button and the like. Nil leaves the header without any.
Actions func(c *ui.Context, color ui.Color)
// Menu adds items to a project row's Shell menu, as DrawDirectoryMenu's.
Menu func(protocol.ProjectID, *ui.Menu) bool
// Children draws an open project's tree.
Children func(protocol.ProjectID)
// Before draws above the projects, under the header: a search line.
Before func(c *ui.Context)
// Filter, when set, lists a project only where shown, and holds it open
// where open without changing its saved disclosure: a search keeps the
// projects it found something in, open. Nil lists every project.
Filter func(protocol.ProjectID) (shown, open bool)
}
DirectoryOptions are a page's project directory (DrawDirectoryWith).
type FileTypes ¶
FileTypes are the files a picker offers: their kind's name, and their extensions with or without the dot.
type MediaTile ¶
type MediaTile struct {
Title string
Preview ui.ImageSource
Open func()
}
type MemoryFilter ¶
MemoryFilter selects active entries by exact ownership. A positive Limit bounds a read. Entry identifies a saved entry to open directly.
type MemorySummary ¶
type MemorySummary = protocol.MemorySummary
type MessageReference ¶
type MessageReference struct {
Kind, ID, Label string
}
MessageReference attaches a structured @mention (role, team, project, entity, or session) to a programmatically sent message.
type NodeAvailability ¶
NodeAvailability distinguishes a temporarily unavailable executor from an explicitly removed relationship. Unknown devices are treated as offline.
type NodeInfo ¶
type NodeInfo struct {
ID protocol.NodeID
Label string
Connected bool
Local bool
ProjectSources []string
Tools []protocol.HostTool
CanClone bool
}
NodeInfo describes an execution Node visible to this window.
type PanelTabSpec ¶
type PanelTabSpec struct {
Kind string
Key string
// Title is the static fallback tab title when TitleFunc is nil or returns empty.
Title string
// TitleFunc, when non-nil, is evaluated live on every frame for the tab title.
TitleFunc func() string
Icon *ui.SVG
// Busy is the static fallback spinner flag when BusyFunc is nil.
Busy bool
// BusyFunc, when non-nil, is evaluated live on every frame for the tab spinner.
BusyFunc func() bool
Render func(*ui.Context)
OnClose func()
}
PanelTabSpec registers a dynamic module-owned tab in the window's right panel.
type ProductAttachment ¶
ProductAttachment is an in-memory file the user explicitly selected through a native product's scoped UI. Key is a nonempty identity unique in the batch; Name is a filename, not a path. MediaType does not include parameters; an empty value uses application/octet-stream. The composer copies Data.
type ProjectActions ¶
type ProjectActions struct {
// DrawDirectory uses the window's project order, sort menu and folder
// disclosures. Only open folders mount their product-specific children.
DrawDirectory func(c *ui.Context, title string, children func(protocol.ProjectID, bool))
// DrawDirectoryMenu is DrawDirectory whose project rows' Shell menus also
// build menu's items after the new-session item. menu reports whether one
// of its items was chosen, which opens that project's disclosure. Nil when
// the host predates it; a nil menu draws DrawDirectory.
DrawDirectoryMenu func(c *ui.Context, title string, menu func(protocol.ProjectID, *ui.Menu) bool, children func(protocol.ProjectID, bool))
// DrawDirectoryWith is DrawDirectoryMenu for a page whose tree is not
// sessions: its header carries the page's own actions in place of the
// Shell's sort menu (and its archived sessions) and add-project button,
// and children are never asked for archived ones. Nil when the host
// predates it.
DrawDirectoryWith func(c *ui.Context, o DirectoryOptions)
// DrawRow draws this Node's inventory project with its Shell menu and
// persistent disclosure. The page supplies selection and filtered children.
DrawRow func(c *ui.Context, id protocol.ProjectID, selected bool, selectProject, children func()) bool
Create func() bool
Edit func(protocol.ProjectID) bool
AskRemove func(*ui.Context, protocol.ProjectID) bool
}
type ProviderAccount ¶
type ProviderAccount struct {
Authentication protocol.Authentication
ProviderRevision uint64
Credential protocol.CredentialID
CredentialKnown bool
CredentialRevision uint64
AccountLabel string
Brand string
PluginPackage string
PluginProvider string
}
ProviderAccount identifies a connected provider's credential binding. CredentialKnown is false until its credential metadata has loaded.
type SendMessageRequest ¶
type SendMessageRequest struct {
Text string
References []MessageReference
OnSettled func(bool)
}
SendMessageRequest sends a message into an existing session through the standard composer submission pipeline without overwriting the user's draft.
type Services ¶
type Services struct {
Node protocol.NodeID
Connected func() bool
Next func(context.Context, string) (Change, error)
Post func(func(*ui.Context)) bool
Wake func()
Async func(func()) bool
Prepare func(protocol.Command) protocol.Request
Execute func(context.Context, protocol.Request) (protocol.Output, error)
Settle func(context.Context, protocol.Request) (protocol.Output, error)
Resolve func(context.Context, protocol.Request) (Receipt, error)
Outcome func(context.Context, protocol.Request) (protocol.RequestOutcome, error)
// Multi-node discovery, execution, snapshots and window-wide notifications.
Nodes func() []NodeInfo
// NodeLabel resolves the canonical localized display name for any Node ID:
// the local host name in the window's active locale, the peer's canonical
// name when known or remembered, or a consistent short ID fallback.
NodeLabel func(protocol.NodeID) string
NodeAvailability func(protocol.NodeID) NodeAvailability
// ModelOptions returns the canonical kit.ModelSelect options for enabled
// model channels on the given Node (zero NodeID selects the local Node),
// with Mark, Brand, BrandName, Efforts, DefaultEffort, and Score populated.
ModelOptions func(protocol.NodeID) []kit.ModelOption
PrepareOn func(protocol.NodeID, protocol.Command) (protocol.Request, error)
ExecuteOn func(context.Context, protocol.NodeID, protocol.Request) (protocol.Output, error)
SettleOn func(context.Context, protocol.NodeID, protocol.Request) (protocol.Output, error)
ResolveOn func(context.Context, protocol.NodeID, protocol.Request) (Receipt, error)
OutcomeOn func(context.Context, protocol.NodeID, protocol.Request) (protocol.RequestOutcome, error)
Snapshot func(protocol.NodeID) (*protocol.Snapshot, bool)
// SessionExists queries the live session inventory without copying it.
// During initial load, disconnection or recovery it returns known=false.
SessionExists func(node protocol.NodeID, session protocol.SessionID) (exists, known bool)
ProviderAccount func(protocol.NodeID, protocol.ProviderID) (ProviderAccount, bool)
Credentials func(protocol.NodeID) map[protocol.CredentialID]protocol.Credential
// OpenSession opens a session or, when absent or zero, the Node's new conversation.
OpenSession func(protocol.NodeID, protocol.SessionID)
// OpenArtifact opens a session-owned HTML artifact read-only in the current
// page's right panel (works on Bot, Tasks, and Conversation pages).
OpenArtifact func(node protocol.NodeID, session protocol.SessionID, artifact protocol.ArtifactID, title string) bool
// OpenDraftAt opens an unsent conversation on this Node in the given
// project and worktree. Zero IDs select the Node's ordinary draft location.
OpenDraftAt func(protocol.NodeID, protocol.ProjectID, protocol.WorktreeID)
// OpenRosterEditor opens the selected Node's Bot or squad editor over
// the window's current page, or its templates in Settings, on the UI
// thread. Use "bot" or "squad" with an empty ID to create.
OpenRosterEditor func(node protocol.NodeID, kind, id string) bool
// ReadMemories runs off the UI thread. OpenMemory and NewMemory navigate on it.
ReadMemories func(context.Context, protocol.NodeID, MemoryFilter) ([]MemorySummary, error)
OpenMemory func(protocol.NodeID, MemoryFilter) bool
NewMemory func(protocol.NodeID, MemoryFilter) bool
RevealDetails func()
// OpenPanelTab opens or focuses a dynamic module-owned tab in the window's
// right panel on the current page. UI thread only.
OpenPanelTab func(PanelTabSpec) bool
// UpdatePanelTab updates an open module-owned right-panel tab in place.
UpdatePanelTab func(PanelTabSpec) bool
// ClosePanelTab closes a module-owned right-panel tab by kind and key.
ClosePanelTab func(kind, key string) bool
// SendMessage sends a message into an existing session through the standard
// composer submission pipeline without disturbing the user's draft.
SendMessage func(node protocol.NodeID, session protocol.SessionID, req SendMessageRequest) bool
// FillSessionDraft replaces an existing session's composer draft text and
// focuses the editor with the caret at the end.
FillSessionDraft func(node protocol.NodeID, session protocol.SessionID, text string) bool
// OpenPage shows another page of this window: a page's ID, or
// "page#subview" for one of its registered subviews (as a welcome card
// links them), the page choosing what the subview opens. It runs on
// the UI thread after the current frame; an unknown target is ignored.
OpenPage func(target string)
// HTMLView draws an HTML page in the element's place, in the same
// sandbox as a conversation's documents: no network, no navigation
// away, no new windows. key names the page, so one kept page reloads
// only when html changes. It reports false where no web view can show
// it, and the caller draws its fallback. UI thread only.
HTMLView func(c *ui.Context, key, html string) bool
Unread func(string) int
HintDismissed func(string) bool
DismissHint func(string)
OnChange func(func()) func()
Usage *UsageServices
// ProjectActions opens the shared editor and confirmation on the UI thread.
ProjectActions ProjectActions
// Mounting and interacting with these elements run on the window's UI thread.
TerminalLaunch func(*ui.Context) any
MountTerminal func(protocol.TerminalID, func(TerminalInfo) bool) Terminal
MountConversation func(ConversationSpec) Conversation
// Native pickers wait for a choice; call them outside the UI thread.
PickFiles func(context.Context) ([]string, error)
// PickFilesOf is PickFiles offering only files of the given types.
PickFilesOf func(context.Context, FileTypes) ([]string, error)
PickFolder func(context.Context) (string, error)
PickDestination func(context.Context, string) (string, error)
PickSecret func(context.Context, string) ([]byte, string, error)
WriteClipboard func(string) error
Preview func(string, func(context.Context, uint64, func(uint64, uint64)) ([]byte, error)) error
// File paths are captured by a native picker or drop, not by the template.
OpenSource func(context.Context, string, uint64) (SourceFile, error)
OpenDestination func(string) (Destination, error)
Upload func(context.Context, protocol.StreamID, uint64, string, io.ReadCloser, func(uint64)) error
Download func(context.Context, protocol.StreamID, uint64, string, io.WriteCloser, func(uint64)) error
ReleaseStream func(protocol.StreamID)
}
Services belong to one window and its local Node. They are for compiled contributions, which expose only their scoped operations to a template. Requests and local file paths must come from those native operations, not directly from a template. Persistent operations outlive a template.
type SessionConfig ¶
type SessionConfig = protocol.SessionConfig
type SourceFile ¶
type SourceFile struct {
Reader io.ReadCloser
Size uint64
Revision string
}
type TerminalInfo ¶
type TerminalInfo = protocol.TerminalInfo
type UsageInventory ¶
type UsageInventory struct {
Node protocol.NodeID
Label string
Projects []protocol.Project
Providers []protocol.ConversationProvider
}
UsageInventory holds the filter options available on one Node.
type UsageNodeSource ¶
type UsageNodeSource struct {
Node protocol.NodeID
Entry protocol.NodeID
View UsageNodeView
}
UsageNodeSource pairs a Node route with its observed usage view.
type UsageNodeView ¶
type UsageNodeView struct {
Report *protocol.UsageReport
Connected bool
Refreshing bool
Error *protocol.Fault
}
UsageNodeView is the current observation state of one Node in a usage overview.
type UsageOverview ¶
type UsageOverview struct {
Sources []UsageNodeSource
Summary *UsageSummary
Complete bool
Error *protocol.Fault
}
UsageOverview is one consistent snapshot produced by WatchOverview.
type UsageSample ¶
type UsageSample struct {
Revision uint64
Report func(protocol.NodeID, protocol.UsageQuery) (protocol.UsageReport, error)
Inventory func() ([]protocol.Project, []protocol.ConversationProvider)
}
UsageSample serves in-memory Demo usage reports and filter inventory without contacting any Node. Revision advances whenever the demo ledger changes.
type UsageScopedGroup ¶
type UsageScopedGroup struct {
Node protocol.NodeID
Entry protocol.NodeID
Group protocol.UsageGroup
}
UsageScopedGroup tags a usage breakdown group with the Node that reported it.
type UsageScopedPage ¶
type UsageScopedPage struct {
Items []UsageScopedRequest
HasMore bool
}
UsageScopedPage is one cursor-paginated slice of merged usage requests.
type UsageScopedRequest ¶
type UsageScopedRequest struct {
Request protocol.UsageRequest
Entry protocol.NodeID
}
UsageScopedRequest tags a usage request record with its entry Node.
type UsageServices ¶
type UsageServices struct {
Sources func() []UsageSource
// WatchOverview observes usage for target, or across all active Sources
// when target is the zero NodeID. onUpdate runs off the UI thread. Call
// Close to release the watch; closing the window also stops active watches.
WatchOverview func(context.Context, protocol.NodeID, protocol.UsageQuery, func(UsageOverview, error)) (UsageWatch, error)
ReadUsage func(context.Context, protocol.NodeID, protocol.UsageQuery) (protocol.UsageReport, error)
Inventory func(protocol.NodeID) (UsageInventory, bool)
Sample func() (*UsageSample, bool)
}
UsageServices exposes multi-node and Demo usage operations to native modules.
type UsageSource ¶
UsageSource identifies a Node included in usage reads and overviews.
type UsageSummary ¶
type UsageSummary struct {
Totals protocol.UsageMetrics
Days []protocol.UsagePoint
Recent []protocol.UsagePoint
Groups []UsageScopedGroup
Requests UsageScopedPage
}
UsageSummary aggregates totals, time buckets, breakdown groups and requests across the Nodes observed by a usage overview.
type UsageWatch ¶
UsageWatch owns a live or sample usage overview subscription.