@bloxystudios/bloxycode 1.0.0

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 (344) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +256 -0
  3. package/bin/bloxycode +84 -0
  4. package/package.json +133 -0
  5. package/src/acp/README.md +164 -0
  6. package/src/acp/agent.ts +1437 -0
  7. package/src/acp/session.ts +105 -0
  8. package/src/acp/types.ts +22 -0
  9. package/src/agent/agent.ts +356 -0
  10. package/src/agent/generate.txt +75 -0
  11. package/src/agent/prompt/bloxy.txt +46 -0
  12. package/src/agent/prompt/compaction.txt +12 -0
  13. package/src/agent/prompt/explore.txt +18 -0
  14. package/src/agent/prompt/summary.txt +11 -0
  15. package/src/agent/prompt/title.txt +44 -0
  16. package/src/auth/index.ts +73 -0
  17. package/src/bloxy/event.ts +41 -0
  18. package/src/bloxy/index.ts +5 -0
  19. package/src/bloxy/parser.ts +263 -0
  20. package/src/bloxy/prompt.ts +121 -0
  21. package/src/bloxy/runner.ts +193 -0
  22. package/src/bloxy/state.ts +246 -0
  23. package/src/bun/index.ts +134 -0
  24. package/src/bus/bus-event.ts +43 -0
  25. package/src/bus/global.ts +10 -0
  26. package/src/bus/index.ts +105 -0
  27. package/src/cli/bootstrap.ts +17 -0
  28. package/src/cli/cmd/acp.ts +69 -0
  29. package/src/cli/cmd/agent.ts +257 -0
  30. package/src/cli/cmd/auth.ts +400 -0
  31. package/src/cli/cmd/cmd.ts +7 -0
  32. package/src/cli/cmd/debug/agent.ts +167 -0
  33. package/src/cli/cmd/debug/config.ts +16 -0
  34. package/src/cli/cmd/debug/file.ts +97 -0
  35. package/src/cli/cmd/debug/index.ts +48 -0
  36. package/src/cli/cmd/debug/lsp.ts +52 -0
  37. package/src/cli/cmd/debug/ripgrep.ts +87 -0
  38. package/src/cli/cmd/debug/scrap.ts +16 -0
  39. package/src/cli/cmd/debug/skill.ts +16 -0
  40. package/src/cli/cmd/debug/snapshot.ts +52 -0
  41. package/src/cli/cmd/export.ts +88 -0
  42. package/src/cli/cmd/generate.ts +38 -0
  43. package/src/cli/cmd/github.ts +1548 -0
  44. package/src/cli/cmd/import.ts +98 -0
  45. package/src/cli/cmd/mcp.ts +755 -0
  46. package/src/cli/cmd/models.ts +77 -0
  47. package/src/cli/cmd/pr.ts +112 -0
  48. package/src/cli/cmd/run.ts +395 -0
  49. package/src/cli/cmd/serve.ts +20 -0
  50. package/src/cli/cmd/session.ts +135 -0
  51. package/src/cli/cmd/stats.ts +402 -0
  52. package/src/cli/cmd/tui/app.tsx +771 -0
  53. package/src/cli/cmd/tui/attach.ts +39 -0
  54. package/src/cli/cmd/tui/component/border.tsx +21 -0
  55. package/src/cli/cmd/tui/component/dialog-agent.tsx +31 -0
  56. package/src/cli/cmd/tui/component/dialog-command.tsx +148 -0
  57. package/src/cli/cmd/tui/component/dialog-mcp.tsx +86 -0
  58. package/src/cli/cmd/tui/component/dialog-model.tsx +234 -0
  59. package/src/cli/cmd/tui/component/dialog-provider.tsx +256 -0
  60. package/src/cli/cmd/tui/component/dialog-session-list.tsx +114 -0
  61. package/src/cli/cmd/tui/component/dialog-session-rename.tsx +31 -0
  62. package/src/cli/cmd/tui/component/dialog-stash.tsx +87 -0
  63. package/src/cli/cmd/tui/component/dialog-status.tsx +164 -0
  64. package/src/cli/cmd/tui/component/dialog-tag.tsx +44 -0
  65. package/src/cli/cmd/tui/component/dialog-theme-list.tsx +50 -0
  66. package/src/cli/cmd/tui/component/logo.tsx +102 -0
  67. package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +653 -0
  68. package/src/cli/cmd/tui/component/prompt/frecency.tsx +89 -0
  69. package/src/cli/cmd/tui/component/prompt/history.tsx +108 -0
  70. package/src/cli/cmd/tui/component/prompt/index.tsx +1138 -0
  71. package/src/cli/cmd/tui/component/prompt/stash.tsx +101 -0
  72. package/src/cli/cmd/tui/component/textarea-keybindings.ts +73 -0
  73. package/src/cli/cmd/tui/component/tips.tsx +153 -0
  74. package/src/cli/cmd/tui/component/todo-item.tsx +32 -0
  75. package/src/cli/cmd/tui/context/args.tsx +14 -0
  76. package/src/cli/cmd/tui/context/directory.ts +13 -0
  77. package/src/cli/cmd/tui/context/exit.tsx +23 -0
  78. package/src/cli/cmd/tui/context/helper.tsx +25 -0
  79. package/src/cli/cmd/tui/context/keybind.tsx +101 -0
  80. package/src/cli/cmd/tui/context/kv.tsx +52 -0
  81. package/src/cli/cmd/tui/context/local.tsx +402 -0
  82. package/src/cli/cmd/tui/context/prompt.tsx +18 -0
  83. package/src/cli/cmd/tui/context/route.tsx +46 -0
  84. package/src/cli/cmd/tui/context/sdk.tsx +94 -0
  85. package/src/cli/cmd/tui/context/sync.tsx +470 -0
  86. package/src/cli/cmd/tui/context/theme/aura.json +69 -0
  87. package/src/cli/cmd/tui/context/theme/ayu.json +80 -0
  88. package/src/cli/cmd/tui/context/theme/bloxycode.json +245 -0
  89. package/src/cli/cmd/tui/context/theme/carbonfox.json +248 -0
  90. package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +233 -0
  91. package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +233 -0
  92. package/src/cli/cmd/tui/context/theme/catppuccin.json +112 -0
  93. package/src/cli/cmd/tui/context/theme/cobalt2.json +228 -0
  94. package/src/cli/cmd/tui/context/theme/cursor.json +249 -0
  95. package/src/cli/cmd/tui/context/theme/dracula.json +219 -0
  96. package/src/cli/cmd/tui/context/theme/everforest.json +241 -0
  97. package/src/cli/cmd/tui/context/theme/flexoki.json +237 -0
  98. package/src/cli/cmd/tui/context/theme/github.json +233 -0
  99. package/src/cli/cmd/tui/context/theme/gruvbox.json +242 -0
  100. package/src/cli/cmd/tui/context/theme/kanagawa.json +77 -0
  101. package/src/cli/cmd/tui/context/theme/lucent-orng.json +237 -0
  102. package/src/cli/cmd/tui/context/theme/material.json +235 -0
  103. package/src/cli/cmd/tui/context/theme/matrix.json +77 -0
  104. package/src/cli/cmd/tui/context/theme/mercury.json +252 -0
  105. package/src/cli/cmd/tui/context/theme/monokai.json +221 -0
  106. package/src/cli/cmd/tui/context/theme/nightowl.json +221 -0
  107. package/src/cli/cmd/tui/context/theme/nord.json +223 -0
  108. package/src/cli/cmd/tui/context/theme/one-dark.json +84 -0
  109. package/src/cli/cmd/tui/context/theme/orng.json +249 -0
  110. package/src/cli/cmd/tui/context/theme/osaka-jade.json +93 -0
  111. package/src/cli/cmd/tui/context/theme/palenight.json +222 -0
  112. package/src/cli/cmd/tui/context/theme/rosepine.json +234 -0
  113. package/src/cli/cmd/tui/context/theme/solarized.json +223 -0
  114. package/src/cli/cmd/tui/context/theme/synthwave84.json +226 -0
  115. package/src/cli/cmd/tui/context/theme/tokyonight.json +243 -0
  116. package/src/cli/cmd/tui/context/theme/vercel.json +245 -0
  117. package/src/cli/cmd/tui/context/theme/vesper.json +218 -0
  118. package/src/cli/cmd/tui/context/theme/zenburn.json +223 -0
  119. package/src/cli/cmd/tui/context/theme.tsx +1152 -0
  120. package/src/cli/cmd/tui/event.ts +48 -0
  121. package/src/cli/cmd/tui/routes/home.tsx +140 -0
  122. package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +64 -0
  123. package/src/cli/cmd/tui/routes/session/dialog-message.tsx +109 -0
  124. package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +26 -0
  125. package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +47 -0
  126. package/src/cli/cmd/tui/routes/session/footer.tsx +91 -0
  127. package/src/cli/cmd/tui/routes/session/header.tsx +142 -0
  128. package/src/cli/cmd/tui/routes/session/index.tsx +2048 -0
  129. package/src/cli/cmd/tui/routes/session/permission.tsx +508 -0
  130. package/src/cli/cmd/tui/routes/session/question.tsx +453 -0
  131. package/src/cli/cmd/tui/routes/session/sidebar.tsx +313 -0
  132. package/src/cli/cmd/tui/thread.ts +165 -0
  133. package/src/cli/cmd/tui/ui/dialog-alert.tsx +57 -0
  134. package/src/cli/cmd/tui/ui/dialog-confirm.tsx +83 -0
  135. package/src/cli/cmd/tui/ui/dialog-export-options.tsx +204 -0
  136. package/src/cli/cmd/tui/ui/dialog-help.tsx +38 -0
  137. package/src/cli/cmd/tui/ui/dialog-prompt.tsx +77 -0
  138. package/src/cli/cmd/tui/ui/dialog-select.tsx +385 -0
  139. package/src/cli/cmd/tui/ui/dialog.tsx +167 -0
  140. package/src/cli/cmd/tui/ui/link.tsx +28 -0
  141. package/src/cli/cmd/tui/ui/spinner.ts +368 -0
  142. package/src/cli/cmd/tui/ui/toast.tsx +100 -0
  143. package/src/cli/cmd/tui/util/clipboard.ts +160 -0
  144. package/src/cli/cmd/tui/util/editor.ts +32 -0
  145. package/src/cli/cmd/tui/util/signal.ts +7 -0
  146. package/src/cli/cmd/tui/util/terminal.ts +114 -0
  147. package/src/cli/cmd/tui/util/transcript.ts +98 -0
  148. package/src/cli/cmd/tui/worker.ts +152 -0
  149. package/src/cli/cmd/uninstall.ts +357 -0
  150. package/src/cli/cmd/upgrade.ts +73 -0
  151. package/src/cli/cmd/web.ts +81 -0
  152. package/src/cli/error.ts +57 -0
  153. package/src/cli/network.ts +53 -0
  154. package/src/cli/ui.ts +86 -0
  155. package/src/cli/upgrade.ts +25 -0
  156. package/src/command/index.ts +173 -0
  157. package/src/command/template/bloxy-resume.txt +15 -0
  158. package/src/command/template/bloxy-status.txt +25 -0
  159. package/src/command/template/bloxy-validate.txt +22 -0
  160. package/src/command/template/bloxy.txt +14 -0
  161. package/src/command/template/initialize.txt +10 -0
  162. package/src/command/template/review.txt +99 -0
  163. package/src/config/config.ts +1367 -0
  164. package/src/config/markdown.ts +93 -0
  165. package/src/env/index.ts +26 -0
  166. package/src/file/ignore.ts +83 -0
  167. package/src/file/index.ts +415 -0
  168. package/src/file/ripgrep.ts +407 -0
  169. package/src/file/time.ts +69 -0
  170. package/src/file/watcher.ts +127 -0
  171. package/src/flag/flag.ts +79 -0
  172. package/src/format/formatter.ts +357 -0
  173. package/src/format/index.ts +137 -0
  174. package/src/global/index.ts +55 -0
  175. package/src/id/id.ts +83 -0
  176. package/src/ide/index.ts +76 -0
  177. package/src/index.ts +159 -0
  178. package/src/installation/index.ts +246 -0
  179. package/src/lsp/client.ts +252 -0
  180. package/src/lsp/index.ts +485 -0
  181. package/src/lsp/language.ts +119 -0
  182. package/src/lsp/server.ts +2046 -0
  183. package/src/mcp/auth.ts +135 -0
  184. package/src/mcp/index.ts +934 -0
  185. package/src/mcp/oauth-callback.ts +200 -0
  186. package/src/mcp/oauth-provider.ts +154 -0
  187. package/src/patch/index.ts +680 -0
  188. package/src/permission/arity.ts +163 -0
  189. package/src/permission/index.ts +210 -0
  190. package/src/permission/next.ts +280 -0
  191. package/src/plugin/antigravity.ts +378 -0
  192. package/src/plugin/codex.ts +506 -0
  193. package/src/plugin/copilot.ts +298 -0
  194. package/src/plugin/index.ts +136 -0
  195. package/src/project/bootstrap.ts +35 -0
  196. package/src/project/instance.ts +91 -0
  197. package/src/project/project.ts +371 -0
  198. package/src/project/state.ts +66 -0
  199. package/src/project/vcs.ts +76 -0
  200. package/src/provider/auth.ts +147 -0
  201. package/src/provider/models-snapshot.ts +2 -0
  202. package/src/provider/models.ts +133 -0
  203. package/src/provider/provider.ts +1241 -0
  204. package/src/provider/sdk/openai-compatible/src/README.md +5 -0
  205. package/src/provider/sdk/openai-compatible/src/index.ts +2 -0
  206. package/src/provider/sdk/openai-compatible/src/openai-compatible-provider.ts +100 -0
  207. package/src/provider/sdk/openai-compatible/src/responses/convert-to-openai-responses-input.ts +303 -0
  208. package/src/provider/sdk/openai-compatible/src/responses/map-openai-responses-finish-reason.ts +22 -0
  209. package/src/provider/sdk/openai-compatible/src/responses/openai-config.ts +18 -0
  210. package/src/provider/sdk/openai-compatible/src/responses/openai-error.ts +22 -0
  211. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-api-types.ts +207 -0
  212. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts +1732 -0
  213. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-prepare-tools.ts +177 -0
  214. package/src/provider/sdk/openai-compatible/src/responses/openai-responses-settings.ts +1 -0
  215. package/src/provider/sdk/openai-compatible/src/responses/tool/code-interpreter.ts +88 -0
  216. package/src/provider/sdk/openai-compatible/src/responses/tool/file-search.ts +128 -0
  217. package/src/provider/sdk/openai-compatible/src/responses/tool/image-generation.ts +115 -0
  218. package/src/provider/sdk/openai-compatible/src/responses/tool/local-shell.ts +65 -0
  219. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search-preview.ts +104 -0
  220. package/src/provider/sdk/openai-compatible/src/responses/tool/web-search.ts +103 -0
  221. package/src/provider/transform.ts +741 -0
  222. package/src/pty/index.ts +241 -0
  223. package/src/question/index.ts +171 -0
  224. package/src/scheduler/index.ts +61 -0
  225. package/src/server/error.ts +36 -0
  226. package/src/server/event.ts +7 -0
  227. package/src/server/mdns.ts +59 -0
  228. package/src/server/routes/config.ts +92 -0
  229. package/src/server/routes/experimental.ts +208 -0
  230. package/src/server/routes/file.ts +197 -0
  231. package/src/server/routes/global.ts +135 -0
  232. package/src/server/routes/mcp.ts +225 -0
  233. package/src/server/routes/permission.ts +68 -0
  234. package/src/server/routes/project.ts +82 -0
  235. package/src/server/routes/provider.ts +165 -0
  236. package/src/server/routes/pty.ts +169 -0
  237. package/src/server/routes/question.ts +98 -0
  238. package/src/server/routes/session.ts +939 -0
  239. package/src/server/routes/tui.ts +379 -0
  240. package/src/server/server.ts +604 -0
  241. package/src/session/compaction.ts +225 -0
  242. package/src/session/fallback.ts +246 -0
  243. package/src/session/index.ts +498 -0
  244. package/src/session/instruction.ts +164 -0
  245. package/src/session/llm.ts +298 -0
  246. package/src/session/message-v2.ts +747 -0
  247. package/src/session/message.ts +189 -0
  248. package/src/session/processor.ts +450 -0
  249. package/src/session/prompt/anthropic-20250930.txt +166 -0
  250. package/src/session/prompt/anthropic.txt +105 -0
  251. package/src/session/prompt/beast.txt +147 -0
  252. package/src/session/prompt/build-switch.txt +5 -0
  253. package/src/session/prompt/codex_header.txt +79 -0
  254. package/src/session/prompt/copilot-gpt-5.txt +143 -0
  255. package/src/session/prompt/gemini.txt +155 -0
  256. package/src/session/prompt/max-steps.txt +16 -0
  257. package/src/session/prompt/plan-reminder-anthropic.txt +67 -0
  258. package/src/session/prompt/plan.txt +26 -0
  259. package/src/session/prompt/qwen.txt +109 -0
  260. package/src/session/prompt.ts +1822 -0
  261. package/src/session/retry.ts +99 -0
  262. package/src/session/revert.ts +121 -0
  263. package/src/session/status.ts +100 -0
  264. package/src/session/summary.ts +217 -0
  265. package/src/session/system.ts +52 -0
  266. package/src/session/todo.ts +37 -0
  267. package/src/share/share-next.ts +200 -0
  268. package/src/share/share.ts +92 -0
  269. package/src/shell/shell.ts +67 -0
  270. package/src/skill/index.ts +1 -0
  271. package/src/skill/skill.ts +135 -0
  272. package/src/snapshot/index.ts +236 -0
  273. package/src/storage/storage.ts +227 -0
  274. package/src/tool/apply_patch.ts +281 -0
  275. package/src/tool/apply_patch.txt +33 -0
  276. package/src/tool/bash.ts +258 -0
  277. package/src/tool/bash.txt +115 -0
  278. package/src/tool/batch.ts +175 -0
  279. package/src/tool/batch.txt +24 -0
  280. package/src/tool/bloxy-control.ts +123 -0
  281. package/src/tool/bloxy-control.txt +13 -0
  282. package/src/tool/codesearch.ts +132 -0
  283. package/src/tool/codesearch.txt +12 -0
  284. package/src/tool/edit.ts +655 -0
  285. package/src/tool/edit.txt +10 -0
  286. package/src/tool/external-directory.ts +32 -0
  287. package/src/tool/glob.ts +77 -0
  288. package/src/tool/glob.txt +6 -0
  289. package/src/tool/grep.ts +154 -0
  290. package/src/tool/grep.txt +8 -0
  291. package/src/tool/invalid.ts +17 -0
  292. package/src/tool/ls.ts +121 -0
  293. package/src/tool/ls.txt +1 -0
  294. package/src/tool/lsp.ts +96 -0
  295. package/src/tool/lsp.txt +19 -0
  296. package/src/tool/multiedit.ts +46 -0
  297. package/src/tool/multiedit.txt +41 -0
  298. package/src/tool/plan-enter.txt +14 -0
  299. package/src/tool/plan-exit.txt +13 -0
  300. package/src/tool/plan.ts +130 -0
  301. package/src/tool/question.ts +33 -0
  302. package/src/tool/question.txt +10 -0
  303. package/src/tool/read.ts +211 -0
  304. package/src/tool/read.txt +12 -0
  305. package/src/tool/registry.ts +161 -0
  306. package/src/tool/skill.ts +82 -0
  307. package/src/tool/task.ts +191 -0
  308. package/src/tool/task.txt +60 -0
  309. package/src/tool/todo.ts +53 -0
  310. package/src/tool/todoread.txt +14 -0
  311. package/src/tool/todowrite.txt +167 -0
  312. package/src/tool/tool.ts +89 -0
  313. package/src/tool/truncation.ts +106 -0
  314. package/src/tool/webfetch.ts +188 -0
  315. package/src/tool/webfetch.txt +13 -0
  316. package/src/tool/websearch.ts +150 -0
  317. package/src/tool/websearch.txt +14 -0
  318. package/src/tool/write.ts +85 -0
  319. package/src/tool/write.txt +8 -0
  320. package/src/util/archive.ts +16 -0
  321. package/src/util/binary.ts +41 -0
  322. package/src/util/color.ts +19 -0
  323. package/src/util/context.ts +25 -0
  324. package/src/util/defer.ts +12 -0
  325. package/src/util/error.ts +54 -0
  326. package/src/util/eventloop.ts +20 -0
  327. package/src/util/filesystem.ts +93 -0
  328. package/src/util/fn.ts +11 -0
  329. package/src/util/format.ts +20 -0
  330. package/src/util/iife.ts +3 -0
  331. package/src/util/keybind.ts +103 -0
  332. package/src/util/lazy.ts +23 -0
  333. package/src/util/locale.ts +81 -0
  334. package/src/util/lock.ts +98 -0
  335. package/src/util/log.ts +180 -0
  336. package/src/util/queue.ts +32 -0
  337. package/src/util/rpc.ts +66 -0
  338. package/src/util/scrap.ts +10 -0
  339. package/src/util/signal.ts +12 -0
  340. package/src/util/slug.ts +74 -0
  341. package/src/util/timeout.ts +14 -0
  342. package/src/util/token.ts +7 -0
  343. package/src/util/wildcard.ts +56 -0
  344. package/src/worktree/index.ts +549 -0
@@ -0,0 +1,771 @@
1
+ import { render, useKeyboard, useRenderer, useTerminalDimensions } from "@opentui/solid"
2
+ import { Clipboard } from "@tui/util/clipboard"
3
+ import { TextAttributes } from "@opentui/core"
4
+ import { RouteProvider, useRoute } from "@tui/context/route"
5
+ import { Switch, Match, createEffect, untrack, ErrorBoundary, createSignal, onMount, batch, Show, on } from "solid-js"
6
+ import { Installation } from "@/installation"
7
+ import { Flag } from "@/flag/flag"
8
+ import { DialogProvider, useDialog } from "@tui/ui/dialog"
9
+ import { DialogProvider as DialogProviderList } from "@tui/component/dialog-provider"
10
+ import { SDKProvider, useSDK } from "@tui/context/sdk"
11
+ import { SyncProvider, useSync } from "@tui/context/sync"
12
+ import { LocalProvider, useLocal } from "@tui/context/local"
13
+ import { DialogModel, useConnected } from "@tui/component/dialog-model"
14
+ import { DialogMcp } from "@tui/component/dialog-mcp"
15
+ import { DialogStatus } from "@tui/component/dialog-status"
16
+ import { DialogThemeList } from "@tui/component/dialog-theme-list"
17
+ import { DialogHelp } from "./ui/dialog-help"
18
+ import { CommandProvider, useCommandDialog } from "@tui/component/dialog-command"
19
+ import { DialogAgent } from "@tui/component/dialog-agent"
20
+ import { DialogSessionList } from "@tui/component/dialog-session-list"
21
+ import { KeybindProvider } from "@tui/context/keybind"
22
+ import { ThemeProvider, useTheme } from "@tui/context/theme"
23
+ import { Home } from "@tui/routes/home"
24
+ import { Session } from "@tui/routes/session"
25
+ import { PromptHistoryProvider } from "./component/prompt/history"
26
+ import { FrecencyProvider } from "./component/prompt/frecency"
27
+ import { PromptStashProvider } from "./component/prompt/stash"
28
+ import { DialogAlert } from "./ui/dialog-alert"
29
+ import { ToastProvider, useToast } from "./ui/toast"
30
+ import { ExitProvider, useExit } from "./context/exit"
31
+ import { Session as SessionApi } from "@/session"
32
+ import { TuiEvent } from "./event"
33
+ import { KVProvider, useKV } from "./context/kv"
34
+ import { Provider } from "@/provider/provider"
35
+ import { ArgsProvider, useArgs, type Args } from "./context/args"
36
+ import open from "open"
37
+ import { writeHeapSnapshot } from "v8"
38
+ import { PromptRefProvider, usePromptRef } from "./context/prompt"
39
+
40
+ async function getTerminalBackgroundColor(): Promise<"dark" | "light"> {
41
+ // can't set raw mode if not a TTY
42
+ if (!process.stdin.isTTY) return "dark"
43
+
44
+ return new Promise((resolve) => {
45
+ let timeout: NodeJS.Timeout
46
+
47
+ const cleanup = () => {
48
+ process.stdin.setRawMode(false)
49
+ process.stdin.removeListener("data", handler)
50
+ clearTimeout(timeout)
51
+ }
52
+
53
+ const handler = (data: Buffer) => {
54
+ const str = data.toString()
55
+ const match = str.match(/\x1b]11;([^\x07\x1b]+)/)
56
+ if (match) {
57
+ cleanup()
58
+ const color = match[1]
59
+ // Parse RGB values from color string
60
+ // Formats: rgb:RR/GG/BB or #RRGGBB or rgb(R,G,B)
61
+ let r = 0,
62
+ g = 0,
63
+ b = 0
64
+
65
+ if (color.startsWith("rgb:")) {
66
+ const parts = color.substring(4).split("/")
67
+ r = parseInt(parts[0], 16) >> 8 // Convert 16-bit to 8-bit
68
+ g = parseInt(parts[1], 16) >> 8 // Convert 16-bit to 8-bit
69
+ b = parseInt(parts[2], 16) >> 8 // Convert 16-bit to 8-bit
70
+ } else if (color.startsWith("#")) {
71
+ r = parseInt(color.substring(1, 3), 16)
72
+ g = parseInt(color.substring(3, 5), 16)
73
+ b = parseInt(color.substring(5, 7), 16)
74
+ } else if (color.startsWith("rgb(")) {
75
+ const parts = color.substring(4, color.length - 1).split(",")
76
+ r = parseInt(parts[0])
77
+ g = parseInt(parts[1])
78
+ b = parseInt(parts[2])
79
+ }
80
+
81
+ // Calculate luminance using relative luminance formula
82
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255
83
+
84
+ // Determine if dark or light based on luminance threshold
85
+ resolve(luminance > 0.5 ? "light" : "dark")
86
+ }
87
+ }
88
+
89
+ process.stdin.setRawMode(true)
90
+ process.stdin.on("data", handler)
91
+ process.stdout.write("\x1b]11;?\x07")
92
+
93
+ timeout = setTimeout(() => {
94
+ cleanup()
95
+ resolve("dark")
96
+ }, 1000)
97
+ })
98
+ }
99
+
100
+ import type { EventSource } from "./context/sdk"
101
+
102
+ export function tui(input: {
103
+ url: string
104
+ args: Args
105
+ directory?: string
106
+ fetch?: typeof fetch
107
+ events?: EventSource
108
+ onExit?: () => Promise<void>
109
+ }) {
110
+ // promise to prevent immediate exit
111
+ return new Promise<void>(async (resolve) => {
112
+ const mode = await getTerminalBackgroundColor()
113
+ const onExit = async () => {
114
+ await input.onExit?.()
115
+ resolve()
116
+ }
117
+
118
+ render(
119
+ () => {
120
+ return (
121
+ <ErrorBoundary
122
+ fallback={(error, reset) => <ErrorComponent error={error} reset={reset} onExit={onExit} mode={mode} />}
123
+ >
124
+ <ArgsProvider {...input.args}>
125
+ <ExitProvider onExit={onExit}>
126
+ <KVProvider>
127
+ <ToastProvider>
128
+ <RouteProvider>
129
+ <SDKProvider
130
+ url={input.url}
131
+ directory={input.directory}
132
+ fetch={input.fetch}
133
+ events={input.events}
134
+ >
135
+ <SyncProvider>
136
+ <ThemeProvider mode={mode}>
137
+ <LocalProvider>
138
+ <KeybindProvider>
139
+ <PromptStashProvider>
140
+ <DialogProvider>
141
+ <CommandProvider>
142
+ <FrecencyProvider>
143
+ <PromptHistoryProvider>
144
+ <PromptRefProvider>
145
+ <App />
146
+ </PromptRefProvider>
147
+ </PromptHistoryProvider>
148
+ </FrecencyProvider>
149
+ </CommandProvider>
150
+ </DialogProvider>
151
+ </PromptStashProvider>
152
+ </KeybindProvider>
153
+ </LocalProvider>
154
+ </ThemeProvider>
155
+ </SyncProvider>
156
+ </SDKProvider>
157
+ </RouteProvider>
158
+ </ToastProvider>
159
+ </KVProvider>
160
+ </ExitProvider>
161
+ </ArgsProvider>
162
+ </ErrorBoundary>
163
+ )
164
+ },
165
+ {
166
+ targetFps: 60,
167
+ gatherStats: false,
168
+ exitOnCtrlC: false,
169
+ useKittyKeyboard: {},
170
+ consoleOptions: {
171
+ keyBindings: [{ name: "y", ctrl: true, action: "copy-selection" }],
172
+ onCopySelection: (text) => {
173
+ Clipboard.copy(text).catch((error) => {
174
+ console.error(`Failed to copy console selection to clipboard: ${error}`)
175
+ })
176
+ },
177
+ },
178
+ },
179
+ )
180
+ })
181
+ }
182
+
183
+ function App() {
184
+ const route = useRoute()
185
+ const dimensions = useTerminalDimensions()
186
+ const renderer = useRenderer()
187
+ renderer.disableStdoutInterception()
188
+ const dialog = useDialog()
189
+ const local = useLocal()
190
+ const kv = useKV()
191
+ const command = useCommandDialog()
192
+ const sdk = useSDK()
193
+ const toast = useToast()
194
+ const { theme, mode, setMode } = useTheme()
195
+ const sync = useSync()
196
+ const exit = useExit()
197
+ const promptRef = usePromptRef()
198
+
199
+ // Wire up console copy-to-clipboard via opentui's onCopySelection callback
200
+ renderer.console.onCopySelection = async (text: string) => {
201
+ if (!text || text.length === 0) return
202
+
203
+ await Clipboard.copy(text)
204
+ .then(() => toast.show({ message: "Copied to clipboard", variant: "info" }))
205
+ .catch(toast.error)
206
+ renderer.clearSelection()
207
+ }
208
+ const [terminalTitleEnabled, setTerminalTitleEnabled] = createSignal(kv.get("terminal_title_enabled", true))
209
+
210
+ createEffect(() => {
211
+ console.log(JSON.stringify(route.data))
212
+ })
213
+
214
+ // Update terminal window title based on current route and session
215
+ createEffect(() => {
216
+ if (!terminalTitleEnabled() || Flag.BLOXYCODE_DISABLE_TERMINAL_TITLE) return
217
+
218
+ if (route.data.type === "home") {
219
+ renderer.setTerminalTitle("BloxyCode")
220
+ return
221
+ }
222
+
223
+ if (route.data.type === "session") {
224
+ const session = sync.session.get(route.data.sessionID)
225
+ if (!session || SessionApi.isDefaultTitle(session.title)) {
226
+ renderer.setTerminalTitle("BloxyCode")
227
+ return
228
+ }
229
+
230
+ // Truncate title to 40 chars max
231
+ const title = session.title.length > 40 ? session.title.slice(0, 37) + "..." : session.title
232
+ renderer.setTerminalTitle(`OC | ${title}`)
233
+ }
234
+ })
235
+
236
+ const args = useArgs()
237
+ onMount(() => {
238
+ batch(() => {
239
+ if (args.agent) local.agent.set(args.agent)
240
+ if (args.model) {
241
+ const { providerID, modelID } = Provider.parseModel(args.model)
242
+ if (!providerID || !modelID)
243
+ return toast.show({
244
+ variant: "warning",
245
+ message: `Invalid model format: ${args.model}`,
246
+ duration: 3000,
247
+ })
248
+ local.model.set({ providerID, modelID }, { recent: true })
249
+ }
250
+ if (args.sessionID) {
251
+ route.navigate({
252
+ type: "session",
253
+ sessionID: args.sessionID,
254
+ })
255
+ }
256
+ })
257
+ })
258
+
259
+ let continued = false
260
+ createEffect(() => {
261
+ // When using -c, session list is loaded in blocking phase, so we can navigate at "partial"
262
+ if (continued || sync.status === "loading" || !args.continue) return
263
+ const match = sync.data.session
264
+ .toSorted((a, b) => b.time.updated - a.time.updated)
265
+ .find((x) => x.parentID === undefined)?.id
266
+ if (match) {
267
+ continued = true
268
+ route.navigate({ type: "session", sessionID: match })
269
+ }
270
+ })
271
+
272
+ createEffect(
273
+ on(
274
+ () => sync.status === "complete" && sync.data.provider.length === 0,
275
+ (isEmpty, wasEmpty) => {
276
+ // only trigger when we transition into an empty-provider state
277
+ if (!isEmpty || wasEmpty) return
278
+ dialog.replace(() => <DialogProviderList />)
279
+ },
280
+ ),
281
+ )
282
+
283
+ const connected = useConnected()
284
+ command.register(() => [
285
+ {
286
+ title: "Switch session",
287
+ value: "session.list",
288
+ keybind: "session_list",
289
+ category: "Session",
290
+ suggested: sync.data.session.length > 0,
291
+ slash: {
292
+ name: "sessions",
293
+ aliases: ["resume", "continue"],
294
+ },
295
+ onSelect: () => {
296
+ dialog.replace(() => <DialogSessionList />)
297
+ },
298
+ },
299
+ {
300
+ title: "New session",
301
+ suggested: route.data.type === "session",
302
+ value: "session.new",
303
+ keybind: "session_new",
304
+ category: "Session",
305
+ slash: {
306
+ name: "new",
307
+ aliases: ["clear"],
308
+ },
309
+ onSelect: () => {
310
+ const current = promptRef.current
311
+ // Don't require focus - if there's any text, preserve it
312
+ const currentPrompt = current?.current?.input ? current.current : undefined
313
+ route.navigate({
314
+ type: "home",
315
+ initialPrompt: currentPrompt,
316
+ })
317
+ dialog.clear()
318
+ },
319
+ },
320
+ {
321
+ title: "Switch model",
322
+ value: "model.list",
323
+ keybind: "model_list",
324
+ suggested: true,
325
+ category: "Agent",
326
+ slash: {
327
+ name: "models",
328
+ },
329
+ onSelect: () => {
330
+ dialog.replace(() => <DialogModel />)
331
+ },
332
+ },
333
+ {
334
+ title: "Model cycle",
335
+ value: "model.cycle_recent",
336
+ keybind: "model_cycle_recent",
337
+ category: "Agent",
338
+ hidden: true,
339
+ onSelect: () => {
340
+ local.model.cycle(1)
341
+ },
342
+ },
343
+ {
344
+ title: "Model cycle reverse",
345
+ value: "model.cycle_recent_reverse",
346
+ keybind: "model_cycle_recent_reverse",
347
+ category: "Agent",
348
+ hidden: true,
349
+ onSelect: () => {
350
+ local.model.cycle(-1)
351
+ },
352
+ },
353
+ {
354
+ title: "Favorite cycle",
355
+ value: "model.cycle_favorite",
356
+ keybind: "model_cycle_favorite",
357
+ category: "Agent",
358
+ hidden: true,
359
+ onSelect: () => {
360
+ local.model.cycleFavorite(1)
361
+ },
362
+ },
363
+ {
364
+ title: "Favorite cycle reverse",
365
+ value: "model.cycle_favorite_reverse",
366
+ keybind: "model_cycle_favorite_reverse",
367
+ category: "Agent",
368
+ hidden: true,
369
+ onSelect: () => {
370
+ local.model.cycleFavorite(-1)
371
+ },
372
+ },
373
+ {
374
+ title: "Switch agent",
375
+ value: "agent.list",
376
+ keybind: "agent_list",
377
+ category: "Agent",
378
+ slash: {
379
+ name: "agents",
380
+ },
381
+ onSelect: () => {
382
+ dialog.replace(() => <DialogAgent />)
383
+ },
384
+ },
385
+ {
386
+ title: "Toggle MCPs",
387
+ value: "mcp.list",
388
+ category: "Agent",
389
+ slash: {
390
+ name: "mcps",
391
+ },
392
+ onSelect: () => {
393
+ dialog.replace(() => <DialogMcp />)
394
+ },
395
+ },
396
+ {
397
+ title: "Agent cycle",
398
+ value: "agent.cycle",
399
+ keybind: "agent_cycle",
400
+ category: "Agent",
401
+ hidden: true,
402
+ onSelect: () => {
403
+ local.agent.move(1)
404
+ },
405
+ },
406
+ {
407
+ title: "Variant cycle",
408
+ value: "variant.cycle",
409
+ keybind: "variant_cycle",
410
+ category: "Agent",
411
+ hidden: true,
412
+ onSelect: () => {
413
+ local.model.variant.cycle()
414
+ },
415
+ },
416
+ {
417
+ title: "Agent cycle reverse",
418
+ value: "agent.cycle.reverse",
419
+ keybind: "agent_cycle_reverse",
420
+ category: "Agent",
421
+ hidden: true,
422
+ onSelect: () => {
423
+ local.agent.move(-1)
424
+ },
425
+ },
426
+ {
427
+ title: "Connect provider",
428
+ value: "provider.connect",
429
+ suggested: !connected(),
430
+ slash: {
431
+ name: "connect",
432
+ },
433
+ onSelect: () => {
434
+ dialog.replace(() => <DialogProviderList />)
435
+ },
436
+ category: "Provider",
437
+ },
438
+ {
439
+ title: "View status",
440
+ keybind: "status_view",
441
+ value: "opencode.status",
442
+ slash: {
443
+ name: "status",
444
+ },
445
+ onSelect: () => {
446
+ dialog.replace(() => <DialogStatus />)
447
+ },
448
+ category: "System",
449
+ },
450
+ {
451
+ title: "Switch theme",
452
+ value: "theme.switch",
453
+ keybind: "theme_list",
454
+ slash: {
455
+ name: "themes",
456
+ },
457
+ onSelect: () => {
458
+ dialog.replace(() => <DialogThemeList />)
459
+ },
460
+ category: "System",
461
+ },
462
+ {
463
+ title: "Toggle appearance",
464
+ value: "theme.switch_mode",
465
+ onSelect: (dialog) => {
466
+ setMode(mode() === "dark" ? "light" : "dark")
467
+ dialog.clear()
468
+ },
469
+ category: "System",
470
+ },
471
+ {
472
+ title: "Help",
473
+ value: "help.show",
474
+ slash: {
475
+ name: "help",
476
+ },
477
+ onSelect: () => {
478
+ dialog.replace(() => <DialogHelp />)
479
+ },
480
+ category: "System",
481
+ },
482
+ {
483
+ title: "Open docs",
484
+ value: "docs.open",
485
+ onSelect: () => {
486
+ open("https://opencode.ai/docs").catch(() => {})
487
+ dialog.clear()
488
+ },
489
+ category: "System",
490
+ },
491
+ {
492
+ title: "Exit the app",
493
+ value: "app.exit",
494
+ slash: {
495
+ name: "exit",
496
+ aliases: ["quit", "q"],
497
+ },
498
+ onSelect: () => exit(),
499
+ category: "System",
500
+ },
501
+ {
502
+ title: "Toggle debug panel",
503
+ category: "System",
504
+ value: "app.debug",
505
+ onSelect: (dialog) => {
506
+ renderer.toggleDebugOverlay()
507
+ dialog.clear()
508
+ },
509
+ },
510
+ {
511
+ title: "Toggle console",
512
+ category: "System",
513
+ value: "app.console",
514
+ onSelect: (dialog) => {
515
+ renderer.console.toggle()
516
+ dialog.clear()
517
+ },
518
+ },
519
+ {
520
+ title: "Write heap snapshot",
521
+ category: "System",
522
+ value: "app.heap_snapshot",
523
+ onSelect: (dialog) => {
524
+ const path = writeHeapSnapshot()
525
+ toast.show({
526
+ variant: "info",
527
+ message: `Heap snapshot written to ${path}`,
528
+ duration: 5000,
529
+ })
530
+ dialog.clear()
531
+ },
532
+ },
533
+ {
534
+ title: "Suspend terminal",
535
+ value: "terminal.suspend",
536
+ keybind: "terminal_suspend",
537
+ category: "System",
538
+ hidden: true,
539
+ onSelect: () => {
540
+ process.once("SIGCONT", () => {
541
+ renderer.resume()
542
+ })
543
+
544
+ renderer.suspend()
545
+ // pid=0 means send the signal to all processes in the process group
546
+ process.kill(0, "SIGTSTP")
547
+ },
548
+ },
549
+ {
550
+ title: terminalTitleEnabled() ? "Disable terminal title" : "Enable terminal title",
551
+ value: "terminal.title.toggle",
552
+ keybind: "terminal_title_toggle",
553
+ category: "System",
554
+ onSelect: (dialog) => {
555
+ setTerminalTitleEnabled((prev) => {
556
+ const next = !prev
557
+ kv.set("terminal_title_enabled", next)
558
+ if (!next) renderer.setTerminalTitle("")
559
+ return next
560
+ })
561
+ dialog.clear()
562
+ },
563
+ },
564
+ {
565
+ title: kv.get("animations_enabled", true) ? "Disable animations" : "Enable animations",
566
+ value: "app.toggle.animations",
567
+ category: "System",
568
+ onSelect: (dialog) => {
569
+ kv.set("animations_enabled", !kv.get("animations_enabled", true))
570
+ dialog.clear()
571
+ },
572
+ },
573
+ {
574
+ title: kv.get("diff_wrap_mode", "word") === "word" ? "Disable diff wrapping" : "Enable diff wrapping",
575
+ value: "app.toggle.diffwrap",
576
+ category: "System",
577
+ onSelect: (dialog) => {
578
+ const current = kv.get("diff_wrap_mode", "word")
579
+ kv.set("diff_wrap_mode", current === "word" ? "none" : "word")
580
+ dialog.clear()
581
+ },
582
+ },
583
+ ])
584
+
585
+ createEffect(() => {
586
+ const currentModel = local.model.current()
587
+ if (!currentModel) return
588
+ if (currentModel.providerID === "openrouter" && !kv.get("openrouter_warning", false)) {
589
+ untrack(() => {
590
+ DialogAlert.show(
591
+ dialog,
592
+ "Warning",
593
+ "While openrouter is a convenient way to access LLMs your request will often be routed to subpar providers that do not work well in our testing.\n\nFor reliable access to models check out BloxyCode Zen\nhttps://opencode.ai/zen",
594
+ ).then(() => kv.set("openrouter_warning", true))
595
+ })
596
+ }
597
+ })
598
+
599
+ sdk.event.on(TuiEvent.CommandExecute.type, (evt) => {
600
+ command.trigger(evt.properties.command)
601
+ })
602
+
603
+ sdk.event.on(TuiEvent.ToastShow.type, (evt) => {
604
+ toast.show({
605
+ title: evt.properties.title,
606
+ message: evt.properties.message,
607
+ variant: evt.properties.variant,
608
+ duration: evt.properties.duration,
609
+ })
610
+ })
611
+
612
+ sdk.event.on(TuiEvent.SessionSelect.type, (evt) => {
613
+ route.navigate({
614
+ type: "session",
615
+ sessionID: evt.properties.sessionID,
616
+ })
617
+ })
618
+
619
+ sdk.event.on(SessionApi.Event.Deleted.type, (evt) => {
620
+ if (route.data.type === "session" && route.data.sessionID === evt.properties.info.id) {
621
+ route.navigate({ type: "home" })
622
+ toast.show({
623
+ variant: "info",
624
+ message: "The current session was deleted",
625
+ })
626
+ }
627
+ })
628
+
629
+ sdk.event.on(SessionApi.Event.Error.type, (evt) => {
630
+ const error = evt.properties.error
631
+ if (error && typeof error === "object" && error.name === "MessageAbortedError") return
632
+ const message = (() => {
633
+ if (!error) return "An error occurred"
634
+
635
+ if (typeof error === "object") {
636
+ const data = error.data
637
+ if ("message" in data && typeof data.message === "string") {
638
+ return data.message
639
+ }
640
+ }
641
+ return String(error)
642
+ })()
643
+
644
+ toast.show({
645
+ variant: "error",
646
+ message,
647
+ duration: 5000,
648
+ })
649
+ })
650
+
651
+ sdk.event.on(Installation.Event.UpdateAvailable.type, (evt) => {
652
+ toast.show({
653
+ variant: "info",
654
+ title: "Update Available",
655
+ message: `BloxyCode v${evt.properties.version} is available. Run 'bloxycode upgrade' to update manually.`,
656
+ duration: 10000,
657
+ })
658
+ })
659
+
660
+ return (
661
+ <box
662
+ width={dimensions().width}
663
+ height={dimensions().height}
664
+ backgroundColor={theme.background}
665
+ onMouseUp={async () => {
666
+ if (Flag.BLOXYCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT) {
667
+ renderer.clearSelection()
668
+ return
669
+ }
670
+ const text = renderer.getSelection()?.getSelectedText()
671
+ if (text && text.length > 0) {
672
+ await Clipboard.copy(text)
673
+ .then(() => toast.show({ message: "Copied to clipboard", variant: "info" }))
674
+ .catch(toast.error)
675
+ renderer.clearSelection()
676
+ }
677
+ }}
678
+ >
679
+ <Switch>
680
+ <Match when={route.data.type === "home"}>
681
+ <Home />
682
+ </Match>
683
+ <Match when={route.data.type === "session"}>
684
+ <Session />
685
+ </Match>
686
+ </Switch>
687
+ </box>
688
+ )
689
+ }
690
+
691
+ function ErrorComponent(props: {
692
+ error: Error
693
+ reset: () => void
694
+ onExit: () => Promise<void>
695
+ mode?: "dark" | "light"
696
+ }) {
697
+ const term = useTerminalDimensions()
698
+ const renderer = useRenderer()
699
+
700
+ const handleExit = async () => {
701
+ renderer.setTerminalTitle("")
702
+ renderer.destroy()
703
+ props.onExit()
704
+ }
705
+
706
+ useKeyboard((evt) => {
707
+ if (evt.ctrl && evt.name === "c") {
708
+ handleExit()
709
+ }
710
+ })
711
+ const [copied, setCopied] = createSignal(false)
712
+
713
+ const issueURL = new URL("https://github.com/bloxystudios/bloxycode/issues/new?template=bug-report.yml")
714
+
715
+ // Choose safe fallback colors per mode since theme context may not be available
716
+ const isLight = props.mode === "light"
717
+ const colors = {
718
+ bg: isLight ? "#ffffff" : "#0a0a0a",
719
+ text: isLight ? "#1a1a1a" : "#eeeeee",
720
+ muted: isLight ? "#8a8a8a" : "#808080",
721
+ primary: isLight ? "#3b7dd8" : "#fab283",
722
+ }
723
+
724
+ if (props.error.message) {
725
+ issueURL.searchParams.set("title", `opentui: fatal: ${props.error.message}`)
726
+ }
727
+
728
+ if (props.error.stack) {
729
+ issueURL.searchParams.set(
730
+ "description",
731
+ "```\n" + props.error.stack.substring(0, 6000 - issueURL.toString().length) + "...\n```",
732
+ )
733
+ }
734
+
735
+ issueURL.searchParams.set("opencode-version", Installation.VERSION)
736
+
737
+ const copyIssueURL = () => {
738
+ Clipboard.copy(issueURL.toString()).then(() => {
739
+ setCopied(true)
740
+ })
741
+ }
742
+
743
+ return (
744
+ <box flexDirection="column" gap={1} backgroundColor={colors.bg}>
745
+ <box flexDirection="row" gap={1} alignItems="center">
746
+ <text attributes={TextAttributes.BOLD} fg={colors.text}>
747
+ Please report an issue.
748
+ </text>
749
+ <box onMouseUp={copyIssueURL} backgroundColor={colors.primary} padding={1}>
750
+ <text attributes={TextAttributes.BOLD} fg={colors.bg}>
751
+ Copy issue URL (exception info pre-filled)
752
+ </text>
753
+ </box>
754
+ {copied() && <text fg={colors.muted}>Successfully copied</text>}
755
+ </box>
756
+ <box flexDirection="row" gap={2} alignItems="center">
757
+ <text fg={colors.text}>A fatal error occurred!</text>
758
+ <box onMouseUp={props.reset} backgroundColor={colors.primary} padding={1}>
759
+ <text fg={colors.bg}>Reset TUI</text>
760
+ </box>
761
+ <box onMouseUp={handleExit} backgroundColor={colors.primary} padding={1}>
762
+ <text fg={colors.bg}>Exit</text>
763
+ </box>
764
+ </box>
765
+ <scrollbox height={Math.floor(term().height * 0.7)}>
766
+ <text fg={colors.muted}>{props.error.stack}</text>
767
+ </scrollbox>
768
+ <text fg={colors.text}>{props.error.message}</text>
769
+ </box>
770
+ )
771
+ }