context

package
v0.8.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DeepseekChat     = int64(0)
	DeepseekReasoner = int64(1)
)
View Source
const (
	RoleDev    = "dev"
	RoleExpert = "expert"
	RoleReview = "review"
)

Role constants for --role flag

Variables

View Source
var (
	HistSizeKey           = ContextKeyType[int]{"HistSize"}
	StartTimeKey          = ContextKeyType[time.Time]{"StartTime"}
	StartBalanceKey       = ContextKeyType[map[string]string]{"StartBalance"}
	CurrentModelIDKey     = ContextKeyType[int64]{"CurrentModelID"}
	CurrentModelNameKey   = ContextKeyType[string]{"CurrentModelName"}
	CurrentDomainIDKey    = ContextKeyType[int64]{"CurrentDomainID"}
	CurrentRoleKey        = ContextKeyType[string]{"CurrentRole"}
	ToolCallIDKey         = ContextKeyType[string]{"ToolCallID"}
	ShellNameKey          = ContextKeyType[string]{"ShellName"}
	ShellSummaryKey       = ContextKeyType[string]{"ShellSummary"}
	ShellArgsKey          = ContextKeyType[[]string]{"ShellArgs"}
	ShellStdinKey         = ContextKeyType[io.Reader]{"ShellStdin"}
	StreamKey             = ContextKeyType[bool]{"Stream"}
	LeftTokensKey         = ContextKeyType[int]{"LeftTokens"}
	WechatFormatKey       = ContextKeyType[string]{"WechatFormat"}
	ToolDisplayNameKey    = ContextKeyType[string]{"ToolDisplayName"}
	FinishReasonLengthKey = ContextKeyType[bool]{"FinishReasonLength"}
	GitWorkingDirKey      = ContextKeyType[string]{"GitWorkingDir"}
	IsChildProcessKey     = ContextKeyType[bool]{"IsChildProcess"}
	AINameCNKey           = ContextKeyType[string]{"AINameCN"}
	AINameENKey           = ContextKeyType[string]{"AINameEN"}
	AINameEmailKey        = ContextKeyType[string]{"AINameEmail"}
	GitUserNameKey        = ContextKeyType[string]{"GitUserName"}
	GitUserEmailKey       = ContextKeyType[string]{"GitUserEmail"}
)
View Source
var (
	WithTimeout      = context.WithTimeout
	WithValue        = context.WithValue
	WithCancel       = context.WithCancel
	DeadlineExceeded = context.DeadlineExceeded
	Background       = context.Background
)
View Source
var (
	ProjectRoot           = GetProjectRoot()
	ModelDeepseekChat     = config.Get("model-deepseek-chat", "deepseek-v4-pro")
	ModelDeepseekReasoner = config.Get("model-deepseek-reasoner", "deepseek-v4-flash")
)

Functions

func ContextValue

func ContextValue[T any](ctx context.Context, k ContextKeyType[T], d T) (v T)

func GetProjectRoot

func GetProjectRoot() (projectRoot string)

func GitUserEmail added in v0.8.0

func GitUserEmail() string

GitUserEmail returns git config user.email, or "未知" on error.

func GitUserName added in v0.8.0

func GitUserName() string

GitUserName returns git config user.name, or "未知" on error.

func IsTesting

func IsTesting() bool

func ReasonerModelOK added in v0.7.4

func ReasonerModelOK() bool

Types

type CancelFunc

type CancelFunc = context.CancelFunc

type Context

type Context = context.Context

type ContextKeyType

type ContextKeyType[T any] struct {
	// contains filtered or unexported fields
}

Source Files

  • context.go

Jump to

Keyboard shortcuts

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