prompt

package
v0.90.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: AGPL-3.0 Imports: 1 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 (native/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

func IsResume added in v0.87.0

func IsResume(parked string) bool

IsResume is whether parked is lich's continuation of a turn a usage limit ended, in any language: the row keeps the language it was parked in.

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
	// BriefingArtifacts follows every route, its own leading space included
	// where the language separates sentences with one; %s is how to open a
	// page, a tool name or a command, never translated.
	BriefingArtifacts string

	// internal/relay: compose, origin and replyInstruction.
	RelayMessage      string
	OriginCLI         string
	OriginSession     string
	ReplyCommand      string
	ReplyRouteCLI     string
	ReplyRouteTools   string
	ReplyOnlyWayBack  string
	PingPongWarning   string
	WorkerTask        string
	PickTicketNudge   string
	CompactReminder   Plural
	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
	// The line in front of a watch's prompt, naming what was met. %[1]d is the
	// pull request; %[2]s, where it appears, the commit.
	WatchChecksFailed string
	WatchChecksPassed string
	WatchReview       string
	// `lich schedule` and schedule_prompt's answers.
	ScheduledAtResult string // %[1]s is when
	ScheduledOnResult string // %[1]s is the condition, %[2]d the run limit
	ScheduleCleared   string
	// `lich check-log` and read_check_log's answers. %[1]d is the pull
	// request, %[2]s the commit, then the counts named in the text.
	CheckLogNoPR    string
	CheckLogClean   string // %[3]d passed, %[4]d pending
	CheckLogRunning string // %[3]d failed, %[4]d pending
	CheckLogFailed  string // %[3]d failed
	CheckLogCut     string // %[1]d is the lines left out
	CheckLogNoLog   string

	// internal/drop: the line under a copied file's path.
	CopyNotice string
	// internal/artifact: the line under a copied artifact's path. %[1]s is its
	// name, %[2]q the session it came from.
	ArtifactCopyNotice 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
	MCPArtifacts           string // %s is the session's artifact directory
	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
	OpenedSessionLabelOnly string
	ClosedRemoved          string
	ClosedKept             string
	ClosedPlain            string
	ClosedProject          string
	HandoffNote            string
	HandoffNone            string
	HandoffSent            string

	HandoffProfileSuggested string
	HandoffProfileDropped   string

	// internal/cli: a browser page as the browser_* tools answer with it. The
	// line tags (url:, title:, wait:, text:, interactive, downloading:, dialog
	// open:) and browser_dialog stay English in every locale: the tool
	// descriptions name them. PageListSame stands for an element list the
	// agent's last page answer already gave it.
	PageInteractive  string
	PageListSame     string
	PageMore         string
	PageFilled       string
	PageChecked      string
	PageDownloading  string
	PageWaitTimedOut string
	PageConsoleMore  Plural
	PageDialogWaits  string
	// PageDialogWaitsCLI is PageDialogWaits for `lich browser`, which names
	// its own verb instead of the MCP tool.
	PageDialogWaitsCLI 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 window'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