prompt

package
v0.71.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package prompt holds the natural-language text lich types into an agent session, in every language a user can pick for it. The UI has its own language and its own catalogs (frontend/src/lib/i18n); the two settings are independent because people often run the interface in one language and talk to their agents in another.

A catalog is a struct rather than a map of string keys so that a wrong name is a compile error at the call site, and a locale that misses a field is caught by TestCatalogParity. Each field is a fmt format: use explicit argument indexes (%[2]s) when a translation needs the arguments in another order.

Index

Constants

View Source
const EnvVar = "LICH_PROMPT_LANG"

EnvVar is the variable lich exports into every session PTY with the prompt language at spawn time. Text composed outside the lich process (the lich CLI, its MCP server, the companion plugin's hooks) reads the language from here, because it has no way to read the setting itself.

Variables

Langs is every language a catalog exists for, English first as the default.

Functions

This section is empty.

Types

type Catalog

type Catalog struct {

	// internal/relay: SpawnBriefing. These are passed as one argv entry and a
	// provider shipped as a .cmd is spawned through cmd.exe, so they must not
	// contain a double quote or angle brackets in any locale.
	BriefingIntro        string
	BriefingCards        string
	BriefingNative       string
	BriefingSessions     string
	BriefingCommandTools string
	BriefingCommandCLI   string

	// internal/relay: compose, origin and replyInstruction.
	RelayMessage      string
	OriginCLI         string
	OriginSession     string
	ReplyCommand      string
	ReplyRouteCLI     string
	ReplyRouteTools   string
	ReplyOnlyWayBack  string
	WorkerTask        string
	PickTicketNudge   string
	NudgeResultsReady Plural
	NudgeRouteCLI     string
	NudgeRouteTools   string
	NudgeNotice       string

	// internal/relay: a subagent's report and block, a merge notice, a late
	// scheduled prompt and the continuation parked at a usage limit.
	SubagentReport       string
	SubagentReportBranch string
	BlockedNotice        string
	ReportSummary        Plural
	BlockedSummary       string
	MergeNotice          string
	MergeSummary         string
	LateNotice           string
	// ResumePrompt is stored in the sessions table as a parked prompt, so a row
	// written in one language has to be recognised in every other: match it
	// with relay's isResumePrompt, never with ==.
	ResumePrompt string

	// internal/drop: the line under a copied file's path.
	CopyNotice string

	// internal/cli: the lich command line and its MCP server, read from
	// EnvVar. MCP tool descriptions, flag help and errors stay English.
	MCPInstructions        string
	HandOverFailed         string
	SendToSessionPrivate   string
	OutcomeUnread          string
	OutcomeUndelivered     string
	OutcomeUnanswered      string
	OutcomeStopped         string
	OutcomeExpired         string
	StillWorkingPrivate    string
	StillWorkingOpen       string
	StillWorkingPrivateCLI string
	StillWorkingOpenCLI    string
	CollectedNothing       string
	CollectedAnswer        string
	CollectedStillWorking  string
	OpenedProject          string
	OpenedWorktree         string
	OpenedConfined         string
	OpenedSession          string
	ClosedRemoved          string
	ClosedKept             string
	ClosedPlain            string
	// contains filtered or unexported fields
}

Catalog is every prompt text in one language. Add a field here, then its text in en.go and in every other locale file; TestCatalogParity fails until each locale has it with the same format verbs.

Untranslated in every locale, because agents and tools match them literally: the [lich] token, tool and CLI names, ticket ids, and tool parameters.

func For

func For(lang Lang) *Catalog

For is the catalog of a language. A Lang that came through Parse always has one; a hand-built Lang with no catalog panics, which is a programming error.

func (*Catalog) Pick

func (c *Catalog) Pick(n int, p Plural) string

Pick is the form of p this catalog's language uses for n.

type Lang

type Lang string

Lang is a prompt language, spelled as a BCP 47 tag: the same value is stored in the settings table, exported to every session as EnvVar, and offered by the frontend's select.

const (
	English      Lang = "en"
	PortugueseBR Lang = "pt-BR"
	Spanish      Lang = "es"
	ChineseCN    Lang = "zh-CN"
	Japanese     Lang = "ja"
	Korean       Lang = "ko"
	Russian      Lang = "ru"
)

func Parse

func Parse(tag string) Lang

Parse reads a stored or exported language tag. An empty or unknown tag is English: absent is the default by contract, and a tag from a newer build must not stop an older one from talking to its agents.

type Plural

type Plural struct {
	One   string
	Few   string
	Many  string
	Other string
}

Plural is a text that changes with a count, one field per CLDR form. Few and Many are written only by a language whose rule selects them (Russian) and stay empty elsewhere.

Jump to

Keyboard shortcuts

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