import type { CommandSpec, EngineInterface, FsEntry, FsStat, PaneCloseArgs, PaneOpenArgs, ProcessRunInit, ProcessRunResult, SessionMessage, TimerCall, } from 'claude-code' /** * The engine as `session.start` bound it from its `$`, each member spelled * `$.noun.event(...)` there; used by every later hook, timer and press. */ export type Host = { /** * `$.clock.now`. */ now: () => Promise /** * `$.clock.after`. */ after: TimerCall /** * `$.clock.every`. */ every: TimerCall /** * `$.process.run`. */ run: ( argv: readonly string[], init: ProcessRunInit, ) => Promise /** * `$.fs.stat`. */ stat: (path: string) => Promise /** * `$.fs.list`: a directory's entries by kind, links never followed. */ listDir: (path: string) => Promise /** * `$.fs.read`. */ readFile: (path: string) => Promise /** * Reads the plugin's store (`$.store.get`). */ storeGet: (key: string) => Promise /** * Writes the plugin's store (`$.store.set`). */ storeSet: (key: string, value: unknown) => Promise /** * `$.session.messages`. */ messages: () => Promise /** * `$.ui.invalidate("ui.render")`: every pane instance draws again. */ invalidate: () => void /** * `$.ui.status`: the plugin's line under the prompt. */ status: (text: string | undefined) => void /** * One debug line under the plugin's name (`$.ui.log`). */ uiLog: (text: string) => void /** * `$.ui.open`. */ openPane: (pane: PaneOpenArgs) => Promise /** * `$.ui.close`. */ closePane: (pane: PaneCloseArgs) => Promise /** * `$.command.register`; rejects while another `/diff` is listed. */ registerCommand: (spec: CommandSpec) => Promise /** * Which session the pane-shown row is latched to, as `$.session.id` says. */ sessionId: () => Promise /** * `$.telemetry.mark`; rejects where the telemetry built-in is absent. */ mark: EngineInterface['telemetry']['mark'] /** * `$.telemetry.log`; rejects where the telemetry built-in is absent. */ log: EngineInterface['telemetry']['log'] }