Documentation
¶
Overview ¶
Package operations binds declared native host operations without running package scripts. Package installation and callback execution have other owners.
Index ¶
- Constants
- Variables
- func Alias(owner, name string) string
- func Command(operation protocol.ToolOperation, arguments json.RawMessage, ...) (protocol.Command, error)
- func CommandContent(output protocol.Output) *protocol.ToolContent
- func ConnectionOperation(operation protocol.ToolOperation) bool
- func ExactRevision(entry any, revision uint64) (map[string]any, error)
- func IsCommandTool(name string) bool
- func IsUpdatePlanTool(name string) bool
- func LegacyCommandTool(alias string) string
- func Official(owner protocol.PluginReference, alias string) (pack, tool string, official bool)
- func OfficialPackages() ([]string, error)
- func Policy(operation protocol.ToolOperation) (readOnly, concurrent bool)
- func ScopedCommand(operation protocol.ToolOperation, arguments json.RawMessage, ...) (protocol.Command, error)
- func ScopedOperation(operation protocol.ToolOperation) bool
- func ScopedOutput(operation protocol.ToolOperation, output protocol.Output) (any, error)
- func UpdatePlanSchema() string
- type Catalog
- type CommandSpec
- type ConnectionArguments
- type Declaration
- type Instruction
- type MediaSpec
- type ModeSelection
- type NativeSkillPackage
- type Package
- type Resources
- func (r *Resources) AddNativeSkills(packages []NativeSkillPackage)
- func (r *Resources) Catalog(child bool) (string, error)
- func (r *Resources) Python(ctx context.Context, key string, manager *python.Manager) (*python.Ready, error)
- func (r *Resources) Read(ctx context.Context, key, relative string) (SkillText, error)
- func (r *Resources) SelectedMode(config protocol.SessionConfig) (*ModeSelection, error)
- func (r *Resources) Skills() map[string]protocol.PluginSkill
- type SkillText
- type Spec
Constants ¶
const PresentFilesTool = "present_files"
PresentFilesTool is the Node's file delivery; its results show as file cards.
const SkillBytes = 128 * 1024
const UpdatePlanTool = "update_plan"
Variables ¶
var Bundled = sync.OnceValues(load)
var LegacyUpdatePlanTool = Alias("progress", UpdatePlanTool)
var MediaSpecs = sync.OnceValues(func() ([]MediaSpec, error) { var specs []MediaSpec err := json.Unmarshal(mediaSpecification, &specs) return specs, err })
MediaSpecs are the built-in media tools. No package declares or binds them.
Functions ¶
func Command ¶
func Command(operation protocol.ToolOperation, arguments json.RawMessage, worktree protocol.WorktreeID, session protocol.SessionID, turn protocol.TurnID, project *protocol.ProjectID, sandbox bool) (protocol.Command, error)
Command binds model arguments to immutable turn resources. Resource identity never comes from an untrusted tool argument except an explicit worktree tool.
func CommandContent ¶ added in v0.2.4
func CommandContent(output protocol.Output) *protocol.ToolContent
CommandContent describes inspectable output from the core command tools.
func ConnectionOperation ¶
func ConnectionOperation(operation protocol.ToolOperation) bool
ConnectionOperation reports whether an operation reaches a saved database or SSH connection. These operations are bound by the Node, which owns the sharing decision, instead of Command.
func ExactRevision ¶
ExactRevision renders a catalog entry with its revision as a decimal string, which keeps exact 64-bit values for script-safe models.
func IsCommandTool ¶ added in v0.2.4
IsCommandTool identifies a core session command by its model-facing name.
func IsUpdatePlanTool ¶ added in v0.2.4
func LegacyCommandTool ¶ added in v0.2.4
LegacyCommandTool resolves the former commands package's canonical alias.
func Official ¶
func Official(owner protocol.PluginReference, alias string) (pack, tool string, official bool)
Official names a tool of a package the application ships: the package and the tool as the shipped manifest spells them. The owner must be the shipped package itself, by name and by the digest of the embedded tree, the same test CaptureCatalog applies. A package a user installed under a shipped package's name has another digest and is not official; neither is a shipped package updated past the embedded copy.
func OfficialPackages ¶
OfficialPackages lists the names of the packages the application ships.
func Policy ¶
func Policy(operation protocol.ToolOperation) (readOnly, concurrent bool)
func ScopedCommand ¶
func ScopedCommand(operation protocol.ToolOperation, arguments json.RawMessage, session protocol.SessionID) (protocol.Command, error)
ScopedCommand maps a model or role operation onto the Node command that owns it. Role application always targets the captured session.
func ScopedOperation ¶
func ScopedOperation(operation protocol.ToolOperation) bool
ScopedOperation reports whether an operation installs or removes a local model or manages the role catalog. The Node dispatches these under the declaring package instead of a workspace command.
func ScopedOutput ¶
ScopedOutput projects a model or role outcome for the calling tool. Role outcomes carry public definitions with decimal-string revisions.
func UpdatePlanSchema ¶ added in v0.2.4
func UpdatePlanSchema() string
UpdatePlanSchema uses the same argument contract as progress.update.
Types ¶
type Catalog ¶
type Catalog struct {
Packages []Package
ArtifactClasses map[string][]string
References []protocol.PluginReference
Tools []Declaration
Instructions []Instruction
}
func CaptureCatalog ¶
type CommandSpec ¶ added in v0.2.4
type CommandSpec struct {
Name string `json:"name"`
Spec
Presentation protocol.ToolPresentation `json:"presentation"`
Display protocol.ToolDisplay `json:"display"`
}
CommandSpec pairs one built-in command tool with its conversation display.
func CommandSpecs ¶ added in v0.2.4
func CommandSpecs() ([]CommandSpec, error)
CommandSpecs supplies the session command tools independently of installed packages. They share policies with the corresponding package operations.
type ConnectionArguments ¶
type ConnectionArguments struct {
// Target is the connection a catalog, query, run or transfer names.
Target *protocol.ConnectionResource
// Save holds the checked arguments of a save operation.
Save json.RawMessage
// Catalog, query and execute.
Database *string
ReadOnly bool
Sql string
RowLimit uint32
// Run and transfer.
Command string
Path string
RemotePath string
Direction protocol.SshDirection
TimeoutMs uint64
}
ConnectionArguments is one decoded connection tool call. Only the fields of its operation are set.
func ConnectionCall ¶
func ConnectionCall(operation protocol.ToolOperation, arguments json.RawMessage) (ConnectionArguments, error)
ConnectionCall decodes the model arguments of a connection operation.
type Declaration ¶
type Declaration struct {
Spec
Owner protocol.PluginReference
Name string
Exposed string
Initial bool
Script bool
Contexts []protocol.PluginConversationResource
Presentation protocol.ToolPresentation
Grouping protocol.ToolGrouping
Display *protocol.ToolDisplay
}
type Instruction ¶
type Instruction struct {
Owner protocol.PluginReference
Text string
AnyTools []string
}
type MediaSpec ¶
MediaSpec is one Node-owned media tool: its name, the operation that identifies its approval, its description, parameters and policy.
type ModeSelection ¶
type ModeSelection struct {
Package protocol.PluginReference
Declaration protocol.PluginModesDeclaration
}
type NativeSkillPackage ¶
type NativeSkillPackage struct {
Package string
Skills []protocol.PluginSkill
Tree fs.FS
}
NativeSkillPackage describes a compile-time module skill tree embedded in the binary (with files laid out under skills/<name>/SKILL.md inside Tree).
type Package ¶
type Package struct {
Reference protocol.PluginReference
Skills []protocol.PluginSkill
Scope protocol.PluginScope
Modes []protocol.PluginModesDeclaration
Options json.RawMessage
// contains filtered or unexported fields
}
Package keeps metadata and resources from one immutable bundled digest.
type Resources ¶
type Resources struct {
// contains filtered or unexported fields
}
func CaptureResources ¶
func CaptureResources(ctx context.Context, profile string, references []protocol.PluginReference) (*Resources, error)
CaptureResources resolves only the exact package versions admitted by a turn.
func (*Resources) AddNativeSkills ¶
func (r *Resources) AddNativeSkills(packages []NativeSkillPackage)
AddNativeSkills registers built-in skills provided by assembled native modules unless an installed plugin with the same package name is already captured in this turn.
func (*Resources) SelectedMode ¶
func (r *Resources) SelectedMode(config protocol.SessionConfig) (*ModeSelection, error)
type Spec ¶
type Spec struct {
Operation protocol.ToolOperation `json:"operation"`
Description string `json:"description"`
Parameters json.RawMessage `json:"parameters"`
ReadOnly bool `json:"read_only"`
Concurrent bool `json:"concurrent"`
}