Help us shape the future of Go! Take the 2026 Go Developer Survey

intent

package
v0.1.58 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package intent is the deprecated import path for authored playbooks. New consumers should import protocol/playbook; this package preserves existing YAML/JSON profiles and admitted intent:// resource identities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvidenceContract

type EvidenceContract struct {
	Required   []string `yaml:"required,omitempty" json:"required,omitempty"`
	Optional   []string `yaml:"optional,omitempty" json:"optional,omitempty"`
	Forbidden  []string `yaml:"forbidden,omitempty" json:"forbidden,omitempty"`
	Completion []string `yaml:"completion,omitempty" json:"completion,omitempty"`
}

type Execution

type Execution struct {
	DisablePlanner    bool `yaml:"disablePlanner,omitempty" json:"disablePlanner,omitempty"`
	DisableDelegation bool `yaml:"disableDelegation,omitempty" json:"disableDelegation,omitempty"`
	// DisableTools removes the callable tool surface for a profile whose
	// evidence is injected before the model call. BuildBinding uses this flag
	// to skip tool discovery entirely rather than constructing and then
	// discarding an expensive workspace-wide tool catalog.
	DisableTools bool `yaml:"disableTools,omitempty" json:"disableTools,omitempty"`
}

Execution applies turn-scoped runtime restrictions after this profile is selected. Restrictions only narrow the agent's normal capabilities.

type Expansion

type Expansion struct {
	Mode      string `yaml:"mode"                json:"mode"`
	Model     string `yaml:"model,omitempty"     json:"model,omitempty"`
	MaxTokens int    `yaml:"maxTokens,omitempty" json:"maxTokens,omitempty"`
}

Expansion configures optional sidecar LLM synthesis at delegation time.

type KnowledgeMatch

type KnowledgeMatch struct {
	RootIDs []string `yaml:"rootIds" json:"rootIds"`
	Path    string   `yaml:"path,omitempty" json:"path,omitempty"`
	// MaxFragments controls semantic candidate depth before URI deduplication.
	MaxFragments int `yaml:"maxFragments,omitempty" json:"maxFragments,omitempty"`
	// MaxDocuments controls the final number of distinct documents injected.
	MaxDocuments int      `yaml:"maxDocuments,omitempty" json:"maxDocuments,omitempty"`
	MinScore     *float64 `yaml:"minScore,omitempty" json:"minScore,omitempty"`
	LimitBytes   int      `yaml:"limitBytes,omitempty" json:"limitBytes,omitempty"`
	Exclude      []string `yaml:"exclude,omitempty" json:"exclude,omitempty"`
	// NeighborFragmentsBefore/After include adjacent same-document fragments
	// when those fragments are present in the semantic candidate pool.
	NeighborFragmentsBefore int `yaml:"neighborFragmentsBefore,omitempty" json:"neighborFragmentsBefore,omitempty"`
	NeighborFragmentsAfter  int `yaml:"neighborFragmentsAfter,omitempty" json:"neighborFragmentsAfter,omitempty"`
	// MaxTotalBytes bounds the combined injected content for this match entry.
	// It is applied after full-document loading and includes canonical citations.
	MaxTotalBytes int `yaml:"maxTotalBytes,omitempty" json:"maxTotalBytes,omitempty"`
	// Required makes retrieval infrastructure failures fail the turn. An empty
	// match after MinScore filtering is still a valid result.
	Required bool `yaml:"required,omitempty" json:"required,omitempty"`
}

KnowledgeMatch configures one profile-scoped semantic resource lookup.

type MCPManager

type MCPManager interface {
	Get(ctx context.Context, convID, serverName string) (mcpclient.Interface, error)
}

MCPManager is the subset of *mcpmgr.Manager used by Render. *mcpmgr.Manager satisfies this interface without any changes.

type MCPSource

type MCPSource struct {
	Server string            `yaml:"server"         json:"server"`
	Prompt string            `yaml:"prompt"         json:"prompt"`
	Args   map[string]string `yaml:"args,omitempty" json:"args,omitempty"`
}

MCPSource fetches instructions from an MCP server prompt.

type Message

type Message struct {
	Role string `yaml:"role"           json:"role"`
	Text string `yaml:"text,omitempty" json:"text,omitempty"`
	URI  string `yaml:"uri,omitempty"  json:"uri,omitempty"`
}

Message is a single role+content instruction, aligned with MCP PromptMessage.

type Profile

type Profile struct {
	// ResourceURI is host-supplied admitted routing metadata, not authored authority.
	ResourceURI              string `json:"-" yaml:"-"`
	ResourceProviderIdentity string `json:"-" yaml:"-"`
	ResourceFingerprint      string `json:"-" yaml:"-"`
	// ToolBundleDefinitions are producer-compiled owning-intent attachments.
	ToolBundleDefinitions []*toolbundle.Bundle `json:"toolBundleDefinitions,omitempty" yaml:"-"`
	ID                    string               `yaml:"id"                       json:"id"`
	Name                  string               `yaml:"name,omitempty"           json:"name,omitempty"`
	Description           string               `yaml:"description,omitempty"    json:"description,omitempty"`
	// Model optionally overrides the selected agent model for turns using this
	// profile. Intake classification keeps its independently configured model.
	Model            string            `yaml:"model,omitempty"          json:"model,omitempty"`
	AppliesTo        []string          `yaml:"appliesTo,omitempty"      json:"appliesTo,omitempty"`
	EvidenceContract *EvidenceContract `yaml:"evidenceContract,omitempty" json:"evidenceContract,omitempty"`
	Messages         []Message         `yaml:"messages,omitempty"       json:"messages,omitempty"`
	Instructions     string            `yaml:"instructions,omitempty"   json:"instructions,omitempty"`
	MCP              *MCPSource        `yaml:"mcp,omitempty"            json:"mcp,omitempty"`
	// ToolBundles lists the tool-bundle ids that are activated for the worker
	// when this profile is applied.  Runtime enforcement, not access control.
	ToolBundles    []string `yaml:"toolBundles,omitempty"    json:"toolBundles,omitempty"`
	PreferredTools []string `yaml:"preferredTools,omitempty" json:"preferredTools,omitempty"`
	Template       string   `yaml:"template,omitempty"       json:"template,omitempty"`
	Templates      []string `yaml:"templates,omitempty"      json:"templates,omitempty"`
	Resources      []string `yaml:"resources,omitempty"      json:"resources,omitempty"`
	// Bootstrap adds trusted pre-model tool calls for turns using this profile.
	// The calls are executed by the same centralized bootstrap executor used by
	// agent-level metadata.
	Bootstrap []agent.BootstrapToolCall `yaml:"bootstrap,omitempty" json:"bootstrap,omitempty"`
	// Knowledge declares semantic resource matches that activate only when this
	// profile is selected for the current turn. The roots must already be
	// authorized on the selected agent. This keeps large knowledge corpora out
	// of unrelated turns while retaining the agent resource boundary.
	Knowledge       []KnowledgeMatch           `yaml:"knowledge,omitempty" json:"knowledge,omitempty"`
	LookupOverlays  []*overlay.Overlay         `yaml:"lookupOverlays,omitempty" json:"lookupOverlays,omitempty"`
	LookupLibraries []overlay.LibraryReference `yaml:"lookupLibraries,omitempty" json:"lookupLibraries,omitempty"`
	// ParallelToolCalls optionally overrides the selected agent's default
	// parallel tool execution preference for turns using this profile.
	ParallelToolCalls *bool      `yaml:"parallelToolCalls,omitempty" json:"parallelToolCalls,omitempty"`
	Expansion         *Expansion `yaml:"expansion,omitempty"      json:"expansion,omitempty"`
	Execution         *Execution `yaml:"execution,omitempty" json:"execution,omitempty"`
}

Profile is a scenario configuration unit pairing instruction messages, tool bundles, and one default plus optional additional output templates.

func (*Profile) EffectiveMessages

func (p *Profile) EffectiveMessages() []Message

EffectiveMessages returns the messages to render. Messages takes priority over Instructions. Returns nil for MCP-only profiles.

func (*Profile) Render

func (p *Profile) Render(ctx context.Context, mgr MCPManager, opts *RenderOptions) ([]Message, error)

Render resolves the profile's instruction source and returns []Message.

Source priority:

  1. If p.MCP is set: call the MCP server's GetPrompt; convert the result.
  2. If p.Messages is set: render each message (URI loaded, text templated).
  3. If p.Instructions is set: wrap as a single system message.

mgr may be nil; MCP-sourced profiles will return an error in that case. opts may be nil; defaults are applied.

func (*Profile) Validate added in v0.1.57

func (p *Profile) Validate() error

Validate keeps optional lookup attachments bound to explicit original template identities. Immutable parent revisions require stamped references.

func (*Profile) ValidateForParent added in v0.1.57

func (p *Profile) ValidateForParent(immutableParent bool) error

type RenderOptions

type RenderOptions struct {
	// ConversationID is used to retrieve the MCP client from the manager.
	ConversationID string
	// Binding is an arbitrary key-value map rendered into message text and
	// into MCP arg values via Go's text/template engine.
	Binding map[string]interface{}
	// FS is used to load messages whose source is a URI.
	// When nil, afs.New() is used.
	FS afs.Service
}

RenderOptions carries optional context needed during rendering.

Jump to

Keyboard shortcuts

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