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

intake

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: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceWorkspace      = "workspace"
	SourceAgent          = "agent"
	SourceReused         = "reused"
	SourceCallerProvided = "caller-provided"
	SourceFallback       = "fallback"
)

Source values for Context.Source. Centralized so the runtime, intake services, and observability subscribers all reference the same constants.

View Source
const (
	ModeRoute   = "route"
	ModeClarify = "clarify"
	ModePlanner = "planner"
)

Mode values for Context.Mode. Workspace intake's classification result.

View Source
const ContextKey = "intake.turnContext"

ContextKey is the key used to store Context in QueryInput.Context.

Variables

This section is empty.

Functions

func WithBundleRepo

func WithBundleRepo(r *toolbundlerepo.Repository) func(*Service)

func WithConversationClient added in v0.1.11

func WithConversationClient(c apiconv.Client) func(*Service)

func WithProfileRepo

func WithProfileRepo(r *promptrepo.Repository) func(*Service)

func WithTemplateRepo added in v0.1.8

func WithTemplateRepo(r *tplrepo.Repository) func(*Service)

Types

type ClassificationContext added in v0.1.8

type ClassificationContext struct {
	Title      string  `json:"title,omitempty"`
	Intent     string  `json:"intent,omitempty"`
	Confidence float64 `json:"confidence,omitempty"`
}

type Context added in v0.1.8

type Context struct {
	Classification        ClassificationContext        `json:"classification,omitempty"`
	Scope                 ScopeContext                 `json:"scope,omitempty"`
	Prompting             PromptingContext             `json:"prompting,omitempty"`
	DirectAction          DirectActionContext          `json:"directAction,omitempty"`
	DirectActionExecution DirectActionExecutionContext `json:"directActionExecution,omitempty"`
	Routing               RoutingContext               `json:"routing,omitempty"`
	Planner               PlannerContext               `json:"planner,omitempty"`
}

Context is the structured output of intake. It is grouped by feature area so routing, scope extraction, prompting hints, and planner state do not bleed together as unrelated top-level keys.

func FromContext added in v0.1.8

func FromContext(ctxMap map[string]any) *Context

FromContext retrieves a Context previously stored under ContextKey. Returns nil when missing or the stored value has the wrong type.

func StoreCallerProvided added in v0.1.8

func StoreCallerProvided(ctxMap map[string]any, override *Context) (map[string]any, *Context)

StoreCallerProvided records a caller-supplied Context into the QueryInput context map under the well-known ContextKey. The stored value is a copy (so later mutation of the caller's struct does not race with the runtime), annotated with Source = SourceCallerProvided. The runtime's intake skip rule then sees a non-nil Context under the key and bypasses the intake-sidecar LLM call (see service/agent/intake_query.go).

ctxMap is the QueryInput.Context map (lazy-initialized when nil). Returns the resulting (possibly newly-allocated) map and a pointer to the stored copy.

type DirectActionContext added in v0.1.9

type DirectActionContext struct {
	ToolName      string                 `json:"toolName,omitempty"`
	Input         map[string]interface{} `json:"input,omitempty"`
	InputJSON     string                 `json:"inputJson,omitempty"`
	AssistantText string                 `json:"assistantText,omitempty"`
}

func NormalizeClassifierDirectAction added in v0.1.13

func NormalizeClassifierDirectAction(action *DirectActionContext) DirectActionContext

type DirectActionExecutionContext added in v0.1.9

type DirectActionExecutionContext struct {
	Executed   bool        `json:"executed,omitempty"`
	ToolName   string      `json:"toolName,omitempty"`
	Result     interface{} `json:"result,omitempty"`
	ResultText string      `json:"resultText,omitempty"`
}

type PlannerContext added in v0.1.8

type PlannerContext struct {
	Trigger string `json:"trigger,omitempty"`
	AgentID string `json:"agentId,omitempty"`
}

type PromptingContext added in v0.1.8

type PromptingContext struct {
	SuggestedProfileID string   `json:"suggestedProfileId,omitempty"`
	AppendToolBundles  []string `json:"appendToolBundles,omitempty"`
	TemplateID         string   `json:"templateId,omitempty"`
}

type RoutingContext added in v0.1.8

type RoutingContext struct {
	SelectedAgentID string `json:"selectedAgentId,omitempty"`
	Mode            string `json:"mode,omitempty"`
	Source          string `json:"source,omitempty"`
}

type RunOption added in v0.1.10

type RunOption func(*runOptions)

RunOption customizes a single intake sidecar call.

func WithTranscript added in v0.1.10

func WithTranscript(messages []TranscriptMessage) RunOption

WithTranscript provides recent visible user/assistant transcript context for the current intake call. Intake uses it to resolve elided follow-up requests while still classifying the current user message as the active request.

type ScopeContext added in v0.1.8

type ScopeContext struct {
	Values map[string]string `json:"values,omitempty"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service runs the intake sidecar LLM call and returns an intake Context.

func New

func New(llm *core.Service, opts ...func(*Service)) *Service

New creates an intake Service. llm is required; repos are optional.

func (*Service) Run

func (s *Service) Run(ctx context.Context, userMessage string, cfg *agentmdl.Intake, userID string, opts ...RunOption) *Context

Run executes the intake sidecar for the given user message and agent config. Returns nil when the sidecar is not enabled or a non-fatal error occurs (callers always proceed with the turn regardless).

type TranscriptMessage added in v0.1.10

type TranscriptMessage struct {
	Role    string
	Content string
}

TranscriptMessage is a compact, generic transcript row provided to intake. It intentionally carries only speaker role and visible text content so workspace-specific state and internal execution details stay out of the framework contract.

Jump to

Keyboard shortcuts

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