operations

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 25 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package operations binds declared native host operations without running package scripts. Package installation and callback execution have other owners.

Index

Constants

View Source
const PresentFilesTool = "present_files"

PresentFilesTool is the Node's file delivery; its results show as file cards.

View Source
const SkillBytes = 128 * 1024
View Source
const UpdatePlanTool = "update_plan"

Variables

View Source
var Bundled = sync.OnceValues(func() (*Catalog, error) {
	return &Catalog{ArtifactClasses: map[string][]string{}}, nil
})

Bundled retains the empty default inventory for callers that also resolve installed package captures. Native modules register their own tools and skills.

View Source
var LegacyUpdatePlanTool = Alias("progress", UpdatePlanTool)
View Source
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 Alias

func Alias(owner, name string) string

func Command

func Command(operation protocol.ToolOperation, arguments json.RawMessage, worktree protocol.WorktreeID, session protocol.SessionID, turn protocol.TurnID, project *protocol.ProjectID, workspaceAccess 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

func ExactRevision(entry any, revision uint64) (map[string]any, error)

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

func IsCommandTool(name string) bool

IsCommandTool identifies a core session command by its model-facing name.

func IsUpdatePlanTool added in v0.2.4

func IsUpdatePlanTool(name string) bool

func LegacyCommandTool added in v0.2.4

func LegacyCommandTool(alias string) string

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 an exact tool declaration owned by the bundled inventory. Installed package names and origins do not establish this content identity.

func OfficialPackages

func OfficialPackages() ([]string, error)

OfficialPackages lists the names in the bundled inventory, not installed names.

func Parameters

func Parameters(operation protocol.ToolOperation) json.RawMessage

Parameters returns the shared input schema for a built-in operation.

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

func ScopedOutput(operation protocol.ToolOperation, output protocol.Output) (any, error)

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.

func WorkspaceModuleCommand

func WorkspaceModuleCommand(operation protocol.ToolOperation) string

WorkspaceModuleCommand maps optional workspace tool operations to their protocol commands. The selected module, not the operation, supplies execution.

Types

type Catalog

type Catalog struct {
	Packages        []Package
	ArtifactClasses map[string][]string
	References      []protocol.PluginReference
	Tools           []Declaration
	Instructions    []Instruction
}

func CaptureCatalog

func CaptureCatalog(ctx context.Context, profile string, references []protocol.PluginReference) (*Catalog, error)

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

type MediaSpec struct {
	Name string `json:"name"`
	Spec
}

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
	Requirements *protocol.PluginRequirements
	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 captured package.

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) Catalog

func (r *Resources) Catalog(child bool) (string, error)

func (*Resources) Python

func (r *Resources) Python(ctx context.Context, key string, manager *python.Manager) (*python.Ready, error)

func (*Resources) Read

func (r *Resources) Read(ctx context.Context, key, relative string) (SkillText, error)

func (*Resources) SelectedMode

func (r *Resources) SelectedMode(config protocol.SessionConfig) (*ModeSelection, error)

func (*Resources) Skills

func (r *Resources) Skills() map[string]protocol.PluginSkill

type SkillText

type SkillText struct{ Content, Directory string }

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"`
}

Jump to

Keyboard shortcuts

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