opencode/packages/session-ui/src/actions.ts
opencode-agent[bot] 434f7b2a36
fix(app): derive waiting steer presentation from execution state (#53880)
Co-authored-by: Brendonovich <14191578+Brendonovich@users.noreply.github.com>
2026-10-08 07:37:45 +00:00

40 lines
1.3 KiB
TypeScript

import type { PromptFileAttachment } from "@opencode/client/promise"
export type SessionUserComment =
| {
type?: "file"
path: string
comment: string
selection?: {
startLine: number
endLine: number
}
}
| {
/** A comment on something other than file lines, such as an element picked in a page. */
type: "note"
comment: string
label: string
icon: string
}
/** An attachment delivered to the model as a path on the server instead of inline bytes. */
export type SessionUserAttachmentReference = {
name: string
mime: string
path: string
}
export type SessionUserActions = {
openAttachment?: (file: PromptFileAttachment) => void
revert?: (input: { sessionID: string; messageID: string }) => Promise<void> | void
/**
* An input the server has not delivered yet. Like the TUI, a pending steer can move to the queue or be deleted;
* it shows as waiting only while `steering` behind delivered work or `stranded` by an execution that ended.
*/
pending?: {
status: (messageID: string) => "starting" | "steering" | "stranded" | "queued" | undefined
queue: (input: { sessionID: string; messageID: string }) => Promise<void>
remove: (input: { sessionID: string; messageID: string }) => Promise<void>
}
}