cerebras-cli 1.0.1 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/README.md +3 -5
  2. package/cerebras-cli-1.0.0.tgz +0 -0
  3. package/package.json +7 -88
  4. package/AGENTS.md +0 -27
  5. package/Dockerfile +0 -10
  6. package/bunfig.toml +0 -4
  7. package/parsers-config.ts +0 -239
  8. package/script/build.ts +0 -151
  9. package/script/postinstall.mjs +0 -122
  10. package/script/publish.ts +0 -256
  11. package/script/schema.ts +0 -47
  12. package/src/acp/README.md +0 -164
  13. package/src/acp/agent.ts +0 -812
  14. package/src/acp/session.ts +0 -70
  15. package/src/acp/types.ts +0 -22
  16. package/src/agent/agent.ts +0 -310
  17. package/src/agent/generate.txt +0 -75
  18. package/src/auth/index.ts +0 -70
  19. package/src/bun/index.ts +0 -152
  20. package/src/bus/global.ts +0 -10
  21. package/src/bus/index.ts +0 -142
  22. package/src/cli/bootstrap.ts +0 -17
  23. package/src/cli/cmd/acp.ts +0 -88
  24. package/src/cli/cmd/agent.ts +0 -165
  25. package/src/cli/cmd/auth.ts +0 -369
  26. package/src/cli/cmd/cmd.ts +0 -7
  27. package/src/cli/cmd/debug/config.ts +0 -15
  28. package/src/cli/cmd/debug/file.ts +0 -91
  29. package/src/cli/cmd/debug/index.ts +0 -41
  30. package/src/cli/cmd/debug/lsp.ts +0 -47
  31. package/src/cli/cmd/debug/ripgrep.ts +0 -83
  32. package/src/cli/cmd/debug/scrap.ts +0 -15
  33. package/src/cli/cmd/debug/snapshot.ts +0 -48
  34. package/src/cli/cmd/export.ts +0 -88
  35. package/src/cli/cmd/generate.ts +0 -38
  36. package/src/cli/cmd/github.ts +0 -1200
  37. package/src/cli/cmd/import.ts +0 -98
  38. package/src/cli/cmd/mcp.ts +0 -400
  39. package/src/cli/cmd/models.ts +0 -77
  40. package/src/cli/cmd/pr.ts +0 -112
  41. package/src/cli/cmd/run.ts +0 -342
  42. package/src/cli/cmd/serve.ts +0 -31
  43. package/src/cli/cmd/session.ts +0 -106
  44. package/src/cli/cmd/stats.ts +0 -298
  45. package/src/cli/cmd/tui/app.tsx +0 -732
  46. package/src/cli/cmd/tui/attach.ts +0 -25
  47. package/src/cli/cmd/tui/component/border.tsx +0 -21
  48. package/src/cli/cmd/tui/component/dialog-agent.tsx +0 -31
  49. package/src/cli/cmd/tui/component/dialog-command.tsx +0 -124
  50. package/src/cli/cmd/tui/component/dialog-feedback.tsx +0 -160
  51. package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -86
  52. package/src/cli/cmd/tui/component/dialog-model.tsx +0 -223
  53. package/src/cli/cmd/tui/component/dialog-notification.tsx +0 -78
  54. package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -222
  55. package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -97
  56. package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
  57. package/src/cli/cmd/tui/component/dialog-status.tsx +0 -114
  58. package/src/cli/cmd/tui/component/dialog-tag.tsx +0 -44
  59. package/src/cli/cmd/tui/component/dialog-theme-list.tsx +0 -50
  60. package/src/cli/cmd/tui/component/logo.tsx +0 -37
  61. package/src/cli/cmd/tui/component/notification-banner.tsx +0 -58
  62. package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -530
  63. package/src/cli/cmd/tui/component/prompt/history.tsx +0 -107
  64. package/src/cli/cmd/tui/component/prompt/index.tsx +0 -931
  65. package/src/cli/cmd/tui/context/args.tsx +0 -14
  66. package/src/cli/cmd/tui/context/directory.ts +0 -12
  67. package/src/cli/cmd/tui/context/exit.tsx +0 -23
  68. package/src/cli/cmd/tui/context/helper.tsx +0 -25
  69. package/src/cli/cmd/tui/context/keybind.tsx +0 -111
  70. package/src/cli/cmd/tui/context/kv.tsx +0 -49
  71. package/src/cli/cmd/tui/context/local.tsx +0 -339
  72. package/src/cli/cmd/tui/context/prompt.tsx +0 -18
  73. package/src/cli/cmd/tui/context/route.tsx +0 -45
  74. package/src/cli/cmd/tui/context/sdk.tsx +0 -75
  75. package/src/cli/cmd/tui/context/sync.tsx +0 -374
  76. package/src/cli/cmd/tui/context/theme/aura.json +0 -69
  77. package/src/cli/cmd/tui/context/theme/ayu.json +0 -80
  78. package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +0 -233
  79. package/src/cli/cmd/tui/context/theme/catppuccin.json +0 -112
  80. package/src/cli/cmd/tui/context/theme/cobalt2.json +0 -228
  81. package/src/cli/cmd/tui/context/theme/dracula.json +0 -219
  82. package/src/cli/cmd/tui/context/theme/everforest.json +0 -241
  83. package/src/cli/cmd/tui/context/theme/flexoki.json +0 -237
  84. package/src/cli/cmd/tui/context/theme/github.json +0 -233
  85. package/src/cli/cmd/tui/context/theme/gruvbox.json +0 -95
  86. package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
  87. package/src/cli/cmd/tui/context/theme/material.json +0 -235
  88. package/src/cli/cmd/tui/context/theme/matrix.json +0 -77
  89. package/src/cli/cmd/tui/context/theme/mercury.json +0 -252
  90. package/src/cli/cmd/tui/context/theme/monokai.json +0 -221
  91. package/src/cli/cmd/tui/context/theme/nightowl.json +0 -221
  92. package/src/cli/cmd/tui/context/theme/nord.json +0 -223
  93. package/src/cli/cmd/tui/context/theme/one-dark.json +0 -84
  94. package/src/cli/cmd/tui/context/theme/orng.json +0 -245
  95. package/src/cli/cmd/tui/context/theme/palenight.json +0 -222
  96. package/src/cli/cmd/tui/context/theme/rosepine.json +0 -234
  97. package/src/cli/cmd/tui/context/theme/solarized.json +0 -223
  98. package/src/cli/cmd/tui/context/theme/synthwave84.json +0 -226
  99. package/src/cli/cmd/tui/context/theme/tokyonight.json +0 -243
  100. package/src/cli/cmd/tui/context/theme/vercel.json +0 -245
  101. package/src/cli/cmd/tui/context/theme/vesper.json +0 -218
  102. package/src/cli/cmd/tui/context/theme/zenburn.json +0 -223
  103. package/src/cli/cmd/tui/context/theme.tsx +0 -1077
  104. package/src/cli/cmd/tui/event.ts +0 -39
  105. package/src/cli/cmd/tui/routes/home.tsx +0 -104
  106. package/src/cli/cmd/tui/routes/session/dialog-message.tsx +0 -93
  107. package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +0 -37
  108. package/src/cli/cmd/tui/routes/session/footer.tsx +0 -76
  109. package/src/cli/cmd/tui/routes/session/header.tsx +0 -183
  110. package/src/cli/cmd/tui/routes/session/index.tsx +0 -1703
  111. package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -586
  112. package/src/cli/cmd/tui/spawn.ts +0 -60
  113. package/src/cli/cmd/tui/thread.ts +0 -120
  114. package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -55
  115. package/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -81
  116. package/src/cli/cmd/tui/ui/dialog-help.tsx +0 -36
  117. package/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -75
  118. package/src/cli/cmd/tui/ui/dialog-select.tsx +0 -317
  119. package/src/cli/cmd/tui/ui/dialog.tsx +0 -170
  120. package/src/cli/cmd/tui/ui/spinner.ts +0 -368
  121. package/src/cli/cmd/tui/ui/toast.tsx +0 -100
  122. package/src/cli/cmd/tui/util/clipboard.ts +0 -127
  123. package/src/cli/cmd/tui/util/editor.ts +0 -32
  124. package/src/cli/cmd/tui/util/terminal.ts +0 -114
  125. package/src/cli/cmd/tui/worker.ts +0 -63
  126. package/src/cli/cmd/uninstall.ts +0 -344
  127. package/src/cli/cmd/upgrade.ts +0 -67
  128. package/src/cli/cmd/web.ts +0 -84
  129. package/src/cli/error.ts +0 -55
  130. package/src/cli/ui.ts +0 -84
  131. package/src/cli/upgrade.ts +0 -25
  132. package/src/command/index.ts +0 -79
  133. package/src/command/template/initialize.txt +0 -10
  134. package/src/command/template/review.txt +0 -73
  135. package/src/config/config.ts +0 -886
  136. package/src/config/markdown.ts +0 -41
  137. package/src/env/index.ts +0 -26
  138. package/src/file/fzf.ts +0 -124
  139. package/src/file/ignore.ts +0 -83
  140. package/src/file/index.ts +0 -326
  141. package/src/file/ripgrep.ts +0 -391
  142. package/src/file/time.ts +0 -38
  143. package/src/file/watcher.ts +0 -89
  144. package/src/flag/flag.ts +0 -28
  145. package/src/format/formatter.ts +0 -277
  146. package/src/format/index.ts +0 -137
  147. package/src/global/index.ts +0 -52
  148. package/src/id/id.ts +0 -73
  149. package/src/ide/index.ts +0 -75
  150. package/src/index.ts +0 -158
  151. package/src/installation/index.ts +0 -194
  152. package/src/lsp/client.ts +0 -215
  153. package/src/lsp/index.ts +0 -370
  154. package/src/lsp/language.ts +0 -111
  155. package/src/lsp/server.ts +0 -1327
  156. package/src/mcp/auth.ts +0 -82
  157. package/src/mcp/index.ts +0 -576
  158. package/src/mcp/oauth-callback.ts +0 -203
  159. package/src/mcp/oauth-provider.ts +0 -132
  160. package/src/notification/index.ts +0 -101
  161. package/src/patch/index.ts +0 -622
  162. package/src/permission/index.ts +0 -198
  163. package/src/plugin/index.ts +0 -95
  164. package/src/project/bootstrap.ts +0 -31
  165. package/src/project/instance.ts +0 -68
  166. package/src/project/project.ts +0 -133
  167. package/src/project/state.ts +0 -65
  168. package/src/project/vcs.ts +0 -77
  169. package/src/provider/auth.ts +0 -143
  170. package/src/provider/models-macro.ts +0 -11
  171. package/src/provider/models.ts +0 -93
  172. package/src/provider/provider.ts +0 -996
  173. package/src/provider/sdk/openai-compatible/src/README.md +0 -5
  174. package/src/provider/sdk/openai-compatible/src/index.ts +0 -2
  175. package/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +0 -100
  176. package/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +0 -303
  177. package/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +0 -27
  178. package/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +0 -18
  179. package/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +0 -22
  180. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +0 -207
  181. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +0 -1713
  182. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +0 -177
  183. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +0 -1
  184. package/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +0 -88
  185. package/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +0 -128
  186. package/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +0 -115
  187. package/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +0 -65
  188. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +0 -104
  189. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +0 -103
  190. package/src/provider/transform.ts +0 -406
  191. package/src/pty/index.ts +0 -226
  192. package/src/ratelimit/index.ts +0 -185
  193. package/src/server/error.ts +0 -36
  194. package/src/server/project.ts +0 -50
  195. package/src/server/server.ts +0 -2463
  196. package/src/server/tui.ts +0 -71
  197. package/src/session/compaction.ts +0 -257
  198. package/src/session/index.ts +0 -470
  199. package/src/session/message-v2.ts +0 -641
  200. package/src/session/message.ts +0 -189
  201. package/src/session/processor.ts +0 -443
  202. package/src/session/prompt/anthropic-20250930.txt +0 -166
  203. package/src/session/prompt/anthropic.txt +0 -105
  204. package/src/session/prompt/anthropic_spoof.txt +0 -1
  205. package/src/session/prompt/beast.txt +0 -147
  206. package/src/session/prompt/build-switch.txt +0 -5
  207. package/src/session/prompt/codex.txt +0 -318
  208. package/src/session/prompt/compaction.txt +0 -12
  209. package/src/session/prompt/copilot-gpt-5.txt +0 -143
  210. package/src/session/prompt/gemini.txt +0 -155
  211. package/src/session/prompt/max-steps.txt +0 -16
  212. package/src/session/prompt/plan-reminder-anthropic.txt +0 -67
  213. package/src/session/prompt/plan.txt +0 -26
  214. package/src/session/prompt/polaris.txt +0 -107
  215. package/src/session/prompt/qwen.txt +0 -109
  216. package/src/session/prompt/summarize.txt +0 -4
  217. package/src/session/prompt/title.txt +0 -36
  218. package/src/session/prompt.ts +0 -1541
  219. package/src/session/retry.ts +0 -82
  220. package/src/session/revert.ts +0 -108
  221. package/src/session/status.ts +0 -75
  222. package/src/session/summary.ts +0 -203
  223. package/src/session/system.ts +0 -148
  224. package/src/session/todo.ts +0 -36
  225. package/src/share/share-next.ts +0 -195
  226. package/src/share/share.ts +0 -87
  227. package/src/snapshot/index.ts +0 -197
  228. package/src/storage/storage.ts +0 -226
  229. package/src/telemetry/index.ts +0 -232
  230. package/src/tool/bash.ts +0 -365
  231. package/src/tool/bash.txt +0 -128
  232. package/src/tool/batch.ts +0 -173
  233. package/src/tool/batch.txt +0 -28
  234. package/src/tool/codesearch.ts +0 -138
  235. package/src/tool/codesearch.txt +0 -12
  236. package/src/tool/edit.ts +0 -674
  237. package/src/tool/edit.txt +0 -10
  238. package/src/tool/glob.ts +0 -65
  239. package/src/tool/glob.txt +0 -6
  240. package/src/tool/grep.ts +0 -120
  241. package/src/tool/grep.txt +0 -8
  242. package/src/tool/invalid.ts +0 -17
  243. package/src/tool/ls.ts +0 -110
  244. package/src/tool/ls.txt +0 -1
  245. package/src/tool/lsp-diagnostics.ts +0 -26
  246. package/src/tool/lsp-diagnostics.txt +0 -1
  247. package/src/tool/lsp-hover.ts +0 -31
  248. package/src/tool/lsp-hover.txt +0 -1
  249. package/src/tool/multiedit.ts +0 -46
  250. package/src/tool/multiedit.txt +0 -41
  251. package/src/tool/patch.ts +0 -233
  252. package/src/tool/patch.txt +0 -1
  253. package/src/tool/read.ts +0 -217
  254. package/src/tool/read.txt +0 -12
  255. package/src/tool/registry.ts +0 -148
  256. package/src/tool/task.ts +0 -135
  257. package/src/tool/task.txt +0 -60
  258. package/src/tool/todo.ts +0 -39
  259. package/src/tool/todoread.txt +0 -14
  260. package/src/tool/todowrite.txt +0 -167
  261. package/src/tool/tool.ts +0 -66
  262. package/src/tool/webfetch.ts +0 -187
  263. package/src/tool/webfetch.txt +0 -14
  264. package/src/tool/websearch.ts +0 -150
  265. package/src/tool/websearch.txt +0 -11
  266. package/src/tool/write.ts +0 -99
  267. package/src/tool/write.txt +0 -8
  268. package/src/types/shims.d.ts +0 -3
  269. package/src/util/color.ts +0 -19
  270. package/src/util/context.ts +0 -25
  271. package/src/util/defer.ts +0 -12
  272. package/src/util/eventloop.ts +0 -20
  273. package/src/util/filesystem.ts +0 -69
  274. package/src/util/fn.ts +0 -11
  275. package/src/util/iife.ts +0 -3
  276. package/src/util/keybind.ts +0 -79
  277. package/src/util/lazy.ts +0 -11
  278. package/src/util/locale.ts +0 -81
  279. package/src/util/lock.ts +0 -98
  280. package/src/util/log.ts +0 -177
  281. package/src/util/queue.ts +0 -32
  282. package/src/util/rpc.ts +0 -42
  283. package/src/util/scrap.ts +0 -10
  284. package/src/util/signal.ts +0 -12
  285. package/src/util/timeout.ts +0 -14
  286. package/src/util/token.ts +0 -7
  287. package/src/util/wildcard.ts +0 -54
  288. package/sst-env.d.ts +0 -9
  289. package/test/bun.test.ts +0 -53
  290. package/test/config/agent-color.test.ts +0 -66
  291. package/test/config/config.test.ts +0 -503
  292. package/test/config/markdown.test.ts +0 -89
  293. package/test/file/ignore.test.ts +0 -10
  294. package/test/fixture/fixture.ts +0 -28
  295. package/test/fixture/lsp/fake-lsp-server.js +0 -77
  296. package/test/ide/ide.test.ts +0 -82
  297. package/test/keybind.test.ts +0 -317
  298. package/test/lsp/client.test.ts +0 -95
  299. package/test/patch/patch.test.ts +0 -348
  300. package/test/preload.ts +0 -38
  301. package/test/project/project.test.ts +0 -42
  302. package/test/provider/provider.test.ts +0 -1809
  303. package/test/provider/transform.test.ts +0 -305
  304. package/test/session/retry.test.ts +0 -61
  305. package/test/session/session.test.ts +0 -71
  306. package/test/snapshot/snapshot.test.ts +0 -939
  307. package/test/tool/__snapshots__/tool.test.ts.snap +0 -9
  308. package/test/tool/bash.test.ts +0 -55
  309. package/test/tool/patch.test.ts +0 -259
  310. package/test/util/iife.test.ts +0 -36
  311. package/test/util/lazy.test.ts +0 -50
  312. package/test/util/timeout.test.ts +0 -21
  313. package/test/util/wildcard.test.ts +0 -55
  314. package/tsconfig.json +0 -17
@@ -1,931 +0,0 @@
1
- import { BoxRenderable, TextareaRenderable, MouseEvent, PasteEvent, t, dim, fg, type KeyBinding } from "@opentui/core"
2
- import { createEffect, createMemo, type JSX, onMount, createSignal, onCleanup, Show, Switch, Match } from "solid-js"
3
- import "opentui-spinner/solid"
4
- import { useLocal } from "@tui/context/local"
5
- import { useTheme } from "@tui/context/theme"
6
- import { EmptyBorder } from "@tui/component/border"
7
- import { useSDK } from "@tui/context/sdk"
8
- import { useRoute } from "@tui/context/route"
9
- import { useSync } from "@tui/context/sync"
10
- import { Identifier } from "@/id/id"
11
- import { createStore, produce } from "solid-js/store"
12
- import { useKeybind } from "@tui/context/keybind"
13
- import { usePromptHistory, type PromptInfo } from "./history"
14
- import { type AutocompleteRef, Autocomplete } from "./autocomplete"
15
- import { useCommandDialog } from "../dialog-command"
16
- import { useRenderer } from "@opentui/solid"
17
- import { Editor } from "@tui/util/editor"
18
- import { useExit } from "../../context/exit"
19
- import { Clipboard } from "../../util/clipboard"
20
- import type { FilePart } from "@opencode-ai/sdk/v2"
21
- import { TuiEvent } from "../../event"
22
- import { iife } from "@/util/iife"
23
- import { Locale } from "@/util/locale"
24
- import { createColors, createFrames } from "../../ui/spinner.ts"
25
- import { useDialog } from "@tui/ui/dialog"
26
- import { DialogProvider as DialogProviderConnect } from "../dialog-provider"
27
- import { useToast } from "../../ui/toast"
28
-
29
- export type PromptProps = {
30
- sessionID?: string
31
- disabled?: boolean
32
- onSubmit?: () => void
33
- ref?: (ref: PromptRef) => void
34
- hint?: JSX.Element
35
- showPlaceholder?: boolean
36
- }
37
-
38
- export type PromptRef = {
39
- focused: boolean
40
- current: PromptInfo
41
- set(prompt: PromptInfo): void
42
- reset(): void
43
- blur(): void
44
- focus(): void
45
- }
46
-
47
- const PLACEHOLDERS = ["Fix a TODO in the codebase", "What is the tech stack of this project?", "Fix broken tests"]
48
-
49
- export function Prompt(props: PromptProps) {
50
- let input: TextareaRenderable
51
- let anchor: BoxRenderable
52
- let autocomplete: AutocompleteRef
53
-
54
- const keybind = useKeybind()
55
- const local = useLocal()
56
- const sdk = useSDK()
57
- const route = useRoute()
58
- const sync = useSync()
59
- const dialog = useDialog()
60
- const toast = useToast()
61
- const status = createMemo(() => sync.data.session_status[props.sessionID ?? ""] ?? { type: "idle" })
62
- const history = usePromptHistory()
63
- const command = useCommandDialog()
64
- const renderer = useRenderer()
65
- const { theme, syntax } = useTheme()
66
-
67
- function promptModelWarning() {
68
- toast.show({
69
- variant: "warning",
70
- message: "Connect a provider to send prompts",
71
- duration: 3000,
72
- })
73
- if (sync.data.provider.length === 0) {
74
- dialog.replace(() => <DialogProviderConnect />)
75
- }
76
- }
77
-
78
- const textareaKeybindings = createMemo(() => {
79
- const newlineBindings = keybind.all.input_newline || []
80
- const submitBindings = keybind.all.input_submit || []
81
-
82
- return [
83
- { name: "return", action: "submit" },
84
- { name: "return", meta: true, action: "newline" },
85
- ...newlineBindings.map((binding) => ({
86
- name: binding.name,
87
- ctrl: binding.ctrl || undefined,
88
- meta: binding.meta || undefined,
89
- shift: binding.shift || undefined,
90
- action: "newline" as const,
91
- })),
92
- ...submitBindings.map((binding) => ({
93
- name: binding.name,
94
- ctrl: binding.ctrl || undefined,
95
- meta: binding.meta || undefined,
96
- shift: binding.shift || undefined,
97
- action: "submit" as const,
98
- })),
99
- ] satisfies KeyBinding[]
100
- })
101
-
102
- const fileStyleId = syntax().getStyleId("extmark.file")!
103
- const agentStyleId = syntax().getStyleId("extmark.agent")!
104
- const pasteStyleId = syntax().getStyleId("extmark.paste")!
105
- let promptPartTypeId: number
106
-
107
- command.register(() => {
108
- return [
109
- {
110
- title: "Clear prompt",
111
- value: "prompt.clear",
112
- category: "Prompt",
113
- disabled: true,
114
- onSelect: (dialog) => {
115
- input.extmarks.clear()
116
- input.clear()
117
- dialog.clear()
118
- },
119
- },
120
- {
121
- title: "Submit prompt",
122
- value: "prompt.submit",
123
- disabled: true,
124
- keybind: "input_submit",
125
- category: "Prompt",
126
- onSelect: (dialog) => {
127
- if (!input.focused) return
128
- submit()
129
- dialog.clear()
130
- },
131
- },
132
- {
133
- title: "Paste",
134
- value: "prompt.paste",
135
- disabled: true,
136
- keybind: "input_paste",
137
- category: "Prompt",
138
- onSelect: async () => {
139
- const content = await Clipboard.read()
140
- if (content?.mime.startsWith("image/")) {
141
- await pasteImage({
142
- filename: "clipboard",
143
- mime: content.mime,
144
- content: content.data,
145
- })
146
- }
147
- },
148
- },
149
- {
150
- title: "Interrupt session",
151
- value: "session.interrupt",
152
- keybind: "session_interrupt",
153
- disabled: status().type === "idle",
154
- category: "Session",
155
- onSelect: (dialog) => {
156
- if (autocomplete.visible) return
157
- if (!input.focused) return
158
- // TODO: this should be its own command
159
- if (store.mode === "shell") {
160
- setStore("mode", "normal")
161
- return
162
- }
163
- if (!props.sessionID) return
164
-
165
- setStore("interrupt", store.interrupt + 1)
166
-
167
- setTimeout(() => {
168
- setStore("interrupt", 0)
169
- }, 5000)
170
-
171
- if (store.interrupt >= 2) {
172
- sdk.client.session.abort({
173
- sessionID: props.sessionID,
174
- })
175
- setStore("interrupt", 0)
176
- }
177
- dialog.clear()
178
- },
179
- },
180
- {
181
- title: "Open editor",
182
- category: "Session",
183
- keybind: "editor_open",
184
- value: "prompt.editor",
185
- onSelect: async (dialog, trigger) => {
186
- dialog.clear()
187
-
188
- // replace summarized text parts with the actual text
189
- const text = store.prompt.parts
190
- .filter((p) => p.type === "text")
191
- .reduce((acc, p) => {
192
- if (!p.source) return acc
193
- return acc.replace(p.source.text.value, p.text)
194
- }, store.prompt.input)
195
-
196
- const nonTextParts = store.prompt.parts.filter((p) => p.type !== "text")
197
-
198
- const value = trigger === "prompt" ? "" : text
199
- const content = await Editor.open({ value, renderer })
200
- if (!content) return
201
-
202
- input.setText(content, { history: false })
203
-
204
- // Update positions for nonTextParts based on their location in new content
205
- // Filter out parts whose virtual text was deleted
206
- // this handles a case where the user edits the text in the editor
207
- // such that the virtual text moves around or is deleted
208
- const updatedNonTextParts = nonTextParts
209
- .map((part) => {
210
- let virtualText = ""
211
- if (part.type === "file" && part.source?.text) {
212
- virtualText = part.source.text.value
213
- } else if (part.type === "agent" && part.source) {
214
- virtualText = part.source.value
215
- }
216
-
217
- if (!virtualText) return part
218
-
219
- const newStart = content.indexOf(virtualText)
220
- // if the virtual text is deleted, remove the part
221
- if (newStart === -1) return null
222
-
223
- const newEnd = newStart + virtualText.length
224
-
225
- if (part.type === "file" && part.source?.text) {
226
- return {
227
- ...part,
228
- source: {
229
- ...part.source,
230
- text: {
231
- ...part.source.text,
232
- start: newStart,
233
- end: newEnd,
234
- },
235
- },
236
- }
237
- }
238
-
239
- if (part.type === "agent" && part.source) {
240
- return {
241
- ...part,
242
- source: {
243
- ...part.source,
244
- start: newStart,
245
- end: newEnd,
246
- },
247
- }
248
- }
249
-
250
- return part
251
- })
252
- .filter((part) => part !== null)
253
-
254
- setStore("prompt", {
255
- input: content,
256
- // keep only the non-text parts because the text parts were
257
- // already expanded inline
258
- parts: updatedNonTextParts,
259
- })
260
- restoreExtmarksFromParts(updatedNonTextParts)
261
- input.cursorOffset = Bun.stringWidth(content)
262
- },
263
- },
264
- ]
265
- })
266
-
267
- sdk.event.on(TuiEvent.PromptAppend.type, (evt) => {
268
- input.insertText(evt.properties.text)
269
- })
270
-
271
- createEffect(() => {
272
- if (props.disabled) input.cursorColor = theme.backgroundElement
273
- if (!props.disabled) input.cursorColor = theme.text
274
- })
275
-
276
- const [store, setStore] = createStore<{
277
- prompt: PromptInfo
278
- mode: "normal" | "shell"
279
- extmarkToPartIndex: Map<number, number>
280
- interrupt: number
281
- placeholder: number
282
- }>({
283
- placeholder: Math.floor(Math.random() * PLACEHOLDERS.length),
284
- prompt: {
285
- input: "",
286
- parts: [],
287
- },
288
- mode: "normal",
289
- extmarkToPartIndex: new Map(),
290
- interrupt: 0,
291
- })
292
-
293
- createEffect(() => {
294
- input.focus()
295
- })
296
-
297
- onMount(() => {
298
- promptPartTypeId = input.extmarks.registerType("prompt-part")
299
- })
300
-
301
- function restoreExtmarksFromParts(parts: PromptInfo["parts"]) {
302
- input.extmarks.clear()
303
- setStore("extmarkToPartIndex", new Map())
304
-
305
- parts.forEach((part, partIndex) => {
306
- let start = 0
307
- let end = 0
308
- let virtualText = ""
309
- let styleId: number | undefined
310
-
311
- if (part.type === "file" && part.source?.text) {
312
- start = part.source.text.start
313
- end = part.source.text.end
314
- virtualText = part.source.text.value
315
- styleId = fileStyleId
316
- } else if (part.type === "agent" && part.source) {
317
- start = part.source.start
318
- end = part.source.end
319
- virtualText = part.source.value
320
- styleId = agentStyleId
321
- } else if (part.type === "text" && part.source?.text) {
322
- start = part.source.text.start
323
- end = part.source.text.end
324
- virtualText = part.source.text.value
325
- styleId = pasteStyleId
326
- }
327
-
328
- if (virtualText) {
329
- const extmarkId = input.extmarks.create({
330
- start,
331
- end,
332
- virtual: true,
333
- styleId,
334
- typeId: promptPartTypeId,
335
- })
336
- setStore("extmarkToPartIndex", (map: Map<number, number>) => {
337
- const newMap = new Map(map)
338
- newMap.set(extmarkId, partIndex)
339
- return newMap
340
- })
341
- }
342
- })
343
- }
344
-
345
- function syncExtmarksWithPromptParts() {
346
- const allExtmarks = input.extmarks.getAllForTypeId(promptPartTypeId)
347
- setStore(
348
- produce((draft) => {
349
- const newMap = new Map<number, number>()
350
- const newParts: typeof draft.prompt.parts = []
351
-
352
- for (const extmark of allExtmarks) {
353
- const partIndex = draft.extmarkToPartIndex.get(extmark.id)
354
- if (partIndex !== undefined) {
355
- const part = draft.prompt.parts[partIndex]
356
- if (part) {
357
- if (part.type === "agent" && part.source) {
358
- part.source.start = extmark.start
359
- part.source.end = extmark.end
360
- } else if (part.type === "file" && part.source?.text) {
361
- part.source.text.start = extmark.start
362
- part.source.text.end = extmark.end
363
- } else if (part.type === "text" && part.source?.text) {
364
- part.source.text.start = extmark.start
365
- part.source.text.end = extmark.end
366
- }
367
- newMap.set(extmark.id, newParts.length)
368
- newParts.push(part)
369
- }
370
- }
371
- }
372
-
373
- draft.extmarkToPartIndex = newMap
374
- draft.prompt.parts = newParts
375
- }),
376
- )
377
- }
378
-
379
- props.ref?.({
380
- get focused() {
381
- return input.focused
382
- },
383
- get current() {
384
- return store.prompt
385
- },
386
- focus() {
387
- input.focus()
388
- },
389
- blur() {
390
- input.blur()
391
- },
392
- set(prompt) {
393
- input.setText(prompt.input, { history: false })
394
- setStore("prompt", prompt)
395
- restoreExtmarksFromParts(prompt.parts)
396
- input.gotoBufferEnd()
397
- },
398
- reset() {
399
- input.clear()
400
- input.extmarks.clear()
401
- setStore("prompt", {
402
- input: "",
403
- parts: [],
404
- })
405
- setStore("extmarkToPartIndex", new Map())
406
- },
407
- })
408
-
409
- async function submit() {
410
- if (props.disabled) return
411
- if (autocomplete.visible) return
412
- if (!store.prompt.input) return
413
- const selectedModel = local.model.current()
414
- if (!selectedModel) {
415
- promptModelWarning()
416
- return
417
- }
418
- const sessionID = props.sessionID
419
- ? props.sessionID
420
- : await (async () => {
421
- const sessionID = await sdk.client.session.create({}).then((x) => x.data!.id)
422
- return sessionID
423
- })()
424
- const messageID = Identifier.ascending("message")
425
- let inputText = store.prompt.input
426
-
427
- // Expand pasted text inline before submitting
428
- const allExtmarks = input.extmarks.getAllForTypeId(promptPartTypeId)
429
- const sortedExtmarks = allExtmarks.sort((a: { start: number }, b: { start: number }) => b.start - a.start)
430
-
431
- for (const extmark of sortedExtmarks) {
432
- const partIndex = store.extmarkToPartIndex.get(extmark.id)
433
- if (partIndex !== undefined) {
434
- const part = store.prompt.parts[partIndex]
435
- if (part?.type === "text" && part.text) {
436
- const before = inputText.slice(0, extmark.start)
437
- const after = inputText.slice(extmark.end)
438
- inputText = before + part.text + after
439
- }
440
- }
441
- }
442
-
443
- // Filter out text parts (pasted content) since they're now expanded inline
444
- const nonTextParts = store.prompt.parts.filter((part) => part.type !== "text")
445
-
446
- if (store.mode === "shell") {
447
- sdk.client.session.shell({
448
- sessionID,
449
- agent: local.agent.current().name,
450
- model: {
451
- providerID: selectedModel.providerID,
452
- modelID: selectedModel.modelID,
453
- },
454
- command: inputText,
455
- })
456
- setStore("mode", "normal")
457
- } else if (
458
- inputText.startsWith("/") &&
459
- iife(() => {
460
- const command = inputText.split(" ")[0].slice(1)
461
- console.log(command)
462
- return sync.data.command.some((x) => x.name === command)
463
- })
464
- ) {
465
- let [command, ...args] = inputText.split(" ")
466
- sdk.client.session.command({
467
- sessionID,
468
- command: command.slice(1),
469
- arguments: args.join(" "),
470
- agent: local.agent.current().name,
471
- model: `${selectedModel.providerID}/${selectedModel.modelID}`,
472
- messageID,
473
- })
474
- } else {
475
- sdk.client.session.prompt({
476
- sessionID,
477
- ...selectedModel,
478
- messageID,
479
- agent: local.agent.current().name,
480
- model: selectedModel,
481
- parts: [
482
- {
483
- id: Identifier.ascending("part"),
484
- type: "text",
485
- text: inputText,
486
- },
487
- ...nonTextParts.map((x) => ({
488
- id: Identifier.ascending("part"),
489
- ...x,
490
- })),
491
- ],
492
- })
493
- }
494
- history.append(store.prompt)
495
- input.extmarks.clear()
496
- setStore("prompt", {
497
- input: "",
498
- parts: [],
499
- })
500
- setStore("extmarkToPartIndex", new Map())
501
- props.onSubmit?.()
502
-
503
- // temporary hack to make sure the message is sent
504
- if (!props.sessionID)
505
- setTimeout(() => {
506
- route.navigate({
507
- type: "session",
508
- sessionID,
509
- })
510
- }, 50)
511
- input.clear()
512
- }
513
- const exit = useExit()
514
-
515
- function pasteText(text: string, virtualText: string) {
516
- const currentOffset = input.visualCursor.offset
517
- const extmarkStart = currentOffset
518
- const extmarkEnd = extmarkStart + virtualText.length
519
-
520
- input.insertText(virtualText + " ")
521
-
522
- const extmarkId = input.extmarks.create({
523
- start: extmarkStart,
524
- end: extmarkEnd,
525
- virtual: true,
526
- styleId: pasteStyleId,
527
- typeId: promptPartTypeId,
528
- })
529
-
530
- setStore(
531
- produce((draft) => {
532
- const partIndex = draft.prompt.parts.length
533
- draft.prompt.parts.push({
534
- type: "text" as const,
535
- text,
536
- source: {
537
- text: {
538
- start: extmarkStart,
539
- end: extmarkEnd,
540
- value: virtualText,
541
- },
542
- },
543
- })
544
- draft.extmarkToPartIndex.set(extmarkId, partIndex)
545
- }),
546
- )
547
- }
548
-
549
- async function pasteImage(file: { filename?: string; content: string; mime: string }) {
550
- const currentOffset = input.visualCursor.offset
551
- const extmarkStart = currentOffset
552
- const count = store.prompt.parts.filter((x) => x.type === "file").length
553
- const virtualText = `[Image ${count + 1}]`
554
- const extmarkEnd = extmarkStart + virtualText.length
555
- const textToInsert = virtualText + " "
556
-
557
- input.insertText(textToInsert)
558
-
559
- const extmarkId = input.extmarks.create({
560
- start: extmarkStart,
561
- end: extmarkEnd,
562
- virtual: true,
563
- styleId: pasteStyleId,
564
- typeId: promptPartTypeId,
565
- })
566
-
567
- const part: Omit<FilePart, "id" | "messageID" | "sessionID"> = {
568
- type: "file" as const,
569
- mime: file.mime,
570
- filename: file.filename,
571
- url: `data:${file.mime};base64,${file.content}`,
572
- source: {
573
- type: "file",
574
- path: file.filename ?? "",
575
- text: {
576
- start: extmarkStart,
577
- end: extmarkEnd,
578
- value: virtualText,
579
- },
580
- },
581
- }
582
- setStore(
583
- produce((draft) => {
584
- const partIndex = draft.prompt.parts.length
585
- draft.prompt.parts.push(part)
586
- draft.extmarkToPartIndex.set(extmarkId, partIndex)
587
- }),
588
- )
589
- return
590
- }
591
-
592
- const highlight = createMemo(() => {
593
- if (keybind.leader) return theme.border
594
- if (store.mode === "shell") return theme.primary
595
- return local.agent.color(local.agent.current().name)
596
- })
597
-
598
- const spinnerDef = createMemo(() => {
599
- const color = local.agent.color(local.agent.current().name)
600
- return {
601
- frames: createFrames({
602
- color,
603
- style: "blocks",
604
- inactiveFactor: 0.6,
605
- // enableFading: false,
606
- minAlpha: 0.3,
607
- }),
608
- color: createColors({
609
- color,
610
- style: "blocks",
611
- inactiveFactor: 0.6,
612
- // enableFading: false,
613
- minAlpha: 0.3,
614
- }),
615
- }
616
- })
617
-
618
- return (
619
- <>
620
- <Autocomplete
621
- sessionID={props.sessionID}
622
- ref={(r) => (autocomplete = r)}
623
- anchor={() => anchor}
624
- input={() => input}
625
- setPrompt={(cb) => {
626
- setStore("prompt", produce(cb))
627
- }}
628
- setExtmark={(partIndex, extmarkId) => {
629
- setStore("extmarkToPartIndex", (map: Map<number, number>) => {
630
- const newMap = new Map(map)
631
- newMap.set(extmarkId, partIndex)
632
- return newMap
633
- })
634
- }}
635
- value={store.prompt.input}
636
- fileStyleId={fileStyleId}
637
- agentStyleId={agentStyleId}
638
- promptPartTypeId={() => promptPartTypeId}
639
- />
640
- <box ref={(r) => (anchor = r)}>
641
- <box
642
- border={["left"]}
643
- borderColor={highlight()}
644
- customBorderChars={{
645
- ...EmptyBorder,
646
- vertical: "┃",
647
- bottomLeft: "╹",
648
- }}
649
- >
650
- <box
651
- paddingLeft={2}
652
- paddingRight={1}
653
- paddingTop={1}
654
- flexShrink={0}
655
- backgroundColor={theme.backgroundElement}
656
- flexGrow={1}
657
- >
658
- <textarea
659
- placeholder={props.sessionID ? undefined : `Ask anything... "${PLACEHOLDERS[store.placeholder]}"`}
660
- textColor={theme.text}
661
- focusedTextColor={theme.text}
662
- minHeight={1}
663
- maxHeight={6}
664
- onContentChange={() => {
665
- const value = input.plainText
666
- setStore("prompt", "input", value)
667
- autocomplete.onInput(value)
668
- syncExtmarksWithPromptParts()
669
- }}
670
- keyBindings={textareaKeybindings()}
671
- onKeyDown={async (e) => {
672
- if (props.disabled) {
673
- e.preventDefault()
674
- return
675
- }
676
- if (keybind.match("input_clear", e) && store.prompt.input !== "") {
677
- input.clear()
678
- input.extmarks.clear()
679
- setStore("prompt", {
680
- input: "",
681
- parts: [],
682
- })
683
- setStore("extmarkToPartIndex", new Map())
684
- return
685
- }
686
- if (keybind.match("input_forward_delete", e) && store.prompt.input !== "") {
687
- const cursorOffset = input.cursorOffset
688
- if (cursorOffset < input.plainText.length) {
689
- const text = input.plainText
690
- const newText = text.slice(0, cursorOffset) + text.slice(cursorOffset + 1)
691
- input.setText(newText)
692
- input.cursorOffset = cursorOffset
693
- }
694
- e.preventDefault()
695
- return
696
- }
697
- if (keybind.match("app_exit", e)) {
698
- await exit()
699
- return
700
- }
701
- if (e.name === "!" && input.visualCursor.offset === 0) {
702
- setStore("mode", "shell")
703
- e.preventDefault()
704
- return
705
- }
706
- if (store.mode === "shell") {
707
- if ((e.name === "backspace" && input.visualCursor.offset === 0) || e.name === "escape") {
708
- setStore("mode", "normal")
709
- e.preventDefault()
710
- return
711
- }
712
- }
713
- if (store.mode === "normal") autocomplete.onKeyDown(e)
714
- if (!autocomplete.visible) {
715
- if (
716
- (keybind.match("history_previous", e) && input.cursorOffset === 0) ||
717
- (keybind.match("history_next", e) && input.cursorOffset === input.plainText.length)
718
- ) {
719
- const direction = keybind.match("history_previous", e) ? -1 : 1
720
- const item = history.move(direction, input.plainText)
721
-
722
- if (item) {
723
- input.setText(item.input, { history: false })
724
- setStore("prompt", item)
725
- restoreExtmarksFromParts(item.parts)
726
- e.preventDefault()
727
- if (direction === -1) input.cursorOffset = 0
728
- if (direction === 1) input.cursorOffset = input.plainText.length
729
- }
730
- return
731
- }
732
-
733
- if (keybind.match("history_previous", e) && input.visualCursor.visualRow === 0) input.cursorOffset = 0
734
- if (keybind.match("history_next", e) && input.visualCursor.visualRow === input.height - 1)
735
- input.cursorOffset = input.plainText.length
736
- }
737
- }}
738
- onSubmit={submit}
739
- onPaste={async (event: PasteEvent) => {
740
- if (props.disabled) {
741
- event.preventDefault()
742
- return
743
- }
744
-
745
- // Normalize line endings at the boundary
746
- // Windows ConPTY/Terminal often sends CR-only newlines in bracketed paste
747
- // Replace CRLF first, then any remaining CR
748
- const normalizedText = event.text.replace(/\r\n/g, "\n").replace(/\r/g, "\n")
749
- const pastedContent = normalizedText.trim()
750
- if (!pastedContent) {
751
- command.trigger("prompt.paste")
752
- return
753
- }
754
-
755
- // trim ' from the beginning and end of the pasted content. just
756
- // ' and nothing else
757
- const filepath = pastedContent.replace(/^'+|'+$/g, "").replace(/\\ /g, " ")
758
- const isUrl = /^(https?):\/\//.test(filepath)
759
- if (!isUrl) {
760
- try {
761
- const file = Bun.file(filepath)
762
- // Handle SVG as raw text content, not as base64 image
763
- if (file.type === "image/svg+xml") {
764
- event.preventDefault()
765
- const content = await file.text().catch(() => {})
766
- if (content) {
767
- pasteText(content, `[SVG: ${file.name ?? "image"}]`)
768
- return
769
- }
770
- }
771
- if (file.type.startsWith("image/")) {
772
- event.preventDefault()
773
- const content = await file
774
- .arrayBuffer()
775
- .then((buffer) => Buffer.from(buffer).toString("base64"))
776
- .catch(() => {})
777
- if (content) {
778
- await pasteImage({
779
- filename: file.name,
780
- mime: file.type,
781
- content,
782
- })
783
- return
784
- }
785
- }
786
- } catch {}
787
- }
788
-
789
- const lineCount = (pastedContent.match(/\n/g)?.length ?? 0) + 1
790
- if (
791
- (lineCount >= 3 || pastedContent.length > 150) &&
792
- !sync.data.config.experimental?.disable_paste_summary
793
- ) {
794
- event.preventDefault()
795
- pasteText(pastedContent, `[Pasted ~${lineCount} lines]`)
796
- return
797
- }
798
- }}
799
- ref={(r: TextareaRenderable) => {
800
- input = r
801
- setTimeout(() => {
802
- input.cursorColor = theme.text
803
- }, 0)
804
- }}
805
- onMouseDown={(r: MouseEvent) => r.target?.focus()}
806
- focusedBackgroundColor={theme.backgroundElement}
807
- cursorColor={theme.text}
808
- syntaxStyle={syntax()}
809
- />
810
- <box flexDirection="row" flexShrink={0} paddingTop={1} gap={1}>
811
- <text fg={highlight()}>
812
- {store.mode === "shell" ? "Shell" : Locale.titlecase(local.agent.current().name)}{" "}
813
- </text>
814
- <Show when={store.mode === "normal"}>
815
- <box flexDirection="row" gap={1}>
816
- <text fg={theme.textMuted}>{local.model.parsed().provider}</text>
817
- <text flexShrink={0} fg={theme.text}>
818
- {local.model.parsed().model}
819
- </text>
820
- </box>
821
- </Show>
822
- </box>
823
- </box>
824
- </box>
825
- <box
826
- height={1}
827
- border={["left"]}
828
- borderColor={highlight()}
829
- customBorderChars={{
830
- ...EmptyBorder,
831
- // when the background is transparent, don't draw the vertical line
832
- vertical: theme.background.a != 0 ? "╹" : " ",
833
- }}
834
- >
835
- <box
836
- height={1}
837
- border={["bottom"]}
838
- borderColor={theme.backgroundElement}
839
- customBorderChars={
840
- theme.background.a != 0
841
- ? {
842
- ...EmptyBorder,
843
- horizontal: "▀",
844
- }
845
- : {
846
- ...EmptyBorder,
847
- horizontal: " ",
848
- }
849
- }
850
- />
851
- </box>
852
- <box flexDirection="row" justifyContent="space-between">
853
- <Show when={status().type !== "idle"} fallback={<text />}>
854
- <box
855
- flexDirection="row"
856
- gap={1}
857
- flexGrow={1}
858
- justifyContent={status().type === "retry" ? "space-between" : "flex-start"}
859
- >
860
- <box flexShrink={0} flexDirection="row" gap={1}>
861
- {/* @ts-ignore // SpinnerOptions doesn't support marginLeft */}
862
- <spinner marginLeft={1} color={spinnerDef().color} frames={spinnerDef().frames} interval={40} />
863
- <box flexDirection="row" gap={1} flexShrink={0}>
864
- {(() => {
865
- const retry = createMemo(() => {
866
- const s = status()
867
- if (s.type !== "retry") return
868
- return s
869
- })
870
- const message = createMemo(() => {
871
- const r = retry()
872
- if (!r) return
873
- if (r.message.includes("exceeded your current quota") && r.message.includes("gemini"))
874
- return "gemini is way too hot right now"
875
- if (r.message.length > 50) return r.message.slice(0, 50) + "..."
876
- return r.message
877
- })
878
- const [seconds, setSeconds] = createSignal(0)
879
- onMount(() => {
880
- const timer = setInterval(() => {
881
- const next = retry()?.next
882
- if (next) setSeconds(Math.round((next - Date.now()) / 1000))
883
- }, 1000)
884
-
885
- onCleanup(() => {
886
- clearInterval(timer)
887
- })
888
- })
889
- return (
890
- <Show when={retry()}>
891
- <text fg={theme.error}>
892
- {message()} [retrying {seconds() > 0 ? `in ${seconds()}s ` : ""}
893
- attempt #{retry()!.attempt}]
894
- </text>
895
- </Show>
896
- )
897
- })()}
898
- </box>
899
- </box>
900
- <text fg={store.interrupt > 0 ? theme.primary : theme.text}>
901
- esc{" "}
902
- <span style={{ fg: store.interrupt > 0 ? theme.primary : theme.textMuted }}>
903
- {store.interrupt > 0 ? "again to interrupt" : "interrupt"}
904
- </span>
905
- </text>
906
- </box>
907
- </Show>
908
- <Show when={status().type !== "retry"}>
909
- <box gap={2} flexDirection="row">
910
- <Switch>
911
- <Match when={store.mode === "normal"}>
912
- <text fg={theme.text}>
913
- {keybind.print("agent_cycle")} <span style={{ fg: theme.textMuted }}>switch agent</span>
914
- </text>
915
- <text fg={theme.text}>
916
- {keybind.print("command_list")} <span style={{ fg: theme.textMuted }}>commands</span>
917
- </text>
918
- </Match>
919
- <Match when={store.mode === "shell"}>
920
- <text fg={theme.text}>
921
- esc <span style={{ fg: theme.textMuted }}>exit shell mode</span>
922
- </text>
923
- </Match>
924
- </Switch>
925
- </box>
926
- </Show>
927
- </box>
928
- </box>
929
- </>
930
- )
931
- }