intent

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 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 Catalog added in v1.0.0

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

Catalog is an immutable set of locale-specific deterministic intent terms. It is safe to share across dispatchers and concurrent requests.

func LoadLanguagePacks added in v1.0.0

func LoadLanguagePacks(dir string) (*Catalog, error)

LoadLanguagePacks reads all .yaml and .yml files in dir. An empty directory path disables external language packs. Invalid files fail closed so a typo cannot silently alter production routing.

func (*Catalog) Locales added in v1.0.0

func (c *Catalog) Locales() []string

Locales returns the canonical locales loaded into the catalog.

type Domain

type Domain string
const (
	DomainConversation  Domain = "conversation"
	DomainResearch      Domain = "research"
	DomainBrowser       Domain = "browser"
	DomainFile          Domain = "file"
	DomainDesktop       Domain = "desktop"
	DomainAutomation    Domain = "automation"
	DomainOrchestration Domain = "orchestration"
	DomainPlanning      Domain = "planning"
	DomainTask          Domain = "task"
)

type Intent

type Intent struct {
	Goal       string              `json:"goal"`
	Normalized string              `json:"normalized"`
	Domains    []Domain            `json:"domains"`
	Mode       Mode                `json:"mode"`
	Signals    []Signal            `json:"signals"`
	Entities   map[string][]string `json:"entities,omitempty"`
	Confidence float64             `json:"confidence"`
}

func Parse

func Parse(request Request) Intent

Parse preserves the package-level API for callers that only need the built-in Chinese and English compatibility rules.

func (Intent) HasDomain

func (i Intent) HasDomain(wanted Domain) bool

func (Intent) HasSignal

func (i Intent) HasSignal(wanted Signal) bool

type Mode

type Mode string
const (
	ModeChat     Mode = "chat"
	ModeRead     Mode = "read"
	ModeWrite    Mode = "write"
	ModeExecute  Mode = "execute"
	ModeResearch Mode = "research"
	ModePlan     Mode = "plan"
)

type Parser added in v1.0.0

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

Parser applies the built-in compatibility rules plus one locale-specific language pack selected from its catalog.

func NewParser added in v1.0.0

func NewParser(catalog *Catalog) *Parser

NewParser creates an immutable, concurrency-safe parser.

func (*Parser) Parse added in v1.0.0

func (p *Parser) Parse(request Request) Intent

Parse classifies one request using the language pack selected by Locale.

type Request

type Request struct {
	Text                    string
	HasFiles                bool
	ActiveBrowserSession    bool
	ActiveDesktopSession    bool
	BackgroundMonitor       bool
	PersistentGoalExecution bool
	Locale                  string
	Timezone                string
	PreviousUserMessages    []string
}

type Signal

type Signal string
const (
	SignalUploadedFile          Signal = "uploaded_file"
	SignalWorkspaceRead         Signal = "workspace_read"
	SignalWorkspaceWrite        Signal = "workspace_write"
	SignalCommand               Signal = "command"
	SignalLocalDeviceFile       Signal = "local_device_file"
	SignalOpenTarget            Signal = "open_target"
	SignalExplicitDesktop       Signal = "explicit_desktop"
	SignalDirectBrowserControl  Signal = "direct_browser_control"
	SignalContextualMediaTitle  Signal = "contextual_media_title"
	SignalWebAccess             Signal = "web_access"
	SignalContextualResearch    Signal = "contextual_research"
	SignalBrowserAuthentication Signal = "browser_authentication"
	SignalBrowserDownload       Signal = "browser_download"
	SignalBrowserScreenshot     Signal = "browser_screenshot"
	SignalBrowserClose          Signal = "browser_close"
	SignalPlanning              Signal = "planning"
	SignalTaskManagement        Signal = "task_management"
	SignalWait                  Signal = "wait"
	SignalScheduled             Signal = "scheduled"
	SignalPersistentGoal        Signal = "persistent_goal"
)

Jump to

Keyboard shortcuts

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