Skip to content
mercury framework
GitHub

SessionToolContext

SessionToolContext = object

Defined in: types/plugin-types/index.ts:204

The per-turn context a sessionTools factory receives: the session it’s building tools for, and the two core capabilities a tool may need bound to that session — staging a confirm-required action, and stashing a display artifact for the model to present. All generic; nothing here is CLI-shaped.

person: { key: string; } | null

Defined in: types/plugin-types/index.ts:221

Whom the tools act for, by the person’s key, when they act as the person, and whom the turn is for when the plugin acts as no one (actsAs: "anyone", the operator’s key on the terminal); null when they act as the plugin’s own service identity: on the terminal, where whoever types already holds the container, and for a person allowed to make Mercury act as itself.


requireLogin: () => Promise<LoginRequired>

Defined in: types/plugin-types/index.ts:226

For a plugin acting as person whose service says that person isn’t logged in: starts their login and returns what the tool hands back, a loginRequired result whose link the channel shows them, or an error when nothing can take a login.

Promise<LoginRequired>


sessionKey: string

Defined in: types/plugin-types/index.ts:205


optional stageChoices?: StageChoices

Defined in: types/plugin-types/index.ts:212

Stages an action offered as several choices (see StageChoices). The core always sets it; optional so a plugin also builds against an older one, where it has to do without.


stageConfirmation: StageConfirmation

Defined in: types/plugin-types/index.ts:208


stashDisplay: (artifact, label?) => string

Defined in: types/plugin-types/index.ts:214

Stashes a rendered list for the model to present, with what it is (label: the command that built it), and returns its ref.

string

string

string


t: Translate

Defined in: types/plugin-types/index.ts:207

The texts of the person the turn is for (a choice’s label, a line a tool shows them).