Download packages/tui/src/prompt/traits.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 765 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/src/prompt/traits.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/tui/src/prompt/traits.ts
-
curl -L -o traits.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/tui/src/prompt/traits.ts
765 Bytes
| import type { EditorTraits } from "@opentui/core" | |
| export type PromptMode = "normal" | "shell" | |
| export interface PromptTraitsInput { | |
| mode: PromptMode | |
| autocompleteVisible: boolean | |
| } | |
| export type PromptTraits = EditorTraits & { | |
| owner: "opencode" | |
| role: "prompt" | |
| } | |
| /** The managed textarea keymap owns `suspend`; these traits only describe capture and status. */ | |
| export function computePromptTraits(input: PromptTraitsInput): PromptTraits { | |
| const capture = | |
| input.mode === "normal" | |
| ? input.autocompleteVisible | |
| ? (["escape", "navigate", "submit", "tab"] as const) | |
| : (["tab"] as const) | |
| : undefined | |
| return { | |
| capture, | |
| status: input.mode === "shell" ? "SHELL" : undefined, | |
| owner: "opencode", | |
| role: "prompt", | |
| } | |
| } | |