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

prompt

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvidenceContract added in v0.1.9

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 Expansion added in v0.1.7

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 MCPManager added in v0.1.7

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 added in v0.1.7

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 added in v0.1.7

type Profile struct {
	ID               string            `yaml:"id"                       json:"id"`
	Name             string            `yaml:"name,omitempty"           json:"name,omitempty"`
	Description      string            `yaml:"description,omitempty"    json:"description,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"`
	// 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"`
}

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

func (*Profile) EffectiveMessages added in v0.1.7

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 added in v0.1.7

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.

type RenderOptions added in v0.1.7

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