Documentation
¶
Overview ¶
Package ops is the operation catalog. A Spec declares one operation once: its name, owner, effect, toolset, typed input, constraints and guidance. The desktop mounts each Spec as an MCP tool, and the hive CLI builds a command from the same Spec, so the two surfaces cannot drift apart.
Index ¶
Constants ¶
const ( // DetailSummary omits every source-supplied payload. DetailSummary = "summary" // DetailFull holds nothing back. DetailFull = "full" )
The two ends of the surface-wide detail ladder.
Every operation whose answer carries source-supplied JSON (an inbox item's payload, an event's detail, a dry run's messages) answers at a size set by data nobody here chose. Rather than a cap that silently truncates, each one takes a detail argument and reports the level it answered at, so an omitted field is never mistaken for an absent one. An operation may add rungs between these; summary and full mean the same thing everywhere.
const CallerField = "caller"
CallerField is the json name of the input field that says who is calling. The CLI fills it from --caller and gives it no flag of its own.
Variables ¶
var ErrInvalidCallerRule = fmt.Errorf("not a valid CallerRule, try [%s]", strings.Join(_CallerRuleNames, ", "))
var SummaryOrFull = Constraint{Enum: []string{DetailSummary, DetailFull}, Default: DetailSummary}
SummaryOrFull is the detail constraint of an operation with no middle rung.
var Verbs = []string{
"list", "get", "create", "put", "update", "delete", "clear",
"open", "close", "move", "focus", "resize", "turn", "preview", "refresh",
}
Verbs is the closed verb vocabulary. put creates or replaces.
Functions ¶
func CallerRuleNames ¶
func CallerRuleNames() []string
CallerRuleNames returns a list of possible string values of CallerRule.
Types ¶
type CallerRule ¶
type CallerRule string
CallerRule says which callers an operation with a caller input accepts. A chat caller passes both rules on a desktop-owned operation, because the desktop resolves chats.
ENUM(none, session, session-or-global)
const ( // CallerRuleNone is a CallerRule of type none. CallerRuleNone CallerRule = "none" // CallerRuleSession is a CallerRule of type session. CallerRuleSession CallerRule = "session" // CallerRuleSessionOrGlobal is a CallerRule of type session-or-global. CallerRuleSessionOrGlobal CallerRule = "session-or-global" )
func ParseCallerRule ¶
func ParseCallerRule(name string) (CallerRule, error)
ParseCallerRule attempts to convert a string to a CallerRule.
func (CallerRule) AppendText ¶
func (x CallerRule) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (CallerRule) IsValid ¶
func (x CallerRule) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (CallerRule) MarshalText ¶
func (x CallerRule) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (CallerRule) String ¶
func (x CallerRule) String() string
String implements the Stringer interface.
func (*CallerRule) UnmarshalText ¶
func (x *CallerRule) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type Constraint ¶
type Constraint struct {
Enum []string
Min, Max *float64
// Default is the value an omitted field takes. It is documentation: the
// handler must treat the zero value the same way.
Default any
}
Constraint narrows one input field beyond what its Go type says. The MCP schema states it, and the CLI checks it before it calls.
type Field ¶
type Field struct {
Name string
// Type is the field's Go type with any pointer removed. Pointer says
// whether there was one: an omitted pointer field keeps a stored value.
Type reflect.Type
Pointer bool
Description string
Required bool
Constraint
}
Field is one input field with its constraint applied.
func Fields ¶
Fields lists the input fields of op in declaration order. A Fields key that names no field is an error.
type Info ¶
type Info struct {
Name string
Resource string
Verb string
// ToolName is the MCP tool name: "<resource>_<verb>".
ToolName string
Owner Owner
Effect Effect
Toolset Toolset
Summary string
Guidance string
Args []string
Fields Constraints
Caller CallerRule
}
Info is a Spec with its type parameter erased.
func (Info) Description ¶
Description is the MCP tool description: the summary as a sentence, then the guidance.
type Kind ¶
type Kind string
Kind is the error vocabulary every surface maps once. A tool error crosses MCP as text that starts with "<kind>: ".
type Op ¶
type Op interface {
Info() Info
InputType() reflect.Type
// InputSchema is the inferred schema of In with Fields applied. A Fields
// key that names no input field is an error.
InputSchema() (*jsonschema.Schema, error)
}
Op is a Spec seen without its type parameter, so a catalog can hold operations of different input types.
type Spec ¶
type Spec[In any] struct { // Name is "<resource>.<verb>". The resource may contain "_", which the // CLI spells as "-". Name string Owner Owner Effect Effect Toolset Toolset // Summary is one line with no final period: the MCP title and the CLI // usage. Summary string // Guidance is the behavior an agent or a person must know: the rest of // the MCP description and the CLI long help. Guidance string // Args are the json names of the fields the CLI takes as positional // arguments, in order. Args []string // Fields adds constraints to input fields, keyed by json name. Fields Constraints // Caller is the rule for the input's caller field. Leave it unset for an // operation with no caller field. Caller CallerRule }
Spec declares one operation with input type In. The output type is not part of the Spec: it belongs to the side that binds the handler.
An In may implement Validator for rules a JSON schema cannot state.
func (Spec[In]) Info ¶
Info panics on a malformed Name or a verb outside Verbs: both are programming errors that the catalog test catches first.
func (Spec[In]) InputSchema ¶
func (s Spec[In]) InputSchema() (*jsonschema.Schema, error)
Directories
¶
| Path | Synopsis |
|---|---|
|
Package actions declares the action catalog, action run and applet operations of the desktop's app-control MCP server.
|
Package actions declares the action catalog, action run and applet operations of the desktop's app-control MCP server. |
|
Package catalog lists every operation of every toolset.
|
Package catalog lists every operation of every toolset. |
|
Package diagnostics declares the status and diagnostics operations of the desktop's app-control MCP server.
|
Package diagnostics declares the status and diagnostics operations of the desktop's app-control MCP server. |
|
Package drive declares the Hive Drive document and canvas operations, served on the drive MCP server.
|
Package drive declares the Hive Drive document and canvas operations, served on the drive MCP server. |
|
Package flows declares the profile, flow and image operations of the desktop's app-control MCP server.
|
Package flows declares the profile, flow and image operations of the desktop's app-control MCP server. |
|
Package inbox declares the feed, inbox and source operations of the desktop's app-control MCP server.
|
Package inbox declares the feed, inbox and source operations of the desktop's app-control MCP server. |
|
Package layout declares the tab, panel and split operations of a chat or Code session, served on the drive MCP server.
|
Package layout declares the tab, panel and split operations of a chat or Code session, served on the drive MCP server. |
|
Package mcpops mounts catalog operations on an MCP server.
|
Package mcpops mounts catalog operations on an MCP server. |
|
Package reviews declares the operations an agent uses to review a Code session's branch diff, served on the drive MCP server.
|
Package reviews declares the operations an agent uses to review a Code session's branch diff, served on the drive MCP server. |
|
Package sessions declares the hive session operations of the desktop's app-control MCP server.
|
Package sessions declares the hive session operations of the desktop's app-control MCP server. |
|
Package workspaces declares the agent workspace and scheduled chat operations of the desktop's app-control MCP server.
|
Package workspaces declares the agent workspace and scheduled chat operations of the desktop's app-control MCP server. |